JP7069870B2 - Information processing equipment - Google Patents

Information processing equipment Download PDF

Info

Publication number
JP7069870B2
JP7069870B2 JP2018046086A JP2018046086A JP7069870B2 JP 7069870 B2 JP7069870 B2 JP 7069870B2 JP 2018046086 A JP2018046086 A JP 2018046086A JP 2018046086 A JP2018046086 A JP 2018046086A JP 7069870 B2 JP7069870 B2 JP 7069870B2
Authority
JP
Japan
Prior art keywords
instruction
interrupt
priority
interrupt handler
conditional branch
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
Application number
JP2018046086A
Other languages
Japanese (ja)
Other versions
JP2019159852A (en
Inventor
修平 内田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Fuji Electric Co Ltd
Original Assignee
Fuji Electric Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Fuji Electric Co Ltd filed Critical Fuji Electric Co Ltd
Priority to JP2018046086A priority Critical patent/JP7069870B2/en
Publication of JP2019159852A publication Critical patent/JP2019159852A/en
Application granted granted Critical
Publication of JP7069870B2 publication Critical patent/JP7069870B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Description

本発明は、組込み機器などマイクロプロセッサを内蔵する情報処理装置に係り、特に、マイクロプロセッサの外部または内部で発生する割込み信号により起動される複数の割込みハンドラの優先度を変更することのできる情報処理装置に関するものである。 The present invention relates to an information processing device having a built-in microprocessor such as an embedded device, and in particular, information processing capable of changing the priority of a plurality of interrupt handlers activated by an interrupt signal generated outside or inside the microprocessor. It is about the device.

一般にマイクロプロセッサ(以下、「MPU」という。)を内蔵する組込み機器では、MPUの外部または内部で割込み信号が発生したときに、組込み機器のソフトウェアプログラムの開発者(以下、単に「開発者」という。)が予め設定した優先度で夫々の割込み信号に対応する割込みハンドラが実行される。この割込み信号は、ある事象(イベント)が発生したときに発生する場合もあるが、タイマ割込みなど周期的に発生する場合も少なからずある。複数の割込みが同時に発生する場合もあるが、この場合は開発者が割込み信号ごとに予め設定した優先度に基づいて、優先度の高い順に割込みハンドラが実行される。 Generally, in an embedded device having a built-in microprocessor (hereinafter referred to as "MPU"), when an interrupt signal is generated outside or inside the MPU, the developer of the software program of the embedded device (hereinafter, simply referred to as "developer"). The interrupt handler corresponding to each interrupt signal is executed with the priority set by.). This interrupt signal may occur when a certain event (event) occurs, but it may also occur periodically such as a timer interrupt. A plurality of interrupts may occur at the same time. In this case, the interrupt handler is executed in descending order of priority based on the priority preset for each interrupt signal by the developer.

使用する割込み信号や割込みの優先度を適切に設計することは、リアルタイム性の要求される組込み機器では特に重要であるが、これらの設計は経験や勘に頼るところが大きいのが現状である。特に、複数の割込みが同時に発生した場合の優先度を決定するためには、組込み機器の機能全体を理解すると共にMPUの動作や仕様等の理解が必要になるので難易度が高い。 Appropriately designing the interrupt signal to be used and the priority of interrupts is especially important for embedded devices that require real-time performance, but the current situation is that these designs rely largely on experience and intuition. In particular, in order to determine the priority when a plurality of interrupts occur at the same time, it is necessary to understand the entire function of the embedded device and the operation and specifications of the MPU, which is difficult.

ソフトウェアプログラムを試験的に実行することによりプログラムの挙動を確認しながら優先度を変更することは、優先度の設計の難易度を下げるために有効であり、従来から割込みハンドラの優先度を切り替えるための技術が提案されている。(例えば、特許文献1を参照)。 Changing the priority while checking the behavior of the program by executing the software program on a trial basis is effective for reducing the difficulty of designing the priority, and for switching the priority of the interrupt handler from the past. Technology has been proposed. (See, for example, Patent Document 1).

特開2004-127039号公報Japanese Unexamined Patent Publication No. 2004-127039

特許文献1に記載の技術は、優先度の高いタスクが長時間待たされることを防止するため、開発者が予め設定した共有資源へのアクセス時間帯に基づいて共有資源アクセス時にMPUがタスクの優先度を動的に変更するというものである。 In the technique described in Patent Document 1, in order to prevent a task having a high priority from being waited for a long time, the MPU gives priority to the task when accessing the shared resource based on the access time zone for the shared resource preset by the developer. The degree is changed dynamically.

しかしながら、特許文献1は、利用者が予め指定した共有資源へのイベント的なアクセスの際、その時間帯に基づいてタスクの優先度を変更するという技術であり、定周期割込みの周期を所望通りにするための優先度変更には適用できない。 However, Patent Document 1 is a technique of changing the priority of a task based on the time zone when an event-like access to a shared resource specified by a user occurs, and the periodic interrupt cycle is as desired. It cannot be applied to the priority change to make it.

本発明は、上述のかかる事情に鑑みてなされたものであり、複数の定周期割込みの優先度を夫々の割込みハンドラの実行状況に基づいて動的に変更することにより、各割込み優先度を適切に設定することのできる情報処理装置を提供することを目的とする。 The present invention has been made in view of the above circumstances, and by dynamically changing the priority of a plurality of fixed-period interrupts based on the execution status of each interrupt handler, each interrupt priority is appropriately set. The purpose is to provide an information processing device that can be set to.

上記目的を達成するため、本発明の情報処理装置は、主に次の点を特徴とする。
1.割込み優先度の動的変更対象の割込みハンドラを予め決めておき、その割込みハンドラにおける、本来の実行周期の許容超過時間および本来の実行周期からの許容超過回数の割合を含む許容条件を情報処理装置に設定する。
2.割込みハンドラ実行時、割込みハンドラ中の条件分岐と実行処理を検出のうえ、実行時間が最大になるような条件で割込みハンドラを実行する。
3.プログラムの実行中、プログラムにより構成される優先度設定手段は、前記許容条件を満たさない割込みハンドラの存在を検知して当該割込みハンドラの優先度を高くする。
4.優先度設定手段は、優先度を最高にしても前記許容条件を満たさない割込みハンドラが存在する場合は、開発者が認識可能な形式でアラーム出力を行う。
In order to achieve the above object, the information processing apparatus of the present invention is mainly characterized by the following points.
1. 1. The interrupt handler for which the interrupt priority is dynamically changed is determined in advance, and the information processing device determines the allowable conditions including the ratio of the allowable excess time of the original execution cycle and the allowable excess number of times from the original execution cycle in the interrupt handler. Set to.
2. 2. When the interrupt handler is executed, the conditional branch and execution process in the interrupt handler are detected, and the interrupt handler is executed under the condition that the execution time is maximized.
3. 3. During the execution of the program, the priority setting means configured by the program detects the existence of an interrupt handler that does not satisfy the allowable condition and raises the priority of the interrupt handler.
4. The priority setting means outputs an alarm in a format recognizable by the developer when there is an interrupt handler that does not satisfy the allowable condition even if the priority is set to the highest.

具体的には、本発明に係わる情報処理装置は、複数の定周期割込み信号の夫々に対応して実行される割込みハンドラの割込み優先度を設定する情報処理装置であって、
夫々の割込みハンドラごとにその割込みハンドラの起動間隔を計測するタイマと、
前記起動間隔と本来の周期とのずれに対する許容条件を保存する手段と、
割込みハンドラごとに前記許容条件を逸脱したか否かを判定し、逸脱した場合はその割込みハンドラの割込み優先度を上げる優先度設定手段と、
を備えたことを特徴とする。
Specifically, the information processing device according to the present invention is an information processing device that sets the interrupt priority of an interrupt handler executed corresponding to each of a plurality of fixed-period interrupt signals.
A timer that measures the activation interval of each interrupt handler,
A means for preserving the allowable condition for the deviation between the activation interval and the original cycle,
For each interrupt handler, it is determined whether or not the permissible condition is deviated, and if it deviates, a priority setting means for raising the interrupt priority of the interrupt handler is used.
It is characterized by being equipped with.

好ましくは、この許容条件は、夫々の割込みハンドラの予め設定された本来の起動周期と前記タイマの値との差が閾値を超えたか否かによって定められ、または当該差が閾値を超えた回数に基づいて定められるようにすると良い。 Preferably, this permissible condition is determined by whether or not the difference between the preset original activation cycle of each interrupt handler and the value of the timer exceeds the threshold value, or the number of times the difference exceeds the threshold value. It is good to be determined based on this.

本発明では、仕様通りの周期で実行されない割込みハンドラを検出して、その割込みハンドラの割込み優先度を変更することにより、すべての割込みハンドラの優先度が最適になるように調整を行う。 In the present invention, an interrupt handler that is not executed at a cycle according to the specification is detected, and the interrupt priority of the interrupt handler is changed so that the priority of all interrupt handlers is adjusted to be optimum.

より好ましくは、割込みハンドラごとの割込み優先度を保存し、初期状態(システムリセット時)は管理対象のすべての割込みハンドラを最低レベルの優先度に設定しておき、前記優先度設定手段は、割込みハンドラが前記許容条件を逸脱したときに、その割込みハンドラの割込み優先度を上げるようにすると良い。 More preferably, the interrupt priority for each interrupt handler is saved, all managed interrupt handlers are set to the lowest priority in the initial state (at the time of system reset), and the priority setting means is an interrupt. When the handler deviates from the permissible condition, it is preferable to raise the interrupt priority of the interrupt handler.

このようにすれば、許容条件を逸脱する割込みハンドラの優先度が自動的に上がるのでシステム全体の割込み優先度の調整を自動的に行うことができる。なお、この調整は、システム開発時に行い、調整後の割込み優先度を固定的に設定しても良いし、システム稼働中を含め常に調整を行うようにしても良い。 By doing so, the priority of the interrupt handler that deviates from the permissible condition is automatically increased, so that the interrupt priority of the entire system can be automatically adjusted. It should be noted that this adjustment may be performed at the time of system development, and the interrupt priority after adjustment may be fixedly set, or the adjustment may be performed at all times including during system operation.

また、本発明に係わる情報処理装置は、
割込みハンドラごとに、そのプログラムコード中の条件付き分岐命令を検出して、当該条件付き分岐命令を、ノーオペレーション命令その他条件付き分岐命令以外の予め設定した命令に置き換える命令読替手段と、
当該割込みハンドラが実行された後に、前記命令読替手段によって置き換えられた命令を、元の条件付き分岐命令に戻す命令読替取消手段と、
を備えたことを特徴とする。

Further, the information processing apparatus according to the present invention is
An instruction reading means that detects a conditional branch instruction in the program code for each interrupt handler and replaces the conditional branch instruction with a preset instruction other than a no-operation instruction or other conditional branch instructions.
After the interrupt handler is executed, the instruction replacement canceling means for returning the instruction replaced by the instruction reading means back to the original conditional branch instruction,
It is characterized by being equipped with.

本発明では、割込みハンドラのプログラムコード(機械語)中に、if文、while文等の条件付き分岐付き命令が存在する場合は、それをNOP(ノーオペレーション命令)など、条件付き分岐命令以外の予め定めた命令に置き換える。この状態で割込みハンドラを実行することにより、定周期動作に影響を及ぼすようなクリティカルパスを通すことができる。このような命令読替処理はシステム開発中に行うのが好ましい。 In the present invention, if a conditional branch instruction such as an if statement or while statement exists in the program code (machine language) of the interrupt handler, it is not a conditional branch instruction such as NOP (no operation instruction). Replace with a predetermined instruction. By executing the interrupt handler in this state, it is possible to pass a critical path that affects the fixed cycle operation. It is preferable to perform such instruction replacement processing during system development.

また、割込みハンドラの割込み優先度が予め定めた一定の優先度まで上がり、尚も前記許容条件を逸脱する場合はアラーム出力することにより、開発者はシステム全体の定周期動作に影響を与える可能性の高い割込みハンドラを予め認識することができる。 In addition, if the interrupt priority of the interrupt handler rises to a predetermined priority and still deviates from the permissible conditions, an alarm is output, which may affect the fixed cycle operation of the entire system. It is possible to recognize a high interrupt handler in advance.

本発明によれば、定周期割込みで動作する割込みハンドラの適切な割込み優先度を自動設定できるので、割込み優先度の設計の難易度を下げることが可能になる。 According to the present invention, it is possible to automatically set an appropriate interrupt priority of an interrupt handler that operates with a fixed-period interrupt, so that it is possible to reduce the difficulty of designing the interrupt priority.

本発明の第1の実施の形態による組込み機器の機能構成図である。It is a functional block diagram of the embedded device by 1st Embodiment of this invention. 図1の時間測定結果格納テーブルのデータ構成例である。It is a data structure example of the time measurement result storage table of FIG. 図1の優先度設定手段の処理手順を示すフローチャートである。It is a flowchart which shows the processing procedure of the priority setting means of FIG. 図3のステップS102の処理の具体例の説明図である。It is explanatory drawing of the specific example of the process of step S102 of FIG. 本発明の第2の実施の形態による組込み機器の機能構成図である。It is a functional block diagram of the embedded device by the 2nd Embodiment of this invention. 図5の時間測定結果格納テーブルのデータ構成例である。It is a data structure example of the time measurement result storage table of FIG. 図5の優先度設定手段の処理手順を示すフローチャートである。It is a flowchart which shows the processing procedure of the priority setting means of FIG. 図5の命令読替手段の処理手順を示すフローチャートである。It is a flowchart which shows the processing procedure of the instruction reading means of FIG. 図5の命令読替取消手段の処理手順を示すフローチャートである。It is a flowchart which shows the processing procedure of the instruction replacement canceling means of FIG. 図5の条件付き分岐命令テーブルのデータ構成例である。It is a data structure example of the conditional branch instruction table of FIG. 図8の命令読替処理の具体例の説明図である。It is explanatory drawing of the specific example of the instruction reading process of FIG. 図5の読替箇所記録テーブルのデータ構成例である。It is a data structure example of the reading place record table of FIG. 図5の他の実施例である。It is another embodiment of FIG.

以下、本発明の情報処理装置として、リアルタイム性が要求される組込み機器を例に図面を参照しながら説明する。なお、本発明は組込み機器に限らず、定周期割込みによって割込みハンドラが実行される演算処理機能を有する情報処理装置全般に適用可能である。 Hereinafter, the information processing apparatus of the present invention will be described with reference to the drawings, taking as an example an embedded device that requires real-time performance. The present invention is not limited to embedded devices, and can be applied to all information processing devices having an arithmetic processing function in which an interrupt handler is executed by a fixed-period interrupt.

(第1の実施の形態)
組込み機器1は、一般に、外部機器からの信号を入力する入力部、入力した信号に基づいて演算処理を実行し、またプログラムやデータを記憶するメモリを有する演算処理部(以下、「CPU」という。)、及び演算結果を外部機器へ出力する出力部を備えている。
(First Embodiment)
The embedded device 1 is generally an input unit that inputs a signal from an external device, an arithmetic processing unit that executes arithmetic processing based on the input signal, and has a memory for storing programs and data (hereinafter referred to as "CPU"). ), And an output unit that outputs the calculation result to an external device.

図1は、組込み機器1のCPU2の機能構成図である。CPU2は、予め定められた周期で起動される割込みハンドラ26、夫々の割込みハンドラごとに該割込みハンドラの起動間隔を計測するタイマ21、割込みハンドラの優先度を変更する優先度設定手段23、割込みハンドラごとにその起動間隔や本来の周期とのずれに関する許容条件等を保存する時間測定結果格納テーブル24を備えている。優先度設定手段23や割込みハンドラ26はプログラムによって実現することができる。 FIG. 1 is a functional configuration diagram of the CPU 2 of the embedded device 1. The CPU 2 includes an interrupt handler 26 that is activated at a predetermined cycle, a timer 21 that measures the activation interval of the interrupt handler for each interrupt handler, a priority setting means 23 that changes the priority of the interrupt handler, and an interrupt handler. Each time, a time measurement result storage table 24 for storing the start-up interval, the allowable condition regarding the deviation from the original cycle, and the like is provided. The priority setting means 23 and the interrupt handler 26 can be realized by a program.

CPU2はこの他、組込み機器1の機能を実現するためのアプリケーションプログラムやオペレーティングシステム等の手段27を備えているが、本発明とは直接関係がないので説明を省略する。 In addition to this, the CPU 2 includes means 27 such as an application program and an operating system for realizing the functions of the embedded device 1, but since it is not directly related to the present invention, the description thereof will be omitted.

以下、割込みハンドラ26の例として、タイマ21からの定周期割込みによって、50ミリ秒周期の制御処理を実行する割込みハンドラ26aと、タイマ21からの定周期割込みによって、100ミリ秒周期の制御処理を実行する割り込みハンドラ26bを用いて説明する。 Hereinafter, as an example of the interrupt handler 26, the interrupt handler 26a that executes the control process with a fixed cycle cycle from the timer 21 and the control process with a fixed cycle cycle from the timer 21 are performed with a fixed cycle interrupt from the timer 21. This will be described using the interrupt handler 26b to be executed.

時間測定結果格納テーブル24は、図2に示すように、割込み優先度の動的変更対象の割込みハンドラ26a,26bの夫々について、最新の実行開始時カウンタ値、過去n回(n>=1の自然数)の周期(単位はカウンタ値)、本来の周期(単位はカウンタ値)、直近n回の実行あたりの周期超過許容回数、周期超過許容カウンタ値、および割込み番号が互いに関連付けられて保存されている。なお、図2では、過去3回(n=3)の実績値を記録する例を示している。また、タイマ値はカウンタ値を用いて示している。たとえば、0.1ミリ秒で1カウントの場合は、最新の周期510は、前回起動から今回起動までの時間間隔(起動間隔)が51ミリ秒(510カウント×0.1ミリ秒/カウント=51ミリ秒)であることを表している。図2において、「最新の実行開始時カウンタ値」、「最新の周期」、「1回前の周期」、「2回前の周期」の各値は、プログラムの実行に伴って変化し、その他の項目は、システム構築時に開発者が予め設定し、プログラムの実行に伴って変化しない。 As shown in FIG. 2, the time measurement result storage table 24 has the latest execution start counter value for each of the interrupt handlers 26a and 26b for which the interrupt priority is dynamically changed, and the past n times (n> = 1). The cycle (unit is the counter value) of the natural number), the original cycle (the unit is the counter value), the number of times the cycle can be exceeded per last n executions, the cycle excess tolerance counter value, and the interrupt number are stored in association with each other. There is. Note that FIG. 2 shows an example of recording the actual value of the past three times (n = 3). The timer value is shown using the counter value. For example, in the case of 1 count in 0.1 ms, the latest cycle 510 has a time interval (startup interval) from the previous start to the current start of 51 ms (510 count x 0.1 ms / count = 51). It means that it is (milliseconds). In FIG. 2, each value of "latest execution start counter value", "latest cycle", "one cycle before", and "two previous cycles" changes with the execution of the program, and others. The item of is set in advance by the developer at the time of system construction and does not change with the execution of the program.

例えば、割込みハンドラ26aについて、「本来の周期」欄の値「500」は、仕様上の周期が50ミリ秒であることを示している。「3回の実行あたりの周期超過許容回数」欄の値「1」は、直近3回の実行において周期の超過があった回数が1回までは許容され、この場合は割込み優先度の変更処理は行なわれず、2回以上周期超過した場合に割込み優先度の変更処理が実行されることを意味する。また「周期超過許容カウンタ値」の値「0」は、周期が1カウントでも超過すると、その周期において周期超過があったと判定されることを意味する。また割込みハンドラ26bの「周期超過許容カウンタ値」の値「20」は、周期超過が本来の周期の20カウント以内までは周期超過がなかったと判定され、周期超過が20カウントを超えるとその周期において周期超過があったと判定されることを意味する。 For example, for the interrupt handler 26a, the value "500" in the "original cycle" column indicates that the specified cycle is 50 milliseconds. The value "1" in the "Allowable number of cycle excesss per 3 executions" column allows up to 1 cycle excess in the last 3 executions. In this case, interrupt priority change processing. Is not performed, and it means that the interrupt priority change process is executed when the cycle is exceeded twice or more. Further, the value "0" of the "cycle excess permissible counter value" means that if the cycle exceeds even one count, it is determined that the cycle has been exceeded in that cycle. Further, the value "20" of the "cycle excess allowance counter value" of the interrupt handler 26b is determined that the cycle has not been exceeded until the cycle excess is within 20 counts of the original cycle, and when the cycle excess exceeds 20 counts, the cycle is exceeded. It means that it is determined that the cycle has been exceeded.

なお、図2の例では、3回分の周期を記録することとしているが、何回分の周期を保存するかは、開発プログラムの特性に応じて開発者が適宜決定すればよい。 In the example of FIG. 2, three cycles are recorded, but the number of cycles to be saved may be appropriately determined by the developer according to the characteristics of the development program.

次に、優先度設定手段23の処理手順について、図3を参照しながら説明する。優先度設定手段23は、割込みハンドラ26の開始時に割込みハンドラ26から呼び出され、以下の処理を実行する。なお、各割込みハンドラ26の割込み優先度の初期値は開発者が任意に設定可能であるが、初期状態においては最低レベルにしておくのが好ましい。 Next, the processing procedure of the priority setting means 23 will be described with reference to FIG. The priority setting means 23 is called from the interrupt handler 26 at the start of the interrupt handler 26, and executes the following processing. The initial value of the interrupt priority of each interrupt handler 26 can be arbitrarily set by the developer, but it is preferable to set it to the lowest level in the initial state.

(1)優先度設定手段23は呼び出されると、まずタイマ21のカウンタ値を読み出し(ステップS101)、呼出元の割込みハンドラに関し、時間測定結果格納テーブル24に保存されているカウンタ値と周期(起動間隔)を最新値に更新する(ステップS102~S104)。
(2)時間測定結果格納テーブル24の呼出元の割込みハンドラに関する情報にアクセスして、周期超過許容カウンタ値を超えている周期の数が、3回の実行あたりの周期超過許容回数を超えているか否かを判定する(ステップS105,S106)。
(3)ステップS105,S106の判定の結果、周期超過許容回数を超えていない場合は優先度設定処理を終了する。一方、周期超過許容回数を超えている場合は、次に呼出元の割込みハンドラの割込みの優先度を高くすることが可能か否かを判定する(ステップS107,S108)。そして、
(4)ステップS107,S108の判定の結果、優先度を高くすることが可能ならば、割込みハンドラに対応する割込みの優先度を1つだけ高くする(ステップS109)。一方、優先度を高くすることが不可能ならば、その旨をコンソール出力等により利用者に通知する(ステップS110)。
(1) When the priority setting means 23 is called, it first reads the counter value of the timer 21 (step S101), and regarding the interrupt handler of the caller, the counter value and the cycle (startup) stored in the time measurement result storage table 24. The interval) is updated to the latest value (steps S102 to S104).
(2) Whether the number of cycles exceeding the cycle excess tolerance counter value by accessing the information regarding the caller's interrupt handler in the time measurement result storage table 24 exceeds the cycle excess tolerance counter count per three executions. It is determined whether or not (steps S105 and S106).
(3) As a result of the determination in steps S105 and S106, if the allowable number of times the cycle is exceeded is not exceeded, the priority setting process is terminated. On the other hand, if the number of times the cycle exceeds the allowable number is exceeded, it is determined whether or not it is possible to raise the interrupt priority of the caller's interrupt handler (steps S107 and S108). and,
(4) If it is possible to raise the priority as a result of the determination in steps S107 and S108, the priority of the interrupt corresponding to the interrupt handler is raised by one (step S109). On the other hand, if it is impossible to raise the priority, the user is notified by console output or the like (step S110).

優先度設定手段23は、以上の手順で複数の割込みハンドラの割込み優先度を自動的に調整する。 The priority setting means 23 automatically adjusts the interrupt priorities of a plurality of interrupt handlers according to the above procedure.

ここで、優先度設定手段23の時間測定結果格納テーブル24に保存されている周期の更新処理(ステップS102)の実現手法の一例を図4に基づいて説明する。
(1)図4(a)に示すように、時間測定結果格納テーブル24のうち周期に関する部分を、最新の周期へのポインタを含む循環リスト(周期格納領域0~2)として実装する。たとえば、周期格納領域0は、周期データと、次の周期格納領域として周期格納領域1のアドレスが格納されている。他の周期格納領域についても同様である。いま、図3のステップS102実行前の状態では、図4(a)に示すように、最新の周期へのポインタが指し示すアドレスは周期格納領域0のアドレスとなっているとする。すなわち周期格納領域0は最新の周期の格納領域、周期格納領域1は1回前の周期の格納領域、周期格納領域2は2回前の周期の格納領域として、それぞれ使用しているとする。
(2)図3のステップS102の処理として、図4(b)に示すように、最新の周期へのポインタが指し示すアドレスを、周期格納領域2に変更する。これにより、最新の周期の格納領域として使用していた周期格納領域0が1回前の周期の格納領域になり、1回前の周期の格納領域として使用していた周期格納領域1が2回前の周期の格納領域になる。このようにすれば、3回分の周期データを効率的に更新していくことができる。
Here, an example of a method for realizing the cycle update process (step S102) stored in the time measurement result storage table 24 of the priority setting means 23 will be described with reference to FIG.
(1) As shown in FIG. 4A, the part related to the cycle in the time measurement result storage table 24 is implemented as a circular list (cycle storage area 0 to 2) including a pointer to the latest cycle. For example, the periodic storage area 0 stores periodic data and the address of the periodic storage area 1 as the next periodic storage area. The same applies to other periodic storage areas. Now, in the state before the execution of step S102 in FIG. 3, as shown in FIG. 4A, it is assumed that the address pointed to by the pointer to the latest cycle is the address of the cycle storage area 0. That is, it is assumed that the cycle storage area 0 is used as the storage area of the latest cycle, the cycle storage area 1 is used as the storage area of the previous cycle, and the cycle storage area 2 is used as the storage area of the cycle two times before.
(2) As the process of step S102 in FIG. 3, as shown in FIG. 4 (b), the address pointed to by the pointer to the latest cycle is changed to the cycle storage area 2. As a result, the cycle storage area 0 used as the storage area of the latest cycle becomes the storage area of the previous cycle, and the cycle storage area 1 used as the storage area of the previous cycle becomes twice. It becomes the storage area of the previous cycle. By doing so, it is possible to efficiently update the periodic data for three times.

以上、本実施の形態によれば、優先度設定手段が、時間測定結果格納テーブルに設定された許容条件を満足できない割込みハンドラの優先順位を逐次上げていくので、システム全体として適切な割込み優先度を自動設定できる。 As described above, according to the present embodiment, the priority setting means sequentially raises the priority of interrupt handlers that cannot satisfy the allowable conditions set in the time measurement result storage table, so that the interrupt priority is appropriate for the entire system. Can be set automatically.

(第2の実施の形態)
次に本発明の第2の実施の形態について説明する。図5は、第2の実施の形態による組込み機器の機能ブロック図である。図1に示す第1の実施の形態との主な違いは、割込みハンドラの実行時間が長くなるように命令を読み替える処理を実行する命令読替手段28、命令読替手段28による読替処理を取消す処理を実行する命令読替取消手段29、条件付き分岐命令を格納するテーブル30、及び命令読替箇所を記録するテーブル31を追加したことである。また、これらの追加に伴い、時間測定結果格納テーブル24にデータ項目が追加され、優先度設定手段23の処理手順が変更になっている。
(Second embodiment)
Next, a second embodiment of the present invention will be described. FIG. 5 is a functional block diagram of the embedded device according to the second embodiment. The main difference from the first embodiment shown in FIG. 1 is the instruction reading means 28 that executes the instruction reading process so that the execution time of the interrupt handler becomes longer, and the instruction reading means 28 processing that cancels the reading process. The instruction replacement canceling means 29 to be executed, the table 30 for storing the conditional branch instruction, and the table 31 for recording the instruction replacement location have been added. Further, along with these additions, data items are added to the time measurement result storage table 24, and the processing procedure of the priority setting means 23 is changed.

本実施の形態による時間測定結果格納テーブル24の例を図6に示す。図2との違いは、命令読替条件を追加したことである。命令読替条件とは、命令読替手段28の実行条件であり、開発者が予め設定するものである。開発者が設定可能にすることにより、実行時間が大きく変化しないことが仕様上明らかな処理、すなわち実行時間が稀に長くなることがない処理に対し、命令読替手段28を実行しないようにすることが可能である。これにより、命令読替処理実行による実行時間の遅延を抑制することができる。 FIG. 6 shows an example of the time measurement result storage table 24 according to the present embodiment. The difference from FIG. 2 is that the instruction replacement condition is added. The instruction reading condition is an execution condition of the instruction reading means 28, and is set in advance by the developer. By making it configurable by the developer, the instruction reading means 28 should not be executed for a process whose execution time does not change significantly, that is, a process whose execution time rarely becomes long. Is possible. As a result, it is possible to suppress the delay in the execution time due to the execution of the instruction replacement process.

本実施の形態による優先度設定手段23の処理手順を図7に示す。図3との違いは、優先度設定手段の起動開始直後に、処理手順ステップS201~S203を追加したことである。具体的には、優先度設定手段23は起動されると、時間測定結果格納テーブル24の命令読替条件を満たす場合に命令読替手段28を呼び出す(ステップS201~S203)。その後、図3と同様にステップS101以降の処理を実行する。 FIG. 7 shows a processing procedure of the priority setting means 23 according to the present embodiment. The difference from FIG. 3 is that the processing procedure steps S201 to S203 are added immediately after the start of the priority setting means. Specifically, when the priority setting means 23 is activated, the command reading means 28 is called when the command reading conditions of the time measurement result storage table 24 are satisfied (steps S201 to S203). After that, the processes after step S101 are executed in the same manner as in FIG.

次に命令読替手段28の処理の概略手順を図8を用いて説明する。命令読替手段28は優先度設定手段23を経由して自身を呼び出した割込みハンドラの各命令に対し、次の処理を実行する。
(1)命令が条件付き分岐命令であるか否かを、当該命令が条件付き分岐命令テーブル30に含まれているか否かに基づき判定する(ステップS302)。
(2)当該命令が条件付き分岐命令テーブル30に含まれていれば、条件付き分岐命令を予め決められた別の命令に書き換える(ステップS304)。具体的には、当該命令に基づく分岐により実行されうる処理のうち、より実行時間を要する処理が無条件で実行されるように書き換える。
(3)読替箇所のアドレス、読替前の命令、および、読替後の命令を、読替箇所記録テーブル31に記録する。本記録は、命令読替取消手段29で読み替えた内容をもとに戻すために使用する。
Next, a schematic procedure for processing the command reading means 28 will be described with reference to FIG. The instruction reading means 28 executes the following processing for each instruction of the interrupt handler that calls itself via the priority setting means 23.
(1) Whether or not the instruction is a conditional branch instruction is determined based on whether or not the instruction is included in the conditional branch instruction table 30 (step S302).
(2) If the instruction is included in the conditional branch instruction table 30, the conditional branch instruction is rewritten with another predetermined instruction (step S304). Specifically, among the processes that can be executed by the branch based on the instruction, the process that requires more execution time is rewritten so as to be executed unconditionally.
(3) The address of the replacement location, the command before the replacement, and the command after the replacement are recorded in the replacement location recording table 31. This record is used to restore the contents read by the command replacement canceling means 29.

割込みハンドラ26は、終了時に命令読替取消手段29を呼び出す。図9に示すように、呼び出された命令読替取消手段29は、読替箇所記録テーブル31にアクセスして、本処理の呼出元の割込みハンドラに関連付けて記録されている内容に基づいて、当該割込みハンドラ26の処理内容を命令読替前に戻す。これにより、当該割込みハンドラ26の本来の処理(命令読替前の処理)が実行されるようになる。 The interrupt handler 26 calls the instruction replacement canceling means 29 at the end. As shown in FIG. 9, the called instruction replacement canceling means 29 accesses the replacement location recording table 31 and determines the interrupt handler based on the contents recorded in association with the interrupt handler of the caller of this process. The processing content of 26 is returned to before the instruction is replaced. As a result, the original processing of the interrupt handler 26 (processing before reading the instruction) is executed.

以下に命令読替処理および条件付き分岐命令テーブル30の具体例を示す。
命令読替手段で使用する条件付き分岐命令テーブル30は、図10に示すように、CPU2上で実行する命令の種類に基づいて、条件付き分岐命令、および、当該分岐命令による分岐処理が終了する箇所に記載される命令(分岐処理終了命令)が記録されている。これらの命令は開発者が予め設定する。登録すべき命令の種類は、使用するCPUにより定まる。
A specific example of the instruction replacement process and the conditional branch instruction table 30 is shown below.
As shown in FIG. 10, the conditional branch instruction table 30 used in the instruction reading means is a place where the conditional branch instruction and the branch processing by the branch instruction are completed based on the type of the instruction executed on the CPU 2. The instruction (branch processing end instruction) described in is recorded. These instructions are preset by the developer. The type of instruction to be registered is determined by the CPU used.

次に命令読替手段28のステップS304による命令読替処理の例を図11を用いて説明する。いまCPUは、命令長は4バイト固定であり、実行に要する時間は全命令同一であるものとする。また、条件付き分岐命令テーブル30には図10に記載の内容が登録されているものとする。 Next, an example of the command reading process according to step S304 of the command reading means 28 will be described with reference to FIG. Now, it is assumed that the instruction length of the CPU is fixed at 4 bytes and the time required for execution is the same for all instructions. Further, it is assumed that the contents shown in FIG. 10 are registered in the conditional branch instruction table 30.

当該ステップS304において、命令読替前は、アドレス0x1230に条件付き分岐命令「bge」があり、当該条件付き分岐命令によりアドレス0x1244にジャンプしなかった場合の処理は、アドレス0x1240の分岐処理終了命令「b」で終了するため、4命令である。一方、アドレス0x1244にジャンプした場合の処理は、アドレス0x124Cの分岐処理終了命令「bx」で終了するため、3命令である。従って、アドレス0x1244にジャンプしなかった場合の処理(アドレス0x1244にジャンプした場合と比べ時間がかかる)処理が常に実行されるよう、アドレス0x1230の条件付き分岐命令を、無処理の命令「nop」に置換する。 In step S304, before the instruction is read, there is a conditional branch instruction "bge" at address 0x1230, and if the conditional branch instruction does not jump to address 0x1244, the processing is the branch processing end instruction "b" at address 0x1240. Because it ends with ", there are four instructions. On the other hand, the processing when jumping to the address 0x1244 is three instructions because it ends with the branch processing end instruction "bx" at the address 0x124C. Therefore, the conditional branch instruction at address 0x1230 is changed to the unprocessed instruction "nop" so that the processing when it does not jump to address 0x1244 (it takes longer than when it jumps to address 0x1244) is always executed. Replace.

以上のごとく命令読替処理が実行される。
図12は、命令読替手段28、および命令読替取消手段29で使用する読替箇所記録テーブル31の例である。本テーブルには、読替箇所のアドレス、読替前の命令、および、読替後の命令を格納する。本テーブル31は、命令読替手段28により行(レコード)が追加され、命令読替取消手段29によりレコードの読出し、削除が行われる。
The instruction replacement process is executed as described above.
FIG. 12 is an example of a replacement location recording table 31 used by the command replacement means 28 and the command replacement canceling means 29. This table stores the address of the replacement location, the command before the replacement, and the command after the replacement. A line (record) is added to the table 31 by the instruction reading means 28, and the record is read and deleted by the instruction reading canceling means 29.

(他の実施例)
上記は、CPUで実行される命令を書き換えることが可能であることを前提としている。しかし、実機においては、当該命令は書き換えることが不可能なメモリに保存されていることがある。本実施例は、この場合にも適用可能にするものである。
(Other Examples)
The above assumes that it is possible to rewrite the instructions executed by the CPU. However, in the actual machine, the instruction may be stored in a memory that cannot be rewritten. This embodiment also makes it applicable in this case.

図13は、割込みの優先度を決定する対象の組込み機器における機能構成を示したものである。本実施例においては、組込み機器でソフトウェアプログラムを実行する代わりに、命令セットシミュレータ20が動作するパーソナルコンピュータ10でソフトウェアプログラムをシミュレーションする、命令セットシミュレータ20上で動作する各手段やテーブル等は、図5と同様である。 FIG. 13 shows a functional configuration in an embedded device for which an interrupt priority is determined. In this embodiment, instead of executing the software program in the embedded device, each means, table, etc. operating on the instruction set simulator 20 that simulates the software program on the personal computer 10 on which the instruction set simulator 20 operates are shown in the figure. It is the same as 5.

以上、本実施の形態によれば、第1の実施の形態の効果に加えて、実行周期が稀に長くなる割込みハンドラの優先度についても、割込みの優先度を適切に設定でき、設計の難易度を下げることが可能になる。 As described above, according to the present embodiment, in addition to the effect of the first embodiment, the interrupt priority can be appropriately set for the priority of the interrupt handler whose execution cycle is rarely long, and the design is difficult. It becomes possible to lower the degree.

本発明は、上述した実施の形態に限定されることなく、その要旨を逸脱しない範囲で種々変形して実現することができる。例えば、上記の説明において、割込みハンドラが許容条件を逸脱した場合に、優先度設定手段は割込み優先度を1だけ上げることとしているが、逸脱した量に応じて割込み優先度を2以上、上げるようにしても良い。このようにすれば、割込み優先度をより早く最適化することができる。 The present invention is not limited to the above-described embodiment, and can be realized by various modifications without departing from the gist thereof. For example, in the above description, when the interrupt handler deviates from the allowable condition, the priority setting means increases the interrupt priority by 1, but the interrupt priority is increased by 2 or more according to the deviated amount. You can do it. In this way, the interrupt priority can be optimized faster.

1 組み込み機器(情報処理装置)
2 CPU
10 パーソナルコンピュータ(情報処理装置)
20 命令セットシミュレータ
21 タイマ
23 優先度設定手段
24 時間測定結果格納テーブル
26(26a,26b,26c) 割込みハンドラ
28 命令読替手段
29 命令読替取消手段
30 分岐命令テーブル
31 読替箇所記録テーブル
1 Embedded device (information processing device)
2 CPU
10 Personal computer (information processing device)
20 Instruction set simulator 21 Timer 23 Priority setting means 24 Hours measurement result storage table 26 (26a, 26b, 26c) Interrupt handler 28 Instruction reading means 29 Instruction reading canceling means 30 Branch instruction table 31 Reading location recording table

Claims (6)

複数の定周期割込み信号の夫々に対応して実行される割込みハンドラの割込み優先度を設定する情報処理装置であって、
夫々の割込みハンドラごとにその割込みハンドラの起動間隔を計測するタイマと、
前記起動間隔と本来の周期とのずれに対する許容条件を保存する手段と、
割込みハンドラごとに前記許容条件を逸脱したか否かを判定し、逸脱した場合はその割込みハンドラの割込み優先度を上げる優先度設定手段と、
を備えたことを特徴とする情報処理装置。
An information processing device that sets the interrupt priority of an interrupt handler that is executed in response to each of multiple fixed-period interrupt signals.
A timer that measures the activation interval of each interrupt handler,
A means for preserving the allowable condition for the deviation between the activation interval and the original cycle,
For each interrupt handler, it is determined whether or not the permissible condition is deviated, and if it deviates, a priority setting means for raising the interrupt priority of the interrupt handler is used.
An information processing device characterized by being equipped with.
前記許容条件は、夫々の割込みハンドラの予め設定された本来の起動周期と前記タイマの値との差が閾値を超えたか否かによって定められ、又は、当該差が閾値を超えた回数に基づいて定められることを特徴とする請求項1に記載の情報処理装置。 The allowable condition is determined by whether or not the difference between the preset original activation cycle of each interrupt handler and the value of the timer exceeds the threshold value, or is based on the number of times the difference exceeds the threshold value. The information processing apparatus according to claim 1, wherein the information processing apparatus is defined. 割込みハンドラごとの割込み優先度を保存し、
初期状態はすべての割込みハンドラが最低レベルの優先度に設定されており、
前記優先度設定手段は、割込みハンドラが前記許容条件を逸脱したときに、その割込みハンドラの割込み優先度を上げることを特徴とする請求項1又は2に記載の情報処理装置。
Save the interrupt priority for each interrupt handler and save it.
Initially, all interrupt handlers are set to the lowest priority.
The information processing apparatus according to claim 1 or 2, wherein the priority setting means raises the interrupt priority of the interrupt handler when the interrupt handler deviates from the permissible condition.
割込みハンドラごとに、そのプログラムコード中の条件付き分岐命令を検出して、当該条件付き分岐命令を、ノーオペレーション命令その他条件付き分岐命令以外の予め設定した命令に置き換える命令読替手段と、
当該割込みハンドラが実行された後に、前記命令読替手段によって置き換えられた命令を、元の条件付き分岐命令に戻す命令読替取消手段と、
を備えたことを特徴とする請求項1乃至3のいずれかに記載の情報処理装置。
An instruction reading means that detects a conditional branch instruction in the program code for each interrupt handler and replaces the conditional branch instruction with a preset instruction other than a no-operation instruction or other conditional branch instructions.
After the interrupt handler is executed, the instruction replacement canceling means for returning the instruction replaced by the instruction reading means back to the original conditional branch instruction,
The information processing apparatus according to any one of claims 1 to 3, wherein the information processing apparatus is provided.
条件付き分岐命令の一覧を保存する条件付分岐命令テーブルを備え、
前記命令読替手段は、前記条件付き分岐命令テーブルを参照して、割込みハンドラのプログラムコード中に該当する条件付き分岐命令が存在するか否かを判定し、条件付き分岐命令が存在する場合は、当該条件付き分岐命令および該条件付き分岐命令の存在したアドレスを読替箇所記録テーブルに記録し、
前記命令読替取消手段は、前記読替箇所記録テーブルを参照して、前記命令読替手段によって置き換えられた命令を、元の条件付き分岐命令に戻すことを特徴とする請求項4に記載の情報処理装置。
It has a conditional branch instruction table that stores a list of conditional branch instructions.
The instruction reading means refers to the conditional branch instruction table, determines whether or not the corresponding conditional branch instruction exists in the program code of the interrupt handler, and if the conditional branch instruction exists, the conditional branch instruction is present. The conditional branch instruction and the address where the conditional branch instruction existed are recorded in the replacement location recording table.
The information processing apparatus according to claim 4, wherein the instruction replacement canceling means refers to the replacement location recording table and returns the instruction replaced by the instruction replacement means to the original conditional branch instruction. ..
割込みハンドラの割込み優先度が予め定めた一定の優先度まで上がり、尚も前記許容条件を逸脱する場合は、アラーム出力することを特徴とする請求項1乃至5のいずれかに記載の情報処理装置。 The information processing apparatus according to any one of claims 1 to 5, wherein if the interrupt priority of the interrupt handler rises to a predetermined predetermined priority and still deviates from the allowable condition, an alarm is output. ..
JP2018046086A 2018-03-13 2018-03-13 Information processing equipment Active JP7069870B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2018046086A JP7069870B2 (en) 2018-03-13 2018-03-13 Information processing equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2018046086A JP7069870B2 (en) 2018-03-13 2018-03-13 Information processing equipment

Publications (2)

Publication Number Publication Date
JP2019159852A JP2019159852A (en) 2019-09-19
JP7069870B2 true JP7069870B2 (en) 2022-05-18

Family

ID=67996435

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2018046086A Active JP7069870B2 (en) 2018-03-13 2018-03-13 Information processing equipment

Country Status (1)

Country Link
JP (1) JP7069870B2 (en)

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003015886A (en) 2001-07-05 2003-01-17 Nec Eng Ltd Interruption control circuit and interruption priority order changing system using the circuit
JP2006185365A (en) 2004-12-28 2006-07-13 Renesas Technology Corp Semiconductor device and debugging method
JP2011186591A (en) 2010-03-05 2011-09-22 Renesas Electronics Corp Processor and control method therefor
JP2013121545A (en) 2013-02-14 2013-06-20 Ykk Corp Slide fastener
JP2016062574A (en) 2014-09-22 2016-04-25 株式会社沖データ Interrupt control circuit and image formation system

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH04361328A (en) * 1991-06-10 1992-12-14 Fujitsu Ltd Processing mode switching system

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003015886A (en) 2001-07-05 2003-01-17 Nec Eng Ltd Interruption control circuit and interruption priority order changing system using the circuit
JP2006185365A (en) 2004-12-28 2006-07-13 Renesas Technology Corp Semiconductor device and debugging method
JP2011186591A (en) 2010-03-05 2011-09-22 Renesas Electronics Corp Processor and control method therefor
JP2013121545A (en) 2013-02-14 2013-06-20 Ykk Corp Slide fastener
JP2016062574A (en) 2014-09-22 2016-04-25 株式会社沖データ Interrupt control circuit and image formation system

Also Published As

Publication number Publication date
JP2019159852A (en) 2019-09-19

Similar Documents

Publication Publication Date Title
JP5323828B2 (en) Virtual machine control device, virtual machine control program, and virtual machine control circuit
JP5680679B2 (en) Apparatus and method for handling exception events
CN107463400B (en) Hot updating method of mobile application and terminal equipment
JP4770664B2 (en) Microprocessor and microcomputer using the same
KR20200139706A (en) Exception handling in transaction
US7168075B1 (en) Automation device and updating method
CN112579162A (en) Method for selecting high-level features by coordinating hardware and software on heterogeneous ISA platform
JP7069870B2 (en) Information processing equipment
JP5870043B2 (en) Start control device, information device, and start control method
CN109358903B (en) Data access device and access error notification method
EP1227401B1 (en) Task management device, method and program therefor
JP7276755B2 (en) Processing speed matching circuit and microprocessor
US10762226B2 (en) Register access control
JP2007047426A (en) Video display device and control circuit for display
JP7418670B2 (en) Computer, control method and control program
CN113342376B (en) Method and device for upgrading operating system of Internet of things equipment
JP7379875B2 (en) Control device and its maintenance support device
CN109542598B (en) Timed task management method and device
TWI682323B (en) Server and setting method thereof
KR20080044652A (en) Method for debugging by using stack of cpu
JP4305400B2 (en) Microcomputer
JP2019020931A (en) Processing speed matching circuit and microprocessor
US20120159134A1 (en) Exception control method, system, and program
JP3638505B2 (en) Simulation apparatus and software simulation method for microprocessor
JP2015121953A (en) Microcomputer and electronic control device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20210215

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20211228

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20220201

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20220308

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: 20220405

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20220418

R150 Certificate of patent or registration of utility model

Ref document number: 7069870

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150