JPS6258019B2 - - Google Patents
Info
- Publication number
- JPS6258019B2 JPS6258019B2 JP54100025A JP10002579A JPS6258019B2 JP S6258019 B2 JPS6258019 B2 JP S6258019B2 JP 54100025 A JP54100025 A JP 54100025A JP 10002579 A JP10002579 A JP 10002579A JP S6258019 B2 JPS6258019 B2 JP S6258019B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- digits
- output
- zero
- register
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired
Links
Landscapes
- Complex Calculations (AREA)
- Executing Machine-Instructions (AREA)
Description
この発明はデータ処理装置において数値の大小
を比較するデータ比較装置に関する。
従来、データ処理装置に於いて、数値データの
大小を判定する場合には、比較すべき数値の間で
減算を行ない、数値の大小を判定する方法が一般
的に行なわれている。数値の桁数がある程度大き
いデータを扱うデータ処理装置、特にある程度大
きい桁数まで指定できるような可変長データを取
り扱うデータ処理装置では減算の桁数が多くなる
と、全桁同時に演算するためには過大な演算器を
必要とし、不経済であるし、また特定の桁数に区
切つて演算すると、演算時間が大きくなる。また
それぞれの数値に対して、それぞれ固有の指数を
指定できるようなデータ処理装置に於ては、減算
に先立つてそれぞれの数値の桁合せを行なう必要
もあり、比較される実際の数値の内容によつては
非常に効率が悪い。
この発明は上記実情に鑑みなされたもので、例
えば「5」と「10」の如く数値の桁数によつて、
また例えば「19」と「20」の如く最上位桁のみの
比較によつて数値の大小が判定できる場合に、被
比較数の間に減算処理を施こすことなく数値の大
小を判定し、数値比較処理の効率化を実現したデ
ータ比較装置を提供することを目的とする。
以下図面を参照してこの発明の一実施例を説明
する。第1図は処理装置とデータの関係を示す図
である。図中1はデータ処理装置、2は主記憶装
置であり、データ処理装置1が比較命令を実行す
ることによつて主記憶装置内のデータaとbを比
較するものとする。通常の情報処理システムと同
様に、データ処理装置1は、命令で指定された主
記憶装置2内のアドレスから指定された長さのデ
ータa,bを上位桁から順次データ処理装置1内
へ取込むものとする。データ処理装置1と主記憶
装置2との間のデータの転送はデータバス3を通
して一度に16ビツトずつ行なわれるものとし、取
扱われるデータは、4ビツトで10進1桁を表わす
BCDコードの10進数と仮定する。
更にデータ処理装置1内には命令の実行開始
後、実行の為に必要な情報として、各データの長
さ、指数等が適当に準備される。即ち、第2図に
示したデータ処理装置1内のレングスレジスタ4
にデータaの長さ、同じくレングスレジスタ5に
データbの長さ、エクスポネントレジスタ6にデ
ータaの指数、同じくエクスポネントレジスタ7
にデータbの指数がそれぞれ準備されているもの
とする。各データの符号は既成の方法例えば符号
判読器8によつて判続されプラス(+)であれば
“0”、マイナス(−)であれば“1”がフリツプ
フロツプ9及び10にセツトされ、データaの符
号がフリツプフロツプ9に、データbの符号がフ
リツプフロツプ10にそれぞれセツトされるもの
とする。
第2図はこの発明の一実施例を示す機能構成図
である。図中4乃至7は前述した如く、データの
長さ、指数を保持する各レジスタ、8はデータ符
号を判読する符号判読器、9,10はそれぞれの
符号を保持するフリツプフロツプである。主記憶
装置2からのデータa,bはバス3を介して入力
され、符号判読器8によつて判読され、判読結果
はそれぞれのデータに対応してフリツプフロツプ
9又は10にセツトされる。また演算に使用する
為のデータは、データレジスタ100に書き込ま
れる。11はバス3からのデータの中にゼロ
(零)でない数値があらわれるまで上位のゼロの
桁数を累計してゆくリーデイングセロカウンタで
ある。なお、このリーデイングゼロカウンタ11
の詳細は第4図で説明する。またこのリーデイン
グゼロカウンタ11は最初のゼロでない数値が現
われると、データセレクタ20にその桁位置を示
す選択信号を更にレジスタ21又は22に書き込
み信号を送る。そしてデータaのゼロでない最上
位4ビツト桁をレジスタ21に、同様にデータb
のゼロでない最上位4ビツト桁をレジスタ22に
記憶する。12,13,16は周知の2の補数形
の加減算器、26は4ビツトのデータの大小を判
定するデータ比較器であり、レジスタ21の内容
がレジスタ22の内容より大きい時に出力23の
みを“1”にし、両者が等しい場合には出力24
のみを“1”、レジスタ22の内容がレジスタ2
1の内容より大きい場合には出力25のみを
“1”にする。リーデイングゼロカウンタ11に
よつて累計された最上位桁からの連続したゼロの
桁数は減算器12によつて指定されたデータの長
さから差し引かれ、減算器12の出力にはデータ
の実質桁数が出力される。更にこの出力に対し加
算器13によつて対応する指数を加えて加算器1
3からデータの実効桁数が出力される。データa
の実効桁数はレジスタ14に、又、データbの実
効桁数はレジスタ15に記憶される。なお上記各
レジスタ4,5,6,7,14,15,21,2
2には、表−1に例示されたデータa,bに合わ
せた数値が示されている。
The present invention relates to a data comparison device for comparing the magnitude of numerical values in a data processing device. 2. Description of the Related Art Conventionally, when determining the magnitude of numerical data in a data processing apparatus, a method of subtracting between numerical values to be compared is generally used to determine the magnitude of numerical data. In a data processing device that handles data with a relatively large number of numerical digits, especially in a data processing device that handles variable-length data that can specify up to a relatively large number of digits, when the number of digits for subtraction increases, it becomes too large to operate on all digits at the same time. It requires a large arithmetic unit, which is uneconomical, and if the calculation is divided into a specific number of digits, the calculation time increases. In addition, in data processing devices that allow you to specify a unique exponent for each numerical value, it is necessary to align the digits of each numerical value before subtraction, and the content of the actual numerical values being compared must be adjusted. It is extremely inefficient. This invention was made in view of the above circumstances, and for example, depending on the number of digits of numerical values such as "5" and "10",
For example, when the magnitude of a numerical value can be determined by comparing only the most significant digits, such as "19" and "20", the magnitude of the numerical value can be determined without performing subtraction processing between the comparands. It is an object of the present invention to provide a data comparison device that realizes efficient comparison processing. An embodiment of the present invention will be described below with reference to the drawings. FIG. 1 is a diagram showing the relationship between a processing device and data. In the figure, 1 is a data processing device, 2 is a main storage device, and the data processing device 1 compares data a and b in the main storage device by executing a comparison instruction. Similar to a normal information processing system, the data processing device 1 sequentially imports data a and b of a specified length into the data processing device 1 from the address in the main storage device 2 specified by the instruction, starting from the most significant digits. shall be included. Data transfer between the data processing device 1 and the main memory device 2 is carried out 16 bits at a time through the data bus 3, and the data handled is 4 bits representing one decimal digit.
Assume BCD code decimal number. Further, in the data processing device 1, after the execution of an instruction is started, the length of each data, exponent, etc. are appropriately prepared as information necessary for execution. That is, the length register 4 in the data processing device 1 shown in FIG.
The length of data a is stored in length register 5, the length of data b is stored in exponent register 6, and the exponent of data a is stored in exponent register 6.
It is assumed that the index of data b is prepared for each. The sign of each data is determined by a ready-made method, for example, a code reader 8, and if it is plus (+), "0" is set, and if it is minus (-), "1" is set in flip-flops 9 and 10. It is assumed that the code of data a is set in flip-flop 9 and the code of data b is set in flip-flop 10. FIG. 2 is a functional configuration diagram showing an embodiment of the present invention. In the figure, 4 to 7 are registers that hold the length and exponent of data as described above, 8 is a code reader that reads data codes, and 9 and 10 are flip-flops that hold respective codes. Data a and b from the main storage device 2 are input via the bus 3 and are read by a code reader 8, and the reading results are set in flip-flops 9 or 10 in accordance with the respective data. Further, data for use in calculations is written to the data register 100. 11 is a leading cell counter that accumulates the number of high-order zero digits until a non-zero value appears in the data from the bus 3. Furthermore, this leading zero counter 11
The details will be explained in FIG. When the first non-zero value appears, the leading zero counter 11 sends a selection signal indicating the digit position to the data selector 20 and a write signal to the register 21 or 22. Then, the most significant 4 non-zero bits of data a are stored in the register 21, and similarly data b is stored in register 21.
The most significant 4 non-zero bits of 0 are stored in register 22. 12, 13, and 16 are well-known two's complement type adders/subtractors, and 26 is a data comparator that determines the magnitude of 4-bit data. 1", and if both are equal, output 24
only “1”, the contents of register 22 are register 2
If it is larger than the content of 1, only the output 25 is set to "1". The number of consecutive zero digits from the most significant digit accumulated by the leading zero counter 11 is subtracted from the specified data length by the subtracter 12, and the output of the subtracter 12 shows the actual digits of the data. The number will be output. Furthermore, the corresponding exponent is added to this output by adder 13, and then the adder 1
From 3, the effective number of digits of the data is output. data a
The effective number of digits of data b is stored in register 14, and the effective number of digits of data b is stored in register 15. Note that each of the above registers 4, 5, 6, 7, 14, 15, 21, 2
2 shows numerical values corresponding to data a and b illustrated in Table-1.
【表】
減算器16はレジスタ14の内容からレジスタ
15の内容を減ずるもので、この逆算器16か
ら、減算の結果の符号19が出力される。更にデ
コーダ17によつて減算器16の出力データがゼ
ロか否かチエツクが行なわれる。例えば減算器1
6による減算の結果が正数またはゼロのとき、信
号線19を“0”にし、負のときには信号線19
を“1”にする。また減算結果がゼロのとき(即
ち、レジスタ14,15の内容が等しい時)には
デコーダ17の出力18が“1”となり、そうで
なければ“0”となる。ゼロ検出器27は、レジ
スタ14及び15の内容が共にゼロであることを
検出するもので、例えばレジスタ14及び15の
内容が共にゼロのときその出力28に“1”を出
力し、そうでなければ出力28は“0”になる。
次に、第2図に示した回路の動作を表−1で示
したデータa,bを一例として以下に説明する。
先ず、データパス3から転送されてきたデータa
の符号「+」を示すデータ“0”は符号判読器8
により判読され、その結果フリツプフロツプ9を
セツトする。またデータaの数値
「00012345678」の上位桁のゼロの数がリーデイン
グゼロカウンタ11によりカウントされ、減算器
12の一方へカウント数「3」“0011”が出力さ
れる。また、データaの最初のゼロでない数値
「1」をリーデイングゼロカウンタ11が検出し
た時、セレクタ20へ選択信号が、またレジスタ
21へ書込み信号が与えられる。この結果、前記
数値「1」のBCDデータ「0001」がセレクタ2
0を介してレジスタ21へ書込まれる。一方、前
記減算器12ではデータaの有効桁「11」
“001011”から前記リーデイングゼロカウント値
「3」“0011”が減算され、その減算値“001000”
が加算器13の一方へ出力される。加算器13で
は前記減算値“001000”とデータa指数「6」
“000110”が加算され、その加算結果“001110”
がレジスタ14にセツトされる。同様の動作がデ
ータbについても実施される。なお、データbの
動作ではフリツプフロツプ10が同様にセツトさ
れ、またレジスタ22に最初のゼロでない数値
「5」“0101”がセツトされる。また、減算器12
ではデータbの有効桁「8」“001000”−“0001”
(データbのリーデイスグゼロカウント値)の減
算処理が行なわれ減算値“000111”が加算器13
へ出力される。また加算器13ではデータbの指
数「11」“001011”+“000111”の加算処理が行な
われ、その結果“010010”がレジスタ15にセツ
トされる。
そして、上記した表−1の実施例によれば、デ
ータ比較器26の出力25のみが“1”となり、
出力23,24は“0”である。また減算器16
の出力信号線19が“1”(減算結果が負を意味
する。)となる。また出力28,18は“0”、フ
リツプフロツプ9,10の出力9′,10′は
“1”となる。
第3図は第2図の実施例に於ける数値の大小を
判定する部分の具体例である。第3図において左
側からの入力信号は第2図からの信号であり、第
2図と同一符号を付してその説明は省略する。図
中、29〜38はインバータ、39〜43は2入
力ナンドゲート、44〜49は3入力ナンドゲー
ド、50,51は4入力ナンドゲートである。信
号線28が“1”になるとインバータ33によつ
て信号線52が“0”となり、このことは両デー
タが共にゼロで相等しいことを意味する。9′,
10′はフリツプフロツプ9,10からのデータ
a,bの符号信号であり、データa,bの符号が
等しい時はナンドゲート41の出力から“1”が
得られる。また、データa,bの符号が共に正の
時、インバータ31の出力から“1”が得られ
る。更にまた、データa,bの符号が共に負の
時、インバータ32の出力から“1”が得られ
る。ナンドゲート50は、両データの少くとも一
つはゼロでなく、(即ち入力28が“0”でイン
バータ33で“1”となる)符号が等しく(上記
ナンドゲート41の出力が“1”)実効桁数も等
しく、(即ち、入力18が“1”の時)更にゼロ
でない最初の一桁の数字も等しいとき(即ち、入
力24が“1”の時)にのみ出力が“0”とな
る。従つて、ナンドゲート50から“0”が出力
される時はデータa,bが等しいことを意味す
る。信号線52が“0”のとき、この実施例の範
囲では数値の大小判定ができず、両データの減算
によつて判定しなければならないことを意味す
る。ナンドゲート42は、それぞれのデータの符
号が異なり、(即ち、上記ナンドゲート41の出
力が“0”で、インバータ36により“1”とな
る時)且つデータaの符号が正のとき(即ち、入
力9′が“1”である時)その出力が“0”とな
る。従つて、このナンドゲート42から“0”が
出力される時はデータaが大きいことを意味す
る。ナンドゲート44〜47は符号しいときに大
小を決めるためのゲートで、いずれもデータaが
大きいときに“0”を出力とするゲートである。
データa,bともに正の場合は、インバータ31
の出力が“1”で実効桁数が等しくなく(即ち、
入力18が“0”でインバータ35により“1”
となる時)実効桁数がデータaの方が長い(即
ち、入力19が“0”でインバータ34により
“1”となる時)場合ゲート44の出力が“0”
となる。また実効桁数が等しい(即ち入力18が
“1”の時)が最初のゼロでない桁値がデータa
の方が大きい(即ち入力23が“1”の時)場合
ゲート45の出力が“0”となる。両データが、
共に負の場合は、インバータ32の出力が“1”
で実効桁数が等しくなく、(即ち入力18が
“0”でインバータ35により“1”となる時)
実行桁数がデータbの方が長い(即ち、入力19
が“1”の時)場合ゲート46の出力が“0”と
なる。更に両データの符号が等しい(即ち入力1
8)が“1”の時)が、最初のゼロでない桁値が
データbの方が大きい(即ち入力25が“1”の
時)場合ゲート47の出力が“0”になつて、デ
ータaが大きいことを示す。このように、データ
aが大きい場合に、ゲート42,44,45,4
6及び47のいずれかの出力が“0”になる。従
つて、データaが大きい場合はゲート43の出力
を“1”とし、そうでないとゲート43の出力が
“0”となる。また、両データが等しくなければ
信号線52は“1”であり、両データが共にゼロ
でなければ信号線53は“1”である。従つてデ
ータaが大きければゲート48の出力である信号
線54が“0”となる。データbが大きいとゲー
ト43の出力が“0”であり、インバータ39に
より“1”となり、ゲート49の信号線55が
“0”となる。
上記表−1の実施例の動作を第3図において説
明すると、第3図の入力9′,10′は“1”、入
力28は“0”、入力24は“0”、入力18は
“0”、入力19は“1”、入力23は“0”、入力
25は“1”となつている。従つてゲート50,
42,44,45,46,47のいずれか1つか
らでも“0”が出力されることはない。従つて、
ゲート43からの出力“0”がインバータ38に
より“1”となりゲート49に入力され、信号線
52,53もまた“1”となつているため前記ゲ
ート49からの出力“0”が信号線55に出力さ
れる。よつて、表−1の場合データbがデータa
よりも大きいことが判別される。
第4図はリーデイングゼロカウンタ11周辺の
具体例である。図中第2図と同一部分には同一符
号を付してある。図においてIはインバータ、6
4〜66は2入力ナンドゲート、62,63は3
入力ナンドゲート、56〜61は4入力ナンドゲ
ートである。67は周知の2進加算器であり、6
9は加算器67の出力70を入力とするレジスタ
である。68はレジスタ69と同時に書き込まれ
る1ビツトのレジスタである。56〜59はゼロ
検出器となる。主記憶装置2からデータバス3に
よつて入力されたデータはインバータIを介して
ナンドゲート56〜59に入力され、データの内
容を調べられる。もし上位4ビツトが全て“0”
であると、ナンドゲート56の出力が“0”とな
る。同様にしてナンドゲート57は第2番目の4
ビツト、ナンドゲート58は第3番日、ナンドゲ
ート59は第4番目の4ビツトに対しゼロのチエ
ツクを行ない、該当する4ビツトがゼロのとき、
その出力を“0”とする。このナンドゲート56
〜59の出力信号を使つてバス3上のリーデイン
グゼロの数をゲート60〜66を用いてデコード
する。このデコード回路により最初の桁がゼロで
なければ“000”、最切の桁がゼロで、第2桁がゼ
ロでなければ“001”、最初の2桁がセロで第3桁
がゼロでなければ“010”、上位3桁がゼロで、第
4桁がゼロでなければ“011”、全桁ゼロであれば
“100”というそれぞれの値を信号線74〜76に
出力する。各データの読込みに先立つてレジスタ
68,69はゼロに初期設定される。レジスタ6
8,69は68の出力信号72が“0”のときデ
ータの取り込み信号によつて書き込みが行なわれ
るように制御される。これによりレジスタ69の
内容は加算器67によつてリーデイングゼロの数
を累計してゆき、ゼロでない数字が現われるとナ
ンドゲート60の出力が“1”となつて、レジス
タ68に“1”を書き込み、信号線72が“1”
になることによつて、それ以降レジスタ69は書
き変えられずにリーデイングゼロの累計値を保持
する。信号線75,76はデータセレクタ20の
選択信号として使用される。その値が“00”のと
きにはデータセレクタ20のセグメント77を選
択して、第1の4ビツトを出力し、また“01”の
ときにはセグメント78を選択して第2の4ビツ
トを出力し、同様に“10”のときにはセグメント
78を選択して第3の4ビツトを出力し、更に
“11”のときには第4の4ビツトを選択して信号
線82に出力する。データセレクタ20によつて
選択された一桁(4ビツト)のデータはデータa
の取り込み中には、レジスタ21にまたデータb
の取込み中にはレジスタ22に書き込まれる。両
レジスタ21,22とも、各データの取り込み時
にレジスタ68の出力72が“1”になると対応
するレジスタへのデータの書き込みを禁止するこ
とにより、レジスタ21,22にそれぞれのデー
タのゼロでない最上位桁が記憶される。従つて、
各データの主記憶装置2からの読出し終了時にリ
ーデイングゼロの数がレジスタ69、ゼロでない
最上位桁に値がレジスタ21又は22に作成され
ていることになる。
以上詳記したようにこの発明によれば、被比較
数の値が特定の場合を除き、数値の大小比較を減
算処理を施すことなく効率良く実行することので
きるデータ比較装置が提供できる。[Table] The subtracter 16 subtracts the contents of the register 15 from the contents of the register 14, and the inverse subtracter 16 outputs the sign 19 of the result of the subtraction. Further, the decoder 17 checks whether the output data of the subtracter 16 is zero. For example, subtractor 1
When the result of subtraction by 6 is a positive number or zero, the signal line 19 is set to "0", and when it is negative, the signal line 19 is set to "0".
Set to “1”. Further, when the subtraction result is zero (that is, when the contents of the registers 14 and 15 are equal), the output 18 of the decoder 17 becomes "1", and otherwise becomes "0". The zero detector 27 detects that the contents of the registers 14 and 15 are both zero. For example, when the contents of the registers 14 and 15 are both zero, it outputs "1" to its output 28; In this case, the output 28 becomes "0". Next, the operation of the circuit shown in FIG. 2 will be explained below using data a and b shown in Table 1 as an example.
First, data a transferred from data path 3
The data “0” indicating the sign “+” is the code reader 8.
As a result, the flip-flop 9 is set. Further, the number of zeros in the upper digits of the numerical value "00012345678" of data a is counted by the leading zero counter 11, and the count number "3""0011" is output to one side of the subtractor 12. Further, when the leading zero counter 11 detects the first non-zero value "1" of the data a, a selection signal is given to the selector 20 and a write signal is given to the register 21. As a result, the BCD data “0001” of the numerical value “1” is set to selector 2.
0 to register 21. On the other hand, in the subtracter 12, the significant digit of data a is "11".
The leading zero count value “3” “0011” is subtracted from “001011” and the subtracted value “001000”
is output to one side of the adder 13. The adder 13 outputs the subtracted value "001000" and the data a index "6".
“000110” is added and the addition result is “001110”
is set in register 14. A similar operation is performed for data b. In the operation of data b, the flip-flop 10 is similarly set, and the first non-zero value "5""0101" is set in the register 22. Also, the subtractor 12
Then, the significant digits of data b are “8” “001000” – “0001”
(Reading zero count value of data b) is subtracted and the subtracted value "000111" is sent to the adder 13.
Output to. Further, the adder 13 performs addition processing of the exponents "11", "001011" and "000111" of the data b, and as a result "010010" is set in the register 15. According to the embodiment shown in Table 1 above, only the output 25 of the data comparator 26 becomes "1",
Outputs 23 and 24 are "0". Also, the subtractor 16
The output signal line 19 becomes "1" (meaning that the subtraction result is negative). Further, the outputs 28 and 18 become "0", and the outputs 9' and 10' of the flip-flops 9 and 10 become "1". FIG. 3 shows a specific example of the portion for determining the magnitude of numerical values in the embodiment of FIG. 2. In FIG. 3, the input signal from the left side is the signal from FIG. 2, and is given the same reference numeral as in FIG. 2, and the explanation thereof will be omitted. In the figure, 29-38 are inverters, 39-43 are 2-input NAND gates, 44-49 are 3-input NAND gates, and 50 and 51 are 4-input NAND gates. When the signal line 28 becomes "1", the inverter 33 causes the signal line 52 to become "0", which means that both data are zero and equal. 9′,
10' is a code signal of data a and b from the flip-flops 9 and 10, and when the signs of data a and b are equal, "1" is obtained from the output of the NAND gate 41. Further, when the signs of data a and b are both positive, "1" is obtained from the output of the inverter 31. Furthermore, when the signs of data a and b are both negative, "1" is obtained from the output of the inverter 32. The NAND gate 50 has an effective digit in which at least one of both data is not zero (that is, the input 28 is "0" and the inverter 33 is "1") and the signs are equal (the output of the NAND gate 41 is "1"). The output is "0" only when the numbers are equal (ie, when input 18 is "1") and the first non-zero digit is also equal (ie, when input 24 is "1"). Therefore, when "0" is output from the NAND gate 50, it means that data a and b are equal. When the signal line 52 is "0", it means that the magnitude of the numerical value cannot be determined within the scope of this embodiment and must be determined by subtracting both data. The NAND gate 42 operates when the respective data have different signs (i.e., when the output of the NAND gate 41 is "0" and becomes "1" by the inverter 36) and when the sign of the data a is positive (i.e., the input 9 ' is "1"), its output becomes "0". Therefore, when "0" is output from this NAND gate 42, it means that data a is large. NAND gates 44 to 47 are gates for determining the magnitude when the sign is positive, and all gates output "0" when data a is large.
If both data a and b are positive, the inverter 31
output is “1” and the effective number of digits is not equal (i.e.,
When input 18 is “0”, it becomes “1” by inverter 35.
) When data a has a longer effective number of digits (that is, when input 19 is "0" and becomes "1" by inverter 34), the output of gate 44 is "0"
becomes. Also, the effective number of digits is equal (i.e., when input 18 is "1"), but the first non-zero digit value is data a
is larger (that is, when the input 23 is "1"), the output of the gate 45 becomes "0". Both data are
If both are negative, the output of the inverter 32 is “1”
The effective number of digits is not equal (i.e., when input 18 is "0" and becomes "1" by inverter 35)
The number of execution digits is longer for data b (i.e. input 19
is "1"), the output of the gate 46 becomes "0". Furthermore, the signs of both data are the same (i.e. input 1
8) is "1"), but if the first non-zero digit value is larger in data b (that is, when input 25 is "1"), the output of gate 47 becomes "0" and data a is large. In this way, when data a is large, gates 42, 44, 45, 4
The output of either 6 or 47 becomes "0". Therefore, when the data a is large, the output of the gate 43 is set to "1"; otherwise, the output of the gate 43 is set to "0". Further, if both data are equal, the signal line 52 is "1", and if both data are not zero, the signal line 53 is "1". Therefore, if the data a is large, the signal line 54, which is the output of the gate 48, becomes "0". When the data b is large, the output of the gate 43 is "0", the inverter 39 changes it to "1", and the signal line 55 of the gate 49 becomes "0". The operation of the embodiment shown in Table 1 above will be explained with reference to FIG. 3.Inputs 9' and 10' in FIG. 0", input 19 is "1", input 23 is "0", and input 25 is "1". Therefore, gate 50,
"0" is never output from any one of 42, 44, 45, 46, and 47. Therefore,
Since the output "0" from the gate 43 is changed to "1" by the inverter 38 and is input to the gate 49, and the signal lines 52 and 53 are also "1", the output "0" from the gate 49 is input to the signal line 55. is output to. Therefore, in Table 1, data b is data a
is determined to be larger than . FIG. 4 shows a specific example of the area around the leading zero counter 11. In the figure, the same parts as in FIG. 2 are designated by the same reference numerals. In the figure, I is an inverter, 6
4-66 are 2-input NAND gates, 62 and 63 are 3-input NAND gates.
Input NAND gates 56 to 61 are 4-input NAND gates. 67 is a well-known binary adder;
9 is a register which receives the output 70 of the adder 67 as an input. 68 is a 1-bit register written simultaneously with register 69. 56 to 59 are zero detectors. Data input from main memory 2 via data bus 3 is input to NAND gates 56-59 via inverter I, and the contents of the data are examined. If the upper 4 bits are all “0”
If so, the output of the NAND gate 56 becomes "0". Similarly, the NAND gate 57 is the second 4
The NAND gate 58 checks the 4th bit for zero, and the NAND gate 59 checks the 4th bit for zero, and when the corresponding 4 bits are zero,
The output is set to "0". This nand gate 56
The output signal of ~59 is used to decode the number of leading zeros on bus 3 using gates 60-66. With this decoding circuit, if the first digit is zero, it will be "000", if the last digit is zero and the second digit is zero, it will be "001", if the first two digits are zero and the third digit is zero, it will be "001". If the upper three digits are zero and the fourth digit is not zero, then "011" is output, and if all the digits are zero, "100" are output to the signal lines 74 to 76. Registers 68 and 69 are initialized to zero prior to each data read. register 6
8 and 69 are controlled so that writing is performed by a data capture signal when the output signal 72 of 68 is "0". As a result, the contents of the register 69 are accumulated by the number of leading zeros by the adder 67, and when a non-zero number appears, the output of the NAND gate 60 becomes "1", and "1" is written in the register 68. Signal line 72 is “1”
As a result, the register 69 is not rewritten and holds the cumulative value of leading zero. Signal lines 75 and 76 are used as selection signals for data selector 20. When the value is "00", the segment 77 of the data selector 20 is selected and the first 4 bits are output, and when the value is "01", the segment 78 is selected and the second 4 bits are output, and the same is true. When it is "10", the segment 78 is selected and the third four bits are output, and when it is "11", the fourth four bits are selected and output to the signal line 82. The one-digit (4-bit) data selected by the data selector 20 is data a.
While data is being fetched, data b is also stored in the register 21.
is written to the register 22 while the data is being fetched. For both registers 21 and 22, when the output 72 of the register 68 becomes "1" when each data is taken in, writing of data to the corresponding register is prohibited, so that the highest non-zero value of the respective data is stored in the registers 21 and 22. The digit is memorized. Therefore,
At the end of reading each data from the main memory device 2, the number of leading zeros is created in the register 69, and a value is created in the register 21 or 22 for the most significant non-zero digit. As described in detail above, according to the present invention, it is possible to provide a data comparison device that can efficiently compare the magnitude of numerical values without performing subtraction processing, except when the value of the comparand is specific.
図はこの発明の一実施例を示すもので、第1図
はデータ処理装置とデータとの関係を示すブロツ
ク図、第2図は要部の回路構成を示すブロツク
図、第3図はデータ判定を行なう回路構成を示す
ブロツク図、第4図は上記第2図の一部機能部分
を具体的に示す回路構成図である。
1……データ処理装置、2……主記憶装置、3
……バス、4,5,6,7,14,15,21,
22……レジスタ、8……判読器、9,10……
フリツプフロツプ、11……リーデイングゼロカ
ウンタ、12,16……減算器、13……加算
器、17……デコーダ、20……データセレク
タ、26……データ比較器。
The figures show one embodiment of the present invention, in which Fig. 1 is a block diagram showing the relationship between a data processing device and data, Fig. 2 is a block diagram showing the circuit configuration of the main part, and Fig. 3 is a block diagram showing the relationship between the data processing device and data. FIG. 4 is a block diagram illustrating a circuit configuration for performing the above-described circuit configuration. 1...Data processing device, 2...Main storage device, 3
...Bus, 4, 5, 6, 7, 14, 15, 21,
22...Register, 8...Reader, 9,10...
Flip-flop, 11... Leading zero counter, 12, 16... Subtractor, 13... Adder, 17... Decoder, 20... Data selector, 26... Data comparator.
Claims (1)
いて、最上位桁から連続して含まれる数値として
無効なゼロの桁数を算出する無効桁数算出手段
と、前記2つの数値データのそれぞれについて、
前記無効桁数算出手段により算出された無効桁数
を除いたデータの実質桁数を算出する実質桁数算
出手段と、前記実質桁数算出手段により算出され
た前記2つの数値データの実質桁数を比較するこ
とにより、前記2つの数値データの大小を判定す
る第1の判定手段と、前記前記無効桁数算出手段
により算出された無効桁数を除く2つの数値デー
タを上位桁より比較することにより、前記2つの
数値データの大小を判定する第2の判定手段と、
前記第1、第2の判定手段による判定結果のデー
タから前記2つの数値データの大小判定結果情報
を得る第3の判定手段とを具備してなることを特
徴とするデータ比較装置。1. For each of the two numerical data to be compared, an invalid digit number calculation means for calculating the number of invalid zero digits as a numerical value consecutively included from the most significant digit, and for each of the two numerical data,
an actual number of digits calculation means for calculating the actual number of digits of data excluding the number of invalid digits calculated by the number of invalid digits calculation means; and an actual number of digits of the two numerical data calculated by the actual number of digits calculation means. A first determining means for determining the magnitude of the two numerical data by comparing the two numerical data excluding the number of invalid digits calculated by the number of invalid digits calculating means starting from the higher digits. a second determining means for determining the magnitude of the two numerical data;
and third determining means for obtaining magnitude determination result information of the two numerical data from the data of the determination results by the first and second determining means.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP10002579A JPS5624643A (en) | 1979-08-06 | 1979-08-06 | Data comparing device |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP10002579A JPS5624643A (en) | 1979-08-06 | 1979-08-06 | Data comparing device |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS5624643A JPS5624643A (en) | 1981-03-09 |
| JPS6258019B2 true JPS6258019B2 (en) | 1987-12-03 |
Family
ID=14262990
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP10002579A Granted JPS5624643A (en) | 1979-08-06 | 1979-08-06 | Data comparing device |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPS5624643A (en) |
Family Cites Families (1)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS5441035A (en) * | 1977-09-08 | 1979-03-31 | Nippon Gakki Seizo Kk | Digital data converter circuit |
-
1979
- 1979-08-06 JP JP10002579A patent/JPS5624643A/en active Granted
Also Published As
| Publication number | Publication date |
|---|---|
| JPS5624643A (en) | 1981-03-09 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| CN108139912B (en) | Apparatus and method for calculating and preserving error bounds during floating point operations | |
| US6216222B1 (en) | Handling exceptions in a pipelined data processing apparatus | |
| JPH0786826B2 (en) | Integer division circuit | |
| JPH0479015B2 (en) | ||
| JPS6258019B2 (en) | ||
| JPH1091395A (en) | Processor | |
| US8209366B2 (en) | Method, apparatus and program storage device that provides a shift process with saturation for digital signal processor operations | |
| US3154676A (en) | Change adder | |
| JPS5831005B2 (en) | Electronics | |
| JPH064331A (en) | Decimal check circuit | |
| JPH0680487B2 (en) | Processor | |
| JPH0248733A (en) | information processing equipment | |
| JPH01231126A (en) | Information processor | |
| JPH0413734B2 (en) | ||
| JP2985093B2 (en) | Arithmetic control unit | |
| JPS5933551A (en) | Operand duplication detecting circuit | |
| JPS5851352A (en) | Data processor | |
| JPH03245225A (en) | Floating decimal-point addition/subtraction device | |
| JPS61256437A (en) | Arithmetic unit | |
| JPS6133215B2 (en) | ||
| JPS61188624A (en) | Fixed point arithmetic unit | |
| JPS5911141B2 (en) | arithmetic device | |
| JPS59176844A (en) | Data processor | |
| JPS5834852B2 (en) | Enzanshiyorihoushiki | |
| JPS62264345A (en) | Processing system in address conversion exception mode of vector processor |