JP2005157537A - Memory access monitoring device - Google Patents
Memory access monitoring device Download PDFInfo
- Publication number
- JP2005157537A JP2005157537A JP2003392167A JP2003392167A JP2005157537A JP 2005157537 A JP2005157537 A JP 2005157537A JP 2003392167 A JP2003392167 A JP 2003392167A JP 2003392167 A JP2003392167 A JP 2003392167A JP 2005157537 A JP2005157537 A JP 2005157537A
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- memory access
- register
- frame area
- instruction code
- 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
Links
Images
Abstract
Description
本発明は、他の命令セットアーキテクチャのプログラム(オブジェクト)を自身の命令セットに動的に変換するバイナリートラスレーションに関し、特に、メモリアクセス命令の削除を効率的に行なうことが可能なバイナリートランスレーション用のメモリアクセス監視装置に関する。 The present invention relates to binary translation that dynamically converts a program (object) of another instruction set architecture into its own instruction set, and in particular, for binary translation capable of efficiently deleting memory access instructions. The present invention relates to a memory access monitoring apparatus.
近年発表されたプロセッサにおいては、斬新なアーキテクチャを採用することで大幅な性能向上を目指す動きも活発化している。その1つとして、動的なコード変換技術であるバイナリートランスレーションを挙げることができる。このバイナリートランスレーションは、コンパイラが出力する実行コードとマイクロコンピュータが実行する命令との間の自由度を高め、マイクロコントローラの視点においては、コード互換性という過去の遺産によるしがらみから開放する手段を提供するものである。 In recent years, processors that have been announced in recent years have been actively moving toward a significant performance improvement by adopting a novel architecture. One example is binary translation, which is a dynamic code conversion technique. This binary translation increases the degree of freedom between the executable code output by the compiler and the instructions executed by the microcomputer, and provides a means to free from the legacy of the legacy of code compatibility from the microcontroller's point of view. To do.
このようなバイナリートランスレーション技術において、スケジューラが自由に命令の順番を移動させることができれば、それだけよい命令コードを生成することができる。この命令を移動させることの最大の制約は、メモリ演算間の潜在的な依存性から生じる。すなわち、実際にはメモリ演算間に依存関係がない場合であっても、マイクロコンピュータによってアクセスされるアドレスが実行時にしか分からないため、安全のためにメモリアクセス命令の順番を入れ替えたり、削除したりすることはできない。 In such a binary translation technique, if the scheduler can freely move the order of instructions, a better instruction code can be generated. The biggest constraint on moving this instruction arises from potential dependencies between memory operations. In other words, even if there is actually no dependency between memory operations, the address accessed by the microcomputer is known only at the time of execution, so the order of memory access instructions can be changed or deleted for safety. I can't do it.
たとえば、ロード命令をストア命令の前に移動できると、パイプライン処理など、多くの場合は良い結果が得られる。しかし、ロード命令によって、たまたま先行するストア命令によって書込まれたデータを読出すという事態が生じると、命令の順番を入れ替えることによって不正となってしまう。命令実行時以外にこれを検出することが困難であるため、トランスレータは、過度に保守的な変換しかできなくなる。 For example, if the load instruction can be moved before the store instruction, good results are obtained in many cases, such as pipeline processing. However, if the load instruction happens to read the data written by the preceding store instruction, it becomes illegal by changing the order of the instructions. Since it is difficult to detect this except during instruction execution, the translator can only perform an excessively conservative conversion.
しかしながら、簡単なハードウェアを付加することによってこの問題を解決することができる。トランスレータは、ロード命令をストア命令よりも前に移動する場合、ロード命令をプロテクトロードという命令に変換する。そして、データをロードするのに加えて、アドレス、ロードされるデータのサイズなどをロードプロテクトテーブルに記憶する。 However, this problem can be solved by adding simple hardware. When the translator moves the load instruction before the store instruction, the translator converts the load instruction into a protect load instruction. In addition to loading the data, the address, the size of the loaded data, and the like are stored in the load protect table.
そして、ストア命令をロードプロテクトテーブルをチェックするストア命令に変換する。ストア命令は、データをストアするのに加えて、ロードプロテクトテーブルをチェックする。チェックした結果、以前ロードしたデータを上書きするという事態が生じた場合には例外を発生して、ある時点から命令を再実行することで、正確なプログラム実行を継続して行なうことができる。これについて、簡単に説明する。 Then, the store instruction is converted into a store instruction for checking the load protect table. In addition to storing data, the store instruction checks the load protect table. As a result of checking, if a situation occurs in which previously loaded data is overwritten, an exception is generated, and by executing the instruction again from a certain point, accurate program execution can be continued. This will be briefly described.
命令実行時に例外が発生せずに、命令の順番がオリジナルの命令と同じ状態になっている時点まで到達すると、特別な命令によってそれまでの作業を確定する。この特別な命令をコミットと呼び、作業を確定した時点をコミットした時点と呼ぶ。コミット後に、例外が発生した場合には、最後にコミットした時点まで戻ることで実行を保証する。再実行のためには、コミット時点のレジスタ値をシャドウレジスタに保持したり、コミット後のメモリへの書込みを遅らせたりする機構(ストアバッファ)が必要になる。 If no exception occurs during the execution of the instruction and the instruction reaches the point where the order of the instructions is the same as the original instruction, the work up to that point is determined by a special instruction. This special command is called commit, and the time when the work is confirmed is called the commit time. If an exception occurs after committing, execution is guaranteed by returning to the point of last commit. For re-execution, a mechanism (store buffer) that holds the register value at the time of commit in the shadow register or delays writing to the memory after commit is required.
これに関連する技術として、特開2002−312180号公報に開示された発明がある。このプロセッサシステムにおいては、元命令列解釈実行処理流、命令変換・最適化処理流と元命令列先読み処理流を独立させ、チップマルチプロセッサ形式や、1個の命令実行制御部で同時に複数の処理流を実行する形式でプロセッサを構成して、複数処理流を並列処理する。さらに、命令変換・最適化処理流は、複数処理流を生成する形で変換後命令列を構成し、元命令列解釈実行処理流は、各命令解釈実行時に命令変換・最適化処理流に生成された当該命令に対応する変換後命令列が存在する場合にこれを実行する。
上述したロードプロテクトテーブルを用いたハードウェアにおいては、保護する命令がすべて記述され、明示的に命令によって記憶された情報を無効にして処理が進められる。マイクロコンピュータは性能を重視するため、保護された命令を記憶する数(エントリ数)が多くても、ハードウェア規模の多少の増加を問題にしない場合が多い。しかし、ハードウェア規模の増大は、消費電力や、生産コストの増加に直接結びつく。マイクロコントローラにおいては、ハードウェアの増加をできるだけ避けたいため、性能を犠牲にせざるを得ないという問題点があった。 In the hardware using the load protection table described above, all the instructions to be protected are described, and the processing proceeds with invalid information stored by the instructions explicitly. Since microcomputers place emphasis on performance, even if the number of protected instructions stored (number of entries) is large, there is often no problem with a slight increase in hardware scale. However, an increase in hardware scale directly leads to an increase in power consumption and production costs. In the microcontroller, there is a problem that performance must be sacrificed in order to avoid an increase in hardware as much as possible.
また、高級言語などをコンパイルして得られるアセンブラにおいては、一般に、フレーム領域(スタック領域)を一時的にデータを保持するために使用し、グローバルな変数を保持する領域とは分離している場合が多い。フレーム領域を使用する理由のほとんどは、汎用レジスタの不足によるものである。これに対して、汎用レジスタの数が豊富なマイクロプロセッサでトランスレーションコードを実行する場合、データをレジスタに保持できるため、メモリアクセスが不要になることが多い。 In an assembler obtained by compiling a high-level language, etc., the frame area (stack area) is generally used to temporarily hold data and is separated from the area that holds global variables. There are many. Most of the reason for using the frame area is due to the lack of general purpose registers. On the other hand, when the translation code is executed by a microprocessor having a large number of general-purpose registers, data can be held in the registers, so that memory access is often unnecessary.
ロードプロテクトテーブルだけしかない場合、上述した最適化を行なうときに、メモリアクセス命令の削除が可能になる訳ではない。たとえば、オリジナルのコードが一時的な値をフレーム領域に保持し、その値が必要になるたびにフレーム領域から読出す場合を考える。レジスタに値を保持できるのであれば、メモリへの書込み、メモリからの読出しは必要なくなるので、これらのメモリアクセス命令を削除することができる。しかし、他のメモリアクセス命令が、その値を参照していないという保証はない。ロードプロテクト機能を有している場合でも、メモリアクセス命令が削除されればロードプロテクトテーブルには登録されないので、少なくともストア命令を削除することはできない。 If there is only a load protect table, it is not possible to delete a memory access instruction when performing the optimization described above. For example, consider a case where the original code holds a temporary value in the frame area and reads it from the frame area each time that value is needed. If the value can be held in the register, writing to the memory and reading from the memory are not necessary, and these memory access instructions can be deleted. However, there is no guarantee that other memory access instructions do not reference the value. Even when the load protect function is provided, if the memory access instruction is deleted, it is not registered in the load protect table, so at least the store instruction cannot be deleted.
また、その保証のためだけに、不要なメモリアクセス命令が残るだけでなく、その命令を残すことによってロードプロテクトテーブルのエントリを使用しなければならず、大きなテーブルが必要になる。したがって、ハードウェアの規模が増大するが、それにもかかわらずメモリアクセスの最適化がある程度しかできないといった問題点があった。 Further, not only an unnecessary memory access instruction remains for the guarantee, but also the entry of the load protection table must be used by leaving the instruction, and a large table is required. Therefore, although the scale of hardware increases, there is a problem that memory access can be optimized only to some extent.
本発明は、上記問題点を解決するためになされたものであり、その目的は、メモリアクセス命令の削除による最適化が自由に行なえ、効率のよいトランスレーションコードを生成することが可能なメモリアクセス監視装置を提供することである。 The present invention has been made in order to solve the above-described problems, and an object of the present invention is to provide a memory access that can be optimized by deleting a memory access instruction and can generate an efficient translation code. It is to provide a monitoring device.
本発明のある局面に従えば、バイナリートランスレーションを実行可能なマイクロコントローラにおけるメモリアクセス監視装置であって、命令コードをデコードし、メモリの特定領域であるフレーム領域をチェックするメモリアクセス命令であるか否かを判定するデコード手段と、フレーム領域を設定するテーブルと、デコード手段によって当該命令コードがフレーム領域をチェックするメモリアクセス命令であると判定され、かつ当該命令コードによってアクセスされるメモリアドレスがテーブルに設定されるフレーム領域内であれば、ヒット信号を生成して出力する生成手段とを含む。 According to one aspect of the present invention, a memory access monitoring device in a microcontroller capable of executing binary translation is a memory access instruction that decodes an instruction code and checks a frame area that is a specific area of the memory. Decoding means for determining whether or not, a table for setting a frame area, and a memory address that is determined by the decoding means to be a memory access instruction for checking the frame area by the instruction code and accessed by the instruction code And generating means for generating and outputting a hit signal.
本発明の別の局面に従えば、バイナリートランスレーションを実行可能なマイクロコントローラにおけるメモリアクセス監視装置であって、命令コードをデコードし、レジスタ相対間接メモリアクセス命令であるか否かを判定するデコード手段と、メモリの特定領域であるフレーム領域を設定するテーブルと、ベースレジスタの番号を格納するレジスタと、デコード手段によって当該命令コードがレジスタ相対間接メモリアクセス命令でないメモリアクセス命令と判定された場合、またはデコード手段によって当該命令コードがレジスタ相対間接メモリアクセス命令であると判定され、かつ当該命令コードのベースレジスタの番号がレジスタに格納されるベースレジスタ番号と一致しない場合に、当該命令コードによってアクセスされるメモリアドレスがテーブルに設定されるフレーム領域内であれば、ヒット信号を生成して出力する生成手段とを含む。 According to another aspect of the present invention, there is provided a memory access monitoring device in a microcontroller capable of executing binary translation, which decodes an instruction code and determines whether it is a register relative indirect memory access instruction. And a table for setting a frame area, which is a specific area of the memory, a register for storing a base register number, and a decoding unit that determines that the instruction code is not a register relative indirect memory access instruction, or When the instruction means determines that the instruction code is a register relative indirect memory access instruction and the base register number of the instruction code does not match the base register number stored in the register, the instruction code accesses the instruction code. Memo If the frame area in which the address is set in the table, and a generating means for generating and outputting a hit signal.
本発明のある局面によれば、生成手段が、デコード手段によって当該命令コードがフレーム領域をチェックするメモリアクセス命令であると判定され、かつ当該命令コードによってアクセスされるメモリアドレスがテーブルに設定されるフレーム領域内であれば、ヒット信号を生成して出力するので、不要となったフレーム領域をアクセスするメモリアクセス命令を削除しても、他のメモリアクセス命令がその削除したメモリアクセス命令と同じアドレスにアクセスすることがないことを保証できるようになった。 According to an aspect of the present invention, the generation unit determines that the instruction code is a memory access instruction for checking the frame area by the decoding unit, and sets a memory address accessed by the instruction code in the table. If it is within the frame area, a hit signal is generated and output, so even if a memory access instruction that accesses a frame area that is no longer needed is deleted, the other memory access instruction has the same address as the deleted memory access instruction. You can now guarantee that you will never have access.
本発明の別の局面によれば、生成手段が、デコード手段によって当該命令コードがレジスタ相対間接メモリアクセス命令でないメモリアクセス命令と判定された場合、またはデコード手段によって当該命令コードがレジスタ相対間接メモリアクセス命令であると判定され、かつ当該命令コードのベースレジスタの番号がレジスタに格納されるベースレジスタ番号と一致しない場合に、当該命令コードによってアクセスされるメモリアドレスがテーブルに設定されるフレーム領域内であれば、ヒット信号を生成して出力するので、フレーム領域テーブルの値と比較する特定のメモリアクセス命令を用意することなく、フレーム領域テーブルを参照するか否かを判断することが可能となった。 According to another aspect of the present invention, when the generation unit determines that the instruction code is not a register relative indirect memory access instruction by the decoding unit, or the instruction unit stores the instruction code in register relative indirect memory access by the decoding unit. If the instruction register is determined to be an instruction and the base register number of the instruction code does not match the base register number stored in the register, the memory address accessed by the instruction code is within the frame area set in the table. If so, a hit signal is generated and output, so it is possible to determine whether or not to refer to the frame area table without preparing a specific memory access instruction to be compared with the value of the frame area table. .
(第1の実施の形態)
図1は、本発明の第1の実施の形態におけるメモリアクセス監視装置の概略構成を示すブロック図である。このメモリアクセス監視装置は、命令コードをデコードするデコーダ1と、命令コードが所定の条件にヒットするか否かを判定し、その判定結果であるヒット信号を生成して出力するヒット信号生成回路2と、メモリアクセスアドレスがフレーム領域内にあるか否かを判定するのに使用されるフレーム領域テーブル3とを含む。なお、本実施の形態においては、マイクロコントローラとメモリアクセス監視装置とが1チップで構成される場合について説明するが、これに限られるものではない。
(First embodiment)
FIG. 1 is a block diagram showing a schematic configuration of a memory access monitoring apparatus according to the first embodiment of the present invention. The memory access monitoring device includes a decoder 1 that decodes an instruction code, a hit
フレーム領域をチェックするか否かの情報は、命令コードに明示されている。デコーダ1は、その情報をデコードすることによってフレーム領域チェック信号を生成し、ヒット信号生成回路2へ出力する。また、デコーダ1は、オペランドのデコード結果をヒット信号生成回路2へ出力する。
Information on whether or not to check the frame area is specified in the instruction code. The decoder 1 decodes the information to generate a frame area check signal and outputs it to the hit
フレーム領域テーブル3は、フレーム領域のアドレスの最大値を保持する最大値レジスタ31と、フレーム領域のアドレスの最小値を保持する最小値レジスタ32と、最大値レジスタ31に保持される最大値とアドレスバス5に出力されたメモリアクセスアドレスとを比較する比較器33と、最小値レジスタ32に保持される最小値とアドレスバス5に出力されたメモリアクセスアドレスとを比較する比較器34とを含む。
The frame area table 3 includes a
比較器33は、アドレスバス5に出力されたメモリアクセスアドレスが、最大値レジスタ31に保持される最大値以下であれば、第1の比較条件一致信号を出力する。図1の例では、その比較一致信号の論理レベルをハイレベル(以下、Hレベルと略す。)とし、メモリアクセスアドレスが最大値レジスタ31に保持される最大値以下の場合、比較器33は、Hレベルを出力し、最大値よりも大きければロウレベル(以下、Lレベルと略す。)を出力する。また、比較器34は、アドレスバス5に出力されたメモリアクセスアドレスが、最小値レジスタ32に保持される最小値以上であれば、第2の比較条件一致信号を出力する。図1の例では、その比較一致信号の論理レベルをHレベルとすると、メモリアクセスアドレスが最大値レジスタ32に保持される最小値以上の場合、比較器34は、Hレベルを出力し、最小値よりも小さければLレベルを出力する。
The
ヒット信号生成回路2は、デコーダ1から出力されたオペランドおよびフレーム領域チェック信号に基づいてフレーム領域のチェックを行なうか否かを示すcheck信号を生成して出力する制御回路21と、ヒット信号出力回路22とを含む。
The hit
制御回路21は、オペランドがメモリアクセス命令を示し、フレーム領域チェック信号がフレーム領域のチェックを行なうことを示す場合に、check信号として所定の論理レベルの信号を出力する。図1の例では、フレーム領域チェック信号がフレーム領域のチェックを行なうことを示す場合、check信号にHレベルを出力する。また、ヒット信号出力回路22は、AND回路で構成され、制御信号21から出力されるcheck信号がHレベルであり、かつ比較器33および34から出力される信号がそれぞれHレベルの場合にヒット信号にHレベルを出力し、それ以外の場合にはヒット信号にLレベルを出力する。
The
なお、上記の構成では比較器33,34からの第1、第2の比較一致信号がHレベルであり、フレーム領域チェックを行なう場合に制御回路21からのcheck信号がHレベルの場合においてAND回路で構成されるヒット信号出力回路22からHレベルのヒット信号が出力される例を示したが、入力あるいは出力の論理レベルを入れ替えることは任意可能であり、例えば、第1、第2の比較一致信号およびフレーム領域チェックを行なう際出力されるcheck信号の論理レベルに応じてヒット信号出力回路22をOR回路、NAND回路もしくはNOR回路のような論理回路への置き換えや、入力の一部の論理レベルを反転入力とした論理回路を適宜用いることが可能である。
In the above configuration, when the first and second comparison coincidence signals from the
また、図1の例では第1の比較一致信号と第2の比較一致信号とはそれぞれヒット信号出力回路22に入力されているが、フレームテーブル領域3内において、AND回路を更に設け第1の比較一致信号と第2の比較一致信号とをそのAND回路に入力し、その出力をヒット信号出力回路22の入力に供給することも可能である。その際ヒット信号出力回路の入力端子数は1端子少なくすることができる。
In the example of FIG. 1, the first comparison match signal and the second comparison match signal are respectively input to the hit
ヒット信号は、マイクロプロセッサ内の例外を発生させる機構に伝達される。ヒット信号がHレベルの場合に例外が発生し、ある時点からの命令の再実行が行なわれる。この命令の再実行は、従来技術で説明したロードプロテクトテーブルで例外が発生した場合の動作と同様である。 The hit signal is communicated to a mechanism that generates an exception in the microprocessor. An exception occurs when the hit signal is at the H level, and the instruction is re-executed from a certain point. The re-execution of this instruction is the same as the operation when an exception occurs in the load protection table described in the prior art.
図2は、本発明の第1の実施の形態におけるフレーム領域テーブル操作命令の一例を示す図である。SET_FPMIN命令は、最小値レジスタ32にフレーム領域のアドレスの最小値をセットするための命令である。SET_FPMAX命令は、最大値レジスタ31にフレーム領域のアドレスの最大値をセットするための命令である。なお、レジスタにセットする値は、SET_FPMINまたはSET_FPMAXのあとに記述される。RESET_FPMIN命令は、最小値レジスタ32をリセットするための命令であり、この命令を実行することによって最小値レジスタ32の全ビットに“1”が設定される。RESET_FPMAX命令は、最大値レジスタ31をリセットするための命令であり、この命令を実行することによって最大値レジスタ31の全ビットに“0”が設定される。
FIG. 2 is a diagram illustrating an example of a frame area table operation command according to the first embodiment of this invention. The SET_FPMIN instruction is an instruction for setting the minimum value of the address of the frame area in the
トランスレーションを開始した時点、またはフレーム領域の変更が生じたときに、これらの命令が実行(トランスレートコードに記述)されることによって、フレーム領域テーブルの最大値や最小値のセットまたはリセットが行なわれる。 These instructions are executed (described in the translation code) when translation starts or when the frame area is changed, so that the maximum or minimum value of the frame area table is set or reset. It is.
デコーダ1は、命令コードがフレーム領域テーブル操作命令であれば、バス4を介して最大値レジスタ31または最小値レジスタ32のセットまたはリセットを行なう。
If the instruction code is a frame area table operation instruction, the decoder 1 sets or resets the
図3は、本発明の第1の実施の形態におけるフレーム領域をチェックするか否かを明示する方法の一例を示す図である。図3(a)は、ワードのロード命令を示しており、左側のニーモニックに示すように、フレーム領域チェック拡張子“.F”を付加することによって明示的に記述される。また、右側の命令コードの構成に示すように、ビット30および31にフレーム領域チェック拡張子が格納される。なお、図3(a)に示すロード命令は、レジスタRbに格納されたベースアドレスにRcに格納された値を加算したアドレスからデータを読出し、そのデータをレジスタRaに格納する命令である。また、図3(b)に示すロード命令は、レジスタRbに格納されたベースアドレスに即値immを加算したアドレスからデータを読出し、そのデータをレジスタRaに格納する命令である。
FIG. 3 is a diagram showing an example of a method for clearly indicating whether or not to check the frame area in the first embodiment of the present invention. FIG. 3A shows a word load instruction, which is explicitly described by adding a frame region check extension “.F” as shown in the left mnemonic. Further, as shown in the configuration of the instruction code on the right side, the frame region check extension is stored in
以上説明したように、本実施の形態におけるメモリアクセス監視装置によれば、メモリアクセス命令がフレーム領域をアクセスする場合に例外を発生させて、ある時点からの命令の再実行を行なうようにしたので、不要となったフレーム領域をアクセスするメモリアクセス命令を削除しても、他のメモリアクセス命令がその削除したメモリアクセス命令と同じアドレスにアクセスすることがないことを保証できるようになった。したがって、メモリアクセス命令の削除による最適化が自由に行なえるようになり、効率のよいトランスレートコードを生成することが可能となった。 As described above, according to the memory access monitoring apparatus of the present embodiment, when a memory access instruction accesses a frame area, an exception is generated and the instruction is re-executed from a certain point in time. Even if a memory access instruction that accesses a frame area that is no longer needed is deleted, it can be assured that no other memory access instruction accesses the same address as the deleted memory access instruction. Therefore, optimization by deleting the memory access instruction can be performed freely, and an efficient translation code can be generated.
また、削除したフレーム領域をアクセスする命令を、ロードプロテクトテーブルで個々に管理する必要がなくなり、ロードプロテクトテーブルを最小限のハードウェアで構成することが可能となった。 In addition, it is no longer necessary to individually manage the instruction for accessing the deleted frame area using the load protect table, and the load protect table can be configured with a minimum amount of hardware.
(第2の実施の形態)
図4は、本発明の第2の実施の形態におけるメモリアクセス監視装置の概略構成を示すブロック図である。このメモリアクセス監視装置は、命令コードをデコードするデコーダ11と、デコーダ11から出力されたレジスタ相対間接信号に基づいてフレーム領域アクセス信号を生成して出力する制御回路23と、ヒット信号出力回路24と、最大値レジスタ31と、最小値レジスタ32と、比較器33および34と、ベースレジスタ番号を保持するベースレジスタ35とを含む。なお、第1の実施の形態と同じ機能を有する構成部分については同じ参照符号を付し、その構成の詳細な説明は繰り返さない。
(Second Embodiment)
FIG. 4 is a block diagram showing a schematic configuration of a memory access monitoring apparatus according to the second embodiment of the present invention. The memory access monitoring device includes a decoder 11 that decodes an instruction code, a
一般に、フレーム領域をアクセスするメモリアクセス命令は、(ベースレジスタの値+即値)をアドレスとする。そのため、同じアドレスをアクセスするか否かは、ベースレジスタの値が変わらない限り、トランスレーション時に判断することができる。また、(ベースレジスタの値+即値)をアドレスとしないメモリアクセス命令は、すべてフレーム領域テーブルの値との比較を行なえば、フレーム領域をアクセスする命令を削除しても、正しい実行が確実に保証できる。 In general, a memory access instruction for accessing a frame area uses (base register value + immediate value) as an address. Therefore, whether to access the same address can be determined at the time of translation as long as the value of the base register does not change. In addition, all memory access instructions that do not use (base register value + immediate value) as an address can be guaranteed to be correctly executed even if the instruction that accesses the frame area is deleted by comparing it with the value in the frame area table. it can.
デコーダ11は、命令コードをデコードし、命令コードが(ベースレジスタの値+即値)をアドレスとするレジスタ相対間接メモリアクセス命令の場合には、たとえばレジスタ相対間接信号にHレベルを出力し、それ以外の場合にはレジスタ相対間接信号にLレベルを出力する。 The decoder 11 decodes the instruction code, and if the instruction code is a register relative indirect memory access instruction whose address is (base register value + immediate value), for example, outputs an H level to the register relative indirect signal. In this case, L level is output to the register relative indirect signal.
制御回路23は、デコーダ11から出力されるレジスタ相対間接信号がHレベルの場合、メモリアクセス命令のレジスタ番号と、ベースレジスタ35に保持されるベースレジスタの番号とを比較する。一致する場合には、このメモリアクセス命令がフレーム領域をアクセスすると判断し、フレーム領域アクセス信号にたとえばHレベルを出力する。
When the register relative indirect signal output from the decoder 11 is at the H level, the
また、デコーダ11から出力されるレジスタ相対間接信号がLレベルの場合、またはレジスタ相対間接信号がHレベルであっても、メモリアクセス命令のレジスタ番号と、ベースレジスタ35に保持されるベースレジスタの番号とが一致しない場合には、このメモリアクセス命令がフレーム領域をアクセスするか否かを判断するためにフレーム領域アクセス信号にたとえばLレベルを出力する。
In addition, when the register relative indirect signal output from the decoder 11 is at the L level, or even when the register relative indirect signal is at the H level, the register number of the memory access instruction and the number of the base register held in the
ヒット信号出力回路24は、図4の例ではフレーム領域アクセス信号を受ける入力を反転入力としたAND回路(つまり、反転入力端子の信号がLレベルで他の端子の入力信号がHレベルのときのみにHレベルのヒット信号を出力する論理回路)で構成され、フレーム領域アクセス信号がHレベルの場合は、比較結果を無効とし、ヒット信号にLレベルを出力する。また、ヒット信号出力回路24は、フレーム領域アクセス信号がLレベルであり、比較器33および34のそれぞれからHレベルが出力される場合は、ヒット信号にHレベルを出力して例外を発生させ、ある時点からの命令の再実行が行なわれる。
In the example of FIG. 4, the hit
図5は、本発明の第1の実施の形態におけるフレーム領域テーブル操作命令の一例を示す図である。SET_FPMIN命令、SET_FPMAX命令、RESET_FPMIN命令およびRESET_FPMAX命令は、図2に示すものと同様である。SET_FP命令は、ベースレジスタ35にレジスタ番号をセットするための命令である。CLR_FP命令は、ベースレジスタ35の値をクリアするための命令であり、この命令を実行することによってベースレジスタ35に(レジスタ数+1)がセットされる。
FIG. 5 is a diagram illustrating an example of a frame area table operation command according to the first embodiment of this invention. The SET_FPMIN instruction, the SET_FPMAX instruction, the RESET_FPMIN instruction, and the RESET_FPMAX instruction are the same as those shown in FIG. The SET_FP instruction is an instruction for setting a register number in the
以上説明したように、本実施の形態におけるメモリアクセス監視装置によれば、第1の実施の形態において説明した効果に加えて、フレーム領域テーブルの値と比較する特定のメモリアクセス命令を用意することなく、フレーム領域テーブルを参照するか否かを判断することができる。したがって、命令フィールドを変更したり、新たな命令を追加することなくフレーム領域を参照するか否かを判断することが可能となった。 As described above, according to the memory access monitoring apparatus of the present embodiment, in addition to the effects described in the first embodiment, a specific memory access instruction to be compared with the value of the frame area table is prepared. It is possible to determine whether or not to refer to the frame area table. Therefore, it is possible to determine whether to refer to the frame area without changing the instruction field or adding a new instruction.
(第3の実施の形態)
本発明の第1および第2の実施の形態においては、フレーム領域テーブルのセットおよびリセットを専用命令を用いて行なうものであったが、本発明の第3の実施の形態においては、メモリアクセス命令にフレーム領域操作用拡張子を付加することによって、メモリアクセスと同時にフレーム領域テーブルの内容の変更を可能とするものである。
(Third embodiment)
In the first and second embodiments of the present invention, the frame area table is set and reset using a dedicated instruction. However, in the third embodiment of the present invention, a memory access instruction By adding a frame area operation extension to the frame area, the contents of the frame area table can be changed simultaneously with memory access.
図6は、本発明の第3の実施の形態におけるメモリアクセス監視装置の概略構成を示すブロック図である。このメモリアクセス監視装置は、命令コードをデコードするデコーダ12と、デコーダ12から出力されたレジスタ相対間接信号に基づいてフレーム領域アクセス信号を生成して出力する制御回路23と、ヒット信号出力回路24と、最大値レジスタ31と、最小値レジスタ32と、比較器33および34と、ベースレジスタ番号を保持するベースレジスタ35とを含む。なお、第2の実施の形態と同じ機能を有する構成部分については同じ参照符号を付し、その構成の詳細な説明は繰り返さない。
FIG. 6 is a block diagram showing a schematic configuration of a memory access monitoring apparatus according to the third embodiment of the present invention. The memory access monitoring device includes a
デコーダ12は、命令コードをデコードし、命令コードが(ベースレジスタの値+即値)をアドレスとするメモリアクセス命令の場合には、レジスタ相対間接信号にHレベルを出力し、それ以外の場合にはレジスタ相対間接信号にLレベルを出力する。また、デコーダ12は、命令コードが、フレーム領域操作用拡張子が付されたメモリアクセス命令であれば、フレーム領域操作用拡張子をデコードし、デコード結果に応じてベースレジスタ35、最大値レジスタ31または最小値レジスタ32へのセット信号を出力すると共に、バス4にレジスタ番号またはメモリアドレスを出力する。
The
図7は、本発明の第3の実施の形態におけるフレーム領域操作用拡張子の一例を示す図である。命令に拡張子“.FMIN”が付されていれば、最小値レジスタ32にフレーム領域のアドレスの最小値がセットされる。命令に拡張子“.FMAX”が付されていれば、最大値レジスタ31にフレーム領域のアドレスの最大値がセットされる。命令に拡張子“.b”が付されていれば、ベースレジスタ35にベースレジスタ番号がセットされる。
FIG. 7 is a diagram illustrating an example of an extension for manipulating a frame area according to the third embodiment of the present invention. If the extension “.FMIN” is attached to the instruction, the minimum value of the address of the frame area is set in the
図8は、本発明の第3の実施の形態におけるフレーム領域操作用拡張子が付された命令の一例を示す図である。図8(a)および図8(b)は、ワードのロード命令を示しており、左側のニーモニックに示すように、フレーム領域操作用拡張子を付加することによって明示的に記述される。なお、拡張子“.F”には、図7に示すフレーム領域操作用拡張子のいずれかが記述される。また、右側の命令コードの構成に示すように、ビット30および31にフレーム領域操作用拡張子が格納される。また、レジスタにセットする値は、フレーム領域操作用拡張子を含む命令コード以降に記述され、たとえば全体として8バイト命令を構成する。
FIG. 8 is a diagram illustrating an example of an instruction with a frame region operation extension according to the third embodiment of the present invention. FIGS. 8A and 8B show a word load instruction, which is explicitly described by adding a frame region operation extension as shown in the left mnemonic. In the extension “.F”, any one of the frame region operation extensions shown in FIG. 7 is described. Further, as shown in the configuration of the instruction code on the right side, the extension for operating the frame area is stored in
たとえば、デコーダ12は、図8(a)に示すロード命令にフレーム領域操作用拡張子“.FMIN”が付されていれば、最小値レジスタ32にセットする値をバス4に出力すると共に、最小値レジスタ32へのセット信号を出力する。また、デコーダ12は、図8(b)に示すロード命令にフレーム領域操作用拡張子“.FMAX”が付されていれば、最大値レジスタ31にセットする値をバス4に出力すると共に、最大値レジスタ31へのセット信号を出力する。さらに、デコーダ12は、図8(a)に示すロード命令にフレーム領域操作用拡張子“.b”が付されていれば、ベースレジスタ35にセットする値をバス4に出力すると共に、ベースレジスタ35へのセット信号を出力する。
For example, if the load instruction shown in FIG. 8A is appended with the extension “.FMIN” for frame region operation, the
以上説明したように、本実施の形態におけるメモリアクセス監視装置によれば、第1および第2の実施の形態において説明した効果に加えて、専用命令の実行による実行サイクルが追加されることなく、フレーム領域テーブルに値をセットすることができる。したがって、実行サイクルを削減した命令コードを生成することが可能となった。 As described above, according to the memory access monitoring device in the present embodiment, in addition to the effects described in the first and second embodiments, an execution cycle due to execution of a dedicated instruction is not added. Values can be set in the frame area table. Therefore, it is possible to generate an instruction code with a reduced execution cycle.
今回開示された実施の形態は、すべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は上記した説明ではなくて特許請求の範囲によって示され、特許請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。 The embodiment disclosed this time should be considered as illustrative in all points and not restrictive. The scope of the present invention is defined by the terms of the claims, rather than the description above, and is intended to include any modifications within the scope and meaning equivalent to the terms of the claims.
1,11,12 デコーダ、2 ヒット信号生成回路、3 フレーム領域テーブル、4 バス、5 アドレスバス、21,23 制御回路、22,24 AND回路、31 最大値レジスタ、32 最小値レジスタ、33,34 比較器、35 ベースレジスタ。 1, 11, 12 decoder, 2 hit signal generation circuit, 3 frame area table, 4 bus, 5 address bus, 21, 23 control circuit, 22, 24 AND circuit, 31 maximum value register, 32 minimum value register, 33, 34 Comparator, 35 base register.
Claims (7)
命令コードをデコードし、メモリの特定領域であるフレーム領域をチェックするメモリアクセス命令であるか否かを判定するデコード手段と、
前記フレーム領域を設定するテーブルと、
前記デコード手段によって当該命令コードがフレーム領域をチェックするメモリアクセス命令であると判定され、かつ当該命令コードによってアクセスされるメモリアドレスが前記テーブルに設定されるフレーム領域内であれば、ヒット信号を生成して出力する生成手段とを含む、メモリアクセス監視装置。 A memory access monitoring device in a microcontroller capable of executing binary translation,
Decoding means for decoding the instruction code and determining whether the instruction is a memory access instruction for checking a frame area which is a specific area of the memory;
A table for setting the frame area;
If the instruction means determines that the instruction code is a memory access instruction for checking the frame area, and the memory address accessed by the instruction code is within the frame area set in the table, a hit signal is generated. And a memory access monitoring device.
前記デコード手段は、前記識別子を参照して当該命令コードがフレーム領域をチェックするメモリアクセス命令であるか否かを判定する、請求項1記載のメモリアクセス監視装置。 The instruction code includes an identifier indicating whether to check the frame area,
The memory access monitoring apparatus according to claim 1, wherein the decoding unit determines whether or not the instruction code is a memory access instruction for checking a frame area with reference to the identifier.
命令コードをデコードし、レジスタ相対間接メモリアクセス命令であるか否かを判定するデコード手段と、
メモリの特定領域であるフレーム領域を設定するテーブルと、
ベースレジスタの番号を格納するレジスタと、
前記デコード手段によって当該命令コードがレジスタ相対間接メモリアクセス命令でないメモリアクセス命令と判定された場合、またはデコード手段によって当該命令コードがレジスタ相対間接メモリアクセス命令であると判定され、かつ当該命令コードのベースレジスタの番号が前記レジスタに格納されるベースレジスタ番号と一致しない場合に、当該命令コードによってアクセスされるメモリアドレスが前記テーブルに設定されるフレーム領域内であれば、ヒット信号を生成して出力する生成手段とを含むメモリアクセス監視装置。 A memory access monitoring device in a microcontroller capable of executing binary translation,
Decoding means for decoding an instruction code and determining whether or not it is a register relative indirect memory access instruction;
A table for setting a frame area which is a specific area of the memory;
A register to store the base register number;
When the decoding means determines that the instruction code is a memory access instruction that is not a register relative indirect memory access instruction, or the decoding means determines that the instruction code is a register relative indirect memory access instruction and the base of the instruction code If the register number does not match the base register number stored in the register and the memory address accessed by the instruction code is within the frame area set in the table, a hit signal is generated and output. And a memory access monitoring device including a generation unit.
前記フレーム領域のアドレスの最大値を格納する第2のレジスタと、
前記メモリアドレスが前記第1のレジスタに格納される最小値以上であるか否かを判定する第1の比較手段と、
前記メモリアドレスが前記第2のレジスタに格納される最大値以下であるか否かを判定する第2の比較手段とを含む、請求項1〜3のいずれかに記載のメモリアクセス監視装置。 The table includes a first register for storing a minimum value of an address of the frame region;
A second register for storing a maximum value of the address of the frame area;
First comparing means for determining whether the memory address is greater than or equal to a minimum value stored in the first register;
4. The memory access monitoring apparatus according to claim 1, further comprising: a second comparison unit that determines whether or not the memory address is equal to or less than a maximum value stored in the second register.
前記デコード手段は、命令コードが前記専用命令であれば、前記テーブルまたは前記レジスタに値を設定する、請求項1〜5のいずれかに記載のメモリアクセス監視装置。 The instruction includes a dedicated instruction for setting a frame area in the table or the register,
The memory access monitoring apparatus according to claim 1, wherein if the instruction code is the dedicated instruction, the decoding unit sets a value in the table or the register.
メモリアクセスと同時に、前記テーブルまたは前記レジスタに設定される値とを含み、
前記デコード手段は、命令コードに前記拡張子が付されていれば、メモリアクセスと同時に、前記テーブルまたは前記レジスタに値を設定する、請求項1〜6のいずれかに記載のメモリアクセス監視装置。 The instruction code includes an extension indicating that the frame area is operated,
A value set in the table or the register simultaneously with the memory access,
The memory access monitoring apparatus according to claim 1, wherein the decoding unit sets a value in the table or the register simultaneously with a memory access if the extension is added to the instruction code.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003392167A JP2005157537A (en) | 2003-11-21 | 2003-11-21 | Memory access monitoring device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003392167A JP2005157537A (en) | 2003-11-21 | 2003-11-21 | Memory access monitoring device |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2005157537A true JP2005157537A (en) | 2005-06-16 |
Family
ID=34718957
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2003392167A Pending JP2005157537A (en) | 2003-11-21 | 2003-11-21 | Memory access monitoring device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2005157537A (en) |
-
2003
- 2003-11-21 JP JP2003392167A patent/JP2005157537A/en active Pending
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US9524163B2 (en) | Computer processor employing hardware-based pointer processing | |
KR101461378B1 (en) | Synchronizing simd vectors | |
JP5335887B2 (en) | Debugging method, control method, and debugging device for authenticating conditional debug instruction based on address | |
JP3872809B2 (en) | Method and apparatus for enhancing scheduling in advanced microprocessors | |
KR100577827B1 (en) | System and method for multiple store buffer forwarding in a system with a restrictive memory model | |
US5347636A (en) | Data processor which efficiently accesses main memory and input/output devices | |
KR101221512B1 (en) | System and method of data forwarding within an execution unit | |
US6289445B2 (en) | Circuit and method for initiating exception routines using implicit exception checking | |
US5016169A (en) | Data processor capable of correctly re-executing instructions | |
JP2003510682A5 (en) | ||
TW201706856A (en) | Central processing unit with enhanced instruction set | |
JP4202244B2 (en) | VLIW DSP and method of operating the same | |
US20060095726A1 (en) | Independent hardware based code locator | |
JP2021512400A (en) | Controlling protected tag checking in memory access | |
JP4004915B2 (en) | Data processing device | |
JP7377807B2 (en) | Branch target variants for branch with link instructions | |
US6189093B1 (en) | System for initiating exception routine in response to memory access exception by storing exception information and exception bit within architectured register | |
JP2007206933A (en) | Information processor, boot loader generation method and program transfer method in information processor | |
CN111984317A (en) | System and method for addressing data in a memory | |
US8484446B2 (en) | Microprocessor saving data stored in register and register saving method | |
JP2009020695A (en) | Information processing apparatus and system | |
JP2005157537A (en) | Memory access monitoring device | |
JP4545777B2 (en) | Data processing device | |
KR100802686B1 (en) | System and method for low overhead boundary checking of java arrays | |
JP5822848B2 (en) | Exception control method, system and program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Effective date: 20061114 Free format text: JAPANESE INTERMEDIATE CODE: A621 |
|
A977 | Report on retrieval |
Effective date: 20090722 Free format text: JAPANESE INTERMEDIATE CODE: A971007 |
|
A131 | Notification of reasons for refusal |
Effective date: 20090825 Free format text: JAPANESE INTERMEDIATE CODE: A131 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20091222 |