JPH0527975A - Microcomputer - Google Patents

Microcomputer

Info

Publication number
JPH0527975A
JPH0527975A JP3207631A JP20763191A JPH0527975A JP H0527975 A JPH0527975 A JP H0527975A JP 3207631 A JP3207631 A JP 3207631A JP 20763191 A JP20763191 A JP 20763191A JP H0527975 A JPH0527975 A JP H0527975A
Authority
JP
Japan
Prior art keywords
stack
data
stack area
area
stack pointer
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
JP3207631A
Other languages
Japanese (ja)
Inventor
Yuji Sasahara
裕司 笹原
Akiko Takemoto
明樹子 竹本
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.)
Mitsubishi Electric Corp
Original Assignee
Mitsubishi Electric 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 Mitsubishi Electric Corp filed Critical Mitsubishi Electric Corp
Priority to JP3207631A priority Critical patent/JPH0527975A/en
Publication of JPH0527975A publication Critical patent/JPH0527975A/en
Pending legal-status Critical Current

Links

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

PURPOSE:To facilitate the transfer of variables such as a sub routine, etc., in a stack by respectively providing first and second micropointers at the data storage places of first and second stack areas on a memory. CONSTITUTION:The stack area on the memory is divided into two areas 5 and 4, data to be used at the hardware of a return destination of the sub routine (SUB) or the return destination of interruption are stored in the place of the first area 5 shown by a first stack pointer SP-1, and data to be used on the software of augument, etc., are stored in the place of the second memory area 4 shown by the second stack pointer. Thus, since the stack is divided by functions even when instructions are alternately continued for operating the data on the hardware and the software, the transfer of variable is made smooth.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】この発明は、マイクロコンピュー
タに関し、特に、スタック操作におけるサブルーチン等
の変数の受け渡しを容易にするマイクロコンピュータに
関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a microcomputer, and more particularly to a microcomputer which facilitates the transfer of variables such as subroutines in stack operations.

【0002】[0002]

【従来の技術】従来のマイクロコンピュータでスタック
操作をする場合は、図2で示すような方法で行ってい
た。図2において、1〜3はスタック操作命令のステッ
プ、7はスタック領域、SP3はスタック領域内のデー
タ格納場所を示すスタックポインタであり、1〜3の命
令のステップを実行した場合のデータ及びスタックポイ
ンタの変化を示している
2. Description of the Related Art When a stack operation is performed by a conventional microcomputer, the method shown in FIG. 2 is used. In FIG. 2, 1-3 are steps of a stack operation instruction, 7 is a stack area, SP3 is a stack pointer indicating a data storage location in the stack area, and data and stack when the steps of 1-3 instructions are executed. Indicates a change in pointer

【0003】動作について説明すると、まず、第1ステ
ップのPUSH αを実行すると、スタック領域7に変
数の“α”が待避され、スタックポインタSP3が“0
000”から“0001”に変化する。次に、第2ステ
ップのPUSH βが実行されると、スタック領域7に
変数“β”が待避され、変数“α”の上に積まれる。そ
して、スタックポインタSP3は“0002”を示す。
次に、第3ステップの命令JSR SUBが実行されサ
ブルーチン(SUB)が呼出されると、サブルーチンの
戻り先番地のデータが変数“β”の上にさらに積まれ
て、スタックポインタSP3は最終的に“0003”を
示す。
To explain the operation, first, when PUSH α in the first step is executed, the variable “α” is saved in the stack area 7 and the stack pointer SP3 is set to “0”.
Change from 000 ”to“ 0001. ”Next, when the second step PUSH β is executed, the variable“ β ”is saved in the stack area 7 and is stacked on the variable“ α ”. The pointer SP3 indicates “0002”.
Next, when the instruction JSR SUB of the third step is executed and the subroutine (SUB) is called, the data of the return address of the subroutine is further loaded on the variable “β”, and the stack pointer SP3 finally becomes. Indicates "0003".

【0004】[0004]

【発明が解決しようとする課題】従来のマイクロコンピ
ュータでは、スタックポインタの示すスタック領域にデ
ータが積まれていくので、呼出されたサブルーチン内で
変数α,βの値を使用すようとすると、現在のスタック
ポインタから、変数α,βのデータが格納されている番
地を計算によって求めなければならないという問題点が
っあた。このため、変数の受け渡しが容易ではなく、ま
たCコンバイラを使用しての、関数呼出し部分のコンパ
イラ結果のオブジェクトコードが大きくなる問題点もあ
った。
In the conventional microcomputer, data is accumulated in the stack area indicated by the stack pointer. Therefore, if the values of the variables α and β are used in the called subroutine, it is currently impossible to use the values. There is a problem that the address where the data of variables α and β are stored must be calculated from the stack pointer of. For this reason, there is a problem in that it is not easy to pass variables, and the object code of the compiler result of the function calling portion using the C combiner becomes large.

【0005】この発明は上記のような問題点を解消する
ためになされたもので、スタックによるサブルーチンへ
の変数の受け渡しが容易にでき、また、Cコンパイラを
使用しての関数呼出し部分のコンパイラ結果でのオブジ
ェクトコードが大きくならないマイクロコンピュータを
提供することにある。
The present invention has been made in order to solve the above-mentioned problems. It is possible to easily pass a variable to a subroutine by a stack, and a compiler result of a function calling portion using a C compiler. The object is to provide a microcomputer that does not increase the object code in.

【0006】[0006]

【課題を解決するための手段】この発明に係るマイクロ
コンピュータではメモリ上のスタック領域を第1のスタ
ック領域5と第2のスタック領域4とに分け、上記第1
のスタック領域におけるサブルーチンの戻り先等のハー
ドウェア上で使用されるデータが格納されている場所を
示す第1のスタックポインタSP1と、第2のスタック
領域における引き数等のソフトウェア上で使用されるデ
ータが格納されている場所を示す第2のスタックポイン
タSP2とを有する。
In the microcomputer according to the present invention, the stack area on the memory is divided into a first stack area 5 and a second stack area 4, and
Used in software such as a first stack pointer SP1 indicating a location where data used in hardware such as a return destination of a subroutine in the stack area of the second stack area is stored, and an argument in the second stack area And a second stack pointer SP2 indicating the location where the data is stored.

【0007】[0007]

【作用】この発明に係るマイクロコンピュータでは、メ
モリ上のスタック領域を2つの領域に分け、サブルーチ
ンの戻り先や割込みの戻り先等のハードウェアで使用す
るデータを、上記第1のスタックポインタの示す上記第
1のメモリ領域の場所に格納し、引き数等のソフトウェ
ア上で使用するデータを上記第2のスタックポインタの
示す上記第2のメモリ領域の場所に格納する。このよう
に、格納するデータの機能によって、そのデータの格納
する場所を分けた。
In the microcomputer according to the present invention, the stack area on the memory is divided into two areas, and the data used by the hardware such as the return destination of the subroutine or the return destination of the interrupt is indicated by the first stack pointer. The data is stored in the location of the first memory area, and the data such as an argument used on the software is stored in the location of the second memory area indicated by the second stack pointer. In this way, the place to store the data is divided according to the function of the data to be stored.

【0008】[0008]

【実施例】以下、この発明の実施例を図について説明す
る。図1はこの発明の一実施例におけるスタック領域及
びスタックポインタを示す図である。図1において、1
〜3は命令のステップ、4は第1のスタック領域として
のスタック領域、5は第2のスタック領域としてのスタ
ック領域、SP2は第2のスタックポインタとしてのス
タックポインタ、SP1は第1のスタックポインタとし
てのスタックポインタてあり、命令によるスタック領域
のデータの変化及びスタックポインタの変化を示してい
る。
Embodiments of the present invention will be described below with reference to the drawings. FIG. 1 is a diagram showing a stack area and a stack pointer in an embodiment of the present invention. In FIG. 1, 1
˜3 are instruction steps, 4 is a stack area as a first stack area, 5 is a stack area as a second stack area, SP2 is a stack pointer as a second stack pointer, and SP1 is a first stack pointer. Is a stack pointer, which indicates a change in the data in the stack area and a change in the stack pointer depending on the instruction.

【0009】メモリ上のスタック領域は二つのスタック
領域に分かれており、第1のスタック領域のスタック領
域5は、サブルーチンの戻り先(サブルーチンの戻り番
地),割込み先の戻り先(割込み先の番地)等のハード
ウェアで使用するデータをスタックポインタSP1の示
す場所に格納するスタックである。また、第2のスタッ
ク領域のスタック領域4は、引き数のソフトウェア上で
使用されるデータをスタックポインタSP2の示す場所
に格納するスタックである。
The stack area on the memory is divided into two stack areas. The stack area 5 of the first stack area is the return destination of the subroutine (return address of the subroutine) and the return destination of the interrupt destination (address of the interrupt destination). ) And other data used by hardware is stored in the location indicated by the stack pointer SP1. Further, the stack area 4 of the second stack area is a stack for storing the data used on the software of the argument at the location indicated by the stack pointer SP2.

【0010】次に、図1を参照して、この実施例の動作
について説明する。命令が実行されない状態では、スタ
ック領域4のスタックポインタSP2は“0100”を
示している。第1のステップであるPUSH αの命令
が実行されると、スタックポインタSP2は“010
1”を示し、データ“α”がスタック領域4に待避され
る。次に、第2のステップであるPUSH βの命令が
実行されると、スタックポインタSP2は“0102”
を示し、データ“β”がスタック領域4に待避され、デ
ータ“α”の上に積まれる。
Next, the operation of this embodiment will be described with reference to FIG. When the instruction is not executed, the stack pointer SP2 in the stack area 4 indicates "0100". When the instruction of PUSH α, which is the first step, is executed, the stack pointer SP2 becomes “010
1 ”and the data“ α ”is saved in the stack area 4. Next, when the instruction of PUSH β which is the second step is executed, the stack pointer SP2 is set to“ 0102 ”.
The data “β” is saved in the stack area 4 and stacked on the data “α”.

【0011】次に、第3のステップであるJSR SU
Bが命令が実行されると、この命令はサブルーチン(S
UB)を呼出す命令なので、別に設けられたスタック領
域5のスタックポインタSP1“0000”の示す場所
にサブルーチンの戻り先番地のデータを積み、スタック
ポインタSP1を“0001”とする。このように、ハ
ードウェア上のデータとソフトウェア上のデータを操作
する命令が交互に続く場合でも、スタックを機能別に分
けているため、変数の受け渡しがスムースになる。
Next, the third step, JSR SU
When B executes the instruction, this instruction executes the subroutine (S
Since it is an instruction to call UB), the data of the return address of the subroutine is loaded in the location indicated by the stack pointer SP1 "0000" of the separately provided stack area 5, and the stack pointer SP1 is set to "0001". In this way, even when the instructions for manipulating the data on the hardware and the data on the software continue alternately, the stack is divided according to the functions, so that the variables can be passed smoothly.

【0012】なお、この実施例では、スタックを2つに
分けた例について説明したが、機能別に分けるスタック
の数及びスタックポインタの数は2つに限らず、さらに
増やすことも可能である。
In this embodiment, an example in which the stack is divided into two has been described, but the number of stacks and the number of stack pointers divided by function are not limited to two, and can be further increased.

【0013】[0013]

【発明の効果】以上のように、この発明によれば、メモ
リ上の第1のスタック領域のデータ格納場所を示す第1
のマイクロポインタと、メモリ上の第2のスタック領域
のデータ格納場所を示す第2のマイクロポインタとを有
するため、変数の受け渡しが容易にできるようになるた
め、サブルーチンの構造化,モジュール化が進み、ま
た、Cコンパイラを使用しての関数呼出し部分のコンパ
イラ結果におけるオブジェクトコードが、従来に比べ小
さくなる効果がある。
As described above, according to the present invention, the first stack area indicating the data storage location of the first stack area on the memory is displayed.
, And the second micropointer indicating the data storage location of the second stack area on the memory, it becomes possible to easily pass and receive variables, so that the subroutine is structured and modularized. Also, the object code in the compiler result of the function calling portion using the C compiler is smaller than the conventional one.

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

【図1】この発明の一実施例におけるスタック領域及び
スタックポインタを示す図である。
FIG. 1 is a diagram showing a stack area and a stack pointer according to an embodiment of the present invention.

【図2】従来の技術の一例におけるスタック領域及びス
タックポインタを示す図である。
FIG. 2 is a diagram showing a stack area and a stack pointer in an example of a conventional technique.

【符号の説明】[Explanation of symbols]

4,5 スタック領域 SP1,SP2 スタックポインタ 4,5 Stack area SP1, SP2 Stack pointer

─────────────────────────────────────────────────────
─────────────────────────────────────────────────── ───

【手続補正書】[Procedure amendment]

【提出日】平成4年6月4日[Submission date] June 4, 1992

【手続補正1】[Procedure Amendment 1]

【補正対象書類名】明細書[Document name to be amended] Statement

【補正対象項目名】0004[Correction target item name] 0004

【補正方法】変更[Correction method] Change

【補正内容】[Correction content]

【0004】[0004]

【発明が解決しようとする課題】従来のマイクロコンピ
ュータでは、スタックポインタの示すスタック領域にデ
ータが積まれていくので、呼出されたサブルーチン内で
変数α,βの値を使用ようとすると、現在のスタック
ポインタから、変数α,βのデータが格納されている番
地を計算によって求めなければならないという問題点が
っあた。このため、変数の受け渡しが容易ではなく、ま
たCコンバイラを使用しての、関数呼出し部分のコンパ
イラ結果のオブジェクトコードが大きくなる問題点もあ
った。
In THE INVENTION Problems to be Solved by conventional microcomputer, the data in the stack area indicated by the stack pointer is gradually piled, variable α in the called subroutine, if you try to use the value of beta, now There is a problem that the address where the data of variables α and β are stored must be calculated from the stack pointer of. For this reason, there is a problem in that it is not easy to pass variables, and the object code of the compiler result of the function calling portion using the C combiner becomes large.

Claims (1)

【特許請求の範囲】 【請求項1】 メモリ上のスタック領域を第1のスタッ
ク領域と第2のスタック領域とに分け、第1のスタック
領域におけるサブルーチンの戻り先等のハードウェア上
で使用されるデータが格納されている場所を示す第1の
スタックポインタと、第2のスタック領域における引き
数等のソフトウェア上で使用されるデータが格納されて
いる場所を示す第2のスタックポインタとを有すること
を特徴とするマイクロコンピュータ。
Claim: What is claimed is: 1. A stack area on a memory is divided into a first stack area and a second stack area, and is used on hardware such as a return destination of a subroutine in the first stack area. A first stack pointer indicating the location where the data to be stored is stored, and a second stack pointer indicating the location where the data such as an argument in the second stack area used in software is stored. A microcomputer characterized in that.
JP3207631A 1991-07-24 1991-07-24 Microcomputer Pending JPH0527975A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP3207631A JPH0527975A (en) 1991-07-24 1991-07-24 Microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP3207631A JPH0527975A (en) 1991-07-24 1991-07-24 Microcomputer

Publications (1)

Publication Number Publication Date
JPH0527975A true JPH0527975A (en) 1993-02-05

Family

ID=16542996

Family Applications (1)

Application Number Title Priority Date Filing Date
JP3207631A Pending JPH0527975A (en) 1991-07-24 1991-07-24 Microcomputer

Country Status (1)

Country Link
JP (1) JPH0527975A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5511993A (en) * 1993-08-25 1996-04-30 Yazaki Corporation Connector shield wire connection structure
US6568967B2 (en) 2000-07-06 2003-05-27 Yazaki Corporation Protective cover
US7787479B2 (en) * 2005-04-28 2010-08-31 Fujitsu Ten Limited Gateway apparatus and routing method

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5511993A (en) * 1993-08-25 1996-04-30 Yazaki Corporation Connector shield wire connection structure
US6568967B2 (en) 2000-07-06 2003-05-27 Yazaki Corporation Protective cover
US7787479B2 (en) * 2005-04-28 2010-08-31 Fujitsu Ten Limited Gateway apparatus and routing method

Similar Documents

Publication Publication Date Title
EP0087978B1 (en) Information processing unit
EP0538817B1 (en) High-speed processor capable of handling multiple interrupts
US4410939A (en) System for program interrupt processing with quasi-stack of register-sets
US5375238A (en) Nesting management mechanism for use in loop control system
JP2883784B2 (en) Microcomputer
US6138210A (en) Multi-stack memory architecture
US4942524A (en) Software trap system which saves previous content of software trap handling pointer in a stack upon execution of a trap
US4128878A (en) System for excuting a program-call instruction in a computer
JPH0527975A (en) Microcomputer
US6058457A (en) Method for storing method frames in multiple stacks
EP0240108A2 (en) A data processing system
US6067602A (en) Multi-stack-caching memory architecture
US5640548A (en) Method and apparatus for unstacking registers in a data processing system
US6092152A (en) Method for stack-caching method frames
JPS62151940A (en) Register saving/return system
US5765148A (en) Database processing apparatus and database processing method for variable length objects, and computer-readable memory medium for storing database processing program
JP3539984B2 (en) Processor
EP0401745A2 (en) Data processor for high-speed access to stack area data
JPS6353650A (en) Computer
JPS61216035A (en) Method for processing overflow of address stack
JPS58197548A (en) Stack control system
JPH064319A (en) Shared routine control system in operating system
JPH05274144A (en) Information processor
JPH0262633A (en) Inter-program communication system
JPH04344532A (en) Central processing unit