JP2694774B2 - Program branch method - Google Patents

Program branch method

Info

Publication number
JP2694774B2
JP2694774B2 JP2280502A JP28050290A JP2694774B2 JP 2694774 B2 JP2694774 B2 JP 2694774B2 JP 2280502 A JP2280502 A JP 2280502A JP 28050290 A JP28050290 A JP 28050290A JP 2694774 B2 JP2694774 B2 JP 2694774B2
Authority
JP
Japan
Prior art keywords
program
branch
instruction
address
processing
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 - Fee Related
Application number
JP2280502A
Other languages
Japanese (ja)
Other versions
JPH04153836A (en
Inventor
了 神谷
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.)
Yamaha Corp
Original Assignee
Yamaha Corp
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 Yamaha Corp filed Critical Yamaha Corp
Priority to JP2280502A priority Critical patent/JP2694774B2/en
Publication of JPH04153836A publication Critical patent/JPH04153836A/en
Application granted granted Critical
Publication of JP2694774B2 publication Critical patent/JP2694774B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)

Description

【発明の詳細な説明】 [産業上の利用分野] この発明は、一つのプロセッサが分岐によって複数の
処理を順次実行していく際のプログラム分岐方式に関す
る。
Description: TECHNICAL FIELD The present invention relates to a program branching method when one processor sequentially executes a plurality of processes by branching.

[従来の技術] 複数の独立した処理を単一のプロセッサによって並列
的に実行する方法として、従来から複数の処理プログラ
ム間で条件分岐を繰り返しながら前記複数の処理を交互
に実行していく方法が知られている。
[Prior Art] As a method of executing a plurality of independent processes in parallel by a single processor, a method of executing the plurality of processes alternately while repeating conditional branching between a plurality of process programs has been conventionally used. Are known.

第6図は、このような条件分岐による従来の方法を説
明するための模式図である。
FIG. 6 is a schematic diagram for explaining a conventional method based on such conditional branching.

即ち、プログラムP1中のアドレスA1でCALL命令をフェ
ッチすると、プロセッサは、プログラムカウンタPCの値
であるアドレスA1をスタックレジスタトップSTに退避さ
せ、プログラムカウンタPCにはCALL命令のオペランドで
あるアドレスA2を格納する。これにより、プロセッサの
処理は、プログラムP2のアドレスA2に分岐する。
That is, when the CALL instruction is fetched at the address A1 in the program P1, the processor saves the address A1 which is the value of the program counter PC to the stack register top ST, and the address A2 which is the operand of the CALL instruction is stored in the program counter PC. Store. As a result, the processing of the processor branches to the address A2 of the program P2.

続いて、プログラムP2の実行中、RET(リターン)命
令をフェッチすると、プロセッサは、スタックレジスタ
トップSTに退避させておいた分岐前のアドレスA1をプロ
グラムカウンタPCに復元する。これにより、プロセッサ
の処理は、再びプログラムP2からプログラムP1のアドレ
スA1+1に分岐する。
Subsequently, when the RET (return) instruction is fetched during execution of the program P2, the processor restores the address A1 before the branch saved in the stack register top ST to the program counter PC. As a result, the processing of the processor branches again from the program P2 to the address A1 + 1 of the program P1.

以上のような処理を繰り返すことにより、単一のプロ
セッサでプログラムP1とプログラムP2とを交互に実行す
ることができ、見かけ上2つの処理を並列的に実行させ
ることができる。
By repeating the above processing, the single processor can alternately execute the programs P1 and P2, and apparently the two processings can be executed in parallel.

[発明が解決しようとする課題] しかしながら、このような従来のプログラム分岐方式
では、プログラムP2を変更した場合に、プログラムP1中
のCALL命令の分岐先も変更しなければならない。
[Problems to be Solved by the Invention] However, in such a conventional program branching method, when the program P2 is changed, the branch destination of the CALL instruction in the program P1 must also be changed.

このように、従来の単一プロセッサによる条件分岐方
式では、分岐元及び分岐先のプログラムが互いに影響を
及ぼし合うことになる。このため、分岐処理が複雑化す
ると共に、分岐処理のタイミングを個々の処理毎に独自
に設定することができないため、例えば送受信のプログ
ラムに適用した場合、送受信の同期確立が難しくなると
いう問題点がある。
As described above, in the conventional conditional branch method using a single processor, the branch source program and the branch destination program influence each other. For this reason, the branching process becomes complicated, and the timing of the branching process cannot be set independently for each individual process. Therefore, when applied to a program for sending and receiving, it is difficult to establish synchronization between sending and receiving. is there.

この発明は、このような問題点を解決するためになさ
れたもので、複数の処理が互いに実行権を他の処理に渡
すための分岐処理を、複数の処理間で互いに影響を及ぼ
すことなしに極めて簡単な命令によって実行することが
でき、分岐処理の簡単化及び送受信プログラムの同期確
立の容易化を図ることができるプログラム分岐方式を提
供することを目的とする。
The present invention has been made to solve such a problem, and a branching process for a plurality of processes to pass execution rights to another process can be performed without affecting each other. It is an object of the present invention to provide a program branching method that can be executed by an extremely simple instruction and that can simplify branch processing and facilitate synchronization establishment of a transmission / reception program.

[課題を解決するための手段] この発明のプログラム分岐方式は、2つのプログラム
を並列に実行するためのプログラム分岐方式において、
前記2つのプログラム間で1つの後入れ先出し法のスタ
ックレジスタ群を共有すると共に、プログラムカウンタ
に格納された現在アドレスと前記スタックレジスタ群の
トップに格納されたデータとを交換する分岐命令を備
え、前記2つのプログラム中に前記分岐命令を適宜挿入
することにより、他の分岐機構を介すことなく、前記2
つのプログラム間で分岐処理を実行することを特徴とす
る。
[Means for Solving the Problem] A program branching method of the present invention is a program branching method for executing two programs in parallel,
A branch instruction for sharing one last-in, first-out stack register group between the two programs and for exchanging a current address stored in a program counter with data stored at the top of the stack register group; By appropriately inserting the branch instruction into the two programs, the branch instruction can be executed without passing through another branch mechanism.
The feature is that branch processing is executed between two programs.

[作用] この発明によれば第1の処理の実行中に前記分岐命令
を実行すると、プログラムカウンタに格納された現在ア
ドレスとスタックレジスタに格納された第2の処理の分
岐前のアドレスとが交換されるので、上記第2の処理に
おける分岐前のアドレスに分岐することになる。更に、
この第2の処理を実行している最中に前記分岐命令を実
行すると、上記と同様に第2の処理に分岐する前の前記
第1の処理のアドレスに分岐することになる。
[Operation] According to the present invention, when the branch instruction is executed during execution of the first process, the current address stored in the program counter and the address before the branch of the second process stored in the stack register are exchanged. Therefore, the branch is made to the address before the branch in the second processing. Furthermore,
If the branch instruction is executed during the execution of the second processing, the processing branches to the address of the first processing before the processing branches to the second processing as described above.

このように、2つの処理に前記分岐命令を適宜挿入し
ておくことにより、前記2つの処理が単一のプロセッサ
によって交互に実行されることになる。
By appropriately inserting the branch instruction in the two processes in this manner, the two processes are alternately executed by the single processor.

この発明によれば、一方の処理が変更されても他方の
処理には、分岐先等の条件が記載されていないから、他
方の処理が影響を受けることはない。このため、分岐処
理のタイミングも容易に設定することができる。
According to the present invention, even if one process is changed, the other process does not have a condition such as a branch destination, so that the other process is not affected. Therefore, the timing of branch processing can be easily set.

[実施例] 以下、添付の図面を参照して、この発明の実施例につ
いて説明する。
Embodiments Embodiments of the present invention will be described below with reference to the accompanying drawings.

第2図は、この実施例のプログラム分岐方式を適用し
た信号処理プロセッサのシステム構成を示すブロック図
である。
FIG. 2 is a block diagram showing the system configuration of a signal processor to which the program branching method of this embodiment is applied.

このシステムは、通信回線を介して受信された信号を
ディジタル信号の形態で処理して送信するシステムで、
受信処理用のプログラムと送信処理用のプログラムとを
備え、これらを交互に並列的に実行する。このシステム
は、システムの制御を司るCPU(中央処理装置)1と、
前記送受信用のプログラムが格納されたROM2と、前記送
受信処理において作業エリアを提供するRAM3と、キーボ
ード等の操作部4と、図示しない通信回線とシステムと
の間のデータの送受信を制御する通信/回線制御部5と
からなり、これらがシステムバス6を介して相互に接続
されて構成されている。
This system is a system for processing and transmitting a signal received through a communication line in the form of a digital signal,
A program for reception processing and a program for transmission processing are provided, and these programs are alternately executed in parallel. This system has a CPU (Central Processing Unit) 1 that controls the system,
A ROM 2 storing the transmission / reception program, a RAM 3 for providing a work area in the transmission / reception processing, an operation unit 4 such as a keyboard, and communication / control for controlling data transmission / reception between a communication line (not shown) and the system. It is composed of a line control unit 5, which are connected to each other via a system bus 6.

CPU1は、例えば第3図に示すように構成されている。 The CPU 1 is configured, for example, as shown in FIG.

即ち、ROM2等から順次読み出された命令は、データバ
ス11を介して命令レジスタ13に格納されたのち、命令デ
コーダ14で解読されるようになっている。命令デコーダ
14は、解読結果に基づいて、汎用レジスタ群15、プログ
ラムカウンタ16及びスタックレジスタ群17に対するデー
タの格納及び読出制御と、プログラムカウンタ16のイン
クリメント制御を行う。また、命令デコーダ14は、演算
処理部18の演算処理の実行を制御する。プログラムカウ
ンタ16に格納された値は、アドレスバッファ19を介して
アドレスバス12に出力されるようになっている。
That is, the instructions sequentially read from the ROM 2 and the like are stored in the instruction register 13 via the data bus 11 and then decoded by the instruction decoder 14. Instruction decoder
Based on the decoding result, the control unit 14 controls data storage and reading with respect to the general-purpose register group 15, the program counter 16 and the stack register group 17 and the increment control of the program counter 16. The instruction decoder 14 also controls the execution of the arithmetic processing of the arithmetic processing unit 18. The value stored in the program counter 16 is output to the address bus 12 via the address buffer 19.

次に、このシステムに備えられたCO_RET命令について
説明する。
Next, the CO_RET instruction provided in this system will be described.

CO_RET命令は、従来のCALL命令と同様分岐命令の一種
である。このCO_RET命令が実行されると、プログラムカ
ウンタ16に格納されている値と、スタックレジスタ群17
のトップ(以下、スタックレジスタトップと呼ぶ)に格
納された値とが交換される。
The CO_RET instruction is a kind of branch instruction like the conventional CALL instruction. When this CO_RET instruction is executed, the value stored in the program counter 16 and the stack register group 17
Is exchanged with the value stored in the top (hereinafter, referred to as the stack register top).

第1図は、このCO_RET命令を使用した分岐処理を示す
模式図である。
FIG. 1 is a schematic diagram showing a branch process using this CO_RET instruction.

即ち、いま、何らかの処理によってスタックレジスタ
トップ(ST)にプログラムP2中のアドレスA3が格納され
ているとする。このとき、プログラムP1のアドレスA1で
CO_RET命令が実行されると、プログラムカウンタ(PC)
16に格納されているアドレスA1と、スタックレジスタト
ップ17に格納されているアドレスA3とが入れ替わる。こ
れにより、処理はプログラムP2のアドレスA3に分岐す
る。プログラムP2の処理が進み、アドレスA4でCO_RET命
令が実行されると、プログラムカウンタ16に格納されて
いるアドレスA4と、スタックレジスタトップに格納され
ているアドレスA1とが入れ替わる。これにより、処理
は、プログラムP1のアドレスA1に分岐する。
That is, it is assumed that the address A3 in the program P2 is stored in the stack register top (ST) by some processing. At this time, at address A1 of program P1
When the CO_RET instruction is executed, the program counter (PC)
The address A1 stored in 16 and the address A3 stored in the stack register top 17 are exchanged. As a result, the process branches to the address A3 of the program P2. When the processing of the program P2 progresses and the CO_RET instruction is executed at the address A4, the address A4 stored in the program counter 16 and the address A1 stored in the stack register top are exchanged. As a result, the process branches to the address A1 of the program P1.

以後、同様の処理を繰り返すことにより、プログラム
P1とP2とが交互に実行されることになる。
After that, by repeating the same processing, the program
P1 and P2 will be executed alternately.

第4図は本発明による分岐処理の応用例を示す図であ
る。即ち、送信用及び受信用の各プログラムに適宜CO_R
ET命令を挿入するだけで、送信用プログラムと受信用プ
ログラムとの間で交互にプログラムの実行権を渡して並
列的な処理を行うことができる。また、図示のように、
各プログラム中においても、CALL命令及びRET命令の挿
入によって、プログラム内分岐を行うことが可能である
ことはいうまでもない。
FIG. 4 is a diagram showing an application example of the branching process according to the present invention. That is, CO_R can be set appropriately for each program for transmission and reception.
By simply inserting the ET command, the program execution right can be alternately passed between the transmission program and the reception program to perform parallel processing. Also, as shown
Needless to say, it is possible to branch in a program by inserting a CALL instruction and a RET instruction even in each program.

このような処理を行うことにより、送信用及び受信用
のプログラムは、互いに相手のプログラムを意識するこ
となく分岐のタイミングを決定することができる。した
がって、例えば第5図(a),(b)に示すように、送
受信のプログラムループ中に、一定時間プログラムを実
行する毎にCO_RET命令を挿入する場合でも、送受信のプ
ログラムで、夫々挿入タイミングを独自に設定すること
ができる。このため、送受信の同期確立も容易になると
いう利点がある。
By performing such processing, the transmission program and the reception program can determine the branch timing without being aware of each other's program. Therefore, for example, as shown in FIGS. 5A and 5B, even when the CO_RET instruction is inserted into the transmission / reception program loop every time the program is executed for a certain period of time, the insertion / reception timings of the transmission / reception program are different from each other. Can be set independently. Therefore, there is an advantage that synchronization of transmission and reception can be easily established.

[発明の効果] 以上述べたように、この発明によれば、分岐命令とし
てプログラムカウンタに格納された現在アドレスとスタ
ックレジスタに格納された分岐前アドレスとを交換する
命令によって分岐処理を行うようにしたので、一方の処
理を規定するプログラム中に他方の処理を規定するプロ
グラムの分岐先等を記述する必要がなく、複数の処理が
相互に影響を及ぼすことはない。
[Effects of the Invention] As described above, according to the present invention, branch processing is performed by an instruction for exchanging the current address stored in the program counter as a branch instruction and the pre-branch address stored in the stack register. Therefore, it is not necessary to describe the branch destination of the program that defines the other process in the program that defines one process, and the multiple processes do not affect each other.

このため、分岐処理及びそのタイミングの設定が極め
て簡単になるという効果を奏する。
Therefore, there is an effect that the branching process and the setting of the timing thereof are extremely simple.

【図面の簡単な説明】[Brief description of the drawings]

第1図はこの発明の実施例のプログラム分岐方式を説明
するための模式図、第2図は同方式を適用しシステムの
ブロック図、第3図は同システムにおけるCPUのブロッ
ク図、第4図は同方式の応用例を説明するための模式
図、第5図は同方式における分岐命令の挿入タイミング
を示す模式図、第6図は従来のプログラム分岐方式を説
明するすための模式図である。 1……CPU、2……ROM、3……RAM、4……操作部、5
……通信/回線制御部、6……システムバス、11……デ
ータバス、12……アドレスバス、13……命令レジスタ、
14……命令デコーダ、15……汎用レジスタ群、16……プ
ログラムカウンタ、17……スタックレジスタ群、18……
演算処理部、19……アドレスバッファ。
FIG. 1 is a schematic diagram for explaining a program branching system of an embodiment of the present invention, FIG. 2 is a block diagram of a system to which the system is applied, FIG. 3 is a block diagram of a CPU in the system, and FIG. Is a schematic diagram for explaining an application example of the system, FIG. 5 is a schematic diagram showing a branch instruction insertion timing in the system, and FIG. 6 is a schematic diagram for explaining a conventional program branch system. . 1 ... CPU, 2 ... ROM, 3 ... RAM, 4 ... operation section, 5
...... Communication / line control unit, 6 ... System bus, 11 ... Data bus, 12 ... Address bus, 13 ... Instruction register,
14 …… Instruction decoder, 15 …… General purpose register group, 16 …… Program counter, 17 …… Stack register group, 18 ……
Arithmetic processing unit, 19 ... Address buffer.

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】2つのプログラムを並列に実行するための
プログラム分岐方式において、 前記2つのプログラム間で1つの後入れ先出し法のスタ
ックレジスタ群を共有すると共に、 プログラムカウンタに格納された現在アドレスと前記ス
タックレジスタ群のトップに格納されたデータとを交換
する分岐命令を備え、 前記2つのプログラム中に前記分岐命令を適宜挿入する
ことにより、他の分岐機構を介すことなく、前記2つの
プログラム間で分岐処理を実行することを特徴とするプ
ログラム分岐方式。
1. A program branching method for executing two programs in parallel, wherein one stack register group of the last-in first-out method is shared between the two programs, and a current address stored in a program counter is used. A branch instruction for exchanging data stored at the top of the stack register group is provided, and by appropriately inserting the branch instruction into the two programs, the two programs can be executed without passing through another branch mechanism. A program branching method characterized in that branching processing is executed between them.
JP2280502A 1990-10-18 1990-10-18 Program branch method Expired - Fee Related JP2694774B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2280502A JP2694774B2 (en) 1990-10-18 1990-10-18 Program branch method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2280502A JP2694774B2 (en) 1990-10-18 1990-10-18 Program branch method

Publications (2)

Publication Number Publication Date
JPH04153836A JPH04153836A (en) 1992-05-27
JP2694774B2 true JP2694774B2 (en) 1997-12-24

Family

ID=17625986

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2280502A Expired - Fee Related JP2694774B2 (en) 1990-10-18 1990-10-18 Program branch method

Country Status (1)

Country Link
JP (1) JP2694774B2 (en)

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS52144242A (en) * 1976-05-27 1977-12-01 Mitsubishi Electric Corp Multi-task control system

Also Published As

Publication number Publication date
JPH04153836A (en) 1992-05-27

Similar Documents

Publication Publication Date Title
US4928226A (en) Data processor for parallelly executing conflicting instructions
US5611061A (en) Method and processor for reliably processing interrupt demands in a pipeline processor
GB2380834A (en) Thread ending method
US6029222A (en) Method and processor for selectively marking instructions as interruptible or uninterruptible and judging interrupt requests based on the marked instruction
US5283874A (en) Cross coupling mechanisms for simultaneously completing consecutive pipeline instructions even if they begin to process at the same microprocessor of the issue fee
EP0272705B1 (en) Loosely coupled pipeline processor
US5095426A (en) Data processing system for effectively handling exceptions during execution of two different types of instructions
EP0521486B1 (en) Hierarchical structure processor
US5499348A (en) Digital processor capable of concurrently executing external memory access and internal instructions
US4677549A (en) Pipelined data processor system having increased processing speed
EP0240606B1 (en) Pipe-line processing system and microprocessor using the system
US5872962A (en) Program control system
US5291615A (en) Instruction pipeline microprocessor
US20010016899A1 (en) Data-processing device
JP2694774B2 (en) Program branch method
US5276822A (en) System with enhanced execution of address-conflicting instructions using immediate data latch for holding immediate data of a preceding instruction
US6763450B1 (en) Processor
JP2814683B2 (en) Instruction processing unit
JPH0793151A (en) Instruction supplying device
JPH0338727A (en) Resources interference controller and data processor
JP3735551B2 (en) Information processing device that operates in synchronous / asynchronous mode
JPS62175831A (en) Control system for pipeline with tag
EP0234785A1 (en) Improvements relating to control flow in computers
JPS63141131A (en) Pipeline control system
JPH10510936A (en) Microprocessor

Legal Events

Date Code Title Description
S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313532

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20070912

Year of fee payment: 10

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20080912

Year of fee payment: 11

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20090912

Year of fee payment: 12

LAPS Cancellation because of no payment of annual fees