JPH02297623A - Microprocessor - Google Patents

Microprocessor

Info

Publication number
JPH02297623A
JPH02297623A JP11736489A JP11736489A JPH02297623A JP H02297623 A JPH02297623 A JP H02297623A JP 11736489 A JP11736489 A JP 11736489A JP 11736489 A JP11736489 A JP 11736489A JP H02297623 A JPH02297623 A JP H02297623A
Authority
JP
Japan
Prior art keywords
data
input
address
register
stored
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
JP11736489A
Other languages
Japanese (ja)
Inventor
Kohei Eguchi
江口 公平
Yuichi Shiraki
白木 裕一
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.)
Oki Electric Industry Co Ltd
Original Assignee
Oki Electric Industry Co 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 Oki Electric Industry Co Ltd filed Critical Oki Electric Industry Co Ltd
Priority to JP11736489A priority Critical patent/JPH02297623A/en
Publication of JPH02297623A publication Critical patent/JPH02297623A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To reduce the number of steps of a program required for a loop by replacing a processing in software fashion to find the maximum value and its memory address from data by hardware. CONSTITUTION:A Y-input register 26 which latches the data that flows to Y-input out of two-input ports X and Y of an arithmetic and logic unit(ALU) 2, a data register 27 which latches the data in the Y-input register 26 with the ALU2 when a computed result(X-Y) is shown as X<Y and whose output is connected to the input port X of the ALU 2, an address register 28 which latches the address value of a memory 4 with the ALU 2 when the computed result (X-Y) is shown as X<Y similarly, and a gate circuit 21 which controls those data register 27 and address register 28 when it is X<Y are provided. Thereby, it is possible to reduce the number of steps of the program required for the loop by reducing the number of instructions of a microprogram in the loop.

Description

【発明の詳細な説明】 [産業上の利用分野] 本発明はマイクロプロセッサに係り、特にマイクロプロ
セッサにおけるメモリ内データの最大値または最小値と
その値が格納されているアドレスとを、ソフト的にでは
なく、ハード的に求めるデータ制御回路に関するもので
ある。
[Detailed Description of the Invention] [Industrial Application Field] The present invention relates to a microprocessor, and in particular, it is possible to determine by software the maximum or minimum value of data in memory in a microprocessor and the address where that value is stored. Rather, it is related to the data control circuit required in terms of hardware.

[従来の技術] 第2図は従来のマイクロプロセッサの一構成例を示すブ
ロック図である(特願昭62−154328号明細書)
[Prior Art] Fig. 2 is a block diagram showing an example of the configuration of a conventional microprocessor (Japanese Patent Application No. 154328/1982).
.

算術論理演算器2(以下、AlO2と略称)は2個の入
力ポートX、Yを有し、X入力ポートに入力されたデー
タからY入力ポートに入力されたデータを減算する。こ
の減算により、AlO2からはSフラグ19が出力され
、Sフラグ19はAlO2の演算結果が負のときアクテ
ィブとなる。これら2個の入力ポートX、Yのうち入力
ポートYには、Y入力バス11を介してデータバス1上
に乗るデータが入力される。また、入力ポートXには、
AlO2の演算結果を格納するアキュムレータ3(以下
、ACC3と略称)の出力がACC出力バスIOを介し
て入力される。このA、 CC3の出力は分岐されてデ
ータバス1にも送られる。
Arithmetic logic unit 2 (hereinafter abbreviated as AlO2) has two input ports X and Y, and subtracts data input to the Y input port from data input to the X input port. As a result of this subtraction, the S flag 19 is output from AlO2, and the S flag 19 becomes active when the calculation result of AlO2 is negative. Of these two input ports X and Y, data on the data bus 1 is input to the input port Y via the Y input bus 11. In addition, input port
The output of an accumulator 3 (hereinafter abbreviated as ACC3) that stores the calculation result of AlO2 is inputted via the ACC output bus IO. The outputs of A and CC3 are branched and sent to data bus 1 as well.

アドレスポインタ5はメモリアドレス線14を介してメ
モリ4へ指示すべきアドレスを出力する。
Address pointer 5 outputs an address to be specified to memory 4 via memory address line 14.

メモリ4の入出力はメモリバス13を介してデータバス
1に接続され、指示アドレスに格納されているデータを
データバス1上に読み出し、あるいはデータバス1から
送られて来るデータを指示アドレスに書き込む。
The input/output of the memory 4 is connected to the data bus 1 via the memory bus 13, and the data stored at the designated address is read onto the data bus 1, or the data sent from the data bus 1 is written to the designated address. .

Aレジスタ6、Bレジスタ7、Cレジスタ8゜Dレジス
タ9の4個のレジスタは、それぞれA ノ<ス15.B
バス16.Cバス17.Dバス18を介してデータバス
1に接続され、データバス1上のデータを取り込み、あ
るいは取り込んだデータをデータバスl上に出力する。
The four registers A register 6, B register 7, C register 8, and D register 9 are respectively A register 6, B register 7, C register 8, and D register 9. B
Bus 16. C bus 17. It is connected to the data bus 1 via the D bus 18, and takes in data on the data bus 1, or outputs the taken data onto the data bus 1.

このように構成されたマイクロプロセッサにおいて、今
、第3図に示すように、メモリ4へのアドレスAiから
Ai+(n−1)(ただし、i≧0、n≧2)までに格
納されているデータn個の中から最大値と、その最大値
が格納されているメモリアドレスを求めることを考える
In the microprocessor configured in this way, as shown in FIG. Consider finding the maximum value among n pieces of data and the memory address where the maximum value is stored.

最大値とそのメモリアドレスを求めるためのアルゴリズ
ムを示したのが第4図である。ここで、Akはメモリア
ドレス、(X)はXに格納されているデータ、Rmax
は最大値を格納するレジスタ。
FIG. 4 shows an algorithm for finding the maximum value and its memory address. Here, Ak is the memory address, (X) is the data stored in X, and Rmax
is a register that stores the maximum value.

ARma xは最大値のメモリアドレスの値を格納する
レジスタである。
ARmax is a register that stores the maximum memory address value.

先ず、メモリアドレスAiに格納されているデータ(A
i)を最大値を格納するレジスタRma xに、メモリ
アドレスAiの値を最大値のメモリアドレスの値を格納
するレジスタARmaxにそれぞれ格納した上で、i+
1をレジスタkにセットする(ステップ4]、、42)
First, data stored at memory address Ai (A
After storing i) in the register Rmax x that stores the maximum value and the value of the memory address Ai in the register ARmax that stores the value of the maximum memory address,
Set 1 to register k (step 4], 42)
.

次に、レジスタRma xに格納された値がレジスタ(
Ak)に格納された値よりも小さいか否かが判断される
(ステップ43)。Rmax<(Ak)であれば、レジ
スタ内容を更新する必要があるとして、データ(Ak)
の値をレジスタRma xに、メモリアドレスAkの値
をARma xに格納スル(ステップ44)。逆にRm
a x≧(A k )であれば、更新する必要がないの
で上記ステップ44をジャンプする。ここでに+lをレ
ジスタkに格納する(ステップ45)。
Next, the value stored in register Rmax is set to register (
It is determined whether the value is smaller than the value stored in Ak) (step 43). If Rmax<(Ak), it is assumed that the register contents need to be updated, and the data (Ak)
The value of the memory address Ak is stored in the register Rmax, and the value of the memory address Ak is stored in the ARmax (step 44). On the contrary, Rm
If a x≧(A k ), there is no need to update, and the process jumps to step 44 above. At this point, +l is stored in register k (step 45).

その後、レジスタにの内容かに= i −nであるか否
かを判断して、否であれば全メモリアドレスについての
サーチが未だ終了していないとしてステップ43へ戻り
、メモリアドレスAi〜Ai−(n−1)までに格納さ
れているデータの中から最大値とそのメモリアドレスと
を求めるループ(ステップ43〜46)を、k = i
−nになるまで(合計n回)繰り返す(ステップ46)
Thereafter, it is determined whether the contents of the register = i -n, and if not, it is determined that the search for all memory addresses has not yet been completed, and the process returns to step 43, where the memory addresses Ai to Ai- are searched. The loop (steps 43 to 46) for finding the maximum value and its memory address from among the data stored up to (n-1) is performed by k = i
Repeat until -n (total n times) (step 46)
.

上述した第4図に示すアルゴリズムを第2図に示す従来
のマイクロプロセッサで実現するための手順を第5図に
示す。ここで、ARはデータの最大値を格納するAレジ
スタ(3,BRはその最大値のメモリアドレスを格納す
るBレジスタ7、CRはサーチする最初の番地となるに
番目のアドレスAkを格納するCレジスタ3.DRは最
終番地であるi−n番目のアドレスを格納するDレジス
タ9である。
FIG. 5 shows a procedure for implementing the algorithm shown in FIG. 4 described above using the conventional microprocessor shown in FIG. 2. Here, AR is A register (3) that stores the maximum value of data, BR is B register 7 that stores the memory address of the maximum value, and CR is C that stores the first address Ak to be searched. Register 3.DR is a D register 9 that stores the i-nth address, which is the final address.

先ず、メモリアドレスAtに格納されているデータ(A
i)を最大値を格納するレジスタARに、メモリアドレ
スAiの値を最大値のメモリアドレスの値を格納するレ
ジスタBRに、i+ll目のアドレスAt+1をレジス
タCRに、i−1番目のアドレスAi−nをレジスタD
Rにそれぞれ格納する。その上で、アドレスポインタ5
のアドレスをAi+lにセットする。ここでi+lはレ
ジスタkにセットする(ステップ51.52)。
First, data (A
i) in the register AR that stores the maximum value, the value of the memory address Ai in the register BR that stores the value of the maximum memory address, the i+llth address At+1 in the register CR, and the i-1th address Ai- n to register D
Each is stored in R. On top of that, address pointer 5
Set the address of Ai+l. Here, i+l is set in register k (steps 51 and 52).

次に、レジスタARに格納したデータ(AR)から、ア
ドレスポインタ5によって指定されたアドレスAkに格
納されているメモリ4のデータ(Ak)を読み出してA
lO2により減算し、その演算結果をACC3に格納す
る(ステップ53)。この演算結果によりAlO2から
出されるSフラグ19がアクティブか否かを判断する(
ステップ54)。アクティブであれば、レジスタ内容を
更新する必要があるとして、メモリ4から読み出したデ
ータ(Ak)の値をデータレジスタARに、レジスタC
Rに格納されているメモリアドレス(CR)の値をアド
レスレジスタBRにそれぞれ格納する(ステップ55)
。逆にアクティブでなければ、更新する必要がないので
上記ステップ55をジャンプする。
Next, from the data (AR) stored in the register AR, the data (Ak) in the memory 4 stored at the address Ak specified by the address pointer 5 is read out.
It is subtracted by lO2, and the calculation result is stored in ACC3 (step 53). Based on this calculation result, it is determined whether the S flag 19 output from AlO2 is active or not (
Step 54). If it is active, it is assumed that it is necessary to update the register contents, and the value of the data (Ak) read from memory 4 is transferred to data register AR and register C.
The values of the memory addresses (CR) stored in R are stored in the address register BR (step 55).
. On the other hand, if it is not active, there is no need to update, so skip step 55 above.

そして、次に予め1つ進めたアドレスを記憶させておく
ために、AlO2によって、アドレスポインタCR内に
格納されているアドレスデータ(CR)に1を加算し、
その結果をACC3に蓄積し、その結果(A CC)を
更にアドレスレジスタCRに格納する(ステップ56.
57)。
Then, in order to store the address advanced by one in advance, 1 is added to the address data (CR) stored in the address pointer CR by AlO2,
The result is accumulated in ACC3, and the result (ACC) is further stored in address register CR (step 56.
57).

その後、実際にアドレスを1つ進めるために、アドレス
ポインタ5のメモリアドレスを1増加させる。即ち、k
の値をに+lにセットする(ステップ58)。そして、
レジスタCRに格納したアドレスデータ(CR)から、
最終アドレスレジスタDRに格納されているアドレスデ
ータ(D R)ヲALU2により減算する。即ち、Ak
からAi−nを減算し、その演算結果をACC3に格納
する(ステップ59)。この演算結果により、レジスタ
CRとDRとの内容が(CR)−(DR)であるか否か
を判断して、否であれば必要とする範囲のメモリアドレ
スについてのサーチが未だ終了していないとしてステッ
プ53へ戻り、メモリアドレスAi〜Ai−(n−1)
までに格納されているデータの中から最大値とそのメモ
リアドレスとを求めるループ(ステップ53〜60)を
、(CR)=(DR)になるまで(合計n回)繰り返す
(ステップ60)。
Thereafter, in order to actually advance the address by one, the memory address of the address pointer 5 is increased by one. That is, k
The value of is set to +l (step 58). and,
From the address data (CR) stored in register CR,
The address data (DR) stored in the final address register DR is subtracted by ALU2. That is, Ak
Ai-n is subtracted from and the result of the calculation is stored in ACC3 (step 59). Based on the result of this operation, it is determined whether the contents of registers CR and DR are (CR) - (DR), and if not, the search for the memory address in the required range has not been completed yet. The process returns to step 53, and the memory address Ai to Ai-(n-1) is
The loop for finding the maximum value and its memory address from among the data stored up to now (steps 53 to 60) is repeated (n times in total) until (CR)=(DR) (step 60).

このようにして、上記ループ内でメモリデータの大小を
求める演算と、サーチするアドレスの記憶と、サーチア
ドレスが最終アドレスに達したか否のチェックとの3つ
の処理を行って、最終的に、最大値はAレジスタ6 (
AR)に、そして、最大値のメモリアドレスはBレジス
タ7 (BR)に求められている。
In this way, the three processes of calculating the size of memory data, storing the search address, and checking whether the search address has reached the final address are performed in the above loop, and finally, The maximum value is A register 6 (
AR), and the memory address of the maximum value is found in the B register 7 (BR).

[発明が解決しようとする課題] しかしながら、上記した構成の従来装置では、メモリア
ドレスAiからAi+(n−1)までに格納されている
n個のデータの最大値と、そのメモリアドレスとを求め
るために、第5図に示す0回ループする部分でのマイク
ロプログラム命令に数命令を必要とし、この数を例えば
pとすると、ループ全体のステップ数は、 Xn となり、ループのステップ数は、nが大きいとpが1つ
増えるだけでn個も増えてしまうという欠点があった。
[Problems to be Solved by the Invention] However, in the conventional device having the above configuration, the maximum value of n pieces of data stored from memory address Ai to Ai+(n-1) and the memory address thereof are determined. Therefore, several instructions are required for the microprogram instructions in the part that loops 0 times as shown in FIG. If p is large, there is a drawback that n increases just by increasing p by one.

この発明の目的は、取り扱うデータの個数nが大きいと
、ループ内のマイクロプログラム命令数pが1つ増える
だけでループ全体のステップがn個増え、その結果非常
に大きなステップ数になることが避けられないというソ
フトウェア的処理ではなく、現時点でのデータ最大値と
その最大値のメモリアドレスとを、ハードウェア的処理
によって自動的に更新して求めることによって、上述し
た従来技術の問題点を解消して、ループ内のマイクロプ
ログラムの命令数を減らしてループに必要なプログラム
のステップ数を大幅に減らすことができるマイクロプロ
セッサを提供することにある。
The purpose of this invention is to avoid the fact that when the number n of data to be handled is large, the number of steps in the entire loop increases by n just by increasing the number of microprogram instructions in the loop by one, resulting in a very large number of steps. The above-mentioned problems of the conventional technology are solved by automatically updating and determining the current maximum data value and the memory address of the maximum value through hardware processing, instead of using software processing such that the current maximum data value and the memory address of that maximum value are automatically updated. Therefore, it is an object of the present invention to provide a microprocessor that can significantly reduce the number of program steps required for a loop by reducing the number of microprogram instructions in a loop.

[課題を解決するための手段] この発明のマイクロプロセッサは、記憶装置に格納され
ているデータの中から最大値または最小値を求めると共
に、その最大値または最小値が格納されている記憶装置
の番地を求めるものである。
[Means for Solving the Problems] A microprocessor of the present invention determines the maximum value or minimum value from among data stored in a storage device, and calculates the maximum value or minimum value from among the data stored in the storage device. It asks for the street address.

このようなマイクロプロセッサは、2個の入力ポートX
、Yを有し、入力ポートXに入力されたデータから入力
ポートYに入力されたデータを減算する算術論理演算器
と、上記記憶装置の番地を順次指定することにより、記
憶装置からこれに格納されているデータを順次取り出し
て、上記算術論理演算器の2個の入力ポートX、Yのう
ち入力ポートYに入力する入力手段と、上記入力ポート
Yに入力されるデータを分岐して、この分岐データを入
力とするY入力蓄積手段とを備えている。
Such a microprocessor has two input ports
, Y, which subtracts the data input to the input port Y from the data input to the input port The data input to the input port Y of the two input ports X and Y of the arithmetic logic unit is branched, and the data input to the input port Y is branched. Y input storage means that receives branch data as input.

そして、さらに上記Y入力蓄積手段の出力を入力とし、
かつ上記算術論理演算器の2個の入力ポートX、Yのう
ち入力ポートXに出力を入力するデータ蓄積手段と、上
記記憶装置の指定番地を入力とする番地蓄積手段と、上
記算術論理演算器による演算結果が負または正になった
ときに、Y入力蓄積手段の出力を上記データ蓄積手段に
入力させると共に、上記記憶装置の指定番地を上記番地
蓄積手段に入力させるゲート回路とを備えて構成された
ものである。
Further, the output of the Y input storage means is input,
and data storage means for inputting an output to input port X of the two input ports X and Y of the arithmetic and logic operation unit, address storage means for inputting a specified address of the storage device, and the arithmetic and logic operation unit. and a gate circuit that inputs the output of the Y input storage means to the data storage means and inputs a specified address of the storage device to the address storage means when the calculation result becomes negative or positive. It is what was done.

[作用] 本発明のマイクロプロセッサにより、記憶装置に格納さ
れているデータの中から最大値と、その最大値が格納さ
れている記憶装置の番地を求める場合について述べる。
[Operation] A case will be described in which the microprocessor of the present invention determines the maximum value from among data stored in a storage device and the address of the storage device where the maximum value is stored.

入力ポートxに入力されるデータ蓄積手段の出力と、記
憶装置の指定番地から取り出されて、入力ポートYに入
力される記憶データとがALUによって減算される。な
お、上記Y入力ポートに入力される記憶データは分岐さ
れて、Y入力蓄積手段に蓄積される。
The ALU subtracts the output of the data storage means input to the input port x from the stored data retrieved from the designated address of the storage device and input to the input port Y. Note that the storage data input to the Y input port is branched and stored in the Y input storage means.

ALUによる演算結果が負になると、ゲート回路により
、上記記憶データが現段階で最大値であると判断され、
この記憶データの蓄積されているY入力蓄積手段からそ
の記憶データかデータ蓄積手段に転送されて蓄積される
When the calculation result by the ALU becomes negative, the gate circuit determines that the stored data is the maximum value at the current stage,
The stored data is transferred from the Y input storage means in which the stored data is stored to the data storage means and stored therein.

また、同時に現段階で最大値であると判断された記憶デ
ータの格納されている指定番地が番地蓄積手段に蓄積さ
れる。
At the same time, the designated address where the storage data determined to be the maximum value at the current stage is stored is stored in the address storage means.

入力手段により、次の番地が指定されると、記憶装置か
ら当該番地に格納されている次の記憶データ(今回の記
憶データ)が取り出されて、入力ポートYに入力される
。このとき入力ポートXには最大値と判断されている記
憶データ(前回の記憶データ)がデータ蓄積手段から入
力される。このとき今回の記憶データがY入力蓄積手段
に蓄積される。
When the next address is specified by the input means, the next storage data (current storage data) stored at the address is taken out from the storage device and input to the input port Y. At this time, stored data determined to be the maximum value (previous stored data) is input to input port X from the data storage means. At this time, the current storage data is stored in the Y input storage means.

これら両データの減算をするALUによる演算結果が、
ここで例えば正になると、前回の記憶データが現段階で
未だ最大値であると判断されるので、今回の記憶データ
が蓄積されているY入力蓄積手段からはその記憶データ
がデータ蓄積手段には転送されず、データ蓄積手段には
前回の記憶データが蓄積されたままとなる。同様に番地
蓄積手段にも前回の指定番地が保持されたままとなる。
The calculation result by the ALU that subtracts these two data is
For example, if it becomes positive, it is determined that the previous stored data is still the maximum value at this stage, so the stored data is transferred from the Y input storage means that stores the current stored data to the data storage means. The data is not transferred, and the previously stored data remains stored in the data storage means. Similarly, the previously designated address remains held in the address storage means.

逆に、演算結果が負になると、前回と同様に、データ蓄
積手段と番地蓄積手段とにそれぞれ蓄積される内容は更
新され、現段階で最大値であると判断された今回の記憶
データがデータ蓄積手段に蓄積され、またその記憶デー
タの格納されている指定番地が番地蓄積手段に蓄積され
る。
Conversely, if the calculation result is negative, the contents stored in the data storage means and the address storage means are updated, and the current stored data, which is determined to be the maximum value at the current stage, becomes the data. The stored data is stored in the storage means, and the specified address where the stored data is stored is stored in the address storage means.

このようにして、アドレスを自動的に進めることで、記
憶装置のデータを順次取り出して、この取り出したデー
タと前回までに最大値と判断されたデータとがALUに
より繰返し演算され、演算結果が負であれば最大値とそ
の番地とが更新され、正であれば前回までの最大値とそ
の番地が(♀持される。
In this way, by automatically advancing the address, the data in the storage device is retrieved sequentially, and the ALU repeatedly calculates the retrieved data and the data that was determined to be the maximum value up to the previous time, and the result of the calculation is negative. If so, the maximum value and its address are updated, and if it is positive, the maximum value and its address up to the previous time are retained.

従って、データ蓄積手段と番地蓄積手段とに最終的に残
ったデータおよび番地が、最大値であり、また最大値の
番地となる。
Therefore, the data and address that ultimately remain in the data storage means and address storage means have the maximum value and become the address of the maximum value.

なお、最小値を求める場合には、演算結果が正のときに
データおよび番地を更新させればよく、その他は最大値
の場合と同じである。
Note that when determining the minimum value, the data and address may be updated when the calculation result is positive, and the rest is the same as in the case of the maximum value.

[実施例] 以下、本発明の一実施例を第1図を用いて説明する。[Example] An embodiment of the present invention will be described below with reference to FIG.

m1図はこの発明のマイクロプロセッサの一例を示すブ
ロック図である。
Figure m1 is a block diagram showing an example of the microprocessor of the present invention.

ALU2は、2個の入力ポートX、Yを有し、入力ポー
トXに入力されたデータから入力ポートYに入力された
データを減算する。この減算によりALU2からはAL
U2の演算結果が負のときアクティブとなるSフラグ1
9が北方される。これら2個の入力ポートX、Yのうち
入力ポートYには、Y入力バス11を介してデータバス
1上に乗るデータが入力される。
ALU2 has two input ports X and Y, and subtracts the data input to input port Y from the data input to input port X. By this subtraction, the AL
S flag 1 becomes active when the calculation result of U2 is negative.
9 will be northward. Of these two input ports X and Y, data on the data bus 1 is input to the input port Y via the Y input bus 11.

また、入力ポートXには、セレクタ25より選択された
2つのデータのうちのいずれか一方のデータが入力バス
24を介して入力される。セレクタ25により選択され
る2つのデータの一方は、AlO2の演算結果を格納す
るACC3の出力であり、これはACC出力バス10を
介して供給される。この入力ポートXに入力されるAC
C3の出力は分岐されてデータバスlにも送られる。
Furthermore, one of the two pieces of data selected by the selector 25 is input to the input port X via the input bus 24. One of the two data selected by the selector 25 is the output of the ACC 3 that stores the calculation result of AlO 2 , and this is supplied via the ACC output bus 10 . AC input to this input port
The output of C3 is branched and also sent to data bus l.

セレクタ25により選択される他方のデータは、データ
レジスタ出力バス23を介して供給されるデータレジス
タ27の出力である。ここで、セレクタ25を設けてA
CC3の出力がAlO2にフィードバックする系を残し
ておいたのは、一般的に持っているAlO2の機能を損
ねないようにするためである。
The other data selected by selector 25 is the output of data register 27 supplied via data register output bus 23. Here, a selector 25 is provided to
The reason why the system in which the output of CC3 is fed back to AlO2 was left in place is to prevent the general function of AlO2 from being impaired.

入力手段は、アドレスポインタ5からメモリアドレス線
14を介してメモリ4のアドレスを順次指定することに
より、メモリ4からこれに格納されているデータを順次
読み出して、メモリバス13を通してデータバスl上に
導き、Y入力バス11を介して上記ALU2の2個の入
力ポートX。
The input means sequentially specifies the addresses of the memory 4 from the address pointer 5 via the memory address line 14, thereby sequentially reading out the data stored in the memory 4 and transmitting the data onto the data bus l through the memory bus 13. and the two input ports X of said ALU 2 via the Y input bus 11.

Yのうちの入力ポートYに入力する。Input to input port Y of Y.

Y入力レジスタ26は、AlO2の入力ポートYへY入
力バス11を介して入力される入力データが分岐して入
力され、これをラッチする。
The Y input register 26 receives branched input data input to the input port Y of the AlO2 via the Y input bus 11 and latches it.

データレジスタ27は、Y入力レジスタ26の出力を入
力とし、かつAlO2の2個の入力ポートX、Yのうち
入力ポートXにセレクタ25を介してその出力を供給す
る。
The data register 27 receives the output of the Y input register 26 as an input, and supplies the output to the input port X of the two input ports X and Y of the AlO2 via the selector 25.

アドレスレジスタ28は、メモリアドレス線14を介し
てメモリ4に供給される指定アドレスを分岐して入力と
し、これをラッチしてアドレスバス18を介してデータ
バスl上に送出する。
The address register 28 branches the designated address supplied to the memory 4 via the memory address line 14 as an input, latches it, and sends it out via the address bus 18 onto the data bus l.

ゲート回路21は例えばAND回路で構成され、AlO
2による演算結果が負になって、これより出力されるS
フラグ19がアクティブになったとき、常時マイクロプ
ログラム命令に同期してパルスを発生するクロック20
を、データレジスタ27およびアドレスレジスタ28に
出力して、Y入力レジスタ26の出力をデータレジスタ
27に入力させると共に、アドレスポインタ5がらメモ
リ4に出力される指定アドレスをアドレスレジスタ28
に入力させる。
The gate circuit 21 is composed of, for example, an AND circuit, and is made of AlO
2 becomes negative, and the output S
A clock 20 that always generates a pulse in synchronization with the microprogram instruction when the flag 19 becomes active.
is outputted to the data register 27 and the address register 28, the output of the Y input register 26 is inputted to the data register 27, and the specified address outputted to the memory 4 from the address pointer 5 is inputted to the address register 28.
input.

さて、次に上記したような構成の作動について説明する
Next, the operation of the above-described configuration will be explained.

今、メモリ4のアドレスAiがらAi+(n−1)(た
だし、i≧0、n≧2)までに格納されているデータn
個の中から最大値と、その最大値のアドレスを求めるこ
とを考える。
Data n currently stored in memory 4 from address Ai to Ai+(n-1) (where i≧0, n≧2)
Consider finding the maximum value and the address of that maximum value.

まず、メモリ4のアドレスAiに格納されているデータ
(Ai)をデータレジスタ27に格納し、また、アドレ
スポインタ5の示すアドレス値Aiをアドレスレジスタ
28に格納した上で、メモリアドレスをAi+lにセッ
トしておく。
First, the data (Ai) stored at the address Ai of the memory 4 is stored in the data register 27, and the address value Ai indicated by the address pointer 5 is stored in the address register 28, and then the memory address is set to Ai+l. I'll keep it.

次に、ある特別なマイクロプログラム命令、即ち最大値
及びそのアドレスを求めるという1つのマイクロプログ
ラム命令を実行すると、セレクタ25がデータレジスタ
27からの出力を選択し、データレジスタ27に格納さ
れているデータ(T2R)と、アドレスポインタ5が現
在水しているアドレスAmに格納されているメモリ4の
データ(Am)との間で、AlO2によって (T2R)−(Am) という減算を行い、メモリ4のアドレスを1増加させる
ということが実行される。
Next, when a certain special microprogram instruction, that is, one microprogram instruction to find the maximum value and its address, is executed, the selector 25 selects the output from the data register 27, and the data stored in the data register 27 is (T2R) and the data (Am) in the memory 4 stored at the address Am that the address pointer 5 is currently pointing to, the subtraction (T2R) - (Am) is performed using AlO2. Incrementing the address by 1 is performed.

また、この動作と同時に、まず、AlO2の入力ポート
Yに流れるデータ(Am)はY入力レジスタ26にラッ
チされる。そして、AlO2の演算結果が負のときにS
フラグ19がアクティブとなり、ゲート回路21はSフ
ラグ19がアクティブになったときのみクロック2oの
パルスを通過させる。これがカウントクロック22とな
って、データレジスタ27のクロック入力に入力され、
今ラッチしたばかりのY入力レジスタ26のデータ(A
m)がデータレジスタ27にラッチされる。
Also, at the same time as this operation, data (Am) flowing into the input port Y of the AlO2 is latched into the Y input register 26. Then, when the calculation result of AlO2 is negative, S
The flag 19 becomes active, and the gate circuit 21 allows the pulse of the clock 2o to pass only when the S flag 19 becomes active. This becomes the count clock 22 and is input to the clock input of the data register 27.
The data of the Y input register 26 that has just been latched (A
m) is latched into the data register 27.

また一方では、カウントクロック22はアドレスレジス
タ28のクロック入力に入力され、アドレスポインタ5
のアドレス出力値Amがアドレスレジスタ28にラッチ
される。
On the other hand, the count clock 22 is input to the clock input of the address register 28 and the address pointer 5
The address output value Am is latched into the address register 28.

以上の動作を行う特定のマイクロプログラム命令をn回
実行するだけで最大値をデータレジスタ27に、最大値
のアドレスをアドレスレジスタ28に得ることができる
The maximum value can be obtained in the data register 27 and the address of the maximum value can be obtained in the address register 28 by simply executing the specific microprogram instruction that performs the above operation n times.

なお、アドレスレジスタ28に格納されている最大値の
アドレスはアドレスレジスタバス18を介してデータバ
ス1に、データレジスタ27に格納されている最大値は
AlO2等を介してデータバス1に出力することができ
る。
Note that the maximum value address stored in the address register 28 is output to the data bus 1 via the address register bus 18, and the maximum value stored in the data register 27 is output to the data bus 1 via AlO2 etc. I can do it.

上述したように本実施例のマイクロプロセッサは、Al
O2の2入力ポートX、YのうちY入力に流れるデータ
をラッチするY入力レジスタ26と、AlO2でx−y
の演算結果がX<YのときY入力レジスタ26のデータ
をラッチし、また出力がAlO2の入力ポートxへ接続
されているデータレジスタ27と、AlO2でX−Yの
演算結果が同じ<x<yのときメモリ4のアドレス値を
ラッチするアドレスレジスタ28と、X<Yのときこれ
らデータレジスタ27.アドレスレジスタ28を制御す
るゲート回路21とを設けたものである。
As mentioned above, the microprocessor of this embodiment is made of Al
Of the two input ports X and Y of O2, the Y input register 26 latches the data flowing to the Y input, and the
When the calculation result of X<Y, the data of the Y input register 26 is latched, and the data register 27 whose output is connected to the input port x of AlO2 and the calculation result of X-Y of AlO2 are the same <x< An address register 28 that latches the address value of the memory 4 when y, and these data registers 27 when X<Y. A gate circuit 21 for controlling an address register 28 is provided.

これにより、メモリ4のアドレスAiからAi+(n−
1)までに格納されているn個のデータの中から最大値
とそのメモリアドレスを求めるとき、メモリ4内のデー
タを順番に取り出して、その時点の最大値とそのメモリ
アドレスとの更新を1つのマイクロプログラム命令で実
現できる。
As a result, from address Ai in memory 4 to Ai+(n-
1) When finding the maximum value and its memory address from among the n pieces of data stored up to now, take out the data in memory 4 in order and update the maximum value at that point and its memory address by 1. It can be realized with one microprogram instruction.

従って、今まで、1つのメモリデータに対して、最大値
とそのアドレスを求める処理を行うのに、例えばソフト
処理で求めていた従来のものかp命令必要であったとす
ると、ハード処理で求めている本実施例のものでは全体
のマイクロプログラムのステップ数が1/pになること
か期待できる。
Therefore, up until now, in order to obtain the maximum value and its address for one piece of memory data, for example, if it was necessary to use the conventional p instruction or the p instruction, which was obtained using software processing, it would be necessary to obtain it using hardware processing. In this embodiment, it can be expected that the number of steps in the entire microprogram will be reduced to 1/p.

なお、上記実施例ではAlO2の演算結果が負のときに
アクティブとなるSフラグ19を立て、最大値を求める
ようにしたが、負のときにアクティブとなるフラグの代
わりに、正のときアクティブとなるフラグを設けると、
最小値を求めることも可能となる。
In the above embodiment, the S flag 19 which becomes active when the calculation result of AlO2 is negative is set and the maximum value is determined. If you set a flag like
It is also possible to find the minimum value.

[発明の効果] 本発明によれば、データの中から最大値とそのメモリア
ドレスとを求めるソフトウェア的処理を、ハードウェア
に置き換えるようにしたので、繰返しループ内のマイク
ロプログラムの命令数を減らしてループに必要なプログ
ラムのステップ数を大幅に減らすことができる。
[Effects of the Invention] According to the present invention, the software processing for finding the maximum value and its memory address from data is replaced with hardware, so the number of microprogram instructions in the repeat loop can be reduced. The number of program steps required for loops can be significantly reduced.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明によるマイクロプロセッサの一実施例を
示すブロック図、第2図は従来のマイクロプロセッサの
一例を示すブロック図、第3図はメモリアドレスA1−
A1+(n−1)に格納されているメモリのデータ構成
図、第4図はメモリアドレスAi〜Ai+(n−1)ま
でに格納されているデータの中から最大値とそのメモリ
アドレスとを求めるためのアルゴリズムを説明するフロ
ーチャート、第5図は第4図に示すアルゴリズムを第2
図のマイクロプロセッサで実現するための従来の手順を
示すフローチャートである。 2は算術論理演算器(A L U )、4は記憶装置と
してのメモリ1.5,11,13.14は入力手段であ
って、lはメモリバス、5はアドレスポインタ、11は
Y入力アドレス、13はメモリ/slス。 14はメモリアドレス線、21はゲート回路、26はY
入力蓄積手段であるY入力レジスタ、27はデータ蓄積
手段であるデータレジスタ、28は番地蓄積手段として
のアドレスレジスタ、X、  Yは入力ポートである。 1U 従来例によるマイクaフ゛ロ七フ号 第2図 メモリ構成 第3図
FIG. 1 is a block diagram showing an embodiment of a microprocessor according to the present invention, FIG. 2 is a block diagram showing an example of a conventional microprocessor, and FIG. 3 is a block diagram showing an example of a conventional microprocessor.
Figure 4 is a data configuration diagram of the memory stored in A1+(n-1), which calculates the maximum value and its memory address from among the data stored in memory addresses Ai to Ai+(n-1). Figure 5 is a flowchart explaining the algorithm shown in Figure 4.
2 is a flowchart showing a conventional procedure for implementation with the microprocessor shown in the figure. 2 is an arithmetic logic unit (A L U ), 4 is a memory as a storage device, 1.5, 11, 13.14 is an input means, l is a memory bus, 5 is an address pointer, and 11 is a Y input address. , 13 is a memory/sl space. 14 is a memory address line, 21 is a gate circuit, 26 is Y
A Y input register is an input storage means, 27 is a data register as a data storage means, 28 is an address register as an address storage means, and X and Y are input ports. 1U Conventional Microphone A7F Figure 2 Memory Configuration Figure 3

Claims (1)

【特許請求の範囲】 記憶装置に格納されているデータの中から最大値または
最小値を求めると共に、その最大値または最小値が格納
されている記憶装置の番地を求めるマイクロプロセッサ
において、 2個の入力ポートX、Yを有し、入力ポートXに入力さ
れたデータから入力ポートYに入力されたデータを減算
する算術論理演算器と、 上記記憶装置の番地を順次指定することにより、該記憶
装置からこれに格納されているデータを順次取り出して
、上記算術論理演算器の2個の入力ポートX、Yのうち
入力ポートYに入力する入力手段と、 上記入力ポートYに入力されるデータを分岐して、この
分岐データを入力とするY入力蓄積手段と、 該Y入力蓄積手段の出力を入力とし、かつ上記算術論理
演算器の2個の入力ポートX、Yのうち入力ポートXに
出力を入力するデータ蓄積手段と、上記記憶装置の指定
番地を入力とする番地蓄積手段と、 上記算術論理演算器による演算結果が負または正になっ
たときに、Y入力蓄積手段の出力を上記データ蓄積手段
に入力させると共に、上記記憶装置の指定番地を上記番
地蓄積手段に入力させるゲート回路と を備えたことを特徴とするマイクロプロセッサ。
[Scope of Claim] A microprocessor that determines the maximum value or minimum value from among data stored in a storage device and also determines the address of the storage device where the maximum value or minimum value is stored, comprising: an arithmetic and logic unit that has input ports X and Y and subtracts data input to input port Y from data input to input port X; An input means for sequentially taking out the data stored in this and inputting it to input port Y of the two input ports X and Y of the arithmetic and logic unit, and branching the data input to the input port Y. and a Y input storage means which receives this branch data as input, and which receives the output of the Y input storage means and outputs the output to input port X of the two input ports X and Y of the arithmetic and logic unit. an input data storage means; an address storage means whose input is a specified address of the storage device; and when the result of the operation by the arithmetic and logic unit is negative or positive, the output of the Y input storage means is stored as the data. A microprocessor comprising a gate circuit for inputting a designated address of the storage device to the address storing means.
JP11736489A 1989-05-12 1989-05-12 Microprocessor Pending JPH02297623A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP11736489A JPH02297623A (en) 1989-05-12 1989-05-12 Microprocessor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP11736489A JPH02297623A (en) 1989-05-12 1989-05-12 Microprocessor

Publications (1)

Publication Number Publication Date
JPH02297623A true JPH02297623A (en) 1990-12-10

Family

ID=14709840

Family Applications (1)

Application Number Title Priority Date Filing Date
JP11736489A Pending JPH02297623A (en) 1989-05-12 1989-05-12 Microprocessor

Country Status (1)

Country Link
JP (1) JPH02297623A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009059187A (en) * 2007-08-31 2009-03-19 Nec Electronics Corp Microprocessor and data processing method

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2009059187A (en) * 2007-08-31 2009-03-19 Nec Electronics Corp Microprocessor and data processing method

Similar Documents

Publication Publication Date Title
EP0378830B1 (en) Method and apparatus for handling multiple condition codes as for a parallel pipeline computer
US5499349A (en) Pipelined processor with fork, join, and start instructions using tokens to indicate the next instruction for each of multiple threads of execution
KR920006283B1 (en) Digital signal processing method
JP2539974B2 (en) Register read control method in information processing apparatus
EP0352935A2 (en) Pipelined processor
US4954947A (en) Instruction processor for processing branch instruction at high speed
JPS6160133A (en) Address calculator
JPH03286332A (en) Digital data processor
US5349671A (en) Microprocessor system generating instruction fetch addresses at high speed
US5586337A (en) Programmable controller with timing control
JPH02297623A (en) Microprocessor
JPH0418635A (en) Digital signal processor
KR970006413B1 (en) Fuzzy computer
JP3278441B2 (en) Vector processing equipment
JPH04239338A (en) Measuring system for microprogram comprehension rate
JPH01273132A (en) Microprocessor
KR930003410B1 (en) Data processing apparatus having high-sped reference of stack data
JP2781779B2 (en) Branch control circuit
JPH1173301A (en) Information processor
JPH04184535A (en) Parallel arithmetic units
JP2765058B2 (en) Stream operation completion detection method and apparatus
JPH09106346A (en) Parallel computer
JP2629479B2 (en) Information processing device
JPH04127366A (en) List vector processor
JP2000357087A (en) Device and method for processing operation