JP2010140239A - Apparatus and method for shortening interrupt latency - Google Patents

Apparatus and method for shortening interrupt latency Download PDF

Info

Publication number
JP2010140239A
JP2010140239A JP2008315552A JP2008315552A JP2010140239A JP 2010140239 A JP2010140239 A JP 2010140239A JP 2008315552 A JP2008315552 A JP 2008315552A JP 2008315552 A JP2008315552 A JP 2008315552A JP 2010140239 A JP2010140239 A JP 2010140239A
Authority
JP
Japan
Prior art keywords
interrupt
interrupt processing
time
execution unit
processing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2008315552A
Other languages
Japanese (ja)
Inventor
Kensho Asamoto
憲昭 朝本
Masahiro Murakami
昌弘 村上
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.)
International Business Machines Corp
Original Assignee
International Business Machines Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by International Business Machines Corp filed Critical International Business Machines Corp
Priority to JP2008315552A priority Critical patent/JP2010140239A/en
Publication of JP2010140239A publication Critical patent/JP2010140239A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Bus Control (AREA)

Abstract

<P>PROBLEM TO BE SOLVED: To provide an apparatus and method that ensure a response within a fixed time by effectively shortening interrupt latency, which is the time from the generation of a request for interrupt handling by a device to the invocation of a handler for interrupt handling. <P>SOLUTION: The apparatus includes a general purpose CPU and an interrupt processor for executing an interrupt handling program for executing interrupt handling prioritized over other processing. The interrupt processor includes an interrupt handling execution unit for executing interrupt handling, a memory for storing the interrupt handling program for executing interrupt handling, an interrupt detection part for detecting an execution request requesting the execution of interrupt handling, and an interrupt handling selection part for selecting whether to execute interrupt handling on the general purpose CPU or on the interrupt handling execution unit. <P>COPYRIGHT: (C)2010,JPO&INPIT

Description

本発明は、デバイスが割り込み処理の実行要求をしてから割り込み処理のハンドラーが呼び出されるまでの時間である割り込みレイテンシーを短縮し、一定時間内の応答を保証することができる装置及び方法に関する。   The present invention relates to an apparatus and a method capable of shortening an interrupt latency, which is a time from when a device requests execution of interrupt processing to when an interrupt processing handler is called, and guaranteeing a response within a predetermined time.

従来、割り込み処理が発生した場合には、割り込み要求を検知する割り込みコントローラは割り込み要求をCPUへ通知し、CPUは、記憶装置に記憶してある割り込み処理プログラムに基づいて割り込み処理を実行する。図1は、従来の割り込み処理実行の具体例を示すブロック図である。   Conventionally, when an interrupt process occurs, the interrupt controller that detects the interrupt request notifies the CPU of the interrupt request, and the CPU executes the interrupt process based on the interrupt process program stored in the storage device. FIG. 1 is a block diagram showing a specific example of conventional interrupt processing execution.

図1では、複数のデバイス1、1、・・・のいずれかからの割り込み要求を割り込みコントローラ2が検知した場合、割り込みコントローラ2は、割り込み要求をCPU3へ通知し、CPU3で割り込み要求に対応した処理4が行われる。   In FIG. 1, when the interrupt controller 2 detects an interrupt request from any of the plurality of devices 1, 1,..., The interrupt controller 2 notifies the interrupt request to the CPU 3, and the CPU 3 responds to the interrupt request. Process 4 is performed.

従来の割り込み処理は次のような手順で行われる。外部割り込みが禁止状態でない場合、CPU3が外部割り込み例外を起こし、OS(オペレーティングシステム)6の例外ハンドラを呼び出す。例外ハンドラーでは、割り込みが起きる直前に実行されていたプログラムの状態(以下、コンテキスト情報)を保存し、どのデバイスが割り込みを起こしたかを割り込みコントローラ2のレジスタを読み出すことにより確認する。デバイスが特定された場合、特定されたデバイスに対応するデバイスドライバ7の割り込み処理ルーチンを呼び出す(斯かる処理を以下、ディスパッチという)(第1レベル)。割り込み処理ルーチンでは緊急度の高い処理だけを実行し(第2レベル)、メインの処理は後で実行することができるように信号を送信して処理を終了する。その後、時間が空いた時に該信号を受信し、メインの処理が実行される(第3レベル)。さらに、より高度な処理はミドルウエア又はアプリケーション8により実行される(第4レベル)。   Conventional interrupt processing is performed in the following procedure. When the external interrupt is not prohibited, the CPU 3 raises an external interrupt exception and calls an OS (operating system) 6 exception handler. In the exception handler, the state of the program (hereinafter referred to as context information) executed immediately before the interrupt occurs is saved, and it is confirmed by reading the register of the interrupt controller 2 which device caused the interrupt. When a device is specified, an interrupt processing routine of the device driver 7 corresponding to the specified device is called (this processing is hereinafter referred to as dispatch) (first level). In the interrupt processing routine, only processing with high urgency is executed (second level), and a signal is transmitted so that the main processing can be executed later, and the processing ends. Thereafter, when time is available, the signal is received, and main processing is executed (third level). Further, more advanced processing is executed by the middleware or application 8 (fourth level).

割り込み処理は、他のタスクに影響を与えないよう短時間で処理を完了することが望ましい。しかし、割り込み処理に相当の時間を要するデバイスが1つでも含まれている場合、割り込み処理がCPU3を占有することにより他の処理が待ち状態となり、割り込み要求から割り込み処理のハンドラーが呼び出されるまでの時間である割り込みレイテンシーを短縮することが困難になる場合が生じうる。すなわち、割り込み処理の第1レベルと第2レベルとを包括する処理5がボトルネックとなり、割り込み処理の実行が遅れるという問題点が潜在的に存在する。   It is desirable to complete the interrupt processing in a short time so as not to affect other tasks. However, if there is even one device that requires a considerable amount of time for interrupt processing, the interrupt processing occupies the CPU 3, and other processing enters a wait state until the interrupt processing handler is called from the interrupt request. It may be difficult to shorten the interrupt latency, which is time. That is, there is a potential problem that the process 5 including the first level and the second level of the interrupt process becomes a bottleneck, and the execution of the interrupt process is delayed.

例えば特許文献1では、高速割り込み処理用のプロセッサと、低速割り込み処理用のプロセッサとを備え、高速割り込み処理の実行中は低速割り込み処理用のプロセッサを停止状態とし、割り込み処理に伴うCPUのレジスタの退避、復帰の時間を短縮することにより割り込みレイテンシーを短縮する高速割り込み処理方式が開示されている。また、特許文献2では、主となる汎用CPUと別のレジスタを有する優先割り込み専用CPUとを備え、割り込み処理発生時には優先割り込み専用CPUに割り込み処理を実行させることでレジスタの退避、復帰の時間を無くすことにより割り込みレイテンシーを短縮する半導体装置が開示されている。
特開昭49−95548号公報 特開平9−185591号公報
For example, in Patent Document 1, a processor for high-speed interrupt processing and a processor for low-speed interrupt processing are provided. During execution of high-speed interrupt processing, the processor for low-speed interrupt processing is stopped and the CPU register associated with interrupt processing is changed. A high-speed interrupt processing method is disclosed in which the interrupt latency is shortened by shortening the save and return times. Patent Document 2 includes a main general-purpose CPU and a priority interrupt dedicated CPU having another register. When interrupt processing occurs, the priority interrupt dedicated CPU executes interrupt processing to save register saving and restoration times. A semiconductor device that shortens the interrupt latency by eliminating it is disclosed.
JP-A-49-95548 JP-A-9-185591

しかし、特許文献1に開示されている高速割り込み処理方式では、複数のプロセッサが同時に実行することが無いので、実質上一のプロセッサで実行する場合と同様である。また、特許文献2では、割り込み処理に伴うCPUのレジスタの退避、復帰の時間を無くすことはできるが、割り込み信号の発生する数だけ優先割り込み専用CPUを必要とする。   However, the high-speed interrupt processing method disclosed in Patent Document 1 is substantially the same as that executed by a single processor because a plurality of processors are not executed simultaneously. In Patent Document 2, it is possible to eliminate the time for saving and restoring the CPU registers associated with interrupt processing, but the number of CPUs dedicated to priority interrupts is required as many as the number of interrupt signals generated.

本発明は斯かる事情に鑑みてなされたものであり、デバイスが割り込み処理の実行要求をしてから割り込み処理のハンドラーが呼び出されるまでの時間である割り込みレイテンシーを効果的に短縮し、一定時間内の応答を保証することができる装置及び方法を提供することを目的とする。   The present invention has been made in view of such circumstances, and effectively reduces the interrupt latency, which is the time from when a device requests execution of interrupt processing until the interrupt processing handler is called, within a certain period of time. It is an object of the present invention to provide an apparatus and a method that can guarantee the response of the system.

上記目的を達成するために第1発明に係る装置は、汎用CPUと、他の処理よりも優先させる割り込み処理を実行するための割り込み処理プログラムを実行する割り込み用プロセッサとを有し、前記割り込み用プロセッサは、割り込み処理を実行する割り込み処理実行ユニットと、割り込み処理を実行するための割り込み処理プログラムを記憶するメモリと、割り込み処理の実行を要求する実行要求を検知する割り込み検知部と、割り込み処理を前記汎用CPUで実行するか、前記割り込み処理実行ユニットで実行するかを選択する割り込み処理選択部とを備える。   In order to achieve the above object, an apparatus according to a first aspect of the present invention includes a general-purpose CPU and an interrupt processor that executes an interrupt processing program for executing an interrupt process that has priority over other processes. The processor includes an interrupt processing execution unit that executes interrupt processing, a memory that stores an interrupt processing program for executing interrupt processing, an interrupt detection unit that detects an execution request that requests execution of interrupt processing, and an interrupt processing An interrupt process selection unit that selects whether to execute the program by the general-purpose CPU or the interrupt process execution unit.

また、第2発明に係る装置は、第1発明において、前記割り込み用プロセッサは、時間を計時するタイマを備え、前記割り込み処理選択部は、前記タイマによる計時により一定時間経過する都度、所定の条件が成立しているか否かを判断する基礎となる信号を出力し、前記割り込み処理実行ユニットが、出力された信号に基づいて所定の条件が成立しているか否かを判断して、前記割り込み処理実行ユニットで割り込み処理を実行するか否かを選択する。   According to a second aspect of the present invention, in the first aspect, the interrupt processor includes a timer that counts time, and the interrupt processing selection unit performs a predetermined condition every time a predetermined time elapses due to time count by the timer. A signal serving as a basis for determining whether or not is satisfied, the interrupt processing execution unit determines whether or not a predetermined condition is satisfied based on the output signal, and the interrupt processing Select whether to execute interrupt processing in the execution unit.

また、第3発明に係る装置は、第2発明において、前記割り込み用プロセッサは、一定のタスク数を上限として複数の割り込み処理を実行することが可能であり、前記割り込み処理実行ユニットが、割り込み処理ごとにラウンドロビン方式で実行することが可能な条件が成立しているか否かを判断する。   According to a third aspect of the present invention, in the second aspect, the interrupt processor is capable of executing a plurality of interrupt processes up to a fixed number of tasks, and the interrupt process execution unit includes the interrupt process. Each time, it is determined whether or not a condition that can be executed by the round robin method is satisfied.

また、第4発明に係る装置は、第3発明において、割り込み処理ごとに割り込みの状態に関する情報を記憶する状態レジスタを有し、前記割り込み処理実行ユニットが、前記状態レジスタに記憶されている割り込みの状態に関する情報に基づいて、実行することが可能な条件が成立しているか否かを判断する。   According to a fourth aspect of the present invention, in the third aspect of the present invention, the apparatus according to the third aspect further includes a state register that stores information about an interrupt state for each interrupt process, and the interrupt processing execution unit stores the interrupt stored in the state register. Whether or not a condition that can be executed is satisfied is determined based on the information on the state.

次に、上記目的を達成するために第5発明に係る方法は、汎用CPUと、他の処理よりも優先させる割り込み処理を実行するための割り込み処理プログラムを実行する割り込み用プロセッサとを有し、割り込み処理の実行を要求する実行要求を検知し、割り込み処理を前記汎用CPUで実行するか、前記割り込み用プロセッサで実行するかを選択する。   Next, in order to achieve the above object, a method according to the fifth invention includes a general-purpose CPU and an interrupt processor that executes an interrupt processing program for executing an interrupt process that has priority over other processes. An execution request that requests execution of interrupt processing is detected, and it is selected whether the interrupt processing is executed by the general-purpose CPU or the interrupt processor.

また、第6発明に係る方法は、第5発明において、前記割り込み用プロセッサは、時間を計時するタイマを備え、前記割り込み処理選択部は、前記タイマによる計時により一定時間経過する都度、所定の条件が成立しているか否かを判断する基礎となる信号を出力し、前記割り込み処理実行ユニットが、出力された信号に基づいて所定の条件が成立しているか否かを判断して、前記割り込み処理実行ユニットで割り込み処理を実行するか否かを選択する。   Further, the method according to a sixth invention is the method according to the fifth invention, wherein the interrupt processor includes a timer for measuring time, and the interrupt processing selection unit is configured to execute a predetermined condition every time a predetermined time elapses due to time measurement by the timer. A signal serving as a basis for determining whether or not is satisfied, the interrupt processing execution unit determines whether or not a predetermined condition is satisfied based on the output signal, and the interrupt processing Select whether to execute interrupt processing in the execution unit.

また、第7発明に係る方法は、第6発明において、前記割り込み用プロセッサは、一定のタスク数を上限として複数の割り込み処理を実行することが可能であり、前記割り込み処理実行ユニットが、割り込み処理ごとにラウンドロビン方式で実行することが可能な条件が成立しているか否かを判断する。   The method according to a seventh aspect is the method according to the sixth aspect, wherein the interrupt processor is capable of executing a plurality of interrupt processes up to a fixed number of tasks, wherein the interrupt process execution unit Each time, it is determined whether or not a condition that can be executed by the round robin method is satisfied.

また、第8発明に係る方法は、第7発明において、割り込み処理ごとに割り込みの状態に関する情報を記憶する状態レジスタを有し、前記割り込み処理実行ユニットが、前記状態レジスタに記憶されている割り込みの状態に関する情報に基づいて、実行することが可能な条件が成立しているか否かを判断する。   The method according to an eighth aspect of the present invention is the method according to the seventh aspect, further comprising: a state register that stores information about an interrupt state for each interrupt process, wherein the interrupt processing execution unit stores the interrupt stored in the state register. Whether or not a condition that can be executed is satisfied is determined based on the information on the state.

本発明によれば、割り込み処理を実行する専用の割り込み用プロセッサを用いて、汎用CPUとは完全に独立して割り込み処理を実行することにより、例えばデバイスドライバ、OS等が無用の割り込み禁止時間を設けている場合、処理時間が長い場合等に、リアルタイム性が要求される割り込み処理の実行を阻害することを回避することができ、割り込みレイテンシーを大きく短縮することができ、一定時間内の応答を保証することができる。また、割り込み機能を有していないデバイスに対しても外部割り込み処理を実行することが可能となる。   According to the present invention, by using a dedicated interrupt processor for executing interrupt processing and executing interrupt processing completely independently of a general-purpose CPU, for example, device drivers, OSs and the like can use unnecessary interrupt inhibition time. If it is provided, it is possible to avoid interrupting the execution of interrupt processing that requires real-time performance when the processing time is long, etc., greatly shortening the interrupt latency, and responding within a certain time Can be guaranteed. In addition, external interrupt processing can be executed for a device that does not have an interrupt function.

以下、本発明の実施の形態に係る割り込みレイテンシーを短縮する装置について、図面に基づいて具体的に説明する。以下の実施の形態は、特許請求の範囲に記載された発明を限定するものではなく、実施の形態の中で説明されている特徴的事項の組み合わせの全てが解決手段の必須事項であるとは限らないことは言うまでもない。   An apparatus for reducing interrupt latency according to an embodiment of the present invention will be specifically described below with reference to the drawings. The following embodiments do not limit the invention described in the claims, and all combinations of characteristic items described in the embodiments are essential to the solution. It goes without saying that it is not limited.

また、本発明は多くの異なる態様にて実施することが可能であり、実施の形態の記載内容に限定して解釈されるべきものではない。実施の形態を通じて同じ要素には同一の符号を付している。   The present invention can be implemented in many different modes and should not be construed as being limited to the description of the embodiment. The same symbols are attached to the same elements throughout the embodiments.

本発明の実施の形態では、割り込み処理を実行する専用の割り込み用プロセッサにより、汎用CPUとは完全に独立して割り込み処理を実行することにより、割り込みレイテンシーを大きく短縮することができる。また、ラウンドロビン方式で実行する各割り込み処理ルーチンの最大実行時間に制限を加えることにより、一定時間内に要求された割り込み処理ルーチンの実行が開始されることを保証することができる。さらに、割り込み機能を有していないデバイスに対しても外部割り込み処理を実行することが可能となる。   In the embodiment of the present invention, the interrupt latency can be greatly reduced by executing the interrupt process completely independently of the general-purpose CPU by the dedicated interrupt processor for executing the interrupt process. Further, by limiting the maximum execution time of each interrupt processing routine executed in the round robin method, it is possible to ensure that the requested interrupt processing routine starts to be executed within a certain time. Furthermore, external interrupt processing can be executed even for devices that do not have an interrupt function.

図2は、本発明の実施の形態に係る割り込みレイテンシーを短縮することができる半導体装置の構成例を示すブロック図である。本発明の実施の形態に係る半導体装置10は、汎用CPU30と割り込み用プロセッサ20とを備えている。汎用CPU30、割り込み用プロセッサ20、デバイス11、11、・・・、メモリ40は、バス50を介して互いにデータ通信することが可能に接続されている。   FIG. 2 is a block diagram showing a configuration example of a semiconductor device capable of shortening the interrupt latency according to the embodiment of the present invention. The semiconductor device 10 according to the embodiment of the present invention includes a general-purpose CPU 30 and an interrupt processor 20. The general-purpose CPU 30, the interrupt processor 20, the devices 11, 11,..., And the memory 40 are connected to be able to perform data communication with each other via a bus 50.

半導体装置10の割り込み用プロセッサ20は、割り込み処理専用のI/O主体のプロセッサである。割り込み用プロセッサ20は、割り込み検知部21、割り込み処理選択部22、割り込み処理実行ユニット23、内部メモリ24及びタイマ25を備えている。割り込み処理実行ユニット23はバスインタフェース26を介してバス50と接続されている。   The interrupt processor 20 of the semiconductor device 10 is an I / O-based processor dedicated to interrupt processing. The interrupt processor 20 includes an interrupt detection unit 21, an interrupt process selection unit 22, an interrupt process execution unit 23, an internal memory 24, and a timer 25. The interrupt processing execution unit 23 is connected to the bus 50 via the bus interface 26.

割り込み検知部21は、図1に示す従来の割り込みコントローラ2に相当し、デバイス11、11、・・・からの割り込み処理の実行を要求する実行要求(以下、割り込み要求という)を検知する。割り込み検知部21は、割り込み要求を直接汎用CPU30へ通知するのではなく、割り込み処理選択部22へ通知する。   The interrupt detection unit 21 corresponds to the conventional interrupt controller 2 shown in FIG. 1, and detects an execution request (hereinafter referred to as an interrupt request) that requests execution of interrupt processing from the devices 11, 11,. The interrupt detection unit 21 notifies the interrupt processing selection unit 22 instead of notifying the general-purpose CPU 30 of the interrupt request directly.

割り込み処理選択部22は、割り込み処理を汎用CPU30で実行するか、割り込み処理実行ユニット23で実行するかを選択する。例えばデバイス11からの割り込み要求における割り込み処理の種類を検出し、割り込み処理の種類がリアルタイム性が必要な処理、緊急性は無いが、汎用CPU30で実行するには処理時間が過大である処理等の場合には、割り込み用プロセッサ20の内部で割り込み処理を実行するよう、割り込み処理実行ユニット23へ割り込み要求を通知する(処理62)。それ以外の処理である場合には、従来と同様、割り込み要求を汎用CPU30へ通知する(処理61)。   The interrupt process selection unit 22 selects whether the interrupt process is executed by the general-purpose CPU 30 or the interrupt process execution unit 23. For example, the type of interrupt processing in the interrupt request from the device 11 is detected, the type of interrupt processing is a process that requires real-time processing, and there is no urgency, but the processing time is too long to be executed by the general-purpose CPU 30. In this case, an interrupt request is notified to the interrupt processing execution unit 23 so as to execute the interrupt processing inside the interrupt processor 20 (processing 62). In the case of other processing, an interrupt request is notified to the general-purpose CPU 30 as in the conventional case (processing 61).

割り込み処理プログラムは、汎用CPU30からバス50を介して割り込み用プロセッサ20内の内部メモリ24にダウンロードしておく。したがって、割り込み要求を受け付けた割り込み処理実行ユニット23は、内部メモリ24から対応する割り込み処理プログラムを呼び出して割り込み処理を実行し、割り込み処理の完了を汎用CPU30へ通知する(処理62)。   The interrupt processing program is downloaded from the general-purpose CPU 30 to the internal memory 24 in the interrupt processor 20 via the bus 50. Accordingly, the interrupt processing execution unit 23 that has received the interrupt request calls the corresponding interrupt processing program from the internal memory 24 to execute the interrupt processing, and notifies the general-purpose CPU 30 of the completion of the interrupt processing (processing 62).

図3は、本発明の実施の形態に係る半導体装置10における割り込みレイテンシーを短縮する原理の説明図である。図3(a)は、割り込み用プロセッサ20を備えていない従来の半導体装置におけるデバイスBの割り込み要求が有った場合の割り込みレイテンシーT1を、図3(b)は、本発明の実施の形態に係る半導体装置10におけるデバイスBの割り込み要求が有った場合の割り込みレイテンシーT2を、それぞれ示している。   FIG. 3 is an explanatory diagram of the principle of shortening the interrupt latency in the semiconductor device 10 according to the embodiment of the present invention. FIG. 3A shows an interrupt latency T1 when there is an interrupt request from the device B in a conventional semiconductor device not provided with the interrupt processor 20, and FIG. 3B shows an embodiment of the present invention. The interrupt latency T2 when there is an interrupt request from the device B in the semiconductor device 10 is shown.

図3(a)に示すように、時刻t=0にてデバイスBの割り込み要求が発せられてから、一定時間t1経過後に汎用CPU30に到達する。そして、時刻t=t2となるまでは、汎用CPU30による割り込み処理の禁止期間ΔTとなり、時刻t=t2になった時点で割り込み処理の実行を開始する。なお、図3(a)では、汎用CPU30により割り込み処理の禁止期間ΔTが存在する場合について説明しているが、禁止期間ΔTが存在しない場合には、t=t1から割り込み処理の実行を開始する。   As shown in FIG. 3A, after the interrupt request of the device B is issued at time t = 0, the general CPU 30 is reached after a certain time t1. Until the time t = t2, the interrupt processing prohibition period ΔT by the general-purpose CPU 30 is reached, and the execution of the interrupt processing is started when the time t = t2. FIG. 3A illustrates the case where the general-purpose CPU 30 has the interrupt processing prohibition period ΔT, but when the prohibition period ΔT does not exist, execution of the interrupt processing is started from t = t1. .

割り込み処理の実行を開始する場合、まず時刻t=t2にて実行されている他のプログラムの状況に関する情報であるコンテキスト情報を保存し、ディスパッチする。斯かる処理はOSのハンドラーを呼び出すことにより実行される。そして、図3の例では、割り込み要求の有ったデバイスBの割り込み処理を実行する場合、デバイスAの割り込み処理Aを実行する必要がある例としているため、デバイスAに対応するデバイスドライバのハンドラーを呼び出して割り込み処理Aを実行させた後、再度OSのハンドラーを呼び出すことによりディスパッチする必要が生じる。   When starting execution of interrupt processing, first, context information that is information relating to the status of another program being executed at time t = t2 is saved and dispatched. Such processing is executed by calling an OS handler. In the example of FIG. 3, when executing the interrupt process of the device B having an interrupt request, it is necessary to execute the interrupt process A of the device A. Therefore, the handler of the device driver corresponding to the device A After calling to execute the interrupt process A, it is necessary to dispatch by calling the handler of the OS again.

その後、時刻t=t3にてデバイスBに対応するデバイスドライバのハンドラーを呼び出して、割り込み要求に対する割り込み処理Bを実行させるので、割り込みレイテンシーT1は時刻t=0からt=t3までの時間t3となる。   Thereafter, the handler of the device driver corresponding to the device B is called at time t = t3 to execute the interrupt processing B for the interrupt request, so that the interrupt latency T1 is the time t3 from time t = 0 to t = t3. .

一方、図3(b)では、時刻t=0にてデバイスBの割り込み要求が発せられてから、汎用CPU30による割り込み処理の禁止期間も存在しない。したがって、他の割り込み処理ルーチンの処理待ち時間経過後の時刻t=t4にて割り込み処理B1が実行される。この場合、割り込みレイテンシーT2は時刻t=0からt=t4までの時間t4となり、割り込みレイテンシーを大きく短縮することができる。なお、説明図の都合上、処理時間の長い割り込み処理Aが割り込み処理B1の後に実行されているように記載されているが、実際には、割り込み処理Aは汎用CPU30にて実行されるので、割り込み処理B1と並行に処理されていることは言うまでも無い。   On the other hand, in FIG. 3B, after the interrupt request of the device B is issued at the time t = 0, there is no prohibition period for interrupt processing by the general-purpose CPU 30. Therefore, the interrupt process B1 is executed at time t = t4 after the processing wait time of another interrupt process routine has elapsed. In this case, the interrupt latency T2 is a time t4 from time t = 0 to t = t4, and the interrupt latency can be greatly shortened. For convenience of illustration, it is described that the interrupt process A having a long processing time is executed after the interrupt process B1, but in reality, the interrupt process A is executed by the general-purpose CPU 30. Needless to say, the processing is performed in parallel with the interrupt processing B1.

図2に戻って、割り込み用プロセッサ20は、一定周期でポーリング処理に相当する割り込み処理を実行するためのタイマ(インターバルタイマ)25を備えている。すなわち、デバイス11、11、・・・が、割り込み機能を有していない場合、通常はポーリング処理が実行される。ポーリング処理は一定時間間隔で信号を発することから、CPU、バス等への負荷が大きい。そこで、本実施の形態ではタイマ25の計時により一定周期で内部的にタイマ割り込みを発生させている。   Returning to FIG. 2, the interrupt processor 20 includes a timer (interval timer) 25 for executing interrupt processing corresponding to polling processing at regular intervals. That is, when the devices 11, 11,... Do not have an interrupt function, a polling process is normally executed. Since the polling process generates a signal at regular time intervals, the load on the CPU, bus, etc. is large. Therefore, in the present embodiment, a timer interrupt is internally generated at a constant cycle by the timer 25.

一定周期で発生するタイマ割り込みにより後述の割り込み処理ルーチンが割り込み処理実行ユニット23で実行される。汎用CPU30の代わりに、実行される割り込み処理ルーチンの中でデバイスの状態を確認し、所定の条件が成立した時点でCPU30に対して割り込み要求を通知する(図2の処理63)。したがって、例えば割り込み機能を有していないメモリデバイス等にも汎用CPU30に対する割り込み機能を持たせることができる。図4は、デバイス11が割り込み機能を有していない場合に、従来のように汎用CPU30にてポーリング処理を実行する場合と、割り込み用プロセッサ20の内部で割り込み処理を実行する場合とを比較するタイムチャートである。   An interrupt processing routine, which will be described later, is executed by the interrupt processing execution unit 23 by a timer interrupt that occurs at a constant period. Instead of the general-purpose CPU 30, the state of the device is confirmed in an interrupt processing routine to be executed, and an interrupt request is notified to the CPU 30 when a predetermined condition is satisfied (process 63 in FIG. 2). Therefore, for example, a memory device that does not have an interrupt function can also have an interrupt function for the general-purpose CPU 30. FIG. 4 compares the case where the general-purpose CPU 30 executes polling processing as in the prior art and the case where interrupt processing is executed inside the interrupt processor 20 when the device 11 does not have an interrupt function. It is a time chart.

図4(a)は、汎用CPU30にてポーリング処理を実行する場合の汎用CPU30のタイムチャートを示しており、図4(b)は、割り込み用プロセッサ20にて割り込み処理を実行する場合の汎用CPU30及び割り込み用プロセッサ20のタイムチャートを示している。   4A shows a time chart of the general-purpose CPU 30 when the general-purpose CPU 30 executes the polling process, and FIG. 4B shows a general-purpose CPU 30 when the interrupt processor 20 executes the interrupt process. And the time chart of the processor 20 for interruption is shown.

図4(a)において、時刻TS0から時刻TS1までは、汎用CPU30によりタスクAが実行されている。時刻TS1にて制御がOSに渡され、時刻TS2にてタスクBが実行される。タスクBの中で所定の条件が成立しているか否かを判断する判断処理が実行され、所定の条件が成立していないと判断した場合、時刻TS3にて制御をOSへ戻し、時刻TS4からタスクCを実行する。以後、同様の処理を繰り返して時刻TS5にて所定の条件が成立していると判断した場合、タスクBは所定の条件が成立している場合の処理の実行を開始する。   In FIG. 4A, the task A is executed by the general-purpose CPU 30 from time TS0 to time TS1. At time TS1, control is passed to the OS, and task B is executed at time TS2. In the task B, a determination process for determining whether or not a predetermined condition is satisfied is executed. When it is determined that the predetermined condition is not satisfied, the control is returned to the OS at time TS3, and from time TS4. Task C is executed. Thereafter, when it is determined that the predetermined condition is satisfied at the time TS5 by repeating the same process, the task B starts executing the process when the predetermined condition is satisfied.

一方、図4(b)において、時刻TS0から時刻TS1までは、汎用CPU30によりタスクAが実行されている。時刻TS1にて制御がOSに渡されるまでは、図4(a)と同様である。図4(b)では、時刻TS1にて制御がOSに渡された後、タイマ25の計時により一定周期で割り込み用プロセッサ20による、所定の条件が成立しているか否かを判断する判断処理が実行される。   On the other hand, in FIG. 4B, the task A is executed by the general-purpose CPU 30 from time TS0 to time TS1. The process is the same as that shown in FIG. 4A until control is passed to the OS at time TS1. In FIG. 4B, after the control is transferred to the OS at time TS1, a determination process is performed by the interrupt processor 20 to determine whether or not a predetermined condition is satisfied at a constant period by the timer 25. Executed.

すなわち、時刻TS2’にて割り込み用プロセッサ20が汎用CPU30とは独立に所定の条件が成立しているか否かを判断する判断処理を実行し、所定の条件が成立していないと判断した場合、時刻TS3’にて判断処理を終了する。以後、割り込み用プロセッサ20は、一定周期で判断処理を実行し、時刻TS6にて判断処理を実行して時刻TS7にて所定の条件が成立していると判断した場合、時刻TS8にて汎用CPU30に対して割り込み要求を通知し、時刻TS9にてタスクBは所定の条件が成立している場合の処理の実行を開始する。   That is, when the interrupt processor 20 executes a determination process for determining whether or not a predetermined condition is satisfied independently of the general-purpose CPU 30 at time TS2 ′ and determines that the predetermined condition is not satisfied, The determination process ends at time TS3 ′. Thereafter, when the interrupt processor 20 executes the determination process at a constant cycle, executes the determination process at time TS6, and determines that the predetermined condition is satisfied at time TS7, the general-purpose CPU 30 at time TS8. An interrupt request is notified to task B, and at time TS9, task B starts execution of processing when a predetermined condition is satisfied.

図4(a)と図4(b)とを比較すればわかるように、割り込み用プロセッサ20のタイマ割り込みを繰り返し発生させることにより、タスクBを毎回起動させる必要が無くなり、OSへ制御を戻す回数が減少する。また、タスクBにおける判断処理の必要がないことから、汎用CPU30の負荷も軽減することができる。よって、デバイス11が割り込み機能を有していない場合であっても、ポーリング処理を実行することなく外部割り込み処理を実行することができる。   As can be seen from a comparison between FIG. 4A and FIG. 4B, it is not necessary to start task B each time by repeatedly generating a timer interrupt of the interrupt processor 20, and the number of times control is returned to the OS. Decrease. In addition, since the determination process in task B is not necessary, the load on the general-purpose CPU 30 can be reduced. Therefore, even when the device 11 does not have an interrupt function, external interrupt processing can be executed without executing polling processing.

図5は、本発明の実施の形態に係る割り込み用プロセッサ20の詳細構成を示す模式図である。図5では、いわゆるラウンドロビン方式にて割り込み処理を実行する場合を例に挙げて説明する。本実施の形態に係る割り込み用プロセッサ20は、1つのIPコア(Intellectual Property Core)としてSoC(System on a Chip)に組み込むことを前提としている。   FIG. 5 is a schematic diagram showing a detailed configuration of the interrupt processor 20 according to the embodiment of the present invention. In FIG. 5, a case where interrupt processing is executed by a so-called round robin method will be described as an example. The interrupt processor 20 according to the present embodiment is premised on being incorporated into a SoC (System on a Chip) as one IP core (Intelligent Property Core).

図5において、バス50は汎用CPU30のローカルバスである。バス50を経由して汎用CPU30から制御レジスタ51及び内部メモリ24へアクセスすることができる。また、割り込み処理実行ユニット23は、バス50のバスマスターとしても機能する。ほとんどの処理は、割り込み用プロセッサ20の内部で完結され、デバイス11にアクセスする場合のみ汎用CPU30と共有するバス50を占有する。   In FIG. 5, a bus 50 is a local bus of the general-purpose CPU 30. The general-purpose CPU 30 can access the control register 51 and the internal memory 24 via the bus 50. The interrupt processing execution unit 23 also functions as a bus master for the bus 50. Most of the processing is completed inside the interrupt processor 20 and occupies the bus 50 shared with the general-purpose CPU 30 only when the device 11 is accessed.

各デバイス11からの割り込み要求及びタイマ25からのタイマ割り込みの割り込み要求のうち、最大n個(nは自然数)の割り込み要求が割り込み処理実行ユニット23へ通知される。ここでnは固定値であり、割り込み処理実行ユニット23をSoCに組み込む時点でハードウウエア的に決定される。内部メモリ24にはn個の割り込み処理ルーチンが汎用CPU30からバス50を介して事前にダウンロードされている。   Of the interrupt requests from each device 11 and the timer interrupt requests from the timer 25, a maximum of n (n is a natural number) interrupt requests are notified to the interrupt processing execution unit 23. Here, n is a fixed value, and is determined by hardware when the interrupt processing execution unit 23 is incorporated into the SoC. In the internal memory 24, n interrupt processing routines are downloaded in advance from the general-purpose CPU 30 via the bus 50.

一の割り込み処理実行ユニット23は、内部メモリ24に記憶してある割り込み処理ルーチンP0、P1、・・・Pn-1 を順次切り替えながら実行する。割り込み処理ルーチンPi(iは0〜n−1の整数)が実行されるのは、割り込み処理ルーチンPiが有効であり、割り込み要求がアクティブである場合のみである。割り込み要求1回につき割り込み処理ルーチンPiを1度だけ実行し、必要な場合には最後に汎用CPU30に対して割り込み要求を通知する。   One interrupt processing execution unit 23 executes the interrupt processing routines P0, P1,... Pn-1 stored in the internal memory 24 while sequentially switching them. The interrupt processing routine Pi (i is an integer from 0 to n-1) is executed only when the interrupt processing routine Pi is valid and the interrupt request is active. The interrupt processing routine Pi is executed only once per interrupt request, and when necessary, the interrupt request is finally notified to the general-purpose CPU 30.

割り込み処理の実行中に他の処理が割り込むことは無いが、一定時間Timeout内に割り込み処理ルーチンが終了しない場合には、割り込み処理実行ユニット23は強制的に次の割り込み処理ルーチンPi+1 に制御を渡す。割り込み処理ルーチンを切り替える場合のコンテキスト情報の保存は、割り込み処理実行ユニット23によりハードウエア的に実行される。   While no other process interrupts during the execution of the interrupt process, if the interrupt process routine does not end within the predetermined time Timeout, the interrupt process execution unit 23 forcibly controls the next interrupt process routine Pi + 1. give. Saving of context information when switching interrupt processing routines is executed by hardware by the interrupt processing execution unit 23.

制御レジスタ51は、割り込み処理ルーチンPiの数に対応し、例えば32ビットレジスタとして構成されている。図6は、割り込み要求と割り込み処理ルーチンPi又は汎用CPU30への割り込み要求Rとの対応付けを示す模式図である。   The control register 51 corresponds to the number of interrupt processing routines Pi, and is configured as a 32-bit register, for example. FIG. 6 is a schematic diagram showing the correspondence between the interrupt request and the interrupt processing routine Pi or the interrupt request R to the general-purpose CPU 30.

図7は、論理スイッチSj(jは0からm−1の整数、mは自然数)及びStの構成を示す例示図である。図7の例では、1つのAND回路と1つのNOT回路を組み合わせて、割り込み要求を汎用CPU30へ通知することを示す信号rを出力する。図6の論理スイッチS0、S1、・・・、S(m−1)及びStから出力された信号をそれぞれr0、r1、・・・、r(m−1)及びrtとし、論理回路GのOR回路により、汎用CPU30へ通知する割り込み要求Rを特定する。   FIG. 7 is an exemplary diagram showing the configuration of the logical switch Sj (j is an integer from 0 to m−1, m is a natural number) and St. In the example of FIG. 7, a signal r indicating that an interrupt request is notified to the general-purpose CPU 30 is output by combining one AND circuit and one NOT circuit. The signals output from the logic switches S0, S1,..., S (m−1) and St in FIG. 6 are r0, r1,. The interrupt request R notified to the general-purpose CPU 30 is specified by the OR circuit.

なお、論理スイッチS0、S1、・・・、S(m−1)及びStには、イネーブル信号(ENABLE)、リクエスト信号(REQUEST)、セレクト信号(SELECT)が入力される。イネーブル信号は、割り込み信号の出力を行うか否かを示しており、リクエスト信号は、割り込み要求を受け付けたか否かを示している。セレクト信号は、割り込み要求を汎用CPU30へ通知するか、割り込み処理実行ユニット23へ通知するかを示している。図6の論理回路Hj(jは0〜m−1の整数)のAND回路への入力も同様である。   Note that an enable signal (ENABLE), a request signal (REQUEST), and a select signal (SELECT) are input to the logical switches S0, S1, ..., S (m-1) and St. The enable signal indicates whether or not to output an interrupt signal, and the request signal indicates whether or not an interrupt request has been accepted. The select signal indicates whether to notify the general-purpose CPU 30 of the interrupt request or the interrupt processing execution unit 23. The same applies to the input to the AND circuit of the logic circuit Hj (j is an integer of 0 to m-1) in FIG.

図6に示すように、割り込み要求を汎用CPU30へ通知するか、割り込み処理実行ユニット23へ通知するか、は、図7に示すセレクト信号により決定される。論理回路Gは、複数の論理スイッチSj及びタイマ25用の論理スイッチStを備えており、複数の論理スイッチSj及びタイマ25用の論理スイッチStからの出力信号r0、r1、・・・、r(m−1)及びrtの中からOR回路にて特定した出力信号を割り込み要求Rとして汎用CPU30へ通知する。   As shown in FIG. 6, whether the interrupt request is notified to the general-purpose CPU 30 or the interrupt processing execution unit 23 is determined by the select signal shown in FIG. The logic circuit G includes a plurality of logic switches Sj and a logic switch St for the timer 25, and output signals r0, r1,..., R (from the plurality of logic switches Sj and the logic switch St for the timer 25). The output signal specified by the OR circuit from m-1) and rt is notified to the general-purpose CPU 30 as an interrupt request R.

各論理回路Hi(iは0〜n−1の整数)は、m個(mは自然数)の割り込み要求0、割り込み要求1、・・・、割り込み要求(m−1)、及びタイマ割り込み要求に対応してAND回路をそれぞれ設けておき、割り込み要求j(jは0〜m−1の整数)又はタイマ割り込み要求が出された場合には、割り込み要求j(jは0〜m−1の整数)又はタイマ割り込み要求が出されたAND回路のみがオン状態の信号pj又はptを出力し、OR回路により割り込み要求jに対応した任意の割り込み処理ルーチンPi(iは0〜n−1の整数)のみがアクティブとなる。   Each logic circuit Hi (i is an integer from 0 to n-1) is assigned to m (m is a natural number) interrupt request 0, interrupt request 1, ..., interrupt request (m-1), and timer interrupt request. Correspondingly, AND circuits are provided, and when an interrupt request j (j is an integer from 0 to m−1) or a timer interrupt request is issued, an interrupt request j (j is an integer from 0 to m−1). ) Or only the AND circuit to which the timer interrupt request is issued outputs the signal pj or pt in the ON state, and the arbitrary interrupt processing routine Pi corresponding to the interrupt request j by the OR circuit (i is an integer of 0 to n−1). Only becomes active.

図8は、本発明の実施の形態に係る制御レジスタ51の構成を示す模式図である。制御レジスタ51は、内部に割り込み処理ルーチンP0〜Pn-1 にそれぞれ対応したレジスタ群71、71、・・・を設けてあり、それぞれ割り込み処理プログラムの開始アドレスレジスタ(START)、終了アドレスレジスタ(END)、現在実行中のアドレスを示すインストラクションポインタ(IAR)、状態レジスタ(STAT)、イネーブルレジスタ(ENABLE)、及びリクエストレジスタ(REQUEST)で構成されている。   FIG. 8 is a schematic diagram showing the configuration of the control register 51 according to the embodiment of the present invention. The control register 51 includes register groups 71, 71,... Corresponding to the interrupt processing routines P0 to Pn-1, respectively, and the interrupt processing program start address register (START) and end address register (END), respectively. ), An instruction pointer (IAR) indicating an address currently being executed, a status register (STAT), an enable register (ENABLE), and a request register (REQUEST).

割り込み要求iを受信した割り込み処理実行ユニット23は、割り込み処理ルーチンPiの処理の順番が回ってくると、Piに対応する図8に示すレジスタ群71を照会しながら、内部メモリ24から割り込み処理ルーチンPiを読み出して割り込み処理を実行する。割り込み処理が完了した場合には、割り込み処理の完了を汎用CPU30へ通知する。   The interrupt processing execution unit 23 that has received the interrupt request i, when the processing order of the interrupt processing routine Pi comes around, inquires from the internal memory 24 while referring to the register group 71 shown in FIG. 8 corresponding to Pi. Pi is read and interrupt processing is executed. When the interrupt process is completed, the general CPU 30 is notified of the completion of the interrupt process.

図9は、本発明の実施の形態に係る状態レジスタ(STAT)のビット配列の例示図である。図9の例では、ビット0から順に、割り込み処理ルーチンPiが有効であるか否かを示すV(Valid)ビット、割り込み要求が発生しているか否かを示すT(Trigger)ビット、割り込み処理中であるか否かを示すP(In Process)ビット、及び汎用CPU30へ割り込み要求が通知されているか否かを示すI(Interrupt)ビットが配置されている。   FIG. 9 is a view showing an example of a bit arrangement of the status register (STAT) according to the embodiment of the present invention. In the example of FIG. 9, in order from bit 0, a V (Valid) bit indicating whether or not the interrupt processing routine Pi is valid, a T (Trigger) bit indicating whether or not an interrupt request is generated, and interrupt processing And an I (Interrupt) bit indicating whether or not an interrupt request has been notified to the general-purpose CPU 30.

割り込み処理実行ユニット23は、図8に示すように制御レジスタ51のレジスタ群71、71、・・・の状態レジスタ(STAT)をそれぞれ照会し、該当する割り込み処理ルーチンPiを実行する。また、レジスタ群72は、割り込み処理ルーチンPiで使用される汎用レジスタGPR0、GPR1、・・・、GPRiで構成されている。ほとんどの処理は、割り込み用プロセッサ20の内部で完結しており、デバイス11、11、・・・に対する処理が発生した場合にのみバス50を介してデータ通信すれば足りるので、汎用CPU30による割り込み処理の実行時に比べてバス50の通信負荷を大きく低減することが可能となる。   As shown in FIG. 8, the interrupt processing execution unit 23 inquires the status registers (STAT) of the register groups 71, 71,... Of the control register 51, and executes the corresponding interrupt processing routine Pi. The register group 72 includes general-purpose registers GPR0, GPR1,..., GPRi used in the interrupt processing routine Pi. Most of the processing is completed inside the interrupt processor 20, and it is sufficient to perform data communication via the bus 50 only when processing for the devices 11, 11,... Occurs. The communication load on the bus 50 can be greatly reduced as compared with the execution time of.

各レジスタ群71に設けてあるレジスタENABLEは、割り込み信号の出力を行うか否かを示しており、レジスタREQUESTは、割り込み要求を受け付けたか否かを示している。なお、レジスタREQUESTは、割り込み要求に対する処理がペンディング状態であるか否か(ステータス)を示しており、一般に割り込みステータスレジスタと呼ばれているレジスタと同様である。   A register ENABLE provided in each register group 71 indicates whether an interrupt signal is output, and a register REQUEST indicates whether an interrupt request is accepted. The register REQUEST indicates whether or not the processing for the interrupt request is in a pending state (status), and is similar to a register generally called an interrupt status register.

また、レジスタTIMERは、割り込み処理ルーチンのタイムアウト時間を書き込んであり、レジスタSELECTは、割り込み要求を汎用CPU30へ通知するか、割り込み処理実行ユニット23へ通知するかを示している。   The register TIMER writes the timeout period of the interrupt processing routine, and the register SELECT indicates whether to notify the interrupt request to the general-purpose CPU 30 or the interrupt processing execution unit 23.

図10は、本発明の実施の形態に係るレジスタSTATによる割り込み処理ルーチンPi特定方法の例示図である。図10では、割り込み処理ルーチンP0〜Pn-1 にそれぞれ対応したレジスタ群71に含まれるレジスタENABLE(図10(a))、レジスタREQUEST(図10(b))及び制御レジスタ51に1個だけ設けてあるレジスタSELECTが、それぞれ32ビット構成である場合について説明する。各レジスタのビットは、各割り込み要求信号に対応している。例えば、割り込み要求番号0がレジスタREQUESTのビット0(MSB)に対応し、タイマ割り込みが同レジスタのビット31(LSB)に対応する。また、レジスタENABLEとレジスタREQUESTとは各割り込み処理ルーチンPiごとに設けてあり、一又は複数の割り込み要求番号に対応付けることが可能となっている。   FIG. 10 is a view showing an example of the interrupt processing routine Pi identification method by the register STAT according to the embodiment of the present invention. In FIG. 10, only one register ENABLE (FIG. 10 (a)), one register REQUEST (FIG. 10 (b)) and one control register 51 included in the register group 71 corresponding to the interrupt processing routines P0 to Pn-1 are provided. A case where each of the register SELECTs has a 32-bit configuration will be described. Each register bit corresponds to each interrupt request signal. For example, the interrupt request number 0 corresponds to bit 0 (MSB) of the register REQUEST, and the timer interrupt corresponds to bit 31 (LSB) of the register. The register ENABLE and the register REQUEST are provided for each interrupt processing routine Pi, and can be associated with one or a plurality of interrupt request numbers.

例えば、レジスタENABLEの値が32‘b1110・・・000である場合、割り込み要求番号0、1、2が有効である。ここで、レジスタSELECTの値が32‘b1100・・・000となった場合、割り込み要求番号0、1に対しては割り込み用プロセッサ20の内部で処理(図2の処理62)し、割り込み要求番号2に対しては汎用CPU30で処理(図2の処理61)することを意味している。デバイス11の割り込み要求があり、レジスタREQUESTのビット0又はビット1が‘1’となった場合、対応する割り込み処理ルーチンPiが割り込み処理実行ユニット23で実行される。   For example, when the value of the register ENABLE is 32′b11110... 000, the interrupt request numbers 0, 1 and 2 are valid. Here, when the value of the register SELECT becomes 32′b1100... 000, the interrupt request numbers 0 and 1 are processed inside the interrupt processor 20 (process 62 in FIG. 2), and the interrupt request number 2 means that the general-purpose CPU 30 performs processing (processing 61 in FIG. 2). When there is an interrupt request from the device 11 and bit 0 or bit 1 of the register REQUEST is set to “1”, the corresponding interrupt processing routine Pi is executed by the interrupt processing execution unit 23.

割り込み処理実行ユニット23は、図5の内部メモリ24に示すように、ラウンドロビン方式で割り込み処理ルーチンPiを順次切り替えつつ実行する。図11は、割り込み処理ルーチンPiの動作を説明する処理の説明図である。図11は、説明をわかりやすくするためにプログラミング言語風に記述しているが、割り込み処理実行ユニット23がハードウエア的に行う処理を示している。   As shown in the internal memory 24 of FIG. 5, the interrupt processing execution unit 23 executes the interrupt processing routine Pi while sequentially switching in a round robin manner. FIG. 11 is an explanatory diagram of processing for explaining the operation of the interrupt processing routine Pi. FIG. 11 is described in a programming language style for easy understanding, but shows processing performed by the interrupt processing execution unit 23 in hardware.

図11において、割り込み要求が生じ(T=1)、対応する割り込み処理ルーチンPiが有効(V=1)である場合、レジスタTIMERで指定されるタイムアウト値を残り時間を示すレジスタTLEFTにロードする。レジスタTLEFTの値は、割り込み用プロセッサ20のクロックに同期して‘0’になるまで自動的に減少する。   In FIG. 11, when an interrupt request is generated (T = 1) and the corresponding interrupt processing routine Pi is valid (V = 1), the time-out value specified by the register TIMER is loaded into the register TLEFT indicating the remaining time. The value of the register TLEFT is automatically decreased until it becomes “0” in synchronization with the clock of the interrupt processor 20.

次に、割り込み処理が実行中であることを示すフラグPを‘1’とし、開始アドレスレジスタ(START)を現在の実行アドレス(IAR=START)として実行を開始する。割り込み処理ルーチンPiの現在の実行アドレスが終了アドレスレジスタ(END)に到達した場合(IAR=END)、必要ならば汎用CPU30へ割り込み要求を通知し(I=1)、フラグPを‘0’にして処理を終了する。また、割り込み処理ルーチンPiがレジスタTIMERで指定されたタイムアウト時間内に終了しない場合、割り込み処理ルーチンPiにより使用されるレジスタ群72(汎用レジスタGPRi、カウントレジスタCTR等)に記憶されている値を退避してから、強制的に次の割り込み処理ルーチンへと制御を渡す(タスクスイッチ)。   Next, the flag P indicating that the interrupt process is being executed is set to ‘1’, and the start address register (START) is set to the current execution address (IAR = START) to start the execution. When the current execution address of the interrupt processing routine Pi reaches the end address register (END) (IAR = END), an interrupt request is notified to the general-purpose CPU 30 (I = 1) if necessary, and the flag P is set to “0”. To finish the process. If the interrupt processing routine Pi does not end within the time-out period specified by the register TIMER, the values stored in the register group 72 (general-purpose register GPRI, count register CTR, etc.) used by the interrupt processing routine Pi are saved. Then, control is forcibly passed to the next interrupt processing routine (task switch).

そして、同一の割り込み処理ルーチンの順番が再び回ってきた場合、フラグP=1であるときには前回退避したレジスタ群72のコンテキスト情報を各レジスタに復帰させる。ただし、レジスタ群72を割り込み処理ルーチンの数nだけ設けている場合には、退避及び復帰は不要となる。前回タスクスイッチを行った時点での実行アドレスはレジスタIARに残っているので、レジスタIARに残っているアドレスから実行を再開し、割り込み処理ルーチンPiの現在の実行アドレスが終了アドレスレジスタ(END)に到達するか(IAR=END)、タイムアウトしてタスクスイッチが行われるまで割り込み処理ルーチンPiの実行を続ける。   When the order of the same interrupt processing routine comes again, when the flag P = 1, the context information of the previously saved register group 72 is returned to each register. However, if there are as many register groups 72 as the number n of interrupt processing routines, saving and restoring are not necessary. Since the execution address at the time of the previous task switch remains in the register IAR, execution is resumed from the address remaining in the register IAR, and the current execution address of the interrupt processing routine Pi is stored in the end address register (END). The interrupt processing routine Pi continues to be executed until it reaches (IAR = END) or until time-out and task switching is performed.

通常のCPUでは、タスクスイッチに必要な処理はOS等のソフトウエアにより行われる。しかし、上述のように本発明では、タスクスイッチに必要な処理はハードウエア的に実行されることから、OSは不要となる。   In a normal CPU, processing necessary for task switching is performed by software such as an OS. However, as described above, in the present invention, the processing necessary for the task switch is executed by hardware, so that the OS is unnecessary.

また、割り込みレイテンシーの最大値Tmax は、ラウンドロビン方式による割り込み処理ルーチンの実行により、次に処理の順番が回ってくるまでの時間の最大値に等しい。したがって、割り込みレイテンシーの最大値Tmax は、式(1)にて表すことができる。つまり、割り込み処理ルーチンの数nが固定値であるため、式(1)の時間内に割り込み処理が実行されることが保証される。   Further, the maximum value Tmax of the interrupt latency is equal to the maximum value of the time until the next processing order comes after execution of the interrupt processing routine by the round robin method. Therefore, the maximum value Tmax of the interrupt latency can be expressed by equation (1). That is, since the number n of interrupt processing routines is a fixed value, it is guaranteed that the interrupt processing is executed within the time of Expression (1).

Tmax =Timeout×n+オーバヘッド時間 ・・・ 式(1)   Tmax = Timeout × n + overhead time (1)

ここでオーバヘッド時間とは、コンテキスト情報の保存等に要する時間を意味しており、OSによるタスク切り替え時間と比べるとはるかに小さい。   Here, the overhead time means the time required for saving context information and the like, and is much shorter than the task switching time by the OS.

通常のCPU上で実行する割り込み処理ルーチンの場合、他の割り込み処理への影響を考慮してできるだけ短い時間で処理できるように記述するのが鉄則である。本発明では、長い処理時間を要する割り込み処理ルーチンを使用した場合であっても他の割り込み処理に対するレイテンシーに影響を与えない。したがって、図1の第3レベルで行っていたようなメインの処理を割り込み処理ルーチンの中に含めても問題とはならない。   In the case of an interrupt processing routine executed on a normal CPU, it is a rule to describe the processing so that it can be processed in as short a time as possible in consideration of the influence on other interrupt processing. In the present invention, even when an interrupt processing routine that requires a long processing time is used, the latency for other interrupt processing is not affected. Therefore, it does not matter if the main processing as performed at the third level in FIG. 1 is included in the interrupt processing routine.

以上のように本実施の形態によれば、割り込み処理を実行する専用の割り込み用プロセッサ20を用いて、汎用CPU30とは完全に独立して割り込み処理を実行することにより、例えばデバイスドライバ、OS等が無用の割り込み禁止時間を設けている場合、処理時間が長いデバイスドライバのハンドラーが実行されている場合等であっても、それに影響されることなくリアルタイム性が要求される割り込み処理を即座に実行することができる。また、割り込み機能を有していないデバイスに対しても外部割り込み処理を実行することが可能となる。   As described above, according to the present embodiment, by using the dedicated interrupt processor 20 for executing interrupt processing and executing interrupt processing completely independently of the general-purpose CPU 30, for example, a device driver, OS, etc. If there is an unnecessary interrupt prohibition time, even if a device driver handler with a long processing time is running, interrupt processing that requires real-time performance is immediately executed without being affected by it. can do. In addition, external interrupt processing can be executed for a device that does not have an interrupt function.

なお、本発明は上記実施例に限定されるものではなく、本発明の趣旨の範囲内であれば多種の変更、改良等が可能である。   The present invention is not limited to the above-described embodiments, and various changes and improvements can be made within the scope of the present invention.

従来の割り込み処理実行の具体例を示すブロック図である。It is a block diagram which shows the specific example of the conventional interruption process execution. 本発明の実施の形態に係る割り込みレイテンシーを短縮することができる半導体装置の構成例を示すブロック図である。It is a block diagram which shows the structural example of the semiconductor device which can shorten the interrupt latency concerning embodiment of this invention. 本発明の実施の形態に係る半導体装置における割り込みレイテンシーを短縮する原理の説明図である。It is explanatory drawing of the principle which shortens the interrupt latency in the semiconductor device which concerns on embodiment of this invention. デバイスが割り込み機能を有していない場合に、従来のように汎用CPUにてポーリング処理を実行する場合と、割り込み用プロセッサにて割り込み処理を実行する場合とを比較するタイムチャートである。6 is a time chart for comparing a case where a general-purpose CPU executes polling processing and a case where interrupt processing is executed by an interrupt processor when a device does not have an interrupt function. 本発明の実施の形態に係る割り込み用プロセッサの詳細構成を示す模式図である。It is a schematic diagram which shows the detailed structure of the processor for interruption concerning embodiment of this invention. 割り込み要求と割り込み処理ルーチン又は汎用CPUへの割り込みとの対応付けを示す模式図である。It is a schematic diagram which shows matching with the interruption request | requirement and interruption processing routine or interruption to general purpose CPU. 論理スイッチの構成を示す例示図である。It is an illustration figure which shows the structure of a logic switch. 本発明の実施の形態に係る制御レジスタの構成を示す模式図である。It is a schematic diagram which shows the structure of the control register which concerns on embodiment of this invention. 本発明の実施の形態に係る状態レジスタ(STAT)のビット配列の例示図である。It is an illustration figure of the bit arrangement | sequence of the status register (STAT) based on embodiment of this invention. 本発明の実施の形態に係るレジスタSTATによる割り込み処理ルーチンPi特定方法の例示図である。It is an illustration figure of the interrupt processing routine Pi specific method by the register | resistor STAT which concerns on embodiment of this invention. 割り込み処理ルーチンPiの動作を説明する処理の説明図である。It is explanatory drawing of the process explaining operation | movement of the interruption process routine Pi.

符号の説明Explanation of symbols

10 半導体装置
11 デバイス
20 割り込み用プロセッサ
21 割り込み検知部
22 割り込み処理選択部
23 割り込み処理実行ユニット
24 内部メモリ
25 タイマ(インターバルタイマ)
30 汎用CPU
51 制御レジスタ
DESCRIPTION OF SYMBOLS 10 Semiconductor device 11 Device 20 Interrupt processor 21 Interrupt detection part 22 Interrupt process selection part 23 Interrupt process execution unit 24 Internal memory 25 Timer (interval timer)
30 General-purpose CPU
51 Control register

Claims (8)

汎用CPUと、
他の処理よりも優先させる割り込み処理を実行するための割り込み処理プログラムを実行する割り込み用プロセッサと
を有し、
前記割り込み用プロセッサは、
割り込み処理を実行する割り込み処理実行ユニットと、
割り込み処理を実行するための割り込み処理プログラムを記憶するメモリと、
割り込み処理の実行を要求する実行要求を検知する割り込み検知部と、
割り込み処理を前記汎用CPUで実行するか、前記割り込み処理実行ユニットで実行するかを選択する割り込み処理選択部と
を備える装置。
A general-purpose CPU;
An interrupt processor that executes an interrupt processing program for executing an interrupt process that has priority over other processes;
The interrupt processor is:
An interrupt processing execution unit for executing interrupt processing;
A memory for storing an interrupt processing program for executing the interrupt processing;
An interrupt detection unit that detects an execution request that requests execution of interrupt processing;
An interrupt processing selection unit that selects whether to execute interrupt processing by the general-purpose CPU or the interrupt processing execution unit.
前記割り込み用プロセッサは、時間を計時するタイマを備え、
前記割り込み処理選択部は、
前記タイマによる計時により一定時間経過する都度、所定の条件が成立しているか否かを判断する基礎となる信号を出力し、
前記割り込み処理実行ユニットが、
出力された信号に基づいて所定の条件が成立しているか否かを判断して、前記割り込み処理実行ユニットで割り込み処理を実行するか否かを選択する請求項1記載の装置。
The interrupt processor includes a timer for measuring time,
The interrupt processing selection unit
Each time a predetermined time elapses due to the time measured by the timer, a signal serving as a basis for determining whether or not a predetermined condition is satisfied is output,
The interrupt processing execution unit is
The apparatus according to claim 1, wherein it is determined whether or not a predetermined condition is satisfied based on the output signal, and whether or not to execute interrupt processing in the interrupt processing execution unit is selected.
前記割り込み用プロセッサは、一定のタスク数を上限として複数の割り込み処理を実行することが可能であり、
前記割り込み処理実行ユニットが、
割り込み処理ごとにラウンドロビン方式で実行することが可能な条件が成立しているか否かを判断する請求項2記載の装置。
The interrupt processor is capable of executing a plurality of interrupt processes up to a certain number of tasks,
The interrupt processing execution unit is
The apparatus according to claim 2, wherein it is determined whether a condition capable of being executed in a round-robin manner is satisfied for each interrupt process.
割り込み処理ごとに割り込みの状態に関する情報を記憶する状態レジスタを有し、
前記割り込み処理実行ユニットが、
前記状態レジスタに記憶されている割り込みの状態に関する情報に基づいて、実行することが可能な条件が成立しているか否かを判断する請求項3記載の装置。
It has a status register that stores information about the status of interrupts for each interrupt process,
The interrupt processing execution unit is
The apparatus according to claim 3, wherein it is determined whether or not a condition that can be executed is satisfied based on information on an interrupt state stored in the state register.
汎用CPUと、
他の処理よりも優先させる割り込み処理を実行するための割り込み処理プログラムを実行する割り込み用プロセッサと
を有し、
割り込み処理の実行を要求する実行要求を検知し、
割り込み処理を前記汎用CPUで実行するか、前記割り込み用プロセッサで実行するかを選択する方法。
A general-purpose CPU;
An interrupt processor that executes an interrupt processing program for executing an interrupt process that has priority over other processes;
Detects an execution request that requests execution of interrupt processing,
A method for selecting whether the interrupt processing is executed by the general-purpose CPU or the interrupt processor.
前記割り込み用プロセッサは、時間を計時するタイマを備え、
前記割り込み処理選択部は、
前記タイマによる計時により一定時間経過する都度、所定の条件が成立しているか否かを判断する基礎となる信号を出力し、
前記割り込み処理実行ユニットが、
出力された信号に基づいて所定の条件が成立しているか否かを判断して、前記割り込み処理実行ユニットで割り込み処理を実行するか否かを選択する請求項5記載の方法。
The interrupt processor includes a timer for measuring time,
The interrupt processing selection unit
Each time a predetermined time elapses due to the time measured by the timer, a signal serving as a basis for determining whether or not a predetermined condition is satisfied is output,
The interrupt processing execution unit is
6. The method according to claim 5, wherein it is determined whether or not a predetermined condition is satisfied based on the output signal, and whether or not to execute interrupt processing in the interrupt processing execution unit is selected.
前記割り込み用プロセッサは、一定のタスク数を上限として複数の割り込み処理を実行することが可能であり、
前記割り込み処理実行ユニットが、
割り込み処理ごとにラウンドロビン方式で実行することが可能な条件が成立しているか否かを判断する請求項6記載の方法。
The interrupt processor is capable of executing a plurality of interrupt processes up to a certain number of tasks,
The interrupt processing execution unit is
The method according to claim 6, wherein a determination is made as to whether a condition capable of being executed in a round robin manner is satisfied for each interrupt process.
割り込み処理ごとに割り込みの状態に関する情報を記憶する状態レジスタを有し、
前記割り込み処理実行ユニットが、
前記状態レジスタに記憶されている割り込みの状態に関する情報に基づいて、実行することが可能な条件が成立しているか否かを判断する請求項7記載の方法。
It has a status register that stores information about the status of interrupts for each interrupt process,
The interrupt processing execution unit is
The method according to claim 7, wherein it is determined whether or not a condition that can be executed is satisfied based on information on an interrupt state stored in the state register.
JP2008315552A 2008-12-11 2008-12-11 Apparatus and method for shortening interrupt latency Pending JP2010140239A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008315552A JP2010140239A (en) 2008-12-11 2008-12-11 Apparatus and method for shortening interrupt latency

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008315552A JP2010140239A (en) 2008-12-11 2008-12-11 Apparatus and method for shortening interrupt latency

Publications (1)

Publication Number Publication Date
JP2010140239A true JP2010140239A (en) 2010-06-24

Family

ID=42350337

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008315552A Pending JP2010140239A (en) 2008-12-11 2008-12-11 Apparatus and method for shortening interrupt latency

Country Status (1)

Country Link
JP (1) JP2010140239A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012003325A (en) * 2010-06-14 2012-01-05 Fujitsu Ltd Computer system and interruption request processing method
WO2013042202A1 (en) * 2011-09-20 2013-03-28 富士通株式会社 Interrupt monitoring device and computer system
JP2017123190A (en) * 2017-03-08 2017-07-13 ルネサスエレクトロニクス株式会社 Task processing device
US10481946B2 (en) 2014-05-12 2019-11-19 Hitachi, Ltd. Information-processing device, processing method thereof, and input/output device

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2012003325A (en) * 2010-06-14 2012-01-05 Fujitsu Ltd Computer system and interruption request processing method
WO2013042202A1 (en) * 2011-09-20 2013-03-28 富士通株式会社 Interrupt monitoring device and computer system
US9355049B2 (en) 2011-09-20 2016-05-31 Fujitsu Limited Interrupt monitoring system and computer system
US10481946B2 (en) 2014-05-12 2019-11-19 Hitachi, Ltd. Information-processing device, processing method thereof, and input/output device
JP2017123190A (en) * 2017-03-08 2017-07-13 ルネサスエレクトロニクス株式会社 Task processing device

Similar Documents

Publication Publication Date Title
JP7313381B2 (en) Embedded scheduling of hardware resources for hardware acceleration
US10706496B2 (en) Function callback mechanism between a Central Processing Unit (CPU) and an auxiliary processor
JP5498505B2 (en) Resolving contention between data bursts
CN110678847A (en) Continuous analysis task for GPU task scheduling
JP5673672B2 (en) Multi-core processor system, control program, and control method
JP4770602B2 (en) Electronics
EP2473914A1 (en) Hardware-based scheduling of gpu work
US20140359636A1 (en) Multi-core system performing packet processing with context switching
US9311142B2 (en) Controlling memory access conflict of threads on multi-core processor with set of highest priority processor cores based on a threshold value of issued-instruction efficiency
JPH0454255B2 (en)
JP2010140239A (en) Apparatus and method for shortening interrupt latency
JP2014191655A (en) Multiprocessor, electronic control device, and program
JP6250447B2 (en) Semiconductor device and instruction read control method
US8601488B2 (en) Controlling the task switch timing of a multitask system
CN109766168B (en) Task scheduling method and device, storage medium and computing equipment
US7516311B2 (en) Deterministic microcontroller context arrangement
Wada et al. Fast interrupt handling scheme by using interrupt wake-up mechanism
JP5376042B2 (en) Multi-core processor system, thread switching control method, and thread switching control program
JP2004192052A (en) Software processing method and software processing system
JP3008895B2 (en) Multiprocessor load equalizer
JP5332716B2 (en) Startup control method, information processing apparatus, and program
JP5582241B2 (en) Multi-core processor system, multi-core processor system control method, and multi-core processor system control program
US20220156074A1 (en) Electronic device and multiplexing method of spatial
US9690727B2 (en) System internal latency measurements in realtime applications
JP3900660B2 (en) Sequence controller