JPS5947651A - Program controller - Google Patents

Program controller

Info

Publication number
JPS5947651A
JPS5947651A JP15670382A JP15670382A JPS5947651A JP S5947651 A JPS5947651 A JP S5947651A JP 15670382 A JP15670382 A JP 15670382A JP 15670382 A JP15670382 A JP 15670382A JP S5947651 A JPS5947651 A JP S5947651A
Authority
JP
Japan
Prior art keywords
counter
flag
instruction
repeat
memory
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.)
Granted
Application number
JP15670382A
Other languages
Japanese (ja)
Other versions
JPS6242301B2 (en
Inventor
Katsuhiko Ueda
勝彦 上田
Toshiaki Suzuki
敏明 鈴木
Takashi Sakao
坂尾 隆
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial 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 Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP15670382A priority Critical patent/JPS5947651A/en
Publication of JPS5947651A publication Critical patent/JPS5947651A/en
Publication of JPS6242301B2 publication Critical patent/JPS6242301B2/ja
Granted legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements

Abstract

PURPOSE:To ensure an interruption even under the repeating processing in a style having plural operands, by saving and resetting a program counter, a repeating counter and a repeating flag when an interruption is set. CONSTITUTION:When an interruption flag 16 is set from outside under execution of repeating process, a control part 17 shunts an instruction register RG10 to an address of a memory 8 which is shown by the value obtained by subtracting 1 from the value of a stack pointer SP14. Then a program counter PC9 is saved to the address of the memory 8 having the value obtained by subtracting 1 from the value of the SP14. Furthermore, a repeating counter RC11 and a repeating flag RF13 are saved to the address of the memory 8 shown by the value obtained by subtracting 1 from the value of the SP14. Then the RC11 and RF13 are reset, and the address of an address receiver is set to the PC9. When the interruption is reset, the RC11 and RF13 are reset from the memory 8 in order reverse to the saving state and then reset to the PC9 and RG10 from the memory 8 of an address having the value obtained by increasing the SP14 one by one. Thus the normal program processing is executed.

Description

【発明の詳細な説明】 (産業上の利用分野) 本発明は、マイクロコンピュータのプログラム制御装置
に関するものである。
DETAILED DESCRIPTION OF THE INVENTION (Field of Industrial Application) The present invention relates to a program control device for a microcomputer.

(従来例の構成とその問題点) マイクロコンピータ内に、ある機械語を予め設定した回
数だけくり返し実行するプログラム制御回路を設けてお
くと非常に有効である。このような制御回路をもつマイ
クロコンピュータで、いわゆるストリンゲス処理、例え
ば2つの、連続して意味をもつ数ワードのデータの間で
比較を行う時には、比較を行う機械語をそのワード数分
だけくり返し実行すればよい。そこで、ストリンゲス処
理で比較を行う時には、プログラムメモリには比較を行
う機械語を一つだけ格納しておくだけでよく、フ00グ
ラム川メモリの使用効率が上るだけでなく、ストリンゲ
ス処理のプログラムの作成も容易となる。
(Constitution of Conventional Example and its Problems) It is very effective to provide a program control circuit in a microcomputer that repeatedly executes a certain machine language a preset number of times. When a microcomputer with such a control circuit performs so-called string processing, for example, when comparing two consecutive words of data, it repeatedly executes the machine language for the comparison for the number of words. do it. Therefore, when performing a comparison using string processing, it is only necessary to store only one machine language for comparison in the program memory, which not only improves the efficiency of memory usage but also improves the efficiency of string processing programs. It is also easy to create.

このように、ある機械語を予め設定した回数だけくり返
し実行するためのノログラム制御力法として、制御回路
の中に、くり返し回数を設定するカウンタ(以下これを
リピートカウンタと呼ぶ。)を設け、リピートカウンタ
の値が零になるまで、現在実行中のプログラムメモリの
アドレスを示すプログラムカウンタの値を変化させない
という方法(以下これをリピート処理と呼ぶ)がある。
As described above, as a nologram control method for repeatedly executing a certain machine code a preset number of times, a counter (hereinafter referred to as a repeat counter) for setting the number of repetitions is provided in the control circuit, and the repeat There is a method (hereinafter referred to as repeat processing) in which the value of a program counter indicating the address of the program memory currently being executed is not changed until the value of the counter becomes zero.

そこで、リピートカウンタの値が零になるまで、同じア
ドレスの命令、すなわち同じ機械語が実行され続ける。
Therefore, the instruction at the same address, that is, the same machine language, continues to be executed until the value of the repeat counter becomes zero.

このような制御力法を実現した例としては、インテル社
の16ビツトマイクロコンピユータ808bがあげられ
る。−力、このような制御方法を採用した時に問題とな
るのは、いわゆる割込みとの関係である。割込みが起る
と通常、プログラムカウンタの値は待避され、割込み先
のアドレスがプログラムカウンタに新たに設定され、割
込み先の処理を開始する。そして割込み先の処理が終了
すると、待避しておいた値を70ログラムカウンタに復
帰さぜる。その結果、割込み前のプログラムが再び実行
される。このような割込みがリピート処理中に起った時
、リピート処理をしている命令のオ波レータとオペラン
ドが同じアドレスのグログラムメモリに格納されている
時には問題は生じない。しかし、リピート処理を一般化
した時、メモリにはオペレータをひとつだけ記憶しこの
オペレータの処理対象となるオペランドを順に記憶して
おくという形態をとる墨か考えられる。
An example of implementing such a control force method is Intel's 16-bit microcomputer 808b. A problem that arises when such a control method is adopted is the relationship with so-called interrupts. When an interrupt occurs, the value of the program counter is usually saved, the address of the interrupt destination is newly set in the program counter, and processing of the interrupt destination is started. When the interrupt destination process is completed, the saved value is returned to the 70 program counter. As a result, the program before the interrupt is executed again. When such an interrupt occurs during repeat processing, no problem occurs if the operator and operand of the instruction undergoing repeat processing are stored in the program memory at the same address. However, when repeat processing is generalized, it may be possible to store only one operator in memory and sequentially store operands to be processed by this operator.

しかしながら、このリピート処理中の割込みは正常には
動作しない。例えは第1図に示すように、n番地のメモ
リにオペレータとして比較を指7Nする命令コード1が
、n千1番地からn +4番地には、オペランドとして
、メモリのアト゛レスds12+dc113 + ds
24 + ddz 5が格納されているとする。
However, the interrupt during this repeat processing does not operate normally. For example, as shown in Figure 1, an instruction code 1 that specifies a comparison as an operator in the memory at address n is written as an operand at addresses n121 to n+4, which is the memory address ds12+dc113+ds.
24 + ddz 5 is stored.

そしてリピート処理で、メモリのds1番地の内容6と
、dd、番地の内容7との比較を終え、グログラムカウ
ンタか、n+3の値を示したところで割込みが発生した
とする。割込み発生後、プログラムカウンタの値、n+
3は待避される。そして割込み先の処理が行われた後、
待避しておいた値n +3が70ログラムカウンタ復帰
される。しかし割込み先の処理の中で新しい命令コード
が命令レノスタに71ツチされているため、割込みから
復帰後の命令レノスタには、比較を指示する命令コード
1は既に存在L〜ない。そこで割込みから復帰後はマイ
クロコ/l−′″−一夕は正しく動作しなくなる。これ
を防ぐ方法として、リピート処理中は割込み処理を?−
1わないという方法が考えられる。しかし、一般に割込
みは速かな応答及び処理を必要とするものであり、従っ
てリピート処理中に割込みの県止を有りというのは問題
がある。。
In the repeat process, it is assumed that an interrupt occurs when the comparison between the content 6 of address ds1 in the memory and the content 7 of address dd is completed, and when the glogram counter indicates the value n+3. After an interrupt occurs, the value of the program counter, n+
3 is saved. After the interrupt destination has been processed,
The saved value n+3 is restored to the 70 program counter. However, since a new instruction code has been added to the instruction renoster during the processing at the interrupt destination, the instruction code 1 that instructs the comparison does not already exist in the instruction renoster after returning from the interrupt. Therefore, after returning from an interrupt, the microcontroller will not work properly for a while.A way to prevent this is to handle interrupts during repeat processing.
One possible method is not to do so. However, interrupts generally require quick response and processing, and therefore it is problematic to stop interrupts during repeat processing. .

(発明の[)的) 本う【3明の目的は、従来例で述べた欠点をなくし、オ
被レークの後に複数個のオ及ランドをもつ形式でリピー
ト処理を行っている時にでも、割込み処理が可能々プロ
グラム制御装置を提供することにある。
(Objective of the invention) The purpose of the present invention is to eliminate the drawbacks mentioned in the conventional example, and to prevent interrupts from occurring even when repeat processing is performed in a format that has multiple The object of the present invention is to provide a program-controlled device capable of processing.

(発明の構成) 本発明のプログラム制御装置は、一連の命令群及びデー
タを記憶するメモリと、前記メモリに記憶されている命
令群の実行アドレスを指示するプログラムカウンタと、
前記メモリに記憶され前記グログラムカウンタによって
指示される命令を後述のリピートカウンタの値が零の時
とり込む命令レノスタと、前記命令レノスタに記憶され
ている命令のくり返し実行数を初期値としてノ°リセッ
トし命令を実行する毎にその値が零になるまで1づつ減
じてゆくリピートカウンタと、1iiJ if己リす′
−トカウンタに初期値がゾリセ、1・され前記61′i
令レノスタに格納されている命令が11実行された後に
セットされ前記リピートカウンタの値が零になった後に
リセットされるフラッグと、前記フラッグがリセットさ
れている状態で割込みが生じた時i/(は、前記プログ
ラムカウンタ、前記リピートカウンタ、および前記フラ
ッグのそれぞれの内容を待避すると共に011記リピー
トカウンタをリセットし、前記フラッグかセットされて
いる時にはさらに前記命令レノスタの内容を待避すると
共に前記フラッグをリセットする手段と、割込みから復
帰する時には先ず前記フラッグを復帰し、それがリセッ
ト状態ならば前記プログラムカウンタ、前記リピートカ
ウンタを復帰し、復帰したフラッグがセット状態ならば
さらに前記命令レノスタを復帰する手段とを有すること
を特徴とする。
(Structure of the Invention) A program control device of the present invention includes: a memory that stores a series of instructions and data; a program counter that indicates an execution address of the instruction group stored in the memory;
An instruction renostar that takes in an instruction stored in the memory and instructed by the program counter when the value of a repeat counter (to be described later) is zero; A repeat counter that is reset and decremented by 1 each time an instruction is executed until its value becomes zero, and
- The initial value of the counter is set to 1, and the value is 61'i.
A flag is set after 11 instructions stored in the instruction renoster have been executed and is reset after the value of the repeat counter reaches zero, and when an interrupt occurs while the flag is reset, i/( saves the contents of the program counter, the repeat counter, and the flag, and resets the repeat counter 011, and when the flag is set, further saves the contents of the instruction renoster and resets the flag. means for resetting, and means for first restoring the flag when returning from an interrupt, restoring the program counter and the repeat counter if the flag is in a reset state, and further restoring the instruction renoster if the returned flag is in a set state; It is characterized by having the following.

(実施例の説明) 第2図に本冗明の一実施例を示す。メモリ8は、命令あ
るいは演算データを記憶し、プログラムカウンタ9はメ
モリ8に格納されているプログラムの実行アドレスを示
す。命令レジスタ10は、プログラムカウンタ9によっ
て示されたメモリ8の内容を命令コードとして一時記憶
する。リピートカウンタ11はr−タパス12から初期
値を設定されその後零になるまで、命令レジスタlOに
格納されている命令コードが実行される度にその値を減
じてゆく。リピートフラッグ13は、リピートカウンタ
11に初期値が設定された後命令しノスタ10に格納さ
れた命令コードがくり返し実行されてゆく過程において
、1回目の実行が終了した時点でセットされ、最終回の
実行が終了した時点でリセットされるフラッグである。
(Description of Embodiment) FIG. 2 shows an embodiment of the present invention. The memory 8 stores instructions or operation data, and the program counter 9 indicates the execution address of the program stored in the memory 8. The instruction register 10 temporarily stores the contents of the memory 8 indicated by the program counter 9 as an instruction code. The repeat counter 11 is set with an initial value from the r-tapus 12, and thereafter decrements the value each time the instruction code stored in the instruction register IO is executed until it becomes zero. The repeat flag 13 is set at the end of the first execution in the process of repeatedly executing the instruction code stored in the nostar 10 after the initial value is set in the repeat counter 11. This is a flag that is reset when execution is complete.

スタックポインタ14はメモリ8とアドレスバス15と
共に割込み発生時に、プログラムカウンタ9、リピート
カウンタ11.リピートフラッグ13等を待避する手段
を実現している。すなわち、割込み発生時には、スタッ
クポインタ14が示すアドレスのメモリ8に前述のプロ
グラムカウンタ9等を格納する。割込みフラッグ16は
、外部条件でセットされ、割込み処理が開始された時点
で、制御部17の出力でリセットされるフラッグである
。制御部17は、命令レノスタ10、リピートフラッグ
l:3、割込みフラッグ16のそれぞれの出力と、リピ
ートカウンタ11の内容が零であることを示す零検出信
号18とを入力とし、前述の各構成要素を制御する。
The stack pointer 14, together with the memory 8 and the address bus 15, is used to register the program counter 9, repeat counter 11 . A means for evacuating the repeat flag 13, etc. is realized. That is, when an interrupt occurs, the aforementioned program counter 9 and the like are stored in the memory 8 at the address indicated by the stack pointer 14. The interrupt flag 16 is a flag that is set by an external condition and reset by the output of the control unit 17 when interrupt processing is started. The control unit 17 inputs the outputs of the instruction reno star 10, the repeat flag l:3, and the interrupt flag 16, and the zero detection signal 18 indicating that the content of the repeat counter 11 is zero, and controls each of the above-mentioned components. control.

第3図に第2図に示した制御部17の一構成例を示す。FIG. 3 shows an example of the configuration of the control section 17 shown in FIG. 2.

サイクルカウンタ19は、命令レノスタlOに命令コー
ドが格納された時点でリセ・・トされ、その後lマシン
サイクル毎にインクレメントされるカウンタである。P
LA(Programable LogicArray
) 20は、命令レジスタ10.サイクルカウンタ19
、割込みフラッグ16、リピートフラッグ13、零検出
信号18を入力とし、これらをそのAND部でデコード
し、OR部力・ら各種の制御信号21を出力する。なお
、後述のタイミングで制御部17を動作させる都合上、
PLA 20の入力は後述のクロックT2でイネーブル
となるラッチ22を用いて同期をとる。
The cycle counter 19 is a counter that is reset when an instruction code is stored in the instruction reno star IO, and is incremented every 1 machine cycle thereafter. P
LA (Programmable Logic Array)
) 20 is an instruction register 10. cycle counter 19
, an interrupt flag 16, a repeat flag 13, and a zero detection signal 18 are input, these are decoded by the AND section, and various control signals 21 are outputted from the OR section. In addition, for convenience of operating the control unit 17 at the timing described later,
The inputs of the PLA 20 are synchronized using a latch 22 enabled by a clock T2, which will be described later.

第4図には、第2図に示した一実施例の動作タイミング
を示す。lマシンサイクルをTOからT4の5つのクロ
ックでイア゛4成する。TOからTIの間でメモリ8が
アクセスされ、T1で命令コードが命令レノスタ10に
格納される。またこの時ザイクルカウ/り19はリセッ
トされる。命令コードが命令レソスタ1oに格納された
後は、サイクルカウンタ19はTlのタイミングでカウ
ントアッグされる。T2は、PLA20のデコードのた
めのタイミングであり、PLA 19の入力部に設けた
同期用のラッチ22がイネーブルとなる。T3とT4は
、メモリ8がらデータをデータバス12にとり出したシ
、あるいはデータバス12の内容をメモリ8に書き込む
ために用いる。すなわちT3のタイミングからメモリ8
のアクセスが開始され、T4のタイミングでデータがデ
ータバス12に出力される。逆に、T4のタイミングで
データバス12の内容がメモリ8に書き込壕れる。
FIG. 4 shows the operation timing of the embodiment shown in FIG. 2. One machine cycle is constructed using five clocks from TO to T4. The memory 8 is accessed between TO and TI, and the instruction code is stored in the instruction recorder 10 at T1. Also, at this time, the cycle counter 19 is reset. After the instruction code is stored in the instruction register 1o, the cycle counter 19 is incremented at the timing Tl. T2 is a timing for decoding the PLA 20, and the synchronization latch 22 provided at the input section of the PLA 19 is enabled. T3 and T4 are used to take out data from the memory 8 onto the data bus 12, or to write the contents of the data bus 12 into the memory 8. In other words, from the timing of T3, memory 8
Access is started, and data is output to the data bus 12 at timing T4. Conversely, the contents of the data bus 12 are written to the memory 8 at timing T4.

またT4のタイミングでリピートカウンタllはデータ
バス12から初期値を設定されたり、あるいは、その値
をデクリメントする。リピートフラッグ、T 3は、T
3のタイミングでセット、リセットされる。
Further, at the timing T4, the repeat counter 11 is set to an initial value from the data bus 12, or its value is decremented. Repeat flag, T 3 is T
It is set and reset at timing 3.

第5図に、第4図のタイミングに従うリピートカウンタ
11、リピートフラッグ13の一栴成例を示す。ダウン
カウンタ23は、ノリセ、ドブ・−タ入力端子24、プ
リセットイネーブル端子25、カウントダウンクロック
入力端子26、リセット端子27及び出力端子28を持
つ。ノリセットイネーブル端子25が“l″になると、
ダウンカウンタ23は、ノ°リーヒットデータ入力端子
24の値を内部のノリ、・70フコツブにセットする。
FIG. 5 shows an example of the repeat counter 11 and repeat flag 13 according to the timing shown in FIG. The down counter 23 has a counter input terminal 24, a preset enable terminal 25, a countdown clock input terminal 26, a reset terminal 27, and an output terminal 28. When the reset enable terminal 25 becomes “l”,
The down counter 23 sets the value of the hit data input terminal 24 to an internal value of .70.

その後カウントダウンクロック入力端子26がIt I
 IIになるとダウンカウンタ23はその値をデクレメ
ントしてゆく。ダウンカウンタ23の出力28すなわち
ダウンカウンタ23を構成しているフリツノフロップ0
(図示せず)の出力は、出力バッファ29を通してデー
タバス12に出力される。ダウンカウンタ23の出力2
8は、零検出回路30にも接続されている。零検出回路
30i−t、入力が総て零である時にその出力31を1
”にする。ゲート32は制御部16の出力である制御信
号PRES 33あるいはPOP 34が1”の時T4
タイミングで、プリセットイネーブル端子26を°゛l
”とする。ここで制御信号pRgs 33は、ダウンカ
ウンタ23に初期値を設定する命令が実行された時に“
1”となり、制御信号POP 34は、割込み処理から
復帰する時に′1″となる。ゲート35は、制従1部1
6の出力である制御出力DEC36がII I IIで
あり、がっ、ダウンカウンタ23の内容が零でない時の
T4タイミングで、カウントダウンクロ、り入力端7−
26を111 IIとする。ここで制御信号])EC3
6は、命令レノスタ10に格納されている命令がリピー
ト処理を行えるものである時、その命令が数マシンサイ
クルかかって実行されていく中で、各最後のマシンサイ
クルで“1″′となるようにPLA 19をノ0ログラ
ムしておくことにより出力される。リピートフラッグ1
3は、フリツノフロップ37と、出力ゲート38とから
構成されている。第5図に示すように、制御出力DEC
36が°゛l″であるT3タイミングの時、もしダウン
カウンタ23の内容が零でないならノリツノフロ、ノ3
7の出力REP 39は9′1′″となり、ダウンカウ
ンタ23の内容が零であるならばREP 39は1°0
”となる。フリツノフロップ37の出力REP 39は
また、制御信号POP34がII I ITである時の
T4タイミングでデータバス12の内容に応じてセット
もしくはリセットされる。
After that, the countdown clock input terminal 26 becomes It I
When the value reaches II, the down counter 23 decrements the value. The output 28 of the down counter 23, that is, the fritsuno flop 0 constituting the down counter 23
(not shown) is output to data bus 12 through output buffer 29. Output 2 of down counter 23
8 is also connected to the zero detection circuit 30. The zero detection circuits 30i-t set their outputs 31 to 1 when all inputs are zero.
When the control signal PRES 33 or POP 34, which is the output of the control unit 16, is 1, the gate 32 outputs T4.
At the same time, set the preset enable terminal 26 to
”.Here, the control signal pRgs 33 is “
The control signal POP 34 becomes '1' when returning from the interrupt processing. Gate 35 is control 1 part 1
The control output DEC36, which is the output of 6, is II II II, and at the T4 timing when the content of the down counter 23 is not zero, the countdown clock is input to the input terminal 7-
26 as 111 II. Here the control signal ]) EC3
6 is such that when the instruction stored in the instruction renoster 10 is capable of repeat processing, the instruction becomes "1" in each last machine cycle while the instruction is executed over several machine cycles. It is output by programming PLA 19 in the 0 program. repeat flag 1
3 is composed of a Fritzno flop 37 and an output gate 38. As shown in Fig. 5, the control output DEC
At the T3 timing when 36 is °゛l'', if the contents of the down counter 23 are not zero, then the
7's output REP 39 becomes 9'1''', and if the content of the down counter 23 is zero, REP 39 becomes 1°0.
”. The output REP 39 of the Fritsuno flop 37 is also set or reset depending on the contents of the data bus 12 at timing T4 when the control signal POP 34 is II I IT.

制御部16の出力である制御信号PSH40は、割込み
処理時にパ1′″となりT4タイミングでリピートカウ
ンタ11.  リピートフラッグ13の内容をデータバ
ス12に出力する。そしてこれらの値はスタックポイン
タ14が指示するアドレスのメモリ8に格納される。そ
してその後制御信号PE541がl′″となりリピート
カウンタ11、リピートフラッグ13はリセットされる
。また、零検出回路30の出力信号ZERO18は、前
述のように制御部17に接続されている。
The control signal PSH40, which is the output of the control unit 16, becomes P1'' during interrupt processing and outputs the contents of the repeat counter 11 and repeat flag 13 to the data bus 12 at timing T4. Then, the control signal PE541 becomes l''' and the repeat counter 11 and repeat flag 13 are reset. Further, the output signal ZERO18 of the zero detection circuit 30 is connected to the control section 17 as described above.

第6図は、第1図に示したプログラムを実行する時のリ
ピートカウンタ11、リピートフラッグ13の動作の一
例を示すタイムチャートである。
FIG. 6 is a time chart showing an example of the operation of the repeat counter 11 and repeat flag 13 when the program shown in FIG. 1 is executed.

リピートカウンタに初期値を設定する命令が命令レノス
タlOに格納されると、これが制御部17でデコードさ
れ、制御信号PRES 33が出力される。
When an instruction to set an initial value to the repeat counter is stored in the instruction reno star IO, this is decoded by the control unit 17 and a control signal PRES 33 is output.

この時、第6図に示すようにマシンサイクル410T4
タイミングでゲート32の出力が1”となり、データバ
ス12の内容がダウンカウンタ23にプリセットされ従
って零検出回路30の出力はlO″となる。ここでデー
タバス12上のデータは、メモリ8の内容もしくは命令
レノスタ10に格納されている命令コードの一部であり
今の場合2とする。
At this time, as shown in FIG. 6, the machine cycle 410T4
At this timing, the output of the gate 32 becomes 1'', the contents of the data bus 12 are preset in the down counter 23, and therefore the output of the zero detection circuit 30 becomes 10''. Here, the data on the data bus 12 is the contents of the memory 8 or a part of the instruction code stored in the instruction recorder 10, and is assumed to be 2 in this case.

マシンサイクル42のT2からマシンサイクル43のT
1の間に、n+1番地とn+2番地のメモリの内容ds
1及びdd、を用いてds1番地とdd。
From T2 of machine cycle 42 to T of machine cycle 43
1, the contents of memory at addresses n+1 and n+2 ds
ds1 address and dd using 1 and dd.

番地のメモリの内容が比較されリピート処理の1回目を
終了する。そして終了時のプログラムカウンタの値はn
+3となる。マシンサイクル43のT1では本来新しい
命令コードが命令レノスタ10にとり込まれるが零検出
回路30の出力が0″′の時は、と9込まないようにP
LA 20をフ0ログラムしておくことにより、マシン
サイクル44からは再び比較命令1が実行される。また
マシンサイクル43では制御信号DEC36かII I
 IIとなるようにPLA 20をプログラムしておく
。そこでマシンサイクル430T4では、ゲート35の
出力はl″とな9リピートカウンタの値はlとなる。ま
たマシンサイクル43のT3では零検出回路30の出力
31が1゛0″であるのでリピートフラッグが1”とな
り、リピート処理の1回目が終了したことをあられす。
The contents of the memory at the address are compared and the first repeat process is completed. And the value of the program counter at the end is n
It becomes +3. At T1 of machine cycle 43, a new instruction code is originally taken into the instruction recorder 10, but when the output of the zero detection circuit 30 is 0'', P
By programming LA 20, comparison instruction 1 is executed again from machine cycle 44. Also, in machine cycle 43, the control signal DEC36 or II
Program the PLA 20 so that it becomes II. Therefore, in machine cycle 430T4, the output of the gate 35 is l'' and the value of the 9 repeat counter is l.In addition, in machine cycle 43, T3, the output 31 of the zero detection circuit 30 is 1'0'', so the repeat flag is 1”, indicating that the first repeat process has been completed.

マシンサイクル44のT2からマシンサイクル450T
1の間に、n+3番地とt++4番地のメモリの内容d
H4、dd25が出力されてds2番地のメモリの内容
46とdd2番地のメモリの内容47の比較が行われて
リピート処理の2回目が終了する。またリピートカウン
タll、リピートフラッグ13及び命令レジスタ10の
動作は、リピート処理の1回目の場合と同様である。但
し、マシンサイクル45のT4でリピートカウンタ11
の内容は零となるので零検出回路29の出力は′°1”
となる。また、マシンサイクル45が終了した時のグロ
グラムカウンタ9の値はn −1−5となる。
Machine cycle 44 T2 to machine cycle 450T
1, the contents of memory at addresses n+3 and t++4 d
H4 and dd25 are output, the contents 46 of the memory at address ds2 and the contents 47 of memory at address dd2 are compared, and the second repeat process ends. Further, the operations of the repeat counter 11, the repeat flag 13, and the instruction register 10 are the same as in the case of the first repeat process. However, at T4 of machine cycle 45, repeat counter 11
Since the content of is zero, the output of the zero detection circuit 29 is '°1''
becomes. Furthermore, the value of the glogram counter 9 when the machine cycle 45 ends is n-1-5.

マシンサイクル48からマシンサイクル49にかけてリ
ピート処理の3回目すなわち最終回の処理が行われる。
The third or final repeat process is performed from machine cycle 48 to machine cycle 49.

そしてマシンサイクル490T3では零検出回路30の
出力はl”であるのでリヒートフラッグ13の出力は1
″となる。このように、リピートフラッグ13は、リピ
ート処理の1回目の終了時から最終回の終了時寸での間
+11 I+となる。マシンサイクル49の終了時のゾ
ロク°ラムカウンタの値はn+7となる。
In machine cycle 490T3, the output of the zero detection circuit 30 is l", so the output of the reheat flag 13 is 1.
''.In this way, the repeat flag 13 becomes +11 I+ from the end of the first repeat process to the end of the last time.The value of the Zoroku Ram counter at the end of the machine cycle 49 is It becomes n+7.

マシンサイクル50のT2で零検出回路30の出力は+
1111でありプログラムカウンタの値はn+7である
ので新しい命令51が命令レジスタ10に格納される。
At T2 of machine cycle 50, the output of zero detection circuit 30 is +
1111 and the value of the program counter is n+7, so a new instruction 51 is stored in the instruction register 10.

次に割込み処理について述べる。割込みフラッグ16が
セットされると、制御部17はこれをプ゛コードし、割
込み処理を開始する。割込み時、第7図に示す手順に従
うようにPLA 20をゾロク゛ラムしておく。すなわ
ち、リヒートフラッグ13かIll”ならば、スタック
ポインタ14の値を1つ減じ、この値が示すメモリ8に
命令レジスタ10の内容を待避する。次にスタックポイ
ンタ14の値を1つ減じこの値が示すメモリ8にプログ
ラムカウンタ9の内容を待避する。さらにスタックポイ
ンタ14の値を1つ減じると共に制御信号PSH40を
” 1 ”にしメモリ8にリピートカウンタ11、リピ
ートフラッグ13を待避する。そして待避後は制御信号
RES 41を“l”にしリピートカウンタ11、リヒ
ートフラッグ13をリセットする。最後に割込み先の実
行アドレスをプログラムカウンタ9に設定することによ
り割込み先のプログラムの実行を開始する。、−!、た
りビートフラッグが“θ″ならば、命令レジスタ10の
待避は行わない。そこで、例えば第6図のマシンサイク
ル44のT2で割込みフラッグ16がセットされるとこ
れ以降、制御部17は第7図に従って制御信号を出力す
る。そこでメモリ8には、比較命令1、n+3という値
をもつプログラムカウンタ9、■という値をもつリピー
トカウンタ11、及び1′″という状態をもつリヒート
フラッグ13が格納される。
Next, interrupt processing will be described. When the interrupt flag 16 is set, the control unit 17 precodes it and starts interrupt processing. At the time of an interrupt, the PLA 20 is programmed so as to follow the procedure shown in FIG. That is, if the reheat flag is 13 or "Ill", the value of the stack pointer 14 is decreased by 1, and the contents of the instruction register 10 are saved in the memory 8 indicated by this value.Next, the value of the stack pointer 14 is decreased by 1, and this value is The contents of the program counter 9 are saved in the memory 8 indicated by .Furthermore, the value of the stack pointer 14 is decremented by one, and the control signal PSH40 is set to "1", and the repeat counter 11 and repeat flag 13 are saved in the memory 8.And after saving sets the control signal RES 41 to "L" and resets the repeat counter 11 and reheat flag 13. Finally, by setting the execution address of the interrupt destination in the program counter 9, execution of the program of the interrupt destination is started., -! , or the beat flag is "θ", the instruction register 10 is not saved. Therefore, for example, when the interrupt flag 16 is set at T2 of the machine cycle 44 in FIG. A control signal is output according to the figure.Therefore, the memory 8 stores a comparison instruction 1, a program counter 9 with a value of n+3, a repeat counter 11 with a value of ■, and a reheat flag 13 with a state of 1''. Ru.

割込み先のプログラムの最後には割込み復帰命令を格納
(7ておく。この割込み復帰命令によって、第8図に示
す手順に従って制御信号を出力するように、PLA 2
0をプログラムしておく。すなわち、先ずメモリ8に待
避しておいたリピートカウンタ11、リピートフラッグ
13の値を復帰する。次にスタックポインタ14の値を
1つインクレメントしメモリ8に待避しておいたプログ
ラムカウンタ9の値を復帰する。そして最初に復帰した
リピートフラッグ13の値を判断し、その値がl”なら
ば、さらにスタックポインタ14を1つインクレメント
しメモリ8に待避しておいた命令コードを命令レジスタ
10に復帰することにより、この命令コードを実行する
。復帰したリピートフラッグ13の値が9°0″ならば
、命令レジスタ10への復帰は行わず、復帰したグログ
ラムカウンタ9によってさし示されるメモリ8の内在を
命令レジスタ10へ格納する。次に例として第6図に示
すマシンサイクル44のT2タイミングから割込み処理
を開始したプログラムが、誉す込みから復帰する場合を
考える。第8図に示した手順に従って制御部17は制御
信号を出力する。そこで先ずメモリ8からリヒートカウ
ンタ11、リピートフラッグ13の値を復帰する。そこ
でリピートカウンタ11の値は1、リピートフラッグ1
3の値は1″となる。次にメモリ8からゾログラムカウ
ンタ9の値が復(fljされn + 3となる。今、復
帰したリピートフラッグ13がパ1″′であるので、さ
らにメモリ8から命令コードが復帰され、命令レノスタ
10には比較命令lが格納される。そしてゾログラムカ
ウンタ9の値n+3がさし示すメモリ8の値ds24の
メモリ8がアクセスされる。すなわち、割込みにより中
断していたリピート処理の2回目を開始する。
An interrupt return instruction is stored at the end of the interrupt destination program (7). This interrupt return instruction causes the PLA 2 to output a control signal according to the procedure shown in FIG.
Program 0. That is, first, the values of the repeat counter 11 and repeat flag 13 saved in the memory 8 are restored. Next, the value of the stack pointer 14 is incremented by one, and the value of the program counter 9 saved in the memory 8 is restored. Then, the value of the repeat flag 13 returned first is judged, and if the value is "l", the stack pointer 14 is further incremented by one, and the instruction code saved in the memory 8 is returned to the instruction register 10. This instruction code is executed by executing this instruction code. If the value of the returned repeat flag 13 is 9°0'', the return to the instruction register 10 is not performed, and the contents of the memory 8 pointed to by the returned program counter 9 are executed. Store in instruction register 10. Next, as an example, consider a case where a program that starts interrupt processing at timing T2 of the machine cycle 44 shown in FIG. 6 returns from an interrupt. The control section 17 outputs a control signal according to the procedure shown in FIG. Therefore, first, the values of the reheat counter 11 and repeat flag 13 are restored from the memory 8. Therefore, the value of the repeat counter 11 is 1, and the repeat flag is 1.
The value of 3 becomes 1''. Next, the value of the zologram counter 9 is restored (flj) from the memory 8 and becomes n + 3. Since the repeat flag 13 that has just been restored is 1'', the value of the zologram counter 9 is further retrieved from the memory 8. The instruction code is returned from , and the comparison instruction l is stored in the instruction renoster 10. Then, the memory 8 whose value ds24 in the memory 8 pointed to by the value n+3 of the zologram counter 9 is accessed. Start the second repeat process.

(発明の効果) 以上述べたように、本発明によればひとつのオペレータ
とそれに続くアドレスのメモリに連続して複数個のオ被
ランドを格納するという命令形式によりストリンゲス処
理を可能とするマイクロコンピュータにおいて、ゾログ
ラムカウンタが現在実行中の命令のオペレータを示して
おらずオペランドのみを示している場合においても割込
みが可能と々る。すなわち、割込みという急を要するプ
ログラムの起動のために設けられた機能を何ら損うこと
なく、ストリング処理を行うことができる。
(Effects of the Invention) As described above, according to the present invention, a microcomputer can perform string processing using an instruction format in which a plurality of operands are successively stored in the memory of one operator and the following address. In the above, an interrupt is possible even when the zologram counter does not indicate the operator of the currently executing instruction but only indicates the operand. In other words, string processing can be performed without impairing the interrupt function, which is provided for starting a program that requires an urgent need.

またこれらの機能を実現するために、従来のマイクロコ
ンピータのプログラム制御装置に追加すべきハードウェ
アの主たるものは、ダウンカウンタとフリッグ70ツノ
であり、顕著なハードウェアの増加はない。
Further, in order to realize these functions, the main hardware that must be added to the conventional microcomputer program control device is a down counter and a frig 70 horn, and there is no significant increase in hardware.

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

第1図はリピート処理プログラムの一例を、第2図は本
発明の一実施例を、第3図は第2図中の制御部の一構成
例を、第4図は本発明の一実施例に用いたタイミングを
、第5回目第2図中のリピートカウンタ、リピートフラ
ッグの一構成例を、第6図は第1図に示したプログラム
を第2図に示した本発明の一実施例で実行した時のタイ
ミングを、第7図は割込み処理を行うために第3図中の
PLAにプログラムされている制御手順を、第8図は、
割込み復帰処理を行うために第3図中のPLAにノログ
ラムされている制御手順をそれぞれ示す。 8・・・メモリ、9・・プログラムカウンタ、lo・・
命令レノスタ、11・・・リピートカウンタ、13・・
リピートフラッグ、14・・・スタックポインタ、23
・・ダウンカウンタ、30・・零検出回路、37・・・
フリラフ0フロツプ。 258 第4図 T4
Fig. 1 shows an example of a repeat processing program, Fig. 2 shows an embodiment of the present invention, Fig. 3 shows an example of the configuration of the control section in Fig. 2, and Fig. 4 shows an embodiment of the invention. Figure 6 shows an example of the configuration of the repeat counter and repeat flag shown in Figure 2, and Figure 6 shows the example of the program shown in Figure 1 in an embodiment of the present invention shown in Figure 2. Figure 7 shows the timing of execution, and Figure 8 shows the control procedure programmed into the PLA in Figure 3 to perform interrupt processing.
The control procedures programmed in the PLA in FIG. 3 to perform interrupt recovery processing are shown below. 8...Memory, 9...Program counter, lo...
Instruction reno star, 11... Repeat counter, 13...
Repeat flag, 14...Stack pointer, 23
...Down counter, 30...Zero detection circuit, 37...
Free ruff 0 flop. 258 Figure 4 T4

Claims (1)

【特許請求の範囲】[Claims] 一連の命令群及びデータを記憶するメモリと、前記メモ
リに記憶されている命令群の実行アドレスを指示するゾ
ログラムカウンタと、前記メモ1ノに記憶され前記プロ
グラムカウンタによって指示される命令を後述のリピー
トカウンタのイ直75E零の時とり込む命令レジス、り
と、前記命令レノスタに記憶されている命令のくり返し
実行数を初期f直としてノリセットし命令を実行する毎
にそのイ直75玉零になるまでlづつ減じてゆくリピー
トカウンタと、前記リピートカウンタに初期値がプリセ
ットされ前記命令レジスタに格納されている命令が1口
実行された後にセットされ前記リピートカウンタの値が
零になった後にリセットされるフラッグと、前記フラッ
グがリセットされている状態で割込みが生じた時には、
前記プログラムカウンタ、前言己リピートカウンタ、お
よび前記フラッグのそれぞれの内容を待避すると共に前
記リピートカウンタをリセットし、前記フラッグがセッ
トされている時にはさらに前記命令レジスタの内容を待
避すると共に前記フラッグをリセットする手段と、割込
みから復帰する時には先ず前記フラッグを復帰し、それ
がリセット状態ならば前記プログラムカウンタ、前記リ
ピートカウンタを復帰し、復帰したフラッグがセット状
態ならばさらに前記命令レノスタを復帰する手段とを有
するプログラム制御装置。
A memory for storing a series of instructions and data, a zologram counter for indicating the execution address of the instruction group stored in the memory, and instructions stored in the memo 1 and instructed by the program counter as described below. When the repeat counter is zero, the number of repeated executions of the instruction stored in the instruction register is reset as the initial value, and each time the instruction is executed, the instruction register is set to zero. a repeat counter that decrements by l until the initial value is preset to the repeat counter and the instruction stored in the instruction register is set after one instruction is executed, and the repeat counter is set after the value of the repeat counter becomes zero. The flag to be reset, and when an interrupt occurs while the flag is reset,
The contents of the program counter, the previous repeat counter, and the flag are saved, and the repeat counter is reset, and when the flag is set, the contents of the instruction register are saved, and the flag is reset. and means for first restoring the flag when returning from an interrupt, restoring the program counter and repeat counter if the flag is in a reset state, and further restoring the instruction renoster if the returned flag is in a set state. Program control device with.
JP15670382A 1982-09-10 1982-09-10 Program controller Granted JPS5947651A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP15670382A JPS5947651A (en) 1982-09-10 1982-09-10 Program controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP15670382A JPS5947651A (en) 1982-09-10 1982-09-10 Program controller

Publications (2)

Publication Number Publication Date
JPS5947651A true JPS5947651A (en) 1984-03-17
JPS6242301B2 JPS6242301B2 (en) 1987-09-08

Family

ID=15633486

Family Applications (1)

Application Number Title Priority Date Filing Date
JP15670382A Granted JPS5947651A (en) 1982-09-10 1982-09-10 Program controller

Country Status (1)

Country Link
JP (1) JPS5947651A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63237922A (en) * 1987-03-26 1988-10-04 Saitou Plast Kogyosho:Kk Molding method for resin product
JPH02187829A (en) * 1989-01-13 1990-07-24 Mitsubishi Electric Corp Digital signal processor
EP0454606A2 (en) * 1990-04-23 1991-10-30 International Business Machines Corporation Digital processor with a pipelined architecture permitting an improved concurrent processing of multiple applications
US5596760A (en) * 1991-12-09 1997-01-21 Matsushita Electric Industrial Co., Ltd. Program control method and program control apparatus

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63237922A (en) * 1987-03-26 1988-10-04 Saitou Plast Kogyosho:Kk Molding method for resin product
JPH02187829A (en) * 1989-01-13 1990-07-24 Mitsubishi Electric Corp Digital signal processor
EP0454606A2 (en) * 1990-04-23 1991-10-30 International Business Machines Corporation Digital processor with a pipelined architecture permitting an improved concurrent processing of multiple applications
EP0454606A3 (en) * 1990-04-23 1993-08-11 International Business Machines Corporation Digital processor with a pipelined architecture permitting an improved concurrent processing of multiple applications
US5596760A (en) * 1991-12-09 1997-01-21 Matsushita Electric Industrial Co., Ltd. Program control method and program control apparatus

Also Published As

Publication number Publication date
JPS6242301B2 (en) 1987-09-08

Similar Documents

Publication Publication Date Title
US4870562A (en) Microcomputer capable of accessing internal memory at a desired variable access time
JPH0769791B2 (en) Microprocessor
JPH0348537B2 (en)
JPS5947651A (en) Program controller
JPS6055864B2 (en) vector processor
JPH07219766A (en) Arithmetic processor
JPH0831033B2 (en) Data processing device
JP2812610B2 (en) Pipeline control method
JPS59200356A (en) Program tracing system
JP2504535B2 (en) Bus unit configuration method
JPH0343830A (en) Block repeating circuit
JPS6217840A (en) Microprogram control system based upon attribution flag
JPS63163543A (en) Information processor
JPS63823B2 (en)
JPS6288035A (en) Microprogram controller
JPS5896346A (en) Hierarchical arithmetic system
JPH01121937A (en) Microcomputer
JPS6285339A (en) Microcomputer
JPH01281533A (en) Microprogram controller
JPS6349941A (en) Arithmetic processing unit
JPS59212966A (en) Execution stop circuit of data processor
JPH03164945A (en) Data processor
JPS6288036A (en) Microprogram controller
JPS6376015A (en) Instruction fetching system
JPH0158528B2 (en)