JPH03218515A - Maximum value/minimum value detector - Google Patents
Maximum value/minimum value detectorInfo
- Publication number
- JPH03218515A JPH03218515A JP2255824A JP25582490A JPH03218515A JP H03218515 A JPH03218515 A JP H03218515A JP 2255824 A JP2255824 A JP 2255824A JP 25582490 A JP25582490 A JP 25582490A JP H03218515 A JPH03218515 A JP H03218515A
- Authority
- JP
- Japan
- Prior art keywords
- data
- address
- register
- types
- maximum value
- 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
Abstract
(57)【要約】本公報は電子出願前の出願データであるた
め要約のデータは記録されません。(57) [Summary] This bulletin contains application data before electronic filing, so abstract data is not recorded.
Description
【発明の詳細な説明】
産業上の利用分野
本発明は最大値・最小値検出装置に関するものであり、
特にマイクロプロセッサ,シグナルプロセッサなどにお
いて、多数のデータの最大値または最小値を高速で検出
し、さらには最大値または最小値の位置(アドレス)を
高速で検出する装置に適した装置であム
従来の技術
従来 マイクロプロセッサやシグナルプロセッサにおい
て、この種の最大値・最小値検出装置は2種類のデータ
の減算しまたは比較して、その減算結果または比較結果
により設定される符号フラグを利用し、ソフトウェアに
よって符号フラグを判定して、条件分岐命令などによっ
てプログラムを切り換えて2種類のデータのうちの大き
い方のデータまたは小さい方のデータ、もしくはその格
納アドレスを選択していた そして、このような手法を
1回または複数回繰り返すことで、 2種類またはそれ
以上の種類の最大値または最小イ直 もしくはその格納
アドレスを検出していた従来の 汎用のマイクロプロセ
ッサで50個のデータの最大値を検出するためのプログ
ラム(以下「従来プログラムlJと称す)の一例を示す
。[Detailed Description of the Invention] Industrial Application Field The present invention relates to a maximum value/minimum value detection device,
This device is particularly suitable for devices that detect the maximum or minimum value of a large amount of data at high speed, as well as the position (address) of the maximum or minimum value, particularly in microprocessors, signal processors, etc. Conventional technology In microprocessors and signal processors, this type of maximum value/minimum value detection device subtracts or compares two types of data, uses a sign flag set by the subtraction or comparison result, and uses software The sign flag was determined by the method, and the program was switched using a conditional branch instruction to select the larger or smaller of the two types of data, or its storage address. To detect the maximum value of 50 pieces of data using a conventional general-purpose microprocessor, which used to detect two or more types of maximum value or minimum value or their storage address by repeating the process once or multiple times. An example of a program (hereinafter referred to as "conventional program IJ") is shown below.
AY= 1
X=Y(AY)
AY=2
100. Z=X−Y(AY)
IFZ≧O Go To 200X=Y(AY)
200 AY=AY+1
IF AY≦50 Go TO 100ただし
AY ・・・・・・データアドレスX ・・・・・
・最大値データレジスタY (AY)・・・・・・デー
タレジスタZ ・・・・・・演算結果(符号フラグ)こ
のプログラムについて説明すると、最大値を検出する対
象となっている50個のデータ力( 連続したアドレス
のメモリ(レジスタの場合もある)に格納されていも
第1行で、 50個のデータの先頭アドレスが指定され
ム 第2行で、最大値データレジスタXL 1番地の
データが仮の最大値として格納されも 第3行で、50
個のデータの2番地のアドレスが指定されも 第4行で
、 1番地と2番地のデータの減算X−Y (AY)が
行われ 演算結果Z CZは演算結果により設定される
符号フラグの場合もある)が得られも 第5行で、Zの
符号が判定されも その値が負であるときに41 次
に第6行のプログラムが実行され データY (AY)
がXより大きい場合にXの内容がY(AY)に書き換え
られム Zの符号が正または0であれば 次に第7行の
プログラムが実行されデータレジスタY (AY)を示
すデータアドレスAYの値が1インクリメントされも
第8行で、データアドレスAYの値が判定され 値AY
が50以下であれば第4行に分岐し、それが50を越え
るとプログラムが終了すム プログラムの第4行から第
8行までが49回繰返し実行さレ50個のデータのうち
の最大値が最大値データレジスタXに最終的に設定され
も
最小値の検出の場合には 第4行の演算の順番を逆にし
てY (AY)−Xとする力\ 第5行の判定の部分を
ZくOとすればよレ〜
従来へ 汎用のマイクロプロセッサで50個のデータの
うちの最大値データおよび最大値データのアドレスを検
出するためのプログラムの一例(以下「従来プログラム
2』と称す)を示す。AY=1 X=Y(AY) AY=2 100. Z=X-Y(AY) IFZ≧O Go To 200
・Maximum value data register Y (AY)... Data register Z... Arithmetic result (sign flag) To explain this program, 50 pieces of data whose maximum value is to be detected (Even if they are stored in memory (sometimes in registers) at consecutive addresses)
In the first line, the start address of 50 pieces of data is specified.In the second line, the data at address 1 of maximum value data register XL is stored as a temporary maximum value.In the third line, 50
Even if the address of the 2nd address of the data of In the fifth line, the sign of Z is determined, but if the value is negative, then the program in the sixth line is executed and the data Y (AY) is obtained.
If is larger than X, the content of Even if the value is incremented by 1
In the 8th line, the value of data address AY is determined and the value AY
If it is less than 50, the program branches to the 4th line, and if it exceeds 50, the program ends. Lines 4 to 8 of the program are executed 49 times. The maximum value of the 50 pieces of data. is finally set in the maximum value data register Let's say ZkuO ~ Conventional Example of a program for detecting the maximum value data and the address of the maximum value data among 50 pieces of data using a general-purpose microprocessor (hereinafter referred to as "Conventional Program 2") shows.
100
200
ただし
AY
■
X
Y(AY)
AY= 1
X=Y(AY)
V=1
AY=2
Z=X−Y(AY)
IFZ≧O GO To 200X = Y (
AY)
V=AY
AY= AY+1
IF AY≦50 GO To 100・・・
・・・データアドレス
・・・・・・最大値データアドレス
タ
・・・・・・最大値データレジスタ
・・・・・・データレジスタ
レジス
Z・・・・・・演算結果(符号フラグ)このプログラム
について説明すると、最大値を検出する対象となってい
る50個のデータカへ 連続したアドレスのメモリ(レ
ジスタの場合もある)に格納されていも 第1行で、5
0個のデータの先頭アドレスが指定されも 第2行で、
最大値データレジスタXに 1番地のデータが仮の最大
値として格納されも 第3行で、最大値データアドレス
レジスタVl,,1番地のアドレスが仮の最大値データ
アドレスとして格納されも 第4行で、50個のデータ
の2番地のアドレスが指定されも第5行で、 1番地と
2番地のデータの滅算X−Y(AY)が行われ 演算結
果Z (Zは演算結果により設定される符号フラグの場
合もある)が得られも 第6行で、Zの符号が判定され
も その値が負であれC′1 次に第7行のプログラ
ムが実行されa 第7行では 最大値データレジスタX
&′−現在のアドレス指定されるデータY (AY)が
格納されも 第8行では 最大値データアドレスレジス
タVに 現在のデータアドレスAYが格納されム すな
わへ 第7行および第8行が第6行でのZの符号が負の
場合に実行されて、第7行でデータY (AY)がXよ
り大きい場合にXの内容がY (AY)に書き換えら札
第8行でVの内容がAYに書き換えられa Zの符号
の値が正または0であれば 次に第9行のプログラムが
実行されも 第9行で(上 データレジスタY (AY
)を示すデータアドレスAYの値が1インクリメントさ
れも 第10行で、データアドレスAYの値が判定され
その値が50以下であるときには第5行に分岐し、
50を越えるとプログラムが終了すムプログラムの第5
行から第10行までは49回繰返し実行され 最終的に
最大値データレジスタXに50個のデータのうちの最大
値が設定され 最大値データアドレスレジスタVに最大
値のアドレスが設定されも
最小値の検出の場合には 第5行の演算の順番を逆にし
てY (AY)−Xとする力\ 第6行の判定の部分を
ZくOとすればよレ〜
発明が解決しようとする課題
このような処理構成では 二つのデータの減算結果の判
定およびその結果によるプログラムの切換えにかなり長
い時間を要すも 特に実際の汎用のマイクロプロセッサ
では演算結果の判定と判定結果によるプログラムの切換
え(条件分岐処理)が1ステップの1マシンサイクルで
処理できず、プログラムステップ数が増加し、処理時間
が長くなム
本発明はこのような問題を解決するもので、簡単な手段
で高速処理が可能な最大値・最小値検出装置を提供する
ものであム
課題を解決するための手段
第1の発明の最大値・最小値検出装置は 2種類のデー
タを減算しまたは比較する手段と、この手段による減算
結果または比較結果により符号フラグを設定する符号フ
ラグ設定手段と、 2種類のデータが格納されるデータ
格納手段と、このデータ格納手段に格納される2種類の
データを同時に指定する指定手段と、この指定手段によ
り2種類のデータが同時に指定された場合に 符号フラ
グ設定手段により設定された符号フラグの状態により、
2種類のデータのうちの大きい方のデータまたは小さ
い方のデータのいずれかを選択する選択手段とを備えて
いも
第2の発明の最大値・最小値検出装置線 2種類のデー
タを減算しまたは比較する手段と、この手段による減算
結果または比較結果により符号フラグを設定する符号フ
ラグ設定手段と、 2種類のデータを格納するデータ格
納手段と、 2種類のデータのデーター格納手段におけ
るアドレスを格納するアドレス格納手段と、このデータ
格納手段に格納される2種類のデータを同時に指定する
指定手段と、この指定手段により2種類のデータが同時
に指定された場合に 符号フラグ設定手段で設定された
符号フラグの状態により2種類のデータのうちのデータ
のうちの大きい方のデータまたは小さい方のデータを選
択するデータ選択手段と、符号フラグの状態により2種
類のデータのうちの大きい方のデータのアドレスまたは
小さい方のデータのアドレスを選択するアドレス選択手
段と、このアドレス選択手段で選択されたアドレスをア
ドレス格納手段に格納する手段とを備えていも作用
この構成により、簡素な手法で2種類またはそれ以上の
種類のデータの最大値または最小値を高速で検出するこ
とができる最大値・最小値検呂装置 ならびに2種類ま
たはそれ以上の種類のデータの最大値または最小値ある
いは最大値データのアドレスまたは最小値データのアド
レスを高速で検出できる最大値・最小値検出装置を実現
することができも
実施例
まず、第1の発明の最大値・最小値検出装置の一実施例
について、第1図を用いて説明すも図において、 10
1はデータRAκ l02,103はデータバ入 10
4はALU,105は符号フラグレジスタ、 106は
選択回1!&107,108はデータレジスタであム
ALU104はデータパス102,103のデ一夕を比
較しまたは滅算すム ALU104による比較結果また
は減算結果の符号は符号フラグレジスタ105に設定さ
れも 選択回路10i:L符号フラグレジスタ105の
内容により、データレジスタ107または同108のい
ずれかを選択し、データパス103にデータを出力す4
データバス103に出力されたデータはデータレジス
タ108に設定され.5 ALU104で比較しある
いは減算する際には データバス102にデータRAM
I O 1のデータが出力され データバス103に
データレジスタ108のデータが出力されも 同時にデ
ータ′レジスタ107がデータバス102のデータを受
け取も 選択回路1064上ALU104の比較または
減算結果の符号フラグレジスタ105の内容によって、
データレジスタ107の内容(RAM 1 0 1のデ
ータ)またはデータレジスタ108の内容(その時点で
の最大値)のうちの大きい方のデータを選択し、データ
バス103にデータを出力すム 出力されたデータは最
大値データレジスタ108に設定されムこの手法により
、データレジスタ108のデータがデータRAM 1
0 1のデータより大きい場合には データレジスタ1
08に以前のデータがそのまま保持されも データRA
M 1 0 1のデータがデータレジスタ108のデー
タより大きい場合に番友 データレジスタ108の内
容がデータレジスタ107のデータに書き換えられも
したがって、データレジスタ108の内容力\ 以前の
データレジスタ108のデータとデータRAMIOIの
データのうちの大きい方のデータになムデータRAM
1 0 1のアドレスを更新しながら上記の処理を繰返
し行なうことで、データレジスタ108にはデータRA
MIOIに格納されている2種類またはそれ以上の種類
のデータのうちの最大値が格納されも
次に 第2の発明の最大値・最小値検出装置の一実施例
について、第2図を用いて説明すa図において、 10
1はデータRAM. 102,103はデータバ人 1
04はALU,105は符号フラグレジスタ、 106
は選択回1&107,108はデータレジスタ、 20
9はアドレスポインタ、 210はアドレスレジスタ、
211はアドレス選択回路であム
ALU1.04はデータバス102と同103のデータ
を比較しまたは減算をす−k ALU104による比
較結果または減算結果の符号は符号フラグレジスタ10
5に設定されも 選択回路106番上 符号フラグレ
ジスタ105の内容により、データレジスタ107また
は同108のいずれかを選択し、データバス103にデ
ータを出力すaデータバス103に出力されたデータは
データレジスタ108に設定され& ALU104で
比較しまたは減算をする際には データバス102にデ
ータRAMIOIのデータが出力され データバス10
3にデータレジスタ108のデータが出力されも それ
と同時に データレジスタ107がデータパス102の
データを受け取へ 選択回路106は ALUI 04
による比較結果または減算結果の符号フラグ符号フラグ
レジスタの内容によって、データレジスタ107の内容
(RAM101のデータ)またはデータレジスタ108
の内容(その時点での最大値)のうちの大きい方のデー
タを選択し、データパス103にデータを出力すム 出
力されたデータは最大値データレジスタ108に設定さ
れも この処理によりデータレジスタ108に設定され
ているデータとデータRAMIOIのデータとが比較さ
れて、データレジスタ108のデータ値が大きい場合に
番上 データレジスタ108のデータが以前のデータ
のままであム データRAMIOIのデータが大きい場
合には データレジスタ108のデータがデータレジス
タ107のデータに書き換えられム したがって、デー
タレジスタ108の内容は以前のデータレジスタ108
のデータとデータRAMIOIのデータのうちの大きい
方のデータになaアドレス選択回路2114;L A
LUl04の比較結果または減算結果の符号フラグレジ
スタlO5の内容により、アドレスポインタ209の内
容(その時点でのRAM 1 0 1のアドレス)また
はアドレスレジスタ210の内容(その時点での最大値
データのアドレス)のいずれかのアドレスデータを選択
し、アドレスレジスタ210にアドレスデータを出力す
ム 出力されたアドレスデータはアドレスレジスタl0
8に設定されも この処理によりデータレジスタ210
に設定されているデータとデータRAM 1 0 1の
データとが比較されて、データレジスタ108のデータ
値が大きい場合には アドレスレジスタ210のデータ
が以前のデータのままであム 反対に データRAM1
01のデータが大きい場合に番上 アドレスレジスタ2
10のデータがアドレスポインタ209のアドレスに書
き換えられも したがって、アドレスレジスタ210の
内容41 以萌のデータレジスタ108のデータとデ
ータRAM 1 0 1のデータとのうちの大きい方の
アドレスデータになムデータRAM 1 0 1のアド
レスを更新しながら上述の処理を繰返し行うことで、デ
ータレジスタ108にはデータRAMIOIに格納され
ている2種類またはそれ以上の種類のデータのうちの最
大値が格納され アドレスレジスタ210にはデータR
AMIOIに格納されている2種類またはそれ以上の種
類のデータのうちの最大値データのアドレスが格納され
も
以下に 上述した第1の発明の実施例のマイクロプロセ
ッサで、 50個のデータの最大値を検出するプログラ
ムの一例(以下r本実施例プログラムIJと称す)を示
す。100 200 However, AY ■
AY) V=AY AY= AY+1 IF AY≦50 GO To 100...
...Data address...Maximum value data address...Maximum value data register...Data register register Z...Arithmetic result (sign flag) This program To explain this, even if the 50 data files whose maximum values are to be detected are stored in memory (sometimes in registers) at consecutive addresses, in the first line, 5
Even if the start address of 0 data is specified, in the second line,
Even if the data at address 1 is stored as a temporary maximum value in the maximum value data register Then, even if the address of address 2 of 50 pieces of data is specified, in the 5th line, the data at addresses 1 and 2 are subtracted by X-Y (AY), and the calculation result Z (Z is set by the calculation result. In the 6th line, even if the sign of Z is determined, even if the value is negative, C'1 The program in the 7th line is executed. data register
&'-Even if the current addressed data Y (AY) is stored, the current data address AY is stored in the maximum value data address register V in the 8th line.In other words, the 7th and 8th lines are It is executed when the sign of Z in the 6th line is negative, and in the 7th line, if the data Y (AY) is greater than X, the contents of X are rewritten to Y (AY).The contents of V in the 8th line is rewritten to AY, and if the sign value of aZ is positive or 0, then the program on line 9 is executed.
) is incremented by 1, the value of data address AY is determined in the 10th line, and if the value is less than 50, the process branches to the 5th line.
The fifth part of the program ends when the number exceeds 50.
The process from line to line 10 is repeated 49 times, and finally the maximum value of the 50 data is set in the maximum value data register X, and even though the maximum value address is set in the maximum value data address register V, the minimum value In the case of detection, the order of the calculations in the 5th line is reversed so that Y (AY) - Problem With such a processing configuration, it takes a considerable amount of time to determine the result of subtracting two data and to switch the program based on the result. Especially in actual general-purpose microprocessors, it takes a long time to determine the result of subtraction between two pieces of data and to switch the program based on the result. Conditional branch processing) cannot be processed in one machine cycle per step, increasing the number of program steps and lengthening the processing time.The present invention solves these problems and enables high-speed processing with simple means. Means for Solving the Problem The maximum value/minimum value detecting device of the first invention comprises: a means for subtracting or comparing two types of data; and a means for subtracting or comparing two types of data. a code flag setting means for setting a code flag according to a subtraction result or a comparison result; a data storage means for storing two types of data; and a designation means for simultaneously specifying two types of data to be stored in the data storage means. , when two types of data are specified simultaneously by this specifying means, depending on the state of the sign flag set by the sign flag setting means,
The maximum value/minimum value detection device line of the second invention, further comprising a selection means for selecting either the larger data or the smaller data of the two types of data; means for comparing; code flag setting means for setting a code flag according to the subtraction result or comparison result by the means; data storage means for storing two types of data; and storing addresses of the two types of data in the data storage means. an address storage means, a specification means for simultaneously specifying two types of data to be stored in the data storage means, and a sign flag set by the sign flag setting means when two types of data are simultaneously specified by the specification means. data selection means for selecting the larger or smaller of the two types of data depending on the state of the data, and the address or address of the larger of the two types of data depending on the state of the sign flag. Even though it is equipped with an address selection means for selecting the address of the smaller data, and a means for storing the address selected by the address selection means in the address storage means, this structure allows two or more kinds of data to be selected in a simple manner. A maximum value/minimum value checking device capable of detecting the maximum value or minimum value of two or more types of data at high speed, and the maximum value or minimum value of two or more types of data, or the address or minimum value of the maximum value data. Embodiment First, an embodiment of the maximum value/minimum value detection device of the first invention will be described using FIG. 1. In the diagram, 10
1 is data RAκ l02, 103 is data bar input 10
4 is the ALU, 105 is the sign flag register, 106 is the selection time 1! &107, 108 are data registers. The ALU 104 compares or increments the data of the data paths 102, 103. The sign of the comparison result or subtraction result by the ALU 104 is set in the sign flag register 105. Selection circuit 10i: Depending on the contents of the L code flag register 105, either the data register 107 or 108 is selected and data is output to the data path 103.
The data output to the data bus 103 is set in the data register 108. 5 When comparing or subtracting in ALU 104, data RAM is connected to data bus 102.
Even if the data of I O 1 is output and the data of the data register 108 is output to the data bus 103, and at the same time the data' register 107 receives the data of the data bus 102, the sign flag register 105 of the comparison or subtraction result of the ALU 104 on the selection circuit 1064 Depending on the content of
Selects the larger data of the contents of the data register 107 (data in RAM 101) or the contents of the data register 108 (maximum value at that time), and outputs the data to the data bus 103. The data is set in the maximum value data register 108. By this method, the data in the data register 108 is set in the data RAM 1.
If the data is larger than 0 1, data register 1
Even if the previous data is retained as it is in 08, the data RA
If the data in M101 is larger than the data in the data register 108, the contents of the data register 108 may be rewritten with the data in the data register 107.
Therefore, the content of the data register 108 is changed to the larger of the previous data in the data register 108 and the data in the data RAMIOI.
By repeating the above process while updating the address of 1 0 1, data RA is stored in the data register 108.
When the maximum value of the two or more types of data stored in the MIOI is stored, In figure a to explain, 10
1 is data RAM. 102 and 103 are Databa people 1
04 is ALU, 105 is code flag register, 106
is selection time 1 & 107, 108 is data register, 20
9 is an address pointer, 210 is an address register,
211 is an address selection circuit. ALU 1.04 compares or subtracts the data on the data bus 102 and 103. The sign of the comparison result or subtraction result by the ALU 104 is stored in the sign flag register 10.
Even if set to 5, the selection circuit 106 selects either data register 107 or 108 according to the contents of the code flag register 105 and outputs data to the data bus 103.aThe data output to the data bus 103 is data. When the data RAMIOI is set in the register 108 and compared or subtracted in the ALU 104, the data of the data RAMIOI is output to the data bus 102.
At the same time, the data register 107 receives the data from the data path 102.The selection circuit 106 outputs the data from the data register 108 to ALUI 04.
The sign flag of the comparison result or the subtraction result depending on the contents of the sign flag register, the contents of the data register 107 (data in RAM 101) or the data register 108
Selects the larger data among the contents (maximum value at that time) and outputs the data to the data path 103. Even if the output data is set in the maximum value data register 108, this process The data set in the data register 108 is compared with the data in the data RAMIOI, and if the data value in the data register 108 is large, the data in the data register 108 remains the previous data, and the data in the data RAMIOI is large. The data in the data register 108 is rewritten to the data in the data register 107. Therefore, the contents of the data register 108 are the same as those in the previous data register 108.
A address selection circuit 2114; LA
Depending on the contents of the sign flag register lO5 of the comparison result or subtraction result of LUl04, the contents of the address pointer 209 (the address of RAM 1 0 1 at that time) or the contents of the address register 210 (the address of the maximum value data at that time) Select one of the address data and output the address data to the address register 210.The output address data is stored in the address register l0.
Even if it is set to 8, this process will cause the data register 210 to
The data set in the address register 210 is compared with the data in the data RAM 101, and if the data value in the data register 108 is large, the data in the address register 210 remains the previous data.
If the data in 01 is large, the top address register 2
10 is rewritten to the address of the address pointer 209. Therefore, the contents of the address register 210 are changed to the larger address data of the data of the data register 108 and the data of the data RAM 101. By repeating the above process while updating the 1 0 1 address, the data register 108 stores the maximum value of two or more types of data stored in the data RAMIOI, and the address register 210 data R
In the microprocessor of the embodiment of the first invention described above, the address of the maximum value data of two or more types of data stored in the AMIOI is stored as follows. An example of a program (hereinafter referred to as the present embodiment program IJ) for detecting is shown below.
100
ただし AY
X
Y(AY)
Z
W
AY= 1
X = Y (AY)
AY=2
Z=X−Y(AY)
X=W
AY=AY+1
IF AY≦50 Go To 100・・・・
・・ データアドレス
・・・・・・ 最大値データレジスタ
・・・・・・データレジスタ
・・・・・・演算結果
・・・・・・データレジスタ
(Xまたはり
このプログラムについて説明すると、最大値を検出する
データが連続したアドレスのメモリ(レジスタの場合も
ある)に格納されていも 第1行で、 50個のデータ
の先頭アドレスが指定されも第2行で、最大値データレ
ジスタXに1番地のデータが仮の最大値として格納され
も 第3行で、50個のデータの2番地のアドレスが指
定されも第4行で、 1番地と2番地のデータの滅算X
−Y(AY)を行われ 演算結果Z(Zは演算結果によ
り設定される符号フラグの場合もある)が得られも 第
5行で、演算結果Zの状態によって最大値データレジス
タXまたはデータレジスタY (AY)のデータが最大
値データレジスタに書き込まれも 演算結果Zが正また
はOの場合に番よ 最大値データレジスタXの値が再び
最大値データレジスタXに書き込まれ それが負の場合
に番ヨ データレジスタY (AY)の値が最大値デ
ータレジスタXに書き込まれム このWを指定した場合
の演算結果Zの状態によム 最大値データレジスタXま
たはデータレジスタY (AY)の選択Get, ハ
ードウェアで自動的に行なわれへ 第6行で、データレ
ジスタY (AY)を示すデータアドレスAIの値が1
インクリメントされも 第7行で、データアドレスAY
の値が判定さtL, AYの値が50以下であれば第
4行に分岐し、それが50を越えるとプログラムが終了
すム
プログラムの第4行から第7行までが49回薊返し実行
さt′lA 50個のデータのうちの最大値力1最犬値
データレジスタXに最終的に設定されム最小値の検出の
場合には 第4行の演算の順番を逆にしてY (AY)
−Xとすればよレ〜次に 上述した第2の発明の一実施
例のマイクロプロセッサで、50個のデータの最大値あ
るいは最大値のアドレスを検出するプログラムの一例(
以下[本実施例プログラム2」と称す)を示iAY=1
X=Y(AY)
V=1
100
ただし
AY
■
AY= 2 (4)Z
工X7Y(AY) (5)X=%
j (6)V=AW
(7)AY=AY+1
(8)IF AY≦50
Go TO 100 (9)・・・・
・・データアドレス
・・・・・・最大値データアドレスレジスタ
最大値データレジスタ
データレジスタ
演算結果
データレジスタ(Xまたはり
アドレスレジスタ (Vまたは
AY)
このプログラムについて説明すると、最大値を検出する
データは連続したアドレスのメモリ(レジスタの場合も
ある)に格納されていも 第1行で、 50個のデータ
の先頭アドレスが指定されム第2行で、最大値データレ
ジスタXに1番地のデータが仮の最大値として格納され
も 第3行で、最大値データアドレスレジスタVに1番
地のアドレスが仮の最大値データアドレスとして格納さ
れも 第4行で、 50個のデータの2番地のアドレス
が指定されも 第5行で、 1番地と2番地のデータの
滅算X−Y (AY)を行レ\ その演算結果Z (Z
は演算結果により設定される符号フラグの場合もある)
が得られも 第6行で、演算結果Zの状態によって最大
値データレジスタXまたはデータレジスタY (AY)
のデータが最大値データレジスタに書き込まれも 演算
結果Zが正またはOの場合に番ヨ 最大値データレジ
スタXの値が再び最大値データレジスタXに書き込まれ
それが負の場合には データレジスタY (AY)の
値が最大値データレジスタXに書き込まれa このWを
指定した場合の演算結果Zの状態による最大値データレ
ジスタXまたはデータレジスタY(AY)の選択は ハ
ードウェアで自動的に行なわれへ第7行で、演算結果Z
の状態によって、最大値データアドレスレジスタVまた
はデータアドレスAYのデータ力( 最大値データアド
レスレジスタ■に書き込まれも 演算結果Zが正または
0でる場合に番友 最大値データアドレスレジスタV
の値が再び最大値データアドレスレジスタVに書き込ま
れ それが負の場合には データアドレスAYの値が最
大値データアドレスレジスタVに書き込まれも このA
Wを指定した場合の演算結果Zの状態による最大値デー
タアドレスレジスタ■またはデータアドレスAYの選択
番上 ハードウエアで自動的に行なわれも 第8行で
、データレジスタY(AY)を示すデータアドレスAY
の値が1インクリメントされも 第9行で、データアド
レスAYの値が判定さA AYの値が50以下であれ
ば第5行に分岐し、それが50を越えるとプログラムが
終了すム
プログラムの第5行から第9行までが49回繰返し実行
され 50個のデータのうちの最大値が最大値データレ
ジスタXに また 最大値データのアドレスが最大値デ
ータアドレスレジスタVにそれぞれ最終的に設定されも
最小値の検出の場合には 第5行の演算の順番を逆にし
てY (AY) 一Xとすればよレ〜本実施例プログラ
ムlには 従来プログラム1と比較すると、この従来プ
ログラムlにおける第5行の演算結果Zの判定と条件分
岐の処理とがなレ〜 また 本実施例プログラム2に4
1 従来プログラム2と比較すると、この従来プログ
ラム2における第6行の演算結果Zの判定と条件分岐の
処理とがなレ〜
このように 本実施例プログラム1. 2ではプログ
ラムステップ数が削減されて、高速処理が可能となム
特に実際の汎用プロセッサにおいてはパイプライン処理
をしているたぬ 判定と判定結果による条件分岐処理に
時間を要するたぬ この判定と判定結果による条件分岐
処理のステップを減らすことは処理速度を高める上で非
常に重要であム
発明の効果
以上のように 本発明によれば 簡単な構成により2種
類以上のデータの最大値または最小憾ならびに2種類以
上のデータのうちの最大値または最小籠 もしくは最大
値データのアドレスまたは最小値データのアドレスを高
速で検出することができも100 However, AY X Y (AY) Z W AY= 1
... Data address ... Maximum value data register ... Data register ... Operation result ... Data register (Explaining the X or Riko program, the maximum value Even if the data to be detected is stored in memory (or registers) at consecutive addresses, even if the first address of 50 pieces of data is specified in the first line, 1 is stored in the maximum value data register X in the second line. Although the address data is stored as a temporary maximum value, in the third line, the address of the second address of 50 data is specified, but in the fourth line, the data at addresses 1 and 2 are decremented.
-Y (AY) is performed and the operation result Z (Z may be a sign flag set by the operation result) is obtained.In the fifth line, depending on the state of the operation result Z, the maximum value data register Even if the data of Y (AY) is written to the maximum value data register, if the calculation result Z is positive or O, then the value of the maximum value data register X is written to the maximum value data register X again, and if it is negative, then Number yo The value of data register Y (AY) is written to maximum value data register , to be performed automatically by hardware. In the 6th line, the value of data address AI indicating data register Y (AY) is 1.
In the 7th line, the data address AY is incremented.
If the value of tL, AY is less than 50, the program branches to the 4th line, and if it exceeds 50, the program ends.The program's 4th to 7th lines are executed 49 times. st'lA The maximum value among the 50 pieces of data is finally set in the data register )
-X is an example of a program (
Hereinafter referred to as "Example Program 2") iAY=1 X=Y(AY) V=1 100 However, AY ■ AY=2 (4)Z
Engineering X7Y (AY) (5)X=%
j (6) V=AW
(7)AY=AY+1
(8) IF AY≦50
Go TO 100 (9)...
...Data address... Maximum value data address register Maximum value data register Data register Operation result data register (X or address register (V or AY)) To explain this program, the data that detects the maximum value is continuous. In the first line, the first address of the 50 pieces of data is specified, and in the second line, the data at address 1 is temporarily stored in the maximum value data register X. In the third line, the address of address 1 is stored as the temporary maximum data address in the maximum value data address register V. In the fourth line, the address of address 2 of 50 pieces of data is specified. Also, in the 5th line, the calculation result Z (Z
may also be a sign flag set by the calculation result)
In the sixth line, depending on the state of the operation result Z, the maximum value data register X or data register Y (AY) is obtained.
Even if data is written to the maximum value data register, if the operation result Z is positive or O, the value of the maximum value data register X is written to the maximum value data register The value of (AY) is written to the maximum value data register In the seventh line, the calculation result Z
Depending on the state of the maximum value data address register V or data address AY (even if written to the maximum value data address register ■), if the operation result Z is positive or 0, the maximum value data address register V
The value of data address AY is again written to the maximum value data address register V, and if it is negative, the value of data address AY is written to the maximum value data address register V.
Maximum value depending on the state of operation result Z when W is specified Data address register ■ or data address AY selection top Even if it is automatically performed by hardware, the data address indicating data register Y (AY) on the 8th line AY
Even if the value of AY is incremented by 1, the value of data address AY is determined in the 9th line. If the value of AY is less than 50, the program branches to the 5th line, and if it exceeds 50, the program ends. The steps from the 5th line to the 9th line are executed 49 times, and the maximum value of the 50 pieces of data is finally set in the maximum value data register X, and the address of the maximum value data is finally set in the maximum value data address register V. In the case of detecting the minimum value, the order of the calculations in the 5th line is reversed and it becomes Y (AY) - What is the judgment of the calculation result Z on the 5th line and the conditional branch processing? Also, in this example program 2, 4
1 Compared with the conventional program 2, the determination of the calculation result Z in the 6th line and the conditional branch processing in the conventional program 2 are different. 2 reduces the number of program steps and enables high-speed processing.
In particular, in actual general-purpose processors, pipeline processing is performed, and it takes time to perform judgments and conditional branch processing based on judgment results.Reducing the steps of judgment and conditional branch processing based on judgment results is an effective way to increase processing speed. According to the present invention, the maximum value or minimum value of two or more types of data and the maximum value or minimum value of two or more types of data can be determined with a simple configuration. The address of value data or the address of minimum value data can be detected at high speed.
第1図は第1の発明の最大値・最小値検出装置の一実施
例のブロックは 第2図は第2の発明の最大値・最小値
検出装置の一実施例のブロック図であム
101・・・・・・データRAM, 102, 1
03・・・・・・データバ7,, 104・・・・・
・ALU% 105・・・・・・符号フラグレジスタ、
106・・・・・・選択回艮 107,108・・・
・・・データレジスタ、 209・・・・・・アドレス
ポインタ、 210・・・・・・アドレスレジスタ、
211・・・・・・アドレス選択回施FIG. 1 is a block diagram of an embodiment of the maximum value/minimum value detection device of the first invention. FIG. 2 is a block diagram of an embodiment of the maximum value/minimum value detection device of the second invention. ...Data RAM, 102, 1
03... Data bar 7,, 104...
・ALU% 105... Sign flag register,
106... Selected episode 107,108...
...Data register, 209...Address pointer, 210...Address register,
211...Address selection process
Claims (2)
前記手段による減算結果または比較結果により符号フラ
グを設定する符号フラグ設定手段と、前記2種類のデー
タが格納されるデータ格納手段と、前記データ格納手段
に格納される前記2種類のデータを同時に指定する指定
手段と、前記指定手段により前記2種類のデータが同時
に指定された場合に、前記符号フラグ設定手段により設
定された符号フラグの状態により前記2種類のデータの
うちの大きい方のデータまたは小さい方のデータのいず
れかを選択する選択手段とを備えていることを特徴とす
る最大値・最小値検出装置。(1) means for subtracting or comparing two types of data;
code flag setting means for setting a code flag based on the subtraction result or comparison result by the means; data storage means for storing the two types of data; and simultaneous designation of the two types of data to be stored in the data storage means. and when the two types of data are simultaneously specified by the specifying means, the larger or smaller data of the two types of data is determined depending on the state of the code flag set by the code flag setting means. 1. A maximum value/minimum value detection device, comprising: selection means for selecting one of the two types of data.
前記手段による減算結果または比較結果により符号フラ
グを設定する符号フラグ設定手段と、前記2種類のデー
タを格納するデータ格納手段と、前記2種類のデータの
前記データ格納手段におけるアドレスを格納するアドレ
ス格納手段と、前記データ格納手段に格納される前記2
種類のデータを同時に指定する指定手段と、前記指定手
段により前記2種類のデータが同時に指定された場合に
前記符号フラグ設定手段で設定された符号フラグの状態
により前記2種類のデータのうちのデータのうちの大き
い方のデータまたは小さい方のデータを選択するデータ
選択手段と、前記符号フラグの状態により前記2種類の
データのうちの大きい方のデータのアドレスまたは小さ
い方のデータのアドレスを選択するアドレス選択手段と
、前記アドレス選択手段で選択されたアドレスを前記ア
ドレス格納手段に格納する手段とを備えていることを特
徴とする最大値・最小値検出装置。(2) means for subtracting or comparing two types of data;
code flag setting means for setting a code flag according to the subtraction result or comparison result by the means; data storage means for storing the two types of data; and address storage for storing addresses of the two types of data in the data storage means. and the second data stored in the data storage means.
a designating means for simultaneously designating two types of data, and when the two types of data are simultaneously designated by the designation means, the data of the two types of data is determined by the state of the code flag set by the code flag setting means; data selection means for selecting the larger data or the smaller data of the two types of data; and selecting the address of the larger data or the address of the smaller data of the two types of data depending on the state of the code flag. A maximum value/minimum value detection device comprising: address selection means; and means for storing the address selected by the address selection means in the address storage means.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| US08/011,111 US5457645A (en) | 1989-11-24 | 1993-01-29 | Pattern recognition system including a circuit for detecting maximum or minimum data elements which determines the standard pattern closest to the input pattern |
Applications Claiming Priority (2)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP30540689 | 1989-11-24 | ||
| JP1-305406 | 1989-11-24 |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JPH03218515A true JPH03218515A (en) | 1991-09-26 |
Family
ID=17944747
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2255824A Pending JPH03218515A (en) | 1989-11-24 | 1990-09-25 | Maximum value/minimum value detector |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPH03218515A (en) |
Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS58222341A (en) * | 1982-06-18 | 1983-12-24 | Fujitsu Ltd | Median filter circuit |
| JPS61122747A (en) * | 1984-11-14 | 1986-06-10 | インタ−ナショナル ビジネス マシ−ンズ コ−ポレ−ション | Data processor |
| JPS62134721A (en) * | 1985-12-06 | 1987-06-17 | Nec Corp | Digital signal selecting circuit |
| JPH01271876A (en) * | 1988-04-22 | 1989-10-30 | Nec Corp | Comparison arithmetic processor |
-
1990
- 1990-09-25 JP JP2255824A patent/JPH03218515A/en active Pending
Patent Citations (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS58222341A (en) * | 1982-06-18 | 1983-12-24 | Fujitsu Ltd | Median filter circuit |
| JPS61122747A (en) * | 1984-11-14 | 1986-06-10 | インタ−ナショナル ビジネス マシ−ンズ コ−ポレ−ション | Data processor |
| JPS62134721A (en) * | 1985-12-06 | 1987-06-17 | Nec Corp | Digital signal selecting circuit |
| JPH01271876A (en) * | 1988-04-22 | 1989-10-30 | Nec Corp | Comparison arithmetic processor |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US6789098B1 (en) | Method, data processing system and computer program for comparing floating point numbers | |
| JP3676882B2 (en) | Microprocessor and its peripheral devices | |
| US4878189A (en) | Microcomputer having Z-flag capable of detecting coincidence at high speed | |
| JP2617974B2 (en) | Data processing device | |
| JPH03218515A (en) | Maximum value/minimum value detector | |
| JPH1091395A (en) | Processor | |
| JPH0528431B2 (en) | ||
| US5457645A (en) | Pattern recognition system including a circuit for detecting maximum or minimum data elements which determines the standard pattern closest to the input pattern | |
| JP2965045B2 (en) | Semiconductor integrated circuit device | |
| JP2889244B2 (en) | Image processing device | |
| JPH02239349A (en) | Circuit for detecting exception of virtual computer | |
| JPS63279321A (en) | Microprogram controller | |
| JP2636076B2 (en) | Vector processing equipment | |
| JPS63156233A (en) | System for generating load instruction of integer type data | |
| JPH01228020A (en) | Comparing device | |
| JP3110072B2 (en) | Pre-normalization circuit | |
| JPS6224816B2 (en) | ||
| JP3723311B2 (en) | Parallel processor | |
| JPH06332670A (en) | Sorting processor provided with adder circuit | |
| JPS63174173A (en) | Information processor | |
| JPH1139159A (en) | Computer system | |
| JPH02201644A (en) | Pipe line computing element | |
| JPS6354669A (en) | Vector processor | |
| JPH01195532A (en) | microprocessor | |
| JPS63223833A (en) | arithmetic device |