JPH01309129A - Microprocessor - Google Patents
MicroprocessorInfo
- Publication number
- JPH01309129A JPH01309129A JP63139235A JP13923588A JPH01309129A JP H01309129 A JPH01309129 A JP H01309129A JP 63139235 A JP63139235 A JP 63139235A JP 13923588 A JP13923588 A JP 13923588A JP H01309129 A JPH01309129 A JP H01309129A
- Authority
- JP
- Japan
- Prior art keywords
- data
- flags
- arithmetic
- flag
- unsigned
- 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
Landscapes
- Executing Machine-Instructions (AREA)
Abstract
Description
【発明の詳細な説明】
[発明の目的]
(産業上の利用分野)
この発明は複数のデータ間の演算を実行する機能を持つ
マイクロプロセッサに関し、特に同プロセッサにおける
、演算結果の大小や一致等の条件フラグの出力機構の改
良に関する。[Detailed Description of the Invention] [Objective of the Invention] (Industrial Application Field) The present invention relates to a microprocessor that has the function of performing calculations between multiple pieces of data, and in particular, the present invention relates to a microprocessor that has the function of executing calculations between multiple pieces of data. Regarding the improvement of the condition flag output mechanism.
(従来の技術)
複数のデータ間の演算機能を有するマイクロプロセッサ
においては、一般に、演算の結果が正負もしくは零のい
ずれであったかを示す条件フラグが用意されている。そ
して演算結果の反映により、この条件フラグを変化させ
る。マイクロプロセッサを利用する処理プログラム等は
この条件フラグを見て判断し、分岐等を行なうように構
成される。(Prior Art) A microprocessor having a function of calculating data between a plurality of pieces of data is generally provided with a condition flag indicating whether the result of the calculation is positive, negative, or zero. Then, this condition flag is changed by reflecting the calculation result. A processing program or the like that uses a microprocessor is configured to make a judgment based on this condition flag and perform branching or the like.
このような従来における条件フラグとしては、例えば第
3図および第4図に例を示すようなものがある。Examples of such conventional condition flags include those shown in FIGS. 3 and 4, for example.
第3図は、演算器2およびその周辺部の概略構成を示す
ブロック図である。演算器2により演算が行なわれる2
個のデータを保持する、1aおよび1bの2つの被演算
データレジスタ1がある。FIG. 3 is a block diagram showing a schematic configuration of the arithmetic unit 2 and its peripheral parts. 2 where the calculation is performed by the calculation unit 2
There are two operand data registers 1, 1a and 1b, holding data of .
また演算が行われた結果の数値データが格納される演算
結果レジスタ3がある。そして演算結果の大小関係を表
わすN(ネガティグ>9a、Z(ゼロ)9b、C(−I
rヤリ)9cの3個の条件フラグ9が配設されている。There is also a computation result register 3 in which numerical data as a result of computation is stored. Then, N (negative > 9a, Z (zero) 9b, C (-I
Three condition flags 9, 9c and 9c, are provided.
第4図は、このN9a、Z9b、C9cの3個の条件フ
ラグ9の内部状態の組合わせと、演算結果の大小関係と
の比較を示した図である。FIG. 4 is a diagram showing a comparison between the combination of the internal states of the three condition flags 9, N9a, Z9b, and C9c, and the magnitude relationship of the calculation results.
Zフラグ9bが1の場合には、2つの被演算データレジ
スタ1aおよび1bに保持されていたデータ(それぞれ
の値をAおよびBとする)が1度等しかったことを示し
ている。またZフラグ9bが0の場合には上記2つのデ
ータAおよびBが等しくなかったことがわかる。When the Z flag 9b is 1, it indicates that the data held in the two operand data registers 1a and 1b (respective values are A and B) are equal once. Further, when the Z flag 9b is 0, it can be seen that the two data A and B are not equal.
ところが、2つのデータAとBとの大小を判断しようと
すると、第4図に示されるように、これらのデータが符
号を有するか否かによって判別の仕方が変わってくる0
例えば、Aの方がBより小さいかどうかを判別しようと
すれば、有符号の場合にはNフラグ9aが1かどうかで
、また無符号の場合にはCフラグ9cにより、それぞれ
判別しなければならない。However, when trying to judge the magnitude of two data A and B, as shown in Figure 4, the method of judgment changes depending on whether these data have a sign or not.
For example, if you want to determine whether A is smaller than B, you must determine whether or not the N flag 9a is 1 if it is signed, and by the C flag 9c if it is unsigned. It won't happen.
これは、有符号データの場合には、例えば、その最左端
の1ビツトが正(0)、負(1)の符号として用いられ
ており、また無符号の場合には、逆に、全てのビットが
数値データを表わすものとして扱われる。一方、演算の
際には、この最左端の1ビツトが符号として用いられて
いるいないに拘らず、全く同様に全ビットについて演算
が実行される。そして、演算の結果データについて再び
、最左端の1ビツトを符号と見るかデータとして扱うか
が使い分けられる。In the case of signed data, for example, the leftmost 1 bit is used as a positive (0) or negative (1) sign, and in the case of unsigned data, on the contrary, all Bits are treated as representing numeric data. On the other hand, during an operation, the operation is performed on all bits in exactly the same way, regardless of whether this leftmost bit is used as a sign or not. Then, regarding the result data of the operation, it is determined whether the leftmost 1 bit is treated as a sign or as data.
すなわち、全く同一の結果データであっても、これを符
号付きの有符号データとして見るか、無符号データとし
て扱うかにより、演算結果が零、正あるいは負のいずれ
であるかが具なってくる場合がある。In other words, even if the result data is exactly the same, whether the operation result is zero, positive, or negative depends on whether it is treated as signed data or unsigned data. There are cases.
従って、従来のマイクロプロセッサでは、符号の有無に
無rJJ係に演算の結果、例えば最左端の1ビツトがオ
ンであればNフラグを、キャリが発生すればCフラグを
、また結果データが零であればCフラグを立てていた。Therefore, in a conventional microprocessor, as a result of an operation regardless of the presence or absence of a sign, for example, if the leftmost bit is on, the N flag is set, if a carry occurs, the C flag is set, and if the result data is zero. If there was, I would have set the C flag.
そして、この演算結果を判断する処理プログラム等の側
で、符号の有無に応じ、判定対象とする条件フラグの種
類を変えて判別していた。A processing program or the like that judges the result of this calculation changes the type of condition flag to be judged depending on the presence or absence of a sign.
(発明が解決しようとする課題)
ところが、このような従来のマイクロプロセッサであれ
ば、有符号データと無符号データとの場合で、同じ大小
関係を判断するにも、異なる条件フラグにより判別しな
ければならないため、例えば条件分岐命令を用いようと
しても符号の有無に応じ、異なる条件分岐命令を使わね
ばならなかった。そして、このような複雑で紛られしい
使用方法によっていたため、プログラミング上の錯誤等
を生じやすいこともあった。また、上述した従来例では
3種類の条件フラグを用いて判断に供していなが、この
内の、例えばネガティグ(N)とキャリ(C)との2個
のフラグの一方は、汲うデータの型(符号の有無)によ
り無意味となり、ハードウェアを冗長にしていた。(Problem to be Solved by the Invention) However, with such conventional microprocessors, different condition flags must be used to determine the same magnitude relationship between signed data and unsigned data. Therefore, for example, even if one were to use a conditional branch instruction, a different conditional branch instruction had to be used depending on the presence or absence of a sign. Moreover, due to such a complicated and confusing method of use, programming errors were likely to occur. In addition, in the conventional example described above, three types of condition flags are not used for judgment, but one of these two flags, for example, negative (N) and carry (C), is based on the data to be collected. It became meaningless depending on the type (signed or not), making the hardware redundant.
この発明は、このような従来の事情に鑑みて為されたも
のであり、その目的とするところは、扱うデータの符号
の有無に拘らず、演算結果の大小等が同じ条件下にあれ
ば、同じ条件フラグで表わし、かつ同一の条件分岐命令
等で判断できるようなマイクロプロセッサを提供するこ
とにある。The present invention has been made in view of the above-mentioned conventional circumstances, and its purpose is to perform calculations under the same conditions, regardless of whether or not the data to be handled has a sign. It is an object of the present invention to provide a microprocessor that can express conditions using the same condition flags and make decisions using the same conditional branch instructions.
[発明の構成〕
(課題を解決するための手段)
このような目的を達成するために、この発明に係るマイ
クロプロセッサにあっては、正負の符号を持つ有符号デ
ータの演算実行命令である有符号演算命令群と、正負の
符号を持たない無符号データの演算実行命令である無符
号演算命令群と、の2種類の演算命令群を設けるととも
に、演算命令が有符号演算命令群もしくは無符号演算命
令群のいずれの命令群の命令であるかを判別し、判別情
報を出力するデコード回路と、このデコード回路からの
判別情報、並びに演算を実行する演算器からの演算結果
の情報から、有符号データであれば正負の符号を含めた
大小や一致等の条件フラグを出力し、無符号データであ
れば符号を含めない前記条件フラグを出力するフラグ生
成回路と、を備えたことを特徴とするものである。[Structure of the Invention] (Means for Solving the Problems) In order to achieve such an object, the microprocessor according to the present invention has an instruction to execute an operation on signed data having a positive or negative sign. Two types of operation instruction groups are provided: a signed operation instruction group and an unsigned operation instruction group that is an instruction for executing operations on unsigned data that does not have a positive or negative sign. A decoding circuit that determines which instruction group of arithmetic instruction groups the instruction belongs to and outputs determination information, the determination information from this decoding circuit, and information on the operation results from the arithmetic unit that executes the operation, The present invention is characterized by comprising a flag generation circuit that outputs condition flags such as size and match, including positive and negative signs, if the data is signed data, and outputs the condition flags that do not include the sign, if the data is unsigned data. It is something to do.
(作用)
このような構成を備えたマイクロプロセッサであれば、
演算を実行し、結果を出そうとするデータが有符号なの
か無符号であるのかが、デコード回路において演算命令
を判別することにより判明する。この演算対象のデータ
の符号の有無が明確になれば、演算を実行する演算器か
らの演算結果の情報から、フラグ生成回路により、有符
号データであれば正負の符号を含めた大小や一致等の条
件フラグを出力することが可能になるとともに、無符号
データであれば符号を含めない前記条件フラグを出力す
ることができるようになる。(Function) If a microprocessor has such a configuration,
Whether the data for which an operation is to be executed and a result is to be produced is signed or unsigned is determined by determining the operation instruction in the decoding circuit. Once it is clear whether the data to be operated on has a sign or not, the flag generation circuit uses the information on the operation result from the arithmetic unit that executes the operation to determine whether the data is large or small, including the positive or negative sign, and whether it matches. It becomes possible to output the condition flag of , and, if the data is unsigned data, it becomes possible to output the condition flag that does not include a sign.
こうして、扱うデータの符号の有無に拘らず、演算結果
の大小等が同じ状況であれば同じ条件フラグで表わされ
るようになり、同一の条件分岐命令等で判断可能になる
。また条件フラグの種類も最少限に押えられるようにな
り、ハードウェアの冗長さを無くすことが可能になる。In this way, regardless of the presence or absence of the sign of the data to be handled, if the magnitude of the operation result is the same, it will be represented by the same condition flag, and it will be possible to make a decision using the same conditional branch instruction or the like. Furthermore, the types of condition flags can be kept to a minimum, making it possible to eliminate redundancy in hardware.
(実施例)
第1図は、この発明が適用された一実施例のマイクロプ
ロセッサの要部ブロック図である。(Embodiment) FIG. 1 is a block diagram of main parts of a microprocessor according to an embodiment to which the present invention is applied.
この例のマイクロプロセッサでは、最終的な条件フラグ
として、等しいことを示すZ(ゼロ)とともに、大小関
係を表わすしくレス)との計2個の条件フラグを設けて
いる。In the microprocessor of this example, a total of two condition flags are provided as final condition flags: Z (zero) indicating equality, and Z (res) indicating magnitude relationship.
2個のデータの演算を実行する演算器2と、この演算器
2により演算が行なわれる2個のデータを保持する、1
aおよび1bの2つの被演算データレジスタ1がある。an arithmetic unit 2 that executes operations on two pieces of data; and 1 that holds two pieces of data that are operated on by this arithmetic unit 2;
There are two operand data registers 1, a and 1b.
また演算が行われた結果の数値データが格納される演算
結果レジスタ3、および演算結果の中間フラグ4がある
。There is also an operation result register 3 in which numerical data as a result of the operation is stored, and an intermediate flag 4 for the operation result.
符号5は命令レジスタであり、演算を実行させる有符号
もしくは無符号の演算命令等が格納される。符号6はデ
コード回路であり、命令レジスタ5に格納される演算命
令等が有符号の命令群であるか、無符号の命令群に属す
るのかを判別する。Reference numeral 5 is an instruction register in which signed or unsigned operation instructions for executing operations are stored. Reference numeral 6 denotes a decoding circuit, which determines whether an arithmetic instruction, etc. stored in the instruction register 5 belongs to a signed instruction group or an unsigned instruction group.
このデコード回路による上記判別情報と、中間フラグ4
に保持される演算結果のフラグ条件、および演算結果デ
ータとから、最終の条件フラグを生成するフラグ発生回
路7が設けられている。そしてフラグ発生回路7から出
力される、大小関係を表わすしくレス)8bと、被演算
データが相等しいことを示すZ(ゼロ)8aとの2個の
条件フラグ8が配設されている。The above discrimination information by this decoding circuit and the intermediate flag 4
A flag generation circuit 7 is provided which generates a final condition flag from the flag condition of the operation result held in the flag condition and the operation result data. Two condition flags 8 are provided, which are output from the flag generating circuit 7 and include a response (Res) 8b indicating a magnitude relationship and a Z (zero) 8a indicating that the operand data are equal.
第2図は、この実施例におけるZ(ゼロ)8aとL(レ
ス)8bとの2個の条件フラグ8の、演算結果の大小関
係との比較を示す説明図である。FIG. 2 is an explanatory diagram showing a comparison between two condition flags 8, Z (zero) 8a and L (less) 8b, and the magnitude relationship of the calculation results in this embodiment.
2フラグ8aが1の場合には、2つの被演算データレジ
スタ1aおよび1bに保持されていたデータ(それぞれ
の値をAおよびBとする)が1度等しかったことを示し
ている。また2フラグ9bが0の場合には上記2つのデ
ータAおよびBが等しくなかったことがわかる。When the 2 flag 8a is 1, it indicates that the data held in the two operand data registers 1a and 1b (their respective values are A and B) are equal once. Further, when the 2 flag 9b is 0, it can be seen that the two data A and B are not equal.
さらに、この2つのデータAおよびBの大小関係は、第
2図に示すように、データの符号の有無に拘らず常に、
Lフラグを見ることにより判別できるようになっている
。Furthermore, the magnitude relationship between these two data A and B is always as shown in FIG. 2, regardless of whether the data has a sign or not.
This can be determined by looking at the L flag.
このようにして、扱うデータが有符号であるか無符号で
あるかによらず、条件フラグの意味は常に同じとなり、
演算命令の種類に応じた適切なフラグ変化が生成される
ようになる。また条件フラグの種類も、この例では、従
来の3種類から2種類だけに減少されている。従って、
フラグ回りのハードウェアの減少だけでなく、この条件
フラグに係わる分岐命令等の命令の種類もより厳選する
ことが可能になっている。In this way, regardless of whether the data being handled is signed or unsigned, the meaning of the condition flag is always the same.
Appropriate flag changes are generated according to the type of operation instruction. Furthermore, the types of condition flags have been reduced from the conventional three types to only two types in this example. Therefore,
This not only reduces the amount of hardware surrounding the flag, but also makes it possible to more carefully select the types of instructions, such as branch instructions, related to the condition flag.
なお、フラグ発生回路7の内部構成としては、例えば、
中間フラグ4に従来のN1、Z、Cと同じ条件フラグを
格納するようにして、演算命令の有符号・無符号の種類
に応じ、第4図の条件フラグの組合わせの左右に示すよ
うな判断をそのt、ま実行するようなゲート等により構
成してもよい。あるいは、上記Nフラグ等を演算結果デ
ータから直接引出すことも可能である。勿論、第4図の
論理通りのゲート等に構成する必要はなく、より簡易な
形のゲート等の組合わせで容易に実現できるものである
。Note that the internal configuration of the flag generation circuit 7 is as follows, for example:
By storing the same condition flags as the conventional N1, Z, and C in the intermediate flag 4, the condition flags shown on the left and right of the combination of condition flags in Fig. It may also be configured by a gate or the like that executes the judgment. Alternatively, it is also possible to directly extract the N flag etc. from the calculation result data. Of course, it is not necessary to construct the gates according to the logic shown in FIG. 4, and it can be easily realized by combining gates of simpler forms.
また、上述の実施例構成には、最も簡略な形態での本発
明の適用例を示したが、上記例のような構成だけでなく
、より多種類のフラグ等を擁したマイクロプロセッサや
、あるいは実数形式等の数値データ等に対しても、この
発明を適用することは勿論可能である。In addition, although the above-mentioned embodiment configuration shows an application example of the present invention in the simplest form, it is not limited to the configuration as in the above example. Of course, the present invention can also be applied to numerical data such as real number format.
[発明の効果]
以上、詳細に説明したように、この発明に係るマイクロ
プロセッサによれば、有符号演算と無符号演算のいかん
によらず、常に条件フラグの持つ意味を同一にすること
ができるようになる。[Effects of the Invention] As described above in detail, according to the microprocessor according to the present invention, the meanings of condition flags can always be the same regardless of whether a signed operation or an unsigned operation is performed. It becomes like this.
従って、演算結果を判断し、条件分岐等の命令を実施す
る場合にも、対象データの符号の有無に無関係に、常に
同一の条件分岐命令等により判別することが可能になり
、プログラミング上のf4 f<等を生じ難くし、開発
等の効率を向上させることが可能になる。Therefore, even when determining the calculation result and executing instructions such as conditional branching, it is possible to always use the same conditional branching instruction, etc., regardless of the presence or absence of the sign of the target data. It becomes possible to make it difficult for f< etc. to occur and to improve the efficiency of development, etc.
また、条件フラグの種類等も、この発明の適用により減
少させることも可能であり、フラグに関連するハードウ
ェアの減少や、条件判断命令の種類の厳選等も実現可能
になる。Further, the types of condition flags can be reduced by applying the present invention, and it is also possible to reduce the amount of hardware related to flags and to carefully select the types of condition judgment instructions.
第1図はこの発明に係る一実施例のマイクロプロセッサ
の要部ブロック図、第2図は同実施例における条件フラ
グの説明図、第3図は従来のマイクロプロセッサの要部
ブロック図、第4図は従来の条件フラグの説明図である
。FIG. 1 is a block diagram of main parts of a microprocessor according to an embodiment of the present invention, FIG. 2 is an explanatory diagram of condition flags in the same embodiment, FIG. 3 is a block diagram of main parts of a conventional microprocessor, and FIG. The figure is an explanatory diagram of a conventional condition flag.
Claims (1)
演算を演算器により実行し、演算結果のデータとともに
、前記複数のデータ間の比較結果である大小や一致等の
条件フラグを出力するマイクロプロセッサであつて、 正負の符号を持つ有符号データの演算実行命令である有
符号演算命令群と、 正負の符号を持たない無符号データの演算実行命令であ
る無符号演算命令群と、 演算命令が有符号演算命令群もしくは無符号演算命令群
のいずれの命令群の命令であるかを判別し、判別情報を
出力するデコード回路と、 このデコード回路からの判別情報、並びに演算を実行す
る演算器からの演算結果の情報から、有符号データであ
れば正負の符号を含めた大小や一致等の条件フラグを出
力し、無符号データであれば符号を含めない前記条件フ
ラグを出力するフラグ生成回路と、を備えたことを特徴
とするマイクロプロセッサ。(1) A microprocessor that executes operations between multiple pieces of data that may or may not have signs using an arithmetic unit, and outputs condition flags such as size and match, which are the comparison results between the multiple pieces of data, along with the operation result data. A processor, which includes a group of signed operation instructions that are instructions for executing operations on signed data that has a positive or negative sign, a group of unsigned operation instructions that are instructions for executing operations on unsigned data that does not have a positive or negative sign, and an operation instruction. a decoding circuit that determines whether an instruction belongs to a signed arithmetic instruction group or an unsigned arithmetic instruction group and outputs determination information, and an arithmetic unit that executes the determination information from this decoding circuit and the operation. A flag generation circuit that outputs condition flags such as size and match, including positive and negative signs, based on the information on the calculation result if the data is signed data, and outputs the condition flags that do not include the sign if it is unsigned data. A microprocessor characterized by comprising:
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP63139235A JPH01309129A (en) | 1988-06-08 | 1988-06-08 | Microprocessor |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP63139235A JPH01309129A (en) | 1988-06-08 | 1988-06-08 | Microprocessor |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH01309129A true JPH01309129A (en) | 1989-12-13 |
Family
ID=15240623
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP63139235A Pending JPH01309129A (en) | 1988-06-08 | 1988-06-08 | Microprocessor |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH01309129A (en) |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6598153B1 (en) | 1999-12-10 | 2003-07-22 | International Business Machines Corporation | Processor and method that accelerate evaluation of pairs of condition-setting and branch instructions |
Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS6273329A (en) * | 1985-09-27 | 1987-04-04 | Toshiba Corp | arithmetic processing unit |
-
1988
- 1988-06-08 JP JP63139235A patent/JPH01309129A/en active Pending
Patent Citations (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS6273329A (en) * | 1985-09-27 | 1987-04-04 | Toshiba Corp | arithmetic processing unit |
Cited By (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| US6598153B1 (en) | 1999-12-10 | 2003-07-22 | International Business Machines Corporation | Processor and method that accelerate evaluation of pairs of condition-setting and branch instructions |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US6918031B2 (en) | Setting condition values in a computer | |
| US4578750A (en) | Code determination using half-adder based operand comparator | |
| US5704052A (en) | Bit processing unit for performing complex logical operations within a single clock cycle | |
| EP1204918B1 (en) | Conditional instruction execution in a computer | |
| JP2683488B2 (en) | 3-1 Logical operation device | |
| US4954947A (en) | Instruction processor for processing branch instruction at high speed | |
| EP0093430A2 (en) | Pipeline data processing system | |
| CN107851007B (en) | Method and apparatus for comparison of wide data types | |
| JPH07219769A (en) | Microprocessor | |
| KR100735944B1 (en) | Method and computer program for single instruction multiple data management | |
| US6530015B1 (en) | Accessing a test condition for multiple sub-operations using a test register | |
| JPH01309129A (en) | Microprocessor | |
| US20240220323A1 (en) | Apparatuses, methods, and systems for instructions for loading a tile of a matrix operations accelerator | |
| US9606798B2 (en) | VLIW processor, instruction structure, and instruction execution method | |
| US5045992A (en) | Apparatus for executing instruction regardless of data types and thereafter selectively branching to other instruction upon determining of incompatible data type | |
| JPH05274143A (en) | Composite condition processing system | |
| EP0313817B1 (en) | Method and apparatus for explicitly evaluating conditions in a data processor | |
| US11080054B2 (en) | Data processing apparatus and method for generating a status flag using predicate indicators | |
| JPH05108345A (en) | Branch instruction processor | |
| JP2793357B2 (en) | Parallel processing unit | |
| JPS58205253A (en) | Arithmetic device | |
| JPH1196001A (en) | Program execution device and program conversion method | |
| JPS62159230A (en) | Instruction prefetching device | |
| HK1000738B (en) | Method and apparatus for explicitly evaluating conditions in a data processor | |
| JP2000357087A (en) | Arithmetic processing device and arithmetic processing method |