JP2005018434A - Microprocessor - Google Patents

Microprocessor Download PDF

Info

Publication number
JP2005018434A
JP2005018434A JP2003182694A JP2003182694A JP2005018434A JP 2005018434 A JP2005018434 A JP 2005018434A JP 2003182694 A JP2003182694 A JP 2003182694A JP 2003182694 A JP2003182694 A JP 2003182694A JP 2005018434 A JP2005018434 A JP 2005018434A
Authority
JP
Japan
Prior art keywords
instruction
decryption
encrypted
decoding
microprocessor
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
JP2003182694A
Other languages
Japanese (ja)
Inventor
Miyuki Hori
みゆき 堀
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.)
Toshiba Corp
Original Assignee
Toshiba 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 Toshiba Corp filed Critical Toshiba Corp
Priority to JP2003182694A priority Critical patent/JP2005018434A/en
Publication of JP2005018434A publication Critical patent/JP2005018434A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a microprocessor which can execute a pipeline process of an encrypted command while preventing generation of a stall. <P>SOLUTION: After stored in a command register 111 of a command fetch part 11, the encrypted command sent from a command ROM 2 to the microprocessor 1 is decoded by an encrypted command decoding part 112 and the decoded command is held by a decoded command register 113. Then, the decoded command held by the decoded command register 113 is input to a command decoding part 12 via a selector 114 and a command cache 115 and decoded and calculation process is executed by a calculation executing part 13. Thus, the pipeline process of command queue encrypted command is sequentially executed by the command fetch part 11, the command decoding part 12 and the calculation executing part 13 in parallel. <P>COPYRIGHT: (C)2005,JPO&NCIPI

Description

【0001】
【発明の属する技術分野】
本発明は、マイクロプロセッサに関し、特にパイプライン処理を行うマイクロプロセッサに関する。
【0002】
【従来の技術】
マイクロプロセッサの高速化技術の一つにパイプライン処理がある。パイプライン処理では、命令の実行をいくつかのステージに分け、複数の命令を少しずつ時間をずらして同時並行的に実行する。これにより、複数のステージを並列に動作させることができ、マイクロプロセッサの処理効率が向上する。このとき、総てのステージを常に並列に動作させることができれば、高い処理効率が得られる。
【0003】
一方、マイクロプロセッサに与えられる命令が、ソフトウェアの機密保護等の目的で暗号化されることがある。この場合、マイクロプロセッサの外部にある命令ROMに格納される命令(オブジェクトコード)が暗号化されているため、マイクロプロセッサでこの命令を実行するためには、マイクロプロセッサの内部で暗号化されたコードを暗号化される前の元のコードに戻す復号化を行わなければならない。
【0004】
図7(a)に、この暗号化された命令の復号化のステージを含むパイプライン処理のステージ構成の一例を示す。この例では、命令は、命令フェッチ(F)、暗号化命令の復号化(DA)、命令のデコード(DB)、演算の実行(E)、データキャッシュアクセス(M)、結果の書き込み(W)の6つのステージで順次処理されて行く。ここで、暗号化命令の復号化(DA)ステージと命令のデコード(DB)ステージは、マイクロプロセッサのデコード部で実行される。
【0005】
図7(b)に、複数の暗号化された命令である暗号化命令1、暗号化命令2、・・・が、上述の6つのステージで順次パイプライン処理されている様子を示す。この場合、暗号化命令の復号化(DA)ステージと命令のデコード(DB)ステージがデコード部で実行されているため、暗号化命令1の処理が演算の実行(E)ステージに移行しないと、暗号化命令2の暗号化命令の復号(DA)ステージの実行が開始できない。そのため、暗号化命令の復号化(DA)ステージの前でパイプラインの停止(ストール)が発生する(サイクル3)。
【0006】
同様に、暗号化命令3では、サイクル4、5でストールが発生し、暗号化命令4では、サイクル5、6、7でストールが発生して、パイプラインの処理効率が低下する。
【0007】
このようにパイプライン処理でストールが発生する要因をハザードと言い、パイプライン処理を行うマイクロプロセッサでは、このハザードに対する対策を考慮する必要がある。
【0008】
その対策の一つとして、通常のステージの他にハザード処理ステージを設け、ハザードの発生を検出したときには、ハザード処理ステージを動作させてパイプライン処理が続行されるようにしたものがある(例えば、特許文献1参照。)。
【0009】
【特許文献1】
特開2000−105698号公報(第7−9頁、図1)
【0010】
【発明が解決しようとする課題】
しかしながら、上述のようなハザード処理を専用に行うステージを設ける方法では、ハザードが発生したときに、マイクロプロセッサの処理に要するステージ数が通常の処理よりも多くなる。
【0011】
そこで、本発明の目的は、ストールの発生を抑えて、暗号化された命令のパイプライン処理が可能なマイクロプロセッサを提供することにある。
【0012】
【課題を解決するための手段】
本発明の一態様によれば、外部から与えられる命令を格納する記憶手段と、前記記憶手段に格納された暗号化命令を復号化する暗号化命令復号化手段と、前記暗号化命令復号化手段により復号化された命令を保持する復号化命令保持手段と、前記記憶手段の出力または前記復号化命令保持手段の出力のいずれかを選択して出力する選択手段を有する命令フェッチ部と、前記命令フェッチ部から出力される命令をデコードする命令デコード手段と、前記命令デコード手段から出力される信号に基づき演算を実行する演算実行手段と、前記命令デコード手段から出力される制御信号により前記暗号化命令復号化手段の復号化の実行を制御するとともに、前記選択手段を制御する復号化制御手段とを具備し、前記命令フェッチ部の前記記憶手段に格納された前記命令が暗号化命令であるときに、前記復号化制御手段が、前記暗号化命令復号化手段に前記暗号化命令の復号化を実行させるとともに、前記選択手段に前記復号化命令保持手段の出力を選択させて出力させることを特徴とするマイクロプロセッサが提供される。
【0013】
【発明の実施の形態】
以下、図面を参照しながら本発明の実施の形態を説明する。
【0014】
(実施の形態)
図1は、本発明の実施の形態に係るマイクロプロセッサの構成を示すブロック図である。
【0015】
マイクロプロセッサ1は、マイクロプロセッサ1の外部にある命令ROM2から読み出された命令をフェッチする命令フェッチ部11と、命令フェッチ部11から出力された命令をデコードするデコード部12と、デコード部12から出力される制御信号により演算を実行する演算実行部13とを含み、さらに、命令ROM2から読み出された命令が暗号化命令であるときに、その暗号化命令の復号化を制御する復号化制御部14を有している。
【0016】
このうち、命令フェッチ部11は、命令ROM2から入力された命令を格納する命令レジスタ111と、命令レジスタ111に格納された命令が暗号化命令であるときは、その復号化を行う暗号化命令復号化部112と、暗号化命令復号化部112で復号化された復号化命令を保持する復号化命令レジスタ113と、命令レジスタ111の出力と復号化命令レジスタ113の出力のいずれかを選択して出力するセレクタ114と、セレクタ114の出力が入力される命令キャッシュ115から構成され、命令キャッシュ115の出力が命令フェッチ部11の出力となる。
【0017】
ここで、一群の暗号化命令の命令列の命令が実行されるときは、その実行の直前に後述する復号化開始命令が実行され、デコード部12から復号化開始信号が復号化制御部14へ出力される。復号化開始信号が入力される(ONにされる)と、復号化制御部14は暗号化命令復号化部112へ復号化の開始を指示する。
【0018】
一方、一群の暗号化命令の命令列の命令の最後には、これも後述する復号化終了命令が実行され、デコード部12から復号化終了信号が復号化制御部14へ出力される。復号化終了信号が入力されると、復号化制御部14は暗号化命令復号化部112へ復号化の終了(OFF)を指示する。。
【0019】
この復号化の開始が指示されている間(ONの間)、暗号化命令復号化部112は、命令レジスタ111に格納されている命令を読み込んで、暗号の復号化を実行する。
【0020】
なお、復号化開始命令には、暗号化に使用した暗号鍵(ユーザ鍵)データが記述されており、デコード部12を介して、このユーザ鍵データが暗号化命令復号化部112へ与えられる。
【0021】
また、セレクタ114も、復号化制御部14から出力される復号化制御信号がONであるときは、命令ROM2から入力された命令を暗号化された命令であるとして、復号化命令レジスタ113の出力を選択して復号化命令を出力する。
【0022】
一方、復号化制御信号がOFFであるときは、命令ROM2から入力された命令を暗号化されていない命令であるとして、セレクタ114は命令レジスタ111に格納された命令をそのまま出力する。
【0023】
図2は、図1の暗号化命令復号化部112の内部構成を示すブロック図である。
【0024】
暗号化命令復号化部112は、復号化制御信号がONのときのみライト信号を出力する書き込み制御回路1121と、書き込み制御回路1121からのライト信号で外部からの命令を書き込む暗号化命令格納レジスタ1122と、復号化制御信号がONのときユーザ鍵データを書き込むユーザ鍵格納レジスタ1123とを有している。
【0025】
また、暗号化命令格納レジスタ1122のデータに対して後述するミラー変換を行うミラー変換回路1124と、ユーザ鍵格納レジスタ1123に格納されたユーザ鍵データを上位桁側にコピーして2倍の長さのデータへ拡張するユーザ鍵拡張回路1125と、ミラー変換回路1124の出力とユーザ鍵拡張回路1125の出力のビットごとの排他的論理和(xor)演算を行うビットごとの排他的論理和(xor)演算回路1126を有しており、ビットごとの排他的論理和(xor)演算回路1126の出力が、復号化命令となる。
【0026】
ここで、暗号化命令復号化部112の復号化のアルゴリズムを説明するが、その前に本実施の形態のマイクロプロセッサの命令の暗号化で用いられている暗号化の方式を説明しておく。
【0027】
図3は、本実施の形態のマイクロプロセッサの命令の暗号化で用いられている暗号化の過程を説明するための図である。以下、暗号化の過程を順を追って説明する。
【0028】
(1)ユーザ専用の暗号鍵である16ビットの長さのユーザ鍵をそのまま2つ並べて32ビットの長さに拡張したユーザ鍵を予め用意する。
【0029】
(2)32ビットの長さの命令(機械語)と、上記32ビットの長さの拡張されたユーザ鍵のビットごとの排他的論理和(xor)演算を行う。
【0030】
ここで、命令の各ビットをIn、拡張されたユーザ鍵のビットをKnと表わし、上記の演算結果をIn xor Knと表わすものとし、この演算結果をユーザ鍵でマスクされた命令と称するものとする。
【0031】
(3)上記ユーザ鍵でマスクされた命令の各ビットのミラー変換を行う。
【0032】
ミラー変換とは、nビット目のデータを(31−n)ビット目のデータと入れ替えるものであり、上記の場合、0ビット目のデータは31ビット目と、1ビット目のデータは30ビット目と、・・・、31ビット目のデータは0ビット目と入れ替えられる。
【0033】
このミラー変換の結果得られたデータが暗号化された命令、すなわち暗号化命令である。
【0034】
次に、暗号化命令復号化部112の復号化のアルゴリズムを説明する。
【0035】
図4は、暗号化命令復号化部112における暗号化命令の復号化の過程を説明するための図である。以下、復号化の過程を順を追って説明する。
【0036】
(1)暗号化命令格納レジスタ1122に格納された暗号化命令をミラー変換回路1124でミラー変換する。
【0037】
この結果、暗号化命令は、上述したユーザ鍵でマスクされた命令に戻る。
【0038】
(2)ユーザ鍵でマスクされた命令とユーザ鍵拡張回路1125で拡張されたユーザ鍵データとの間でビットごとの排他的論理和(xor)演算を行う。
【0039】
このとき、ユーザ鍵でマスクされた命令は、In xor Knと表わされるので、この演算は、(In xor Kn) xor Knと表わされる。この論理式を変形すると、In xor (Kn xor Kn)となる。
【0040】
ここで、同一のデータどうしの排他的論理和(xor)演算は0であるので、(Kn xor Kn)=0となり、上式は、In xor 0=Inとなる。
【0041】
すなわち、この演算により、復号化された命令データInが得られるものである。
【0042】
図5は、本実施の形態のマイクロプロセッサ1に与えられる復号化開始命令および復号化終了命令のフォーマットを示す図である。
【0043】
図5(a)は、復号化開始命令のフォーマットである。復号化開始命令は32ビット長の命令であり、16ビットの復号化開始オペレーション(OP)コードと16ビットのユーザ鍵から構成される。
【0044】
図5(b)は、復号化終了命令のフォーマットである。復号化終了命令は16ビット長の命令であり、16ビットの復号化開始オペレーション(OP)コードからのみ構成される。ただし、復号化終了命令は暗号化された命令の命令列の最後におかれるため、マイクロプロセッサ1に与えられるときは、暗号化された32ビット長の命令となっている。
【0045】
図6は、本実施の形態のマイクロプロセッサ1において、暗号化された命令の命令列である暗号化命令1、暗号化命令2、・・・をパイプライン処理したときのステージの遷移を表わす図である。
【0046】
図6(a)に示すように、マイクロプロセッサ1においては、暗号化命令は、命令フェッチ(Fe)、暗号化命令の復号化(Fu)、命令のデコード(D)、演算の実行(E)、データキャッシュアクセス(M)、結果の書き込み(W)の6つのステージで順次処理される。
【0047】
このうち、命令フェッチ(Fe)ステージと暗号化命令の復号化(Fu)ステージが命令フェッチ部11で処理される。
【0048】
また、命令のデコード(D)ステージはデコード部12で処理され、演算の実行(E)ステージ以降の処理は演算実行部13で処理される。
【0049】
上述のように、マイクロプロセッサ1では、命令フェッチ(Fe)ステージと暗号化命令の復号化(Fu)ステージが命令フェッチ部11で処理されるが、このとき、命令フェッチ(Fe)ステージには命令レジスタ111が用いられ、暗号化命令の復号化(Fu)ステージには復号化命令レジスタ113が用いられる。
【0050】
したがって、本実施の形態のマイクロプロセッサ1においては、命令フェッチ(Fe)ステージでの処理と暗号化命令の復号化(Fu)ステージの処理を同時に並列に行うことができる。
【0051】
そのため、図6(b)に示すように、本実施の形態のマイクロプロセッサ1で暗号化命令の命令列のパイプライン処理を行う場合、各ステージ間でストールが発生することなく、総てのステージを並列に動作させることが可能となる。
【0052】
これより、この図6(b)の例を、従来のパイプライン処理の例の図7(b)と比較すると、例えば、従来12サイクルの間に4個の暗号化命令しか処理できなかったものが、本実施の形態では7個の暗号化命令の処理が実行できるようになる。
【0053】
すなわち、従来に比べて、本実施の形態のマイクロプロセッサ1は、暗号化命令のパイプライン処理のスループットを向上させることができる。
【0054】
【発明の効果】
本発明のマイクロプロセッサによれば、ストールの発生を抑えて、暗号化された命令のパイプライン処理を実行することができる。そのため、暗号化された命令のパイプライン処理のスループットの向上を図ることができる。
【図面の簡単な説明】
【図1】本発明の実施の形態に係るマイクロプロセッサの構成を示すブロック図。
【図2】本発明の実施の形態に係るマイクロプロセッサの暗号化命令復号化部の構成を示すブロック図。
【図3】命令の暗号化の過程を説明するための図。
【図4】本発明の実施の形態に係るマイクロプロセッサにおける暗号化命令の復号化の過程を説明するための図。
【図5】本発明の実施の形態に係るマイクロプロセッサに与えられる復号化開始命令および復号化終了命令のフォーマットを示す図。
【図6】本発明の実施の形態に係るマイクロプロセッサにおけるパイプライン処理を説明するためのステージ遷移図。
【図7】従来のマイクロプロセッサにおけるパイプライン処理を説明するためのステージ遷移図。
【符号の説明】
1 マイクロプロセッサ
2 命令ROM
11 命令フェッチ部
12 デコード部
13 演算実行部
14 復号化制御部
111 命令レジスタ
112 暗号化命令復号化部
113 復号化命令レジスタ
114 セレクタ
115 命令キャッシュ
1121 書き込み制御回路
1122 暗号化命令格納レジスタ
1123 ユーザ鍵格納レジスタ
1124 ミラー変換回路
1125 ユーザ鍵拡張回路
1126 ビットごとの排他的論理和(xor)回路
[0001]
BACKGROUND OF THE INVENTION
The present invention relates to a microprocessor, and more particularly to a microprocessor that performs pipeline processing.
[0002]
[Prior art]
One technique for speeding up microprocessors is pipeline processing. In pipeline processing, the execution of instructions is divided into several stages, and a plurality of instructions are executed in parallel with little time. Thereby, a plurality of stages can be operated in parallel, and the processing efficiency of the microprocessor is improved. At this time, if all the stages can always be operated in parallel, high processing efficiency can be obtained.
[0003]
On the other hand, an instruction given to the microprocessor may be encrypted for the purpose of security protection of software. In this case, since the instruction (object code) stored in the instruction ROM outside the microprocessor is encrypted, in order to execute this instruction by the microprocessor, the code encrypted inside the microprocessor is used. Must be decrypted back to the original code before being encrypted.
[0004]
FIG. 7A shows an example of a stage configuration of pipeline processing including a stage of decryption of the encrypted instruction. In this example, the instruction is instruction fetch (F), decryption of encrypted instruction (DA), instruction decode (DB), operation execution (E), data cache access (M), and result writing (W). The six stages are sequentially processed. Here, the decryption (DA) stage of the encrypted instruction and the decode (DB) stage of the instruction are executed by the decoding unit of the microprocessor.
[0005]
FIG. 7B shows a state where a plurality of encrypted instructions, encryption instruction 1, encryption instruction 2,... Are sequentially pipelined in the above-described six stages. In this case, since the decoding (DA) stage and the instruction decoding (DB) stage of the encrypted instruction are executed in the decoding unit, the processing of the encrypted instruction 1 does not move to the execution (E) stage of the operation. Execution of the decryption (DA) stage of the encryption instruction 2 of the encryption instruction 2 cannot be started. Therefore, the pipeline is stopped (stall) before the decryption (DA) stage of the encrypted instruction (cycle 3).
[0006]
Similarly, in the encryption instruction 3, a stall occurs in cycles 4 and 5, and in the encryption instruction 4, a stall occurs in cycles 5, 6, and 7, and the processing efficiency of the pipeline decreases.
[0007]
A factor that causes a stall in pipeline processing is called a hazard, and a microprocessor that performs pipeline processing needs to take measures against this hazard.
[0008]
One of the countermeasures is that a hazard processing stage is provided in addition to the normal stage, and when the occurrence of a hazard is detected, the hazard processing stage is operated so that pipeline processing is continued (for example, (See Patent Document 1).
[0009]
[Patent Document 1]
JP 2000-105698 A (page 7-9, FIG. 1)
[0010]
[Problems to be solved by the invention]
However, in the method of providing a stage dedicated to the hazard processing as described above, when a hazard occurs, the number of stages required for the processing of the microprocessor becomes larger than that of the normal processing.
[0011]
Accordingly, an object of the present invention is to provide a microprocessor capable of pipelined processing of encrypted instructions while suppressing occurrence of stalls.
[0012]
[Means for Solving the Problems]
According to one aspect of the present invention, storage means for storing an externally applied instruction, encrypted instruction decryption means for decrypting an encrypted instruction stored in the storage means, and the encrypted instruction decryption means An instruction fetch unit having a decoded instruction holding unit that holds an instruction decoded by the output unit; a selection unit that selects and outputs either the output of the storage unit or the output of the decoded instruction holding unit; and the instruction Instruction decoding means for decoding an instruction output from the fetch unit, operation execution means for executing an operation based on a signal output from the instruction decoding means, and the encrypted instruction by a control signal output from the instruction decoding means A decoding control unit for controlling the execution of decoding by the decoding unit and for controlling the selection unit, and storing the storage unit in the instruction fetch unit. And the decryption control means causes the encryption instruction decryption means to decrypt the encrypted instruction and the selection means causes the decryption instruction holding means when the instruction is an encryption instruction. There is provided a microprocessor characterized in that the output is selected and output.
[0013]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, embodiments of the present invention will be described with reference to the drawings.
[0014]
(Embodiment)
FIG. 1 is a block diagram showing a configuration of a microprocessor according to an embodiment of the present invention.
[0015]
The microprocessor 1 includes an instruction fetch unit 11 that fetches an instruction read from the instruction ROM 2 outside the microprocessor 1, a decode unit 12 that decodes an instruction output from the instruction fetch unit 11, and a decode unit 12. A decryption control that controls decryption of the encrypted instruction when the instruction read from the instruction ROM 2 is an encrypted instruction. Part 14.
[0016]
Among these, the instruction fetch unit 11 includes an instruction register 111 that stores an instruction input from the instruction ROM 2, and an encrypted instruction decryption that decrypts the instruction stored in the instruction register 111 when the instruction is stored in the instruction register 111. Selecting one of the output of the decryption instruction register 113 holding the decryption instruction decrypted by the encryption section 112, the encrypted instruction decryption section 112, the output of the instruction register 111, and the output of the decryption instruction register 113 The selector 114 to be output and the instruction cache 115 to which the output of the selector 114 is input. The output of the instruction cache 115 is the output of the instruction fetch unit 11.
[0017]
Here, when an instruction in a group of encrypted instructions is executed, a decryption start instruction to be described later is executed immediately before the execution, and a decryption start signal is sent from the decoding unit 12 to the decryption control unit 14. Is output. When the decryption start signal is input (turned ON), the decryption control unit 14 instructs the encryption command decryption unit 112 to start decryption.
[0018]
On the other hand, at the end of the instructions in the instruction sequence of the group of encryption instructions, a decryption end instruction, which will be described later, is executed, and a decryption end signal is output from the decoding unit 12 to the decryption control unit 14. When the decryption end signal is input, the decryption control unit 14 instructs the encryption command decryption unit 112 to end the decryption (OFF). .
[0019]
While the start of decryption is instructed (while ON), the encrypted instruction decryption unit 112 reads the instruction stored in the instruction register 111 and executes decryption of the cipher.
[0020]
The decryption start instruction describes the encryption key (user key) data used for encryption, and this user key data is given to the encryption instruction decryption unit 112 via the decoding unit 12.
[0021]
In addition, when the decryption control signal output from the decryption control unit 14 is ON, the selector 114 also determines that the instruction input from the instruction ROM 2 is an encrypted instruction and outputs the decryption instruction register 113. Is selected and a decryption instruction is output.
[0022]
On the other hand, when the decryption control signal is OFF, the selector 114 outputs the instruction stored in the instruction register 111 as it is, assuming that the instruction input from the instruction ROM 2 is an unencrypted instruction.
[0023]
FIG. 2 is a block diagram showing an internal configuration of the encrypted instruction decryption unit 112 of FIG.
[0024]
The encrypted command decryption unit 112 outputs a write signal only when the decryption control signal is ON, and an encrypted command storage register 1122 that writes an external command with the write signal from the write control circuit 1121 And a user key storage register 1123 for writing user key data when the decryption control signal is ON.
[0025]
In addition, a mirror conversion circuit 1124 that performs mirror conversion, which will be described later, on the data in the encryption instruction storage register 1122 and user key data stored in the user key storage register 1123 are copied to the upper digit side to be twice as long. User-key expansion circuit 1125 that expands to the data of the data, exclusive-OR (xor) for each bit that performs an exclusive-OR (xor) operation for each bit of the output of the mirror conversion circuit 1124 and the output of the user key expansion circuit 1125 An arithmetic circuit 1126 is provided, and an output of the bitwise exclusive OR (xor) arithmetic circuit 1126 becomes a decryption instruction.
[0026]
Here, the decryption algorithm of the encrypted instruction decryption unit 112 will be described. Before that, the encryption method used in the encryption of the instruction of the microprocessor of the present embodiment will be described.
[0027]
FIG. 3 is a diagram for explaining the encryption process used in the instruction encryption of the microprocessor according to the present embodiment. Hereinafter, the encryption process will be described in order.
[0028]
(1) A user key prepared by arranging two user keys each having a 16-bit length, which is an encryption key dedicated to the user, and extending the user key to a 32-bit length is prepared in advance.
[0029]
(2) Perform an exclusive OR (xor) operation for each bit of the 32-bit length instruction (machine language) and the extended user key of 32 bits.
[0030]
Here, each bit of the instruction is represented as In, the bit of the extended user key is represented as Kn, the above operation result is represented as In xor Kn, and the operation result is referred to as an instruction masked with the user key. To do.
[0031]
(3) Perform mirror conversion of each bit of the instruction masked with the user key.
[0032]
In the mirror conversion, the n-th bit data is replaced with the (31-n) -th bit data. In this case, the 0-th bit data is the 31st bit and the first bit data is the 30th bit. .., 31st bit data is replaced with 0th bit.
[0033]
The data obtained as a result of this mirror conversion is an encrypted instruction, that is, an encrypted instruction.
[0034]
Next, the decryption algorithm of the encryption command decryption unit 112 will be described.
[0035]
FIG. 4 is a diagram for explaining a process of decrypting an encrypted instruction in the encrypted instruction decrypting unit 112. Hereinafter, the decoding process will be described in order.
[0036]
(1) The mirror conversion circuit 1124 mirror-converts the encryption command stored in the encryption command storage register 1122.
[0037]
As a result, the encryption command returns to the command masked with the user key described above.
[0038]
(2) A bitwise exclusive OR (xor) operation is performed between the instruction masked with the user key and the user key data expanded by the user key expansion circuit 1125.
[0039]
At this time, since the instruction masked with the user key is represented as In xor Kn, this operation is represented as (In xor Kn) xor Kn. When this logical expression is transformed, it becomes In xor (Kn xor Kn).
[0040]
Here, since the exclusive OR (xor) operation between the same data is 0, (Kn xor Kn) = 0, and the above equation is In xor 0 = In.
[0041]
In other words, the decoded instruction data In is obtained by this calculation.
[0042]
FIG. 5 is a diagram showing a format of a decoding start instruction and a decoding end instruction given to the microprocessor 1 of the present embodiment.
[0043]
FIG. 5A shows the format of the decryption start instruction. The decryption start instruction is a 32-bit instruction and is composed of a 16-bit decryption start operation (OP) code and a 16-bit user key.
[0044]
FIG. 5B shows the format of the decryption end instruction. The decoding end instruction is a 16-bit instruction and is composed only of a 16-bit decoding start operation (OP) code. However, since the decryption end instruction is placed at the end of the instruction sequence of the encrypted instruction, when it is given to the microprocessor 1, it is an encrypted 32-bit length instruction.
[0045]
FIG. 6 is a diagram showing stage transitions when pipeline processing is performed on encrypted instruction 1, encrypted instruction 2,..., Which is an instruction sequence of encrypted instructions, in microprocessor 1 of the present embodiment. It is.
[0046]
As shown in FIG. 6 (a), in the microprocessor 1, the encrypted instruction is instruction fetch (Fe), decryption of the encrypted instruction (Fu), instruction decode (D), and execution of operation (E). , Data cache access (M) and result writing (W) are sequentially processed in six stages.
[0047]
Among these, the instruction fetch unit 11 processes the instruction fetch (Fe) stage and the decryption (Fu) stage of the encrypted instruction.
[0048]
The instruction decode (D) stage is processed by the decode unit 12, and the processing after the operation execution (E) stage is processed by the operation execution unit 13.
[0049]
As described above, in the microprocessor 1, the instruction fetch (Fe) stage and the decryption (Fu) stage of the encrypted instruction are processed by the instruction fetch unit 11. At this time, the instruction fetch (Fe) stage includes an instruction fetch (Fe) stage. The register 111 is used, and the decryption instruction register 113 is used for the decryption (Fu) stage of the encryption instruction.
[0050]
Therefore, in the microprocessor 1 of the present embodiment, the process at the instruction fetch (Fe) stage and the process at the decryption (Fu) stage of the encrypted instruction can be simultaneously performed in parallel.
[0051]
Therefore, as shown in FIG. 6B, when pipeline processing of an instruction sequence of an encrypted instruction is performed by the microprocessor 1 of the present embodiment, all stages are not stalled between the stages. Can be operated in parallel.
[0052]
Thus, when the example of FIG. 6B is compared with FIG. 7B of the example of the conventional pipeline processing, for example, only four encrypted instructions can be processed in the conventional 12 cycles. However, in the present embodiment, processing of seven encrypted instructions can be executed.
[0053]
That is, the microprocessor 1 according to the present embodiment can improve the throughput of pipeline processing of encrypted instructions as compared with the conventional case.
[0054]
【The invention's effect】
According to the microprocessor of the present invention, it is possible to execute pipeline processing of encrypted instructions while suppressing the occurrence of stalls. Therefore, it is possible to improve the throughput of pipeline processing of encrypted instructions.
[Brief description of the drawings]
FIG. 1 is a block diagram showing a configuration of a microprocessor according to an embodiment of the present invention.
FIG. 2 is a block diagram showing a configuration of an encrypted instruction decryption unit of the microprocessor according to the embodiment of the present invention.
FIG. 3 is a diagram for explaining a process of encrypting an instruction.
FIG. 4 is a diagram for explaining a process of decrypting an encrypted instruction in the microprocessor according to the embodiment of the present invention.
FIG. 5 is a diagram showing a format of a decoding start instruction and a decoding end instruction given to the microprocessor according to the embodiment of the present invention.
FIG. 6 is a stage transition diagram for explaining pipeline processing in the microprocessor according to the embodiment of the present invention.
FIG. 7 is a stage transition diagram for explaining pipeline processing in a conventional microprocessor;
[Explanation of symbols]
1 Microprocessor 2 Instruction ROM
11 Instruction fetch unit 12 Decoding unit 13 Operation execution unit 14 Decryption control unit 111 Instruction register 112 Encrypted instruction decryption unit 113 Decryption instruction register 114 Selector 115 Instruction cache 1121 Write control circuit 1122 Encrypted instruction storage register 1123 User key storage Register 1124 Mirror conversion circuit 1125 User key expansion circuit 1126 Exclusive OR (xor) circuit for each bit

Claims (8)

外部から与えられる命令を格納する記憶手段と、前記記憶手段に格納された暗号化命令を復号化する暗号化命令復号化手段と、前記暗号化命令復号化手段により復号化された命令を保持する復号化命令保持手段と、前記記憶手段の出力または前記復号化命令保持手段の出力のいずれかを選択して出力する選択手段を有する命令フェッチ部と、
前記命令フェッチ部から出力される命令をデコードする命令デコード手段と、
前記命令デコード手段から出力される信号に基づき演算を実行する演算実行手段と、
前記命令デコード手段から出力される制御信号により前記暗号化命令復号化手段の復号化の実行を制御するとともに、前記選択手段を制御する復号化制御手段とを具備し、
前記命令フェッチ部の前記記憶手段に格納された前記命令が暗号化命令であるときに、前記復号化制御手段が、前記暗号化命令復号化手段に前記暗号化命令の復号化を実行させるとともに、前記選択手段に前記復号化命令保持手段の出力を選択させて出力させることを特徴とするマイクロプロセッサ。
Storage means for storing an instruction given from the outside, encrypted instruction decryption means for decrypting an encrypted instruction stored in the storage means, and an instruction decrypted by the encrypted instruction decryption means An instruction fetch unit having a decoding instruction holding means; and a selection means for selecting and outputting either the output of the storage means or the output of the decoding instruction holding means;
Instruction decoding means for decoding an instruction output from the instruction fetch unit;
Calculation execution means for executing calculation based on a signal output from the instruction decoding means;
The decryption control means for controlling the execution of the decryption of the encrypted instruction decryption means by the control signal output from the instruction decode means, and for controlling the selection means,
When the instruction stored in the storage means of the instruction fetch unit is an encrypted instruction, the decryption control means causes the encrypted instruction decryption means to execute decryption of the encrypted instruction, A microprocessor characterized by causing the selection means to select and output the output of the decryption instruction holding means.
命令の実行が、命令フェッチステージ、暗号化命令の復号化ステージ、命令のデコードステージ、演算の実行ステージの順でパイプライン処理されるマイクロプロセッサであって、
前記暗号化命令の復号化ステージでの処理と前記命令フェッチステージでの処理が前記命令フェッチ部で実行されることを特徴とする請求項1に記載のマイクロプロセッサ。
A microprocessor in which instruction execution is pipelined in the order of an instruction fetch stage, an encryption instruction decryption stage, an instruction decode stage, and an operation execution stage;
2. The microprocessor according to claim 1, wherein processing at the decryption stage of the encrypted instruction and processing at the instruction fetch stage are executed by the instruction fetch unit.
前記暗号化命令の復号化ステージでの現在の命令の処理と並列に、前記命令フェッチステージが次の命令の処理を実行することを特徴とする請求項2に記載のマイクロプロセッサ。3. The microprocessor according to claim 2, wherein the instruction fetch stage executes processing of a next instruction in parallel with processing of a current instruction at a decryption stage of the encrypted instruction. 前記復号化手段における復号の開始が復号化開始命令により制御され、復号の終了が復号化終了命令により制御されることを特徴とする請求項1に記載のマイクロプロセッサ。2. The microprocessor according to claim 1, wherein start of decoding in said decoding means is controlled by a decoding start instruction, and end of decoding is controlled by a decoding end instruction. 前記復号化開始命令が、一群の暗号化命令の命令列の直前に実行されることを特徴とする請求項4に記載のマイクロプロセッサ。5. The microprocessor according to claim 4, wherein the decryption start instruction is executed immediately before an instruction sequence of a group of encryption instructions. 前記復号化終了命令が、一群の暗号化命令の命令列の最後に実行されることを特徴とする請求項4に記載のマイクロプロセッサ。5. The microprocessor according to claim 4, wherein the decryption end instruction is executed at the end of an instruction sequence of a group of encryption instructions. 前記復号化開始命令が、復号化開始を指令するオペレーションコードと復号化に使用する暗号鍵データから構成されることを特徴とする請求項4に記載のマイクロプロセッサ。5. The microprocessor according to claim 4, wherein the decryption start instruction is composed of an operation code for instructing decryption start and encryption key data used for decryption. 前記復号化開始命令がデコードされて前記命令デコード手段から出力された前記暗号鍵データが、前記暗号化命令復号化手段に入力されて、復号化の実行の間は前記暗号化命令復号化手段に保持されることを特徴とする請求項7に記載のマイクロプロセッサ。The encryption key data output from the instruction decoding means after the decryption start instruction is decoded is input to the encrypted instruction decryption means, and during the execution of the decryption, the encryption instruction decryption means The microprocessor according to claim 7, wherein the microprocessor is held.
JP2003182694A 2003-06-26 2003-06-26 Microprocessor Pending JP2005018434A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003182694A JP2005018434A (en) 2003-06-26 2003-06-26 Microprocessor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003182694A JP2005018434A (en) 2003-06-26 2003-06-26 Microprocessor

Publications (1)

Publication Number Publication Date
JP2005018434A true JP2005018434A (en) 2005-01-20

Family

ID=34183003

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003182694A Pending JP2005018434A (en) 2003-06-26 2003-06-26 Microprocessor

Country Status (1)

Country Link
JP (1) JP2005018434A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006227777A (en) * 2005-02-16 2006-08-31 Renesas Technology Corp Data processor
JP2006309766A (en) * 2005-04-26 2006-11-09 Internatl Business Mach Corp <Ibm> Method for decrypting processor instruction, data processing system, and device
US8266450B2 (en) 2008-04-03 2012-09-11 Renesas Electronics Corporation Information processing device, encryption method of instruction code, and decryption method of encrypted instruction code

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2006227777A (en) * 2005-02-16 2006-08-31 Renesas Technology Corp Data processor
JP4737592B2 (en) * 2005-02-16 2011-08-03 ルネサスエレクトロニクス株式会社 Data processing device
JP2006309766A (en) * 2005-04-26 2006-11-09 Internatl Business Mach Corp <Ibm> Method for decrypting processor instruction, data processing system, and device
US8086871B2 (en) 2005-04-26 2011-12-27 International Business Machines Corporation Method for fast decryption of processor instructions in an encrypted instruction power architecture
US8392725B2 (en) 2005-04-26 2013-03-05 International Business Machines Corporation Method for fast decryption of processor instructions
US8266450B2 (en) 2008-04-03 2012-09-11 Renesas Electronics Corporation Information processing device, encryption method of instruction code, and decryption method of encrypted instruction code

Similar Documents

Publication Publication Date Title
US10560259B2 (en) Architecture and instruction set for implementing advanced encryption standard (AES)
JP6592804B2 (en) Flexible architecture and instructions for the new encryption standard (AES)
JP5538736B2 (en) A combination of instructions that includes a series of transformations to separate one transformation
US8428251B2 (en) System and method for stream/block cipher with internal random states
US20160261406A1 (en) Performing AES Encryption Or Decryption In Multiple Modes With A Single Instruction
US8391475B2 (en) Method and apparatus for advanced encryption standard (AES) block cipher
CN102334307A (en) Key recovery mechanism for cryptographic systems
JP3824121B2 (en) Method and apparatus for decrypting encrypted data
US8266450B2 (en) Information processing device, encryption method of instruction code, and decryption method of encrypted instruction code
KR20050087271A (en) Key schedule apparatus for generating an encryption round key and a decryption round key selectively corresponding to initial round key having variable key length
JP4960456B2 (en) Dual mode AES implementation supporting single and multiple AES operations
US20050147239A1 (en) Method for implementing advanced encryption standards using a very long instruction word architecture processor
JP2005018434A (en) Microprocessor
US7254231B1 (en) Encryption/decryption instruction set enhancement
JP4708914B2 (en) Decryption method
JP2009069686A (en) Encryption circuit and decryption circuit
JP4939305B2 (en) Encryption / decryption device
JPH0435432A (en) Data ciphering system

Legal Events

Date Code Title Description
RD02 Notification of acceptance of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7422

Effective date: 20050415

RD04 Notification of resignation of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7424

Effective date: 20050606