JP2014081783A - Microcontroller, handler address specification method and program - Google Patents

Microcontroller, handler address specification method and program Download PDF

Info

Publication number
JP2014081783A
JP2014081783A JP2012229148A JP2012229148A JP2014081783A JP 2014081783 A JP2014081783 A JP 2014081783A JP 2012229148 A JP2012229148 A JP 2012229148A JP 2012229148 A JP2012229148 A JP 2012229148A JP 2014081783 A JP2014081783 A JP 2014081783A
Authority
JP
Japan
Prior art keywords
handler
interrupt
address
storage means
cpu
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
JP2012229148A
Other languages
Japanese (ja)
Inventor
Kesami Hagiwara
今朝巳 萩原
Hitoshi Suzuki
均 鈴木
Tsukasa Yamamoto
宰 山本
Junichi Sato
純一 佐藤
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.)
Renesas Electronics Corp
Original Assignee
Renesas Electronics 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 Renesas Electronics Corp filed Critical Renesas Electronics Corp
Priority to JP2012229148A priority Critical patent/JP2014081783A/en
Publication of JP2014081783A publication Critical patent/JP2014081783A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Microcomputers (AREA)

Abstract

PROBLEM TO BE SOLVED: To provide a microcontroller, a handler address specification method and a program capable of arranging a handler with a high degree of freedom and at low cost, and specifying a handler address at a high speed.SOLUTION: A microcontroller 100 includes: an interruption controller 200 for, in accordance with the input of an interruption request due to a plurality of interruption factors, outputting control information preliminarily associated with the interruption factors to a CPU 300; handler storage means 401 for storing an interruption handler preliminarily associated with the control information; base address storage means 402 for storing a base address, an access time to which is shorter than that of the handler storage means 401; and a CPU 300 connected to the base address storage means 402. The CPU 300 specifies the handler address as the storage position of the handler in the handler storage means 401 on the basis of the base address and the control information.

Description

本発明は、マイクロコントローラ、ハンドラアドレス特定方法及びプログラムに関し、特にハンドラアドレスを特定する技術に関する。   The present invention relates to a microcontroller, a handler address specifying method, and a program, and more particularly to a technique for specifying a handler address.

マイクロコントローラは、演算結果がエラーを起こした場合や周辺機器から処理要求が送られてきた場合等に、実行中のプログラムを中断してあらかじめ登録されたプログラムを呼び出す機能を持っている。これを割込という。このとき、割込要求の種類に応じて呼び出される、割込を処理及び制御するためにメモリ上に待機しているプログラムを割込ハンドラ(以下、割込ハンドラ又はハンドラ)という。従来より、マイクロコントローラに対する割込要求に応じ、実行すべきハンドラの格納アドレス(以下、ハンドラアドレス)を特定するための方式が提案されている。   The microcontroller has a function of interrupting a program being executed and calling a pre-registered program when an error occurs in a calculation result or when a processing request is sent from a peripheral device. This is called interruption. At this time, a program that is called in accordance with the type of interrupt request and is waiting on the memory for processing and controlling the interrupt is referred to as an interrupt handler (hereinafter referred to as an interrupt handler or handler). Conventionally, a method for specifying a storage address of a handler to be executed (hereinafter referred to as a handler address) in response to an interrupt request to a microcontroller has been proposed.

特許文献1は、ハンドラアドレスの特定方式として、固定ベクタ割込方式及び可変ベクタ割込方式を開示している。固定ベクタ割込方式では、複数の割込レベルに対応付けられた複数のハンドラアドレスが、レジスタIHAに格納されている。そして、発生した割込要求の割込レベルに応じ、レジスタIHAからその割込レベルに対応するハンドラアドレスを選択する。固定ベクタ割込方式は、処理時間が短く、レジスタIHAの内容を自由に設定できるため自由度が高いという特長がある。一方、可変ベクタ割込方式とは、割込が発生するとベクタ番号フェッチを行い、そのベクタ番号に基づいてベクタテーブルエントリ計算を行い、ハンドラアドレスを特定する方式である。可変ベクタ割込方式も、自由度が高いという特長がある。   Patent Document 1 discloses a fixed vector interrupt method and a variable vector interrupt method as methods for specifying a handler address. In the fixed vector interrupt method, a plurality of handler addresses associated with a plurality of interrupt levels are stored in the register IHA. Then, according to the interrupt level of the generated interrupt request, the handler address corresponding to the interrupt level is selected from the register IHA. The fixed vector interrupt method is characterized in that the processing time is short and the contents of the register IHA can be set freely, so that the degree of freedom is high. On the other hand, the variable vector interrupt method is a method in which a vector number is fetched when an interrupt occurs, a vector table entry is calculated based on the vector number, and a handler address is specified. The variable vector interrupt method also has the advantage of a high degree of freedom.

特許文献1はさらに、固定ベクタ割込方式及び可変ベクタ割込方式のそれぞれの特長を補完するため、これらの方式を選択可能とした構成を開示している。具体的には、複数の割込レベル毎に、それぞれ採用すべきハンドラアドレスの特定方式を予め対応付けてレジスタIVCに格納しておき、発生した割込要求の割込レベルに応じ、レジスタIVCからその割込レベルに対応するハンドラアドレスの特定方式を選択するものである。   Patent Document 1 further discloses a configuration in which these methods can be selected in order to complement the features of the fixed vector interrupt method and the variable vector interrupt method. Specifically, for each of a plurality of interrupt levels, a method for specifying a handler address to be adopted is associated with each other in advance and stored in the register IVC, and from the register IVC according to the interrupt level of the generated interrupt request. A method for specifying a handler address corresponding to the interrupt level is selected.

特開平06−324884号公報Japanese Patent Laid-Open No. 06-324884

特許文献1記載の装置では、固定ベクタ割込方式のために、レジスタIHAが、複数の割込レベルに対応する複数のハンドラアドレスをすべて格納している。かかる構成においては、割込レベルの種類が増大するほど、レジスタIHAのサイズも増大する。また、一般にレジスタIHAに使用されるようなレジスタは、汎用のフラッシュメモリ等に比べアクセス時間が短い、換言すれば高速である半面、単位ビットあたりの面積(コスト)が高価である。そのため、レジスタの増大は、回路サイズや製造コストの増大を招くという問題がある。よって、高速かつ高い自由度という特長を維持しつつ、小サイズ、低コストを実現できるハンドラアドレスの特定手法が望まれる。   In the device described in Patent Document 1, because of the fixed vector interrupt method, the register IHA stores all of a plurality of handler addresses corresponding to a plurality of interrupt levels. In such a configuration, the size of the register IHA increases as the types of interrupt levels increase. In general, a register used for the register IHA has a shorter access time than a general-purpose flash memory or the like, in other words, a high speed, but an area (cost) per unit bit is expensive. Therefore, there is a problem that an increase in registers causes an increase in circuit size and manufacturing cost. Therefore, a handler address specifying method capable of realizing a small size and low cost while maintaining the features of high speed and high flexibility is desired.

その他の課題と新規な特徴は、本明細書の記述及び添付図面から明らかになるであろう。   Other problems and novel features will become apparent from the description of the specification and the accompanying drawings.

一実施の形態によれば、マイクロコントローラは、複数の割込要因による割込要求に応じて割込ハンドラを実行するマイクロコントローラであって、
前記割込ハンドラの格納位置を示すアドレスであるハンドラアドレスを特定するために用いられるベースアドレスを記憶する第1の記憶手段と、前記割込ハンドラを記憶する第2の記憶手段と、
前記割込要求の入力に応じて、割込要求と、前記割込要因に予め対応付けられた制御情報を出力する割込コントローラと、
前記割込コントローラから出力された割込要求に応じて、前記割込ハンドラを取得して実行するCPUを備え、
前記CPUから前記第1の記憶手段に対するアクセス時間は、前記CPUから前記第2の記憶手段に対するアクセス時間よりも短く、かつ、
前記CPUは、
(a)前記割込コントローラから出力された割込要求に応じて、前記第1の記憶手段にアクセスして前記ベースアドレスを取得し、
(b)当該取得されたベースアドレスと、前記割込コントローラから出力された前記制御情報に基づいて、前記ハンドラアドレスを特定し、
(c)特定されたハンドラアドレスに基づいて前記第2の記憶手段にアクセスして前記割込ハンドラを実行する。
According to one embodiment, the microcontroller is a microcontroller that executes an interrupt handler in response to an interrupt request from a plurality of interrupt factors,
First storage means for storing a base address used for specifying a handler address which is an address indicating a storage position of the interrupt handler; and second storage means for storing the interrupt handler;
In response to the input of the interrupt request, an interrupt controller that outputs control information associated with the interrupt factor in advance,
In response to an interrupt request output from the interrupt controller, a CPU for acquiring and executing the interrupt handler is provided.
The access time from the CPU to the first storage means is shorter than the access time from the CPU to the second storage means, and
The CPU
(A) In response to the interrupt request output from the interrupt controller, the first storage means is accessed to obtain the base address;
(B) identifying the handler address based on the acquired base address and the control information output from the interrupt controller;
(C) Based on the specified handler address, the second storage means is accessed to execute the interrupt handler.

他の実施の形態によれば、マイクロコントローラは、複数の割込要因による割込要求に応じて割込ハンドラを実行するマイクロコントローラであって、
前記割込要求の入力に応じて、割込要求と、前記割込要因に予め対応付けられた第1又は第2の制御情報と、前記割込要因に予め対応づけられたハンドラアドレス特定方式情報とを出力する割込コントローラと、
前記割込コントローラから出力された割込要求に応じて、前記第1の割込ハンドラ又は前記第2の割込ハンドラを取得して実行するCPUと、
前記第1の割込ハンドラの格納位置を示すアドレスである第1のハンドラアドレスを特定するために用いられる第1のベースアドレスと、前記第2の割込ハンドラの格納位置を示すアドレスである第2のハンドラアドレスを特定するために用いられる第2のベースアドレスを記憶する第1の記憶手段と、
複数の前記第1の割込ハンドラのそれぞれを前記第1の制御情報によって特定される順に予め用意された固定サイズの個別領域のそれぞれに格納する第1の割込ハンドラ格納領域と、前記第2の制御情報と前記第2のハンドラアドレスとを予め対応付けたハンドラアドレステーブルを格納するテーブル記憶領域と、前記第1の割込ハンドラを格納する第1の割込ハンドラ格納領域とを有する第2の記憶手段とを備え、
前記CPUから前記第1の記憶手段に対するアクセス時間は、前記CPUから前記第2の記憶手段に対するアクセス時間よりも短く、かつ、
前記CPUは、
(A)前記ハンドラアドレス特定方式情報が直接分岐方式を示す場合には、
(a)前記割込コントローラから出力された割込要求に応じて、前記第1の記憶手段にアクセスして前記第1のベースアドレスを取得し、
(b−2)前記第1のベースアドレスに基づいて、前記第1の制御情報によって特定される順と、前記第1のハンドラ格納領域において前記割込ハンドラのそれぞれを格納する個別領域の固定サイズから前記第1のハンドラアドレスを特定し、
(c)特定された第1のハンドラアドレスに基づいて前記第2の記憶手段にアクセスして前記第1の割込ハンドラを実行する、
(B)前記ハンドラアドレス特定方式情報がテーブル参照方式を示す場合には、
(a)前記割込コントローラから出力された割込要求に応じて、前記第1の記憶手段にアクセスして前記第2のベースアドレスを取得し、
(b−1)前記第2のベースアドレスに基づいて前記ハンドラアドレステーブルを参照し、当該ハンドラアドレステーブルにおいて前記割込コントローラから出力された前記第2の制御情報と対応づけられた前記第2のハンドラアドレスを特定し、
(c)特定された第2のハンドラアドレスに基づいて前記第2の記憶手段にアクセスして前記第2の割込ハンドラを実行する。
According to another embodiment, the microcontroller is a microcontroller that executes an interrupt handler in response to an interrupt request from a plurality of interrupt factors,
In response to the input of the interrupt request, the interrupt request, the first or second control information associated in advance with the interrupt factor, and the handler address specifying method information associated in advance with the interrupt factor An interrupt controller that outputs
CPU that acquires and executes the first interrupt handler or the second interrupt handler in response to an interrupt request output from the interrupt controller;
A first base address used to specify a first handler address which is an address indicating a storage location of the first interrupt handler, and an address indicating a storage location of the second interrupt handler. First storage means for storing a second base address used to identify the two handler addresses;
A first interrupt handler storage area for storing each of the plurality of first interrupt handlers in a fixed-size individual area prepared in advance in the order specified by the first control information; A table storage area that stores a handler address table that associates the control information with the second handler address in advance, and a first interrupt handler storage area that stores the first interrupt handler. Storage means,
The access time from the CPU to the first storage means is shorter than the access time from the CPU to the second storage means, and
The CPU
(A) When the handler address specifying method information indicates a direct branch method,
(A) In response to the interrupt request output from the interrupt controller, the first storage means is accessed to obtain the first base address,
(B-2) Based on the first base address, the order specified by the first control information, and the fixed size of the individual area for storing each of the interrupt handlers in the first handler storage area Identifying the first handler address from
(C) accessing the second storage means based on the identified first handler address to execute the first interrupt handler;
(B) When the handler address specifying method information indicates a table reference method,
(A) In response to the interrupt request output from the interrupt controller, the first storage means is accessed to obtain the second base address;
(B-1) Refers to the handler address table based on the second base address, and the second address associated with the second control information output from the interrupt controller in the handler address table. Identify the handler address,
(C) Based on the specified second handler address, the second storage means is accessed to execute the second interrupt handler.

他の実施の形態によれば、ハンドラアドレス特定方法は、CPUが、
割込コントローラから割込要因に対応する制御情報を入力するステップと、
第1の記憶手段からベースアドレスを取得するステップと、
前記ベースアドレス及び前記制御情報に基づいて、第2の記憶手段におけるハンドラの格納位置であるハンドラアドレスを特定するステップと、を有し、
前記CPUから前記第1の記憶手段に対するアクセス時間は、前記CPUから前記第2の記憶手段に対するアクセス時間よりも短い。
According to another embodiment, the handler address specifying method is performed by the CPU:
A step of inputting control information corresponding to the interrupt factor from the interrupt controller;
Obtaining a base address from the first storage means;
Identifying a handler address which is a storage location of the handler in the second storage means based on the base address and the control information,
The access time from the CPU to the first storage means is shorter than the access time from the CPU to the second storage means.

他の実施の形態によれば、ハンドラアドレス特定方法は、CPUが、
割込コントローラから、割込要因に対応する第1又は第2の制御情報と、前記割込要因に対応するハンドラアドレス特定方式情報とを入力するステップと、
(A)前記ハンドラアドレス特定方式情報が直接分岐方式を示す場合、
第1の記憶手段から第1のベースアドレスを取得するステップと、
前記第1のベースアドレス及び前記第1の制御情報に基づいて、第2の記憶手段における第1のハンドラ格納領域から第1のハンドラの格納位置である第1のハンドラアドレスを特定するステップと、
(B)前記ハンドラアドレス特定方式情報がテーブル参照方式を示す場合、
第1の記憶手段から第2のベースアドレスを取得するステップと、
前記第2のベースアドレス及び前記第2の制御情報に基づいて、ハンドラアドレステーブルから第2のハンドラアドレスを特定するステップと、を有し、
前記第1のハンドラ格納領域は、前記第1のハンドラをそれぞれ格納するための固定サイズの個別領域に前記第1の制御情報に基づく順序で格納し、
前記第1のベースアドレスは、前記第2の記憶手段における前記第1のハンドラ格納領域の格納位置を示すアドレスであり、
前記ハンドラアドレステーブルは、前記第2の制御情報と前記第2のハンドラアドレスとを予め対応付けたテーブルであり、
前記第2のベースアドレスは、前記第2の記憶手段におけるハンドラアドレステーブルの格納位置を示すアドレスであり、
前記CPUから前記第1の記憶手段に対するアクセス時間は、前記CPUから前記第2の記憶手段に対するアクセス時間よりも短い。
According to another embodiment, the handler address specifying method is performed by the CPU:
Inputting from the interrupt controller the first or second control information corresponding to the interrupt factor and the handler address specifying method information corresponding to the interrupt factor;
(A) When the handler address specifying method information indicates a direct branch method,
Obtaining a first base address from a first storage means;
Identifying a first handler address that is a storage location of the first handler from a first handler storage area in a second storage means based on the first base address and the first control information;
(B) When the handler address specifying method information indicates a table reference method,
Obtaining a second base address from the first storage means;
Identifying a second handler address from a handler address table based on the second base address and the second control information,
The first handler storage area is stored in an order based on the first control information in a fixed-size individual area for storing the first handler,
The first base address is an address indicating a storage position of the first handler storage area in the second storage means,
The handler address table is a table in which the second control information and the second handler address are associated with each other in advance.
The second base address is an address indicating a storage position of a handler address table in the second storage means,
The access time from the CPU to the first storage means is shorter than the access time from the CPU to the second storage means.

他の実施の形態によれば、プログラムは、コンピュータに、上述のいずれか1つの方法を実行させるものである。   According to another embodiment, the program causes a computer to execute any one of the methods described above.

本発明により、高い自由度かつ低コストでハンドラを配置できるとともに、高速にハンドラアドレスを特定できるマイクロコントローラ、ハンドラアドレス特定方法及びプログラムを提供することができる。   According to the present invention, it is possible to provide a microcontroller, a handler address specifying method, and a program capable of specifying a handler address at high speed while arranging handlers with high flexibility and low cost.

実施の形態1にかかるマイクロコントローラ100の構成を示す図である。1 is a diagram showing a configuration of a microcontroller 100 according to a first exemplary embodiment. 実施の形態1にかかるマイクロコントローラ100の構成を示す図である。1 is a diagram showing a configuration of a microcontroller 100 according to a first exemplary embodiment. 実施の形態1にかかる割込コントローラ200の構成を示す図である。It is a figure which shows the structure of the interruption controller 200 concerning Embodiment 1. FIG. 実施の形態1にかかる割込制御レジスタ206の構成を示す図である。FIG. 3 is a diagram showing a configuration of an interrupt control register 206 according to the first embodiment. 実施の形態1にかかるベースレジスタ4020及び4030の構成を示す図である。FIG. 3 is a diagram showing a configuration of base registers 4020 and 4030 according to the first embodiment. 実施の形態1にかかるマイクロコントローラ200の処理を示すフローチャートである。3 is a flowchart showing processing of the microcontroller 200 according to the first embodiment. 実施の形態1にかかるメモリ4010におけるハンドラの配置を示す図である。FIG. 10 is a diagram showing an arrangement of handlers in the memory 4010 according to the first embodiment. 実施の形態1にかかるマイクロコントローラ200の処理を示すタイミングチャートである。3 is a timing chart showing processing of the microcontroller 200 according to the first exemplary embodiment. 実施の形態2にかかる割込制御レジスタ206の構成を示す図である。It is a figure which shows the structure of the interrupt control register 206 concerning Embodiment 2. FIG. 実施の形態2にかかるマイクロコントローラ200の処理を示すフローチャートである。10 is a flowchart showing processing of the microcontroller 200 according to the second embodiment. 実施の形態2にかかるメモリ4010におけるハンドラの配置を示す図である。FIG. 10 is a diagram showing an arrangement of handlers in a memory 4010 according to the second embodiment. 実施の形態3にかかる割込制御レジスタ206の構成を示す図である。FIG. 10 is a diagram illustrating a configuration of an interrupt control register 206 according to the third embodiment. 実施の形態3にかかるマイクロコントローラ200の処理を示すフローチャートである。10 is a flowchart showing processing of the microcontroller 200 according to the third embodiment. 実施の形態3にかかるメモリ4010におけるハンドラの配置を示す図である。FIG. 10 is a diagram showing an arrangement of handlers in a memory 4010 according to the third embodiment.

以下、本発明を適用した具体的な実施の形態について、図面を参照しながら詳細に説明する。   Hereinafter, specific embodiments to which the present invention is applied will be described in detail with reference to the drawings.

<実施の形態1>
本実施の形態では、上述の固定ベクタ割当方式に比べ低コストであるテーブル参照方式と、テーブル参照方式に比べより高速な割込応答が可能である直接分岐方式と、の2つのハンドラアドレス特定方式を開示する。
<Embodiment 1>
In the present embodiment, there are two handler address specifying methods: a table reference method that is lower in cost than the above-described fixed vector allocation method, and a direct branch method that enables a faster interrupt response than the table reference method. Is disclosed.

はじめに、テーブル参照方式の概要について説明する。テーブル参照方式では、ハンドラアドレステーブルベースレジスタ(HTBASE)がハンドラアドレステーブルの先頭アドレスを格納し、ハンドラアドレステーブルが、複数の割込要因に対応する複数のハンドラアドレスを格納する。そして、割込要求の発生に応じ、CPUが、レジスタHTBASEからハンドラアドレステーブルの先頭アドレスを取得し、ハンドラアドレステーブルから、その割込要求の割込要因に対応するハンドラアドレスを選択する。   First, an outline of the table reference method will be described. In the table reference method, the handler address table base register (HTBASE) stores the top address of the handler address table, and the handler address table stores a plurality of handler addresses corresponding to a plurality of interrupt factors. Then, in response to the generation of the interrupt request, the CPU acquires the head address of the handler address table from the register HTBASE, and selects the handler address corresponding to the interrupt factor of the interrupt request from the handler address table.

テーブル参照方式では、ハンドラアドレステーブルを、レジスタに比べ低速であるが単位ビット当たりの面積(コスト)が安価である汎用のフラッシュメモリ等に格納することが可能である。したがって、テーブル参照方式は、特許文献1記載の固定ベクタ割込方式においてレジスタIHAに要していたコストを削減することができる。   In the table reference method, the handler address table can be stored in a general-purpose flash memory or the like that is slower than a register but has a lower area (cost) per unit bit. Therefore, the table reference method can reduce the cost required for the register IHA in the fixed vector interrupt method described in Patent Document 1.

本実施の形態は、このような構成により、高速かつ高い自由度という特長を維持しつつ、小サイズ、低コストでのハンドラアドレスの特定を実現する。   With this configuration, the present embodiment realizes specification of a handler address with a small size and low cost while maintaining the features of high speed and high flexibility.

一方、より高速な割込応答性への要求も存在する。よって、本実施の形態では、この更なる要求に応えるため、直接分岐方式によるハンドラアドレスの特定もサポートした。直接分岐方式によれば、テーブル参照方式よりも高速な割込応答を実現できる。   On the other hand, there is a demand for faster interrupt responsiveness. Therefore, in this embodiment, in order to respond to this further request, the identification of the handler address by the direct branch method is also supported. According to the direct branch method, it is possible to realize an interrupt response faster than the table reference method.

直接分岐方式の概要について説明する。直接分岐方式では、ハンドラアドレスベースレジスタ(HABASE)がベースアドレスを格納する。また、メモリ(汎用のフラッシュメモリ等)が、複数の割込レベル(例えば優先度)に対応する複数のハンドラを、ベースアドレスを先頭に優先度順に格納する。ここで、各ハンドラの格納領域のサイズは一律に固定される。そのため、ベースアドレスと優先度とに基づき、その優先度に対応するハンドラの格納領域のアドレス(ハンドラアドレス)が一意に特定される。割込要求が発生すると、CPUは、レジスタHABASEからベースアドレスを取得し、ベースアドレスとその割込要求の優先度とから、ハンドラアドレスを特定する。   An outline of the direct branching method will be described. In the direct branch method, the handler address base register (HABASE) stores the base address. In addition, a memory (such as a general-purpose flash memory) stores a plurality of handlers corresponding to a plurality of interrupt levels (for example, priority) in order of priority starting from the base address. Here, the size of the storage area of each handler is fixed uniformly. Therefore, based on the base address and the priority, the address (handler address) of the storage area of the handler corresponding to the priority is uniquely specified. When an interrupt request is generated, the CPU acquires a base address from the register HABASE, and specifies a handler address from the base address and the priority of the interrupt request.

直接分岐方式は、ハンドラアドレステーブルを参照するステップを要しないため、テーブル参照方式に比べ高速である。但し、直接分岐方式では、ハンドラの格納領域のサイズが固定されるという制約が生ずる。   The direct branch method is faster than the table reference method because it does not require a step of referring to the handler address table. However, the direct branching method has a restriction that the size of the storage area of the handler is fixed.

図1を用いて、上述の特徴を備えたマイクロコントローラ100の構成について説明する。   The configuration of the microcontroller 100 having the above-described features will be described with reference to FIG.

本実施の形態にかかるマイクロコントローラ100は、少なくとも割込コントローラ200、CPU300、ハンドラ記憶手段401、ベースアドレス記憶手段402を含む。   The microcontroller 100 according to the present embodiment includes at least an interrupt controller 200, a CPU 300, a handler storage unit 401, and a base address storage unit 402.

ハンドラ記憶手段401は、第2の記憶手段として割込ハンドラを格納する記憶手段である。ハンドラ記憶手段401における割込ハンドラの格納アドレスをハンドラアドレスという。ハンドラ記憶手段401としては、例えば汎用のフラッシュメモリを用いることができる。   The handler storage unit 401 is a storage unit that stores an interrupt handler as a second storage unit. The storage address of the interrupt handler in the handler storage unit 401 is called a handler address. For example, a general-purpose flash memory can be used as the handler storage unit 401.

ベースアドレス記憶手段402は、第1の記憶手段として、ベースアドレスを格納する記憶手段である。ベースアドレス記憶手段402としては、例えばレジスタを用いることができる。CPU300から第1の記憶手段であるベースアドレス記憶手段402に対するアクセス時間は、CPU300から第2の記憶手段であるハンドラ記憶手段401に対するアクセス時間よりも短い。ここで、ベースアドレスとは、ハンドラアドレスを特定するための演算の基準、即ちハンドラアドレスを特定するために用いられるアドレスである。   The base address storage unit 402 is a storage unit that stores a base address as the first storage unit. As the base address storage unit 402, for example, a register can be used. The access time from the CPU 300 to the base address storage means 402 as the first storage means is shorter than the access time from the CPU 300 to the handler storage means 401 as the second storage means. Here, the base address is a calculation reference for specifying the handler address, that is, an address used for specifying the handler address.

割込コントローラ200は、複数の割込要因による割込要求の入力に応じ、割込要因毎に予め対応付けられた制御情報をCPU300に対して出力する。   The interrupt controller 200 outputs control information associated in advance for each interrupt factor to the CPU 300 in response to an input of an interrupt request by a plurality of interrupt factors.

CPU300は、割込コントローラ200が出力する制御情報と、ベースアドレス記憶手段402に格納されているベースアドレスと、をパラメタとする所定の演算によってハンドラアドレスを特定する。   The CPU 300 specifies the handler address by a predetermined calculation using the control information output from the interrupt controller 200 and the base address stored in the base address storage unit 402 as parameters.

例えば、テーブル参照方式によりハンドラアドレスを特定する場合は、以下の演算を行うことによりハンドラアドレスを特定できる。   For example, when the handler address is specified by the table reference method, the handler address can be specified by performing the following calculation.

前提として、マイクロコントローラ100は、制御情報とハンドラアドレスとを予め対応付けたハンドラアドレステーブルを格納している、テーブル記憶手段をさらに有しているものとする。また、ベースアドレスは、テーブル記憶手段におけるハンドラアドレステーブルの格納アドレスを示しているものとする。このとき、CPU300は、テーブル記憶手段のベースアドレスに格納されているハンドラアドレステーブルから、制御情報をキーとして目的のハンドラアドレスを取得する。その後、CPU300は、ハンドラ記憶手段401のハンドラアドレスからハンドラを取得し、割込処理を実行することができる。   As a premise, the microcontroller 100 further includes a table storage unit that stores a handler address table in which control information and a handler address are associated with each other in advance. The base address indicates the storage address of the handler address table in the table storage means. At this time, the CPU 300 obtains a target handler address from the handler address table stored in the base address of the table storage means using the control information as a key. Thereafter, the CPU 300 can acquire a handler from the handler address in the handler storage unit 401 and execute an interrupt process.

また、直接分岐方式によりハンドラアドレスを特定する場合は、以下の演算を行うことによりハンドラアドレスを特定できる。   When the handler address is specified by the direct branch method, the handler address can be specified by performing the following calculation.

前提として、ハンドラ記憶手段401は、ハンドラをそれぞれ格納するための固定長の領域を、制御情報に基づく順序で格納したハンドラ格納領域を有しているものとする。また、ベースアドレスは、ハンドラ記憶手段401におけるハンドラ格納領域の先頭アドレスを示しているものとする。このとき、CPU300は、ハンドラ記憶手段401のベースアドレスと、上述の固定長と、制御情報に基づく順序のルールとに基づき、ハンドラアドレスを特定する。その後、CPU300は、ハンドラ記憶手段401のハンドラアドレスからハンドラを取得し、割込処理を実行することができる。   As a premise, it is assumed that the handler storage unit 401 has a handler storage area in which fixed-length areas for storing handlers are stored in the order based on the control information. The base address indicates the start address of the handler storage area in the handler storage unit 401. At this time, the CPU 300 specifies the handler address based on the base address of the handler storage unit 401, the above-described fixed length, and the order rule based on the control information. Thereafter, the CPU 300 can acquire a handler from the handler address in the handler storage unit 401 and execute an interrupt process.

また、本実施の形態では、これらの2つのハンドラアドレス特定方式それぞれの特長を補完するため、条件に応じてこれらの方式を選択するための構成も開示する。これにより、小サイズ、低コストを前提としつつ、高速性と自由度とのバランスを兼ね備えたハンドラアドレス特定手法を実現できる。   In the present embodiment, in order to complement the features of each of these two handler address specifying methods, a configuration for selecting these methods according to conditions is also disclosed. As a result, it is possible to realize a handler address specifying method that has a balance between high speed and flexibility while assuming a small size and low cost.

図2を用いて、2つのハンドラアドレス特定方式を選択可能なマイクロコントローラ100の構成について説明する。   A configuration of the microcontroller 100 capable of selecting two handler address specifying methods will be described with reference to FIG.

割込コントローラ200は、マイクロコントローラ100の内部の周辺機能101からの割込要求、及びマイクロコントローラ100の外部からの割込要求の入力を受け付け、CPU300に割込処理に必要な情報を出力する。割込コントローラ200は、例えば、割込要因に応じたハンドラアドレスの特定方式を選択し、その選択の結果をハンドラアドレス特定方式情報としてCPU300に出力することが可能である。外部からの割込要求の中には、例えば、自動車の衝突センサ502からの割込要求のように、CPU300が高速に応答してエアバッグを膨らませる処理を行う必要があるものもあれば、温度センサ501からの割込要求のように、それほど高速な応答が必要でないものもある。衝突センサ502のように、高速な応答性が求められる割込要因による割込要求の場合は、ハンドラアドレスの特定方式として、直接分岐方式が適している。また、温度センサ501のように、それほど高速な応答が必要でない割込要因による割込要求の場合は、ハンドラアドレスの特定方式として、メモリの利用効率を高められるテーブル参照方式が適している。   The interrupt controller 200 receives input of an interrupt request from the peripheral function 101 inside the microcontroller 100 and an interrupt request from the outside of the microcontroller 100, and outputs information necessary for interrupt processing to the CPU 300. For example, the interrupt controller 200 can select a handler address specifying method according to the interrupt factor, and output the selection result to the CPU 300 as handler address specifying method information. Some interrupt requests from the outside require the CPU 300 to inflate the airbag in response to a high speed, such as an interrupt request from the automobile collision sensor 502, Some interrupt requests from the temperature sensor 501 do not require a very fast response. In the case of an interrupt request due to an interrupt factor that requires high-speed response, such as the collision sensor 502, the direct branching method is suitable as a method for specifying a handler address. Further, in the case of an interrupt request due to an interrupt factor that does not require such a high-speed response, such as the temperature sensor 501, a table reference method that can increase the memory utilization efficiency is suitable as a method for specifying a handler address.

ハンドラ記憶手段401としてのメモリ4010は、プログラム格納領域としてのフラッシュメモリである。CPU300の動作速度がメモリ4010の動作速度よりも大きい場合には、その速度差によるCPU300の処理性能低下を防ぐため、メモリ4010とCPU300との間にキャッシュ104を設けることが多い。   A memory 4010 as the handler storage unit 401 is a flash memory as a program storage area. When the operating speed of the CPU 300 is higher than the operating speed of the memory 4010, the cache 104 is often provided between the memory 4010 and the CPU 300 in order to prevent a reduction in processing performance of the CPU 300 due to the speed difference.

図2のようにメモリ4010がマイクロコントローラ100の内部に搭載される場合、割込ハンドラ(直接分岐方式によって特定される割込ハンドラ(第1の割込ハンドラ)及びテーブル参照方式によって特定される割込ハンドラ(第2の割込ハンドラ)を含む)及びテーブル参照方式において用いられるハンドラアドレステーブルをメモリ4010に格納することが好適である。本実施の形態では、第1の割込ハンドラ、第2の割込ハンドラ及びハンドラアドレステーブルがメモリ4010に格納されている形態を例として説明する。なお、第1の割込ハンドラ、第2の割込ハンドラ、及びハンドラアドレステーブルは、必ずしも物理的に同一のメモリ4010に格納する必要はない。例えば、第1の割込ハンドラ、第2の割込ハンドラ、及びハンドラアドレステーブルを、1つのアドレス空間を構成する複数の物理的な記憶装置に分散して格納しても良い。あるいは、これらをそれぞれ異なるアドレス空間に格納することもできる。具体的には、第1の割込ハンドラ又は第2の割込ハンドラのいずれか一方をメモリ4010に格納し、他方をRAM105、外部メモリ503又は図示しない他の記憶手段に格納しても良い。   When the memory 4010 is mounted inside the microcontroller 100 as shown in FIG. 2, the interrupt handler (the interrupt handler (first interrupt handler) specified by the direct branch method) and the interrupt specified by the table reference method are used. It is preferable to store in the memory 4010 a handler address table used in the table reference method (including the interrupt handler (including the second interrupt handler)). In the present embodiment, an example in which the first interrupt handler, the second interrupt handler, and the handler address table are stored in the memory 4010 will be described. Note that the first interrupt handler, the second interrupt handler, and the handler address table are not necessarily stored in the physically same memory 4010. For example, the first interrupt handler, the second interrupt handler, and the handler address table may be distributed and stored in a plurality of physical storage devices constituting one address space. Alternatively, they can be stored in different address spaces. Specifically, either the first interrupt handler or the second interrupt handler may be stored in the memory 4010, and the other may be stored in the RAM 105, the external memory 503, or other storage means (not shown).

CPU300は、メモリ4010に格納されたプログラムに従って所定の処理を実行する。CPU300は、命令フェッチユニット302及びキャッシュ104を介して、メモリ4010に格納されている命令コードを読み出す。CPU300が必要とする命令コードが既にキャッシュ104に格納されている場合は、メモリ4010に対するアクセスは行われず、キャッシュ104から直ちに命令フェッチユニット302に命令コードが送られる。   CPU 300 executes a predetermined process according to a program stored in memory 4010. The CPU 300 reads out the instruction code stored in the memory 4010 via the instruction fetch unit 302 and the cache 104. When the instruction code required by the CPU 300 is already stored in the cache 104, the memory 4010 is not accessed, and the instruction code is immediately sent from the cache 104 to the instruction fetch unit 302.

なお、プログラムは、マイクロコントローラ100の内部にあるRAM105又はマイクロコントローラ100の外部にある外部メモリ503に格納することもできる。RAM105に命令コードが格納されている場合、CPU300は、命令フェッチユニット302、キャッシュ104、CPUバス103、ロードストアユニット303を介して命令コードを読み出す。また、外部メモリ503に命令コードが格納されている場合、CPU300は、命令フェッチユニット302、キャッシュ104、CPUバス103、外部メモリキャッシュ106、外部メモリコントローラ107を介して命令コードを読み出す。   The program may be stored in the RAM 105 inside the microcontroller 100 or the external memory 503 outside the microcontroller 100. When the instruction code is stored in the RAM 105, the CPU 300 reads out the instruction code via the instruction fetch unit 302, the cache 104, the CPU bus 103, and the load / store unit 303. When an instruction code is stored in the external memory 503, the CPU 300 reads out the instruction code via the instruction fetch unit 302, the cache 104, the CPU bus 103, the external memory cache 106, and the external memory controller 107.

CPU300が、割込コントローラ200から、直接分岐方式が選択された割込要因からの割込要求を受け付けた場合、まず実行ユニット301が、ベースアドレス記憶手段402としてのハンドラアドレスベースレジスタ(HABASE)4020にアクセスし、第1のベースアドレスを取得する。そして、実行ユニット301は、取得した第1のベースアドレスと、割込コントローラ200から受け付けた第1の制御情報、典型的には優先度を用いて、ハンドラアドレスを計算する。ハンドラアドレスの計算方法については後に詳述する。CPU300は、こうして得られたハンドラアドレスから、上述の手順により、ハンドラの命令コードの読み出しを行う。   When the CPU 300 receives an interrupt request from an interrupt factor for which the direct branch method is selected from the interrupt controller 200, the execution unit 301 first has a handler address base register (HABASE) 4020 as the base address storage means 402. To obtain a first base address. Then, the execution unit 301 calculates the handler address using the acquired first base address and the first control information received from the interrupt controller 200, typically the priority. The method for calculating the handler address will be described in detail later. The CPU 300 reads the instruction code of the handler from the handler address thus obtained according to the procedure described above.

CPU300が、割込コントローラ200から、テーブル参照方式が選択された割込要因からの割込要求を受け付けた場合、まず実行ユニット301が、ベースアドレス記憶手段402としてのハンドラアドレステーブルベースレジスタ(HTBASE)4030にアクセスし、第2のベースアドレスを取得する。そして、実行ユニット301は、取得した第2のベースアドレスと、割込コントローラ200から受け付けた第2の制御情報、典型的には割込要因の識別子、例えば要因番号を用いて、ハンドラアドレスの格納アドレスを計算する。ハンドラアドレスの格納アドレスについては後に詳述する。
次いで、CPU300は、ハンドラアドレスの格納アドレスを、ロードストアユニット303からCPUバス103に出力する。ハンドラアドレスの格納アドレスがメモリ4010内のアドレスであれば、CPU300は、メモリ4010の上記格納アドレスからからハンドラアドレスを読み出す。すなわち、CPU300は、ロードストアユニット303、CPUバス103、キャッシュ104を介して、メモリ4010からハンドラアドレスを読み出す。CPU300が必要とするハンドラアドレスが既にキャッシュ104に格納されている場合は、メモリ4010へのアクセスは行われず、キャッシュ104から直ちにCPUバス103を経由してロードストアユニット303にハンドラアドレスが送られる。こうして得られたハンドラアドレスからの命令コードの読み出しは、上述した手順により行われる。
When the CPU 300 receives an interrupt request from an interrupt factor for which the table reference method is selected from the interrupt controller 200, the execution unit 301 first has a handler address table base register (HTBASE) as the base address storage means 402. 4030 is accessed to obtain the second base address. The execution unit 301 stores the handler address using the acquired second base address and the second control information received from the interrupt controller 200, typically an interrupt factor identifier, for example, a factor number. Calculate the address. The storage address of the handler address will be described in detail later.
Next, the CPU 300 outputs the storage address of the handler address from the load / store unit 303 to the CPU bus 103. If the storage address of the handler address is an address in the memory 4010, the CPU 300 reads the handler address from the storage address in the memory 4010. That is, the CPU 300 reads the handler address from the memory 4010 via the load / store unit 303, the CPU bus 103, and the cache 104. When the handler address required by the CPU 300 is already stored in the cache 104, the memory 4010 is not accessed, and the handler address is sent from the cache 104 to the load / store unit 303 via the CPU bus 103 immediately. Reading the instruction code from the handler address thus obtained is performed according to the procedure described above.

ベースアドレス記憶手段402としてのハンドラアドレスベースレジスタ(HABASE)4020は、第1のベースアドレスとしての、直接分岐方式のハンドラの開始アドレス(ベースアドレス)を設定するレジスタである。第2のレジスタとしてのハンドラアドレステーブルベースレジスタ(HTBASE)4030は、第2のベースアドレスとしての、テーブル参照方式のハンドラアドレステーブルの開始アドレス(ベースアドレス)を設定するレジスタである。HABASE4020及びHTBASE4030は、CPU300の内部又は外部のいずれに設けても良いが、CPU300が可能な限り高速に、すなわち短いアクセス時間でアクセスできるよう、CPU300の近傍に設けることが望ましい。   A handler address base register (HABASE) 4020 as the base address storage unit 402 is a register for setting a start address (base address) of a direct branch type handler as a first base address. A handler address table base register (HTBASE) 4030 as a second register is a register for setting a start address (base address) of a table address type handler address table as a second base address. The HABASE 4020 and the HTBASE 4030 may be provided either inside or outside the CPU 300. However, it is desirable that the HABASE 4020 and the HTBASE 4030 be provided in the vicinity of the CPU 300 so that the CPU 300 can be accessed as fast as possible, that is, with a short access time.

なお、HABASE4020及びHTBASE4030に格納するベースアドレスを適切に設定することで、第1の割込ハンドラ、第2の割込ハンドラ及びハンドラアドレステーブルを、メモリ4010のみならず、マイクロコントローラ100の内部にあるRAM105、マイクロコントローラ100の外部にある外部メモリ503又は図示しない他の記憶手段に格納することも可能である。例えば、ハンドラアドレステーブルをロードストアユニット303に直結したRAM105に格納すれば、ハンドラアドレスの読み出しを高速に行えるようになり、テーブル参照方式が選択された割込要因の割込要求に対する応答性能を高めることが可能である。   By appropriately setting the base addresses stored in the HABASE 4020 and the HTBASE 4030, the first interrupt handler, the second interrupt handler, and the handler address table are stored not only in the memory 4010 but also in the microcontroller 100. It is also possible to store in the RAM 105, the external memory 503 outside the microcontroller 100, or other storage means (not shown). For example, if the handler address table is stored in the RAM 105 directly connected to the load / store unit 303, the handler address can be read at high speed, and the response performance to the interrupt request of the interrupt factor for which the table reference method is selected is improved. It is possible.

図3を用いて、割込コントローラ200の具体的な実装例を示す。   A specific implementation example of the interrupt controller 200 will be described with reference to FIG.

割込コントローラ200は、マイクロコントローラ100の内部にある周辺機能や、マイクロコントローラ100の外部からの割込要求0乃至nの入力を受け付ける。割込要求0乃至nは、それぞれ割込要因0乃至nに対応しており、それぞれ独立の信号線を介して要求検出部201に入力される。   The interrupt controller 200 accepts peripheral functions inside the microcontroller 100 and inputs of interrupt requests 0 to n from outside the microcontroller 100. Interrupt requests 0 to n correspond to interrupt factors 0 to n, respectively, and are input to the request detection unit 201 through independent signal lines.

要求検出部201は、上述の割込要求の入力を検出する。割込要求の検出結果は、割込要因0乃至n毎に要求フラグ202に格納される。また、要求フラグ202の内容は要求マスク部203に送られる。   The request detection unit 201 detects the input of the above-described interrupt request. The detection result of the interrupt request is stored in the request flag 202 for each interrupt factor 0 to n. Further, the content of the request flag 202 is sent to the request mask unit 203.

要求マスク部203は、割込要因0乃至n毎に設けられた割込制御レジスタ206から入力される要求マスク0乃至nに従って、割込要求をマスクするか否か、すなわちCPU300への割込を禁止するか又は許可するかを決定し、マスクしない場合、割込要求を優先度判定部204に送る。   The request mask unit 203 determines whether to mask the interrupt request according to the request masks 0 to n input from the interrupt control registers 206 provided for the interrupt factors 0 to n, that is, interrupts to the CPU 300. When it is determined whether to prohibit or permit, and when it is not masked, an interrupt request is sent to the priority determination unit 204.

優先度判定部204は、要求マスク部203から入力される割込要求と、割込制御レジスタ206から入力される、割込要因0乃至n毎に設定された優先度0乃至nとに基づいて、最高優先度の割込要因を選択する。優先度判定部204は、選択された最高優先度の割込要因の要因番号及び優先度を、割込要求生成部205へ送る。   The priority determination unit 204 is based on the interrupt request input from the request mask unit 203 and the priority 0 to n set for each interrupt factor 0 to n input from the interrupt control register 206. Select the highest priority interrupt factor. The priority determination unit 204 sends the factor number and priority of the selected highest priority interrupt factor to the interrupt request generation unit 205.

割込要求生成部205は、優先度判定部204から入力される最高優先度の割込要因の要因番号、優先度、及び割込制御レジスタ206から入力される割込要因毎に設定されたハンドラアドレス特定方式情報0乃至nに基づいて、CPU300に対し、割込要求とともに、CPU300がハンドラアドレスを特定するのに必要な情報である、第1の制御情報としての優先度、第2の制御情報としての要因番号、及びハンドラアドレス特定方式情報を出力する。ここで、ハンドラアドレス特定方式情報とは、ハンドラアドレスの特定方式、すなわち、直接分岐方式又はテーブル参照方式のいずれの方式によりハンドラアドレスを特定すべきかを示す情報である。なお、割込要求生成部205は、ハンドラアドレス特定方式情報が直接分岐方式である場合には第1の制御情報とハンドラアドレス特定方式情報のみを、テーブル参照方式である場合は第2の制御情報とハンドラアドレス特定方式情報のみをCPU300に出力することとしても良い。   The interrupt request generation unit 205 is a handler set for each of the interrupt factor input from the interrupt control register 206 and the factor number of the highest priority interrupt factor input from the priority determination unit 204. The priority as the first control information, the second control information, which is information necessary for the CPU 300 to specify the handler address together with the interrupt request to the CPU 300 based on the address specifying method information 0 to n. The cause number and the handler address specifying method information are output. Here, the handler address specifying method information is information indicating whether a handler address should be specified by a handler address specifying method, that is, a direct branch method or a table reference method. The interrupt request generation unit 205 uses only the first control information and the handler address specifying method information when the handler address specifying method information is the direct branch method, and the second control information when the handler address specifying method information is the table reference method. Only the handler address specifying method information may be output to the CPU 300.

CPU300は、割込コントローラ200から割込要求を受け付けると、割込応答と受け付けた割込要求の要因番号とを割込コントローラ200に通知する。   When receiving an interrupt request from the interrupt controller 200, the CPU 300 notifies the interrupt controller 200 of the interrupt response and the cause number of the received interrupt request.

割込コントローラ200の内部にある割込応答入力部207は、CPU300から通知される割込応答と要因番号との入力を受け付け、要因番号に対応する要求フラグクリア信号を要求フラグ202へ出力し、要因番号に対応する割込要因の要求フラグ202をクリアする。   An interrupt response input unit 207 in the interrupt controller 200 receives an interrupt response and a factor number notified from the CPU 300, and outputs a request flag clear signal corresponding to the factor number to the request flag 202. The interrupt factor request flag 202 corresponding to the factor number is cleared.

周辺バスインタフェース208は、周辺バスから割込制御レジスタ206へのアクセス要求を受け付け、割込制御レジスタ206に値を設定したり、割込制御レジスタ206から値を読み出したりするための制御を行う。   The peripheral bus interface 208 receives an access request to the interrupt control register 206 from the peripheral bus, and performs control for setting a value in the interrupt control register 206 and reading a value from the interrupt control register 206.

図4を用いて、割込制御レジスタ206の具体例について説明する。   A specific example of the interrupt control register 206 will be described with reference to FIG.

割込制御レジスタ206は、割込要因0乃至nに対応してそれぞれ設けられる。割込制御レジスタ206は、対応する割込要因からの割込要求をマスクするか否かを設定するビット(EIMK)、対応する割込要因からの割込要求をCPU300が受け付けた際のハンドラアドレス特定方式情報を設定するビット(EITB)、対応する割込要因の優先度を設定するビット(EIP3−EIP0)を含む。   Interrupt control registers 206 are provided corresponding to interrupt factors 0 to n, respectively. The interrupt control register 206 is a bit (EIMK) for setting whether to mask the interrupt request from the corresponding interrupt factor, and the handler address when the CPU 300 accepts the interrupt request from the corresponding interrupt factor It includes bits (EITB) for setting specific method information and bits (EIP3-EIP0) for setting the priority of the corresponding interrupt factor.

図5を用いて、HABASE4020、HTBASE4030の具体例について説明する。   Specific examples of HABASE4020 and HTBASE4030 will be described with reference to FIG.

ハンドラアドレスベースレジスタ(HABASE)4020は、直接分岐方式の割込ハンドラの開始アドレス(ベースアドレス)を設定するレジスタである。直接分岐方式の割込ハンドラ(第1の割込ハンドラ)は、このレジスタに設定されたアドレスを先頭に、優先度順に配置される。   A handler address base register (HABASE) 4020 is a register for setting a start address (base address) of a direct branch type interrupt handler. The direct branch type interrupt handler (first interrupt handler) is arranged in order of priority starting at the address set in this register.

ハンドラアドレステーブルベースレジスタ(HTBASE)4030は、テーブル参照方式のハンドラアドレステーブルの開始アドレス(ベースアドレス)を設定するレジスタである。テーブル参照方式のハンドラアドレスは、このレジスタに設定されたアドレスを先頭に、割込要因の要因番号順に配置される。   The handler address table base register (HTBASE) 4030 is a register for setting the start address (base address) of the handler address table of the table reference method. The table reference type handler addresses are arranged in the order of the interrupt cause factor numbers, starting with the address set in this register.

つづいて、図6を用いて、マイクロコントローラ100が割込要求を受け付けた際にCPU300が実行する処理について説明する。   Next, a process executed by the CPU 300 when the microcontroller 100 receives an interrupt request will be described with reference to FIG.

S101:CPU300は、割込コントローラ200から割込要求信号とともに、ハンドラアドレスを特定するための情報として、第1の制御情報としての優先度及び第2の制御情報としての割込の要因番号のうち少なくともいずれか一方と、ハンドラアドレス特定方式情報との入力を受け付ける。   S101: The CPU 300, together with the interrupt request signal from the interrupt controller 200, uses the priority as the first control information and the factor number of the interrupt as the second control information as information for specifying the handler address. Input of at least one of them and handler address specifying method information is accepted.

このとき、CPU300は、割込コントローラ200に対し、割込応答と受け付けた割込の要因番号を出力することができる。これにより、割込コントローラ200は、当該要因番号に係る割込要求がCPU300によって受け付けられたことを認識できる。割込コントローラ200の内部にある割込応答入力部207は、当該要因番号に対応する割込要因の要求フラグ202をクリアして、当該要因番号に係る割込要求の受け付け待ち状態を解消する。   At this time, the CPU 300 can output an interrupt response and the accepted interrupt cause number to the interrupt controller 200. Thereby, the interrupt controller 200 can recognize that the CPU 300 has accepted the interrupt request related to the factor number. The interrupt response input unit 207 in the interrupt controller 200 clears the interrupt factor request flag 202 corresponding to the factor number, and cancels the waiting state for accepting the interrupt request related to the factor number.

S102:割込コントローラ200から入力されたハンドラアドレス特定方式情報が直接分岐方式を示す情報である場合、CPU300は、ハンドラアドレスベースレジスタ(HABASE)4020の値を取得する。   S102: When the handler address specifying method information input from the interrupt controller 200 is information indicating the direct branch method, the CPU 300 acquires the value of the handler address base register (HABASE) 4020.

S103:一方、割込コントローラ200から入力されたハンドラアドレス特定方式情報がテーブル参照方式を示す情報である場合、CPU300は、ハンドラアドレステーブルベースレジスタ(HTBASE)4030の値を取得する。   S103: On the other hand, when the handler address specifying method information input from the interrupt controller 200 is information indicating the table reference method, the CPU 300 acquires the value of the handler address table base register (HTBASE) 4030.

S104:ハンドラアドレス特定方式情報が直接分岐方式を示す情報である場合、CPU300は、S101において入力された第1の制御情報としての優先度と、S102において取得したHABASEの値とに基づいて、ハンドラアドレスを特定する。具体的には、数1の計算を行ってハンドラアドレスを特定する。数1において、ハンドラサイズは所定の固定値(例えば16バイト)である。
(数1)ハンドラアドレス = HABASEに格納されたベースアドレス + 優先度 × ハンドラサイズ
S104: When the handler address specifying method information is information indicating the direct branch method, the CPU 300 executes the handler based on the priority as the first control information input in S101 and the HABASE value acquired in S102. Identify the address. Specifically, the handler address is specified by performing the calculation of Equation 1. In Equation 1, the handler size is a predetermined fixed value (for example, 16 bytes).
(Expression 1) Handler address = Base address stored in HABASE + Priority x Handler size

S105:ハンドラアドレス特定方式情報がテーブル参照方式を示す情報である場合、CPU300は、まず、S101において入力された第2の制御情報としての要因番号と、S103において取得したHTBASEの値とに基づいて、ハンドラアドレスの格納アドレスを特定する。具体的には、数2の計算を行ってハンドラアドレスの格納アドレス、すなわちハンドラアドレスが格納されているテーブルのアドレスを特定する。数2において、アドレスサイズは所定の固定値(例えば4バイト)である。
(数2)ハンドラアドレスの格納アドレス = HTBASEに格納されたベースアドレス + 要因番号 × アドレスサイズ
S105: When the handler address specifying method information is information indicating the table reference method, the CPU 300 firstly, based on the factor number as the second control information input in S101 and the value of HTBASE acquired in S103. Identify the storage address of the handler address. Specifically, the calculation of Equation 2 is performed to specify the storage address of the handler address, that is, the address of the table storing the handler address. In Equation 2, the address size is a predetermined fixed value (for example, 4 bytes).
(Equation 2) Handler address storage address = Base address stored in HTBASE + Reason number × Address size

S106:CPU300は、数2により計算したハンドラアドレスの格納アドレスからデータを読み出し、読み出されたデータをハンドラアドレスとする。   S106: The CPU 300 reads data from the storage address of the handler address calculated by Equation 2, and uses the read data as the handler address.

S107:CPU300は、ハンドラアドレスへ分岐する。すなわち、直接分岐方式又はテーブル参照方式のいずれかのハンドラアドレスの特定方式により特定したハンドラアドレスに格納された割込ハンドラの命令コードを読み出し、その命令コードに従い処理を行う。   S107: The CPU 300 branches to the handler address. That is, the instruction code of the interrupt handler stored at the handler address specified by the handler address specifying method of either the direct branch method or the table reference method is read, and processing is performed according to the instruction code.

図7に、メモリ4010における、割込ハンドラ(第1の割込ハンドラ及び第2の割込ハンドラ)のアドレス空間上の配置イメージを示す。   FIG. 7 shows an arrangement image on the address space of the interrupt handlers (first interrupt handler and second interrupt handler) in the memory 4010.

直接分岐方式の割込ハンドラ(第1の割込ハンドラ)602は、ハンドラアドレスベースレジスタ(HABASE)4020に設定されたベースアドレス601から優先度順に配置される。各ハンドラの格納領域のサイズ、すなわちハンドラサイズは固定である(例えば16バイト)。例えば、優先度として0乃至15が設定可能である場合、ベースアドレス601を基点として、優先度0乃至15に対応するハンドラINTPR0乃至INTPR15が、それぞれ16バイトのハンドラサイズの領域に格納されて、優先度順に配置される。   The direct branch type interrupt handler (first interrupt handler) 602 is arranged in order of priority from the base address 601 set in the handler address base register (HABASE) 4020. The size of the storage area of each handler, that is, the handler size is fixed (for example, 16 bytes). For example, when priority levels 0 to 15 can be set, the handlers INTPR0 to INTPR15 corresponding to the priority levels 0 to 15 are stored in a 16-byte handler size area with the base address 601 as a base point. Arranged in order.

テーブル参照方式のハンドラアドレスは、ハンドラアドレステーブルベースレジスタ(HTBASE)4030に設定されたベースアドレス603から要因番号順に配置される。これらのハンドラアドレスを格納する領域をハンドラアドレステーブル604と呼ぶ。各ハンドラアドレスの格納領域のサイズ、すなわちアドレスサイズは固定である(例えば4バイト)。例えば、要因番号として0乃至nが存在する場合、ベースアドレス603を基点として、要因番号0乃至nに対応するハンドラアドレスINT0乃至INTnが、それぞれ4バイトのアドレスサイズの領域に格納されて、要因番号順に配置される。   The handler address of the table reference method is arranged in the order of the factor number from the base address 603 set in the handler address table base register (HTBASE) 4030. An area for storing these handler addresses is called a handler address table 604. The size of the storage area of each handler address, that is, the address size is fixed (for example, 4 bytes). For example, when the factor numbers 0 to n exist, the handler addresses INT0 to INTn corresponding to the factor numbers 0 to n are stored in the 4-byte address size area starting from the base address 603, respectively. Arranged in order.

テーブル参照方式では、各要因番号に対応する割込ハンドラ(第2の割込ハンドラ)の配置アドレス及びサイズは任意である(605)。   In the table reference method, the arrangement address and size of the interrupt handler (second interrupt handler) corresponding to each factor number are arbitrary (605).

図8に、割込発生時の割込コントローラ200とCPU300間との信号のタイミングチャートを示す。   FIG. 8 shows a timing chart of signals between the interrupt controller 200 and the CPU 300 when an interrupt occurs.

時刻t2:割込要因1の割込要求(req1)がアサートされる。   Time t2: Interrupt request 1 (req1) of interrupt factor 1 is asserted.

時刻t3〜t5:req1のアサートを受け、要求フラグ1がセットされる。割込コントローラ200は、CPU300へ割込要求(intreq)とともに、要因番号(intnum[N:0])、優先度(intpri[3:0])、ハンドラアドレス特定方式情報(inteitb)を出力する。このとき、割込要因1に対応する割込制御レジスタ1の設定値は以下のようになっており、この設定値に従って割込コントローラ200からCPU300へ信号が出力される。
EITB = 1:テーブル参照方式を選択
EIP3−EIP0 = 5:優先度5
From time t3 to t5: req1 is asserted, and the request flag 1 is set. The interrupt controller 200 outputs an interrupt request (intreq), a factor number (intnum [N: 0]), a priority (intpri [3: 0]), and handler address specifying method information (intiteb) to the CPU 300. At this time, the set value of the interrupt control register 1 corresponding to the interrupt factor 1 is as follows, and a signal is output from the interrupt controller 200 to the CPU 300 according to this set value.
EITB = 1: Select table reference method EIP3-EIP0 = 5: Priority 5

なお、この期間は、CPU300が、割込応答(intack)と要因番号(intacknum[N:0])を割込コントローラ200に通知していないことからわかるように、CPU300が優先度5よりも高い優先度の割り込みを処理中であるなどの何らかの理由により、この割り込みはCPU300に受け付けられていない。   Note that during this period, the CPU 300 is higher than the priority level 5 as can be seen from the fact that the CPU 300 does not notify the interrupt controller 200 of the interrupt response (intake) and the cause number (intakenum [N: 0]). This interrupt is not accepted by the CPU 300 for some reason such as processing a priority interrupt.

時刻t5:割込要因3の割込要求(req3)がアサートされる。   Time t5: The interrupt request (req3) for interrupt factor 3 is asserted.

時刻t6〜t8:req3のアサートを受け、要求フラグ3がセットされる。割込要因3の優先度は、割込要因1の優先度よりも高いため、割込コントローラ200がCPU300へ通知する情報が、要因1のものから要因3のものに切り替わる。要因3に対応する割込制御レジスタ3の設定値は以下のようになっており、この設定値に従って割込コントローラ200からCPU300へ信号が出力される。
EITB = 0:優先度に基づいた直接分岐方式を選択
EIP3−EIP0 = 2:優先度2
Time t6 to t8: Request flag 3 is set in response to the assertion of req3. Since the priority of the interrupt factor 3 is higher than the priority of the interrupt factor 1, the information notified to the CPU 300 by the interrupt controller 200 is switched from the factor 1 to the factor 3. The set value of the interrupt control register 3 corresponding to the factor 3 is as follows, and a signal is output from the interrupt controller 200 to the CPU 300 according to this set value.
EITB = 0: Select a direct branching method based on priority EIP3-EIP0 = 2: Priority 2

時刻t8:CPU300が要因3の割込要求を受け付け、割込応答(intack)と要因番号(intacknum[N:0])を割込コントローラ200に通知する。   Time t8: The CPU 300 accepts the interrupt request for the factor 3, and notifies the interrupt controller 200 of the interrupt response (intake) and the factor number (intakenum [N: 0]).

時刻t9:割込コントローラ200がCPU300から割込応答(intack)を受け取り、要因3に対応する要求フラグ3をクリアすると同時に割込要求(intreq)を取り下げる。   Time t9: The interrupt controller 200 receives an interrupt response (intake) from the CPU 300, clears the request flag 3 corresponding to the factor 3, and simultaneously withdraws the interrupt request (intreq).

時刻t10〜t12:要求フラグ1はセットされたままであるため、割込コントローラ200は再びCPU300へ割込要求(intreq)とともに要因1の情報(要因番号、優先度、ハンドラアドレス特定方式情報)を通知する。   Time t10 to t12: Since the request flag 1 remains set, the interrupt controller 200 notifies the CPU 300 again of the interrupt request (intreq) and the information of the factor 1 (factor number, priority, handler address specifying method information). To do.

本実施の形態においては、割込コントローラ200の外部のメモリ4010にハンドラやハンドラアドレステーブルを格納することとしたため、ハンドラやハンドラアドレステーブルを自由に配置することが可能であり、割込要因の数が増大したとしても、低コストで割込要因に対応するハンドラを設けることができる。   In this embodiment, since the handlers and handler address tables are stored in the memory 4010 external to the interrupt controller 200, the handlers and handler address tables can be freely arranged, and the number of interrupt factors Even if this increases, a handler corresponding to an interrupt factor can be provided at low cost.

また、本実施の形態においては、メモリ4010よりアクセス時間が短いHABASE4020、HTBASE4030にベースアドレスを格納することにより、CPU300はハンドラアドレス又はハンドラアドレスの格納アドレスを高速に計算することができる。   In this embodiment, the CPU 300 can calculate the handler address or the storage address of the handler address at high speed by storing the base address in the HABASE 4020 and the HTBASE 4030 whose access time is shorter than that of the memory 4010.

<実施の形態2>
実施の形態1の直接分岐方式では、割込要因に応じて設定された優先度に基づいてハンドラアドレスを特定する。そのため、直接分岐方式でハンドラアドレスを特定できる割込ハンドラ(第1の割込ハンドラ)の数は、優先度の数以下に制限される。また、複数の割込要因を同一の優先度に設定し、かつ、これらの複数の要因のハンドラアドレスの特定方法を直接分岐方式とした場合、これらの複数の割込要因の割込ハンドラは同一となるので、割込ハンドラ内で割込要因を判別する処理を行う必要が生じ、直接分岐方式の利点である高速な割込応答性を損なってしまう。
<Embodiment 2>
In the direct branching method of the first embodiment, the handler address is specified based on the priority set according to the interrupt factor. Therefore, the number of interrupt handlers (first interrupt handlers) that can specify the handler address by the direct branching method is limited to the number of priorities or less. Also, when multiple interrupt sources are set to the same priority and the method for specifying the handler addresses of these multiple sources is the direct branch method, the interrupt handlers for these multiple interrupt sources are the same Therefore, it becomes necessary to perform processing for determining the interrupt factor in the interrupt handler, and the high-speed interrupt responsiveness that is an advantage of the direct branching method is impaired.

そこで、本発明の実施の形態2においては、割込制御レジスタ206に、直接分岐方式を選択した場合のハンドラ番号を指定するビットをさらに設ける。これにより、割込要因に設定した優先度とは独立に、直接分岐方式のハンドラアドレスを特定することができ、実施の形態1における上述の問題点を解決することができる。   Therefore, in the second embodiment of the present invention, the interrupt control register 206 is further provided with a bit for designating a handler number when the direct branching method is selected. Thereby, the handler address of the direct branching method can be specified independently of the priority set as the interrupt factor, and the above-described problems in the first embodiment can be solved.

本発明の実施の形態2にかかるマイクロコントローラ100の構成について説明する。   A configuration of the microcontroller 100 according to the second embodiment of the present invention will be described.

実施の形態2のマイクロコントローラ100は、割込コントローラ200内の割込制御レジスタ206の構成に特徴を有する。その余の構成については、実施の形態1と同様である。   The microcontroller 100 according to the second embodiment is characterized by the configuration of the interrupt control register 206 in the interrupt controller 200. The rest of the configuration is the same as in the first embodiment.

図9を用いて、本実施の形態における割込制御レジスタ206の構成について説明する。   The configuration of the interrupt control register 206 in this embodiment will be described with reference to FIG.

割込制御レジスタ206は、割込要因0乃至n毎に設けられる。割込制御レジスタ206は、ハンドラアドレス特定方式情報が直接分岐方式に設定された場合の、ハンドラ番号を指定するビット(HN5−HN0)を含む。なお、本実施の形態における上記ビット数は一例であり、これに限定されるものではない。   The interrupt control register 206 is provided for each interrupt factor 0 to n. Interrupt control register 206 includes bits (HN5 to HN0) for specifying a handler number when the handler address specifying method information is set to the direct branch method. Note that the number of bits in the present embodiment is an example, and the present invention is not limited to this.

図10を用いて、本実施の形態におけるマイクロコントローラ100が割込要求を受け付けた際にCPU300が実行する処理について説明する。   A process executed by the CPU 300 when the microcontroller 100 according to the present embodiment receives an interrupt request will be described with reference to FIG.

S201:CPU300は、割込コントローラ200から割込要求信号とともに、ハンドラアドレスを特定するための情報として、第1の制御情報としてのハンドラ番号及び第2の制御情報としての割込の要因番号のうち少なくともいずれか一方と、ハンドラアドレス特定方式情報との入力を受け付ける。   S201: The CPU 300 includes the handler number as the first control information and the interrupt factor number as the second control information as information for specifying the handler address together with the interrupt request signal from the interrupt controller 200. Input of at least one of them and handler address specifying method information is accepted.

このとき、CPU300は、割込コントローラ200に対し、割込応答と受け付けた割込の要因番号を出力することができる。   At this time, the CPU 300 can output an interrupt response and the accepted interrupt cause number to the interrupt controller 200.

S102:割込コントローラ200から入力されたハンドラアドレス特定方式情報が直接分岐方式を示す情報である場合、CPU300は、ハンドラアドレスベースレジスタ(HABASE)4020の値を取得する。   S102: When the handler address specifying method information input from the interrupt controller 200 is information indicating the direct branch method, the CPU 300 acquires the value of the handler address base register (HABASE) 4020.

S103:一方、割込コントローラ200から入力されたハンドラアドレス特定方式情報がテーブル参照方式を示す情報である場合、CPU300は、ハンドラアドレステーブルベースレジスタ(HTBASE)4030の値を取得する。   S103: On the other hand, when the handler address specifying method information input from the interrupt controller 200 is information indicating the table reference method, the CPU 300 acquires the value of the handler address table base register (HTBASE) 4030.

S204:ハンドラアドレス特定方式情報が直接分岐方式を示す情報である場合、CPU300は、S201において入力された第1の制御情報としてのハンドラ番号と、S102において取得したHABASEの値とに基づいて、ハンドラアドレスを特定する。具体的には、数3の計算を行ってハンドラアドレスを特定する。
(数3)ハンドラアドレス = HABASEに格納されたベースアドレス + ハンドラ番号 × ハンドラサイズ
S204: When the handler address specifying method information is information indicating the direct branch method, the CPU 300 executes the handler based on the handler number as the first control information input in S201 and the value of HABASE acquired in S102. Identify the address. Specifically, the handler address is specified by performing the calculation of Equation 3.
(Expression 3) Handler address = Base address stored in HABASE + Handler number × Handler size

S105:ハンドラアドレス特定方式情報がテーブル参照方式を示す情報である場合、CPU300は、まず、S201において入力された第2の制御情報としての要因番号と、S103において取得したHTBASEの値とに基づいて、ハンドラアドレスの格納アドレスを特定する。具体的には、数2の計算を行ってハンドラアドレスの格納アドレス、すなわちハンドラアドレスが格納されているテーブルのアドレスを特定する。   S105: When the handler address specifying method information is information indicating the table reference method, the CPU 300 firstly, based on the factor number as the second control information input in S201 and the value of HTBASE acquired in S103. Identify the storage address of the handler address. Specifically, the calculation of Equation 2 is performed to specify the storage address of the handler address, that is, the address of the table storing the handler address.

S106:CPU300は、数2により計算したハンドラアドレスの格納アドレスからデータを読み出し、読み出されたデータをハンドラアドレスとする。   S106: The CPU 300 reads data from the storage address of the handler address calculated by Equation 2, and uses the read data as the handler address.

S107:CPU300は、ハンドラアドレスへ分岐する。すなわち、直接分岐方式又はテーブル参照方式のいずれかのハンドラアドレスの特定方式により特定したハンドラアドレスに格納された割込ハンドラの命令コードを読み出し、その命令コードに従い処理を行う。   S107: The CPU 300 branches to the handler address. That is, the instruction code of the interrupt handler stored at the handler address specified by the handler address specifying method of either the direct branch method or the table reference method is read, and processing is performed according to the instruction code.

図11に、本実施の形態における割込ハンドラ(第1の割込ハンドラ及び第2の割込ハンドラ)のアドレス空間上の配置イメージを示す。   FIG. 11 shows an arrangement image on the address space of the interrupt handlers (first interrupt handler and second interrupt handler) in the present embodiment.

直接分岐方式の割込ハンドラ(第1の割込ハンドラ)606は、ハンドラアドレスベースレジスタ(HABASE)4020に設定されたベースアドレス601からハンドラ番号順に配置される。各ハンドラの格納領域のサイズ、すなわちハンドラサイズは固定である(例えば16バイト)。例えば、ハンドラ番号として0乃至63が設定可能である場合、ベースアドレス601を基点として、ハンドラ番号0乃至63に対応するハンドラINTNUM0乃至INTNUM63が、それぞれ16バイトのハンドラサイズの領域に格納されて、ハンドラ番号順に配置される。   Direct branch type interrupt handlers (first interrupt handlers) 606 are arranged in the order of handler numbers starting from the base address 601 set in the handler address base register (HABASE) 4020. The size of the storage area of each handler, that is, the handler size is fixed (for example, 16 bytes). For example, when 0 to 63 can be set as the handler number, the handlers INTNUM0 to INTNUM63 corresponding to the handler numbers 0 to 63 with the base address 601 as a base point are stored in a handler size area of 16 bytes respectively. Arranged in numerical order.

テーブル参照方式のハンドラアドレスは、ハンドラアドレステーブルベースレジスタ(HTBASE)4030に設定されたベースアドレス603から要因番号順に配置される。これらのハンドラアドレスを格納する領域をハンドラアドレステーブル604と呼ぶ。各ハンドラアドレスの格納領域のサイズ、すなわちアドレスサイズは固定である(例えば4バイト)。例えば、要因番号として0乃至nが存在する場合、ベースアドレス603を基点として、要因番号0乃至nに対応するハンドラアドレスINT0乃至INT15が、それぞれ4バイトのアドレスサイズの領域に格納されて、要因番号順に配置される。   The handler address of the table reference method is arranged in the order of the factor number from the base address 603 set in the handler address table base register (HTBASE) 4030. An area for storing these handler addresses is called a handler address table 604. The size of the storage area of each handler address, that is, the address size is fixed (for example, 4 bytes). For example, when the factor numbers 0 to n exist, the handler addresses INT0 to INT15 corresponding to the factor numbers 0 to n are stored in the 4-byte address size areas starting from the base address 603, respectively. Arranged in order.

テーブル参照方式では、各要因番号に対応する割込ハンドラ(第2の割込ハンドラ)の配置アドレス及びサイズは任意である(605)。   In the table reference method, the arrangement address and size of the interrupt handler (second interrupt handler) corresponding to each factor number are arbitrary (605).

本実施の形態においては、直接分岐方式において、割込コントローラ200が、割込制御レジスタ206によって割込要因に予め対応付けられたハンドラ番号をCPU300に出力し、CPU300がハンドラ番号に基づいてハンドラアドレスを特定するよう構成した。これにより、優先度の数に拘束されることなく、ハンドラの数を特定することができる。また、ハンドラ内で割込要因を判別する処理を行う必要がない。   In the present embodiment, in the direct branch method, the interrupt controller 200 outputs a handler number previously associated with an interrupt factor by the interrupt control register 206 to the CPU 300, and the CPU 300 handles the handler address based on the handler number. Configured to identify. Thereby, the number of handlers can be specified without being restricted by the number of priorities. Further, it is not necessary to perform processing for determining the interrupt factor in the handler.

<実施の形態3>
実施の形態1及び実施の形態2では、高速な割込応答が必要な割込要因については直接分岐方式を、そうでない割込要因についてはテーブル参照方式を割り当てることにより、高速な割込応答性とメモリの自由かつ効率的な利用とを両立させた。
<Embodiment 3>
In the first and second embodiments, a direct branch method is assigned for interrupt factors that require a high-speed interrupt response, and a table reference method is assigned for interrupt factors that do not require a high-speed interrupt response. And free and efficient use of memory.

しかしながら、何らかの制約条件により、ハンドラアドレスの特定方式として直接分岐方式しか利用できない場合が考えられる。本発明の実施の形態3は、かかる場合においてもメモリを自由かつ効率的に利用することができるマイクロコントローラ100に関する。   However, there may be a case where only the direct branching method can be used as a method for specifying the handler address due to some constraints. The third embodiment of the present invention relates to a microcontroller 100 that can use a memory freely and efficiently even in such a case.

本発明の実施の形態3にかかるマイクロコントローラ100の構成について説明する。   A configuration of the microcontroller 100 according to the third embodiment of the present invention will be described.

実施の形態3のマイクロコントローラ100は、割込コントローラ200内の割込制御レジスタ206の構成と、メモリ4010内の割込ハンドラの配置方法とに特徴を有する。その余の構成については、実施の形態1及び実施の形態2と同様である。   The microcontroller 100 according to the third embodiment is characterized by the configuration of the interrupt control register 206 in the interrupt controller 200 and the arrangement method of the interrupt handlers in the memory 4010. The rest of the configuration is the same as in the first and second embodiments.

図12を用いて、本実施の形態における割込制御レジスタ206の構成について説明する。   The configuration of the interrupt control register 206 in this embodiment will be described with reference to FIG.

割込制御レジスタ206は、割込要因0乃至n毎に設けられる。割込制御レジスタ206は、ハンドラ番号を指定するビット(HN5−HN0)を含む。なお、本実施の形態における上記ビット数は一例であり、これに限定されるものではない。本実施の形態では、割込要因0乃至nのうち、高速な割込応答を必要としない割込要因x1乃至xnのハンドラ番号を、全て共通の番号、例えば63に設定する。これにより、CPU300が割込要因x1乃至xnからの割込要求を受け付けた場合、ハンドラ番号63の割込ハンドラへ分岐する。   The interrupt control register 206 is provided for each interrupt factor 0 to n. Interrupt control register 206 includes bits (HN5-HN0) for specifying a handler number. Note that the number of bits in the present embodiment is an example, and the present invention is not limited to this. In this embodiment, among the interrupt factors 0 to n, the handler numbers of interrupt factors x1 to xn that do not require a high-speed interrupt response are all set to a common number, for example, 63. As a result, when the CPU 300 receives an interrupt request from the interrupt factors x1 to xn, the CPU 300 branches to the interrupt handler with the handler number 63.

図13を用いて、本実施の形態におけるマイクロコントローラ100が割込要求を受け付けた際にCPU300が実行する処理について説明する。   A process executed by the CPU 300 when the microcontroller 100 according to the present embodiment receives an interrupt request will be described with reference to FIG.

S301:CPU300は、割込コントローラ200から割込要求信号とともに、ハンドラアドレスを特定するための情報として、第1の制御情報としてのハンドラ番号の入力を受け付ける。   S301: CPU 300 accepts an input of a handler number as first control information as information for specifying a handler address together with an interrupt request signal from interrupt controller 200.

このとき、CPU300は、割込コントローラ200に対し、割込応答と受け付けた割込の要因番号を出力することができる。   At this time, the CPU 300 can output an interrupt response and the accepted interrupt cause number to the interrupt controller 200.

S102:CPU300は、ハンドラアドレスベースレジスタ(HABASE)4020の値を取得する。   S102: The CPU 300 acquires the value of the handler address base register (HABASE) 4020.

S204:CPU300は、S301において入力された第1の制御情報としてのハンドラ番号と、S102において取得したHABASEの値とに基づいて、ハンドラアドレスを特定する。具体的には、数3の計算を行ってハンドラアドレスを特定する。   S204: The CPU 300 specifies the handler address based on the handler number as the first control information input in S301 and the HABASE value acquired in S102. Specifically, the handler address is specified by performing the calculation of Equation 3.

S107:CPU300は、ハンドラアドレスへ分岐する。すなわち、ハンドラアドレスに格納された割込ハンドラの命令コードを読み出し、その命令コードに従い処理を行う。   S107: The CPU 300 branches to the handler address. That is, the instruction code of the interrupt handler stored at the handler address is read and processing is performed according to the instruction code.

図14に、本実施の形態における割込ハンドラのアドレス空間上の配置イメージを示す。   FIG. 14 shows an arrangement image of the interrupt handlers in the address space according to the present embodiment.

割込ハンドラ(第1の割込ハンドラ)606は、ハンドラアドレスベースレジスタ(HABASE)4020に設定されたベースアドレス601からハンドラ番号順に配置される。各ハンドラの格納領域のサイズ、すなわちハンドラサイズは固定である(例えば16バイト)。例えば、ハンドラ番号として0乃至63が設定可能である場合、ベースアドレス601を基点として、ハンドラ番号0乃至63に対応するハンドラINTNUM0乃至INTNUM63が、それぞれ16バイトのハンドラサイズの領域に格納されて、ハンドラ番号順に配置される。   Interrupt handlers (first interrupt handlers) 606 are arranged in the order of handler numbers from the base address 601 set in the handler address base register (HABASE) 4020. The size of the storage area of each handler, that is, the handler size is fixed (for example, 16 bytes). For example, when 0 to 63 can be set as the handler number, the handlers INTNUM0 to INTNUM63 corresponding to the handler numbers 0 to 63 with the base address 601 as a base point are stored in a handler size area of 16 bytes respectively. Arranged in numerical order.

本実施の形態では、割込コントローラ200内の割込制御レジスタ206において、高速な割込応答を必要としない割込要因x1乃至xnのハンドラ番号が、全て共通の番号、例えば63に設定される。これにより、CPU300が割込要因x1乃至xnからの割込要求を受け付けた場合、ハンドラINTNUM63へ分岐する。ハンドラINTNUM63には、割込要求が割込要因x1乃至xnのどの要因からのものなのかを判別し、割込要因x1乃至xnそれぞれに固有のハンドラINTx1乃至INTxnへ分岐する処理を記述しておく。こうすることで、高速な割込応答を必要としない割込要因x1乃至xnについて、割込ハンドラ(第1の割込ハンドラ)の配置場所やサイズに自由度が増し、メモリの利用効率を高めることができる。   In the present embodiment, in the interrupt control register 206 in the interrupt controller 200, the handler numbers of interrupt factors x1 to xn that do not require a high-speed interrupt response are all set to a common number, for example, 63. . Thus, when the CPU 300 accepts an interrupt request from the interrupt factors x1 to xn, it branches to the handler INTNUM63. In the handler INTNUM63, a process for determining from which of the interrupt factors x1 to xn the interrupt request originated and branching to the handlers INTx1 to INTxn specific to the interrupt factors x1 to xn is described. . This increases the degree of freedom in the location and size of the interrupt handler (first interrupt handler) for interrupt factors x1 to xn that do not require a high-speed interrupt response, and increases the memory utilization efficiency. be able to.

本実施の形態においては、直接分岐方式しか利用できないマイクロコントローラ100において、割込コントローラ200内の割込制御レジスタ206が、高速な割込応答を必要としない割込要因に共通のハンドラ番号を割り当て、メモリ4010内の上記共通のハンドラ番号に対応する割込ハンドラに、割込要求の割込要因を判別し、割込要因毎の他の割込ハンドラへ分岐する処理を行わせる。これにより、高速な割込応答を必要としない割込要因について、割込ハンドラの配置場所やサイズに自由度が増し、メモリの利用効率を高めることができる。   In the present embodiment, in microcontroller 100 that can only use the direct branch method, interrupt control register 206 in interrupt controller 200 assigns a common handler number to an interrupt factor that does not require a high-speed interrupt response. Then, the interrupt handler corresponding to the common handler number in the memory 4010 is caused to determine the interrupt factor of the interrupt request and perform processing to branch to another interrupt handler for each interrupt factor. As a result, with regard to an interrupt factor that does not require a high-speed interrupt response, the degree of freedom increases in the location and size of the interrupt handler, and the use efficiency of the memory can be increased.

<実施の形態4>
実施の形態3は、高速な割込応答を必要としない割込要因について、メモリの自由かつ効率的な利用を実現した。本発明の実施の形態4は、高速な割込応答を必要とする割込要因についても、メモリを自由かつ効率的に利用することができるマイクロコントローラ100に関する。
<Embodiment 4>
The third embodiment realizes free and efficient use of the memory for an interrupt factor that does not require a high-speed interrupt response. The fourth embodiment of the present invention relates to a microcontroller 100 that can use a memory freely and efficiently for an interrupt factor that requires a high-speed interrupt response.

本発明の実施の形態4にかかるマイクロコントローラ100の構成について説明する。   A configuration of the microcontroller 100 according to the fourth embodiment of the present invention will be described.

実施の形態4のマイクロコントローラ100は、割込コントローラ200内の割込制御レジスタ206の構成と、メモリ4010内の割込ハンドラの配置方法とに特徴を有する。その余の構成については、実施の形態3と同様である。   The microcontroller 100 of the fourth embodiment is characterized by the configuration of the interrupt control register 206 in the interrupt controller 200 and the arrangement method of the interrupt handlers in the memory 4010. The rest of the configuration is the same as in the third embodiment.

本実施の形態における割込制御レジスタ206は、高速な割込応答を必要とする割込要因yのハンドラ番号を任意の要因番号、例えば30に設定する。このとき、もし割込要因yに対応する割込ハンドラが、規定のハンドラサイズより大きいものである場合、割込制御レジスタ206は、ハンドラ番号30に連続するハンドラ番号31を、他のどの割込要因にも割り当てないようにする。   The interrupt control register 206 in the present embodiment sets the handler number of the interrupt factor y that requires a high-speed interrupt response to an arbitrary factor number, for example, 30. At this time, if the interrupt handler corresponding to the interrupt factor y is larger than the specified handler size, the interrupt control register 206 assigns the handler number 31 consecutive to the handler number 30 to any other interrupt. Do not assign to factors.

加えて、図14に示すように、メモリ4010内のハンドラINTNUM30の領域とハンドラINTNUM31の領域を連結した領域に、要因yの割込ハンドラを格納する。   In addition, as shown in FIG. 14, the interrupt handler for the factor y is stored in an area obtained by connecting the area of the handler INTNUM 30 and the area of the handler INTNUM 31 in the memory 4010.

これにより、高速な割込応答性能を損なわないまま割込ハンドラのサイズの自由度を増すことができる。   Thereby, the freedom degree of the size of an interrupt handler can be increased without impairing high-speed interrupt response performance.

本実施の形態においては、メモリ4010が、複数の割込ハンドラの識別子と関連付けられた連続する格納領域に1つの割込ハンドラを格納し、割込コントローラ200内の割込制御レジスタ206は、上記複数の割込ハンドラの識別子のうち、上記連続する格納領域の先頭領域に関連付けられた割込ハンドラの識別子のみを、所定の割込要因と対応付けるよう構成した。これにより、高速な割込応答性能を損なわないまま割込ハンドラのサイズの自由度を増すことができる。   In the present embodiment, the memory 4010 stores one interrupt handler in a continuous storage area associated with the identifiers of a plurality of interrupt handlers, and the interrupt control register 206 in the interrupt controller 200 Of the identifiers of the plurality of interrupt handlers, only the identifier of the interrupt handler associated with the top area of the continuous storage area is associated with a predetermined interrupt factor. Thereby, the freedom degree of the size of an interrupt handler can be increased without impairing high-speed interrupt response performance.

<その他の実施の形態>
なお、本発明は上述した実施の形態のみに限定されるものではなく、本発明の要旨を逸脱しない範囲において種々の変更が可能であることは勿論である。
<Other embodiments>
It should be noted that the present invention is not limited to the above-described embodiments, and various modifications can be made without departing from the scope of the present invention.

例えば、上述の実施の形態では、ハードウェアの構成として説明したが、これに限定されるものではなく、任意の処理を、CPU(Central Processing Unit)にコンピュータプログラムを実行させることにより実現することも可能である。この場合、コンピュータプログラムは、様々なタイプの非一時的なコンピュータ可読媒体(non−transitory computer readable medium)を用いて格納され、コンピュータに供給することができる。非一時的なコンピュータ可読媒体は、様々なタイプの実体のある記録媒体(tangible storage medium)を含む。非一時的なコンピュータ可読媒体の例は、磁気記録媒体(例えばフレキシブルディスク、磁気テープ、ハードディスクドライブ)、光磁気記録媒体(例えば光磁気ディスク)、CD−ROM(Read Only Memory)、CD−R、CD−R/W、半導体メモリ(例えば、マスクROM、PROM(Programmable ROM)、EPROM(Erasable PROM)、フラッシュROM、RAM(random access memory))を含む。また、プログラムは、様々なタイプの一時的なコンピュータ可読媒体(transitory computer readable medium)によってコンピュータに供給されてもよい。一時的なコンピュータ可読媒体の例は、電気信号、光信号、及び電磁波を含む。一時的なコンピュータ可読媒体は、電線及び光ファイバ等の有線通信路、又は無線通信路を介して、プログラムをコンピュータに供給できる。   For example, in the above-described embodiment, the hardware configuration has been described. However, the present invention is not limited to this, and any processing may be realized by causing a CPU (Central Processing Unit) to execute a computer program. Is possible. In this case, the computer program can be stored and provided to the computer using various types of non-transitory computer readable media. Non-transitory computer readable media include various types of tangible storage media. Examples of non-transitory computer-readable media include magnetic recording media (for example, flexible disks, magnetic tapes, hard disk drives), magneto-optical recording media (for example, magneto-optical disks), CD-ROMs (Read Only Memory), CD-Rs, CD-R / W, semiconductor memory (for example, mask ROM, PROM (Programmable ROM), EPROM (Erasable PROM), flash ROM, RAM (Random Access Memory)). The program may also be supplied to the computer by various types of transitory computer readable media. Examples of transitory computer readable media include electrical signals, optical signals, and electromagnetic waves. The temporary computer-readable medium can supply the program to the computer via a wired communication path such as an electric wire and an optical fiber, or a wireless communication path.

100 マイクロコントローラ
101 周辺機能
102 周辺バス
103 CPUバス
104 キャッシュ
105 RAM
106 外部メモリキャッシュ
107 外部メモリコントローラ
200 割込コントローラ
201 要求検出部
202 要求フラグ
203 要求マスク部
204 優先度判定部
205 割込要求生成部
206 割込制御レジスタ
207 割込応答入力部
208 周辺バスインタフェース
300 CPU
301 実行ユニット
302 命令フェッチユニット
303 ロードストアユニット
401 ハンドラ記憶手段
402 ベースアドレス記憶手段
4010 メモリ
4020 HABASE(第1のベースアドレス記憶手段)
4030 HTBASE(第2のベースアドレス記憶手段)
501 温度センサ
502 衝突センサ
503 外部メモリ
100 Microcontroller 101 Peripheral Function 102 Peripheral Bus 103 CPU Bus 104 Cache 105 RAM
106 External Memory Cache 107 External Memory Controller 200 Interrupt Controller 201 Request Detection Unit 202 Request Flag 203 Request Mask Unit 204 Priority Determination Unit 205 Interrupt Request Generation Unit 206 Interrupt Control Register 207 Interrupt Response Input Unit 208 Peripheral Bus Interface 300 CPU
301 execution unit 302 instruction fetch unit 303 load store unit 401 handler storage unit 402 base address storage unit 4010 memory 4020 HABASE (first base address storage unit)
4030 HTBASE (second base address storage means)
501 Temperature sensor 502 Collision sensor 503 External memory

Claims (20)

複数の割込要因による割込要求に応じて割込ハンドラを実行するマイクロコントローラであって、
前記割込ハンドラの格納位置を示すアドレスであるハンドラアドレスを特定するために用いられるベースアドレスを記憶する第1の記憶手段と、
前記割込ハンドラを記憶する第2の記憶手段と、
前記割込要求の入力に応じて、割込要求と、前記割込要因に予め対応付けられた制御情報を出力する割込コントローラと、
前記割込コントローラから出力された割込要求に応じて、前記割込ハンドラを取得して実行するCPUを備え、
前記CPUから前記第1の記憶手段に対するアクセス時間は、前記CPUから前記第2の記憶手段に対するアクセス時間よりも短く、かつ、
前記CPUは、
(a)前記割込コントローラから出力された割込要求に応じて、前記第1の記憶手段にアクセスして前記ベースアドレスを取得し、
(b)当該取得されたベースアドレスと、前記割込コントローラから出力された前記制御情報に基づいて、前記ハンドラアドレスを特定し、
(c)特定されたハンドラアドレスに基づいて前記第2の記憶手段にアクセスして前記割込ハンドラを実行する、
マイクロコントローラ。
A microcontroller that executes an interrupt handler in response to an interrupt request caused by multiple interrupt factors,
First storage means for storing a base address used for specifying a handler address which is an address indicating a storage position of the interrupt handler;
Second storage means for storing the interrupt handler;
In response to the input of the interrupt request, an interrupt controller that outputs control information associated with the interrupt factor in advance,
In response to an interrupt request output from the interrupt controller, a CPU for acquiring and executing the interrupt handler is provided.
The access time from the CPU to the first storage means is shorter than the access time from the CPU to the second storage means, and
The CPU
(A) In response to the interrupt request output from the interrupt controller, the first storage means is accessed to obtain the base address;
(B) identifying the handler address based on the acquired base address and the control information output from the interrupt controller;
(C) accessing the second storage means based on the specified handler address to execute the interrupt handler;
Microcontroller.
前記第2の記憶手段は、前記制御情報と前記ハンドラアドレスとを予め対応付けたハンドラアドレステーブルを格納するテーブル記憶領域を有し、
前記ベースアドレスは、前記第2の記憶手段における前記ハンドラアドレステーブルの格納位置を示すアドレスであり、
前記CPUは、
(b−1)前記ベースアドレスに基づいて前記ハンドラアドレステーブルを参照し、当該ハンドラアドレステーブルにおいて前記割込コントローラから出力された前記制御情報と対応づけられた前記ハンドラアドレスを特定する
請求項1記載のマイクロコントローラ。
The second storage means has a table storage area for storing a handler address table in which the control information and the handler address are associated in advance.
The base address is an address indicating a storage position of the handler address table in the second storage means,
The CPU
(B-1) The handler address table is referenced based on the base address, and the handler address associated with the control information output from the interrupt controller is specified in the handler address table. Microcontroller.
前記第2の記憶手段は、複数の割込ハンドラのそれぞれを、前記制御情報によって特定される順に、予め用意された固定サイズの個別領域のそれぞれに格納するハンドラ格納領域を有し、
前記ベースアドレスは、前記第2の記憶手段における前記ハンドラ格納領域の格納位置を示すアドレスであり、
前記CPUは、
(b−2)前記ベースアドレスに基づいて、前記制御情報によって特定される順と、前記ハンドラ格納領域において前記割込ハンドラのそれぞれを格納する個別領域の固定サイズから前記ハンドラアドレスを特定する
請求項1記載のマイクロコントローラ。
The second storage means has a handler storage area for storing each of the plurality of interrupt handlers in each of the fixed-size individual areas prepared in the order specified by the control information,
The base address is an address indicating a storage position of the handler storage area in the second storage means,
The CPU
(B-2) The handler address is specified based on the base address based on the order specified by the control information and a fixed size of an individual area for storing each of the interrupt handlers in the handler storage area. 1. The microcontroller according to 1.
複数の割込要因による割込要求に応じて割込ハンドラを実行するマイクロコントローラであって、
前記割込要求の入力に応じて、割込要求と、前記割込要因に予め対応付けられた第1又は第2の制御情報と、前記割込要因に予め対応づけられたハンドラアドレス特定方式情報とを出力する割込コントローラと、
前記割込コントローラから出力された割込要求に応じて、前記第1の割込ハンドラ又は前記第2の割込ハンドラを取得して実行するCPUと、
前記第1の割込ハンドラの格納位置を示すアドレスである第1のハンドラアドレスを特定するために用いられる第1のベースアドレスと、前記第2の割込ハンドラの格納位置を示すアドレスである第2のハンドラアドレスを特定するために用いられる第2のベースアドレスを記憶する第1の記憶手段と、
複数の前記第1の割込ハンドラのそれぞれを前記第1の制御情報によって特定される順に予め用意された固定サイズの個別領域のそれぞれに格納する第1の割込ハンドラ格納領域と、前記第2の制御情報と前記第2のハンドラアドレスとを予め対応付けたハンドラアドレステーブルを格納するテーブル記憶領域と、前記第1の割込ハンドラを格納する第1の割込ハンドラ格納領域とを有する第2の記憶手段とを備え、
前記CPUから前記第1の記憶手段に対するアクセス時間は、前記CPUから前記第2の記憶手段に対するアクセス時間よりも短く、かつ、
前記CPUは、
(A)前記ハンドラアドレス特定方式情報が直接分岐方式を示す場合には、
(a)前記割込コントローラから出力された割込要求に応じて、前記第1の記憶手段にアクセスして前記第1のベースアドレスを取得し、
(b−2)前記第1のベースアドレスに基づいて、前記第1の制御情報によって特定される順と、前記第1のハンドラ格納領域において前記割込ハンドラのそれぞれを格納する個別領域の固定サイズから前記第1のハンドラアドレスを特定し、
(c)特定された第1のハンドラアドレスに基づいて前記第2の記憶手段にアクセスして前記第1の割込ハンドラを実行する、
(B)前記ハンドラアドレス特定方式情報がテーブル参照方式を示す場合には、
(a)前記割込コントローラから出力された割込要求に応じて、前記第1の記憶手段にアクセスして前記第2のベースアドレスを取得し、
(b−1)前記第2のベースアドレスに基づいて前記ハンドラアドレステーブルを参照し、当該ハンドラアドレステーブルにおいて前記割込コントローラから出力された前記第2の制御情報と対応づけられた前記第2のハンドラアドレスを特定し、
(c)特定された第2のハンドラアドレスに基づいて前記第2の記憶手段にアクセスして前記第2の割込ハンドラを実行する、
マイクロコントローラ。
A microcontroller that executes an interrupt handler in response to an interrupt request caused by multiple interrupt factors,
In response to the input of the interrupt request, the interrupt request, the first or second control information associated in advance with the interrupt factor, and the handler address specifying method information associated in advance with the interrupt factor An interrupt controller that outputs
CPU that acquires and executes the first interrupt handler or the second interrupt handler in response to an interrupt request output from the interrupt controller;
A first base address used to specify a first handler address which is an address indicating a storage location of the first interrupt handler, and an address indicating a storage location of the second interrupt handler. First storage means for storing a second base address used to identify the two handler addresses;
A first interrupt handler storage area for storing each of the plurality of first interrupt handlers in a fixed-size individual area prepared in advance in the order specified by the first control information; A table storage area that stores a handler address table that associates the control information with the second handler address in advance, and a first interrupt handler storage area that stores the first interrupt handler. Storage means,
The access time from the CPU to the first storage means is shorter than the access time from the CPU to the second storage means, and
The CPU
(A) When the handler address specifying method information indicates a direct branch method,
(A) In response to the interrupt request output from the interrupt controller, the first storage means is accessed to obtain the first base address,
(B-2) Based on the first base address, the order specified by the first control information, and the fixed size of the individual area for storing each of the interrupt handlers in the first handler storage area Identifying the first handler address from
(C) accessing the second storage means based on the identified first handler address to execute the first interrupt handler;
(B) When the handler address specifying method information indicates a table reference method,
(A) In response to the interrupt request output from the interrupt controller, the first storage means is accessed to obtain the second base address;
(B-1) Refers to the handler address table based on the second base address, and the second address associated with the second control information output from the interrupt controller in the handler address table. Identify the handler address,
(C) accessing the second storage means based on the identified second handler address to execute the second interrupt handler;
Microcontroller.
前記第1の記憶手段は、レジスタであり、
前記第2の記憶手段は、前記レジスタよりも前記CPUによるアクセス時間が長いメモリである
請求項1乃至4いずれか1項記載のマイクロコントローラ。
The first storage means is a register;
The microcontroller according to any one of claims 1 to 4, wherein the second storage unit is a memory having a longer access time by the CPU than the register.
前記テーブル記憶領域と、前記第1の割込ハンドラ格納領域と、前記第2の割込ハンドラ格納領域が同一のアドレス空間上にある
請求項4記載のマイクロコントローラ。
The microcontroller according to claim 4, wherein the table storage area, the first interrupt handler storage area, and the second interrupt handler storage area are on the same address space.
前記制御情報は優先度である
請求項1乃至3いずれか1項記載のマイクロコントローラ。
The microcontroller according to any one of claims 1 to 3, wherein the control information is a priority.
前記第制御情報は割込要因の識別子である
請求項1乃至3いずれか1項記載のマイクロコントローラ。
The microcontroller according to any one of claims 1 to 3, wherein the control information is an identifier of an interrupt factor.
前記制御情報はハンドラ識別子である
請求項1乃至3いずれか1項記載のマイクロコントローラ。
The microcontroller according to any one of claims 1 to 3, wherein the control information is a handler identifier.
前記第2の制御情報は割込要因の識別子である
請求項4又は6記載のマイクロコントローラ。
The microcontroller according to claim 4 or 6, wherein the second control information is an identifier of an interrupt factor.
複数の割込要因に共通のハンドラ識別子が予め対応付けられ、
前記第2の記憶手段は、前記ハンドラ識別子に対応する格納領域に、割込要因毎に異なる他のハンドラへさらに分岐する処理を前記CPUに実行させるハンドラを格納する
請求項9記載のマイクロコントローラ。
A common handler identifier is associated with a plurality of interrupt factors in advance,
The microcontroller according to claim 9, wherein the second storage unit stores a handler that causes the CPU to execute a process of further branching to another handler that differs for each interrupt factor in a storage area corresponding to the handler identifier.
前記第2の記憶手段は、複数のハンドラ識別子に対応する連続する格納領域に1つのハンドラを格納し、
前記複数のハンドラ識別子のうち、前記連続する格納領域の先頭領域に対応するハンドラの識別子のみが、所定の割込要因と対応付けられる
請求項9又は11記載のマイクロコントローラ。
The second storage means stores one handler in a continuous storage area corresponding to a plurality of handler identifiers,
The microcontroller according to claim 9 or 11, wherein among the plurality of handler identifiers, only the identifier of the handler corresponding to the head area of the continuous storage area is associated with a predetermined interrupt factor.
CPUが、
割込コントローラから割込要因に対応する制御情報を入力するステップと、
第1の記憶手段からベースアドレスを取得するステップと、
前記ベースアドレス及び前記制御情報に基づいて、第2の記憶手段におけるハンドラの格納位置であるハンドラアドレスを特定するステップと、を有し、
前記CPUから前記第1の記憶手段に対するアクセス時間は、前記CPUから前記第2の記憶手段に対するアクセス時間よりも短い
ハンドラアドレス特定方法。
CPU
A step of inputting control information corresponding to the interrupt factor from the interrupt controller;
Obtaining a base address from the first storage means;
Identifying a handler address which is a storage location of the handler in the second storage means based on the base address and the control information,
The handler address specifying method, wherein an access time from the CPU to the first storage means is shorter than an access time from the CPU to the second storage means.
前記ベースアドレスは、前記第2の記憶手段における、前記制御情報と前記ハンドラアドレスとを予め対応付けたハンドラアドレステーブルの格納位置を示すアドレスである
請求項13記載のハンドラアドレス特定方法。
The handler address specifying method according to claim 13, wherein the base address is an address indicating a storage position of a handler address table in which the control information and the handler address are associated in advance in the second storage unit.
前記第2の記憶手段は、複数の割込ハンドラのそれぞれを、前記制御情報によって特定される順に、予め用意された固定サイズの個別領域のそれぞれに格納するハンドラ格納領域を有し、
前記ベースアドレスは、前記第2の記憶手段における前記ハンドラ格納領域の格納位置を示すアドレスである
請求項13記載のハンドラアドレス特定方法。
The second storage means has a handler storage area for storing each of the plurality of interrupt handlers in each of the fixed-size individual areas prepared in the order specified by the control information,
The handler address specifying method according to claim 13, wherein the base address is an address indicating a storage position of the handler storage area in the second storage means.
CPUが、
割込コントローラから、割込要因に対応する第1又は第2の制御情報と、前記割込要因に対応するハンドラアドレス特定方式情報とを入力するステップと、
(A)前記ハンドラアドレス特定方式情報が直接分岐方式を示す場合、
第1の記憶手段から第1のベースアドレスを取得するステップと、
前記第1のベースアドレス及び前記第1の制御情報に基づいて、第2の記憶手段における第1のハンドラ格納領域から第1のハンドラの格納位置である第1のハンドラアドレスを特定するステップと、
(B)前記ハンドラアドレス特定方式情報がテーブル参照方式を示す場合、
第1の記憶手段から第2のベースアドレスを取得するステップと、
前記第2のベースアドレス及び前記第2の制御情報に基づいて、ハンドラアドレステーブルから第2のハンドラアドレスを特定するステップと、を有し、
前記第1のハンドラ格納領域は、前記第1のハンドラをそれぞれ格納するための固定サイズの個別領域に前記第1の制御情報に基づく順序で格納し、
前記第1のベースアドレスは、前記第2の記憶手段における前記第1のハンドラ格納領域の格納位置を示すアドレスであり、
前記ハンドラアドレステーブルは、前記第2の制御情報と前記第2のハンドラアドレスとを予め対応付けたテーブルであり、
前記第2のベースアドレスは、前記第2の記憶手段におけるハンドラアドレステーブルの格納位置を示すアドレスであり、
前記CPUから前記第1の記憶手段に対するアクセス時間は、前記CPUから前記第2の記憶手段に対するアクセス時間よりも短い
ハンドラアドレス特定方法。
CPU
Inputting from the interrupt controller the first or second control information corresponding to the interrupt factor and the handler address specifying method information corresponding to the interrupt factor;
(A) When the handler address specifying method information indicates a direct branch method,
Obtaining a first base address from a first storage means;
Identifying a first handler address that is a storage location of the first handler from a first handler storage area in a second storage means based on the first base address and the first control information;
(B) When the handler address specifying method information indicates a table reference method,
Obtaining a second base address from the first storage means;
Identifying a second handler address from a handler address table based on the second base address and the second control information,
The first handler storage area is stored in an order based on the first control information in a fixed-size individual area for storing the first handler,
The first base address is an address indicating a storage position of the first handler storage area in the second storage means,
The handler address table is a table in which the second control information and the second handler address are associated with each other in advance.
The second base address is an address indicating a storage position of a handler address table in the second storage means,
The handler address specifying method, wherein an access time from the CPU to the first storage means is shorter than an access time from the CPU to the second storage means.
前記第1の記憶手段は、レジスタであり、
前記第2の記憶手段は、前記レジスタよりも前記CPUによるアクセス時間が長いメモリである
請求項13乃至16いずれか1項記載のハンドラアドレス特定方法。
The first storage means is a register;
The handler address specifying method according to any one of claims 13 to 16, wherein the second storage unit is a memory having a longer access time by the CPU than the register.
前記第1の制御情報はハンドラ識別子であり、
複数の割込要因に共通のハンドラ識別子が予め対応付けられ、
前記第2の記憶手段は、前記ハンドラ識別子に対応する格納領域に、割込要因毎に異なる他のハンドラへさらに分岐する処理を前記CPUに実行させるハンドラを格納する
請求項16記載のハンドラアドレス特定方法。
The first control information is a handler identifier;
A common handler identifier is associated with a plurality of interrupt factors in advance,
17. The handler address specification according to claim 16, wherein the second storage means stores a handler that causes the CPU to execute a process of further branching to another handler that differs for each interrupt factor in a storage area corresponding to the handler identifier. Method.
前記第2の記憶手段は、複数のハンドラ識別子に対応する連続する格納領域に1つのハンドラを格納し、
前記複数のハンドラ識別子のうち、前記連続する格納領域の先頭領域に対応するハンドラの識別子のみが、所定の割込要因と対応付けられる
請求項18記載のハンドラアドレス特定方法。
The second storage means stores one handler in a continuous storage area corresponding to a plurality of handler identifiers,
The handler address specifying method according to claim 18, wherein, among the plurality of handler identifiers, only the identifier of the handler corresponding to the head area of the continuous storage area is associated with a predetermined interrupt factor.
コンピュータに、請求項13乃至19のいずれか1項記載の方法を実行させるためのプログラム。   A program for causing a computer to execute the method according to any one of claims 13 to 19.
JP2012229148A 2012-10-16 2012-10-16 Microcontroller, handler address specification method and program Pending JP2014081783A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2012229148A JP2014081783A (en) 2012-10-16 2012-10-16 Microcontroller, handler address specification method and program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2012229148A JP2014081783A (en) 2012-10-16 2012-10-16 Microcontroller, handler address specification method and program

Publications (1)

Publication Number Publication Date
JP2014081783A true JP2014081783A (en) 2014-05-08

Family

ID=50785925

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2012229148A Pending JP2014081783A (en) 2012-10-16 2012-10-16 Microcontroller, handler address specification method and program

Country Status (1)

Country Link
JP (1) JP2014081783A (en)

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06324884A (en) * 1993-05-13 1994-11-25 Mitsubishi Electric Corp Data processor
JPH08320796A (en) * 1994-09-09 1996-12-03 Hitachi Ltd Data processor
JP2003162418A (en) * 2001-11-28 2003-06-06 Denso Corp Interrupt-activation method and information processor
JP2005267640A (en) * 2004-03-18 2005-09-29 Arm Ltd Method and device for calling function

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH06324884A (en) * 1993-05-13 1994-11-25 Mitsubishi Electric Corp Data processor
JPH08320796A (en) * 1994-09-09 1996-12-03 Hitachi Ltd Data processor
JP2003162418A (en) * 2001-11-28 2003-06-06 Denso Corp Interrupt-activation method and information processor
JP2005267640A (en) * 2004-03-18 2005-09-29 Arm Ltd Method and device for calling function

Similar Documents

Publication Publication Date Title
US9442870B2 (en) Interrupt priority management using partition-based priority blocking processor registers
JP5894496B2 (en) Semiconductor device
JP5498505B2 (en) Resolving contention between data bursts
US20140244981A1 (en) Processor and control method for processor
US7328295B2 (en) Interrupt controller and interrupt controlling method for prioritizing interrupt requests generated by a plurality of interrupt sources
JP2017091544A (en) Method, processing unit, and design structure for handling interrupts in processing unit using virtual processor thread groups
US20160275028A1 (en) Semiconductor device
JP4855864B2 (en) Direct memory access controller
US9697118B1 (en) Memory controller with interleaving and arbitration scheme
US20080168203A1 (en) Data Processing System With Interrupt Controller and Interrupt Controlling Method
JP5108690B2 (en) DMA apparatus and DMA transfer method
JP2014081783A (en) Microcontroller, handler address specification method and program
KR101306670B1 (en) Memory control device and method for controlling same
JP2010044645A (en) Data transfer device, and data transfer method
JP2009288978A (en) Multiple interrupt processor
US20140317627A1 (en) Scheduling apparatus and method of dynamically setting the size of a rotating register
US20150100759A1 (en) Pipelined finite state machine
US7952505B2 (en) Semiconductor device and input selection control method
JP2007026091A (en) Interrupt control circuit and its control method
JP5644197B2 (en) Computer system and interrupt request processing method
US11429437B2 (en) System for arbitrating between multiple flows
US11030127B2 (en) Multi-threaded architecture for memory controller data paths
JP2013161367A (en) Information processing apparatus and control method thereof
JPH0969072A (en) Memory mapped i/o control circuit
JP2015014934A (en) Memory controller and memory control method

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20150820

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20160531

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20160607

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20170207