JPH0447851B2 - - Google Patents
Info
- Publication number
- JPH0447851B2 JPH0447851B2 JP58129221A JP12922183A JPH0447851B2 JP H0447851 B2 JPH0447851 B2 JP H0447851B2 JP 58129221 A JP58129221 A JP 58129221A JP 12922183 A JP12922183 A JP 12922183A JP H0447851 B2 JPH0447851 B2 JP H0447851B2
- Authority
- JP
- Japan
- Prior art keywords
- memory
- address
- stack
- program
- loop
- 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 - Lifetime
Links
Landscapes
- Executing Machine-Instructions (AREA)
Description
【発明の詳細な説明】
〔産業上の利用分野〕
本発明は、プログラム制御回路に関し、特に、
マイクロプログラム論理方式のプロセツサシステ
ムに用いられるいわゆるアドレスシーケンサとし
てのプログラム制御回路に関する。[Detailed Description of the Invention] [Field of Industrial Application] The present invention relates to a program control circuit, and in particular,
The present invention relates to a program control circuit as a so-called address sequencer used in a microprogram logic type processor system.
マイクロプログラム論理方式のプロセツサシス
テム又はマイクロコンピユータにおいては、マイ
クロプログラムメモリに記憶されたマイクロ命令
を所定の順序に従つて読み出すためのプログラム
制御回路(あるいはプログラムコントロール回
路、アドレスシーケンサ)が用いられている。こ
のプログラム制御回路として、最も単純には、ア
ドレスを順次1ずつインクリメントするいわゆる
アドレスカウンタが挙げられるが、さらに、読み
出されたマイクロ命令の内容や演算結果等に応じ
てプログラムの進行を制御する機能を備えたもの
が一般に用いられている。
In microprogram logic processor systems or microcomputers, a program control circuit (or program control circuit, address sequencer) is used to read out microinstructions stored in a microprogram memory in a predetermined order. . The simplest example of this program control circuit is a so-called address counter that sequentially increments addresses by 1, but it also has a function that controls the progress of the program according to the contents of read microinstructions, operation results, etc. Those equipped with the following are generally used.
ところで、このようなプログラム制御回路を用
いてプログラムのループ制御を行なう場合に、ル
ープ回数やリターンアドレスを一時的に記憶する
ためのメモリが必要とされるが、従来のプログラ
ム制御回路内には、ループ回数管理用の1個のレ
ジスタや数ワード程度のスタツクメモリが設けら
れているのみである。したがつて、1重ループの
プログラムのプログラム制御は行なえるが、2重
以上の多重ループは簡単には行なえず、プログラ
ム制御回路外部に、ループ回数やリターンアドレ
スを記憶するメモリ、ループ回数の値を変化させ
る手段、及びループ回数とリターンアドレスとを
プログラム制御回路に再ロードする手段等が必要
となる。このため、ハードウエアが繁雑化した
り、マイクロプログラムのステツプ数が著しく増
加したりする欠点が生じ、また処理速度が低下す
るという不都合も生じていた。 By the way, when performing loop control of a program using such a program control circuit, a memory is required to temporarily store the number of loops and return addresses. Only one register for managing the number of loops and a stack memory of several words are provided. Therefore, although it is possible to program control a program with a single loop, it is not easy to control multiple loops with two or more loops, and the memory for storing the loop count and return address and the value of the loop count are required outside the program control circuit. , and means to reload the loop count and return address into the program control circuit. As a result, the hardware becomes complicated, the number of microprogram steps increases significantly, and the processing speed decreases.
本発明は、上述の実情に鑑み、複数のループ回
数データ及び複数のリターンアドレスを格納する
メモリを内部に有し、多重ループのプログラムを
簡単かつ高速に実行可能とするようなプログラム
制御回路の提供を目的とする。
In view of the above-mentioned circumstances, the present invention provides a program control circuit which has an internal memory for storing a plurality of loop count data and a plurality of return addresses and can easily and quickly execute a multi-loop program. With the goal.
本発明に係るプログラム制御回路は、プログラ
ムメモリに記憶されたプログラムの読み出し順序
を制御するためのプログラム制御回路において、
上記プログラムメモリをアクセスするためのアド
レスを出力する出力ポートと、この出力アドレス
を1加算して出力するためのプログラムカウンタ
と、このプログラムカウンタからのアドレスを記
憶するリターンアドレススタツクメモリと、入力
ポートからのループ回数を記憶するためのループ
回数スタツクメモリと、このループ回数スタツク
メモリに記憶されたループ回数を1減算するデク
リメンタと、このデクリメンタでの減算値がゼロ
となつたか否かを検出するゼロ検出器と、読み出
されたプログラムの命令を解釈して各部の動作を
制御する命令解釈手段と、この命令解釈手段から
のリターンアドレススタツク操作命令に応じて上
記リターンアドレススタツクメモリのメモリワー
ドを指示するスタツクポインタと、上記命令解釈
手段からのループ回数スタツク操作命令に応じて
上記ループ回数スタツクメモリのメモリワードを
指示するスタツクポインタと、上記命令解釈手段
により切換制御され、少なくとも上記プログラム
カウンタからのアドレス及び上記リターンアドレ
ススタツクメモリからのリターンアドレスのいず
れかを選択して上記出力ポートより出力するマル
チプレクサとを具備して成ることを特徴としてい
る。
A program control circuit according to the present invention is a program control circuit for controlling the reading order of programs stored in a program memory.
An output port that outputs an address for accessing the program memory, a program counter that adds 1 to this output address and outputs it, a return address stack memory that stores the address from this program counter, and an input port. A loop count stack memory for storing the loop count from , a decrementer for subtracting 1 from the loop count stored in the loop count stack memory, and a zero detector for detecting whether the subtracted value by the decrementer has become zero. and an instruction interpretation means for interpreting the instructions of the read program to control the operation of each part; a stack pointer that points to a memory word of the loop count stack memory in response to a loop count stack manipulation command from the command interpreter; The present invention is characterized by comprising a multiplexer which selects either the address or the return address from the return address stack memory and outputs it from the output port.
以下、本発明に係るプログラム制御回路の好ま
しい一実施例について、図面を参照しながら説明
する。
Hereinafter, a preferred embodiment of the program control circuit according to the present invention will be described with reference to the drawings.
第1図は、本発明の一実施例としてのプログラ
ム制御回路1の内部構成を示すブロツク図であ
り、第2図はこのプログラム制御回路1を用いて
構成されるマイクロコンピユータの要部を示すブ
ロツク図である。これらの第1図および第2図に
おいて、プログラム制御回路1は、マイクロプロ
グラムメモリ2に記憶されているマイクロ命令の
実行順序を制御するために、このマイクロプログ
ラムメモリ2の読み出しアドレスを出力するもの
であり、プログラム制御回路1の内部では、マル
チプレクサ11により例えば4種類(4系統)の
アドレスデータのうちの1つを選択して出力する
ようにしている。すなわち、マルチプレクサ11
には、入力ポート12からの直接的なアドレスデ
ータと、先行するマイクロ命令にてレジスタ13
に格納され保持されているアドレスデータと、リ
ターンアドレススタツクメモリ14からのリター
ンアドレスデータと、マイクロプログラムカウン
タ15からの順次1ずつインクリメントされるア
ドレスデータとが供給されており、このマルチプ
レクサ11は、命令解釈ブロツク16からの選択
制御信号に応じて上記4種類のアドレスデータの
うちの1つを選択し、バツフアゲート17を介し
て出力ポート18に送る。 FIG. 1 is a block diagram showing the internal configuration of a program control circuit 1 as an embodiment of the present invention, and FIG. 2 is a block diagram showing the main parts of a microcomputer configured using this program control circuit 1. It is a diagram. 1 and 2, a program control circuit 1 outputs a read address of the microprogram memory 2 in order to control the execution order of microinstructions stored in the microprogram memory 2. Inside the program control circuit 1, a multiplexer 11 selects and outputs one of, for example, four types (four systems) of address data. That is, multiplexer 11
, the direct address data from the input port 12 and the register 13 using the preceding microinstruction.
Address data stored and held in the multiplexer 11, return address data from the return address stack memory 14, and address data sequentially incremented by 1 from the microprogram counter 15 are supplied to the multiplexer 11. One of the four types of address data is selected in response to a selection control signal from the command interpretation block 16 and sent to the output port 18 via the buffer gate 17.
マイクロプログラムカウンタ15は、インクリ
メンタ21からの出力データを、クロツク入力端
子22からのクロツクパルスに応じて取り込み出
力するような、一種のラツチあるいはレジスタで
あり、このマイクロプログラムカウンタ15から
出力されたカウントアドレスデータは、上記マル
チプレクサ11のみならず上記リターンアドレス
のスタツクメモリ14のデータ入力端子に供給さ
れている。ここで、クロツク入力端子22に入力
されるクロツクパルスは、上記マイクロプログラ
ムカウンタ15の他に、リターンアドレススタツ
クメモリ14、ループ回数スタツクメモリ23、
これらの各スタツクメモリのスタツクポインタ2
5,26、デクリメンタ27、及びレジスタ13
に供給されており、上記マイクロ命令読み出しの
クロツクサイクルを決定する。インクリメンタ2
1は、マルチプレクサ11からの出力データを1
だけ増加して(インクリメントして)マイクロプ
ログラムカウンタ15に送る。リターンアドレス
のスタツクメモリ14は、命令解釈ブロツク16
からのリターンアドレススタツク操作命令に応じ
て、マイクロプログラムカウンタ15からのカウ
ントアドレスデータをスタツクポインタ25によ
り指示されるメモリワードに書き込み、あるいは
スタツクポインタ25により指示されるメモリワ
ードの内容を読み出してマルチプレクサ11に送
る。スタツクポインタ25は、上記リターンアド
レススタツク操作命令である例えばプツシユ、ポ
ツプ命令に応じて、ポインタ値をインクリメント
あるいはデクリメントし、スタツクメモリ14に
対してデータをいわゆるラストイン・フアースト
アウト制御する。この他、スタツクポインタを変
化させずにリターンアドレスを読み出すこともで
きる。 The microprogram counter 15 is a type of latch or register that captures and outputs the output data from the incrementer 21 in response to clock pulses from the clock input terminal 22, and the count address output from the microprogram counter 15 Data is supplied not only to the multiplexer 11 but also to the data input terminal of the stack memory 14 at the return address. Here, the clock pulses input to the clock input terminal 22 are sent to the micro program counter 15, return address stack memory 14, loop number stack memory 23,
Stack pointer 2 of each of these stack memories
5, 26, decrementer 27, and register 13
, and determines the clock cycle for reading the microinstruction. Incrementer 2
1 is the output data from the multiplexer 11.
is incremented and sent to the microprogram counter 15. The return address stack memory 14 is stored in the instruction interpretation block 16.
In response to a return address stack manipulation command from the microprogram counter 15, the count address data from the microprogram counter 15 is written to the memory word pointed to by the stack pointer 25, or the contents of the memory word pointed to by the stack pointer 25 are read. and sends it to multiplexer 11. The stack pointer 25 increments or decrements the pointer value in response to the return address stack manipulation commands, such as push and pop commands, thereby controlling the data to the stack memory 14 as last-in/first-out. In addition, the return address can also be read without changing the stack pointer.
次に、ループ回数スタツクメモリ23は、複数
のループ回数データを記憶可能な複数ワードを有
し、命令解釈ブロツク16からのループ回数スタ
ツク操作命令に応じて、入力ポート12からのル
ープ回数データをスタツクポインタ26により指
示されるメモリワードに書き込み、あるいはスタ
ツクポインタ26により指示されるメモリワード
の内容をデクリメンタ27に送り1だけ減算(デ
クリメント)して再び当該メモリワードに書き込
む。このときのデクリメント操作は、命令解釈ブ
ロツクからのデクリメント操作命令に応じて行な
われる。さらに、デクリメンタ27においてデク
リメントされた値はゼロ検出器28に送られ、ゼ
ロとなつたときにゼロ検出出力が命令解釈ブロツ
ク16に送られる。なお、ループ回数スタツクメ
モリ23も、スタツクポインタ26の値のインク
リメント、デクリメント動作を伴なつた書き込
み、読み出し操作であるプツシユ、ポツプ操作が
可能であることは勿論である。 Next, the loop count stack memory 23 has a plurality of words capable of storing a plurality of loop count data, and stacks the loop count data from the input port 12 in response to a loop count stack operation command from the instruction interpretation block 16. It writes to the memory word pointed to by the pointer 26, or sends the contents of the memory word pointed to by the stack pointer 26 to the decrementer 27, decrements it by 1, and writes it to the memory word again. The decrement operation at this time is performed in response to a decrement operation command from the instruction interpretation block. Further, the value decremented by the decrementer 27 is sent to a zero detector 28, and when the value becomes zero, a zero detection output is sent to the instruction interpretation block 16. It goes without saying that the loop number stack memory 23 is also capable of push and pop operations, which are write and read operations that involve incrementing and decrementing the value of the stack pointer 26.
ところで、プログラム制御回路1の出力ポート
18からのアドレスデータによりマイクロプログ
ラムメモリ2から読み出されたマイクロ命令は、
1ワード例えば数十ビツトで構成され、この1ワ
ード中に複数の命令を含んでいる。この読み出さ
れたマイクロ命令は、パイプラインレジスタ3を
介して各命令実行ユニツト、例えばALU(論理演
算ユニツト)4、乗算器、データメモリ、コント
ロールバス等に送られ、また一部がプログラム制
御回路1の命令解釈ブロツク16の命令入力端子
19aに送られる。さらに、マイクロ命令中のル
ープ回数やサブルーチン先頭アドレス等のデータ
は、上記入力ポート12を介してプログラム制御
回路1内に取り込まれる。この他、ALU4にお
ける演算に応じたコンデイシヨンコードが、プロ
グラム制御回路1の命令解釈ブロツク16のコン
デイシヨンコード入力端子19bに送られる。 By the way, the microinstruction read out from the microprogram memory 2 by the address data from the output port 18 of the program control circuit 1 is as follows.
One word consists of, for example, several tens of bits, and this one word contains a plurality of instructions. This read microinstruction is sent via the pipeline register 3 to each instruction execution unit, such as an ALU (logic unit) 4, a multiplier, a data memory, a control bus, etc., and some of it is sent to the program control circuit. 1 to the command input terminal 19a of the command interpretation block 16. Furthermore, data such as the number of loops in the microinstruction and the subroutine start address are taken into the program control circuit 1 through the input port 12. In addition, a condition code corresponding to the operation in the ALU 4 is sent to the condition code input terminal 19b of the instruction interpretation block 16 of the program control circuit 1.
以上のような構成において、多重ループを含む
プログラムを実行する場合の各部動作について説
明する。 In the above configuration, the operation of each part when executing a program including multiple loops will be explained.
第3図は、一例として、2重ループを含むプロ
グラムのアドレス及び各スタツクメモリ14,2
3の内容を示すものであり、アドレスA1で第1
のループが開始されて、次のアドレスA1+1及
びループ回数N1が各スタツクメモリ14,23
にそれぞれプツシユされる。この第1のループ処
理はアドレスA4まで及んでおり、このアドレス
A4でループ回数N1のチエツクを行ない、N1回に
達していないときにはアドレスA1+1に戻り、
N1回に達したときには次のアドレスA4+1に進
む。これらのアドレスA1+1からA4までの間に、
第2のループ処理が含まれており、アドレスA2
にて第2のループ処理が開始され、次のアドレス
A2+1及びループ回数N2が各スタツクメモリ1
4,23にそれぞれプツシユされる。そして、ア
ドレスA3にてループ回数N2のチエツクがなされ、
ループ回数がN2未満のときにはアドレスA2+1
に戻り、N2に達したときにはアドレスA3+1に
進む。なお、第3図の各スタツクメモリ14,2
3に図示された矢印は、上記各スタツクポインタ
25,26による指示位置を示している。 FIG. 3 shows, as an example, the address of a program including a double loop and each stack memory 14, 2.
This shows the contents of 3, and the first address is
The next address A 1 +1 and the loop number N 1 are stored in each stack memory 14, 23.
Each of them is pushed. This first loop processing extends to address A 4 , and this address
Check the number of loops N 1 at A 4 , and if it has not reached N 1 , return to address A 1 +1,
When reaching N1 times, proceed to the next address A 4 +1. Between these addresses A 1 + 1 and A 4 ,
The second loop processing is included, and the address A 2
The second loop processing is started at the next address
A 2 + 1 and the number of loops N 2 are each stack memory 1
4 and 23 respectively. Then, the number of loops N 2 is checked at address A 3 ,
When the number of loops is less than N 2 , address A 2 + 1
When N 2 is reached, the process returns to address A 3 +1. In addition, each stack memory 14, 2 in FIG.
The arrows shown in 3 indicate the positions indicated by the stack pointers 25 and 26.
このような2重ループプログラムを実行する場
合に、プログラムが第1のループの開始アドレス
A1に達し、このA1行のマイクロ命令によりルー
プ開始動作が行なわれる。すなわち、命令解釈ブ
ロツク16にループ開始命令が供給されて解釈さ
れることにより、第4図の太線に示すように、マ
ルチプレクサ11においてプログラムカウンタ1
5からのアドレスA1+1の出力が選択されると
ともに、スタツクポインタ25により指定される
リターンアドレススタツクメモリ14内のワード
に上記アドレスデータA1+1が書き込まれる。
これは、スタツクのプツシユ操作であり、メモリ
への書き込み動作と同時にスタツクポインタが例
えばインクリメントされる。また、ループ回数に
ついても同様に、スタツクポインタ26により指
定されるループ回数スタツクメモリ23内のワー
ドに入力ポート12からのループ回数データN1
を書き込むようなスタツクのプツシユ操作が行な
われる。 When executing such a double-loop program, the program starts at the start address of the first loop.
A1 is reached, and a loop start operation is performed by this A1 line microinstruction. That is, by supplying the loop start instruction to the instruction interpretation block 16 and interpreting it, the multiplexer 11 outputs the program counter 1 as shown by the thick line in FIG.
The output of the address A 1 +1 from the return address stack memory 14 is selected, and the address data A 1 +1 is written to the word in the return address stack memory 14 designated by the stack pointer 25.
This is a stack push operation in which the stack pointer is incremented, for example, at the same time as the memory write operation. Similarly, regarding the number of loops, the loop number data N 1 from the input port 12 is stored in the word in the loop number stack memory 23 specified by the stack pointer 26.
A push operation is performed on the stack, such as writing .
次に、プログラムが第2のループ開始アドレス
A2に達すると、第5図の太線に示すように、命
令解釈ブロツク16にループ開始命令が供給され
ることに応じて、リターンアドレススタツクメモ
リ14にプログラムカウンタ15からのアドレス
A2+1がプツシユされ、ループ回数スタツクメ
モリ23に入力ポート12からのループ回数N2
がプツシユされるとともに、マルチプレクサ11
はプログラムカウンタ15からのアドレスA2+
1を選択して出力する。なおこのとき、各スタツ
クポインタ25,26は、第4図に示す状態より
それぞれ1だけ例えばインクリメントされたアド
レスの各スタツクメモリ14,23のワードをそ
れぞれ指定する。 Next, the program selects the second loop start address
When A 2 is reached, as shown by the thick line in FIG.
A 2 +1 is pushed and the loop number N 2 from the input port 12 is stored in the loop number stack memory 23.
is pushed, and the multiplexer 11
is the address A 2 + from program counter 15
Select 1 and output. At this time, each stack pointer 25, 26 specifies a word in each stack memory 14, 23 whose address is incremented, for example, by 1 from the state shown in FIG.
次に、第2のループの終了アドレスA3に達し
たときには、命令解釈ブロツク16に例えばルー
プ終了命令が送られ、第6図の太線に示すよう
に、ループ回数スタツクメモリ23からのループ
回数データN2がポツプされてデクリメンタ27
に送られる。デクリメンタ27は、このデータ
N2を1減算してゼロ検出器28に送り、ゼロ検
出器28はN2−1がゼロか否かを判別する。ゼ
ロ検出器28からの検出出力は命令解釈ブロツク
16に送られ、非ゼロのときは第6図のような動
作制御を、またゼロのときには第7図のような動
作制御をそれぞれ行なう。 Next, when the end address A3 of the second loop is reached, a loop end command, for example, is sent to the command interpretation block 16, and the loop number data N from the loop number stack memory 23 is sent, as shown by the thick line in FIG. 2 is popped and decrementer 27
sent to. The decrementer 27 uses this data
N 2 is subtracted by 1 and sent to the zero detector 28, and the zero detector 28 determines whether N 2 -1 is zero. The detection output from the zero detector 28 is sent to the command interpretation block 16, and when it is non-zero, the operation is controlled as shown in FIG. 6, and when it is zero, the operation is controlled as shown in FIG. 7.
すなわち、上記減算データN2−1が非ゼロの
場合には、第6図に示すように、減算データを第
2ループ回数データとして(N2=N2−1)ルー
プ回数スタツクメモリ23にプツシユするととも
に、マルチプレクサ11によりスタツクメモリ1
4からのリターンアドレスA2+1を選択して出
力し、次のステツプでアドレスA2+1に戻るよ
うにプログラムの進行を制御する。したがつて、
第2のループ処理プログラムが1回実行される毎
にループ回数データN2は1ずつ減算され、ルー
プ回数スタツクメモリ23内の同じワードに書き
込まれる。 That is, if the subtraction data N 2 -1 is non-zero, the subtraction data is pushed to the loop number stack memory 23 as second loop number data (N 2 =N 2 -1), as shown in FIG. At the same time, the stack memory 1 is
The program progress is controlled so that the return address A 2 +1 from 4 is selected and output, and the program returns to address A 2 +1 in the next step. Therefore,
Each time the second loop processing program is executed, the loop count data N2 is subtracted by 1 and written into the same word in the loop count stack memory 23.
そして、第2のループ処理がN2(初期値)回実
行されたとき、すなわちループ制御変数としての
N2−1がゼロとなつたときには、ゼロ検出器2
8からの検出出力に応じて命令解釈ブロツク16
は、第7図に示すように、マルチプレクサ11に
よりマイクロプログラムカウンタ15からのアド
レスA3+1を選択して出力し、次のステツプで
はプログラムメモリ上での次のアドレスA3+1
に進むように制御する。なお、第7図において
は、アドレスA3の命令実行の際のループ回数ス
タツクメモリ23をポツプした後のデータの流れ
を太線で示しており、スタツクメモリ23及びス
タツクポインタ26へのポツプ制御信号の流れを
省略している。この場合、スタツクメモリ23は
ポツプ操作されたまま、デクリメンタ27の減算
データのプツシユ操作は行なわれず、スタツクポ
インタ26は第1ループ回数N1の記憶されたワ
ードを指示している。 Then, when the second loop processing is executed N 2 (initial value) times, that is, when the second loop processing is executed N 2 (initial value) times,
When N 2 -1 becomes zero, zero detector 2
The instruction interpretation block 16 responds to the detection output from 8.
As shown in FIG. 7, the multiplexer 11 selects and outputs the address A 3 +1 from the microprogram counter 15, and in the next step, the next address A 3 +1 on the program memory is selected and output.
control to proceed. In FIG. 7, the flow of data after the loop count stack memory 23 is popped during execution of the instruction at address A3 is indicated by a thick line, and the flow of pop control signals to the stack memory 23 and stack pointer 26 is indicated by a thick line. is omitted. In this case, the stack memory 23 remains in the pop operation, but the push operation of the subtracted data of the decrementer 27 is not performed, and the stack pointer 26 points to the word stored for the first loop number N1 .
また、これら第6図、第7図において、リター
ンアドレススタツクメモリ14やスタツクポイン
タ25への制御信号の流れも図示を省略している
が、第6図の場合には、スタツクポインタ25の
値を変化させずにスタツクメモリ14の読み出し
のみを行ない、第7図の場合には、スタツクポイ
ンタ25の値のみを例えばデクリメントするか、
あるいはマルチプレクサ11がカウンタ15を選
択していることよりポツプ操作を行なつてもよ
い。 6 and 7, the flow of control signals to the return address stack memory 14 and the stack pointer 25 is also omitted, but in the case of FIG. Either the stack memory 14 is only read without changing the value of the stack pointer 25, and in the case of FIG. 7, only the value of the stack pointer 25 is decremented, for example.
Alternatively, a pop operation may be performed since the multiplexer 11 selects the counter 15.
すなわち、このようなループの終了アドレス
A3におけるスタツク操作について説明すると、
ループ回数スタツクメモリ23に関しては、先ず
常にデクリメンタ27にデータをポツプし、デク
リメント後のゼロ検出器28からの検出出力に応
じて、非ゼロのときのみ上記減算データをプツシ
ユする。したがつて、減算データがゼロとなる
N2回ループ終了時には、上記ポツプのみが行な
われ、スタツクポインタ26は第1のループ回数
N1のデータが記憶されているワードを指示して
いる。また、リターンアドレススタツクメモリ1
4に関しては、上記減算データが非ゼロのときに
はスタツクポインタ25の値は変化せず、スタツ
クメモリ14のアドレスデータA2+1が読み出
され、また上記減算データがゼロのときにはスタ
ツクポインタ25の値が例えばデクリメントされ
て、アドレスデータA1+1が記憶されているワ
ードが指示される。 i.e. the end address of such a loop
To explain the stack operation in A 3 ,
Regarding the loop number stack memory 23, first, data is always popped into the decrementer 27, and the subtracted data is pushed only when the data is non-zero, depending on the detection output from the zero detector 28 after decrementing. Therefore, the subtracted data becomes zero.
N At the end of the second loop, only the above pop is performed, and the stack pointer 26 is set to the first loop number.
N indicates the word in which 1 data is stored. Also, return address stack memory 1
4, when the subtraction data is non-zero, the value of the stack pointer 25 does not change, and the address data A 2 +1 of the stack memory 14 is read out, and when the subtraction data is zero, the value of the stack pointer 25 does not change. is, for example, decremented to indicate the word in which address data A 1 +1 is stored.
次に、第1のループの終了アドレスA4に達し
たときには、上記アドレスA3に達したときと同
様に、ループ回数N1がスタツクメモリ23より
デクリメンタ27にポツプされ、1減算されてゼ
ロ検出器28でゼロか否かが判別され、非ゼロの
ときは減算データをスタツクメモリ23にプツシ
ユするとともに、マルチプレクサ11がスタツク
メモリ14からのリターンアドレスA1+1を選
択して、次のステツプでアドレスA1+1に戻る。
また、第1のループがN1回実行されて上記減算
データがゼロとなるときには、マルチプレクサ1
1がプログラムカウンタ15からのアドレスA4
+1を選択し、次のステツプでアドレスA4+1
に進む。 Next, when the end address A4 of the first loop is reached, the number of loops N1 is popped from the stack memory 23 to the decrementer 27 , and is subtracted by 1, in the same way as when the address A3 is reached. 28, it is determined whether or not it is zero, and if it is non-zero, the subtracted data is pushed to the stack memory 23, and the multiplexer 11 selects the return address A 1 +1 from the stack memory 14, and in the next step, the address A 1 +1 is pushed. Return to
Also, when the first loop is executed N1 times and the above subtracted data becomes zero, the multiplexer 1
1 is address A from program counter 15 4
Select +1 and in the next step address A 4 +1
Proceed to.
以上のようにして、第1のループについては
N1回、第2のループについては第1のループの
各回毎にN2回(全体としてN1×N2回)の実行が
それぞれなされる。 As above, for the first loop
The second loop is executed N 1 times, and the second loop is executed N 2 times for each iteration of the first loop (total N 1 ×N 2 times).
このような2重ループ処理を行なわせるための
マイクロプログラムとしては、上記各アドレス
A1,A2の各ステツプにループ開始命令をそれぞ
れのループ回数N1,N2とともに設け、上記各ア
ドレスA3,A4の各ステツプにループ終了命令を
設けるだけでよく、ループ回数やリターンアドレ
スのメモリ書き込み、読み出し操作、及びデクリ
メント操作等を含むループ動作制御については、
プログラム制御回路1内部の主として命令解釈ブ
ロツク16により上記ループ開始命令やループ終
了命令に応じて実行されるため、マイクロプログ
ラムの負担が大幅に軽減される。したがつて、マ
イクロプログラムのステツプ数やマイクロプログ
ラムメモリのワード数が少なくてすみ、そのアド
レシングのためのビツト数も少なくできる。しか
も、ループ回数やリターンアドレスを記憶するた
めのメモリがプログラム制御回路1内部に設けら
れており、外付けハードウエアが不要になるとと
もに、1ステツプでループ開始やループ終了が各
動作が行なえるため、処理時間を大幅に短縮でき
る。 As a microprogram to perform such double loop processing, each of the above addresses
It is only necessary to provide a loop start instruction in each step of A 1 and A 2 with the respective loop numbers N 1 and N 2 , and provide a loop end instruction in each step of each of the above addresses A 3 and A 4 . For loop operation control including address memory write, read operations, and decrement operations,
Since the program is executed mainly by the instruction interpretation block 16 within the program control circuit 1 in response to the loop start command and the loop end command, the burden on the microprogram is greatly reduced. Therefore, the number of steps in the microprogram and the number of words in the microprogram memory can be reduced, and the number of bits for addressing can also be reduced. Moreover, the memory for storing the loop count and return address is provided inside the program control circuit 1, eliminating the need for external hardware and allowing each operation to start and end a loop in one step. , processing time can be significantly reduced.
なお、本発明は上記実施例のみに限定されるも
のではなく、例えば3重以上の多重ループの処理
についても同様に、簡潔なプログラムで短時間で
実行できる。また、プログラム制御回路(プログ
ラムコントローラ)の使用例は第2図のものに限
定されない。 It should be noted that the present invention is not limited to the above-mentioned embodiments, and for example, processing of multiple loops of three or more can be executed in a short time with a simple program. Furthermore, the usage example of the program control circuit (program controller) is not limited to that shown in FIG.
本発明に係るプログラム制御回路によれば、多
重ループを含むプログラムの場合に、各ループ回
数をプログラム制御回路内のループ回数スタツク
メモリに記憶させておくことができるため、プロ
グラム制御回路外部のメモリ等を利用する必要が
なく、プログラムが簡潔になりステツプ数が大幅
に短縮され、プログラムメモリの容量も少なくて
すむためこれをアクセスするためのアドレスのビ
ツト数を減らすことができ、しかも処理時間を短
縮できる。
According to the program control circuit according to the present invention, in the case of a program including multiple loops, the number of loops can be stored in the loop number stack memory within the program control circuit. There is no need to use this, the program becomes simpler, the number of steps is greatly reduced, the amount of program memory is also small, the number of bits in the address to access it can be reduced, and the processing time can be shortened. .
第1図は本発明に係るプログラム制御回路の一
実施例を示すブロツク回路図、第2図は第1図の
プログラム制御回路の使用例を示すブロツク図、
第3図は2重ループを示すプログラムのアドレス
及びスタツクメモリ内容を示す図、第4図ないし
第7図は第1図の回路の動作を説明するための図
である。
1……プログラム制御回路、2……マイクロプ
ログラムメモリ、11……マルチプレクサ、12
……入力ポート、14……リターンアドレススタ
ツクメモリ、15……マイクロプログラムカウン
タ、16……命令解釈ブロツク、18……出力ポ
ート、21……インクリメンタ、23……ループ
回数スタツクメモリ、25,26……スタツクポ
インタ、27……デクリメンタ、28……ゼロ検
出器。
FIG. 1 is a block circuit diagram showing an embodiment of the program control circuit according to the present invention, FIG. 2 is a block diagram showing an example of use of the program control circuit of FIG.
FIG. 3 is a diagram showing addresses and stack memory contents of a program showing a double loop, and FIGS. 4 to 7 are diagrams for explaining the operation of the circuit of FIG. 1. 1...Program control circuit, 2...Micro program memory, 11...Multiplexer, 12
... Input port, 14 ... Return address stack memory, 15 ... Microprogram counter, 16 ... Instruction interpretation block, 18 ... Output port, 21 ... Incrementer, 23 ... Loop number stack memory, 25, 26 ...Stack pointer, 27...Decrementer, 28...Zero detector.
Claims (1)
読み出し順序を制御するためのプログラム制御回
路において、 上記プログラムメモリをアクセスするためのア
ドレスを出力する出力ポートと、 この出力アドレスを1加算して出力するための
プログラムカウンタと、 このプログラムカウンタからのアドレスを記憶
するリターンアドレススタツクメモリと、 入力ポートからのループ回数を記憶するための
ループ回数スタツクメモリと、 このループ回数スタツクメモリに記憶されたル
ープ回数を1減算するデクリメンタと、 このデクリメンタでの減算値がゼロとなつたか
否かを検出するゼロ検出器と、 読み出されたプログラムの命令を解釈して各部
の動作を制御する命令解釈手段と、 この命令解釈手段からのリターンアドレススタ
ツク操作命令に応じて上記リターンアドレススタ
ツクメモリのメモリワードを指示するスタツクポ
インタと、 上記命令解釈手段からのループ回数スタツク操
作命令に応じて上記ループ回数スタツクメモリの
メモリワードを指示するスタツクポインタと、 上記命令解釈手段により切換制御され、少なく
とも上記プログラムカウンタからのアドレス及び
上記リターンアドレススタツクメモリからのリタ
ーンアドレスのいずれかを選択して上記出力ポー
トより出力するマルチプレクサとを具備して成る
ことを特徴とするプログラム制御回路。[Scope of Claims] 1. In a program control circuit for controlling the read order of programs stored in a program memory, an output port that outputs an address for accessing the program memory; and an output port that adds 1 to this output address. a program counter for outputting the program counter; a return address stack memory for storing addresses from this program counter; a loop number stack memory for storing the number of loops from the input port; and a return address stack memory for storing the number of loops from the input port; A decrementer that subtracts 1 from the number of times, a zero detector that detects whether the subtracted value by the decrementer becomes zero, and an instruction interpreter that interprets the instructions of the read program and controls the operation of each part. , a stack pointer that points to a memory word in the return address stack memory in response to a return address stack manipulation command from the command interpretation means; A stack pointer indicating a memory word in the stack memory, and a switch controlled by the instruction interpreting means to select at least one of the address from the program counter and the return address from the stack memory to output the output port from the stack memory. A program control circuit comprising: a multiplexer for outputting output.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP58129221A JPS6020242A (en) | 1983-07-15 | 1983-07-15 | Program control circuit |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP58129221A JPS6020242A (en) | 1983-07-15 | 1983-07-15 | Program control circuit |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JPS6020242A JPS6020242A (en) | 1985-02-01 |
| JPH0447851B2 true JPH0447851B2 (en) | 1992-08-05 |
Family
ID=15004135
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP58129221A Granted JPS6020242A (en) | 1983-07-15 | 1983-07-15 | Program control circuit |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JPS6020242A (en) |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS61259339A (en) * | 1985-05-13 | 1986-11-17 | Hitachi Ltd | Sequence control device |
| JPS62169232A (en) * | 1986-01-22 | 1987-07-25 | Oki Electric Ind Co Ltd | Signal processing processor |
| JPH0679271B2 (en) * | 1987-04-24 | 1994-10-05 | 株式会社日立製作所 | Loop control circuit |
| JPS6458023A (en) * | 1987-08-28 | 1989-03-06 | Ricoh Kk | Microprogram controller |
Family Cites Families (2)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JPS56140444A (en) * | 1980-04-03 | 1981-11-02 | Nec Corp | Microprogram control system |
| US4450525A (en) * | 1981-12-07 | 1984-05-22 | Ibm Corporation | Control unit for a functional processor |
-
1983
- 1983-07-15 JP JP58129221A patent/JPS6020242A/en active Granted
Also Published As
| Publication number | Publication date |
|---|---|
| JPS6020242A (en) | 1985-02-01 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| US5619704A (en) | Asynchronous interrupt inhibit method and apparatus for avoiding interrupt of an inseparable operation | |
| US4430706A (en) | Branch prediction apparatus and method for a data processing system | |
| US5235686A (en) | Computer system having mixed macrocode and microcode | |
| US3889243A (en) | Stack mechanism for a data processor | |
| GB2399899A (en) | Active memory with three control units | |
| EP0062658A4 (en) | Stack for a data processor. | |
| EP0010196B1 (en) | Control circuit and process for digital storage devices | |
| US4093983A (en) | Fast and normal rate instruction fetching | |
| JPH0447851B2 (en) | ||
| EP0279953B1 (en) | Computer system having mixed macrocode and microcode instruction execution | |
| US5287483A (en) | Prefetched operand storing system for an information processor | |
| US4124892A (en) | Data processing systems | |
| KR100321745B1 (en) | A micro controller unit for external memory access | |
| JPH08255476A (en) | Apparatus and method for memory extended stack in data-processing system | |
| US4816992A (en) | Method of operating a data processing system in response to an interrupt | |
| US5557772A (en) | Data processing apparatus including a register storing a parameter and a microinstruction execution arrangement including a correction arrangement for causing a first value of the parameter to be change to a second, correct value | |
| JPH0373010B2 (en) | ||
| JPS62245439A (en) | Symbolic processing system and method | |
| JP2721610B2 (en) | Programmable controller | |
| AU540728B2 (en) | Stack for a data processor | |
| EP0167333A2 (en) | Data processing apparatus with data type classifier | |
| JPH0232650B2 (en) | ||
| JPH0243626A (en) | Apparatus for controlling execution speed of computer processor | |
| JPS60193046A (en) | Instruction exception detection method | |
| JPS6346856B2 (en) |