JP4382833B2 - Processor - Google Patents
Processor Download PDFInfo
- Publication number
- JP4382833B2 JP4382833B2 JP2007112789A JP2007112789A JP4382833B2 JP 4382833 B2 JP4382833 B2 JP 4382833B2 JP 2007112789 A JP2007112789 A JP 2007112789A JP 2007112789 A JP2007112789 A JP 2007112789A JP 4382833 B2 JP4382833 B2 JP 4382833B2
- Authority
- JP
- Japan
- Prior art keywords
- unit
- instruction
- state
- signal
- debug
- 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.)
- Active
Links
- 238000012545 processing Methods 0.000 claims description 355
- 230000004044 response Effects 0.000 claims description 79
- 238000000034 method Methods 0.000 claims description 38
- 230000008569 process Effects 0.000 claims description 37
- 230000007274 generation of a signal involved in cell-cell signaling Effects 0.000 claims description 13
- 238000003780 insertion Methods 0.000 claims description 12
- 230000037431 insertion Effects 0.000 claims description 12
- 230000000644 propagated effect Effects 0.000 claims description 11
- 238000001514 detection method Methods 0.000 claims description 7
- 230000001902 propagating effect Effects 0.000 claims description 2
- 230000007704 transition Effects 0.000 description 100
- 238000004458 analytical method Methods 0.000 description 25
- 230000006870 function Effects 0.000 description 15
- 230000003111 delayed effect Effects 0.000 description 14
- 238000010586 diagram Methods 0.000 description 9
- 230000008859 change Effects 0.000 description 8
- 238000003708 edge detection Methods 0.000 description 5
- 230000004048 modification Effects 0.000 description 5
- 238000012986 modification Methods 0.000 description 5
- 230000000873 masking effect Effects 0.000 description 3
- 230000001360 synchronised effect Effects 0.000 description 3
- 102100024452 DNA-directed RNA polymerase III subunit RPC1 Human genes 0.000 description 1
- 101000689002 Homo sapiens DNA-directed RNA polymerase III subunit RPC1 Proteins 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 230000000630 rising effect Effects 0.000 description 1
- 239000000725 suspension Substances 0.000 description 1
- 238000012795 verification Methods 0.000 description 1
Landscapes
- Advance Control (AREA)
- Debugging And Monitoring (AREA)
Description
本発明は、プログラムの実行を停止してその実行結果を検証するためのデバッグ機能を備えたプロセッサに係り、特に、デバッグ機能を備えたパイプライン方式のプロセッサに関するものである。 The present invention relates to a processor having a debugging function for stopping execution of a program and verifying the execution result, and more particularly to a pipeline processor having a debugging function.
マイクロコンピュータのプログラムのデバッグは、CPU(central
processing unit)による命令の実行を種々の条件で一時的に停止させて内部のレジスタの値などを調べることにより進められる。デバッグに関連するCPUの制御には、一般に専用のデバッグ回路(エミュレーション回路とも呼ばれる)が用いられる。
Microcomputer program debugging is done by CPU (central
The execution of the instruction by the processing unit) is temporarily stopped under various conditions and the value of the internal register is examined. In general, a dedicated debug circuit (also called an emulation circuit) is used for CPU control related to debugging.
下記の特許文献には、デバッグ回路を備えたプロセッサについての発明が記載されている。
デバッグ回路は、CPUによる命令の実行を停止する場合、まずCPU内部の命令レジスタに対する命令の供給を停止する。そして、通常は、この命令供給を停止してから一定のサイクルが経過した時点より、CPUの命令の実行が停止したものとしてその後の制御を行う。 When stopping execution of instructions by the CPU, the debug circuit first stops supplying instructions to the instruction register in the CPU. Usually, the CPU performs subsequent control on the assumption that the execution of the instruction of the CPU is stopped after a certain cycle has elapsed since the supply of the instruction is stopped.
ところが、パイプライン方式のCPUにおいては、命令の供給を停止しても、その停止以前に命令レジスタへ供給された命令については、プログラムのフローに従って順次に実行される。すなわち、命令レジスタへの命令の供給を停止した後であっても、CPUにおいて命令が実行される期間(以下、遷移期間という)が存在する。この遷移期間において、CPUの命令の実行が停止したものとしてデバッグ回路によるCPUの制御が行われると、次に述べるような種々の問題(パイプライン・ハザード)が生じる。 However, in the pipeline CPU, even if the supply of instructions is stopped, instructions supplied to the instruction register before the stop are sequentially executed according to the program flow. That is, even after the supply of the instruction to the instruction register is stopped, there is a period during which the instruction is executed in the CPU (hereinafter referred to as a transition period). In the transition period, if the CPU is controlled by the debug circuit on the assumption that the execution of the instruction of the CPU is stopped, various problems (pipeline hazard) described below occur.
例えば、デバッグ回路は、CPUに対する割り込み要求を受け付けると、そのときデバッグ用の所定のレジスタに格納されているデバッグに関する情報(CPUの停止原因となったイベントの情報など)を一時的にスタックへ保存する。そして、割り込みルーチンから復帰した際、スタックへ保存しておいた当該デバッグ用の情報を元のレジスタへ戻す。
ところが、デバッグ回路が上述の遷移期間において割り込み要求(CPUの停止時においても優先的に処理されるハードウェア制御などの割り込み要求)を受け付けてしまうと、当該割り込みに応じてデバッグ関連の情報をスタックへ保存した後で、パイプラインに残存する命令が新たな停止イベント(データやアドレスが所定の値と一致する場合に発生する停止イベントなど)を発生させてしまう場合がある。この場合、新たに発生した停止イベントは、割り込み要求を受け付ける前にCPUの命令レジスタへ供給された命令に由来するものであるにも係わらず、割り込みルーチン内でデバッグ用のレジスタを有効に書き換えてしまう。すなわち、割り込み要求より前に供給された命令に由来する停止イベントが、割り込みルーチン内で発生したかのようにレジスタの情報が書き換えられてしまうという問題が生じる。
For example, when receiving an interrupt request to the CPU, the debug circuit temporarily saves information related to debugging (such as information on an event that caused the CPU to stop) stored in a predetermined register for debugging to the stack. To do. When returning from the interrupt routine, the debugging information stored in the stack is returned to the original register.
However, if the debug circuit receives an interrupt request (interrupt request such as hardware control that is preferentially processed even when the CPU is stopped) during the transition period described above, the debug-related information is stacked according to the interrupt. In some cases, an instruction remaining in the pipeline after the data is stored in the pipeline may cause a new stop event (such as a stop event that occurs when data or an address matches a predetermined value). In this case, even though the newly generated stop event originates from the instruction supplied to the CPU instruction register before accepting the interrupt request, the debug register is effectively rewritten in the interrupt routine. End up. That is, there is a problem that the register information is rewritten as if a stop event derived from an instruction supplied before the interrupt request occurred in the interrupt routine.
本発明はかかる事情に鑑みてなされたものであり、その目的は、プログラムの実行を停止する際の遷移期間においてデバッグ動作が実行されることにより生じるパイプライン・ハザードを解消できるパイプライン方式のプロセッサを提供することにある。 The present invention has been made in view of such circumstances, and an object of the present invention is to provide a pipeline-type processor that can eliminate a pipeline hazard caused by executing a debugging operation during a transition period when program execution is stopped. Is to provide.
一連の命令をパイプライン方式にて順次に処理し、当該処理を停止する場合は、新たな命令の処理の開始を禁止するとともに、当該新たな命令の処理の開始を禁止したとき既に開始されていた未完了の処理が完了したか否かを示す状態信号を出力する命令処理部と、入力されるコマンドに応じて、少なくとも前記命令処理部の動作の制御又は当該動作の状態の記録に関連するデバッグ動作を実行するデバッグ部と、前記状態信号が未完了状態を示す期間に前記デバッグ部が前記デバッグ動作を実行しようとした場合、当該デバッグ動作を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留したデバッグ動作を実行させるデバッグ制限部とを有する。
上記プロセッサによれば、前記命令処理部においてパイプライン方式による命令の処理が停止される場合、新たな命令の処理が停止されるとともに、既に開始された処理が完了したか否かを示す状態信号が出力される。この状態信号が前記命令処理部における処理の未完了状態を示す場合、前記デバッグ部によるデバッグ動作の実行が前記デバッグ制限部により制限される。すなわち、前記命令処理部において新たな命令の処理を停止してから残りの命令の処理が完了するまでの間、前記命令処理部の動作の制御やその動作状態の記録に関連するデバッグ動作が制限される。
A series of instructions sequentially processed by pipelining, to stop the process, as well as prohibiting the start of the process of the new instruction, already started when the disables the start of the processing of the new instruction Tei A command processing unit that outputs a status signal indicating whether or not incomplete processing has been completed, and at least the control of the operation of the command processing unit or the recording of the status of the operation according to the input command and debugging unit for debugging operation, if the status signal is the debugger in the period indicated incomplete state attempts to execute the debugging operation, suspended without executing the debug operation, wherein the status signal is not selected And a debug restriction unit that executes the suspended debug operation after the change from the complete state to the complete state .
According to the processor, when the instruction processing by the pipeline method is stopped in the instruction processing unit, the processing of a new instruction is stopped and the status signal indicating whether the already started processing is completed or not Is output. When this status signal indicates an incomplete state of processing in the instruction processing unit, execution of a debugging operation by the debug unit is restricted by the debug restriction unit. That is, the debugging operation related to the control of the operation of the instruction processing unit and the recording of the operation state is limited after the processing of the new instruction is stopped in the instruction processing unit until the processing of the remaining instructions is completed. Is done.
好適に、前記デバッグ部は、入力されるコマンドに応じて、少なくとも、前記命令処理部がアクセス対象とする記憶部にアクセスする、又は、前記一連の命令の中へ更に命令を挿入するメモリアクセス部を有してよい。前記命令処理部は、一連の命令の処理を停止する場合、前記新たな命令の処理の開始を禁止したとき既に前記メモリアクセス部のアクセスに応じて開始されていた未完了の処理又は前記新たな命令の処理の開始を禁止したとき既に前記メモリアクセス部の前記命令の挿入に応じて開始されていた未完了の処理を含む前記既に開始されていた未完了の処理が完了したか否かを示す前記状態信号を出力してよい。 Preferably, the debug unit accesses at least a storage unit to be accessed by the instruction processing unit or inserts further instructions into the series of instructions according to an input command. May be included. It said instruction processing unit to stop processing the sequence of instructions, are already new in response to said access memory access section of the completion Not having been started process or when said prohibited the start of the process of the new instruction indicates whether already the insertion the already outstanding that were start processing includes processing uncompleted had been initiated in response to the instruction of the memory access unit is completed when the disables the start of processing of instructions The status signal may be output.
好適に、前記命令処理部は、入力される一連の命令をパイプライン方式にて実行する命令実行部と、前記命令実行部への命令の入力を制御する入力制御部と、前記入力制御部により前記命令実行部への命令の入力が停止されると所定の停止信号を発生する信号発生部と、前記信号発生部において発生した停止信号を初段に入力し、前記命令実行部における命令の実行段階の進行と同期して、当該入力した停止信号を順次に後段へ伝播する複数の遅延部を含んだ信号伝播部と、前記停止信号が前記信号伝播部を伝播しているか否か検知し、当該検知結果を前記状態信号として出力する状態信号出力部とを含んでよい。
上記の構成によれば、前記入力制御部によって前記命令実行部への命令の入力が停止されると、前記信号発生部において前記停止信号が発生する。当該発生した停止信号は、前記信号伝播部における前記複数の遅延部の初段に入力され、前記命令実行部における命令の実行段階の進行と同期して、後段の遅延部へ順次に伝播される。この信号伝播部において前記停止信号が伝播している間、前記状態信号出力部からは、前記命令実行部における命令の実行が完了していないことを示す前記状態信号が出力される。
前記信号伝播部は、例えば、前記命令実行部において一の命令を実行するための複数の段階に対応し、前記停止信号を伝搬する複数の遅延部と、前記複数の段階による命令の実行に付随した処理が実行され得る一定の期間において、前記複数の段階に対応する前記複数の遅延部により伝搬された前記停止信号を更に伝播する拡張遅延部とを含んでよい。
Preferably, the instruction processing unit includes an instruction execution unit that executes a series of input instructions in a pipeline manner, an input control unit that controls input of an instruction to the instruction execution unit, and the input control unit. A signal generation unit that generates a predetermined stop signal when input of an instruction to the instruction execution unit is stopped; In synchronization with the progression of the signal, a signal propagation unit including a plurality of delay units that sequentially propagate the input stop signal to the subsequent stage, and detecting whether the stop signal propagates through the signal propagation unit, A state signal output unit that outputs a detection result as the state signal.
According to the above configuration, when the input control unit stops the input of the instruction to the instruction execution unit, the signal generation unit generates the stop signal. The generated stop signal is input to the first stage of the plurality of delay units in the signal propagation unit, and is sequentially propagated to the subsequent delay unit in synchronization with the progress of the instruction execution stage in the instruction execution unit. While the stop signal is propagated in the signal propagation unit, the state signal output unit outputs the state signal indicating that the instruction execution in the instruction execution unit is not completed.
The signal propagation unit corresponds to, for example, a plurality of stages for executing one instruction in the instruction execution unit, and includes a plurality of delay units for propagating the stop signal, and an instruction execution by the plurality of stages An extended delay unit that further propagates the stop signal propagated by the plurality of delay units corresponding to the plurality of stages in a certain period during which the above-described processing can be performed.
また、前記命令処理部は、入力される一連の命令をパイプライン方式にて実行する命令実行部と、前記命令実行部への命令の入力を制御する入力制御部と、前記入力制御部により前記命令実行部への命令の入力が停止されると、所定の停止命令を前記命令実行部に供給する停止命令供給部と、前記命令実行部において前記所定の停止命令が実行中であるか否かを検知し、当該検知結果を前記状態信号として出力する状態信号出力部とを含んでもよい。
上記の構成によれば、前記入力制御部によって前記命令実行部への命令の入力が停止されると、前記停止命令供給部によって前記命令実行部に所定の停止命令が供給される。この所定の停止命令が前記命令実行部において実行されている間、前記状態信号出力部からは、前記命令実行部における命令の実行が完了していないことを示す前記状態信号が出力される。
The instruction processing unit includes: an instruction execution unit that executes a series of input instructions in a pipeline manner; an input control unit that controls input of an instruction to the instruction execution unit; and the input control unit When input of an instruction to the instruction execution unit is stopped, a stop instruction supply unit that supplies a predetermined stop instruction to the instruction execution unit, and whether or not the predetermined stop instruction is being executed in the instruction execution unit And a state signal output unit that outputs the detection result as the state signal.
According to the above configuration, when input of the instruction to the instruction execution unit is stopped by the input control unit, a predetermined stop instruction is supplied to the instruction execution unit by the stop instruction supply unit. While the predetermined stop instruction is being executed in the instruction execution unit, the state signal output unit outputs the state signal indicating that the instruction execution in the instruction execution unit is not completed.
好適に、前記デバッグ部は、命令の処理を停止しているときでも割り込み要求を受け付けるように前記命令処理部を制御可能であってよく、前記デバッグ制限部は、前記状態信号が未完了状態を示す期間に前記割り込み要求が発生した場合、前記デバッグ部の制御に応じた前記命令処理部における当該割り込み要求の受付を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留した割り込み要求の受付を実行させてよい。 Preferably, the debug unit may be able to control the instruction processing unit so as to accept an interrupt request even when instruction processing is stopped, and the debug limiting unit may indicate that the status signal is in an incomplete state. If the interrupt request occurs during the period shown, suspended without executing the acceptance of the interrupt request in the instruction processing unit according to the control of the debugger, the state signal is changed to the completion state of an uncompleted state Later, the pending interrupt request may be accepted.
好適に、前記デバッグ制限部は、前記状態信号が未完了状態を示す期間に前記メモリアクセス部が前記アクセス又は前記命令の挿入を実行しようとした場合、当該アクセス又は当該命令の挿入を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留したアクセス又は命令の挿入を実行させてよい。
更に、前記命令処理部は、命令の処理を停止しているときに前記メモリアクセス部による前記アクセス又は前記命令の挿入が生じた場合、当該アクセスに応じた処理が完了したか否か又は当該挿入した命令に応じた処理が完了したか否かを示す前記状態信号を出力してよい。前記デバッグ制限部は、前記状態信号が前記メモリアクセス部のアクセスに応じた処理の未完了又は前記挿入した命令に応じた処理の未完了を示す期間に前記割り込み要求が発生した場合、前記デバッグ部の制御に応じた前記命令処理部における当該割り込み要求の受付を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留した割り込み要求の受付を実行させてよい。
Preferably, said debug limiting unit, when the status signal is the memory access section to the period indicated incomplete state attempts to execute the insertion of the access or the instruction without executing the insertion of the access or the instruction And the insertion of the reserved access or instruction may be executed after the status signal changes from the incomplete status to the completed status.
Further, when the access or the instruction insertion by the memory access unit occurs when the instruction processing unit stops the instruction processing, whether or not the processing corresponding to the access is completed or the insertion The status signal indicating whether or not the processing according to the issued command is completed may be output. When the interrupt request is generated in a period in which the status signal indicates that the processing corresponding to the access of the memory access unit is not completed or the processing corresponding to the inserted instruction is not completed, the debugging unit wherein according to a control of pending without executing the acceptance of the interrupt request in the instruction processing unit, the status signal may be executed reception of the hold the interrupt request after changing to completion state from an uncompleted state.
好適に、前記デバッグ部は、前記命令処理部における命令の実行状態を示すステートマシンを有してよく、前記デバッグ制限部は、前記状態信号が未完了状態を示す期間に前記デバッグ部が前記ステートマシンのステートの更新を実行しようとした場合、当該ステートの更新を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留したステートの更新を実行させてよい。 Preferably, the debug unit may include a state machine that indicates an execution state of an instruction in the instruction processing unit, and the debug restriction unit is configured so that the debug unit is in the state during a period in which the state signal indicates an incomplete state. If you try to perform an update of the state of the machine, pending without executing the updating of the state, the status signal may then execute the pending the state updated after changes to the completion state of an uncompleted state.
好適に、前記デバッグ部は、前記命令処理部における処理の停止原因に関わる情報を記憶する記憶部を有してよく、前記デバッグ制限部は、前記状態信号が未完了状態を示す期間に前記デバッグ部が前記記憶部の記憶情報の更新を実行しようとした場合、当該記憶情報の更新を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留した記憶情報の更新を実行させてよい。 Preferably, the debug unit may include a storage unit that stores information related to a cause of stoppage of processing in the instruction processing unit, and the debug restriction unit may include the debug during a period in which the state signal indicates an incomplete state. If the part is trying to perform an update of the stored information of the storage unit, suspended without executing the updating of the stored information, said status signal of the hold the stored information after the change to the completion state of an uncompleted state An update may be performed.
好適に、前記デバッグ部は、前記デバッグ動作として、少なくとも前記命令処理部における処理の停止又は再開を制御してよく、前記デバッグ制限部は、前記状態信号が未完了状態を示す期間に前記デバッグ部が前記命令処理部における処理の停止又は再開を実行しようとした場合、当該処理の停止又は再開を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留した処理の停止又は再開を実行させてよい。 Preferably, the debugging unit may control at least stop or restart of processing in the instruction processing unit as the debugging operation, and the debug limiting unit may be configured to output the debugging unit during a period when the state signal indicates an incomplete state. process but if an attempt is made to execute a process of stopping or restarting of the instruction processing unit, which reserves without running the stop or restart of the process, the status signal is the hold after having changed to the completion state of an uncompleted state May be stopped or restarted.
好適に、前記デバッグ部は、前記命令処理部により命令が処理されている期間であって、前記状態信号が未完了状態を示す場合を含む期間において、前記命令処理部の処理に関連する所定のイベントの発生を示す信号をカウントするカウント部を有してよい。
また、前記カウント部は、入力される制御信号に応じて、少なくとも、前記状態信号が未完了状態を示す期間における被カウント信号のカウントを実行するか否かの選択、又は、前記状態信号が未完了状態を示す期間に入力される初期化信号に応じたカウント値の初期化を実行するか否かの選択が可能であってよい。
Preferably, the debug unit is a predetermined period related to processing of the instruction processing unit in a period in which an instruction is processed by the instruction processing unit, including a case where the state signal indicates an incomplete state. A counting unit that counts a signal indicating the occurrence of an event may be included.
In addition, the counting unit selects at least whether or not to count the counted signal in a period in which the state signal indicates an incomplete state, or the state signal is not yet determined in accordance with an input control signal. It may be possible to select whether or not to execute the initialization of the count value according to the initialization signal input during the period indicating the completion state.
本発明によれば、命令処理部における新たな命令の処理を停止してからその停止前に既に開始された処理が完了するまでの間、命令処理部の動作の制御や動作状態の記録などに関連するデバッグ動作が制限されるため、命令処理部が実行状態から停止状態へ移行する遷移期間においてデバッグ動作が実行されることにより生じる種々の問題を解消することができる According to the present invention, from the time when the processing of a new command in the command processing unit is stopped until the processing already started before the stop is completed, the control of the operation of the command processing unit, the recording of the operation state, etc. Since the related debug operation is limited, various problems caused by executing the debug operation in the transition period in which the instruction processing unit shifts from the execution state to the stop state can be solved.
図1は、本発明の実施形態に係るプロセッサの構成の一例を示す図である。
図1に示すプロセッサは、命令処理部10と、デバッグ部20と、デバッグ制限部30とを有する。
FIG. 1 is a diagram illustrating an example of a configuration of a processor according to an embodiment of the present invention.
The processor illustrated in FIG. 1 includes an instruction processing unit 10, a debug unit 20, and a debug restriction unit 30.
[命令処理部10]
命令処理部10は、入力される一連の命令をパイプライン方式にて順次に処理する。すなわち、一の命令を複数の段階で処理するとともに、その各段階の処理を独立に行うことで一連の命令を並列に処理する。
[Instruction processor 10]
The instruction processing unit 10 sequentially processes a series of input instructions in a pipeline manner. That is, a single instruction is processed in a plurality of stages, and a series of instructions are processed in parallel by performing the processing in each stage independently.
パイプライン方式による命令の処理の段階には、例えば、プログラム・メモリ(不図示)から命令をフェッチする段階(フェッチ段階)と、フェッチされた命令をデコードして実行する段階(実行段階)が含まれる。 The pipeline processing stage includes, for example, a stage of fetching an instruction from a program memory (not shown) (fetch stage) and a stage of decoding and executing the fetched instruction (execution stage). It is.
フェッチ段階には、例えば、プログラム・メモリにフェッチ対象の命令のアドレスを渡す段階(プリフェッチ段階「PRE−FETCH1」)、プログラム・メモリからの応答を待機する段階(プリフェッチ段階「PRE−FETCH2」)、プログラム・メモリから命令を読み出して命令バッファ・キューIBQに格納する段階(フェッチ段階「FETCH」)、命令バッファ・キューIBQに格納される命令を事前にデコードして命令の境界の識別やパイプライン保護用のサイクルを挿入するかについての判定を行う段階(プリデコード段階「PRE−DEC」)が含まれる。 In the fetch stage, for example, a stage of passing an address of an instruction to be fetched to the program memory (prefetch stage “PRE-FETCH1”), a stage of waiting for a response from the program memory (prefetch stage “PRE-FETCH2”), Stages where instructions are read from the program memory and stored in the instruction buffer queue IBQ (fetch stage “FETCH”), instructions stored in the instruction buffer queue IBQ are pre-decoded to identify instruction boundaries and pipeline protection A stage for determining whether to insert a cycle for the purpose (predecoding stage “PRE-DEC”) is included.
実行段階には、例えば、命令バッファ・キューIBQから命令を読み出してデコードする段階(デコード段階「DECODE」)、デコード結果に基づいて処理対象のデータの格納アドレスを生成する段階(アドレス段階「ADDRESS」)、生成されたアドレスを不図示のデータ・メモリに渡す段階(アクセス段階「ACCESS1」)、データ・メモリからの応答を待機する段階(アクセス段階「ACCESS2」)、データ・メモリからデータを読み出す段階(リード段階「READ」)、データ・メモリから読み出したデータやレジスタに格納されるデータに演算を施す段階(実行段階「EXE」)、演算結果のデータをデータ・メモリやレジスタに書き込む段階(ライト段階「WRITE1」,「WRITE2」)が含まれる。 In the execution stage, for example, a stage in which an instruction is read from the instruction buffer queue IBQ and decoded (decoding stage “DECODE”), and a storage address of data to be processed is generated based on the decoding result (address stage “ADDRESS”). ), Passing the generated address to a data memory (not shown) (access stage “ACCESS1”), waiting for a response from the data memory (access stage “ACCESS2”), and reading data from the data memory (Read stage “READ”), a stage for performing operations on data read from the data memory and data stored in the register (execution stage “EXE”), and a stage for writing the result data to the data memory or register (write) Stage "WRITE1", "WRITE2").
また、命令処理部10は、後述するデバッグ部20の制御に従って命令の処理を停止する場合、新たな命令の処理を停止するとともに、既に開始された処理が完了したか否かを示す状態信号S1を出力する。例えば、命令処理部10は、プログラムの実行を停止させるイベント(以下、HALTイベントという)が発生すると、新たな命令のデコードを停止するとともに、既に実行段階へ移行している命令に関して、その実行が完了したか否かを示す状態信号S1を出力する。
命令処理部10の状態信号S1によってその状態が示される「既に開始された処理」には、プログラムのフローに従って開始された通常命令の処理のほか、後述するDMA部23のアクセス要求に応じて開始された処理や、DMA部23によって通常命令の中に挿入される命令に応じて開始された処理などが含まれる。
In addition, when the instruction processing unit 10 stops processing an instruction in accordance with the control of the debug unit 20 to be described later, the instruction processing unit 10 stops processing a new instruction and indicates whether or not the already started processing is completed. Is output. For example, when an event for stopping execution of a program (hereinafter referred to as a HALT event) occurs, the instruction processing unit 10 stops decoding of a new instruction and executes an instruction that has already entered the execution stage. A status signal S1 indicating whether or not it is completed is output.
In the “already started processing” whose state is indicated by the status signal S1 of the instruction processing unit 10, in addition to processing of a normal instruction started in accordance with the program flow, it starts in response to an access request from the DMA unit 23 described later. And processing started in response to an instruction inserted into a normal instruction by the DMA unit 23.
命令処理部10は、例えば図1に示すように、命令バッファ・キューIBQと、入力制御部11と、セレクタ12と、命令実行部13と、パイプライン保護部14と、信号発生部15と、信号伝播部16と、状態信号出力部17とを有する。 For example, as shown in FIG. 1, the instruction processing unit 10 includes an instruction buffer / queue IBQ, an input control unit 11, a selector 12, an instruction execution unit 13, a pipeline protection unit 14, a signal generation unit 15, A signal propagation unit 16 and a state signal output unit 17 are included.
命令バッファ・キューIBQは、プログラムを格納する不図示のメモリから順次に命令をフェッチして格納する。 The instruction buffer queue IBQ sequentially fetches and stores instructions from a memory (not shown) that stores programs.
セレクタ12は、不図示の制御回路からの制御信号SELに従って、命令バッファ・キューIBQに格納された命令若しくは割り込み命令(INTR)を選択し、命令実行部13へ入力する。 The selector 12 selects an instruction or an interrupt instruction (INTR) stored in the instruction buffer queue IBQ in accordance with a control signal SEL from a control circuit (not shown), and inputs it to the instruction execution unit 13.
入力制御部11は、デバッグ部20において出力される各種の制御信号に従って、命令実行部13への命令の入力を制御する。すなわち、プログラムの実行中においては、命令バッファ・キューIBQに格納される命令を命令実行部13に供給し、プログラムの実行を停止する場合は、命令バッファ・キューIBQから命令実行部13への命令の供給を停止する。 The input control unit 11 controls input of an instruction to the instruction execution unit 13 according to various control signals output from the debug unit 20. That is, when the program is being executed, the instruction stored in the instruction buffer queue IBQ is supplied to the instruction execution unit 13, and when the program execution is stopped, the instruction from the instruction buffer queue IBQ to the instruction execution unit 13 is executed. Stop supplying.
また、入力制御部11は、有効な割り込み要求が発生した場合、割り込み命令(INTR)を命令実行部13へ供給する。この割り込み命令(INTR)に応じて、割り込みベクタが指すメモリ・アドレスから割り込みルーチンの命令がフェッチされ、命令バッファ・キューIBQに格納される。入力制御部11は、命令バッファ・キューIBQに格納された割り込みルーチンの命令を、命令実行部13へ供給する。 Further, the input control unit 11 supplies an interrupt command (INTR) to the command execution unit 13 when a valid interrupt request is generated. In response to the interrupt instruction (INTR), the instruction of the interrupt routine is fetched from the memory address indicated by the interrupt vector and stored in the instruction buffer queue IBQ. The input control unit 11 supplies the instruction of the interrupt routine stored in the instruction buffer queue IBQ to the instruction execution unit 13.
命令実行部13は、入力制御部11を介して入力される一連の命令をパイプライン方式にて実行する。例えば命令実行部13は、「PRE−DEC」段階において、命令バッファ・キューIBQから入力した命令をプリデコードし、この命令に対して「DECODE」,「ADDRESS」,「ACCESS1,「ACCESS2」,「READ」,「EXE」,「WRITE1」,「WRITE2」の各処理を段階的に進行させることにより、命令に応じた種々の動作をする。また、順次入力される命令に対して各段階の処理を独立に実行することで、複数の命令を並列に実行する。 The instruction execution unit 13 executes a series of instructions input via the input control unit 11 in a pipeline manner. For example, in the “PRE-DEC” stage, the instruction execution unit 13 predecodes an instruction input from the instruction buffer queue IBQ, and “DECODE”, “ADDRESS”, “ACCESS1,“ ACCESS2 ”,“ By proceeding in stages with each process of “READ”, “EXE”, “WRITE1”, and “WRITE2”, various operations according to the command are performed. In addition, a plurality of instructions are executed in parallel by independently executing the processing of each stage for the sequentially input instructions.
図1に示す命令実行部13は、パイプラインの構成を模式的に表しており、レジスタRA1,RA2,…,RAnと処理回路U1,U2,…,Unを有する。レジスタRA1は、命令バッファ・キューIBQから入力した命令に対するパイプラインの第1段階目の処理で利用されるデータを格納する。処理回路U1は、レジスタRA1に格納されたデータに基づいて第1段階目の処理を実行し、その結果をレジスタRA2に格納する。処理回路U1は、例えば「DECODE」段階の処理を実行する。
同様に、レジスタRAi(iは2からnまでの整数を示す)は、パイプラインの第(i−1)段階目の処理結果を格納し、処理回路Uiは、レジスタRAiに格納されたデータに基づいて第i段階目の処理を実行する。
The instruction execution unit 13 shown in FIG. 1 schematically shows the configuration of the pipeline, and includes registers RA1, RA2,..., RAn and processing circuits U1, U2,. The register RA1 stores data used in the first stage processing of the pipeline for the instruction input from the instruction buffer queue IBQ. The processing circuit U1 executes the first stage processing based on the data stored in the register RA1, and stores the result in the register RA2. The processing circuit U1 executes, for example, “DECODE” stage processing.
Similarly, the register RAi (i indicates an integer from 2 to n) stores the processing result of the (i−1) -th stage of the pipeline, and the processing circuit Ui stores the data stored in the register RAi. Based on this, the i-th stage process is executed.
パイプライン保護部14は、パイプラインにおいて2以上の命令が並列に実行されることに伴う各種の問題(パイプライン・ハザード)を回避するため、命令実行部13における命令の各実行段階の進行を制御する。例えば、依存関係を有する命令同士が並列に実行されることによって命令の実行順序が乱れたり、同一のハードウェアに対して2以上の命令によるアクセスが同時に発生したりすることを回避するため、パイプラインの各段階に追加のサイクル(パイプライン保護サイクル)を挿入する。パイプライン保護部14は、例えば「PRE−DEC」段階のプリデコード結果などに基づいてパイプライン・ハザードの発生を予測し、それを回避するためのパイプライン保護サイクルを決定してパイプラインの各段階に挿入する。 In order to avoid various problems (pipeline hazards) associated with two or more instructions being executed in parallel in the pipeline, the pipeline protection unit 14 advances the execution stages of the instructions in the instruction execution unit 13. Control. For example, in order to avoid that the instructions having dependency relations are executed in parallel, the order of execution of instructions is disturbed, and the same hardware is accessed by two or more instructions at the same time. Insert additional cycles (pipeline protection cycles) at each stage of the line. The pipeline protection unit 14 predicts the occurrence of a pipeline hazard based on, for example, the pre-decode result in the “PRE-DEC” stage, and determines a pipeline protection cycle for avoiding the occurrence of the pipeline hazard. Insert into the stage.
信号発生部15は、入力制御部11により命令の入力が停止されると、当該入力停止を示す停止信号SHを発生して信号伝播部16に入力する。例えばHALTイベントが発生してプログラムの実行を停止する場合や、プログラムの実行停止中に生じた割り込みから復帰して再停止する場合などにおいて停止信号SHを発生する。 When the input control unit 11 stops inputting an instruction, the signal generation unit 15 generates a stop signal SH indicating the input stop and inputs the stop signal SH to the signal propagation unit 16. For example, the stop signal SH is generated when a HALT event occurs to stop the execution of a program, or when returning from an interrupt that occurred during the stop of the execution of the program and then stopping again.
信号伝播部16は、命令実行部13における命令の実行段階の進行と同期して、信号発生部15が発生した停止信号SHを順次に伝播する複数のレジスタRB1,RB2,…,RBnを有する。
レジスタRB1,…,RBnは、命令実行部13におけるレジスタRA1,…,RAn(すなわちパイプラインの第1段階,…,第n段階)にそれぞれ対応しており、例えば図1に示すように直列に接続される。初段のレジスタRB1は、信号発生部15において発生する停止信号SHを入力し、命令実行部13におけるパイプラインの第1段階の進行と同期して、停止信号SHをレジスタRB2に伝播する。2段目以降のレジスタ(RB2〜)も同様に、パイプラインの対応する実行段階の進行と同期して、前段から入力した停止信号を次段へ伝播する。例えば、パイプライン保護部14によってパイプラインのある段階にパイプライン保護サイクルが挿入されると、当該段階に対応するレジスタにおける停止信号SHの伝播期間も延長される。
なお、レジスタRB1,…,RBnは、本発明における遅延部の一例である。
The signal propagation unit 16 includes a plurality of registers RB1, RB2,.
The registers RB1,..., RBn correspond to the registers RA1,..., RAn (that is, the first stage,. Connected. The first stage register RB1 receives the stop signal SH generated in the signal generation unit 15, and propagates the stop signal SH to the register RB2 in synchronization with the progress of the first stage of the pipeline in the instruction execution unit 13. Similarly, the second and subsequent registers (RB2 to RB2) propagate the stop signal input from the previous stage to the next stage in synchronization with the progress of the corresponding execution stage of the pipeline. For example, when a pipeline protection cycle is inserted at a stage of the pipeline by the pipeline protection unit 14, the propagation period of the stop signal SH in the register corresponding to the stage is also extended.
Registers RB1,..., RBn are an example of a delay unit in the present invention.
信号伝播部16は、上述したレジスタRB1,…,RBnに加えて、その終段から出力される停止信号SHを更に伝播する拡張遅延部161を有する。
拡張遅延部161は、停止信号SHがレジスタRB1,RB2,…,RBnを伝播した後更に一定の期間、停止信号SHの伝播期間を延長する。拡張遅延部16によって延長される伝播期間は、命令実行部13のn段階のパイプラインによって命令が実行された後、これに付随した処理が実行され得る期間に相当する。
In addition to the registers RB1,..., RBn described above, the signal propagation unit 16 includes an extension delay unit 161 that further propagates the stop signal SH output from the final stage.
The extension delay unit 161 extends the propagation period of the stop signal SH for a certain period after the stop signal SH propagates through the registers RB1, RB2,. The propagation period extended by the extended delay unit 16 corresponds to a period during which an associated process can be executed after an instruction is executed by the n-stage pipeline of the instruction execution unit 13.
例えば、後述するデバッグ部20は、メモリに書き込まれたデータの値とアドレスの値がそれぞれ予め設定したデータ値、アドレス値と一致することを条件に、命令処理部10のHALTイベントを発生させることができる(後述のアドレス/データ・ウォッチポイント)。このHALTイベントは、パイプラインの最後の「WRITE2」段階においてメモリに書き込まれるデータの値と書き込み先のアドレス値が確定した後に発生する。つまり、パイプラインにおける命令の実行が完了した後も、付随的にHALTイベントなどの処理が実行され得る。拡張遅延部16は、このような付随的処理が実行される期間が含まれるように停止信号SHの伝播期間を延長する。 For example, the debug unit 20 to be described later generates a HALT event of the instruction processing unit 10 on the condition that the value of data written to the memory and the value of the address match the preset data value and address value, respectively. (Address / data watchpoint described later). This HALT event occurs after the value of data to be written into the memory and the address value of the write destination are determined at the last “WRITE2” stage of the pipeline. That is, even after the execution of instructions in the pipeline is completed, processing such as a HALT event can be executed incidentally. The extension delay unit 16 extends the propagation period of the stop signal SH so that the period in which such ancillary processing is executed is included.
拡張遅延部161は、例えば、レジスタRB1,RB2,…,RBnの後段へ更にレジスタを追加することによって実現してもよいし、あるいは、レジスタRB1,RB2,…,RBnのクロックサイクルに一定の遅延を与える回路を設けることによって全体の伝播期間が一定期間延長されるようにしてもよい。 The extended delay unit 161 may be realized, for example, by adding more registers to the subsequent stage of the registers RB1, RB2,..., RBn, or a fixed delay in the clock cycle of the registers RB1, RB2,. The entire propagation period may be extended for a certain period by providing a circuit for providing
状態信号出力部17は、信号発生部15において発生した停止信号SHが信号伝播部16を伝播しているか否か検知し、この検知結果を状態信号S1として出力する。
例えば、停止信号SHが1ビットの信号であり、その値を「1」とすると、状態信号出力部17は、レジスタRB1,RB2,…,RBn及び拡張遅延部161の何れかに値「1」の停止信号SHが保持されているか否かを検知する。すなわち、レジスタRB1,RB2,…,RBn及び拡張遅延部161の出力信号の論理和に相当する信号を状態信号S1として出力する。ここでは一例として、状態信号S1が値「1」の場合、命令実行部13においてパイプラインの命令の実行が完了していないことを示すものとする。
The state signal output unit 17 detects whether or not the stop signal SH generated in the signal generation unit 15 is propagated through the signal propagation unit 16, and outputs the detection result as the state signal S1.
For example, if the stop signal SH is a 1-bit signal and its value is “1”, the status signal output unit 17 sets the value “1” in any of the registers RB1, RB2,. It is detected whether or not the stop signal SH is held. That is, a signal corresponding to the logical sum of the outputs of the registers RB1, RB2,..., RBn and the extended delay unit 161 is output as the status signal S1. Here, as an example, when the status signal S1 is “1”, it indicates that the instruction execution unit 13 has not completed the execution of the pipeline instruction.
[デバッグ部20]
デバッグ部20は、デバッグ用のホスト装置(不図示)から入力されるコマンドに応じて、命令処理部10により実行されるプログラムの検証に関わるデバッグ動作を実行する。例えば、デバッグ動作として、命令処理部10の動作の制御や、その動作状態の記録などを行う。デバッグ部20において実行されるコマンドの一例を以下に示す。
[Debug unit 20]
The debugging unit 20 executes a debugging operation related to verification of a program executed by the instruction processing unit 10 in accordance with a command input from a debugging host device (not shown). For example, as a debugging operation, the operation of the instruction processing unit 10 is controlled and the operation state is recorded. An example of a command executed in the debug unit 20 is shown below.
<HALTコマンド>
命令処理部10における命令の処理を停止する。
<STEPコマンド>
命令処理部10において、バックグラウンド・コード(デバッグのために停止可能な命令)を1個ずつ実行する。
<RUNC(Conditional Run)コマンド>
命令処理部10において、フォアグランド・コード(デバッグ時にバックグラウンド・コードを停止しているときも実行される割り込みルーチンの命令)やバックグラウンド・コードを所定の数だけ実行したり、これらの命令をHALTイベントが発生するまで実行する。
<RUNF(Free Run)コマンド>
命令処理部10において、フォアグランド・コードやバックグラウンド・コードをHALTイベントの有無にかかわらず実行する。
<HALT command>
The instruction processing in the instruction processing unit 10 is stopped.
<STEP command>
The instruction processing unit 10 executes background code (instructions that can be stopped for debugging) one by one.
<RUNC (Conditional Run) command>
The instruction processing unit 10 executes a predetermined number of foreground codes (interrupt routine instructions that are executed even when the background code is stopped during debugging) and background codes. Execute until a HALT event occurs.
<RUNF (Free Run) command>
In the instruction processing unit 10, the foreground code and the background code are executed regardless of the presence or absence of the HALT event.
また、デバッグ部20の制御により発生するHALTイベントには、上述した実行コマンドの他にも例えば以下のものがある。 In addition to the above-described execution commands, for example, there are the following HALT events generated by the control of the debug unit 20.
<ソフトウェア・ブレークポイント(Break Point)>
デバッグ部20は、後述するDMA機能によって、メモリに格納される所望の命令をデバッグ用の命令(停止命令(ESTOP)など)に置換する。命令処理部10は、この停止命令をプリデコードすると、プログラムの実行を停止する。
<ハードウェア・ブレークポイント>
デバッグ部20は、プログラム・メモリのアドレス・バスを監視し、メモリに格納される所望の命令が命令処理部10によりフェッチされたことを検出すると、その命令に所定のタグを付加する。命令処理部10は、このタグをプリデコードすると、プログラムの実行を停止する。ハードウェア・ブレークポイントは、メモリ上のプログラムを書き換える必要がないため、プログラム・メモリがROM(read only memory)の場合でも利用できる。
<アドレス/データ・ウォッチポイント(Watch Point)>
デバッグ部20は、データ・メモリのアドレス・バス又はデータ・バスを監視し、予め指定されたデータ値又はアドレス値を検出すると、命令処理部10に対してプログラムの実行の停止を要求する。このHALTイベントは、所望のアドレス値とデータ値が両方検出された場合に発生させることも可能である。
<外部トリガ・ウォッチポイント>
デバッグ部20は、予め指定された外部からのトリガ信号(不図示)を監視し、そのトリガ信号を検出すると、命令処理部10に対してプログラムの実行の停止を要求する。
<Software Breakpoint>
The debug unit 20 replaces a desired instruction stored in the memory with a debug instruction (such as a stop instruction (ESTOP)) by a DMA function described later. When the instruction processing unit 10 predecodes the stop instruction, the instruction processing unit 10 stops the execution of the program.
<Hardware breakpoint>
When the debug unit 20 monitors the address bus of the program memory and detects that a desired instruction stored in the memory is fetched by the instruction processing unit 10, the debug unit 20 adds a predetermined tag to the instruction. When the instruction processing unit 10 predecodes the tag, the instruction processing unit 10 stops the execution of the program. Hardware breakpoints can be used even when the program memory is a ROM (read only memory) because it is not necessary to rewrite the program on the memory.
<Address / Data Watch Point>
The debug unit 20 monitors the address bus or data bus of the data memory, and when detecting a data value or address value designated in advance, requests the instruction processing unit 10 to stop execution of the program. This HALT event can also be generated when both a desired address value and a data value are detected.
<External trigger watchpoint>
The debug unit 20 monitors an external trigger signal (not shown) designated in advance, and when detecting the trigger signal, requests the instruction processing unit 10 to stop the execution of the program.
デバッグ部20は、例えば図1に示すように、実行制御部21と、分析部22と、DMA部23と、デバッグ状態レジスタ24(DBGSTAT)とを有する。 For example, as shown in FIG. 1, the debug unit 20 includes an execution control unit 21, an analysis unit 22, a DMA unit 23, and a debug status register 24 (DBGSTAT).
実行制御部21は、不図示のホスト装置より入力されるコマンドや分析部22におけるウォッチポイントの検出結果などに応じて、命令処理部10におけるプログラムの実行状態を制御する。
例えば、実行制御部21は、ホスト装置からコマンド(「HALT」,「RUNC」等)が入力されると、命令処理部10に対して当該コマンドの実行を要求するリクエスト信号EXE_RQを出力する。
また、実行制御部21は、分析部22においてウォッチポイントの条件に一致する事象が検出されると、デバッグ状態レジスタ24(DBGSTAT)等を参照して、ホスト装置から入力されるコマンドに応じた実行条件や現在の命令の実行状態がそのウォッチポイントの停止条件を満たしているか判定し、停止条件を満たしている場合、命令処理部10に対してプログラムの実行停止を要求するリクエスト信号WP−RQを出力する。
更に、実行制御部21は、デバッグのためプログラムの実行を停止しているときでも所定の割り込み要求については受け付けるように命令処理部10を制御する。例えばハードウェアの割り込み制御などでは処理を停止することが許されないことがあり、そのような割り込み処理ルーチンを有するプログラムのデバッグにおいては、プログラムの実行停止時に割り込みイネーブル信号INT_ENMを有効状態に設定することで、割り込み要求の受付を可能とする。
The execution control unit 21 controls the execution state of the program in the instruction processing unit 10 in accordance with a command input from a host device (not shown) or a watchpoint detection result in the analysis unit 22.
For example, when a command (“HALT”, “RUNC”, etc.) is input from the host device, the execution control unit 21 outputs a request signal EXE_RQ requesting the instruction processing unit 10 to execute the command.
When the analysis unit 22 detects an event that matches the watchpoint condition, the execution control unit 21 refers to the debug status register 24 (DBGSTAT) or the like and executes the execution according to the command input from the host device. It is determined whether the execution condition of the condition and the current instruction satisfies the stop condition of the watchpoint. If the stop condition is satisfied, a request signal WP-RQ that requests the instruction processing unit 10 to stop the execution of the program is sent. Output.
Furthermore, the execution control unit 21 controls the instruction processing unit 10 to accept a predetermined interrupt request even when execution of the program is stopped for debugging. For example, it may not be allowed to stop processing in hardware interrupt control, etc. In debugging a program having such an interrupt processing routine, the interrupt enable signal INT_ENM must be set to an effective state when the program execution is stopped. The interrupt request can be accepted.
他方、実行制御部21は、命令処理部10の動作の状態(処理の停止原因に関する情報
など)が記憶されたデバッグ状態レジスタ24(DBGSTAT)にアクセスし、その記憶情報を適宜更新する。
例えば、実行制御部21は、HALTイベントに対する応答信号(HALT_ACK)
が命令処理部10から出力されると、デバッグ状態レジスタ24(DBGSTAT)においてプログラムの実行停止の原因を示す所定のフラグデータ(HALTイベントフラグ)をセットする。
On the other hand, the execution control unit 21 accesses the debug state register 24 (DBGSTAT) in which the state of operation of the instruction processing unit 10 (information about the cause of the stop of processing) is stored, and updates the stored information as appropriate.
For example, the execution control unit 21 responds to a HALT event (HALT_ACK).
Is output from the instruction processing unit 10, predetermined flag data (HALT event flag) indicating the cause of program execution stoppage is set in the debug status register 24 (DBGSTAT).
また、実行制御部21は、命令処理部10における命令の実行状態を示すステートマシン211(EXSM)を備えている。実行制御部21は、命令の実行状態に関して命令処理部10から出力される各種の信号(命令のデコード開始や停止を示す信号、HALTイベントに対する応答信号、割り込み命令や復帰命令に対する応答信号など)に応じて、ステートマシン211(EXSM)のステートを更新する。 Further, the execution control unit 21 includes a state machine 211 (EXSM) that indicates an instruction execution state in the instruction processing unit 10. The execution control unit 21 receives various signals (a signal indicating start / stop of instruction decoding, a response signal for a HALT event, a response signal for an interrupt instruction or a return instruction, etc.) output from the instruction processing unit 10 regarding the execution state of the instruction. In response, the state of the state machine 211 (EXSM) is updated.
分析部22は、予め設定された条件に従って、命令処理部10によるメモリへのアクセスや外部からのトリガ信号を監視する。例えば、分析部22は、命令処理部10の要求に応じて、メモリのアドレス・バスやデータ・バスに所定値のデータが出力されたかどうかの監視や、外部から所定のトリガ信号が入力されたかどうかの監視を行う。 The analysis unit 22 monitors access to the memory by the instruction processing unit 10 and a trigger signal from the outside according to preset conditions. For example, in response to a request from the instruction processing unit 10, the analysis unit 22 monitors whether a predetermined value of data has been output to the memory address bus or data bus, or whether a predetermined trigger signal has been input from the outside. Monitor whether.
また分析部22は、実行制御部21により設定される条件に従って被カウント信号をカウントするベンチマークカウンタ221を備える。
ベンチマークカウンタ221は、本発明におけるカウンタ部の一例に相当するものであり、実行制御部21等から入力される制御信号に応じて、種々の被カウント信号をカウントする。例えば、命令処理部10の処理に関連する各種のイベント(命令処理部10の内部イベント,分析部22で検出されるウォッチポイント等のイベント,メモリのキャッシュ・ミス等の外部イベント)の発生を示す信号や、命令処理部10における各命令の実行(例えば各命令のデコードの実行)を示す信号、命令処理部10の動作タイミングの基準を示すクロック信号などをカウントする。
また、ベンチマークカウンタ221は、上述したイベントの発生を示す信号等を初期化信号として入力した場合に、カウント値を初期化する機能も有している。
更に、ベンチマークカウンタ221は、状態信号S1が命令処理部10のパイプライン処理の未完了状態を示す遷移期間において、カウント動作や初期化動作を実行するか否かを選択可能である。すなわち、ベンチマークカウンタ221は、プログラムの実行が停止される際の遷移期間において、上述した被カウント信号のカウントを実行するか否か、初期化信号に応じたカウント値の初期化を実行するか否かをそれぞれ選択することができる。例えば、ベンチマークカウンタ221は、ウォッチポイントなどのイベントをカウントする場合、HALTイベントが発生していない通常の期間に加えて、HALTイベントが発生した後の遷移期間において発生するイベントもカウントすることが可能である。また、クロック信号をカウントする場合においては、遷移期間におけるカウントを停止することが可能である。すなわち、ベンチマークカウンタ221は、カウント対象の信号に応じて、遷移期間におけるカウント動作や初期化動作の有無を選択することができる。
The analysis unit 22 includes a benchmark counter 221 that counts the counted signal according to the conditions set by the execution control unit 21.
The benchmark counter 221 corresponds to an example of a counter unit in the present invention, and counts various counted signals in accordance with a control signal input from the execution control unit 21 or the like. For example, it indicates the occurrence of various events related to the processing of the instruction processing unit 10 (internal events of the instruction processing unit 10, events such as watchpoints detected by the analysis unit 22, external events such as memory cache misses). A signal, a signal indicating execution of each instruction in the instruction processing unit 10 (for example, execution of decoding of each instruction), a clock signal indicating a reference of operation timing of the instruction processing unit 10, and the like are counted.
The benchmark counter 221 also has a function of initializing a count value when a signal indicating the occurrence of the event described above is input as an initialization signal.
Further, the benchmark counter 221 can select whether or not to execute the count operation or the initialization operation in the transition period in which the state signal S1 indicates the incomplete state of the pipeline processing of the instruction processing unit 10. That is, the benchmark counter 221 determines whether or not to execute the counting of the counted signal described above and whether or not to initialize the count value according to the initialization signal in the transition period when the execution of the program is stopped. Each can be selected. For example, when counting events such as watchpoints, the benchmark counter 221 can count events that occur in the transition period after the occurrence of the HALT event in addition to the normal period in which the HALT event has not occurred. It is. In addition, when counting clock signals, it is possible to stop counting during the transition period. That is, the benchmark counter 221 can select the presence or absence of a counting operation or an initialization operation during the transition period according to the signal to be counted.
DMA(direct memory access)部23は、不図示のホスト装置より入力されるコマンドに応じて、命令処理部10がアクセス対象とする記憶部にアクセスし、そのデータの読み出しや書き込みを行う。命令処理部10がアクセス対象とするメモリには、内部若しくは外部のメモリや、命令処理部10において命令の処理に利用されるレジスタ群などが含まれる。
DMA部23は、例えばメモリに格納される所望の命令をデバッグ用の命令(プログラムの停止命令など)に置換することで、命令実行部13にデバッグ命令を実行させる。
また、DMA部23は、命令実行部13のデコード段階のパイプラインに対してレジスタの読み書き要求を直接挿入することにより、命令実行部13のパイプライン処理を利用してレジスタ群にアクセスする。
また、DMA部23は、命令処理部10に入力される一連の命令の中へ更に命令を挿入することで、命令処理部10に任意の命令を実行させることもできる。この場合、DMA部23は、例えば、ホスト装置より入力されるコマンドにより指定された所望の命令を命令実行部13の命令レジスタ(フェッチした命令をデコードするために格納するレジスタ)へ直接書き込む。
DMA部23によるアクセスは、例えば、命令処理部10によるアクセスの合間に行ってもよいし、あるいは、命令処理部10によるアクセスを停止させて行ってもよい。
DMA部23は、上記のDMAアクセスを有効にする場合、命令処理部10に対してリクエスト信号DMA_RQを出力する。このリクエスト信号に対する応答信号が命令処理部10から返されると、DMA部23はそのアクセスを有効にする。
A DMA (direct memory access) unit 23 accesses a storage unit to be accessed by the instruction processing unit 10 in accordance with a command input from a host device (not shown), and reads and writes the data. The memory to be accessed by the instruction processing unit 10 includes an internal or external memory, a register group used for instruction processing in the instruction processing unit 10, and the like.
For example, the DMA unit 23 causes the instruction execution unit 13 to execute the debug instruction by replacing a desired instruction stored in the memory with a debug instruction (such as a program stop instruction).
The DMA unit 23 accesses the register group by using the pipeline processing of the instruction execution unit 13 by directly inserting a register read / write request into the decoding pipeline of the instruction execution unit 13.
The DMA unit 23 can also cause the instruction processing unit 10 to execute an arbitrary instruction by inserting further instructions into a series of instructions input to the instruction processing unit 10. In this case, for example, the DMA unit 23 directly writes a desired instruction specified by a command input from the host device to the instruction register of the instruction execution unit 13 (a register for storing the fetched instruction).
Access by the DMA unit 23 may be performed, for example, between accesses by the instruction processing unit 10 or may be performed by stopping access by the instruction processing unit 10.
The DMA unit 23 outputs a request signal DMA_RQ to the instruction processing unit 10 when enabling the DMA access. When a response signal to this request signal is returned from the instruction processing unit 10, the DMA unit 23 validates the access.
デバッグ状態レジスタ24(DBGSTAT)は、デバッグに関連する命令処理部10の動作状態の情報を記憶する。例えば、命令処理部10におけるプログラムの実行を停止させる原因となったHALTイベントを示すフラグデータ(HALTイベントフラグ)を記憶する。 The debug state register 24 (DBGSTAT) stores information on the operation state of the instruction processing unit 10 related to debugging. For example, flag data (HALT event flag) indicating the HALT event that causes the instruction processing unit 10 to stop execution of the program is stored.
また、デバッグ状態レジスタ24(DBGSTAT)は、例えば次の情報を記憶する。 The debug status register 24 (DBGSTAT) stores, for example, the following information.
<HPI(high priority interrupt)>
割り込みの実行自体が最優先とみなされ、他の割り込みの重複やデバッグ動作に制限がもたらされていることを示すフラグデータ。
<IDS(interrupt during suspend)_ACT>
割り込みを受け付けたときに直前のバックグラウンド・コードが実行停止中であったことを示すフラグデータ。
<DFC(debug frame counter)>
バックグラウンド・コードからの割り込みの階層を示す5ビットのデータ。初期値は「0x1F」(「0x」は16進数を示す)であり、割り込みの階層が増すごとに1ずつインクリメントされる。デバッグ部20は、「DFC」を参照することによって、割り込みの階層ごとにデバッグ要求を制御する。
<HPI (high priority interrupt)>
Flag data indicating that interrupt execution itself is regarded as the highest priority, and other interrupt duplication and debugging operations are limited.
<IDS (interrupt during suspend) _ACT>
Flag data indicating that the previous background code was suspended when an interrupt was accepted.
<DFC (debug frame counter)>
5-bit data indicating the hierarchy of interrupts from the background code. The initial value is “0x1F” (“0x” indicates a hexadecimal number), and is incremented by 1 each time the interrupt hierarchy increases. The debug unit 20 controls the debug request for each interrupt hierarchy by referring to “DFC”.
[デバッグ制限部30]
デバッグ制限部30は、命令処理部10より出力される状態信号S1がパイプライン処理の未完了状態を示す場合(すなわち値「1」の場合)、状態信号S1が完了状態を示すまで(すなわち値「0」に変化するまで)デバッグ部20によるデバッグ動作を制限する。
[Debug restriction unit 30]
When the state signal S1 output from the instruction processing unit 10 indicates an incomplete state of pipeline processing (that is, when the value is “1”), the debug limiting unit 30 continues until the state signal S1 indicates a completed state (that is, the value). The debug operation by the debug unit 20 is limited (until it changes to “0”).
例えば、デバッグ制限部30は、HALTイベントの発生によって状態信号S1が値「1」になった場合、状態信号S1が「0」に変化するまで、割り込み要求の受付や、DMA部23によるアクセス、命令の実行状態を示すステートマシン211のステートの更新、デバッグ状態レジスタ24(DBGSTAT)の記憶情報の更新、デバッグ部20のコマンドの実行(HALT、RUNCコマンドなど)を制限する。 For example, when the status signal S1 becomes the value “1” due to the occurrence of the HALT event, the debug limiting unit 30 receives an interrupt request or accesses the DMA unit 23 until the status signal S1 changes to “0”. The update of the state of the state machine 211 indicating the execution state of the instruction, the update of the storage information of the debug state register 24 (DBGSTAT), and the execution of commands of the debug unit 20 (HALT, RUNC command, etc.) are restricted.
デバッグ制限部30は、例えば図1に示すように、AND回路31,32,33,36と、エッジ検出回路34と、ACK信号保持回路35とを有する。 The debug restriction unit 30 includes AND circuits 31, 32, 33, and 36, an edge detection circuit 34, and an ACK signal holding circuit 35, for example, as shown in FIG.
AND回路31は、実行制御部21の割り込みイネーブル信号INT_ENと状態信号S1を入力し、状態信号S1が「1」の場合に値「0」を持ち、状態信号S1が「0」の場合に割り込みイネーブル信号INT_ENと同一値を持つ割り込みイネーブル信号INT_ENMを出力する。命令処理部10は、AND回路31から出力される割り込みイネーブル信号INT_ENMが「1」の場合に割り込み要求を受付可能となり、割り込みイネーブル信号INT_ENMが「0」の場合は割り込み要求を受け付けない状態となる。したがって、HALTイベントの発生により状態信号S1が「1」になる期間(パイプラインに残る命令の処理が未完了の期間)は、命令処理部10における割り込み要求の受付が制限される。 The AND circuit 31 receives the interrupt enable signal INT_EN and the status signal S1 of the execution control unit 21, has a value “0” when the status signal S1 is “1”, and interrupts when the status signal S1 is “0”. An interrupt enable signal INT_ENM having the same value as the enable signal INT_EN is output. The instruction processing unit 10 can accept an interrupt request when the interrupt enable signal INT_ENM output from the AND circuit 31 is “1”, and does not accept an interrupt request when the interrupt enable signal INT_ENM is “0”. . Accordingly, during the period in which the status signal S1 becomes “1” due to the occurrence of the HALT event (the period in which the instruction remaining in the pipeline is not completed), the reception of interrupt requests in the instruction processing unit 10 is limited.
AND回路32は、実行制御部21のリクエスト信号EXE_RQと状態信号S1を入力し、状態信号S1が「1」の場合に値「0」を持ち、状態信号S1が「0」の場合にリクエスト信号EXE_RQと同一値を持つリクエスト信号EXE_RQMを出力する。命令処理部10は、AND回路32から出力されるリクエスト信号EXE_RQMが「1」の場合、実行制御部21からの要求を受けてコマンド(HALTコマンド、RUNCコマンドなど)を実行し、リクエスト信号EXE_RQMが「0」の場合はコマンドを実行しない。したがって、HALTイベントの発生により状態信号S1が「1」になる期間は、デバッグ部20の制御による命令処理部10の処理の停止や再開が制限される。 The AND circuit 32 receives the request signal EXE_RQ and the status signal S1 from the execution control unit 21, has a value “0” when the status signal S1 is “1”, and a request signal when the status signal S1 is “0”. A request signal EXE_RQM having the same value as EXE_RQ is output. When the request signal EXE_RQM output from the AND circuit 32 is “1”, the instruction processing unit 10 receives a request from the execution control unit 21 and executes a command (HALT command, RUNC command, etc.), and the request signal EXE_RQM is If “0”, the command is not executed. Therefore, during the period in which the status signal S1 is “1” due to the occurrence of the HALT event, the stop and restart of the processing of the instruction processing unit 10 under the control of the debugging unit 20 is restricted.
AND回路33は、DMA部23のリクエスト信号DMA_RQと状態信号S1を入力し、状態信号S1が「1」の場合に値「0」を持ち、状態信号S1が「0」の場合にリクエスト信号DMA_RQと同一値を持つリクエスト信号DMA_RQMを出力する。命令処理部10は、AND回路33から出力されるリクエスト信号DMA_RQMが「1」の場合、DMAアクセス(メモリへのアクセス等)を許可する応答信号を返し、リクエスト信号DMA_RQMが「0」の場合はこの応答信号を返さない。したがって、HALTイベントの発生により状態信号S1が「1」になる期間、DMA部23によるアクセスは制限される。 The AND circuit 33 receives the request signal DMA_RQ and the status signal S1 of the DMA unit 23, has a value “0” when the status signal S1 is “1”, and has a request signal DMA_RQ when the status signal S1 is “0”. A request signal DMA_RQM having the same value as is output. When the request signal DMA_RQM output from the AND circuit 33 is “1”, the instruction processing unit 10 returns a response signal permitting DMA access (access to the memory, etc.), and when the request signal DMA_RQM is “0”. This response signal is not returned. Therefore, access by the DMA unit 23 is restricted during a period in which the status signal S1 is “1” due to the occurrence of the HALT event.
エッジ検出回路34は、状態信号S1が「1」から「0」へ変化する立下りエッジにおいて、実行制御部21のステートマシン211(EXSM)のステートを「停止状態(DSUSP)」に設定する信号DSUSP_SETを出力する。すなわち、命令処理部10のパイプラインに残る命令の処理が完了したとき、ステートマシン211のステートは「停止状態(DSUSP)」に更新される。したがって、HALTイベントが発生した後、状態信号S1が「1」から「0」に変わるまでの間は、実行状態を示すステートマシン211(EXSM)のステート更新が制限される。 The edge detection circuit 34 sets the state of the state machine 211 (EXSM) of the execution control unit 21 to “stop state (DSUSP)” at the falling edge where the state signal S1 changes from “1” to “0”. DSUSP_SET is output. That is, when the processing of the instruction remaining in the pipeline of the instruction processing unit 10 is completed, the state of the state machine 211 is updated to “stopped state (DSUSP)”. Therefore, after the HALT event occurs, state update of the state machine 211 (EXSM) indicating the execution state is restricted until the state signal S1 changes from “1” to “0”.
ACK信号保持回路35は、状態信号S1が「1」の期間において命令処理部10より出力されるHALTイベントの応答信号HALT_ACKを保持する。例えば、命令処理部10は、HALTイベントが発生すると「1」のパルスを応答信号HALT_ACKとして出力する。状態信号S1が「1」の場合、ACK信号保持回路35はこの応答信号HALT_ACKを保持して「1」を出力する。その後、状態信号S1が「0」になると、ACK信号保持回路35は応答信号HALT_ACKの保持を解除して「0」を出力する。
他方、AND回路36は、このACK信号保持回路35の出力信号と状態信号S1とを入力し、状態信号S1が「1」の場合に値「0」を持ち、状態信号S1が「0」の場合にACK信号保持回路35の出力信号と同一値を持つフラグセット信号FLG_SETを出力する。
The ACK signal holding circuit 35 holds the response signal HALT_ACK of the HALT event output from the instruction processing unit 10 during the period in which the status signal S1 is “1”. For example, when a HALT event occurs, the command processing unit 10 outputs a pulse “1” as a response signal HALT_ACK. When the status signal S1 is “1”, the ACK signal holding circuit 35 holds the response signal HALT_ACK and outputs “1”. Thereafter, when the status signal S1 becomes “0”, the ACK signal holding circuit 35 releases the holding of the response signal HALT_ACK and outputs “0”.
On the other hand, the AND circuit 36 receives the output signal of the ACK signal holding circuit 35 and the status signal S1, has a value “0” when the status signal S1 is “1”, and the status signal S1 is “0”. In this case, a flag set signal FLG_SET having the same value as the output signal of the ACK signal holding circuit 35 is output.
ACK信号保持回路35において応答信号HALT_ACKが保持されているとき(ACK信号保持回路35の出力信号が「1」のとき)、状態信号S1が「1」から「0」へ変化すると、AND回路36は「1」のフラグセット信号FLG_SETを出力する。状態信号S1が「0」へ変化することによりACK信号保持回路35が応答信号HALT_ACKの保持を解除すると(ACK信号保持回路35の出力信号が「0」になると)、AND回路36はフラグセット信号FLG_SETを「0」にする。その結果、フラグセット信号FLG_SETは一旦「0」から「1」へ立ち上がり、1サイクル後に再び「1」から「0」へ戻る。すなわち、フラグセット信号FLG_SETは、状態信号S1が「1」になる期間だけ応答信号HALT_ACKのパルスを遅延させた信号に相当する。
フラグセット信号FLG_SETが「0」から「1」へ立ち上がると、デバッグ状態レジスタ24(DBGSTAT)は、その時点における命令処理部10の動作状態を反映するように記憶情報(HALTイベントフラグなど)を更新する。
したがって、HALTイベントの発生により状態信号S1が「1」になる期間は、デバッグ状態レジスタ24(DBGSTAT)における記憶情報の更新が制限される。
When the response signal HALT_ACK is held in the ACK signal holding circuit 35 (when the output signal of the ACK signal holding circuit 35 is “1”), when the state signal S1 changes from “1” to “0”, the AND circuit 36 Outputs a flag set signal FLG_SET of “1”. When the ACK signal holding circuit 35 releases the holding of the response signal HALT_ACK by changing the state signal S1 to “0” (when the output signal of the ACK signal holding circuit 35 becomes “0”), the AND circuit 36 outputs a flag set signal. Set FLG_SET to “0”. As a result, the flag set signal FLG_SET once rises from “0” to “1” and returns from “1” to “0” again after one cycle. That is, the flag set signal FLG_SET corresponds to a signal obtained by delaying the pulse of the response signal HALT_ACK only during a period in which the state signal S1 is “1”.
When the flag set signal FLG_SET rises from “0” to “1”, the debug state register 24 (DBGSTAT) updates the storage information (such as the HALT event flag) to reflect the operation state of the instruction processing unit 10 at that time. To do.
Therefore, during the period in which the status signal S1 is “1” due to the occurrence of the HALT event, the update of the stored information in the debug status register 24 (DBGSTAT) is restricted.
ここで、上述した構成を有する本実施形態に係るプロセッサのデバッグ時の動作について説明する。
まず、プログラムの実行を停止するときにデバッグ動作の制限を行わない場合の問題点について図2〜図7を参照して説明し、次いで、本実施形態に係るプロセッサの動作について図8〜図13を参照して説明する。
Here, an operation at the time of debugging of the processor according to the present embodiment having the above-described configuration will be described.
First, problems when the debug operation is not limited when stopping the execution of the program will be described with reference to FIGS. 2 to 7, and then the operation of the processor according to the present embodiment will be described with reference to FIGS. Will be described with reference to FIG.
図2は、プログラムの実行を停止する際の遷移期間においてデバッグ動作を制限する機能をもたないプロセッサの一構成例を示す図である。
図2に示すプロセッサは、命令処理部10Xとデバッグ部20Xを有する。命令処理部10Xは、上述した命令処理部10における信号発生部15,信号伝播部16,状態信号出力部17を省略したものであり、他の構成は命令処理部10と同様である。デバッグ部20Xは、HALTイベントに対する応答信号HALT_ACKが出力されてから一定サイクル後に(すなわちパイプラインの処理の完了とは無関係に)ステートマシン211やデバッグ状態レジスタ24(DBGSTAT)を更新するロジック回路を有しており、他の構成は上述したデバッグ部20と同様である。
FIG. 2 is a diagram illustrating a configuration example of a processor that does not have a function of limiting a debugging operation in a transition period when program execution is stopped.
The processor shown in FIG. 2 includes an instruction processing unit 10X and a debugging unit 20X. The instruction processing unit 10X is obtained by omitting the signal generation unit 15, the signal propagation unit 16, and the state signal output unit 17 in the instruction processing unit 10 described above, and the other configurations are the same as those of the instruction processing unit 10. The debug unit 20X has a logic circuit that updates the state machine 211 and the debug state register 24 (DBGSTAT) after a certain cycle (that is, regardless of completion of pipeline processing) after the response signal HALT_ACK to the HALT event is output. The other configuration is the same as that of the debug unit 20 described above.
<1−1> プログラムの実行を停止する際の遷移期間にHALTイベントが発生する場合 <1-1> When a HALT event occurs during the transition period when program execution is stopped
図3は、図2に示すプロセッサにおいて、プログラムの実行を停止する際の遷移期間にHALTイベント(ウォッチポイント)が発生する場合の動作の一例を示すタイミング図である。
図3(A)は、命令処理部10XのクロックCLKを示す。
図3(B)は、デバッグ状態レジスタ24(DBGSTAT)の記憶情報を示す。
図3(C)は、ステートマシン211(EXSM)のステート(命令処理部10Xの実行状態)を示す。
図3(D)は、デバッグ状態レジスタ24(DBGSTAT)に記憶されるDFC(割り込みの階層)を示す。
図3(E),(F),(G),(H),(I),(J),(K),(L),(M)は、それぞれ、パイプラインにおけるプリデコード段階「PRE−DEC」,デコード段階「DECODE」,アドレス段階「ADDRESS」,アクセス段階「ACCESS1」,アクセス段階「ACCESS2」,リード段階「READ」,実行段階「EXE」,ライト段階「WRITE1」,ライト段階「WRITE2」において処理される命令を示す。
FIG. 3 is a timing chart showing an example of operation when a HALT event (watchpoint) occurs in the transition period when program execution is stopped in the processor shown in FIG.
FIG. 3A shows the clock CLK of the instruction processing unit 10X.
FIG. 3B shows information stored in the debug status register 24 (DBGSTAT).
FIG. 3C shows a state of the state machine 211 (EXSM) (execution state of the instruction processing unit 10X).
FIG. 3D shows a DFC (interrupt hierarchy) stored in the debug status register 24 (DBGSTAT).
3 (E), (F), (G), (H), (I), (J), (K), (L), and (M) respectively represent predecode stages “PRE−” in the pipeline. DEC ", decode stage" DECODE ", address stage" ADDRESS ", access stage" ACCESS1 ", access stage" ACCESS2 ", read stage" READ ", execution stage" EXE ", write stage" WRITE1 ", write stage" WRITE2 " Indicates the instruction to be processed.
命令処理部10Xは、ソフトウェア・ブレークポイントの停止命令(ESTOP)をプリデコードすると(サイクルC1)、新たな命令のデコードを停止し、このHALTイベントに対する応答信号HALT_ACKを発生する(サイクルC2)。デバック部20は、この応答信号HALT_ACKを受けて、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグをセットするともに、ステートマシン211(EXSM)のステートを「実行状態(EXE)」から「停止状態(DSUSP)」に更新する(サイクルC3)。このとき、パイプラインの実行段階を処理する命令実行部13には、停止命令(ESTOP)より前にデコードされた命令(N〜N−5)が残っている。命令実行部13は、これらの命令を順次に実行する(サイクルC3〜C8)。 When the instruction processing unit 10X predecodes the software breakpoint stop instruction (ESTOP) (cycle C1), it stops decoding a new instruction and generates a response signal HALT_ACK for this HALT event (cycle C2). Upon receiving this response signal HALT_ACK, the debugging unit 20 sets the HALT event flag of the debug state register 24 (DBGSTAT) and changes the state of the state machine 211 (EXSM) from “execution state (EXE)” to “stop state ( DSUSP) "(cycle C3). At this time, the instruction (N to N-5) decoded before the stop instruction (ESTOP) remains in the instruction execution unit 13 that processes the execution stage of the pipeline. The instruction execution unit 13 executes these instructions sequentially (cycles C3 to C8).
一方、分析部22は、予め設定された条件に従って、命令処理部10によるメモリへのアクセスを監視している。そして、「停止状態(DSUSP)」のステートに移行したとき、パイプラインに残存する命令の実行によって、ウォッチポイントの条件に一致するアクセスが発生したことを検出する(サイクルC9)。 On the other hand, the analysis unit 22 monitors the access to the memory by the instruction processing unit 10 according to preset conditions. Then, when the state shifts to the “stop state (DSUSP)”, it is detected that an access that matches the condition of the watchpoint is generated by executing the instruction remaining in the pipeline (cycle C9).
分析部22は、ウォッチポイントのHALTイベントが発生したことを実行制御部21Xに通知する。ところが、このとき既にステートマシン211(EXSM)は「停止状態(DSUSP)」を示しているため、実行制御部21Xはプログラムの実行停止を要求するリクエスト信号WP−RQを出力せず、分析部22からの通知を無視する。その結果、命令処理部10XからHALTイベントに対する応答信号(HALT_ACK)は出力されないので、このHALTイベントはデバッグ状態レジスタ24(DBGSTAT)にセットされない。すなわち、停止命令(ESTOP)より前にデコードされた命令に由来するHALTイベントが発生しているにも関わらず、その事実がデバッグ状態レジスタ24(DBGSTAT)に正しく反映されないという問題が生じる。 The analysis unit 22 notifies the execution control unit 21X that a watchpoint HALT event has occurred. However, at this time, since the state machine 211 (EXSM) already indicates the “stop state (DSUSP)”, the execution control unit 21X does not output the request signal WP-RQ requesting the program execution stop, and the analysis unit 22 Ignore notifications from. As a result, since the response signal (HALT_ACK) to the HALT event is not output from the instruction processing unit 10X, this HALT event is not set in the debug status register 24 (DBGSTAT). That is, there is a problem that despite the occurrence of a HALT event derived from an instruction decoded before the stop instruction (ESTOP), the fact is not correctly reflected in the debug status register 24 (DBGSTAT).
<1−2> プログラムの実行を停止する際の遷移期間にHALTイベントと割り込みが発生する場合 <1-2> When a HALT event and interrupt occur during the transition period when program execution is stopped
図4は、図2に示すプロセッサにおいて、プログラムの実行を停止する際の遷移期間にHALTイベント(ウォッチポイント)と割り込みが発生する場合の第1の動作例を示すタイミング図である。
図4(A)は、命令処理部10XのクロックCLKを示す。
図4(B),(C)は、割り込み時において命令処理部10Xの動作状態の情報(ステータス情報)をスタックへ保存するためのバスFDBUS,EDBUSをそれぞれ示す。
図4(D)は、デバッグ状態レジスタ24(DBGSTAT)の記憶情報が出力されるバスDBGSBUSを示す。
図4(E)は、デバッグ状態レジスタ24(DBGSTAT)の記憶情報をスタックへ保存する際に「1」となる信号SAVESTSを示す。
図4(F)は、停止状態において割り込みを受け付けた場合に命令処理部10Xが出力する応答信号RTINTACKを示す。
図4(G)は、命令処理部10Xのステータス情報をスタックへ保存する動作の開始時に「1」となる信号PUSHSTRTを示す。
図4(H)は、デバッグ状態レジスタ24(DBGSTAT)の記憶情報を示す。
図4(I)は、プログラム実行中のデバッグ動作を制限する場合に「1」となるフラグデータDBGMを示す。
図4(J)は、優先度の高い割り込みによって他の割り込みの重複やデバッグ動作を制限する場合に「1」となるフラグデータHPIを示す。
図4(K)は、割り込みを受け付けたときに直前のバックグラウンド・コードが実行停止中であった場合「1」となるフラグデータIDS_ACTを示す。
図4(L)は、ステートマシン211(EXSM)のステート(命令処理部10Xの実行状態)を示す。
図4(M)は、バックグラウンド・コードからの割り込みの階層を示す5ビットのデータ(DFC)を示す
図4(N),(O),(P),(Q),(R),(S),(T),(U),(V)は、それぞれ、パイプラインの段階「PRE−DEC」,「DECODE」,「ADDRESS」,「ACCESS1」,「ACCESS2」,「READ」,「EXE」,「WRITE1」,「WRITE2」において処理される命令を示す。
FIG. 4 is a timing diagram showing a first operation example when a HALT event (watchpoint) and an interrupt occur in the transition period when the execution of the program is stopped in the processor shown in FIG.
FIG. 4A shows the clock CLK of the instruction processing unit 10X.
FIGS. 4B and 4C respectively show buses FDBUS and EDBUS for saving information (status information) on the operation state of the instruction processing unit 10X to the stack at the time of an interrupt.
FIG. 4D shows the bus DBGSBUS to which the stored information of the debug status register 24 (DBGSTAT) is output.
FIG. 4E shows a signal SAVEESTS that becomes “1” when the information stored in the debug status register 24 (DBGSTAT) is saved in the stack.
FIG. 4F shows a response signal RINTACK output from the instruction processing unit 10X when an interrupt is accepted in the stopped state.
FIG. 4G shows a signal PUSHSTRT that becomes “1” at the start of the operation of saving the status information of the instruction processing unit 10X in the stack.
FIG. 4H shows information stored in the debug status register 24 (DBGSTAT).
FIG. 4I shows flag data DBGM that becomes “1” when the debugging operation during program execution is limited.
FIG. 4J shows flag data HPI that becomes “1” when another interrupt is overlapped or a debug operation is restricted by a high-priority interrupt.
FIG. 4K shows flag data IDS_ACT that becomes “1” when the immediately preceding background code is suspended when an interrupt is accepted.
FIG. 4L shows a state of the state machine 211 (EXSM) (execution state of the instruction processing unit 10X).
4 (M) shows 5-bit data (DFC) indicating the hierarchy of interrupts from the background code. FIG. 4 (N), (O), (P), (Q), (R), ( S), (T), (U), and (V) are pipeline stages “PRE-DEC”, “DECODE”, “ADDRESS”, “ACCESS1”, “ACCESS2”, “READ”, “EXE, respectively. ”,“ WRITE1 ”, and“ WRITE2 ”indicate instructions to be processed.
命令処理部10Xは、ソフトウェア・ブレークポイントの停止命令(ESTOP)をプリデコードすると(サイクルC51)、新たな命令のデコードを停止し、このHALTイベントに対する応答信号HALT_ACKを発生する(サイクルC52)。デバック部20Xは、この応答信号HALT_ACKを受けて、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグをセットするともに、ステートマシン211(EXSM)のステートを「実行状態(EXE)」から「停止状態(DSUSP)」に更新する(サイクルC53)。このとき、パイプラインの実行段階を処理する命令実行部13には、停止命令(ESTOP)より前にデコードされた命令(N〜N−5)が残っている。命令実行部13は、これらの命令を順次に実行する(サイクルC53〜C58)。 When the instruction processing unit 10X predecodes the software breakpoint stop instruction (ESTOP) (cycle C51), it stops decoding a new instruction and generates a response signal HALT_ACK for this HALT event (cycle C52). The debug unit 20X receives the response signal HALT_ACK, sets the HALT event flag of the debug state register 24 (DBGSTAT), and changes the state of the state machine 211 (EXSM) from “execution state (EXE)” to “stop state ( DSUSP) "(cycle C53). At this time, the instruction (N to N-5) decoded before the stop instruction (ESTOP) remains in the instruction execution unit 13 that processes the execution stage of the pipeline. The instruction execution unit 13 executes these instructions sequentially (cycles C53 to C58).
このパイプラインに残る命令を実行しているとき、命令処理部10Xは、デバッグ動作よりも優先される割り込み要求を受ける(サイクルC53)。命令処理部10Xは、この割り込み要求に対して、応答信号RTINTACKを出力する(サイクルC54)。デバック部20Xは、この応答信号RTINTACKを受けて、ステートマシン211(EXSM)を「停止状態(DSUSP)」から「停止中の割り込み状態(IDS:interrupt during suspend)」に更新する(サイクルC55)。 When executing the instruction remaining in the pipeline, the instruction processing unit 10X receives an interrupt request that has priority over the debug operation (cycle C53). In response to this interrupt request, the instruction processing unit 10X outputs a response signal RINTACK (cycle C54). Upon receiving this response signal RINTACK, the debugging unit 20X updates the state machine 211 (EXSM) from “suspended state (DSUSP)” to “interrupt state suspended (IDS)” (cycle C55).
命令処理部10Xは、割り込みの受け付けに伴って、ステータス・レジスタ(ST0〜ST2)等の情報をスタックに保存する処理を開始する。すなわち、命令処理部10Xは、割り込み要求を受け付けると、スタックに保存する所定のレジスタの情報をバスへ出力する(サイクルC60〜62)。図4の例では、命令処理部10Xの動作状態を示すステータス・レジスタST0〜ST2やプログラム・カウンタPCH,PCL(不図示)、デバッグ部20Xのデバッグ状態レジスタ24(DBGSTAT)の記憶情報をそれぞれバスへ出力する。また、命令処理部10Xは、割り込みルーチンを開始する前に、各レジスタの記憶情報(ステータス・レジスタのフラグデータDBGMなど)を初期値に設定する。
デバック部20Xは、命令処理部10Xにおいて上述した保存処理が開始されると、割り込み階層のデータ(DFC)を「1」だけ増加させる(サイクルC59)。そして、デバッグ状態レジスタ24(DBGSTAT)の保存処理が行われる時点(サイクルC61)において、HALTイベントフラグを全てクリアし、フラグデータHPI,IDS_ACTをそれぞれ「1」に設定する。
The instruction processing unit 10X starts processing for storing information such as the status registers (ST0 to ST2) in the stack in response to acceptance of the interrupt. That is, when receiving an interrupt request, the instruction processing unit 10X outputs information on a predetermined register stored in the stack to the bus (cycles C60 to C62). In the example of FIG. 4, information stored in the status registers ST0 to ST2 indicating the operating state of the instruction processing unit 10X, the program counters PCH and PCL (not shown), and the debug status register 24 (DBGSTAT) of the debugging unit 20X are respectively buses. Output to. Further, the instruction processing unit 10X sets storage information (such as status register flag data DBGM) in each register to an initial value before starting an interrupt routine.
The debugging unit 20X increases the data (DFC) of the interrupt hierarchy by “1” when the above-described storage process is started in the instruction processing unit 10X (cycle C59). Then, at the time when the save processing of the debug status register 24 (DBGSTAT) is performed (cycle C61), all the HALT event flags are cleared, and the flag data HPI and IDS_ACT are set to “1”, respectively.
一方、分析部22は、予め設定された条件に従って、命令処理部10によるメモリへのアクセスを監視している。そして、上述した割り込みにより「停止中の割り込み状態(IDS)」のステートに移行したとき、パイプラインに残存する命令の実行によって、ウォッチポイントの条件に一致するアクセスが発生したことを検出する(サイクルC57)。 On the other hand, the analysis unit 22 monitors the access to the memory by the instruction processing unit 10 according to preset conditions. Then, when a transition to the “suspended interrupt state (IDS)” state occurs due to the above-described interrupt, it is detected that an access that matches the watchpoint condition has occurred due to the execution of the instruction remaining in the pipeline (cycle) C57).
実行制御部21Xは、分析部22からウォッチポイントのHALTイベントを通知されると、このとき「停止状態(DSUSP)」のステートではないので、プログラムの実行停止を要求するリクエスト信号WP−RQを命令処理部10Xに出力する(サイクルC57)。リクエスト信号WP−RQを受けた命令処理部10Xは、デバッグ部20Xに応答信号HALT_ACKを出力する(サイクルC58)。命令処理部10Xからの応答信号HALT_ACKを受けたデバッグ部20Xは、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグをセットするともに、ステートマシン211(EXSM)のステートを「停止中の割り込み状態(IDS)」から再び「停止状態(DSUSP)」へ戻す(サイクルC59)。 When the execution control unit 21X is notified of the watchpoint HALT event from the analysis unit 22, the execution control unit 21X is not in the “stop state (DSUSP)” state at this time, and therefore issues a request signal WP-RQ requesting the program execution stop. The data is output to the processing unit 10X (cycle C57). The instruction processing unit 10X that has received the request signal WP-RQ outputs a response signal HALT_ACK to the debugging unit 20X (cycle C58). Receiving the response signal HALT_ACK from the instruction processing unit 10X, the debug unit 20X sets the HALT event flag of the debug state register 24 (DBGSTAT) and sets the state of the state machine 211 (EXSM) to “stopped interrupt state (IDS). ) ”Again to“ stop state (DSUSP) ”(cycle C59).
以上のように、プログラムの実行が停止される際の遷移期間において割り込み命令とHALTイベントが重複した結果、割り込みルーチン(フォアグラウンド・コード)へ移ったとき、ステートマシン211(EXSM)のステートは「停止状態(DSUSP)」になる(サイクルC59〜)。命令処理部10Xは、このステートに従って、割り込みルーチンの先頭から命令の処理を停止する(サイクルC63)。すなわち、割り込み要求を受け付ける前にデコードされた命令(バックグラウンド・コード)に由来するHALTイベントが、割り込みルーチン(フォアグラウンド・コード)における命令の実行を止めてしまうという問題が生じる。
また、この場合、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグは割り込みに伴う保存処理が行われると同時に全てクリアされてしまうので、HALTイベントに応じてプログラムの実行が停止されたのに、その原因を示す情報がデバッグ状態レジスタ24(DBGSTAT)に記録されていないこととなる。その結果、ホスト装置においてプログラムの実行停止原因を把握できないという問題が生じる。
As described above, the state of the state machine 211 (EXSM) is “stopped” when the interrupt instruction (foreground code) is moved as a result of the overlap of the interrupt instruction and the HALT event in the transition period when the program execution is stopped. State (DSUSP) "(cycle C59-). The instruction processing unit 10X stops instruction processing from the beginning of the interrupt routine according to this state (cycle C63). That is, there arises a problem that a HALT event derived from an instruction (background code) decoded before accepting an interrupt request stops execution of the instruction in the interrupt routine (foreground code).
In this case, since the HALT event flag of the debug status register 24 (DBGSTAT) is all cleared at the same time as the saving process associated with the interrupt is performed, the execution of the program is stopped in response to the HALT event. Information indicating the cause is not recorded in the debug status register 24 (DBGSTAT). As a result, there arises a problem that the cause of the program execution stoppage cannot be grasped in the host device.
図5は、図2に示すプロセッサにおいて、プログラムの実行を停止する際の遷移期間にHALTイベント(ウォッチポイント)と割り込みが発生する場合の第2の動作例を示すタイミング図である。図5(A)〜(V)は、それぞれ図4(A)〜(V)に対応する。 FIG. 5 is a timing chart showing a second operation example when a HALT event (watchpoint) and an interrupt are generated in the transition period when program execution is stopped in the processor shown in FIG. FIGS. 5A to 5V correspond to FIGS. 4A to 4V, respectively.
図5に示す第2の動作例では、図4に示す第1の動作例に比べて、ウォッチポイントによるHALTイベントの発生時点が3サイクル遅くなっている。サイクルC101〜C106までの動作については、図4におけるサイクルC51〜C56と同じである。 In the second operation example shown in FIG. 5, the generation time point of the HALT event by the watchpoint is delayed by three cycles compared to the first operation example shown in FIG. 4. The operations from the cycles C101 to C106 are the same as the cycles C51 to C56 in FIG.
実行制御部21Xは、サイクルC103で受け付けた割り込み命令に応じて、まずデバッグ状態レジスタ24(DBGSTAT)に格納される割り込み階層のデータ(DFC)を「1」だけ増加させる(サイクルC109)。
次いで、命令処理部10Xは、スタックに保存する所定のレジスタの情報をバスへ出力する(サイクルC110〜112)。
その後、命令処理部10Xは、割り込みルーチンを開始するために、各レジスタの記憶情報をクリアする(サイクルC111)。またこのとき、デバッグ部20Xは、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグを全てクリアし、フラグデータHPI,IDS_ACTをそれぞれ「1」に設定する。
The execution control unit 21X first increases the interrupt hierarchy data (DFC) stored in the debug status register 24 (DBGSTAT) by “1” in response to the interrupt instruction received in cycle C103 (cycle C109).
Next, the instruction processing unit 10X outputs information on a predetermined register stored in the stack to the bus (cycles C110 to 112).
Thereafter, the instruction processing unit 10X clears the storage information of each register in order to start the interrupt routine (cycle C111). At this time, the debug unit 20X clears all the HALT event flags in the debug status register 24 (DBGSTAT), and sets the flag data HPI and IDS_ACT to “1”, respectively.
一方、分析部22は、予め設定された条件に従って、命令処理部10によるメモリへのアクセスを監視している。そして、「停止中の割り込み状態(IDS)」においてステータス情報をスタックに保存しているとき、パイプラインに残存する命令の実行によって、ウォッチポイントの条件に一致するアクセスが発生したことを検出する(サイクルC110)。 On the other hand, the analysis unit 22 monitors the access to the memory by the instruction processing unit 10 according to preset conditions. Then, when status information is stored in the stack in the “interrupt state (IDS) being stopped”, it is detected that an access that matches the condition of the watchpoint has occurred due to execution of an instruction remaining in the pipeline ( Cycle C110).
実行制御部21Xは、分析部22からウォッチポイントのHALTイベントを通知される
と、命令処理部10Xに対してプログラムの実行停止を要求するリクエスト信号WP−RQを出力する(サイクルC110)。リクエスト信号WP−RQを受けた命令処理部10Xは、これに対する応答信号HALT_ACKを出力する(サイクルC111)。命令処理部10Xからの応答信号HALT_ACKを受けたデバッグ部20Xは、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグをセットするともに、ステートマシン211(EXSM)のステートを「停止中の割り込み状態(IDS)」から「停止状態(DSUSP)」へ更新する(サイクルC112)。
When notified of the watchpoint HALT event from the analysis unit 22, the execution control unit 21X outputs a request signal WP-RQ requesting the instruction processing unit 10X to stop executing the program (cycle C110). Upon receiving the request signal WP-RQ, the instruction processing unit 10X outputs a response signal HALT_ACK to the request processing unit 10X (cycle C111). Receiving the response signal HALT_ACK from the instruction processing unit 10X, the debug unit 20X sets the HALT event flag of the debug state register 24 (DBGSTAT) and sets the state of the state machine 211 (EXSM) to “stopped interrupt state (IDS). ) "To" stop state (DSUSP) "(cycle C112).
サイクルC111の時点では、デバッグ状態レジスタ24(DBGSTAT)の記憶情報は割り込みルーチンに備えてクリアされているのに、デバッグ部20Xは、遷移期間中に発生したHALTイベントに応じて、そのクリアされたデバッグ状態レジスタ24(DBGSTAT)を書き換えてしまう。すなわち、割り込みの発生前に生じたHALTイベントが割り込みルーチン内で生じたかのようにデバッグ状態レジスタ24(DBGSTAT)の記憶情報を書き換えてしまうという問題が生じる。 At the time of cycle C111, the information stored in the debug status register 24 (DBGSTAT) is cleared in preparation for the interrupt routine, but the debug unit 20X has cleared the information in response to the HALT event that occurred during the transition period. The debug status register 24 (DBGSTAT) is rewritten. That is, there arises a problem that information stored in the debug status register 24 (DBGSTAT) is rewritten as if the HALT event that occurred before the occurrence of the interrupt occurred in the interrupt routine.
<1−3> 割り込みルーチンから復帰してプログラムを停止する際の遷移期間にHALTイベントが発生する場合 <1-3> When a HALT event occurs during the transition period when returning from the interrupt routine and stopping the program
図6は、図2に示すプロセッサにおいて、割り込みルーチンから復帰してプログラムを停止する際の遷移期間にHALTイベントが発生する場合の動作の一例を示すタイミング図である。
図6(A)は、命令処理部10XのクロックCLKを示す。
図6(B),(C)は、割り込みから復帰する時において、スタックに保存された命令処理部10Xのステータス情報を所定のレジスタへ戻すためのバスCDBUS,DDBUSをそれぞれ示す。
図6(D)は、スタックからデバッグ状態レジスタ24(DBGSTAT)へ情報を戻す際に「1」となる信号RE−DSTATを示す。
図6(E)は、割り込みからの復帰命令に応じて命令処理部10Xが出力する応答信号RETIACKを示す。
図6(F)は、スタックから所定のレジスタへステータス情報を戻す動作の終了時に「1」となる信号POPENDを示す。
図6(G)は、デバッグ状態レジスタ24(DBGSTAT)の記憶情報を示す。
図6(H)は、プログラム実行中のデバッグ動作を制限する場合に「1」となるフラグデータDBGMを示す。
図6(I)は、優先度の高い割り込みによって他の割り込みの重複やデバッグ動作を制限する場合に「1」となるフラグデータHPIを示す。
図6(J)は、割り込みを受け付けたときに直前のバックグラウンド・コードが実行停止中であった場合「1」となるフラグデータIDS_ACTを示す。
図6(K)は、ステートマシン211(EXSM)のステート(命令処理部10Xの実行状態)を示す。
図6(L)は、バックグラウンド・コードからの割り込みの階層を示す5ビットのデータ(DFC)を示す
図6(M),(N),(O),(P),(Q),(R),(S),(T),(U)は、それぞれ、パイプラインの段階「PRE−DEC」,「DECODE」,「ADDRESS」,「ACCESS1」,「ACCESS2」,「READ」,「EXE」,「WRITE1」,「WRITE2」において処理される命令を示す。
FIG. 6 is a timing chart showing an example of operation when a HALT event occurs in the transition period when returning from the interrupt routine and stopping the program in the processor shown in FIG.
FIG. 6A shows the clock CLK of the instruction processing unit 10X.
FIGS. 6B and 6C respectively show buses CDBUS and DDBUS for returning the status information of the instruction processing unit 10X stored in the stack to a predetermined register when returning from the interrupt.
FIG. 6D shows a signal RE-DSTAT that becomes “1” when information is returned from the stack to the debug status register 24 (DBGSTAT).
FIG. 6E shows a response signal RETIACK output by the instruction processing unit 10X in response to a return instruction from an interrupt.
FIG. 6F shows a signal POPEND that becomes “1” at the end of the operation of returning the status information from the stack to a predetermined register.
FIG. 6G shows information stored in the debug status register 24 (DBGSTAT).
FIG. 6H shows flag data DBGM that becomes “1” when the debugging operation during program execution is limited.
FIG. 6I shows flag data HPI that is set to “1” when duplication of other interrupts or a debug operation is restricted by an interrupt having a high priority.
FIG. 6J shows flag data IDS_ACT that becomes “1” when the immediately preceding background code is suspended when an interrupt is accepted.
FIG. 6K shows the state of the state machine 211 (EXSM) (execution state of the instruction processing unit 10X).
FIG. 6 (L) shows 5-bit data (DFC) indicating the hierarchy of interrupts from the background code. FIG. 6 (M), (N), (O), (P), (Q), ( R), (S), (T), and (U) are pipeline stages “PRE-DEC”, “DECODE”, “ADDRESS”, “ACCESS1”, “ACCESS2”, “READ”, “EXE, respectively. ”,“ WRITE1 ”, and“ WRITE2 ”indicate instructions to be processed.
命令処理部10Xは、割り込みルーチンにおいて復帰命令(RTI−R)をプリデコードすると(サイクルC152)、新たな命令のデコードを停止して、応答信号RETIACKを出力する(サイクルC153)。そして、割り込みルーチンの実行前にスタックへ保存された情報をバスCDBUS,DDBUSに出力し、所定のレジスタへ戻す。
スタックの情報がデバッグ状態レジスタ24(DBGSTAT)へ戻されると、これに記憶されるフラグデータHPI,IDS_ACKは、割り込み前の状態、すなわち値「0」の状態へそれぞれ戻る(サイクルC159)。割り込みの階層を示すデータ(DFC)については、スタックへ保存する前に「1」を加算しているため、実行制御部21Xは、スタックの情報が所定のレジスタへ戻された後、「DFC」の値から「1」を減算する(サイクルC160)。
フラグデータDBGMは、デバッグ状態レジスタ24(DBGSTAT)とは別のレジスタ(例えばステータス・レジスタST2)に格納されており、フラグデータHPI,IDS_ACTより遅れたタイミングで割り込み前の状態(値「0」)に戻る(サイクルC161)。
When the instruction processing unit 10X predecodes the return instruction (RTI-R) in the interrupt routine (cycle C152), the instruction processing unit 10X stops decoding the new instruction and outputs the response signal RETIACK (cycle C153). Then, the information stored in the stack before the execution of the interrupt routine is output to the buses CDBUS and DDBUS and returned to a predetermined register.
When the stack information is returned to the debug status register 24 (DBGSTAT), the flag data HPI and IDS_ACK stored therein return to the state before the interrupt, that is, the value “0” (cycle C159). The data (DFC) indicating the interrupt hierarchy is incremented by “1” before being stored in the stack, so that the execution control unit 21X returns “DFC” after the stack information is returned to a predetermined register. “1” is subtracted from the value of (cycle C160).
The flag data DBGM is stored in a register (for example, status register ST2) different from the debug status register 24 (DBGSTAT), and the state before the interrupt (value “0”) is delayed from the flag data HPI, IDS_ACT. (Cycle C161).
またデバッグ部20Xは、スタックへ保存された情報をレジスタへ戻す際、ステートマシン211(EXSM)のステートを「停止状態(DSUSP)」に更新する。 The debug unit 20X updates the state of the state machine 211 (EXSM) to “stop state (DSUSP)” when returning the information stored in the stack to the register.
一方、分析部22は、予め設定された条件に従って、命令処理部10によるメモリへのアクセスを監視している。そして、スタックからレジスタへステータス情報が戻される直前において、命令実行部13のパイプラインに残存する命令の実行によって、ウォッチポイントの条件に一致するアクセスが発生したことを検出する(サイクルC156)。 On the other hand, the analysis unit 22 monitors the access to the memory by the instruction processing unit 10 according to preset conditions. Then, immediately before the status information is returned from the stack to the register, it is detected that an access that matches the watchpoint condition has occurred due to the execution of the instruction remaining in the pipeline of the instruction execution unit 13 (cycle C156).
実行制御部21Xは、分析部22からウォッチポイントのHALTイベントを通知されると、命令処理部10Xに対してプログラムの実行停止を要求するリクエスト信号WP−RQを出力する(サイクルC156)。リクエスト信号WP−RQを受けた命令処理部10Xは、これに対する応答信号HALT_ACKを出力する(サイクルC157)。命令処理部10Xからの応答信号HALT_ACKを受けたデバッグ部20Xは、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグをセットするともに、ステートマシン211(EXSM)のステートを「停止中の割り込み状態(IDS)」から「停止状態(DSUSP)」へ更新する(サイクルC158)。 When notified of the watchpoint HALT event from the analysis unit 22, the execution control unit 21X outputs a request signal WP-RQ requesting the instruction processing unit 10X to stop the execution of the program (cycle C156). Upon receiving the request signal WP-RQ, the instruction processing unit 10X outputs a response signal HALT_ACK to the request processing unit 10X (cycle C157). Receiving the response signal HALT_ACK from the instruction processing unit 10X, the debug unit 20X sets the HALT event flag of the debug state register 24 (DBGSTAT) and sets the state of the state machine 211 (EXSM) to “stopped interrupt state (IDS). ) "To" stop state (DSUSP) "(cycle C158).
ここで、サイクルC158においてウォッチポイントのHALTイベントの発生を示すようにセットされたHALTイベントフラグは、その直後のサイクルC159においてスタックから戻される情報により書き換えられてしまう。そのため、わざわざウォッチポイントを設定したにもかかわらず、そのHALTイベントが発生した事実を把握できないという問題が生じる。 Here, the HALT event flag set so as to indicate the occurrence of the watchpoint HALT event in cycle C158 is rewritten by the information returned from the stack in cycle C159 immediately thereafter. For this reason, there is a problem that the fact that the HALT event has occurred cannot be grasped even though the watchpoint is purposely set.
<1−4> 割り込みによってデバッグ・フレーム(割り込みの階層)が変わるときDMA部23のアクセスが生じる場合 <1-4> Access to the DMA unit 23 occurs when the debug frame (interrupt hierarchy) changes due to an interrupt
割り込み命令によりデバッグ・フレーム(割り込みの階層)が変わるとき、デバッグ状態レジスタ24(DBGSTAT)等に格納される命令処理部10Xのステータス情報は、全て一斉に更新されるのではなく、部分的に異なるタイミングで更新される。そのため、DMA部23の機能によって生成されたメモリアクセス要求(例えばレジスタ値の読
み出し命令)がこのデバッグ・フレームの変わり目において実行され、命令処理部10Xのステータス情報が読み出された場合、その個々の情報の間で相関がないという問題がある。
When the debug frame (interrupt hierarchy) is changed by an interrupt instruction, the status information of the instruction processing unit 10X stored in the debug status register 24 (DBGSTAT) or the like is not updated all at once but is partially different. Updated with timing. Therefore, when a memory access request (for example, a register value read instruction) generated by the function of the DMA unit 23 is executed at the transition of the debug frame and the status information of the instruction processing unit 10X is read out, There is a problem that there is no correlation between information.
例えば、図4のサイクルC55において、命令処理部10Xの実行状態のステート(EXSM)は「停止中の割り込み状態(IDS)」であるので、この場合、割り込みの階層を示す「DFC」の値は「0x00」、フラグデータDBGM,HPI,IDS_ACTの値はそれぞれ「1」になっていなければならない。しかしながら実際は、図4に示すように、「DFC」の値は「0x1F」、フラグデータDBGM,HPI,IDS_ACTの値はそれぞれ「0」になっており、「停止中の割り込み状態(IDS)」のステートに対応していない。
このような場合、DMA部23がデバッグ状態レジスタ24(DBGSTAT)等に格納されるステータス情報を読み出すと、デバッグ作業において意味のない無駄な情報がユーザに提示されてしまう。
For example, in cycle C55 of FIG. 4, the execution state (EXSM) of the instruction processing unit 10X is “stopped interrupt state (IDS)”. In this case, the value of “DFC” indicating the interrupt hierarchy is The values of “0x00”, flag data DBGM, HPI, and IDS_ACT must be “1”. However, in actuality, as shown in FIG. 4, the value of “DFC” is “0x1F”, the values of flag data DBGM, HPI, and IDS_ACT are “0”, respectively. The state is not supported.
In such a case, when the DMA unit 23 reads the status information stored in the debug status register 24 (DBGSTAT) or the like, useless information that is meaningless in debugging work is presented to the user.
<1−5> プログラムの実行を停止する際の遷移期間にデバッグ部20Xのコマンドが実行される場合 <1-5> When the command of the debug unit 20X is executed during the transition period when program execution is stopped
プログラムの実行を停止する際の遷移期間において、デバッグ部20Xにより例えばRUNCコマンドが発行されると、次のような問題が生じる。
この場合、命令処理部10Xは、RUNCコマンドに応じてプログラムの実行を再開すし、ステートマシン211(EXSM)のステートは「停止状態(DSUSP)」から「実行状態(EXE)」に変化する。このステートの変化は、遷移期間の途中で起きる可能性があり、この場合、ステート変化時点より前に既に命令処理部10Xにおいて処理中であった命令に起因したHALTイベント(例えばアドレス/データ・ウォッチポイント)がステート変化後に発生する可能性がある。もしこのようなHALTイベントが発生すると、命令処理部10Xのステートは「実行状態(EXE)」から再び「停止状態(DSUSP)」へ戻ってしまう。
ここで、命令処理部10Xの処理を停止させる原因となったHALTイベントは、RUNCコマンドの発行以前に既に命令処理部10Xで処理が開始された命令に由来するイベントであり、本来、RUNCコマンドの停止条件に含まれていない。つまり、RUNCコマンドの停止条件に含まれていない停止命令によって命令処理部10Xが停止してまうという問題が生じる。
When, for example, a RUNC command is issued by the debug unit 20X during the transition period when program execution is stopped, the following problem occurs.
In this case, the instruction processing unit 10X resumes execution of the program in response to the RUNC command, and the state of the state machine 211 (EXSM) changes from “stopped state (DSUSP)” to “executed state (EXE)”. This state change may occur in the middle of the transition period. In this case, a HALT event (for example, an address / data watch) caused by an instruction already being processed in the instruction processing unit 10X before the state change time. Point) may occur after a state change. If such a HALT event occurs, the state of the instruction processing unit 10X returns from the “execution state (EXE)” to the “stop state (DSUSP)” again.
Here, the HALT event that has caused the processing of the instruction processing unit 10X to stop is an event derived from an instruction that has already been processed by the instruction processing unit 10X before issuing the RUNC command. Not included in the stop condition. That is, there is a problem that the instruction processing unit 10X is stopped by a stop instruction that is not included in the stop condition of the RUNC command.
また、割り込みルーチンから復帰してプログラムを停止する際の遷移期間において(図6参照)、デバッグ部20Xにより例えばRUNCコマンドが発行されると、次のような問題が生じる。
図6の例のサイクルC158〜C159において、デバッグ・フレームの階層を示す「DFC」(図6(L))の値は「0x00」であり、フォアグラウンド・コードを示しているが、ステートマシン211(EXSM)のステート(図6(K))は「停止状態(DSUSP)」であり、バックグラウンド・コードを示している。すなわち、サイクルC158〜C159においてはデバッグ・フレームの境界が重なり合った状態になっている。
RUNCコマンドがサイクルC158より前に発行された場合、ステートマシン211(EXSM)のステートは「停止中の割り込み状態(IDS)」にあることから、既に実行中の状態で更に実行開始を指示する無駄なコマンドが入力されたと解釈されて、RUNCコマンドは無視される。
ところが、サイクルC158〜C159においてRUNCコマンドが発行された場合、ステートは「停止状態(DSUSP)」にあることから、RUNCコマンドのリクエスト信号EXE_RQが命令処理部10Xにおいて有効に受け付けられてしまう。そうすると、バックグラウンド・コードに復帰した際、命令処理部10Xは「実行状態(EXE)」となってしまい、プログラムがそのまま実行されてしまう。
ここで、サイクルC158〜C159において命令処理部10Xに受け付けられたRUNCコマンドは、フォアグラウンド・コード(DFC=「0x00」)に対して発行されたコマンドであるから、本来、バックグラウンド・コードにおける処理の実行に影響を与えるべきではない。つまり、デバッグ部20Xにおいて発行された実行コマンドが、意図しないデバッグ・フレームにおいて実行されてしまうという問題が生じる。
Further, in the transition period when returning from the interrupt routine and stopping the program (see FIG. 6), for example, when the RUNNC command is issued by the debug unit 20X, the following problem occurs.
In the cycles C158 to C159 in the example of FIG. 6, the value of “DFC” (FIG. 6 (L)) indicating the hierarchy of the debug frame is “0x00”, indicating the foreground code, but the state machine 211 ( The state of EXSM) (FIG. 6K) is “stopped state (DSUSP)” and indicates a background code. That is, in the cycles C158 to C159, the debug frame boundaries are overlapped.
If the RUNC command is issued before cycle C158, the state of the state machine 211 (EXSM) is in the “interrupt state (IDS) being stopped”, so it is unnecessary to instruct the start of execution in the already executed state. RUNC command is ignored.
However, when the RUNC command is issued in cycles C158 to C159, since the state is in the “stop state (DSUSP)”, the request signal EXE_RQ of the RUNC command is effectively accepted by the instruction processing unit 10X. Then, when returning to the background code, the instruction processing unit 10X becomes “execution state (EXE)” and the program is executed as it is.
Here, since the RUNC command received by the instruction processing unit 10X in the cycles C158 to C159 is a command issued to the foreground code (DFC = “0x00”), the processing of the background code is inherently performed. Should not affect execution. That is, there is a problem that an execution command issued in the debug unit 20X is executed in an unintended debug frame.
<1−6> プログラムの実行停止時に割り込みを受け付けた後、HALTイベントが発生した場合 <1-6> When a HALT event occurs after accepting an interrupt when program execution is stopped
例えばアクセススピードが遅い外部メモリ等へ書き込みアクセスを行う場合などにおいて、パイプライン保護部14がパイプライン保護サイクルを挿入すると、命令処理部10Xはパイプライン処理の進行を一時的に停止した「ストール」と呼ばれる状態になる。
もし、命令処理部10Xにおける命令の処理が停止される際の遷移期間において割り込みが発生し、更にその遷移期間において上記のストールが発生すると、ストールによるパイプライン処理の停止の影響を受けて、割り込みに伴うスタックへの保存処理の実行が遅れる。この遅れがある程度より長くなると、スタックへの保存処理を実行する前に、割り込みルーチンの最初又は2番目の命令のプリデコードが行われる。
ここで、割り込みルーチンの最初又は2番目の命令がソフトウェア・ブレークポイントの停止命令(ESTOP)であったり、あるいはそれらの命令にハードウェア・ブレークポイントがセットされている場合、プリデコードの実行によって有効なHALTイベントが発生する。HALTイベントが発生すると、このHALTイベントに対応するデバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグがセットされる。
しかしながら、HALTイベントフラグのセットを行った後でスタックへの保存処理が行われると、その保存処理の完了とともにHALTイベントフラグは初期値へクリアされてしまう。割り込みルーチンへ移行したとき、命令処理部10Xは正しく停止状態になるものの、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグは初期値にクリアされているため、なぜ命令処理部10Xが停止したのか、その原因を知ることができない。すなわち、プログラムの実行は割り込みルーチン内で停止されているのに、あたかもそのHALTイベントは割り込みを受け付ける前に起こったものと見なされ、デバッグ状態レジスタ24(DBGSTAT)は実行停止の理由を正しく示すことができないという問題が生じる。
For example, when performing write access to an external memory or the like with a slow access speed, when the pipeline protection unit 14 inserts a pipeline protection cycle, the instruction processing unit 10X temporarily stops the progress of the pipeline processing “stall” It becomes a state called.
If an interrupt occurs during the transition period when instruction processing in the instruction processing unit 10X is stopped, and the above stall occurs during the transition period, the interrupt is affected by the suspension of pipeline processing due to the stall. Execution of saving processing to the stack is delayed. If this delay becomes longer than a certain level, the first or second instruction of the interrupt routine is predecoded before executing the saving process to the stack.
Here, if the first or second instruction of the interrupt routine is a software breakpoint stop instruction (ESTOP), or if a hardware breakpoint is set for those instructions, it is enabled by executing predecode. A HALT event occurs. When a HALT event occurs, the HALT event flag of the debug status register 24 (DBGSTAT) corresponding to this HALT event is set.
However, if the saving process to the stack is performed after setting the HALT event flag, the HALT event flag is cleared to the initial value when the saving process is completed. When the process proceeds to the interrupt routine, the instruction processing unit 10X is correctly stopped, but the HALT event flag of the debug status register 24 (DBGSTAT) is cleared to the initial value, so why the instruction processing unit 10X is stopped? I cannot know the cause. That is, program execution is stopped in the interrupt routine, but the HALT event is considered to have occurred before accepting the interrupt, and the debug status register 24 (DBGSTAT) correctly indicates the reason for execution stop. The problem that cannot be done.
図7は、図2に示すプロセッサにおいて、プログラムの実行を停止する際の遷移期間に割り込みが発生し、更にその割り込みルーチンの先頭が停止命令(ESTOP)である場合の動作の一例を示すタイミング図である。図7(A)〜(V)は、それぞれ図4(A)〜(V)に対応する。 FIG. 7 is a timing chart showing an example of operation in the processor shown in FIG. 2 when an interrupt occurs during a transition period when program execution is stopped and the top of the interrupt routine is a stop instruction (ESTOP). It is. FIGS. 7A to 7V correspond to FIGS. 4A to 4V, respectively.
命令処理部10Xは、ソフトウェア・ブレークポイントの停止命令(ESTOP)をプリデコードすると(サイクルC175)、新たな命令のデコードを停止し、このHALTイベントに対する応答信号HALT_ACKを発生する(サイクルC176)。デバック部20Xは、この応答信号HALT_ACKを受けて、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグをセットするともに、ステートマシン211(EXSM)のステートを「実行状態(EXE)」から「停止状態(DSUSP)」に更新する(サイクルC177)。命令実行部13は、停止命令(ESTOP)より前にデコードされた命令(N〜N−5)を順次に実行する(サイクルC177〜C187)。
ところが、サイクルC181において命令「N」がライト段階「WRITE1」に移行したとき、外部メモリが以前のアクセスを完了していないため、命令「N」による書き込みを実行できない。そのため、パイプライン保護部14はパイプライン保護サイクルを挿入して、命令「N」のライト段階「WRITE1」が完了するまでパイプラインをストール状態にする(サイクルC182〜C186)。
When the instruction processing unit 10X predecodes a software breakpoint stop instruction (ESTOP) (cycle C175), the instruction processing unit 10X stops decoding a new instruction and generates a response signal HALT_ACK for this HALT event (cycle C176). Upon receiving this response signal HALT_ACK, the debugging unit 20X sets the HALT event flag of the debug state register 24 (DBGSTAT), and changes the state of the state machine 211 (EXSM) from “execution state (EXE)” to “stop state ( DSUSP) "(cycle C177). The instruction execution unit 13 sequentially executes instructions (N to N-5) decoded before the stop instruction (ESTOP) (cycles C177 to C187).
However, when the instruction “N” shifts to the write stage “WRITE1” in the cycle C181, the external memory has not completed the previous access, and therefore writing by the instruction “N” cannot be executed. Therefore, the pipeline protection unit 14 inserts a pipeline protection cycle and puts the pipeline into a stalled state until the write stage “WRITE1” of the instruction “N” is completed (cycles C182 to C186).
他方、命令処理部10Xは、上述したプログラム停止時の遷移期間において、デバッグ動作よりも優先される割り込み要求を受け付ける(サイクルC177)。命令処理部10Xは、この割り込み要求に対して、応答信号RTINTACKを出力する(サイクルC178)。デバック部20Xは、この応答信号RTINTACKを受けて、ステートマシン211(EXSM)を「停止状態(DSUSP)」から「停止中の割り込み状態(IDS)」に更新する(サイクルC179)。
割り込み要求を受け付けた命令処理部10Xは、ステータス・レジスタ(ST0〜ST2)をスタックに保存する処理を実行する(サイクルC187〜C191)。しかしながら、上述したようにパイプラインのストールが発生するため、スタックへの保存処理は遅延する。図7(G)と図4(G)を比較して分かるように、ストールが発生すると、その期間分(5サイクル)だけ信号PUSHSTRTの立ち上がり時点が遅れる。
On the other hand, the instruction processing unit 10X accepts an interrupt request that has priority over the debugging operation in the transition period when the program is stopped (cycle C177). In response to this interrupt request, the instruction processing unit 10X outputs a response signal RINTACK (cycle C178). Upon receiving this response signal RINTACK, the debugging unit 20X updates the state machine 211 (EXSM) from “stop state (DSUSP)” to “stopped interrupt state (IDS)” (cycle C179).
Upon receiving the interrupt request, the instruction processing unit 10X executes processing for saving the status register (ST0 to ST2) in the stack (cycles C187 to C191). However, since the pipeline stall occurs as described above, the saving process to the stack is delayed. As can be seen by comparing FIG. 7G and FIG. 4G, when a stall occurs, the rising point of the signal PUSHSTRT is delayed by that period (5 cycles).
ストールの発生によってスタックへの保存処理が遅れている間に、命令処理部10Xは、割り込みルーチンの先頭の命令をプリデコードする(サイクルC187)。ここで、プリデコードした命令がソフトウェア・ブレークポイントの停止命令(ESTOP)であるため、命令処理部10Xは、このHALTイベントに対する応答信号HALT_ACKを発生する(サイクルC188)。デバック部20Xは、この応答信号HALT_ACKを受けて、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグをセットするともに、ステートマシン211(EXSM)のステートを「停止中の割り込み状態(IDS)」から「停止状態(DSUSP)」に更新する(サイクルC189)。 While the saving process to the stack is delayed due to the occurrence of the stall, the instruction processing unit 10X predecodes the first instruction of the interrupt routine (cycle C187). Here, since the predecoded instruction is a software breakpoint stop instruction (ESTOP), the instruction processing unit 10X generates a response signal HALT_ACK for this HALT event (cycle C188). Upon receiving this response signal HALT_ACK, the debugging unit 20X sets the HALT event flag of the debug state register 24 (DBGSTAT) and changes the state of the state machine 211 (EXSM) from “suspended interrupt state (IDS)” to “ Update to “stop state (DSUSP)” (cycle C189).
ストールの解消によってパイプラインの処理が再開すると、命令処理部10Xは、割り込みルーチンの先頭の停止命令(ESTOP)に応じて書き換えられたデバッグ状態レジスタ24(DBGSTAT)の情報をスタックへ保存し、デバッグ状態レジスタ24(DBGSTAT)を初期値にクリアする(サイクルC189〜C190)。割り込みルーチンに移行したとき、命令処理部10Xは「停止状態(DSUSP)」になる。しかしながら、デバッグ状態レジスタ24(DBGSTAT)は初期値にクリアされており、実行停止の原因を正しく示していない。 When the pipeline processing is resumed due to the removal of the stall, the instruction processing unit 10X saves the information of the debug status register 24 (DBGSTAT) rewritten according to the stop instruction (ESTOP) at the head of the interrupt routine to the stack and performs debugging. The status register 24 (DBGSTAT) is cleared to the initial value (cycles C189 to C190). When the process proceeds to the interrupt routine, the instruction processing unit 10X enters the “stop state (DSUSP)”. However, the debug status register 24 (DBGSTAT) is cleared to the initial value and does not correctly indicate the cause of the execution stop.
<1−7> ベンチマークカウンタ221Xにおいてカウントを行っている途中でプログラムの実行を停止する場合 <1-7> When stopping execution of a program while the benchmark counter 221X is counting
分析部22が備えるベンチマークカウンタ221Xは、実行制御部21Xにより設定される条件に従って、命令処理部10Xの処理に関連する各種のイベント(命令処理部10Xの内部イベント,分析部22で検出されるウォッチポイント等のイベント,メモリのキャッシュ・ミス等の外部イベント)の発生を示す信号をカウントする。ところが、図2に示すプロセッサでは、プログラムの実行を停止する際、パイプラインに未処理の命令が残存していても、プログラムの実行を停止するHALTイベントが発生した時点から一定期間の後に、ベンチマークカウンタ221Xのカウントを停止する。そのため、パイプラインに残存するHALTイベント発生以前の命令に由来するイベント(例えば、ウォッチポイント)についてはカウントの対象から除外されてしまい、カウント結果に反映されないという問題が生じる。 The benchmark counter 221X included in the analysis unit 22 is a variety of events related to the processing of the instruction processing unit 10X (internal events of the instruction processing unit 10X, watch detected by the analysis unit 22) according to the conditions set by the execution control unit 21X. Counts signals indicating the occurrence of events such as points and external events such as memory cache misses. However, in the processor shown in FIG. 2, when the execution of the program is stopped, even if unprocessed instructions remain in the pipeline, the benchmark is executed after a certain period from the time when the HALT event for stopping the execution of the program occurs. The counter 221X stops counting. For this reason, an event (for example, a watchpoint) derived from an instruction remaining before the occurrence of the HALT event remaining in the pipeline is excluded from the count target and is not reflected in the count result.
次に、図1に示す本実施形態に係るプロセッサのデバッグ時の動作を説明する。 Next, the debugging operation of the processor according to this embodiment shown in FIG. 1 will be described.
<2−1> プログラムの実行を停止する際の遷移期間にHALTイベントが発生する場合 <2-1> When a HALT event occurs during the transition period when program execution is stopped
図8は、本実施形態に係る図1に示すプロセッサにおいて、プログラムの実行を停止する際の遷移期間にHALTイベント(ウォッチポイント)が発生する場合の動作の一例を示すタイミング図である。
図8(A)は、のクロックCLKを示す。
図8(B)は、デバッグ状態レジスタ24(DBGSTAT)の記憶情報を示す。
図8(C)は、ステートマシン211(EXSM)のステート(命令処理部10の実行状態)を示す。
図8(D)は、デバッグ状態レジスタ24(DBGSTAT)に記憶されるDFC(割り込みの階層)を示す。
図8(E),(F),(G),(H),(I),(J),(K),(L),(M)は、それぞれ、パイプラインにおける「PRE−DEC」,「DECODE」,「ADDRESS」,「ACCESS1」,「ACCESS2」,「READ」,「EXE」,「WRITE1」,「WRITE2」において処理される命令を示す。
図8(N)は、拡張遅延部161において追加されたパイプラインの段階「WRITE3」を示す。
図8(O)は、状態信号S1を示す。
FIG. 8 is a timing chart showing an example of an operation when a HALT event (watchpoint) occurs in the transition period when program execution is stopped in the processor shown in FIG. 1 according to the present embodiment.
FIG. 8A shows the clock CLK.
FIG. 8B shows information stored in the debug status register 24 (DBGSTAT).
FIG. 8C shows the state of the state machine 211 (EXSM) (execution state of the instruction processing unit 10).
FIG. 8D shows a DFC (interrupt hierarchy) stored in the debug status register 24 (DBGSTAT).
8 (E), (F), (G), (H), (I), (J), (K), (L), and (M) are respectively “PRE-DEC”, The instructions processed in “DECODE”, “ADDRESS”, “ACCESS1”, “ACCESS2”, “READ”, “EXE”, “WRITE1”, and “WRITE2” are shown.
FIG. 8N shows the pipeline stage “WRITE3” added in the extended delay unit 161.
FIG. 8 (O) shows the status signal S1.
命令処理部10は、ソフトウェア・ブレークポイントの停止命令(ESTOP)をプリデコードすると(サイクルC201)、新たな命令のデコードを停止し、このHALTイベントに対する応答信号HALT_ACKを発生する(サイクルC202)。 When the instruction processing unit 10 predecodes a software breakpoint stop instruction (ESTOP) (cycle C201), the instruction processing unit 10 stops decoding of a new instruction and generates a response signal HALT_ACK for this HALT event (cycle C202).
信号発生部15は、停止命令(ESTOP)によって新たな命令のデコードが停止される(すなわち入力制御部11において命令の入力が停止される)と、停止信号SHを発生して信号伝播部16に入力する。信号伝播部16のレジスタRB1,RB2,…は、命令実行部13における命令の実行段階の進行に同期して(すなわちパイプライン処理の進行に合わせて)、停止信号SHを順次後段に伝播する。状態信号出力部17は、信号伝播部16において停止信号SHが伝播中であることを検知すると、値「1」の状態信号S1を出力する(サイクルC202〜C210)。値「1」の状態信号S1は、命令実行部13における命令の実行が未完了であることを示す。 When the decoding of a new instruction is stopped by the stop instruction (ESTOP) (that is, the input of the instruction is stopped in the input control unit 11), the signal generation unit 15 generates a stop signal SH and sends it to the signal propagation unit 16. input. The registers RB1, RB2,... Of the signal propagation unit 16 sequentially propagate the stop signal SH to the subsequent stage in synchronization with the progress of the instruction execution stage in the instruction execution section 13 (that is, in accordance with the progress of the pipeline processing). When the signal propagation unit 16 detects that the stop signal SH is being propagated, the state signal output unit 17 outputs the state signal S1 having a value “1” (cycles C202 to C210). The status signal S1 having a value “1” indicates that the instruction execution unit 13 has not yet executed the instruction.
信号伝播部16における停止信号SHの伝播は、パイプライン処理の進行に同期しているため、停止信号SHは1つの命令とみなすことができる。図8において、パイプラインの段階を流れている「HALT」は停止信号SHを示している。
「HALT」(停止信号SH)が通過するパイプラインの段階には、通常のパイプラインの段階に加えて、「WRITE3」段階が存在する。「WRITE3」段階は、拡張遅延部161によって生じる段階であり、通常のパイプラインの段階が終了した後で付随的な処理(HALTイベントに関わる処理など)が発生する期間においても状態信号S1が「1」になるように設けられている。
Since the propagation of the stop signal SH in the signal propagation unit 16 is synchronized with the progress of the pipeline processing, the stop signal SH can be regarded as one instruction. In FIG. 8, “HALT” flowing through the pipeline stage indicates the stop signal SH.
The pipeline stage through which the “HALT” (stop signal SH) passes includes a “WRITE3” stage in addition to the normal pipeline stage. The “WRITE3” stage is a stage generated by the extended delay unit 161, and the state signal S1 is “ 1 ”.
状態信号S1が「1」の場合、命令処理部10より出力されるHALTイベントの応答信号HALT_ACKは、ACK信号保持回路35によって保持される。状態信号S1が「1」から「0」へ変化すると(サイクルC211)、ACK信号保持回路35に保持された応答信号HALT_ACKはAND回路36を通過し、フラグセット信号FLG_SETとして実行制御部21に入力される。実行制御部21は、このフラグセット信号FLG_SETを受けて、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグをセットする(サイクルC212)。すなわち、ソフトウェア・ブレークポイント(ESTOP)などのHALTイベントが発生すると状態信号S1が「1」になり、この状態信号S1が「0」に変化するまで(すなわち命令実行部13における命令の実行が完了するまで)、HALTイベントに伴うデバッグ状態レジスタ24(DBGSTAT)の更新が遅延される。 When the status signal S <b> 1 is “1”, the response signal HALT_ACK of the HALT event output from the instruction processing unit 10 is held by the ACK signal holding circuit 35. When the status signal S1 changes from “1” to “0” (cycle C211), the response signal HALT_ACK held in the ACK signal holding circuit 35 passes through the AND circuit 36 and is input to the execution control unit 21 as the flag set signal FLG_SET. Is done. The execution control unit 21 receives this flag set signal FLG_SET, and sets the HALT event flag of the debug status register 24 (DBGSTAT) (cycle C212). That is, when a HALT event such as a software breakpoint (ESTOP) occurs, the status signal S1 becomes “1”, and the instruction execution in the instruction execution unit 13 is completed until the status signal S1 changes to “0”. Until the debug status register 24 (DBGSTAT) is updated with the HALT event.
また、状態信号S1が「1」から「0」へ変化すると、エッジ検出回路34は信号DSUSP_SETを出力して、実行制御部21のステートマシン211(EXSM)の
ステートを「停止状態(DSUSP)」に設定する。すなわち、ソフトウェア・ブレークポイント(ESTOP)などのHALTイベントが発生した場合、ステートマシン211(EXSM)のステートは直ちに「停止状態(DSUSP)」へ更新されず、状態信号S1が「0」に変化するまでステートの更新が遅延される。
When the state signal S1 changes from “1” to “0”, the edge detection circuit 34 outputs a signal DSUSP_SET, and the state of the state machine 211 (EXSM) of the execution control unit 21 is set to “stop state (DSUSP)”. Set to. That is, when a HALT event such as a software breakpoint (ESTOP) occurs, the state of the state machine 211 (EXSM) is not immediately updated to “stop state (DSUSP)”, and the state signal S1 changes to “0”. State updates are delayed until
一方、分析部22は、予め設定された条件に従って、命令処理部10によるメモリへのアクセスや外部からのトリガ信号を監視している。そして、停止命令(ESTOP)の入力により新たな命令のデコードを停止した後、パイプラインに残存する命令の実行によって、ウォッチポイントの条件に一致するアクセスが発生したことを検出する(サイクルC209)。 On the other hand, the analysis unit 22 monitors access to the memory by the instruction processing unit 10 and a trigger signal from the outside according to preset conditions. Then, after the decoding of a new instruction is stopped by inputting a stop instruction (ESTOP), it is detected that an access that matches the watchpoint condition is generated by executing the instruction remaining in the pipeline (cycle C209).
実行制御部21は、分析部22からウォッチポイントのHALTイベントを通知されると、このとき「停止状態(DSUSP)」のステートではないので、プログラムの実行停止を要求するリクエスト信号WP−RQを命令処理部10に出力する。リクエスト信号WP−RQを受けた命令処理部10は、デバッグ部20に応答信号HALT_ACKを出力する(サイクルC210)。ところが、このとき状態信号S1が「1」であるため、先の停止命令(ESTOP)の場合と同様、応答信号HALT_ACKはACK信号保持回路35によって保持される。このウォッチポイントのHALTイベントに応じたデバッグ状態レジスタ24(DBGSTAT)の更新も、状態信号S1が「0」になるまで遅延される(サイクルC212)。その結果、サイクルC212においては、2つのHALTイベント(停止命令(ESTOP),ウォッチポイント)についてデバッグ状態レジスタ24(DBGSTAT)のフラグ設定が行われる。 When the execution control unit 21 is notified of the watchpoint HALT event from the analysis unit 22, the execution control unit 21 is not in the “stop state (DSUSP)” state at this time, and therefore issues a request signal WP-RQ requesting the program execution stop. Output to the processing unit 10. Upon receiving the request signal WP-RQ, the instruction processing unit 10 outputs a response signal HALT_ACK to the debugging unit 20 (cycle C210). However, since the status signal S1 is “1” at this time, the response signal HALT_ACK is held by the ACK signal holding circuit 35 as in the case of the previous stop instruction (ESTOP). The update of the debug status register 24 (DBGSTAT) in response to the watchpoint HALT event is also delayed until the status signal S1 becomes “0” (cycle C212). As a result, in the cycle C212, the flag of the debug status register 24 (DBGSTAT) is set for two HALT events (stop instruction (ESTOP), watchpoint).
図2に示すプロセッサでは、プログラムの実行を停止する際の遷移期間においてデバッグ状態レジスタ24(DBGSTAT)やステートマシン211(EXSM)の更新を許可している。そのため、<1−1>において説明したように、遷移期間にウォッチポイントなどのHALTイベントが発生すると、その情報がデバッグ状態レジスタ24(DBGSTAT)に正しく記録されないという問題が生じる。
一方、本実施形態に係る図1に示すプロセッサでは、遷移期間におけるデバッグ状態レジスタ24(DBGSTAT)やステートマシン211(EXSM)の更新を制限することによって、遷移期間に生じたHALTイベントの情報がデバッグ状態レジスタ24(DBGSTAT)へ正しく記録され、上記の問題が解消される。
In the processor shown in FIG. 2, updating of the debug state register 24 (DBGSTAT) and the state machine 211 (EXSM) is permitted during a transition period when program execution is stopped. Therefore, as described in <1-1>, when a HALT event such as a watchpoint occurs during the transition period, there is a problem that the information is not correctly recorded in the debug status register 24 (DBGSTAT).
On the other hand, in the processor shown in FIG. 1 according to the present embodiment, the information on the HALT event generated during the transition period is debugged by restricting the update of the debug state register 24 (DBGSTAT) and the state machine 211 (EXSM) during the transition period. It is correctly recorded in the status register 24 (DBGSTAT), and the above problem is solved.
<2−2>プログラムの実行を停止する際の遷移期間にHALTイベントと割り込みが発生する場合 <2-2> When a HALT event and interrupt occur during the transition period when program execution is stopped
図9は、本実施形態に係る図1に示すプロセッサにおいて、プログラムの実行を停止する際の遷移期間に割り込みが発生する場合の動作例を示すタイミング図である。
図9(A)は、命令処理部10のクロックCLKを示す。
図9(B)は、停止状態において割り込みを受け付けた場合に命令処理部10が出力する応答信号RTINTACKを示す。
図9(C)は、ステートマシン211(EXSM)のステート(命令処理部10の実行状態)を示す。
図9(D)は、バックグラウンド・コードからの割り込みの階層を示す5ビットのデータ(DFC)を示す
図9(E)は、デバッグ状態レジスタ24(DBGSTAT)の記憶情報を示す。
図9(F)は、状態信号S1を示す。
図9(G),(H),(I),(J),(K),(L),(M),(N),(O)は、それぞれ、パイプラインの段階「PRE−DEC」,「DECODE」,「ADDRESS」,「ACCESS1」,「ACCESS2」,「READ」,「EXE」,「WRITE1」,「WRITE2」において処理される命令を示す。
図9(P)は、拡張遅延部161において延長されたパイプラインの段階「WRITE3」を示す。
FIG. 9 is a timing chart showing an operation example when an interrupt occurs in the transition period when the execution of the program is stopped in the processor shown in FIG. 1 according to the present embodiment.
FIG. 9A shows the clock CLK of the instruction processing unit 10.
FIG. 9B shows a response signal RINTACK output from the instruction processing unit 10 when an interrupt is accepted in the stopped state.
FIG. 9C shows the state of the state machine 211 (EXSM) (execution state of the instruction processing unit 10).
FIG. 9D shows 5-bit data (DFC) indicating the hierarchy of interrupts from the background code. FIG. 9E shows storage information in the debug status register 24 (DBGSTAT).
FIG. 9F shows the status signal S1.
9 (G), (H), (I), (J), (K), (L), (M), (N), and (O) are pipeline stages “PRE-DEC”, respectively. , “DECODE”, “ADDRESS”, “ACCESS1”, “ACCESS2”, “READ”, “EXE”, “WRITE1”, and “WRITE2”.
FIG. 9P shows the pipeline stage “WRITE3” extended in the extended delay unit 161.
命令処理部10は、ソフトウェア・ブレークポイントの停止命令(ESTOP)をプリデコードすると(サイクルC251)、新たな命令のデコードを停止し、このHALTイベントに対する応答信号HALT_ACKを発生する(サイクルC252)。 When the instruction processing unit 10 predecodes the software breakpoint stop instruction (ESTOP) (cycle C251), it stops decoding a new instruction and generates a response signal HALT_ACK for this HALT event (cycle C252).
信号発生部15は、停止命令(ESTOP)によって新たな命令のデコードが停止されると、停止信号SHを発生して信号伝播部16に入力する。状態信号出力部17は、停止信号SHが信号伝播部16を伝播している間、命令実行部13における命令の実行が未完了であることを示す値「1」の状態信号S1を出力する(サイクルC252〜C260)。 When the decoding of a new instruction is stopped by the stop instruction (ESTOP), the signal generation section 15 generates a stop signal SH and inputs it to the signal propagation section 16. While the stop signal SH is propagated through the signal propagation unit 16, the state signal output unit 17 outputs a state signal S1 having a value “1” indicating that the instruction execution in the instruction execution unit 13 is not completed ( Cycles C252 to C260).
状態信号S1が「1」の場合、命令処理部10より出力される応答信号HALT_ACKは、ACK信号保持回路35によって保持される。状態信号S1が「1」から「0」へ変化すると(サイクルC261)、ACK信号保持回路35に保持された応答信号HALT_ACKはAND回路36を通過し、フラグセット信号FLG_SETとして実行制御部21に入力される。実行制御部21は、このフラグセット信号FLG_SETを受けて、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグをセットする(サイクルC262)。 When the status signal S1 is “1”, the response signal HALT_ACK output from the instruction processing unit 10 is held by the ACK signal holding circuit 35. When the status signal S1 changes from “1” to “0” (cycle C261), the response signal HALT_ACK held in the ACK signal holding circuit 35 passes through the AND circuit 36 and is input to the execution control unit 21 as the flag set signal FLG_SET. Is done. The execution control unit 21 receives this flag set signal FLG_SET and sets the HALT event flag of the debug status register 24 (DBGSTAT) (cycle C262).
また、状態信号S1が「1」から「0」へ変化すると、エッジ検出回路34は信号DSUSP_SETを出力して、信号実行制御部21のステートマシン211(EXSM)のステートを「停止状態(DSUSP)」に設定する(サイクルC262)。 When the state signal S1 changes from “1” to “0”, the edge detection circuit 34 outputs the signal DSUSP_SET, and the state of the state machine 211 (EXSM) of the signal execution control unit 21 is set to “stop state (DSUSP)”. ”(Cycle C262).
以上の動作は図8の場合と同様であり、命令実行部13における命令の実行が完了するまでの間、デバッグ制限部30は、デバッグ状態レジスタ24(DBGSTAT)及びステートマシン211(EXSM)の更新を制限する。 The above operations are the same as those in FIG. 8, and the debug restriction unit 30 updates the debug state register 24 (DBGSTAT) and the state machine 211 (EXSM) until the instruction execution by the instruction execution unit 13 is completed. Limit.
一方、図9の動作例では、図8の場合と異なり、停止命令(ESTOP)のHALTイベントによって「停止状態(DSUSP)」に移行した後、割り込み要求が発生する(サイクルC253)。割り込み要求が発生したとき、状態信号S1は「1」に設定されており、AND回路31から出力される割り込みイネーブル信号INT_ENMは「0」になる。そのため、この割り込み要求は命令処理部10において受け付けられずに待機状態となる(サイクルC253〜C261)。状態信号S1が「1」から「0」に変化すると、AND回路31による割り込みイネーブル信号INT_ENのマスキングが解除されるため、命令処理部10は待機状態にあった割り込み要求を受け付ける(サイクルC262)。
このように、図1に示すプロセッサにおいては、命令実行部13における命令の実行が完了するまでの間、割り込み要求の受付が制限される。
On the other hand, unlike the case of FIG. 8, in the operation example of FIG. 9, an interrupt request is generated after transitioning to the “stop state (DSUSP)” by the HALT event of the stop instruction (ESTOP) (cycle C253). When an interrupt request is generated, the status signal S1 is set to “1”, and the interrupt enable signal INT_ENM output from the AND circuit 31 is set to “0”. Therefore, the interrupt request is not accepted by the instruction processing unit 10 and enters a standby state (cycles C253 to C261). When the status signal S1 changes from “1” to “0”, the masking of the interrupt enable signal INT_EN by the AND circuit 31 is released, so that the instruction processing unit 10 receives an interrupt request in a standby state (cycle C262).
As described above, in the processor shown in FIG. 1, the acceptance of interrupt requests is limited until the execution of instructions in the instruction execution unit 13 is completed.
図10は、本実施形態に係る図1に示すプロセッサにおいて、プログラムの実行を停止する際の遷移期間にHALTイベント(ウォッチポイント)と割り込みが発生する場合の第1の動作例を示すタイミング図である。
図10(A)〜(V)は、それぞれ図4(A)〜(V)に対応する。
図10(W)は、拡張遅延部161において延長されたパイプラインの段階「WRITE3」を示す。
図10(X)は、状態信号S1を示す。
FIG. 10 is a timing chart showing a first operation example when a HALT event (watchpoint) and an interrupt occur in a transition period when program execution is stopped in the processor shown in FIG. 1 according to the present embodiment. is there.
10A to 10V correspond to FIGS. 4A to 4V, respectively.
FIG. 10 (W) shows the pipeline stage “WRITE 3” extended in the extended delay unit 161.
FIG. 10X shows the status signal S1.
命令処理部10は、停止命令(ESTOP)に応じて新たな命令のデコードを停止し、状態信号S1を「1」に設定する(サイクルC301,C302)。デバッグ制限部30は、状態信号S1が「1」の間、デバッグ部20による停止命令(ESTOP)に応じたデバッグ状態レジスタ24(DBGSTAT)及びステートマシン211(EXSM)の更新を制限する(サイクルC302〜C311)。また、この間に発生する割り込み要求(サイクルC303)を待機状態とする。以上の動作は、図9の場合と同様である。 The instruction processing unit 10 stops decoding of a new instruction in response to the stop instruction (ESTOP), and sets the status signal S1 to “1” (cycles C301 and C302). The debug restriction unit 30 restricts updating of the debug state register 24 (DBGSTAT) and the state machine 211 (EXSM) in response to the stop instruction (ESTOP) by the debug unit 20 while the state signal S1 is “1” (cycle C302). ~ C311). Further, an interrupt request (cycle C303) generated during this period is set to a standby state. The above operation is the same as in the case of FIG.
一方、図10の動作例では、図9の場合と異なり、命令のデコードが停止された後の遷移期間において、更にウォッチポイントのHALTイベントが発生する(サイクルC307)。 On the other hand, in the operation example of FIG. 10, unlike the case of FIG. 9, a watchpoint HALT event further occurs in the transition period after the decoding of the instruction is stopped (cycle C307).
分析部22は、ウォッチポイントの条件に一致するアクセスを検出すると、その旨を実行制御部21に通知する。このときステートマシン211(EXSM)は「停止状態(DSUSP)」を示していないので、実行制御部21はプログラムの実行停止を要求するリクエスト信号WP−RQを命令処理部10に出力する(サイクルC307)。リクエスト信号WP−RQを受けた命令処理部10は、デバッグ部20に応答信号HALT_ACKを出力する(サイクルC308)。ところが、このとき状態信号S1が「1」であるため、先の停止命令(ESTOP)の場合と同様、この応答信号HALT_ACKはACK信号保持回路35によって保持される。ウォッチポイントのHALTイベントに応じたデバッグ状態レジスタ24(DBGSTAT)の更新も、状態信号S1が「0」になるサイクルC312まで遅延される。その結果、サイクルC312においては、2つのHALTイベント(停止命令(ESTOP),ウォッチポイント)についてデバッグ状態レジスタ24(DBGSTAT)のフラグ設定が行われる。 When the analysis unit 22 detects an access that matches the watchpoint condition, the analysis unit 22 notifies the execution control unit 21 to that effect. At this time, since the state machine 211 (EXSM) does not indicate “stop state (DSUSP)”, the execution control unit 21 outputs a request signal WP-RQ requesting the program execution stop to the instruction processing unit 10 (cycle C307). ). Upon receiving the request signal WP-RQ, the instruction processing unit 10 outputs a response signal HALT_ACK to the debugging unit 20 (cycle C308). However, since the status signal S1 is “1” at this time, the response signal HALT_ACK is held by the ACK signal holding circuit 35 as in the case of the previous stop instruction (ESTOP). The update of the debug status register 24 (DBGSTAT) in response to the watchpoint HALT event is also delayed until the cycle C312 in which the status signal S1 becomes “0”. As a result, in the cycle C312, the debug status register 24 (DBGSTAT) is set for two HALT events (stop instruction (ESTOP), watchpoint).
命令処理部10は、状態信号S1が「1」から「0」に変化すると、デバッグ制限部30のAND回路31による割り込み要求の受付の制限が解除されるため、それまで待機状態としていた割り込み要求を受け付ける(サイクルC312)。
命令処理部10は、割り込み要求を受け付けると、応答信号RTINTACKを出力する(サイクルC313)。デバック部20は、この応答信号RTINTACKを受けて、ステートマシン211(EXSM)を「停止状態(DSUSP)」から「停止中の割り込み状態(IDS:interrupt during suspend)」に更新する(サイクルC314)。
命令処理部10は、割り込みの受け付けに伴って、ステータス・レジスタ(ST0〜ST2)等の情報をスタックに保存する処理を開始する。すなわち、命令処理部10は、割り込み要求を受け付けると、スタックに保存する所定のレジスタの情報をバスFDBUS,EDBUSへ出力する(サイクルC319〜C321)。そして、割り込みルーチンを開始する前に、各レジスタの記憶情報をクリアする(サイクルC320)。
デバック部20は、このスタックへの保存処理が開始されると、割り込み階層のデータ(DFC)を「1」だけ増加させる(サイクルC318)。そして、デバッグ状態レジスタ24(DBGSTAT)の保存処理が行われる時点(サイクルC320)において、フラグデータHPI,IDS_ACTをそれぞれ「1」に設定する。
When the status signal S1 changes from “1” to “0”, the instruction processing unit 10 releases the restriction on acceptance of interrupt requests by the AND circuit 31 of the debug restriction unit 30. Is received (cycle C312).
When receiving an interrupt request, the instruction processing unit 10 outputs a response signal RINTACK (cycle C313). Upon receiving this response signal RINTACK, the debugging unit 20 updates the state machine 211 (EXSM) from “suspended state (DSUSP)” to “interrupted state suspended (IDS)” (cycle C314).
The instruction processing unit 10 starts processing for storing information such as status registers (ST0 to ST2) in the stack in response to acceptance of an interrupt. That is, when receiving an interrupt request, the instruction processing unit 10 outputs information on a predetermined register stored in the stack to the buses FDBUS and EDBUS (cycles C319 to C321). Then, before starting the interrupt routine, the storage information of each register is cleared (cycle C320).
When the saving process to the stack is started, the debugging unit 20 increases the data (DFC) of the interrupt hierarchy by “1” (cycle C318). The flag data HPI and IDS_ACT are set to “1” at the time (cycle C320) when the debug status register 24 (DBGSTAT) is stored.
以上の処理を経て割り込みルーチン(フォアグラウンド・コード)へ移ったとき、ステートマシン211(EXSM)のステートは「停止中の割り込み状態(IDS)」になっている(サイクルC322〜)。したがって、命令処理部10は、図4の場合のように停止することなく、割り込みルーチンの命令を先頭から正常に実行する(サイクルC322)。 When the process proceeds to the interrupt routine (foreground code) through the above processing, the state of the state machine 211 (EXSM) is “interrupt state (IDS) being stopped” (cycle C322). Therefore, the instruction processing unit 10 normally executes the instruction of the interrupt routine from the beginning without stopping as in the case of FIG. 4 (cycle C322).
図2に示すプロセッサでは、プログラムの実行が停止される際の遷移期間において、割り込み要求の受付を許可する。そのため、遷移期間において割り込み要求とHALTイベントが重複してしまうと、<1−2>において図4を参照して説明したように、割り込み要求を受け付ける前にデコードされた命令(バックグラウンド・コード)に由来して発生したHALTイベントが、割り込みルーチン(フォアグラウンド・コード)における命令の実行に影響を与えてしまうといった問題が生じる。
一方、本実施形態に係る図1に示すプロセッサでは、遷移期間における割り込み要求の受付を制限することにより、遷移期間に生じたHALTイベントに伴う処理と、割り込みルーチンへ移行する際の処理との重複が回避される。これにより、割り込みルーチンへ移行する前のHALTイベントが割り込みルーチンへ移行した後の処理の実行状態に影響を与えなくなり、上記の問題が解消される。
In the processor shown in FIG. 2, the acceptance of the interrupt request is permitted in the transition period when the execution of the program is stopped. Therefore, if the interrupt request and the HALT event overlap in the transition period, as described with reference to FIG. 4 in <1-2>, an instruction (background code) decoded before accepting the interrupt request. This causes a problem that the HALT event generated from the above affects the execution of instructions in the interrupt routine (foreground code).
On the other hand, in the processor shown in FIG. 1 according to the present embodiment, by limiting the acceptance of interrupt requests during the transition period, the processing associated with the HALT event that occurred during the transition period overlaps with the processing when transitioning to the interrupt routine Is avoided. As a result, the HALT event before the transition to the interrupt routine does not affect the execution state of the process after the transition to the interrupt routine, and the above problem is solved.
図11は、本実施形態に係る図1に示すプロセッサにおいて、プログラムの実行を停止する際の遷移期間にHALTイベント(ウォッチポイント)と割り込みが発生する場合の第2の動作例を示すタイミング図である。図11(A)〜(X)は、それぞれ図10(A)〜(X)に対応する。 FIG. 11 is a timing chart showing a second operation example when a HALT event (watchpoint) and an interrupt occur in the transition period when program execution is stopped in the processor shown in FIG. 1 according to the present embodiment. is there. FIGS. 11A to 11X correspond to FIGS. 10A to 10X, respectively.
図11に示す第2の動作例では、ウォッチポイントによるHALTイベントの発生時点が3サイクル遅くなっている点で、図10に示す第1の動作例と異なる。しかしながら、第2の動作例においても、図10の場合と同様に、遷移期間における割り込み要求の受付を制限しているため、この期間におけるHALTイベントと割り込みの重複は回避される。したがって、割り込みルーチンへ移行する前に生じたHALTイベントが割り込みルーチンへ移行した後の実行状態に影響を与えるという問題は解消される。
また、遷移期間におけるHALTイベントと割り込みの重複が回避されることから、<1−2>において図5を参照して説明したように、割り込みルーチンへ移行する前のHALTイベントが割り込みルーチンへ移行した後のデバッグ状態レジスタ24(DBGSTAT)の内容に影響を与えるといった問題も解消される。
The second operation example shown in FIG. 11 is different from the first operation example shown in FIG. 10 in that the occurrence point of the HALT event by the watchpoint is delayed by three cycles. However, in the second operation example as well, in the same way as in the case of FIG. 10, the acceptance of interrupt requests in the transition period is limited, so that the overlap of HALT events and interrupts in this period is avoided. Therefore, the problem that the HALT event generated before the transition to the interrupt routine affects the execution state after the transition to the interrupt routine is solved.
Further, since the HALT event and the interrupt are prevented from overlapping in the transition period, the HALT event before the transition to the interrupt routine is shifted to the interrupt routine as described with reference to FIG. 5 in <1-2>. The problem of affecting the contents of the later debug status register 24 (DBGSTAT) is also solved.
<2−3> 割り込みルーチンから復帰してプログラムを停止する際の遷移期間にHALTイベントが発生する場合 <2-3> When a HALT event occurs during the transition period when returning from the interrupt routine and stopping the program
図12は、本実施形態に係る図1に示すプロセッサにおいて、割り込みルーチンから復帰してプログラムを停止する際の遷移期間にHALTイベントが発生する場合の動作の一例を示すタイミング図である。
図12(A)〜(U)は、それぞれ図6(A)〜(U)に対応する。
図12(V)は、拡張遅延部161において延長されたパイプラインの段階「WRITE3」を示す。
図12(W)は、状態信号S1を示す。
FIG. 12 is a timing chart showing an example of an operation when a HALT event occurs in the transition period when returning from the interrupt routine and stopping the program in the processor shown in FIG. 1 according to the present embodiment.
FIGS. 12A to 12U correspond to FIGS. 6A to 6U, respectively.
FIG. 12 (V) shows the pipeline stage “WRITE 3” extended in the extended delay unit 161.
FIG. 12 (W) shows the status signal S1.
命令処理部10は、割り込みルーチンにおいて復帰命令(RTI−R)をプリデコードすると(サイクルC402)、新たな命令のデコードを停止して、応答信号RETIACKを出力する(サイクルC403)。そして、割り込みルーチンの実行前にスタックへ保存された情報をバスCDBUS,DDBUSに出力し、所定のレジスタへ戻す。
スタックの情報がデバッグ状態レジスタ24(DBGSTAT)へ戻されると、これに記憶されるフラグデータHPI,IDS_ACKは、割り込み前の状態(値「0」)へそれぞれ戻る(サイクルC409)。割り込みの階層を示すデータ(DFC)については、スタックへ保存する前に「1」を加算しているため、デバッグ部20は、スタックの情報がデバッグ状態レジスタ24(DBGSTAT)へ戻されると、その値から「1」を減算する(サイクルC410)。ステータス・レジスタST2に格納されたフラグデータDBGMは、フラグデータHPI,IDS_ACTより遅れたタイミングで割り込み前の状態(値「0」)に戻る(サイクルC411)。
以上の復帰命令(RTI−R)の動作は、図6の場合と同様である。
When the instruction processing unit 10 predecodes the return instruction (RTI-R) in the interrupt routine (cycle C402), the instruction processing unit 10 stops decoding of a new instruction and outputs a response signal RETIACK (cycle C403). Then, the information stored in the stack before the execution of the interrupt routine is output to the buses CDBUS and DDBUS and returned to a predetermined register.
When the stack information is returned to the debug status register 24 (DBGSTAT), the flag data HPI and IDS_ACK stored therein return to the state before the interruption (value “0”) (cycle C409). Since the data indicating the interrupt hierarchy (DFC) is incremented by “1” before saving to the stack, the debug unit 20 returns the stack information to the debug status register 24 (DBGSTAT). “1” is subtracted from the value (cycle C410). The flag data DBGM stored in the status register ST2 returns to the state before interruption (value “0”) at a timing later than the flag data HPI and IDS_ACT (cycle C411).
The operation of the return instruction (RTI-R) described above is the same as in the case of FIG.
一方、図12の動作例では、図6の場合と異なり、復帰命令(RTI−R)によって新たな命令のデコードが停止されると、信号発生部15において停止信号SHが発生する。停止信号SHは、命令実行部13における命令の実行段階の進行に同期して、パイプラインの最後の段階「WRITE3」まで信号伝播部16を伝播する。状態信号出力部17は、信号伝播部16において停止信号SHが伝播している間、値「1」の状態信号S1を出力する(サイクルC403〜C411)。 On the other hand, in the operation example of FIG. 12, unlike the case of FIG. 6, when decoding of a new instruction is stopped by the return instruction (RTI-R), the signal generator 15 generates a stop signal SH. The stop signal SH propagates through the signal propagation unit 16 until the last stage “WRITE3” of the pipeline in synchronization with the progress of the instruction execution stage in the instruction execution unit 13. The state signal output unit 17 outputs the state signal S1 having the value “1” while the stop signal SH is propagated in the signal propagation unit 16 (cycles C403 to C411).
状態信号S1が「1」から「0」へ変化すると、ステートマシン211(EXSM)のステートは「停止状態(DSUSP)」に更新される(サイクルC413)。 When the state signal S1 changes from “1” to “0”, the state of the state machine 211 (EXSM) is updated to “stop state (DSUSP)” (cycle C413).
また、分析部22は、上述した復帰命令(RTI−R)の処理と並行して、予め設定された条件に従って、命令処理部10によるメモリへのアクセスや外部からのトリガ信号を監視している。そして、ステータス情報がスタックへ保存される直前にお
いて、ウォッチポイントの条件に一致するアクセスが発生したことを検出する(サイクルC406)。
Further, in parallel with the processing of the return instruction (RTI-R) described above, the analysis unit 22 monitors memory access by the instruction processing unit 10 and an external trigger signal according to preset conditions. . Then, immediately before the status information is saved in the stack, it is detected that an access that matches the watchpoint condition has occurred (cycle C406).
実行制御部21は、分析部22からウォッチポイントのHALTイベントを通知されると、命令処理部10に対してプログラムの実行停止を要求するリクエスト信号WP−RQを出力する(サイクルC406)。リクエスト信号WP−RQを受けた命令処理部10は、これに対する応答信号HALT_ACKを出力する(サイクルC407)。ところが、このとき状態信号S1が「1」であるため、応答信号HALT_ACKはACK信号保持回路35によって保持される。ウォッチポイントのHALTイベントに応じたデバッグ状態レジスタ24(DBGSTAT)の更新は、状態信号S1が「0」になるまで遅延される(サイクルC413)。デバッグ状態レジスタ24(DBGSTAT)の更新が遅延されている間に、スタックに退避されたステータス情報が各レジスタへ戻される。 When notified of the watchpoint HALT event from the analysis unit 22, the execution control unit 21 outputs a request signal WP-RQ requesting the instruction processing unit 10 to stop the execution of the program (cycle C406). Upon receiving the request signal WP-RQ, the instruction processing unit 10 outputs a response signal HALT_ACK to this (cycle C407). However, since the status signal S 1 is “1” at this time, the response signal HALT_ACK is held by the ACK signal holding circuit 35. The update of the debug status register 24 (DBGSTAT) in response to the watchpoint HALT event is delayed until the status signal S1 becomes “0” (cycle C413). While the update of the debug status register 24 (DBGSTAT) is delayed, the status information saved in the stack is returned to each register.
図2に示すプロセッサでは、<1−3>において説明したように、復帰命令(RTI−R)によってプログラムの実行を停止する遷移期間に発生したHALTイベントの情報が、スタックに退避された情報を戻す際に消失してしまうという問題が生じる。
一方、本実施形態に係る図1に示すプロセッサでは、復帰命令(RTI−R)に伴う処理が完了するまで、デバッグ状態レジスタ24(DBGSTAT)の更新を制限する。そのため、遷移期間に発生したHALTイベントの情報はデバッグ状態レジスタ24(DBGSTAT)に正しく記録され、上記の問題が解消される。
In the processor shown in FIG. 2, as described in <1-3>, the information of the HALT event that occurred during the transition period in which the program execution is stopped by the return instruction (RTI-R) is the information saved in the stack. There is a problem that it disappears when returning.
On the other hand, in the processor shown in FIG. 1 according to the present embodiment, the update of the debug status register 24 (DBGSTAT) is restricted until the processing associated with the return instruction (RTI-R) is completed. Therefore, the information of the HALT event that occurred during the transition period is correctly recorded in the debug status register 24 (DBGSTAT), and the above problem is solved.
<2−4> 割り込みによってデバッグ・フレーム(割り込みの階層)が変わるときにDMA部23のアクセスが生じる場合 <2-4> When the DMA unit 23 is accessed when the debug frame (interrupt hierarchy) is changed by an interrupt
図2に示すプロセッサでは、<1−4>で説明したように、割り込み命令によってデバッグ・フレーム(割り込みの階層)が変わるとき、デバッグ状態レジスタ24(DBGSTAT)等に格納される命令処理部10Xのステータス情報は、全て一斉に更新されるのではなく、部分的に異なるタイミングで更新される。そのため、DMA部23の機能によって生成されたメモリアクセス要求(例えばレジスタ値の読み出し命令)がデバッグ・フレームの変わり目において実行され、命令処理部10Xのステータス情報が読み出された場合、その個々の情報の間で相関がないという問題がある。
これに対し、本実施形態に係る図1に示すプロセッサでは、プログラムの実行が停止される遷移期間において状態信号S1が「1」に設定され、割り込み要求の受付が制限される。そのため、命令の供給が停止される前にDMA機能により挿入されたメモリ等へのアクセス(例えばデバッグ状態レジスタ24(DBGSTAT)の読み出し)が遷移期間において実行されても、その遷移期間は上述したデバッグ・フレームの変わり目と重複しない。すなわち、命令の供給が停止される前にDMA機能により挿入されたメモリ等へのアクセスは、信号伝播部16においてHALT命令が伝播する期間内に終了するので、割り込み要求の受付をこの期間より遅らせることで、DMA機能によるメモリ等へのアクセスとデバッグ・フレームの変わり目とが重複しないようになる。これにより、割り込みルーチンへ移行する際のデバッグ・フレームの変わり目において相関性のないステータス情報が読み出されることがなくなり、上記の問題が解消される。
In the processor shown in FIG. 2, as described in <1-4>, when the debug frame (interrupt hierarchy) is changed by an interrupt instruction, the instruction processing unit 10X stored in the debug status register 24 (DBGSTAT) or the like. The status information is not updated all at once, but is updated at partially different timings. Therefore, when a memory access request (for example, a register value read instruction) generated by the function of the DMA unit 23 is executed at the transition of the debug frame and the status information of the instruction processing unit 10X is read, the individual information There is a problem that there is no correlation.
On the other hand, in the processor shown in FIG. 1 according to the present embodiment, the status signal S1 is set to “1” in the transition period in which the execution of the program is stopped, and the acceptance of the interrupt request is limited. Therefore, even if access to the memory or the like inserted by the DMA function (for example, reading of the debug status register 24 (DBGSTAT)) is executed in the transition period before the supply of the instruction is stopped, the transition period is in the above-described debug period.・ Do not overlap with the transition of the frame. That is, the access to the memory or the like inserted by the DMA function before the instruction supply is stopped is completed within the period in which the HALT instruction is propagated in the signal propagation unit 16, so that the acceptance of the interrupt request is delayed from this period. As a result, the access to the memory or the like by the DMA function does not overlap with the transition of the debug frame. As a result, the status information having no correlation is not read out at the transition of the debug frame when shifting to the interrupt routine, and the above problem is solved.
また、図2に示すプロセッサでは、プログラムの実行が停止される際の遷移期間において、DMA部23によるアクセスが有効になっている。そのため、この遷移期間にDMA部23へコマンドが入力されると、DMA部23はメモリ等へのアクセスを実行する。
もし、遷移期間中にDMA部23によるメモリ等へのアクセス要求が命令処理部10Xで受け付けられると、そのアクセス要求に伴う処理の実行には命令実行部13が使用されるので、それ以前に開始された命令のパイプライン処理が全て完了した後も、DMA部23のアクセス要求に伴うパイプライン処理はしばらく続く。
つまり、遷移期間中にDMA部23のアクセス要求を受け付けてしまうと、HALT命令が信号伝播部16を伝播し終えた後も(状態信号S1が「1」から「0」へ戻った後も)、DMA部23のアクセス要求に伴うパイプライン処理が続いてしまうことになる。そのため、状態信号S1が「0」の状態でDMAのパイプライン処理が続いているときに割り込みが受け付けられると、先述の場合と同様に、デバッグ・フレームの変わり目において相関性のないステータス情報が読み出されるという問題が生じる。
これに対し、図1に示すプロセッサでは、遷移期間におけるDMA部23のアクセス要求(すなわちリクエスト信号DMA_RQM)を状態信号S1によって制限する。すなわち、状態信号S1が「1」の期間に発生したDMA部23のアクセス要求は、状態信号S1が「0」に変わるまで遅延される。これにより、遷移期間中に発生したDMA部23のアクセス要求は、命令処理部10のパイプライン処理の完了後(すなわち「停止状態(DSUSP)」)において生じたものとして取り扱うことが可能になる。
ここで、実行制御部21は、「停止状態(DSUSP)」においてDMA部23のアクセス要求が発生すると、そのアクセス要求に伴うパイプライン処理が完了するまで割り込みの受付を制限する(割り込みイネーブル信号INT_ENを無効状態にする)ものとする。
そうすると、遷移期間後の「停止状態(DSUSP)」において実行されるDMA部23のアクセス期間中においては、割り込みが受け付けられなくなり、デバッグ・フレームの変わり目が生じないため、相関性のないステータス情報が読み出されるという先述の問題が解消する。
更に、DMA部23のアクセス要求が受け付けられた後にデバッグ・フレームの変化が生じないことから、DMA部23のアクセス要求が受け付けられたデバッグ・フレームと、その要求の受け付けによって実際にメモリ等へのアクセスが実行されるデバッグ・フレームとが常に一致する。すなわち、DMA部23によるアクセスが所望のデバッグ・フレームとは異なるフレームで実行されるという問題は生じない。
In the processor shown in FIG. 2, the access by the DMA unit 23 is valid in the transition period when the execution of the program is stopped. Therefore, when a command is input to the DMA unit 23 during this transition period, the DMA unit 23 executes access to a memory or the like.
If an access request to the memory or the like by the DMA unit 23 is accepted by the instruction processing unit 10X during the transition period, the instruction execution unit 13 is used to execute the process associated with the access request, and thus the process starts before that. Even after all the pipeline processing of the issued instruction is completed, the pipeline processing accompanying the access request of the DMA unit 23 continues for a while.
That is, if an access request from the DMA unit 23 is accepted during the transition period, even after the HALT instruction has been propagated through the signal propagation unit 16 (even after the status signal S1 returns from “1” to “0”). Therefore, the pipeline processing accompanying the access request of the DMA unit 23 continues. For this reason, when an interrupt is accepted when the DMA pipeline processing continues with the state signal S1 being “0”, status information having no correlation is read at the transition of the debug frame, as in the case described above. Problem arises.
On the other hand, in the processor shown in FIG. 1, the access request (that is, the request signal DMA_RQM) of the DMA unit 23 in the transition period is limited by the state signal S1. That is, the access request of the DMA unit 23 generated during the period in which the status signal S1 is “1” is delayed until the status signal S1 changes to “0”. As a result, the access request of the DMA unit 23 generated during the transition period can be handled as occurring after completion of the pipeline processing of the instruction processing unit 10 (that is, “stopped state (DSUSP)”).
Here, when an access request from the DMA unit 23 is generated in the “stop state (DSUSP)”, the execution control unit 21 limits the acceptance of interrupts until the pipeline processing associated with the access request is completed (interrupt enable signal INT_EN). To invalid state).
Then, during the access period of the DMA unit 23 executed in the “stop state (DSUSP)” after the transition period, the interrupt is not accepted and the transition of the debug frame does not occur. The aforementioned problem of being read is solved.
Further, since the debug frame does not change after the access request of the DMA unit 23 is accepted, the debug frame in which the access request of the DMA unit 23 is accepted, and the memory or the like is actually received by accepting the request. Always matches the debug frame in which the access is performed. That is, there is no problem that access by the DMA unit 23 is executed in a frame different from the desired debug frame.
図13は、本実施形態に係る図1に示すプロセッサにおいて、プログラムの実行を停止する際の遷移期間にDMA要求が発生する場合の動作例を示すタイミング図である。図13(A)〜(O)は、それぞれ図9(A),(C)〜(P)に対応する。 FIG. 13 is a timing chart showing an operation example when a DMA request is generated in the transition period when the execution of the program is stopped in the processor shown in FIG. 1 according to the present embodiment. FIGS. 13A to 13O correspond to FIGS. 9A and 9C, respectively.
命令処理部10は、ソフトウェア・ブレークポイントの停止命令(ESTOP)をプリデコードすると(サイクルC451)、新たな命令のデコードを停止し、状態信号S1を「1」に設定する(サイクルC452)。パイプラインに残る命令の処理が完了し、状態信号S1が「1」から「0」へ変化すると(サイクルC461)、デバッグ制限部30による制限が解除され、デバッグ部20はデバッグ状態レジスタ24(DBGSTAT)及びステートマシン211(EXSM)を更新する(サイクルC462)。
このように状態信号S1が「1」となる期間(サイクルC452〜C460)において、DMA部23はメモリ等へのアクセスを指示するコマンドを入力し、これに応じたリクエスト信号DMA_RQを出力する(サイクルC453)。このとき状態信号S1は「1」なので、AND回路33から出力されるリクエスト信号DMA_RQMは「0」になる。その結果、DMA部23から出力されるリクエスト信号DMA_RQは命令処理部10において受け付けられず、DMA部23によるDMA要求は待機状態となる。
状態信号S1が「1」から「0」に変化すると、AND回路33によるリクエスト信号DMA_RQのマスキングが解除されるため、命令処理部10は待機状態のDMA要求を受け付ける(サイクルC462)。
このように、図1に示すプロセッサにおいては、命令実行部13における命令の実行が完了するまでの間、DMA部23によるアクセスが制限されるため、割り込みに伴うデバッグ・フレームの変わり目において相関性のないステータス情報がDMA機能により読み出されるという問題は生じない。
When the instruction processing unit 10 predecodes the software breakpoint stop instruction (ESTOP) (cycle C451), the instruction processing unit 10 stops the decoding of a new instruction and sets the status signal S1 to “1” (cycle C452). When the processing of the instruction remaining in the pipeline is completed and the state signal S1 changes from “1” to “0” (cycle C461), the restriction by the debug restriction unit 30 is released, and the debug unit 20 stores the debug state register 24 (DBGSTAT). ) And the state machine 211 (EXSM) are updated (cycle C462).
In this way, during the period in which the status signal S1 is “1” (cycles C452 to C460), the DMA unit 23 inputs a command instructing access to the memory and the like, and outputs a request signal DMA_RQ corresponding to the command (cycle). C453). At this time, since the status signal S1 is “1”, the request signal DMA_RQM output from the AND circuit 33 is “0”. As a result, the request signal DMA_RQ output from the DMA unit 23 is not accepted by the instruction processing unit 10, and the DMA request by the DMA unit 23 enters a standby state.
When the status signal S1 changes from “1” to “0”, the masking of the request signal DMA_RQ by the AND circuit 33 is cancelled, and the instruction processing unit 10 accepts the DMA request in the standby state (cycle C462).
As described above, in the processor shown in FIG. 1, access by the DMA unit 23 is limited until the execution of the instruction in the instruction execution unit 13 is completed. The problem that no status information is read by the DMA function does not occur.
<2−5> プログラムの実行を停止する際の遷移期間にデバッグ部20のコマンドが実行される場合 <2-5> When the command of the debug unit 20 is executed during the transition period when program execution is stopped
プログラムの実行を停止する際の遷移期間や割り込みルーチンから復帰して停止する際の遷移期間においてデバッグ部20Xにより実行コマンド(RUNCコマンド等)が発行された場合、その実行コマンドの発行以前に既に命令処理部10Xで処理されていた命令に由来するHALTイベントが発生すると、<1−5>において説明したように、実行コマンドの本来の停止条件に含まれていない命令によって命令処理部10Xが停止してまうという問題や、意図しないデバッグ・フレームにおいて実行コマンドが実行されてしまう問題が生じる。
これに対し、本実施形態に係るプロセッサでは、プログラムの実行を停止する際の遷移期間において、デバッグ部20のコマンドの実行(HALT、RUNCコマンドなど)を制限する。
すなわち、プログラム停止時の遷移期間において、コマンドの実行を要求するリクエスト信号EXE_RQが実行制御部21において出力されると、このとき状態信号S1は「1」なので、AND回路32から出力されるリクエスト信号EXE_RQMは「0」になる。その結果、実行制御部21から出力されるリクエスト信号EXE_RQは命令処理部10において受け付けられず、実行制御部21によるコマンド実行要求は待機状態となる。状態信号S1が「1」から「0」に変化すると、AND回路32によるリクエスト信号EXE_RQのマスキングが解除されるため、命令処理部10は待機状態のコマンド実行要求を受け付ける。
このように、図1に示すプロセッサにおいては、遷移期間におけるコマンドの実行(HALT、RUNCコマンドなど)が制限されるため、遷移期間において命令の実行や停止に関わる制御が行われることに伴う上記のような問題が解消される。
If an execution command (such as a RUNC command) is issued by the debug unit 20X during a transition period when program execution is stopped or a transition period when returning from an interrupt routine and stopping, an instruction is already issued before the execution command is issued. When a HALT event derived from an instruction processed by the processing unit 10X occurs, as described in <1-5>, the instruction processing unit 10X is stopped by an instruction not included in the original stop condition of the execution command. The problem is that the execution command is executed in an unintended debug frame.
On the other hand, in the processor according to the present embodiment, command execution (HALT, RUNC command, etc.) of the debug unit 20 is limited in a transition period when program execution is stopped.
That is, when the request signal EXE_RQ requesting execution of the command is output from the execution control unit 21 during the transition period when the program is stopped, the status signal S1 is “1” at this time, so that the request signal output from the AND circuit 32 EXE_RQM becomes “0”. As a result, the request signal EXE_RQ output from the execution control unit 21 is not accepted by the instruction processing unit 10, and the command execution request by the execution control unit 21 is in a standby state. When the status signal S1 changes from “1” to “0”, the masking of the request signal EXE_RQ by the AND circuit 32 is cancelled, and the instruction processing unit 10 receives a command execution request in a standby state.
As described above, in the processor shown in FIG. 1, command execution (HALT, RUNC command, etc.) during the transition period is limited. Therefore, the above-described control associated with instruction execution and stoppage during the transition period is performed. Such a problem is solved.
<2−6> プログラムの実行停止時に割り込みを受け付けた後、HALTイベントが発生した場合 <2-6> When a HALT event occurs after accepting an interrupt when program execution is stopped
図2に示すプロセッサでは、割り込みルーチンの最初又は2番目の命令がソフトウェア・ブレークポイントの停止命令(ESTOP)等の場合、<1−6>において説明したように、HALTイベントが割り込みルーチン内で発生するにもかかわらず、スタックへのステータス情報の保存が行われる前に、デバッグ状態レジスタ24(DBGSTAT)のHALTイベントフラグがセットされ、その内容がスタックに保存されてしまうという問題が生じる。
これに対し、本実施形態に係る図1に示すプロセッサでは、図9に示すように、プログラムの実行を停止する際の遷移期間において割り込みの受付を制限するため、上述した問題が解消される。
In the processor shown in FIG. 2, when the first or second instruction of the interrupt routine is a software breakpoint stop instruction (ESTOP) or the like, a HALT event is generated in the interrupt routine as described in <1-6>. However, before the status information is saved in the stack, the HALT event flag of the debug status register 24 (DBGSTAT) is set, and the content is saved in the stack.
On the other hand, in the processor shown in FIG. 1 according to the present embodiment, as shown in FIG. 9, since the acceptance of interrupts is limited in the transition period when the execution of the program is stopped, the above-described problem is solved.
<2−7> ベンチマークカウンタ221においてカウントを行っている途中でプログラムの実行を停止する場合 <2-7> Stopping program execution while the benchmark counter 221 is counting
図2に示すプロセッサでは、プログラムの実行を停止する際、パイプラインに未処理の命令が残存していても、HALTイベント発生時点から一定期間の後にカウントを停止するため、パイプラインに残存するHALTイベント発生以前の命令に由来するイベント(例えば、ウォッチポイント)についてはカウントの対象から除外されてしまうという問題が生じる。
一方、図1に示すプロセッサが備えるベンチマークカウンタ221は、デバッグのためにプログラムの実行を停止する場合においては、状態信号S1が「1」の間、すなわち命令処理部10のパイプライン処理の未完了状態を示している間において、命令処理部10の処理に関連するイベントの発生を示す信号のカウントを継続することが可能である。したがって、図1に示すプロセッサによれば、従来カウント対象から除外されている遷移期間のイベントを正しくカウントすることが可能であり、上記の問題を解消することができる。
また、このベンチマークカウンタ221は、パイプライン処理が未完了の遷移期間におけるカウントの条件、すなわち、被カウント信号のカウント動作を実行するか否かや、初期化信号に応じたカウント値の初期化を実行するか否かを選択できる。すなわち、状態信号S1によって遷移期間が明確に示されていることを利用して、遷移期間におけるカウント動作やカウント値初期化動作を非常に簡易な回路で制御できる。その結果、デバッグに関わる様々なカウント機能を非常に簡易な回路構成で実現することが可能である。
更に、遷移期間におけるカウント動作やカウント値初期化動作をコマンドに応じて任意に制御できるようにベンチマークカウンタ221を構成すれば、様々な条件で被カウント信号のカウントを行うことが可能になるため、ユーザの利便性を向上させることができる。
In the processor shown in FIG. 2, even when unprocessed instructions remain in the pipeline when the program execution is stopped, the count is stopped after a certain period from the time when the HALT event occurs. There arises a problem that an event (for example, a watchpoint) derived from an instruction before the occurrence of the event is excluded from the count target.
On the other hand, the benchmark counter 221 provided in the processor shown in FIG. 1 is not completed when the status signal S1 is “1”, that is, the pipeline processing of the instruction processing unit 10 is not completed when the execution of the program is stopped for debugging. While the state is indicated, it is possible to continue counting signals indicating the occurrence of an event related to the processing of the instruction processing unit 10. Therefore, according to the processor shown in FIG. 1, it is possible to correctly count the events in the transition period that have been excluded from the conventional counting target, and the above problem can be solved.
Further, the benchmark counter 221 initializes the count value according to the count condition in the transition period in which the pipeline processing is not completed, that is, whether to perform the counting operation of the counted signal, or the initialization signal. You can choose whether or not to run. That is, by utilizing the fact that the transition period is clearly indicated by the status signal S1, the count operation and the count value initialization operation in the transition period can be controlled with a very simple circuit. As a result, various count functions related to debugging can be realized with a very simple circuit configuration.
Furthermore, if the benchmark counter 221 is configured so that the count operation and the count value initialization operation in the transition period can be arbitrarily controlled according to the command, it becomes possible to count the counted signal under various conditions. User convenience can be improved.
以上説明したように、本実施形態に係る図1に示すプロセッサによれば、パイプライン方式にて命令を処理する命令処理部10において当該命令の処理が停止される場合、新たな命令の処理が停止されるとともに、既に開始された処理が完了したか否かを示す状態信号S1が出力される。この状態信号S1が命令処理部10における処理の未完了状態を示す場合、デバッグ部20によるデバッグ動作の実行がデバッグ制限部30により制限される。すなわち、命令処理部10への命令の入力を停止してから、その停止より前に既に開始された処理が完了するまでの間、命令処理部10の動作の制御やその動作状態の記録などに関連するデバッグ動作が制限される。 As described above, according to the processor shown in FIG. 1 according to the present embodiment, when the instruction processing unit 10 that processes an instruction in the pipeline system stops processing the instruction, a new instruction is processed. In addition to being stopped, a status signal S1 indicating whether or not the already started processing is completed is output. When the status signal S1 indicates an incomplete state of processing in the instruction processing unit 10, execution of the debug operation by the debug unit 20 is restricted by the debug restriction unit 30. That is, for the control of the operation of the instruction processing unit 10 and the recording of its operation state after the input of the instruction to the instruction processing unit 10 is stopped until the processing already started before the stop is completed. Related debugging behavior is limited.
従来のパイプライン方式のプロセッサでは、HALTイベント等によるデバッグ状態の変化が、それ以前にデコードされた命令の実行が完了しているかどうかに関わらず、新たな命令のデコードを停止してから一定のクロックサイクル後に起こっている。これは、単純に、命令レジスタ(フェッチした命令をデコードするために格納するレジスタ)への新たな命令の供給を止めた時点において、プログラムの実行が停止状態になったと見なしていたことによる。すなわち、プログラムの実行が停止したかどうかの境界線が、命令レジスタへの命令供給の停止時点に設定されている。
しかしながら、パイプラインにおいて未だ命令の実行が続いている段階で、プロセッサの動作状態を制御するデバッグ用のコマンドを実行したり、HALTイベントに応じてステータス情報を更新したり、割り込み要求を受け付けたり、更にはデバッグ用のDMA機能によるメモリ等へのアクセスを有効にしたりすると、デバッグ上のさまざまな問題(パイプライン・ハザード)が生じる。これを解消するため、例えば問題が生じる条件ごとに個別に動作結果だけの整合を得ようとすると、その制御が非常に複雑になる。また、問題が生じる全ての条件を抽出することは困難である。
これらの問題の原因は、HALTイベントによるデバッグ状態の変化、あるいはその前後のデバック動作がプロセッサのプログラム・フローに同期化されていないことにある。本実施形態に係るプロセッサでは、HALTイベント事態を一つの命令(「HALT」:停止信号SH)と見なし、それをパイプラインと同期した処理フロー上に明示的に乗せることで問題の解決を図っている。すなわち、この仮想的な命令「HALT」がパイプラインの段階を通過しているか否かを検出することによって、命令実行部11への命令供給を停止する以前に既に供給されている命令がパイプラインの全段階を通過してその処理が完了する時点を、デバッグ部20に対し容易に伝えることができる。これにより、プログラムの実行の停止や開始の境界線がデバッグ動作にとって極めて明確なものとなり、命令実行部13に実行中の命令が残っている状態でデバッグ動作が行われることによる種々の問題(パイプライン・ハザード)を解消することができる。
In the conventional pipeline processor, the change in the debug state due to a HALT event or the like is constant after stopping the decoding of a new instruction regardless of whether or not the execution of the previously decoded instruction has been completed. Is happening after a clock cycle. This is simply because when the supply of a new instruction to the instruction register (a register for storing a fetched instruction) is stopped, it is considered that the execution of the program has been stopped. In other words, the boundary line indicating whether or not the execution of the program is stopped is set at the time when the instruction supply to the instruction register is stopped.
However, when instructions are still being executed in the pipeline, a debug command that controls the operating state of the processor is executed, status information is updated in response to a HALT event, an interrupt request is received, Furthermore, if access to a memory or the like by the DMA function for debugging is made effective, various problems (pipeline hazard) on debugging occur. In order to solve this problem, for example, if it is attempted to obtain only the matching of the operation results for each condition causing a problem, the control becomes very complicated. Also, it is difficult to extract all conditions that cause problems.
The cause of these problems is that the debug state change due to the HALT event, or the debugging operation before and after that, is not synchronized with the program flow of the processor. In the processor according to the present embodiment, the HALT event situation is regarded as one instruction (“HALT”: stop signal SH), and the problem is solved by explicitly placing it on the processing flow synchronized with the pipeline. Yes. That is, by detecting whether or not the virtual instruction “HALT” has passed through the pipeline stage, the instruction already supplied before the instruction supply to the instruction execution unit 11 is stopped is pipelined. It is possible to easily tell the debug unit 20 when the processing is completed after passing through all the stages. As a result, the boundary between the stop and start of program execution becomes very clear for the debug operation, and various problems (pipe) due to the debug operation being performed in a state where the instruction being executed remains in the instruction execution unit 13. Line hazards can be eliminated.
また、本実施形態に係るプロセッサでは、命令処理部10における命令の処理が未完了の状態か否かを示す状態信号S1を用いることによって、デバッグ用のコマンドの実行、HALTイベントに応じたステータス情報の更新、割り込み要求の受付、DMA機能によるメモリへのアクセス等、様々なデバッグ動作のそれぞれについて、待機状態にするのか、無視するのか、又はそのまま実行するのかといった制御を非常に簡易な回路で実現できる。 Further, in the processor according to the present embodiment, by using the state signal S1 indicating whether or not the instruction processing in the instruction processing unit 10 is in an incomplete state, execution of a debug command and status information corresponding to the HALT event Control of whether to enter standby mode, ignore it, or execute it as it is, for each of various debugging operations, such as update of data, acceptance of interrupt request, access to memory by DMA function, etc. is realized with a very simple circuit it can.
また、本実施形態に係るプロセッサでは、HALTイベントの命令「HALT」(すなわち停止信号SH)が通常のパイプラインの段階を通過した後更に拡張段階(WRITE3)を通過するように、拡張遅延部161を設けている。これにより、命令がパイプラインの全段階を通過した後で、その命令の実行に付随した処理(HALTイベントの処理など)が発生する場合でも、その付随した処理が上述した拡張段階(WRITE3)において発生させることで、付随した処理が発生する期間においてデバッグ動作を適切に制限することができる。 In the processor according to the present embodiment, the expansion delay unit 161 is configured so that the HALT event instruction “HALT” (that is, the stop signal SH) passes through the normal pipeline stage and then passes through the expansion stage (WRITE3). Is provided. As a result, even if processing associated with execution of the instruction (such as processing of a HALT event) occurs after the instruction has passed through all stages of the pipeline, the associated processing is performed in the above-described expansion stage (WRITE 3). By generating it, it is possible to appropriately limit the debugging operation in a period in which the accompanying process occurs.
次に、本実施形態に係るプロセッサの変形例について説明する。 Next, a modification of the processor according to the present embodiment will be described.
図14は、本実施形態に係るプロセッサの第1の変形例を示す図である。
図14に示すプロセッサは、命令処理部10Aと、デバッグ部20と、デバッグ制限部30とを有する。図14と図1における同一符号は同一の構成要素を示す。
FIG. 14 is a diagram illustrating a first modification of the processor according to the present embodiment.
The processor illustrated in FIG. 14 includes an instruction processing unit 10A, a debugging unit 20, and a debugging restriction unit 30. 14 and FIG. 1 indicate the same components.
命令処理部10Aは、命令の処理を停止しているときにDMA部23によるアクセスや命令の挿入が生じた場合、当該アクセス等に伴う命令の処理が完了したか否かを示す状態信号S1を出力する。命令の処理を停止する場合に状態信号S1を出力する動作については、図1における命令処理部10と同じである。 When the instruction processing unit 10A stops the processing of the instruction and the DMA unit 23 accesses or inserts an instruction, the instruction processing unit 10A displays a status signal S1 indicating whether or not the processing of the instruction associated with the access is completed. Output. The operation of outputting the status signal S1 when the instruction processing is stopped is the same as that of the instruction processing unit 10 in FIG.
命令処理部10Aは、例えば図14に示すように信号発生部15Aを有する。
信号発生部15Aは、HALTイベント等に応じて入力制御部11による命令の入力が停止された場合に加えて、命令の処理を停止しているときにDMA部23によるアクセス等が生じた場合にも、停止信号SHを発生する。信号発生部15Aは、ステートマシン211(EXSM)におけるステートを示す信号EXSM_STATとDMA部23からのリクエスト信号DMA_RQMとを入力し、ステートマシン211のステートが「停止状態(DSUSP)」かつリクエスト信号DMA_RQMが「1」の場合に停止信号SHを発生する。
The instruction processing unit 10A includes a signal generation unit 15A as shown in FIG. 14, for example.
In addition to the case where the input of the instruction by the input control unit 11 is stopped in response to the HALT event or the like, the signal generating unit 15A is used when the access or the like by the DMA unit 23 occurs while the instruction processing is stopped. Also generates a stop signal SH. The signal generator 15A receives the signal EXSM_STAT indicating the state in the state machine 211 (EXSM) and the request signal DMA_RQM from the DMA unit 23. The state of the state machine 211 is “stopped (DSUSP)” and the request signal DMA_RQM is In the case of “1”, a stop signal SH is generated.
なお、デバッグ制限部30は、状態信号S1がDMA部23のアクセス等に伴う命令の処理の未完了を示す場合、状態信号S1が当該処理の完了状態を示すまで命令処理部10Aにおける割り込み要求の受付を制限する。 When the status signal S1 indicates that the instruction processing accompanying the DMA unit 23 access or the like is not completed, the debug limiting unit 30 determines whether the interrupt request in the instruction processing unit 10A is output until the status signal S1 indicates the completion status of the processing. Restrict reception.
命令処理部10Aにおいて命令の処理が停止されているとき、DMA部23によるメモリやレジスタへのアクセスや命令の挿入が開始され、さらにその直後に割り込み要求が受け付けられて割り込みルーチンへの移行が開始された場合、DMA部23のリクエストが発行されたときのデバック・フレーム(割り込みの階層)と、DMA部23が実際にアクセスを行うときのデバッグ・フレームとが一致しない場合がある。その場合、DMA部23によるアクセスが所望のデバッグ・フレームとは異なるフレームで実行されるという問題が生じる。
そこで、図14に示すプロセッサでは、命令の処理を停止しているときにDMA部23によるアクセス等が生じた場合、そのアクセス等に伴う処理が完了するまで、命令処理部10Aにおける割り込み要求の受付を制限する。
図15はその動作例を示すタイミング図であり、図15(A)〜(P)はそれぞれ図9(A)〜(P)に対応する。プログラムの実行を停止している「停止状態(DSUSP)」のステートにおいてDMA部23から「1」のリクエスト信号DMA_RQMを入力すると、信号発生部15Aは停止信号SHを出力する(サイクルC501)。この停止信号SHを入力した信号伝播部16は、命令実行部13におけるパイプラインの段階の進行に合わせて、遅延部(RB1,…,RBn,161)により段階的に停止信号SHを伝播する。状態信号出力部17は、信号伝播部18において停止信号SHが伝播していることを検知すると、状態信号S1を「1」に設定する(サイクルC502〜C510)。状態信号S1が「1」の期間において、DMA部23によるアクセスが行われる。例えば、DMA部23は、命令実行部13のデコード段階のパイプラインに対してレジスタの読み書き要求を直接挿入させることにより、命令実行部13のパイプライン処理を利用してレジスタの読み書きを実行させる。このDMAアクセスによるパイプライン処理が未完了の間、状態信号S1は「1」になる。状態信号S1が「1」のときに割り込み要求が発生すると(サイクルC503)、図9の場合と同様、状態信号S1が「0」になるまで割り込み要求は待機状態となる。
このように、図14に示すプロセッサでは、プログラムの実行停止時にDMA部23のアクセス等が発生した場合、割り込み要求の受付を制限する。これにより、DMA部23のアクセス等が所望のデバッグ・フレームと異なるフレームで実行される問題を解消することができる。
When instruction processing is stopped in the instruction processing unit 10A, the DMA unit 23 starts accessing the memory and registers and inserting instructions, and immediately after that, an interrupt request is accepted and the transition to the interrupt routine is started. In this case, the debug frame (interrupt hierarchy) when the DMA unit 23 request is issued may not match the debug frame when the DMA unit 23 actually performs access. In this case, there arises a problem that access by the DMA unit 23 is executed in a frame different from a desired debug frame.
Therefore, in the processor shown in FIG. 14, if an access or the like by the DMA unit 23 occurs while the instruction processing is stopped, the instruction processing unit 10A accepts an interrupt request until the processing associated with the access or the like is completed. Limit.
FIG. 15 is a timing diagram showing an example of the operation, and FIGS. 15A to 15P correspond to FIGS. 9A to 9P, respectively. When a request signal DMA_RQM of “1” is input from the DMA unit 23 in the “stop state (DSUSP)” state in which execution of the program is stopped, the signal generation unit 15A outputs a stop signal SH (cycle C501). The signal propagation unit 16 to which the stop signal SH is input propagates the stop signal SH step by step by the delay units (RB1,..., RBn, 161) in accordance with the progress of the pipeline stage in the instruction execution unit 13. When the state signal output unit 17 detects that the stop signal SH is propagated in the signal propagation unit 18, the state signal output unit 17 sets the state signal S1 to “1” (cycles C502 to C510). During the period in which the status signal S1 is “1”, access by the DMA unit 23 is performed. For example, the DMA unit 23 causes a register read / write request to be executed by using the pipeline processing of the instruction execution unit 13 by directly inserting a register read / write request into the decode stage pipeline of the instruction execution unit 13. While the pipeline processing by DMA access is not completed, the status signal S1 becomes “1”. If an interrupt request is generated when the status signal S1 is “1” (cycle C503), the interrupt request is in a standby state until the status signal S1 becomes “0”, as in FIG.
As described above, the processor shown in FIG. 14 restricts acceptance of an interrupt request when an access or the like of the DMA unit 23 occurs when program execution is stopped. As a result, it is possible to solve the problem that the access of the DMA unit 23 is executed in a frame different from the desired debug frame.
図16は、本実施形態に係るプロセッサの第2の変形例を示す図である。
図16に示すプロセッサは、命令処理部10Bと、デバッグ部20と、デバッグ制限部30とを有する。図16と図1における同一符号は同一の構成要素を示す。
FIG. 16 is a diagram illustrating a second modification of the processor according to the present embodiment.
The processor illustrated in FIG. 16 includes an instruction processing unit 10B, a debug unit 20, and a debug restriction unit 30. The same reference numerals in FIG. 16 and FIG. 1 denote the same components.
命令処理部10Bは、命令バッファ・キューIBQと、入力制御部11と、セレクタ12と、命令実行部13と、パイプライン保護部14と、状態信号出力部17Bと、停止命令供給部18とを有する。図16と図1の同一符号は同一の構成要素を示す。 The instruction processing unit 10B includes an instruction buffer / queue IBQ, an input control unit 11, a selector 12, an instruction execution unit 13, a pipeline protection unit 14, a status signal output unit 17B, and a stop instruction supply unit 18. Have. 16 and FIG. 1 indicate the same components.
停止命令供給部18は、入力制御部11により命令実行部13への命令の入力が停止されると、所定の停止命令を命令実行部13に供給する。例えば、HALTイベントが発生してプログラムの実行を停止する場合や、プログラムの実行停止中に生じた割り込みから復帰して再停止する場合などにおいて所定の停止命令を発生する。 The stop command supply unit 18 supplies a predetermined stop command to the command execution unit 13 when the input control unit 11 stops the input of the command to the command execution unit 13. For example, a predetermined stop instruction is generated when a HALT event occurs to stop the execution of a program, or when returning from an interrupt that occurred during the stop of the execution of the program and then stopping again.
また、停止命令供給部18は、命令の処理を停止しているときにDMA部23によるアクセスや命令の挿入が生じた場合にも、所定の停止命令を発生する。すなわち、ステートマシン211(EXSM)におけるステートを示す信号EXSM_STATとDMA部23からのリクエスト信号DMA_RQMとを入力し、ステートマシン211のステートが「停止状態(DSUSP)」かつリクエスト信号DMA_RQMが「1」の場合、所定の停止命令を発生する。 The stop command supply unit 18 also generates a predetermined stop command when access by the DMA unit 23 or insertion of a command occurs while processing of the command is stopped. That is, the signal EXSM_STAT indicating the state in the state machine 211 (EXSM) and the request signal DMA_RQM from the DMA unit 23 are input, the state of the state machine 211 is “stopped (DSUSP)”, and the request signal DMA_RQM is “1”. A predetermined stop command is generated.
状態信号出力部17Bは、停止命令供給部18より供給された所定の停止命令が命令実行部13において実行中であるか否か(すなわちパイプラインの段階を通過中であるか)を検知し、その検知結果を状態信号S1として出力する。例えば、所定の停止命令が実行中であれば「1」、実行中でなければ「0」の状態信号S1を出力する。
なお、命令実行部13は、この所定の停止命令については実行結果(例えばメモリへのアクセスや演算結果の出力)を伴わない形式的な処理を行ってもよいし、特定の実行結果が生じるような処理を行ってもよい。
The status signal output unit 17B detects whether or not the predetermined stop instruction supplied from the stop instruction supply unit 18 is being executed in the instruction execution unit 13 (that is, whether it is passing through the pipeline stage), The detection result is output as the status signal S1. For example, a status signal S1 of “1” is output if a predetermined stop instruction is being executed, and “0” if it is not being executed.
Note that the instruction execution unit 13 may perform a formal process without an execution result (for example, access to a memory or output of an operation result) for the predetermined stop instruction, or a specific execution result may be generated. May be performed.
上述した構成によれば、HALTイベントの発生等に応じて命令実行部13への命令の入力が停止された場合や、プログラムの実行停止時にDMA部23のアクセス等が生じた場合、命令実行部13に所定の停止命令が供給される。この停止命令が命令実行部13において実行されている間、状態信号出力部17からは、命令実行部13における命令の実行が完了していないことを示す状態信号S1が出力される。この状態信号S1が出力される場合、デバッグ部20によるデバッグ動作(割り込み要求の受付、DMA部23によるアクセス、ステートマシン211(EXSM)の更新、デバッグ状態レジスタ24(DBGSTAT)の更新、デバッグ部20のコマンドの実行など)が制限される。
したがって、図16に示すプロセッサにおいても、プログラムが実行を停止する際の遷移期間におけるデバッグ動作が制限されるため、種々のパイプライン・ハザードを防止できる。また、DMAにおけるアクセスが発生した場合に割り込み要求の受付を制限するため、所望のデバッグ・フレーム(割り込みの階層)と異なるフレームにおいてDMAのアクセスが実行されることを防止できる。
According to the configuration described above, when the input of an instruction to the instruction execution unit 13 is stopped in response to the occurrence of a HALT event, or when the DMA unit 23 is accessed when the execution of the program is stopped, the instruction execution unit A predetermined stop command is supplied to 13. While the stop instruction is being executed in the instruction execution unit 13, the state signal output unit 17 outputs a state signal S1 indicating that the instruction execution in the instruction execution unit 13 has not been completed. When this status signal S1 is output, a debugging operation by the debug unit 20 (acceptance of an interrupt request, access by the DMA unit 23, update of the state machine 211 (EXSM), update of the debug status register 24 (DBGSTAT), debug unit 20 Command execution) is limited.
Therefore, in the processor shown in FIG. 16 as well, various pipeline hazards can be prevented because the debugging operation in the transition period when the program stops executing is limited. Further, since the acceptance of an interrupt request is restricted when an access occurs in the DMA, it is possible to prevent the DMA access from being executed in a frame different from a desired debug frame (interrupt hierarchy).
以上、本発明の実施形態について説明したが、本発明は上記の実施形態のみに限定されるものではなく、種々のバリエーションを含んでいる。 As mentioned above, although embodiment of this invention was described, this invention is not limited only to said embodiment, Various variations are included.
CPUのペリフェラル・モジュールの中には、デバッグ時においてCPUの命令実行が停止した場合の動作を規定するため、命令レジスタへの命令供給が停止されている状態を示す信号の出力をプロセッサに要求するものがある。本実施形態によれば、プロセッサの動作状態を示すステートマシン211(EXSM)の情報と、上述した状態信号S1とに基づいて、簡易な論理演算により上記の信号を生成することができる。 The CPU peripheral module requests the processor to output a signal indicating that the instruction supply to the instruction register is stopped in order to define the operation when the CPU instruction execution is stopped during debugging. There is something. According to the present embodiment, the above signal can be generated by a simple logical operation based on the information of the state machine 211 (EXSM) indicating the operating state of the processor and the above-described state signal S1.
本発明のプロセッサは、パイプライン方式にて命令を処理する任意のプロセッサに広く適用可能である。 The processor of the present invention is widely applicable to any processor that processes instructions in a pipeline manner.
図1に示すプロセッサは、命令処理部10と、デバッグ部20と、デバッグ制限部30とを有する。
10,10A,10B…命令処理部、11…入力制御部、12…セレクタ、13…命令実行部、14…パイプライン保護部、15,15A…信号発生部、16…信号伝播部、161…拡張遅延部、17,17B…状態信号出力部、20…デバッグ部、21…実行制御部、22…分析部、23…DMA部、24…デバッグ状態レジスタ(DBGSTAT)、30…デバッグ制限部,30、31,32,33,36…AND回路、34…エッジ検出回路、35…ACK信号保持回路、IBQ…命令バッファ・キュー
The processor illustrated in FIG. 1 includes an instruction processing unit 10, a debug unit 20, and a debug restriction unit 30.
DESCRIPTION OF SYMBOLS 10,10A, 10B ... Instruction processing part, 11 ... Input control part, 12 ... Selector, 13 ... Instruction execution part, 14 ... Pipeline protection part, 15, 15A ... Signal generation part, 16 ... Signal propagation part, 161 ... Expansion Delay unit, 17, 17B ... Status signal output unit, 20 ... Debug unit, 21 ... Execution control unit, 22 ... Analysis unit, 23 ... DMA unit, 24 ... Debug status register (DBGSTAT), 30 ... Debug limiting unit, 30, 31, 32, 33, 36 ... AND circuit, 34 ... edge detection circuit, 35 ... ACK signal holding circuit, IBQ ... instruction buffer queue
Claims (13)
入力されるコマンドに応じて、少なくとも前記命令処理部の動作の制御又は当該動作の状態の記録に関連するデバッグ動作を実行するデバッグ部と、
前記状態信号が未完了状態を示す期間に前記デバッグ部が前記デバッグ動作を実行しようとした場合、当該デバッグ動作を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留したデバッグ動作を実行させるデバッグ制限部と
を有するプロセッサ。 A series of instructions sequentially processed by pipelining, to stop the process, as well as prohibiting the start of the process of the new instruction, already started when the disables the start of the processing of the new instruction Tei An instruction processing unit for outputting a status signal indicating whether or not incomplete processing has been completed;
In accordance with an input command, at least a debug unit that executes a debug operation related to control of operation of the instruction processing unit or recording of the state of the operation;
If the status signal is the debugger in the period indicated incomplete state attempts to execute the debugging operation, suspended without executing the debug operation, after the state signal is changed to the completion state of incompletion state A processor having a debug restriction unit for executing the suspended debug operation .
前記命令処理部は、一連の命令の処理を停止する場合、前記新たな命令の処理の開始を禁止したとき既に前記メモリアクセス部のアクセスに応じて開始されていた未完了の処理又は前記新たな命令の処理の開始を禁止したとき既に前記メモリアクセス部の前記命令の挿入に応じて開始されていた未完了の処理を含む前記既に開始されていた未完了の処理が完了したか否かを示す前記状態信号を出力する、
請求項1に記載のプロセッサ。 The debug unit has a memory access unit that accesses at least a storage unit to be accessed by the instruction processing unit or inserts further instructions into the series of instructions according to an input command. ,
It said instruction processing unit to stop processing the sequence of instructions, are already new in response to said access memory access section of the completion Not having been started process or when said prohibited the start of the process of the new instruction indicates whether already the insertion the already outstanding that were start processing includes processing uncompleted had been initiated in response to the instruction of the memory access unit is completed when the disables the start of processing of instructions Outputting the status signal;
The processor of claim 1.
入力される一連の命令をパイプライン方式にて実行する命令実行部と、
前記命令実行部への命令の入力を制御する入力制御部と、
前記入力制御部により前記命令実行部への命令の入力が停止されると所定の停止信号を発生する信号発生部と、
前記信号発生部において発生した停止信号を初段に入力し、前記命令実行部における命令の実行段階の進行と同期して、当該入力した停止信号を順次に後段へ伝播する複数の遅延部を含んだ信号伝播部と、
前記停止信号が前記信号伝播部を伝播しているか否か検知し、当該検知結果を前記状態信号として出力する状態信号出力部とを含む、
請求項1に記載のプロセッサ。 The instruction processing unit
An instruction execution unit that executes a series of input instructions in a pipeline manner;
An input control unit that controls input of an instruction to the instruction execution unit;
A signal generator for generating a predetermined stop signal when the input of the instruction to the instruction execution unit is stopped by the input control unit;
The stop signal generated in the signal generation unit is input to the first stage, and includes a plurality of delay units that sequentially propagate the input stop signal to the subsequent stage in synchronization with the progress of the instruction execution stage in the instruction execution unit. A signal propagation part;
A state signal output unit that detects whether or not the stop signal propagates through the signal propagation unit, and outputs the detection result as the state signal,
The processor of claim 1.
前記命令実行部において一の命令を実行するための複数の段階に対応し、前記停止信号を伝搬する複数の遅延部と、
前記複数の段階による命令の実行に付随した処理が実行され得る一定の期間において、前記複数の段階に対応する前記複数の遅延部により伝搬された前記停止信号を更に伝播する拡張遅延部とを含む、
請求項3に記載のプロセッサ。 The signal propagation part is
A plurality of delay units for propagating the stop signal , corresponding to a plurality of stages for executing one command in the command execution unit;
An extended delay unit that further propagates the stop signal propagated by the plurality of delay units corresponding to the plurality of stages in a certain period during which processing associated with execution of instructions by the plurality of stages can be executed ,
The processor according to claim 3.
入力される一連の命令をパイプライン方式にて実行する命令実行部と、
前記命令実行部への命令の入力を制御する入力制御部と、
前記入力制御部により前記命令実行部への命令の入力が停止されると、所定の停止命令を前記命令実行部に供給する停止命令供給部と、
前記命令実行部において前記所定の停止命令が実行中であるか否かを検知し、当該検知結果を前記状態信号として出力する状態信号出力部とを含む、
請求項1に記載のプロセッサ。 The instruction processing unit
An instruction execution unit that executes a series of input instructions in a pipeline manner;
An input control unit that controls input of an instruction to the instruction execution unit;
A stop command supply unit that supplies a predetermined stop command to the command execution unit when input of the command to the command execution unit is stopped by the input control unit;
A state signal output unit that detects whether or not the predetermined stop instruction is being executed in the instruction execution unit, and outputs the detection result as the state signal;
The processor of claim 1.
前記デバッグ制限部は、前記状態信号が未完了状態を示す期間に前記割り込み要求が発生した場合、前記デバッグ部の制御に応じた前記命令処理部における当該割り込み要求の受付を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留した割り込み要求の受付を実行させる、
請求項1、2、3、4又は5の何れか一項に記載のプロセッサ。 The debug unit can control the instruction processing unit to accept an interrupt request even when instruction processing is stopped,
It said debug limiting unit, when said interrupt request is generated, suspends without executing the acceptance of the interrupt request in the instruction processing unit according to the control of the debugger during a period when the state signal indicates an uncompleted state , Causing the pending interrupt request to be accepted after the status signal has changed from an incomplete state to a complete state,
The processor according to any one of claims 1, 2, 3, 4 or 5.
前記デバッグ制限部は、前記状態信号が未完了状態を示す期間に前記メモリアクセス部が前記アクセス又は前記命令の挿入を実行しようとした場合、当該アクセス又は当該命令の挿入を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留したアクセス又は命令の挿入を実行させる、
請求項1、2、3、4又は5の何れか一項に記載のプロセッサ。 The debug unit has a memory access unit that accesses at least a storage unit to be accessed by the instruction processing unit or inserts further instructions into the series of instructions according to an input command. ,
Said debug limiting unit, when said memory access unit tries to perform the insertion of the access or the instruction, and hold without executing the insertion of the access or the instruction during a period when the state signal indicates an uncompleted state , Causing the pending access or instruction insertion to be executed after the status signal changes from an incomplete state to a completed state,
The processor according to any one of claims 1, 2, 3, 4 or 5.
前記命令処理部は、命令の処理を停止しているときに前記メモリアクセス部による前記アクセス又は前記命令の挿入が生じた場合、当該アクセスに応じた処理が完了したか否か又は当該挿入した命令に応じた処理が完了したか否かを示す前記状態信号を出力し、
前記デバッグ制限部は、前記状態信号が前記メモリアクセス部のアクセスに応じた処理の未完了又は前記挿入した命令に応じた処理の未完了を示す期間に前記割り込み要求が発生した場合、前記デバッグ部の制御に応じた前記命令処理部における当該割り込み要求の受付を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留した割り込み要求の受付を実行させる、
請求項7に記載のプロセッサ。 The debug unit can control the instruction processing unit to accept an interrupt request even when instruction processing is stopped,
If the access by the memory access unit or the insertion of the instruction occurs while the instruction processing unit stops the processing of the instruction, whether the processing according to the access is completed or the inserted instruction Output the status signal indicating whether or not the processing according to
When the interrupt request is generated in a period in which the status signal indicates that the processing corresponding to the access of the memory access unit is not completed or the processing corresponding to the inserted instruction is not completed, the debugging unit wherein according to a control of pending without executing the acceptance of the interrupt request in the instruction processing unit, said state signal to execute the reception of the hold the interrupt request after changing to completion state from an uncompleted state,
The processor according to claim 7.
前記デバッグ制限部は、前記状態信号が未完了状態を示す期間に前記デバッグ部が前記ステートマシンのステートの更新を実行しようとした場合、当該ステートの更新を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留したステートの更新を実行させる、
請求項1、2、3、4又は5の何れか一項に記載のプロセッサ。 The debug unit has a state machine indicating an instruction execution state in the instruction processing unit,
Said debug limiting unit, when the status signal is the debugger in the period indicated incomplete state tries to perform an update of the state of the state machine, suspended without executing the updating of the state, the state signal Causes the pending state to be updated after the changes from incomplete to complete
The processor according to any one of claims 1, 2, 3, 4 or 5.
前記デバッグ制限部は、前記状態信号が未完了状態を示す期間に前記デバッグ部が前記記憶部の記憶情報の更新を実行しようとした場合、当該記憶情報の更新を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留した記憶情報の更新を実行させる、
請求項1、2、3、4又は5の何れか一項に記載のプロセッサ。 The debug unit has a storage unit that stores information related to a cause of stoppage of processing in the instruction processing unit,
Said debug limiting unit, when the status signal is the debugger in the period indicated incomplete state tries to perform an update of the stored information of the storage unit, suspended without executing the updating of the stored information, the Update the stored information after the status signal changes from the incomplete state to the complete state,
The processor according to any one of claims 1, 2, 3, 4 or 5.
前記デバッグ制限部は、前記状態信号が未完了状態を示す期間に前記デバッグ部が前記命令処理部における処理の停止又は再開を実行しようとした場合、当該処理の停止又は再開を実行させずに保留し、前記状態信号が未完了状態から完了状態へ変化した後に当該保留した処理の停止又は再開を実行させる、
請求項1、2、3、4又は5の何れか一項に記載のプロセッサ。 The debug unit controls at least stop or restart of processing in the instruction processing unit as the debugging operation,
It said debug limiting unit, when the status signal is the debugger in the period indicated incomplete state attempts to execute a process of stopping or restarting of the instruction processing unit, hold without executing the stop or restart of the process And causing the suspended processing to be stopped or resumed after the state signal changes from the incomplete state to the complete state.
The processor according to any one of claims 1, 2, 3, 4 or 5.
請求項1、2、3、4又は5の何れか一項に記載のプロセッサ。 The debugging unit generates a predetermined event related to the processing of the instruction processing unit during a period in which the instruction is processed by the instruction processing unit, including a case where the state signal indicates an incomplete state Having a counting unit for counting signals indicating
The processor according to any one of claims 1, 2, 3, 4 or 5.
請求項12に記載のプロセッサ。 The counting unit selects at least whether to count the counted signal in a period in which the state signal indicates an incomplete state, or the state signal is in an incomplete state, according to an input control signal It is possible to select whether or not to execute the initialization of the count value according to the initialization signal input during the period indicating
The processor according to claim 12.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2007112789A JP4382833B2 (en) | 2007-04-23 | 2007-04-23 | Processor |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP2007112789A JP4382833B2 (en) | 2007-04-23 | 2007-04-23 | Processor |
Publications (2)
| Publication Number | Publication Date |
|---|---|
| JP2008269390A JP2008269390A (en) | 2008-11-06 |
| JP4382833B2 true JP4382833B2 (en) | 2009-12-16 |
Family
ID=40048782
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP2007112789A Active JP4382833B2 (en) | 2007-04-23 | 2007-04-23 | Processor |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP4382833B2 (en) |
Families Citing this family (4)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP5621232B2 (en) * | 2009-09-11 | 2014-11-12 | 日本電気株式会社 | Out-of-order execution processor |
| US8566645B2 (en) | 2010-12-02 | 2013-10-22 | Advanced Micro Devices, Inc. | Debug state machine and processor including the same |
| KR101991680B1 (en) * | 2012-01-25 | 2019-06-21 | 삼성전자 주식회사 | Hardware debugging apparatus and method of software pipelined program |
| JP2018120449A (en) * | 2017-01-26 | 2018-08-02 | ソニーセミコンダクタソリューションズ株式会社 | Arithmetic processing unit and information processing system |
-
2007
- 2007-04-23 JP JP2007112789A patent/JP4382833B2/en active Active
Also Published As
| Publication number | Publication date |
|---|---|
| JP2008269390A (en) | 2008-11-06 |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| JP6113705B2 (en) | Processor and apparatus for executing lock instructions | |
| JP5047542B2 (en) | Method, computer program, and apparatus for blocking threads when dispatching a multithreaded processor (fine multithreaded dispatch lock mechanism) | |
| US7412589B2 (en) | Method to detect a stalled instruction stream and serialize micro-operation execution | |
| JP4990829B2 (en) | Method and apparatus for suspending execution of thread until specified memory access occurs | |
| US6609193B1 (en) | Method and apparatus for multi-thread pipelined instruction decoder | |
| KR100304182B1 (en) | A device that detects and executes traps on superscalar processors | |
| US20060294326A1 (en) | Primitives to enhance thread-level speculation | |
| US10747543B2 (en) | Managing trace information storage using pipeline instruction insertion and filtering | |
| EP2645236A2 (en) | Semiconductor device | |
| CN101334721A (en) | thread livelock unit | |
| GB2371897A (en) | Tracing out-of-order data | |
| JP2002508564A (en) | Processor with multiple program counters and trace buffers outside execution pipeline | |
| JP2007507791A (en) | System and method for handling exceptional instructions in a trace cache based processor | |
| US20170024249A1 (en) | Parallel Execution Mechanism and Operating Method Thereof | |
| US6647488B1 (en) | Processor | |
| JP4382833B2 (en) | Processor | |
| US6006325A (en) | Method and apparatus for instruction and data serialization in a computer processor | |
| US20050060577A1 (en) | Interrupt verification support mechanism | |
| KR100263262B1 (en) | Microprocessor | |
| US7155718B1 (en) | Method and apparatus to suspend and resume on next instruction for a microcontroller | |
| KR20180126518A (en) | Vector instruction processing | |
| JPH05181676A (en) | Parallel processing type processor system | |
| JP2004192021A (en) | Microprocessor | |
| JP3199035B2 (en) | Processor and execution control method thereof | |
| US7069424B2 (en) | Placing front instruction in replay loop to front to place side instruction into execution stream upon determination of criticality |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20090406 |
|
| A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20090602 |
|
| TRDD | Decision of grant or rejection written | ||
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20090914 |
|
| A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 |
|
| RD04 | Notification of resignation of power of attorney |
Free format text: JAPANESE INTERMEDIATE CODE: A7424 Effective date: 20090924 |
|
| A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20090917 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20121002 Year of fee payment: 3 |
|
| R150 | Certificate of patent or registration of utility model |
Ref document number: 4382833 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
| FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20131002 Year of fee payment: 4 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| S111 | Request for change of ownership or part of ownership |
Free format text: JAPANESE INTERMEDIATE CODE: R313113 |
|
| S533 | Written request for registration of change of name |
Free format text: JAPANESE INTERMEDIATE CODE: R313533 |
|
| R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |
|
| R250 | Receipt of annual fees |
Free format text: JAPANESE INTERMEDIATE CODE: R250 |