JPS61221943A - Arithmetic processor - Google Patents

Arithmetic processor

Info

Publication number
JPS61221943A
JPS61221943A JP60061934A JP6193485A JPS61221943A JP S61221943 A JPS61221943 A JP S61221943A JP 60061934 A JP60061934 A JP 60061934A JP 6193485 A JP6193485 A JP 6193485A JP S61221943 A JPS61221943 A JP S61221943A
Authority
JP
Japan
Prior art keywords
instruction
program counter
program
contents
address
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
JP60061934A
Other languages
Japanese (ja)
Inventor
Noboru Tamura
昇 田村
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.)
Canon Inc
Original Assignee
Canon Inc
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 Canon Inc filed Critical Canon Inc
Priority to JP60061934A priority Critical patent/JPS61221943A/en
Publication of JPS61221943A publication Critical patent/JPS61221943A/en
Pending legal-status Critical Current

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

PURPOSE:To grasp easily the executing state of a program and to simplify both debugging and tracing jobs by using a register which saves and stores temporarily the contents of a program counter. CONSTITUTION:The contents of a program saving register (SPC)a12a are first set to an SPCb12b. Then the contents of a program counter (PC)5 are set to a memory address register (MAR)8 as well as to the SPCa12a. The value of the (PC)5 is increased by one and the contents of an address shown by the PC5 are read out and set to an instruction register 6 to be decoded by an instruc tion decoder 6. Then a read-out job if required for the instruction of the next memory address is carried out. When all instruction codes necessary for execu tion of the instruction are read out, the prescribed instruction processing is executed.

Description

【発明の詳細な説明】 E産業上の利用分野」 本発明は直前のプログラムカウンタの値を保持する手段
を備え1例えば実行ブロクラムのトレースを容易とした
演算処理装置に関するものである。
DETAILED DESCRIPTION OF THE INVENTION Field of Industrial Application The present invention relates to an arithmetic processing device that is provided with means for holding the value of the immediately preceding program counter and that facilitates tracing of, for example, executed blocks.

L開示の概要」 本明細書及び図面はプログラムに従い処理を実行する演
算処理装置において、プログラムカウンタの内容を一時
的に待避格納させる手段を有することにより、プログラ
ムカウンタが更新される時に、現プログラムカウンタの
内容を前記格納手段に待避し、その後プログラムカウン
タを更新することにより、現プログラムカウンタの値と
、直前のプログラムカウンタの値と確認可能とする技術
を開示するものである。
Summary of the Disclosure" This specification and the drawings describe an arithmetic processing unit that executes processing according to a program, which includes means for temporarily saving and storing the contents of a program counter, so that when the program counter is updated, the current program counter The present invention discloses a technique that allows the current program counter value to be checked against the immediately previous program counter value by saving the contents of the program counter in the storage means and then updating the program counter.

L従来の技術」 従来、一般に利用されている演算処理装置(以下、cp
uと称す)にはプログラムカウンタ(以下、PCと称す
)が1つ具備されているのみである。このためプログラ
ムのデパック時点でプログラムのトレースを行う様な場
合、プログラム列の次に行なうべき命令のアドレスは分
るが、1つ前に実行された命令のアドレス、つまり現在
のアドレス(現在のPCの偵)となる前のPCの個が分
からなかった。
``Conventional technology'' Conventionally, commonly used arithmetic processing units
The PC (hereinafter referred to as PC) is equipped with only one program counter (hereinafter referred to as PC). Therefore, when tracing a program at the time of program depacking, the address of the next instruction to be executed in the program sequence can be found, but the address of the previously executed instruction, that is, the current address (current PC I didn't know the number of PCs before becoming a detective.

[発明が解決しようとする問題点] WI3図に示すプログラム列を実行させる場合を例とし
て説明する。
[Problems to be Solved by the Invention] A case where the program sequence shown in FIG. WI3 is executed will be explained as an example.

第3図jt”100”番地にrJMP  JIJ命令、
”200”番地にrJMP  JIJ命令がある例であ
る。ここでジャンプ先のJl”が″′300″′番地で
ある場合に、’300”番地にジャンプして米た時を考
えると、この時のPCの値はL300Jとなっているが
、ここで、どこから(どのアドレスから)この”300
′″番地にジャンプしたのかは全く判らず、“100′
″番地よりか、又は“200”番地よりのジャンプ(分
岐)命令に従って“300′″番地にジャンプして米た
のか、又はプログラムミス等によりそれ以外の番地の命
令の実行により“300″番地に未たのかが判定できず
、プログラムのテバツク処理、トレース処理に多大の労
力と時間を要することとなっていた。
Figure 3: rJMP JIJ command at jt "100" address,
In this example, there is an rJMP JIJ instruction at address "200". Here, if the jump destination Jl" is address "300"', and if we consider when we jump to address '300', the PC value at this time is L300J, but here , from where (from which address) this "300
I have no idea whether it jumped to address ``100''.
``, or jump to address ``300'' following a jump (branch) instruction from address ``200,'' or jump to address ``300'' due to a programming error, etc. by executing an instruction at another address. It is not possible to determine whether the program has been deleted, and it takes a great deal of effort and time to back up and trace the program.

〔問題点を解決するための手段] 本発明は上述の問題点を以下の構成により解決している
[Means for Solving the Problems] The present invention solves the above-mentioned problems with the following configuration.

即ちプログラムカウンタの値を保持する保持手段と、前
記プログラムカウンタの更新前に該プログラムカウンタ
の値を読み出し、前記保持手段に格納するカウンタ(I
I待避手段とを備え演算処理装置により達成できる。
That is, a holding means for holding the value of a program counter, and a counter (I) that reads the value of the program counter and stores it in the holding means before updating the program counter.
This can be achieved by an arithmetic processing device equipped with I saving means.

E作用1 記憶手段より実行手順を順次読み田し、演算処理等を行
なうプログラムカウンタが更新される時に、プログラム
カウンタの内容を自動的に格納手段に待避し、その後、
プログラムカウンタを更新することにより、現プログラ
ムカウンタ偵と、直前のプログラムカウンタ値とが確認
可能となり、プログラムの実行状態が容易に把握するこ
とができ、プログラムのデパック、トレース等の簡略化
が可能となる。
E-effect 1 The execution procedure is sequentially read from the storage means, and when the program counter that performs arithmetic processing etc. is updated, the contents of the program counter are automatically saved to the storage means, and then,
By updating the program counter, it is possible to check the current program counter value and the previous program counter value, making it easier to understand the program execution status and simplifying program depacking, tracing, etc. Become.

[実施例」 以下、図面を参照して本発明の一実施例を説明する。[Example" Hereinafter, one embodiment of the present invention will be described with reference to the drawings.

第1図は本発明に係る一実施例であり、図中2は1術論
理演算器、4は制御回路である。制御回路4は各種タイ
ミング制御を行っているが、このタイミング制御はハー
ドウェア(論理回路)で構成しても、又マイクロプログ
ラミング構成としてもよい、マイクロプログラミング構
成とすることにより、各種の処理目的に容易に対応する
ことが田米る。また、5は命令の記憶位置を記憶するプ
ログラムカウンタ(以下PCと称す)、6は命令レジス
タ、7は命令レジスタ6の命令の解析を行なう命令デコ
ーダ、8はメモリアドレスレジスタ(以下MARと称す
)、9はメモリデータレジスタ(以下MDRと称す)、
10は内部バスである。また12a、bはプログラムカ
ウンタ待避用レジスタ(以下SPCと称す)a、b、1
3はメモリ制御回路、14はメモリ、20は汎用レジス
タであり、プログラム命令により自由に読み書き可能で
ある。
FIG. 1 shows an embodiment of the present invention, in which numeral 2 represents an arithmetic logic operation unit and numeral 4 represents a control circuit. The control circuit 4 performs various timing controls, and this timing control may be configured with hardware (logic circuits) or may be configured with a microprogramming configuration. Tamiru can easily respond. Further, 5 is a program counter (hereinafter referred to as PC) that stores the storage location of instructions, 6 is an instruction register, 7 is an instruction decoder that analyzes the instructions in instruction register 6, and 8 is a memory address register (hereinafter referred to as MAR). , 9 is a memory data register (hereinafter referred to as MDR);
10 is an internal bus. Further, 12a and 12b are program counter save registers (hereinafter referred to as SPC) a, b, 1
3 is a memory control circuit, 14 is a memory, and 20 is a general-purpose register, which can be freely read and written by program instructions.

以下、第1図に示す本実施例装置の動作を第4図のフロ
ーチャートを参照して説明する。
The operation of the apparatus of this embodiment shown in FIG. 1 will be explained below with reference to the flowchart shown in FIG. 4.

まずステップS1で5PCa12aの内容の内部バス1
0に出力し、5PCb12bにこの内容をセットする。
First, in step S1, the internal bus 1 of the contents of 5PCa12a is
0 and set this content to 5PCb12b.

そして続くステップS2で命令の読み出しを行うべくま
ずPO2の内容を内部バスlOに出力する−0そして続
くステップS3で、内部バス10に出力されているPO
2の内容をMAR8にセットする。このMAR8にセッ
トされた値はメモリ14の読み…しアドレスとなる。
Then, in the following step S2, the contents of PO2 are first outputted to the internal bus 10 in order to read the command.
Set the contents of 2 to MAR8. The value set in this MAR8 becomes the read address of the memory 14.

またステップS4で同様に内部バスlOに出力されてい
るPO2の内容が5PCa12aにセットされる。この
ステップS3とステップS4は同時に実行することがで
きる。その後ステップS5でPO2のイーを1つインク
リメントし、ステップS7でffIIJ11回路4はメ
モリ制御回路13にプログラムの読出しを指示する。
Further, in step S4, the contents of PO2, which are similarly output to the internal bus IO, are set to 5PCa12a. Step S3 and step S4 can be executed simultaneously. Thereafter, in step S5, E of PO2 is incremented by one, and in step S7, the ffIIJ11 circuit 4 instructs the memory control circuit 13 to read the program.

PO2の内容が“100”であったとすると、メモリ1
4中の“100”番地の内容を読み出す処理を実行する
。”100″番地の内容が読み出されMDR9にセット
されると、ステップS6でこの命令を命令レジスタ6に
セットし、セットした命令を命令デコーダ7で解読する
。ステップS8でその解読の結果、命令の実行のために
は次のメモリ番地の命令を読出す必要があるか(1つの
命令を全て読み出したか)否かを判別する。この場合に
は“100″番地が1語命令でなく、2語命令、又はそ
れ以上の多語命令である場合にはステップS1に戻り、
統< ” i o i ”番地の命令コードの読…し処
理を実行する。
If the content of PO2 is “100”, memory 1
The process of reading out the contents of address "100" in 4 is executed. When the contents of the address "100" are read and set in the MDR 9, this instruction is set in the instruction register 6 in step S6, and the set instruction is decoded by the instruction decoder 7. In step S8, as a result of the decoding, it is determined whether or not it is necessary to read the instruction at the next memory address in order to execute the instruction (one instruction has all been read). In this case, if the address "100" is not a one-word instruction but a two-word instruction or a multi-word instruction, the process returns to step S1;
Executes the reading process of the instruction code at address ``i o i''.

ステップS8で命令め実行に必要な全ての命令コードの
読出しが終了している時は、続くステップS9で所定の
命令処理を実行する。
When all the instruction codes necessary for executing the instruction have been read out in step S8, predetermined instruction processing is executed in the subsequent step S9.

$3図のプログラムを実行する場合を具体例として以上
の処理を説明すると、今、プログラムの実行が進行して
きて、“#100”番地より格納されているrJMP 
 J IJ命令を実行する場合にはPO2には“100
 ”が格納されている。ここで5PCa12aの内容を
5PCb12bに移し、メモリ14の″100′′番地
の命令を読み出すべくpcsの内容(100)を内部バ
ス10に出力し、MDA8にセットする。同時にこの個
を5PCa12aにもセットする。
$3 To explain the above process using the case of executing the program shown in the figure as a specific example, the execution of the program is now progressing, and the rJMP file stored from address "#100"
When executing the JIJ instruction, “100” is set in PO2.
" is stored there. The contents of 5PCa 12a are transferred to 5PCb 12b, and in order to read the instruction at address "100'' of memory 14, the contents of pcs (100) are output to internal bus 10 and set in MDA8. At the same time, this item is also set to 5PCa12a.

これにより5PCa12aには’too″がセットされ
たことになる。そしてPO2の値を1つインクリメント
し、読み出した命令の実行を行う、ここではジャンプ命
令であるため、分岐先のJ1即ち“300 ”をPO2
に格納する。そして“300”番地の処理を実行する。
As a result, 'too' is set in 5PCa12a. Then, the value of PO2 is incremented by one, and the read instruction is executed. Since this is a jump instruction, the branch destination J1, that is, "300" PO2
Store in. Then, the process for address "300" is executed.

即ち、5PCb12bに5PCa12aの値” 100
 ”をセットし、5PCa12aに300”をセットし
、その語命令処理を実行することになる。
That is, the value of 5PCa12a for 5PCb12b is 100.
", 300" is set in 5PCa12a, and the word command processing is executed.

従って、プログラムデパック時であって、“300”番
地にブレークポイントを設定した様な場合においても、
ブレーク先における5PCa、b(12a、12b)に
はブレークポイントのアドレスが5PCa12aに、ま
た5pcb12bにはブレークポイントの処理を実行す
る前のアドレス″100″がセットされていることにな
る。
Therefore, even if you set a breakpoint at address "300" when depacking a program,
The breakpoint address is set to 5PCa12a in 5PCa,b (12a, 12b) at the break destination, and the address "100" before executing breakpoint processing is set in 5pcb12b.

このためデパックにおいてブレークポイントに何処から
きたかを容易に知ることが出来る。
For this reason, you can easily know where the breakpoint came from in Depack.

また以上の説明ではブレークポイントよりブレークした
時に、ブレーク先で5PCa12aの内容を変更してし
まう例について説明したが、ここで5PCa12aの内
容が変更されない場合にはSPCは1つでよく、上述の
ステップS1の処理も不必要となる。
Also, in the above explanation, when a break is made from a breakpoint, the contents of 5PCa12a are changed at the break destination. However, if the contents of 5PCa12a are not changed here, only one SPC is required, and the steps described above The processing in S1 is also unnecessary.

E他の実施例] 又1以上の説明では必ずPO2の内容を5PC12に格
納する例を説明したが、この処理は必ず必要とされるも
のではなく、プログラムが完成した場合には必要ない場
合の方が大部分である。このため、プログラム命令によ
り、任意にこの処理を実行するか否かを設定することが
できることが望ましい。
E.Other Examples] Also, in the above explanation, an example was explained in which the contents of PO2 are always stored in the 5PC12, but this processing is not always required, and if the program is completed, it may not be necessary. The majority are. Therefore, it is desirable to be able to arbitrarily set whether or not to execute this process using a program instruction.

このプログラム命令により、任意にこの処理を実行する
か否かを設定することができる演算処理装置を第4図に
示す0図中第1図と同一構成には同一番号を付した。
FIG. 4 shows an arithmetic processing unit that can arbitrarily set whether or not to execute this process based on the program command. Components in FIG. 0 that are the same as those in FIG.

図中21はSPCセットモードレジスタであり、SPC
セット命令によりセットされ、SPCリセット命令によ
りリセットされる。このSPCセットモードレジスタ2
1の状態は制御回路4に入力され、制御回路4はこのS
PCセットモードレジスタ21がセットされている場合
には上述のI82@に示す処理を実行し、spcセット
モードレジスタ21がセットされていない場合には第2
図の処理のうちのステップSl、ステップS4゜の処理
を実行しない。
21 in the figure is the SPC set mode register,
It is set by a set command and reset by an SPC reset command. This SPC set mode register 2
The state of S1 is input to the control circuit 4, and the control circuit 4
If the PC set mode register 21 is set, the process shown in I82@ above is executed, and if the spc set mode register 21 is not set, the second
Of the processes in the figure, steps Sl and S4 are not executed.

またこの時5PCa、、b (tza、12b) への
入力はANDゲート22a、22bにより阻止されてい
る。
Further, at this time, input to 5PCa, , b (tza, 12b) is blocked by AND gates 22a and 22b.

E発明の効果J 以上説明したように本発明によれば、プログラムを順次
読み田すためのプログラムカウンタが更新される時に、
プログラムカウンタの内容を自動的に格納手段に待避し
、その後、プログラムカウンタを更新することにより、
現プログラムカウンタ値と、直前のプログラムカウンタ
値とが確認可能となり、プログラムの実行状態が容易に
把握することができ、プログラムのデパック、トレース
等の簡略化が可能となる。
E Effects of the Invention J As explained above, according to the present invention, when the program counter for sequentially reading programs is updated,
By automatically saving the contents of the program counter to a storage means and then updating the program counter,
The current program counter value and the previous program counter value can be checked, the execution state of the program can be easily grasped, and program depacking, tracing, etc. can be simplified.

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

@1rRJは本発明の一実施例演算処理装置の機能ブロ
ック図、 第2図は本実施例の命令実行フローチャート、第3図は
実行プログラムの例を示す図。 第4図は本発明の他の実施例演算処理装置の機能ブロッ
ク図であるφ 図中、2・・・算術論理演算器、4・・・制御回路、5
・・・プログラムカウンタ、6・・・命令レジスタ、7
・・・命令デコーダ、8・・・メモリアドレスレジスタ
、9・・・メモリデータレジスタ、12a、b・・・プ
ログラムカウンタ待避用レジスタ、13・・・メモリ制
御回路、14・・・メモリ、20・・・汎用レジスタ、
21・・・SPCセットモードレジスタ、22・・・A
NDゲートである。 第2図
@1rRJ is a functional block diagram of an arithmetic processing device according to an embodiment of the present invention, FIG. 2 is an instruction execution flowchart of the embodiment, and FIG. 3 is a diagram showing an example of an execution program. FIG. 4 is a functional block diagram of an arithmetic processing device according to another embodiment of the present invention. In the figure, 2... arithmetic logic unit, 4... control circuit, 5
...Program counter, 6...Instruction register, 7
... Instruction decoder, 8... Memory address register, 9... Memory data register, 12a, b... Program counter save register, 13... Memory control circuit, 14... Memory, 20.・General-purpose register,
21...SPC set mode register, 22...A
It is an ND gate. Figure 2

Claims (2)

【特許請求の範囲】[Claims] (1)プログラムカウンタの値を保持する保持手段と、
前記プログラムカウンタの更新前に該プログラムカウン
タの値を読み出し、前記保持手段に格納するカウンタ値
待避手段とを備え、プログラムカウンタが更新される時
に、プログラムカウンタの内容を前記格納手段に待避し
、その後、プログラムカウンタを更新することにより、
現プログラムカウンタ値と、直前のプログラムカウンタ
値とを確認可能とすることを特徴とする演算処理装置。
(1) Holding means for holding the value of the program counter;
counter value saving means for reading the value of the program counter before updating the program counter and storing it in the holding means; saving the contents of the program counter in the storing means when the program counter is updated; , by updating the program counter,
An arithmetic processing device characterized in that it is possible to check a current program counter value and a previous program counter value.
(2)更に格納手段を付勢するか否かを選択する選択手
段を備えたことを特徴とする特許請求の範囲第1項記載
の演算処理装置。
(2) The arithmetic processing device according to claim 1, further comprising selection means for selecting whether or not to energize the storage means.
JP60061934A 1985-03-28 1985-03-28 Arithmetic processor Pending JPS61221943A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP60061934A JPS61221943A (en) 1985-03-28 1985-03-28 Arithmetic processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP60061934A JPS61221943A (en) 1985-03-28 1985-03-28 Arithmetic processor

Publications (1)

Publication Number Publication Date
JPS61221943A true JPS61221943A (en) 1986-10-02

Family

ID=13185501

Family Applications (1)

Application Number Title Priority Date Filing Date
JP60061934A Pending JPS61221943A (en) 1985-03-28 1985-03-28 Arithmetic processor

Country Status (1)

Country Link
JP (1) JPS61221943A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6358548A (en) * 1986-08-28 1988-03-14 Nec Corp Microprocessor for debug

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS53114639A (en) * 1977-03-17 1978-10-06 Fujitsu Ltd Information precessing unit provided with program trace function
JPS5635252A (en) * 1979-08-29 1981-04-07 Casio Comput Co Ltd Detecting system for program branch address

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS53114639A (en) * 1977-03-17 1978-10-06 Fujitsu Ltd Information precessing unit provided with program trace function
JPS5635252A (en) * 1979-08-29 1981-04-07 Casio Comput Co Ltd Detecting system for program branch address

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS6358548A (en) * 1986-08-28 1988-03-14 Nec Corp Microprocessor for debug

Similar Documents

Publication Publication Date Title
JPS645330B2 (en)
JPS61221943A (en) Arithmetic processor
JPS63214804A (en) Processor for plc and plc
JPH02135545A (en) Execution control processing system for debugger
JPS61229137A (en) Arithmetic processing unit
JPS63249206A (en) Programmable controller
JP2562838B2 (en) Processor and store buffer control method
JPS60124746A (en) Data processing unit
JPS6242301B2 (en)
JPS5842891B2 (en) Meirei Seigiyohoushiki
JPS60193046A (en) Detecting system for instruction exception
JPH04367902A (en) Programmable controller
JPS623345A (en) Interruption system
JPS5835648A (en) Program execution controlling system
JP3012618B1 (en) Debugging method of inspected program and its debugging method
JPH04342037A (en) Operand checking system for program
JPH0756637B2 (en) Processor
JPH05342037A (en) Microcomputer for program development
JPH0259829A (en) Microcomputer
JPH02125303A (en) Programmable controller
JPS63163543A (en) Information processor
JPH01253045A (en) Logical analyzing circuit
JPH03164945A (en) Data processor
JPS59206955A (en) Debugging method
JPH02263243A (en) Runaway processor for computer