JPH07105019A - Instruction simulator processing system - Google Patents

Instruction simulator processing system

Info

Publication number
JPH07105019A
JPH07105019A JP5251261A JP25126193A JPH07105019A JP H07105019 A JPH07105019 A JP H07105019A JP 5251261 A JP5251261 A JP 5251261A JP 25126193 A JP25126193 A JP 25126193A JP H07105019 A JPH07105019 A JP H07105019A
Authority
JP
Japan
Prior art keywords
stack
instruction
unit
value
input
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
JP5251261A
Other languages
Japanese (ja)
Inventor
Yoshiro Harada
佳郎 原田
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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP5251261A priority Critical patent/JPH07105019A/en
Publication of JPH07105019A publication Critical patent/JPH07105019A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PURPOSE:To provide an instruction simulator processing system which can be executed even when a stack overflows. CONSTITUTION:A simulator 101 is provided with the input part 106 of indication information on a console 102, the file input part 104 of program information on an input file 103, an instruction input part 116 reading program information from a program memory part 108, a data memory part 109 including a stack memory part 110, a register memory part 112, an instruction execution part 118 executing an instruction by the instruction analysis result of an instruction analysis part 117, a comparison part 123 comparing and collating the value of a stack pointer part 115 with/to the value of a stack regulation part 122, a switching part 124 switching a stack operation destination by the compared result of the comparison part 123, a control part 107 controlling the file input part 104, the instruction input part 116, the instruction analysis part 117, the instruction execution part 118 and the stack regulation part 122, and the output part 105 of control result by the control part 107.

Description

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

【0001】[0001]

【産業上の利用分野】本発明は命令シミュレータ処理方
式に関し、特にマイクロコンピュータ用プログラムのシ
ミュレーション方法として用いられる命令シミュレータ
処理方式に関する。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to an instruction simulator processing method, and more particularly to an instruction simulator processing method used as a simulation method of a microcomputer program.

【0002】[0002]

【従来の技術】一般的に、どのようなプログラムにおい
ても、そのプログラムの命令シミュレーション中にはス
タック操作命令が実行されている。そして、そのスタッ
ク操作が幾重にも行われると、それに対応して、当該ス
タックは順次スタック領域に積まれてゆく。プログラマ
は、このスタック操作が最大幾重になるかを考慮して、
そのためのスタック領域を確保することが必要となる。
このスタック領域の直ぐ近くの領域までも、データ領域
として用いているプログラムの場合には、もしもスタッ
ク領域が正しく確保されずに不十分である場合には、当
該スタック領域を越えてデータ領域にまでもスタックが
積まれる状態となり、これにより、やがてはプログラム
が暴走する事態になる可能性がある。
2. Description of the Related Art Generally, in any program, a stack operation instruction is executed during instruction simulation of the program. Then, if the stack operation is repeated many times, the stack is sequentially stacked in the stack area correspondingly. The programmer considers how much this stack operation can stack up to,
It is necessary to secure a stack area for that purpose.
In the case of a program that is used as a data area even in the area immediately near this stack area, if the stack area is not secured properly and is insufficient, it extends beyond the stack area to the data area. Also becomes a state where the stack is piled up, which may eventually cause the program to run out of control.

【0003】従来の命令シミュレータ処理方式において
は、命令シミュレーション中にスタック・オーバーフロ
ーになったか否かをチェックするために、予めスタック
・アドレスの下限値がスタックの規定値として入力され
ており、命令シミュレーション中にスタック操作命令が
実行される度に、スタック・ポインタがその規定値を下
回るか否かがチェックされて、当該規定値を下回ってい
る場合には警告メッセージが出力されるのが通例であ
る。しかしながら、警告メッセージを出すことはできる
ものの、一旦プログラムが暴走状態になると、それ以降
においては、正しくシミュレーションを継続して実行す
ることは不可能な状態となる。
In the conventional instruction simulator processing method, in order to check whether or not a stack overflow has occurred during instruction simulation, the lower limit value of the stack address is input in advance as a prescribed value of the stack. Each time a stack manipulation instruction is executed, it is checked whether the stack pointer is below the specified value, and if it is below the specified value, a warning message is usually output. . However, although the warning message can be issued, once the program goes into a runaway state, it becomes impossible to correctly continue and execute the simulation thereafter.

【0004】なお、「仮想記憶管理システム及び計算機
システム(特開平3−113550号公報)」において
は、スタック・オーバーフローによるエラー発生の回避
方法として、伸縮可能な仮想空間が提案されているが、
当該提案はOSなどのセルフ系のコンピュータのスタッ
ク処理に関する内容であり、従って、プログラム・メモ
リおよびスタック・メモリを含むデータ・メモリおよび
レジスタ・メモリが全て同じ一つのアドレス空間上の実
アドレスにマッピングされたマイクロコンピュータのプ
ログラムをシミュレーションによりデバッグする場合に
は、全てのメモリに対して、プログラム通りのアドレス
に対応するアドレス空間上においてデバッグする必要が
あり、シミュレーション上において各メモリを仮想空間
に割り当ててデバッグすることが許されないために、上
記の「仮想記憶管理システム及び計算機システム(特開
平3−113550号)」による提案は、この命令シミ
ュレータ処理方式には適用することは不可能である。
In the "virtual memory management system and computer system (Japanese Patent Laid-Open No. 3-113550)", an expandable virtual space is proposed as a method for avoiding an error occurrence due to stack overflow.
The proposal relates to stack processing of a self-system computer such as an OS, and therefore, data memory and register memory including program memory and stack memory are all mapped to the same real address on the same address space. When debugging a microcomputer program by simulation, it is necessary to debug all the memory in the address space corresponding to the address as programmed, and in the simulation, allocate each memory to the virtual space for debugging. Therefore, the proposal by the above "virtual memory management system and computer system (JP-A-3-113550)" cannot be applied to this instruction simulator processing method.

【0005】[0005]

【発明が解決しようとする課題】上述した従来の命令シ
ミュレータ処理方式においては、スタック・オーバーフ
ローになったか否かをチェックして、スタック・ポイン
タが所定の規定値を下回っている場合には、警告メッセ
ージを出すことはできるものの、一旦プログラムが暴走
すると、それ以降においては、正しくシミュレーション
を継続して実行することは不可能である。このために、
プログラムは、スタック・サイズの変更またはデータ領
域の割付け変更などを含むプログラムの再設計、プログ
ラムの修正およびアセンブラ・コンパイラ等によるオブ
ジェクト・ファイルの再作成を行って、再度シミュレー
ションを行うこととなり、このために、多くの時間が余
分に必要になるという欠点がある。
In the above-described conventional instruction simulator processing method, it is checked whether or not a stack overflow has occurred, and if the stack pointer is below a prescribed value, a warning is issued. Although a message can be issued, once the program runs out of control, it is impossible to continue and correctly execute the simulation thereafter. For this,
The program will be redesigned, including changes in the stack size or data area allocation, etc., the program will be modified, and the object file will be recreated by the assembler compiler, etc. The disadvantage is that it requires a lot of time.

【0006】[0006]

【課題を解決するための手段】本発明の命令シミュレー
タ処理方式は、命令解析手段、命令実行手段、プログラ
ムメモリ手段、データメモリ手段およびレジスタメモリ
手段を有するマイクロコンピュータの命令シミュレータ
処理方式において、所定のコンソールよりの指示情報を
入力する入力手段と、所定の入力ファイルよりプログラ
ム情報を入力して、前記プログラムメモリ手段に収納す
るファイル入力手段と、前記入力手段を介して前記コン
ソールより入力される指示情報を介して、所定のスタッ
ク規定値が設定されるスタック規定手段と、前記プログ
ラムメモリ手段よりプログラム情報を読み出して、前記
命令解析手段に出力する命令入力手段と、前記命令解析
手段による命令解析結果により、前記命令実行手段を介
して前記レジスタメモリ手段に設定された値と、前記ス
タック規定手段に設定されている値とを比較する比較手
段と、前記比較手段による比較結果を参照して、前記レ
ジスタメモリ手段に設定された値をそれぞれ識別して出
力する切替手段と、前記切替手段より識別されて出力さ
れる値をそれぞれ区分して収納するスタックメモリ手段
ならびに予備スタックメモリ手段と、をシミュレータと
して少なくとも備えて構成され、スタックが前記スタッ
ク規定値をオーバーしたことが検出される場合には、前
記予備スタックメモリ手段が、データメモリ中の前記ス
タックメモリ手段の延長として機能し、シミュレータの
実行を阻害することなく、正常にシミュレーション処理
を行うことを特徴としている。
The instruction simulator processing method of the present invention is a predetermined instruction simulator processing method for a microcomputer having an instruction analyzing means, an instruction executing means, a program memory means, a data memory means and a register memory means. Input means for inputting instruction information from the console, file input means for inputting program information from a predetermined input file and storing it in the program memory means, and instruction information input from the console via the input means A stack defining means for setting a predetermined stack defining value, an instruction inputting means for reading program information from the program memory means and outputting the program information to the instruction analyzing means, and an instruction analyzing result by the instruction analyzing means. , The register via the instruction executing means The value set in the memory unit is compared with the value set in the stack defining unit, and the value set in the register memory unit is identified by referring to the comparison result by the comparing unit. And a stack memory means and a spare stack memory means for separately storing the values identified and output by the switching means, and the stack is defined by the stack definition means. When it is detected that the value is exceeded, the spare stack memory means functions as an extension of the stack memory means in the data memory, and the simulation processing is normally performed without hindering the execution of the simulator. Is characterized by.

【0007】[0007]

【実施例】次に、本発明について図面を参照して説明す
る。
DESCRIPTION OF THE PREFERRED EMBODIMENTS Next, the present invention will be described with reference to the drawings.

【0008】図1は本発明の一実施例のシステム構成図
である。図1に示されるように、本実施例は、シミュレ
ータ101と、コンソール102と、入力ファイル10
3とを備えて構成されており、上記の主たる構成要素の
シミュレータ101は、コンソール102より起動指示
情報を入力する入力部106と、入力ファイル103よ
りプログラム情報を入力するファイル入力部104と、
入力されるプログラム情報を保持するプログラムメモリ
部108と、プログラムメモリ部108よりプログラム
情報を読み出す命令入力部116と、読み出されたプロ
グラム情報を受けて命令解析する命令解析部117と、
スタックメモリ部110を含むデータメモリ部109
と、BCレジスタ部113、HLレジスタ部114およ
びスタックポインタ部115を含むレジスタメモリ部1
12と、データメモリ部109を操作するデータ操作命
令実行部119、スタックメモリ部110を操作するス
タック操作命令実行部120およびレジスタメモリ部1
12を操作するレジスタ操作命令部121を含み、前記
命令解析部117の命令解析結果による命令を実行する
命令実行部118と、スタック規定部122と、スタッ
クポインタ部115の値とスタック規定部122の値と
を比較照合する比較部123と、比較部123の比較結
果によりスタック操作先を切替える切替部124と、予
備スタックメモリ部111と、入力部106の指示によ
り、ファイル入力部104、命令入力部116、命令解
析部117、命令実行部118およびスタック規定部1
22を制御する制御部107と、当該制御部107によ
る制御結果をコンソール102に出力する出力部105
とを備えて構成される。
FIG. 1 is a system configuration diagram of an embodiment of the present invention. As shown in FIG. 1, the present embodiment has a simulator 101, a console 102, and an input file 10.
3, the simulator 101, which is a main component described above, has an input unit 106 for inputting start instruction information from a console 102, a file input unit 104 for inputting program information from an input file 103,
A program memory unit 108 that holds the input program information, an instruction input unit 116 that reads the program information from the program memory unit 108, an instruction analysis unit 117 that receives the read program information and analyzes the instruction.
Data memory unit 109 including stack memory unit 110
And a register memory unit 1 including a BC register unit 113, an HL register unit 114, and a stack pointer unit 115.
12, a data operation instruction execution unit 119 that operates the data memory unit 109, a stack operation instruction execution unit 120 that operates the stack memory unit 110, and a register memory unit 1
12 including a register operation instruction unit 121 for operating 12, an instruction execution unit 118 that executes an instruction according to the instruction analysis result of the instruction analysis unit 117, a stack definition unit 122, a value of the stack pointer unit 115, and a stack definition unit 122. A comparing unit 123 that compares and collates values, a switching unit 124 that switches the stack operation destination according to the comparison result of the comparing unit 123, a spare stack memory unit 111, and a file input unit 104 and an instruction input unit according to an instruction from the input unit 106 116, instruction analysis unit 117, instruction execution unit 118, and stack definition unit 1
22 and an output unit 105 that outputs the control result of the control unit 107 to the console 102.
And is configured.

【0009】図2は、利用者により作成された入力ファ
イル103のsampleアセンブラソースイメージの
プログラム情報の一部であり、その情報内容は下記のと
うりである。
FIG. 2 shows a part of the program information of the sample assembler source image of the input file 103 created by the user, and the information content is as follows.

【0010】201:スタックポインタ(SP)の値を
F000Hにする。
201: The value of the stack pointer (SP) is set to F000H.

【0011】202:BCレジスタの値を1234Hに
する。
202: The value of the BC register is set to 1234H.

【0012】203:HLレジスタの値を5678Hに
する。
203: The value of the HL register is set to 5678H.

【0013】204:BCレジスタの内容をスタックに
積む。
204: Pushes the contents of the BC register onto the stack.

【0014】205:HLレジスタの内容をスタックに
積む。
205: Pushes the contents of the HL register onto the stack.

【0015】206:スタックからラッチしてBCレジ
スタに入力する。
206: Latch from stack and input to BC register.

【0016】207:スタックからラッチしてHLレジ
スタに入力する。
207: Latch from the stack and input to the HL register.

【0017】図2において、このプログラムが、図2に
示される201の命令より207の命令まで正しくシミ
ュレートされると、一つのPUSH命令により二つのス
タックが積まれるものとすると、スタックポインタ部1
15の値は一時的に最大EFFCHの値まで小さくなっ
て、再びF000Hの値となり、BCレジスタ部113
には5678Hの値が入力され、またHLレジスタ部1
14には1234Hの値が入力されることになる。
In FIG. 2, if this program is correctly simulated from the instruction 201 to the instruction 207 shown in FIG. 2, two stacks are stacked by one PUSH instruction.
The value of 15 temporarily decreases to the value of the maximum EFFCH and becomes the value of F000H again, and the BC register unit 113
The value of 5678H is input to the HL register unit 1
The value of 1234H is input to 14.

【0018】図3は、利用者によるコソール102に対
する操作手順情報を示しており、その情報内容は下記の
とうりである。
FIG. 3 shows operation procedure information on the console 102 by the user, and the information content is as follows.

【0019】301:図2のプログラムをシミュレータ
に読み込む指示を示す。
301: Shows an instruction to read the program of FIG. 2 into the simulator.

【0020】302:スタックアドレスの下限値として
のスタック規定値を、EFFEHにする指示を示す。
302: Indicates an instruction to set the stack specified value as the lower limit value of the stack address to EFFEH.

【0021】303:プログラム実行指示を示す。303: Shows a program execution instruction.

【0022】利用者により、まずコンソール102に対
してプログラムロード指示入力が行われる(301)。
入力部106および制御部107による制御作用によ
り、プログラム情報(図2参照)が格納されている入力
ファイル103より、ファイル入力部104を介して当
該プログラム情報がプログラムメモリ部108に入力さ
れる。次いで、コンソール102に対して、スタックア
ドレスの下限値としてスタック規定値EFFEHの設定
指示が行われ(302)、入力部106により制御部1
07に対し実行が指示される。そして、次に、コンソー
ル102に対してプログラム実行の指示が行われる(3
03)。
First, the user inputs a program load instruction to the console 102 (301).
By the control action of the input unit 106 and the control unit 107, the program information is input to the program memory unit 108 from the input file 103 in which the program information (see FIG. 2) is stored, via the file input unit 104. Next, an instruction to set the stack specified value EFFEH as the lower limit value of the stack address is issued to the console 102 (302), and the input unit 106 controls the control unit 1.
The execution is instructed to 07. Then, next, a program execution instruction is issued to the console 102 (3
03).

【0023】これを受けて、入力部106により制御部
107に対してプログラムの実行が指示され、制御部1
07による制御作用により、プログラム実行の先頭の一
つ目の命令201(図2参照)がプログラムメモリ部1
08より読み出されて、命令入力部116を介して命令
解析部117に入力される。命令解析部117において
は、当該命令内容が解析され、その解析結果は、レジス
タ操作命令実行部121を介してレジスタメモリ部11
2に含まれるスタックポインタ部115に入力されて、
当該スタックポインタ部115にF000Hが設定され
る。続いて、制御部107による制御作用により、命令
202(図2参照)がプログラムメモリ部108より読
み出されて、命令入力部116を介して命令解析部11
7に入力される。命令解析部117においては、当該命
令内容が解析され、その解析結果は、レジスタ操作命令
実行部121を介してレジスタメモリ部112に含まれ
るBCレジスタ部113に入力されて、当該BCレジス
タ部113に1234Hが設定される。
In response to this, the input unit 106 instructs the control unit 107 to execute the program, and the control unit 1
Due to the control action by 07, the first instruction 201 (see FIG. 2) at the beginning of program execution causes the program memory unit 1 to
It is read out from 08 and inputted to the instruction analysis section 117 via the instruction input section 116. The instruction analysis unit 117 analyzes the content of the instruction, and the analysis result is stored in the register memory unit 11 via the register operation instruction execution unit 121.
2 is input to the stack pointer unit 115 included in
F000H is set in the stack pointer section 115. Subsequently, the instruction 202 (see FIG. 2) is read from the program memory unit 108 by the control action of the control unit 107, and the instruction analysis unit 11 is executed via the instruction input unit 116.
Input to 7. In the instruction analysis unit 117, the content of the instruction is analyzed, and the analysis result is input to the BC register unit 113 included in the register memory unit 112 via the register operation instruction execution unit 121, and then to the BC register unit 113. 1234H is set.

【0024】同様にして、制御部107による制御作用
により、命令203(図2参照)がプログラムメモリ部
108より読み出されて、命令入力部116を介して命
令解析部117に入力される。命令解析部117におい
ては、当該命令内容が解析され、その解析結果は、レジ
スタ操作命令実行部121を介してレジスタメモリ部1
12に含まれるHLレジスタ部114に入力されて、当
該HLレジスタ部114に5678Hが設定される。次
いで、制御部107による制御作用により、命令204
(図2参照)がプログラムメモリ部108より読み出さ
れて、命令入力部116を介して命令解析部117に入
力される。命令解析部117においては、当該命令内容
が解析され、その解析結果は、レジスタ操作命令実行部
121を介して、レジスタメモリ部112に含まれるB
Cレジスタ部113に設定された値1234Hが読み出
されて、スタック操作命令実行部120に入力される。
スタック操作命令実行部120においては、まず、当該
値の上位値12Hが分離されて切替部124に送られ
る。この際、スタックポインタ部115におけるF00
0Hの値は、スタック規定部122の値EFFEHより
も大きいので、切替部124を介して前記12Hの値は
スタックメモリ部110にスタックとして積まれる。ま
た、スタックポインタ部115に設定された値は、デク
リメントされてEFFFHとなる。次いで、更にスタッ
ク操作命令実行部120においては、当該値の下位値3
4Hが分離されて切替部124に送られるが、スタック
ポインタ部115における前記EFFFHの値は、スタ
ック規定部122の値EFFEHよりも大きいので、切
替部124を介して前記34Hの値はスタックメモリ部
110にスタックとして積まれる。また、スタックポイ
ンタ部115に設定された値は、デクリメントされてE
FFEHとなる。
Similarly, the instruction 203 (see FIG. 2) is read from the program memory unit 108 by the control operation of the control unit 107 and input to the instruction analysis unit 117 via the instruction input unit 116. The instruction analysis unit 117 analyzes the content of the instruction, and the analysis result is stored in the register memory unit 1 via the register operation instruction execution unit 121.
It is input to the HL register unit 114 included in 12, and 5678H is set in the HL register unit 114. Next, the control unit 107 controls the command 204.
(See FIG. 2) is read from the program memory unit 108 and input to the instruction analysis unit 117 via the instruction input unit 116. The instruction analysis unit 117 analyzes the content of the instruction, and the analysis result is stored in the register memory unit 112 via the register operation instruction execution unit 121.
The value 1234H set in the C register unit 113 is read and input to the stack operation instruction execution unit 120.
In the stack operation instruction execution unit 120, first, the upper value 12H of the value is separated and sent to the switching unit 124. At this time, F00 in the stack pointer unit 115
Since the value of 0H is larger than the value EFFEH of the stack defining unit 122, the value of 12H is stacked as a stack in the stack memory unit 110 via the switching unit 124. Further, the value set in the stack pointer section 115 is decremented to EFFFH. Next, in the stack operation instruction execution unit 120, the lower value 3 of the value is further calculated.
4H is separated and sent to the switching unit 124, but since the value of EFFFH in the stack pointer unit 115 is larger than the value EFFEH of the stack defining unit 122, the value of 34H is passed through the switching unit 124. Stacked at 110. Further, the value set in the stack pointer unit 115 is decremented by E.
It becomes FFEH.

【0025】続いて、制御部107による制御作用によ
り、命令205(図2参照)がプログラムメモリ部10
8より読み出されて、命令入力部116を介して命令解
析部117に入力される。命令解析部117において
は、当該命令内容が解析され、その解析結果は、レジス
タ操作命令実行部121を介してレジスタメモリ部11
2に含まれるHLレジスタ部114に入力され、当該H
Lレジスタ部114の値5678Hが読み出されて、ス
タック操作命令実行部120に送られる。スタック操作
命令実行部120においては、まず、当該値の上位値5
6Hが分離されて切替部124に送られる。この際、ス
タックポインタ部115におけるEFFFHの値は、ス
タック規定部122の値EFFEHよりも大きくないの
で、切替部124を介して前記56Hの値は予備スタッ
クメモリ部111にスタックとして積まれる。また、ス
タックポインタ部115の値は、デクリメントされてE
FFDHとなる。次いで、更にスタック操作命令実行部
120においては、当該値の下位値78Hが切替部12
4に送られるが、スタックポインタ部115における前
記EFFDHの値は、スタック規定部122の値EFF
EHよりも大きくないので、切替部124を介して前記
78Hの値は予備スタックメモリ部111にスタックと
して積まれる。また、スタックポインタ部115の値
は、デクリメントされてEFFCHとなる。
Next, the instruction 205 (see FIG. 2) causes the program memory unit 10 to execute the instruction 205 under the control action of the control unit 107.
8 and is input to the instruction analysis unit 117 via the instruction input unit 116. The instruction analysis unit 117 analyzes the content of the instruction, and the analysis result is stored in the register memory unit 11 via the register operation instruction execution unit 121.
2 is input to the HL register unit 114 included in
The value 5678H of the L register unit 114 is read and sent to the stack operation instruction execution unit 120. In the stack operation instruction execution unit 120, first, the upper value 5 of the value is
6H is separated and sent to the switching unit 124. At this time, the value of EFFFH in the stack pointer unit 115 is not larger than the value EFFEH of the stack defining unit 122, so the value of 56H is stacked as a stack in the spare stack memory unit 111 via the switching unit 124. Further, the value of the stack pointer section 115 is decremented by E.
It becomes FFDH. Next, in the stack operation instruction execution unit 120, the lower value 78H of the value is changed to the switching unit 12.
4, the value of the EFFDH in the stack pointer unit 115 is the value EFF of the stack defining unit 122.
Since it is not larger than EH, the value of 78H is stacked as a stack in the preliminary stack memory unit 111 via the switching unit 124. Further, the value of the stack pointer section 115 is decremented to EFFCH.

【0026】続いて、制御部107による制御作用によ
り、命令206(図2参照)がプログラムメモリ部10
8より読み出されて、命令入力部116を介して命令解
析部117に入力される。命令解析部117において
は、当該命令内容が解析され、スタック操作命令実行部
120により、切替部124に対する二つの値のラッチ
作用が行われる。この際、スタックポインタ部115の
値はインクリメントされてEFFDHとなるが、この値
は、スタック規定部122の値EFFEHよりも大きく
ないので、切替部124を介して予備スタックメモリ部
111よりスタックが読み出されて、一つ目の値78H
が下位値として命令実行部118に送られる。そして、
更に、スタックポインタ部115の値はインクリメント
されてEFFEHとなり、この値は、スタック規定部1
22の値EFFEHよりも大きくないので、切替部12
4を介して予備スタックメモリ部111よりスタックが
読み出されて、二つ目の値56Hが上位値として命令実
行部118に送られる。命令実行部118においては、
得られた値5678Hはレジスタ操作命令実行部121
に伝達され、レジスタ操作命令実行部121を介して、
BCレジスタ部113に設定される。
Subsequently, the control function of the control unit 107 causes the instruction 206 (see FIG. 2) to be executed by the program memory unit 10.
8 and is input to the instruction analysis unit 117 via the instruction input unit 116. The instruction analysis unit 117 analyzes the content of the instruction, and the stack operation instruction execution unit 120 causes the switching unit 124 to latch two values. At this time, the value of the stack pointer unit 115 is incremented to EFFDH, but since this value is not larger than the value EFFEH of the stack defining unit 122, the stack is read from the standby stack memory unit 111 via the switching unit 124. Issued, the first value 78H
Is sent to the instruction execution unit 118 as a lower value. And
Further, the value of the stack pointer section 115 is incremented to EFFEH, and this value is equal to the stack definition section 1
Since it is not larger than the value EFFEH of 22, the switching unit 12
The stack is read from the backup stack memory unit 111 via 4 and the second value 56H is sent to the instruction execution unit 118 as an upper value. In the instruction execution unit 118,
The obtained value 5678H is the register operation instruction execution unit 121.
Is transmitted to the register operation instruction execution unit 121,
It is set in the BC register unit 113.

【0027】続いて、制御部107による制御作用によ
り、命令207(図2参照)がプログラムメモリ部10
8より読み出されて、命令入力部116を介して命令解
析部117に入力される。命令解析部117において
は、当該命令内容が解析され、スタック操作命令実行部
120により、切替部124に対する二つの値のラッチ
作用が行われる。この際、スタックポインタ部115の
値はインクリメントされてEFFFHとなるが、この値
は、スタック規定部122の値EFFEHよりも大きい
ので、切替部124を介してスタックメモリ部110よ
りスタックが読み出されて、一つ目の値34Hが下位値
として命令実行部118に送られる。そして、更に、ス
タックポインタ部115の値はインクリメントされてE
000Hとなり、この値は、スタック規定部122の値
EFFEHよりも大きいので、切替部124を介してス
タックメモリ部110よりスタックが読み出されて、二
つ目の値12Hが上位値として命令実行部118に送ら
れる。命令実行部118においては、得られた値123
4Hはレジスタ操作命令実行部121に伝達され、レジ
スタ操作命令実行部121を介して、HLレジスタ部1
14に設定される。
Then, the control action of the control unit 107 causes the instruction 207 (see FIG. 2) to be executed by the program memory unit 10.
8 and is input to the instruction analysis unit 117 via the instruction input unit 116. The instruction analysis unit 117 analyzes the content of the instruction, and the stack operation instruction execution unit 120 causes the switching unit 124 to latch two values. At this time, the value of the stack pointer unit 115 is incremented to EFFFH. Since this value is larger than the value EFFEH of the stack defining unit 122, the stack is read from the stack memory unit 110 via the switching unit 124. Then, the first value 34H is sent to the instruction execution unit 118 as a lower value. Then, the value of the stack pointer section 115 is further incremented by E.
000H, which is larger than the value EFFEH of the stack defining unit 122, the stack is read from the stack memory unit 110 via the switching unit 124, and the second value 12H is used as the upper value of the instruction executing unit. Sent to 118. In the instruction execution unit 118, the obtained value 123
4H is transmitted to the register operation instruction execution unit 121, and the HL register unit 1 is transmitted via the register operation instruction execution unit 121.
It is set to 14.

【0028】次に、スタック操作命令実行部121よ
り、切替部124に対して値Xを送出する場合の切替部
124における処理工程、即ちPUSH処理の内容につ
いて、図4のフローチャートを参照して説明する。
Next, the processing steps in the switching unit 124 when the value X is sent from the stack operation instruction execution unit 121 to the switching unit 124, that is, the contents of the PUSH processing will be described with reference to the flowchart of FIG. To do.

【0029】まず、ステップ401においては、スタッ
クポインタ(SP)の値とスタック規定値とが比較さ
れ、スタックポインタの値の方が大きい場合には、ステ
ップ402に進み、逆にスタックポインタの値の方が大
きくない場合には、ステップ403に移行する。ステッ
プ402においては、スタックメモリ部110に値Xが
積まれて、ステップ404に進む。他方ステップ403
においては、予備スタックメモリ部111に値Xが積ま
れて、ステップ404に進む。これらのステップ402
およびステップ403に続いて、ステップ404におい
ては、スタックポインタがデクリメントされて(SP−
1)、本処理工程は終了する。
First, in step 401, the value of the stack pointer (SP) is compared with the specified stack value. If the value of the stack pointer is larger, the process proceeds to step 402 and conversely the value of the stack pointer is changed. If it is not larger, the process proceeds to step 403. In step 402, the stack memory unit 110 is loaded with the value X, and the process proceeds to step 404. On the other hand, step 403
In, the value X is stored in the spare stack memory unit 111, and the process proceeds to step 404. These steps 402
Then, in step 404 following step 403, the stack pointer is decremented (SP-
1), this processing step ends.

【0030】次に、スタック操作命令実行部120によ
り、切替部124に対して値Xをラッチする場合の切替
部124における処理工程、即ちPOP処理の内容につ
いて、図5のフローチャートを参照して説明する。
Next, the processing steps in the switching unit 124 when the stack operation instruction executing unit 120 latches the value X to the switching unit 124, that is, the contents of the POP processing will be described with reference to the flowchart of FIG. To do.

【0031】まず、ステップ501においては、スタッ
クポインタがインクリメントされ、ステップ502にお
いて、スタックポインタ(SP)の値とスタック規定値
とが比較され、スタックポインタの値の方が大きい場合
には、ステップ503に進み、逆にスタックポインタの
値の方が大きくない場合には、ステップ504に移行す
る。ステップ503においては、スタックメモリ部11
0より値Xが読み出されて本処理工程は終了する。他方
ステップ504においては、予備スタックメモリ部11
1より値Xが読み出されて、本処理工程は終了する。
First, in step 501, the stack pointer is incremented, and in step 502, the value of the stack pointer (SP) is compared with the stack prescribed value. If the value of the stack pointer is larger, step 503. If the stack pointer value is not larger, the process proceeds to step 504. In step 503, the stack memory unit 11
The value X is read from 0, and this processing step ends. On the other hand, in step 504, the spare stack memory unit 11
The value X is read from 1, and this processing step ends.

【0032】次に、本発明の第2の実施例として、図3
に示される指示手順情報に基づいて図2のプログラム情
報が入力されると、コンソール102に予備スタックメ
モリ使用メッセージが出力されるシミュレータの場合に
ついて、図6のPUSH処理のフローチャートを参照し
て説明する。
Next, as a second embodiment of the present invention, FIG.
2 is input based on the instruction procedure information shown in FIG. 2, a case where a spare stack memory use message is output to the console 102 will be described with reference to the flowchart of PUSH processing in FIG. .

【0033】まず、ステップ601においては、スタッ
クポインタ(SP)の値とスタック規定値とが比較さ
れ、スタックポインタの値の方が大きい場合には、ステ
ップ602に進み、逆にスタックポインタの値の方が大
きくない場合には、ステップ603に移行する。ステッ
プ602においては、スタックメモリ部110に値Xが
積まれ、ステップ605に進む。他方ステップ603に
おいては、予備スタックメモリ部111に値Xが積まれ
てステップ604に進む。ステップ604においては、
制御部107に対して、予備スタックメモリ部111使
用のメッセージを出すようにとの指示が行われ、出力部
105により、当該メッセージがコンソール102に出
力されて、ステップ605に移行する。これらのステッ
プ602およびステップ604に続いて、ステップ60
5においては、スタックポインタがデクリメントされて
(SP−1)、本処理工程は終了する。
First, in step 601, the value of the stack pointer (SP) is compared with the specified stack value. If the value of the stack pointer is larger, the process proceeds to step 602 and conversely the stack pointer value If it is not larger, the process proceeds to step 603. In step 602, the stack memory unit 110 is loaded with the value X, and the process proceeds to step 605. On the other hand, in step 603, the value X is stored in the spare stack memory unit 111, and the process proceeds to step 604. In step 604,
The control unit 107 is instructed to output a message to use the spare stack memory unit 111, the output unit 105 outputs the message to the console 102, and the process proceeds to step 605. Following these steps 602 and 604, step 60
In 5, the stack pointer is decremented (SP-1), and this processing step ends.

【0034】[0034]

【発明の効果】以上説明したように、本発明は、スタッ
クが規定値をオーバーしたことが検出されると、予備の
スタックメモリをデータメモリ中のスタックメモリの延
長として使用することにより、シミュレータの実行を停
止させることなく、正しくシミュレーション処理を行う
ことが可能となり、スタックのオーバーフローに起因す
るバグによるシミュレーション作業のやり直しを排除す
ることができるという効果がある。
As described above, according to the present invention, when it is detected that the stack exceeds the specified value, the spare stack memory is used as an extension of the stack memory in the data memory. It is possible to correctly perform the simulation processing without stopping the execution, and it is possible to eliminate the redo of the simulation work due to the bug caused by the stack overflow.

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

【図1】本発明の一実施例のシステム構成図である。FIG. 1 is a system configuration diagram of an embodiment of the present invention.

【図2】入力ファイルのプログラム情報を示す図であ
る。
FIG. 2 is a diagram showing program information of an input file.

【図3】コンソールに入力する指示手順情報を示す図で
ある。
FIG. 3 is a diagram showing instruction procedure information input to a console.

【図4】第1の実施例におけるPUSH処理のフローチ
ャートを示す図である。
FIG. 4 is a diagram showing a flowchart of PUSH processing in the first embodiment.

【図5】第1の実施例におけるPOP処理のフローチャ
ートを示す図である。
FIG. 5 is a diagram showing a flowchart of POP processing in the first embodiment.

【図6】第2の実施例におけるPUSH処理のフローチ
ャートを示す図である。
FIG. 6 is a diagram showing a flowchart of PUSH processing in the second embodiment.

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

101 シミュレータ 102 コンソール 103 入力コンソール 104 ファイル入力部 105 出力部 106 入力部 107 制御部 108 プログラムメモリ部 109 データメモリ部 110 スタックメモリ部 111 予備スタックメモリ部 112 レジスタメモリ部 113 BCレジスタ部 114 HLレジスタ部 115 スタックポインタ部 116 命令実行部 117 命令解析部 118 命令実行部 119 データ操作命令実行部 120 スタック操作命令実行部 121 レジスタ操作命令実行部 122 スタック規定部 123 比較部 124 切替部 101 simulator 102 console 103 input console 104 file input unit 105 output unit 106 input unit 107 control unit 108 program memory unit 109 data memory unit 110 stack memory unit 111 spare stack memory unit 112 register memory unit 113 BC register unit 114 HL register unit 115 Stack pointer unit 116 Instruction execution unit 117 Instruction analysis unit 118 Instruction execution unit 119 Data manipulation instruction execution unit 120 Stack manipulation instruction execution unit 121 Register manipulation instruction execution unit 122 Stack definition unit 123 Comparison unit 124 Switching unit

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】 命令解析手段、命令実行手段、プログラ
ムメモリ手段、データメモリ手段およびレジスタメモリ
手段を有するマイクロコンピュータの命令シミュレータ
処理方式において、 所定のコンソールよりの指示情報を入力する入力手段
と、 所定の入力ファイルよりプログラム情報を入力して、前
記プログラムメモリ手段に収納するファイル入力手段
と、 前記入力手段を介して前記コンソールより入力される指
示情報を介して、所定のスタック規定値が設定されるス
タック規定手段と、 前記プログラムメモリ手段よりプログラム情報を読み出
して、前記命令解析手段に出力する命令入力手段と、 前記命令解析手段による命令解析結果により、前記命令
実行手段を介して前記レジスタメモリ手段に設定された
値と、前記スタック規定手段に設定されている値とを比
較する比較手段と、 前記比較手段による比較結果を参照して、前記レジスタ
メモリ手段に設定された値をそれぞれ識別して出力する
切替手段と、 前記切替手段より識別されて出力される値をそれぞれ区
分して収納するスタックメモリ手段ならびに予備スタッ
クメモリ手段と、 をシミュレータとして少なくとも備えて構成され、スタ
ックが前記スタック規定値をオーバーしたことが検出さ
れる場合には、前記予備スタックメモリ手段が、データ
メモリ中の前記スタックメモリ手段の延長として機能
し、シミュレータの実行を阻害することなく、正常にシ
ミュレーション処理を行うことを特徴とする命令シミュ
レータ処理方式。
1. An instruction simulator processing method for a microcomputer having an instruction analyzing means, an instruction executing means, a program memory means, a data memory means and a register memory means, and input means for inputting instruction information from a predetermined console, and a predetermined means. A predetermined stack prescribed value is set through file input means for inputting program information from the input file of the above and storing it in the program memory means, and instruction information input from the console through the input means. A stack defining means, an instruction input means for reading out program information from the program memory means and outputting the program information to the instruction analyzing means, and an instruction analysis result by the instruction analyzing means to cause the register memory means via the instruction executing means. The set value and the stack defining means Comparing means for comparing the set value with each other; switching means for identifying and outputting the value set in the register memory means by referring to the comparison result by the comparing means; A stack memory means and a spare stack memory means for separately storing the values output by the above, as a simulator, and when it is detected that the stack exceeds the stack specified value, An instruction simulator processing method, wherein the auxiliary stack memory means functions as an extension of the stack memory means in the data memory, and normally performs the simulation processing without hindering the execution of the simulator.
JP5251261A 1993-10-07 1993-10-07 Instruction simulator processing system Pending JPH07105019A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5251261A JPH07105019A (en) 1993-10-07 1993-10-07 Instruction simulator processing system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5251261A JPH07105019A (en) 1993-10-07 1993-10-07 Instruction simulator processing system

Publications (1)

Publication Number Publication Date
JPH07105019A true JPH07105019A (en) 1995-04-21

Family

ID=17220154

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5251261A Pending JPH07105019A (en) 1993-10-07 1993-10-07 Instruction simulator processing system

Country Status (1)

Country Link
JP (1) JPH07105019A (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02239329A (en) * 1989-03-14 1990-09-21 Toshiba Corp Stack managing system
JPH05250221A (en) * 1992-03-10 1993-09-28 Nec Corp Simulator execution system

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH02239329A (en) * 1989-03-14 1990-09-21 Toshiba Corp Stack managing system
JPH05250221A (en) * 1992-03-10 1993-09-28 Nec Corp Simulator execution system

Similar Documents

Publication Publication Date Title
JP2883784B2 (en) Microcomputer
JPS60136833A (en) Operating system switching method
US5826078A (en) Job re-execution system and controlling method thereof
US6502176B1 (en) Computer system and methods for loading and modifying a control program without stopping the computer system using reserve areas
JPH07105019A (en) Instruction simulator processing system
JP2765549B2 (en) Operation evaluation system in computer system
JP2001117791A (en) Interruption instruction checker and recording medium
JPS635780B2 (en)
JP2513142B2 (en) Program simulator device
JPH05101109A (en) Data base arithmetic processing unit
US11947408B2 (en) Anomaly detection method, anomaly detection recording medium, anomaly detection device, rewriting method, and rewriting device
JP3263999B2 (en) Program content analyzer
JP2008234058A (en) Saved data discrimination method, saved data discrimination program, and saved data discrimination device
JPS62276634A (en) Virtual computer system
JPS63211033A (en) Job control system for rerun
WO1990005951A1 (en) Method of handling unintended software interrupt exceptions
JP3039450B2 (en) Stack area switching method and method, and storage medium storing stack area switching program
JPS61235925A (en) Operating system for electronic computer system
JPH0337201B2 (en)
RU2393530C2 (en) Method for formation of dump file
JPH01185729A (en) Overlay structure program execution system
JPS61278942A (en) Data managing device
JPS5842487B2 (en) Program loading method
JPS6275734A (en) Emulation method
JPH05189211A (en) Information processing system

Legal Events

Date Code Title Description
A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 19960917