[go: up one dir, main page]

JP2010092273A - Information processor - Google Patents

Information processor Download PDF

Info

Publication number
JP2010092273A
JP2010092273A JP2008261759A JP2008261759A JP2010092273A JP 2010092273 A JP2010092273 A JP 2010092273A JP 2008261759 A JP2008261759 A JP 2008261759A JP 2008261759 A JP2008261759 A JP 2008261759A JP 2010092273 A JP2010092273 A JP 2010092273A
Authority
JP
Japan
Prior art keywords
instruction
register
selection
unit
information
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
JP2008261759A
Other languages
Japanese (ja)
Inventor
Yoshihisa Tanaka
義久 田中
Jiro Miyake
二郎 三宅
Toshihiro Yagi
俊宏 八木
Manabu Suetani
学 末谷
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.)
Panasonic Corp
Original Assignee
Panasonic 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 Panasonic Corp filed Critical Panasonic Corp
Priority to JP2008261759A priority Critical patent/JP2010092273A/en
Publication of JP2010092273A publication Critical patent/JP2010092273A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Executing Machine-Instructions (AREA)

Abstract

【課題】マイコンなどの情報処理装置のレジスタ拡張を行う場合、拡張レジスタにアクセスするには、命令コードの追加・変更やレジスタ切り替えのための操作が必要になる。
【解決手段】命令メモリ1と、データメモリ9と、命令メモリから読み出された命令に従って制御信号を生成する命令制御部4と、命令制御部による制御信号に従ってデータメモリに対してアクセスを行うロード・ストアユニット10と、命令制御部による制御信号に従って演算を行う演算器5,6と、演算器5で用いるデータを格納する標準レジスタ群7と、演算器6で用いるデータを格納する拡張レジスタ群8と、選択信号A3により標準レジスタ群7と拡張レジスタ群8とのいずれかを選択する選択手段12と、選択手段12に対し選択信号A3を出力する選択条件判定手段13とを備え、選択条件判定手段13は、装置内部の特定の状態信号に基づいて選択信号A3を生成する。
【選択図】図1
When register expansion of an information processing apparatus such as a microcomputer is performed, an operation for adding / changing an instruction code or switching a register is required to access the extension register.
An instruction memory, a data memory, an instruction control unit for generating a control signal according to an instruction read from the instruction memory, and a load for accessing the data memory according to a control signal from the instruction control unit A store unit 10, arithmetic units 5 and 6 that perform arithmetic operations according to control signals from the instruction control unit, a standard register group 7 that stores data used by the arithmetic unit 5, and an extended register group that stores data used by the arithmetic unit 6 8 and a selection means 12 for selecting one of the standard register group 7 and the extension register group 8 by a selection signal A3, and a selection condition determination means 13 for outputting a selection signal A3 to the selection means 12, and a selection condition The determination unit 13 generates a selection signal A3 based on a specific state signal inside the apparatus.
[Selection] Figure 1

Description

本発明は、性能向上・機能向上の要求に対応するためにレジスタ個数が拡張された情報処理装置にかかわり、特には拡張レジスタに対するアクセスを標準レジスタに対するアクセスと同等の実行サイクル・命令数で行えるようにする技術に関する。   The present invention relates to an information processing apparatus in which the number of registers is expanded to meet the demand for performance improvement and function improvement. In particular, the access to the extension registers can be performed with the same number of execution cycles and instructions as the access to the standard registers. It is related to technology.

マイコン(マイクロコンピュータ)・CPU(Central Processing Unit)・DSP(Digital Signal Processor)などに代表される情報処理装置においては、さらなる性能向上・機能向上の要求に対応するために、既存の情報処理装置が元から持っている演算機能・標準レジスタ以外に、追加で拡張演算機能・拡張レジスタを増設する手法が採られることがある。しかし、この拡張された資源を扱うために既存の情報処理装置の命令フォーマットを大きく変更することは、互換性悪化の問題やアセンブラ・コンパイラの対応が必要になるという問題がある。特に、命令コードフォーマット中のレジスタ指定フィールドのビット幅を拡張することは一般的にむずかしく、拡張レジスタを命令コード中で明示的に指定することは困難である。   In information processing devices represented by microcomputers (microcomputers), CPUs (Central Processing Units), DSPs (Digital Signal Processors), etc., existing information processing devices are used in order to meet the demand for further performance improvement and function improvement. In addition to the arithmetic functions and standard registers that are originally provided, there are cases where an additional arithmetic function and extension registers are additionally added. However, greatly changing the instruction format of an existing information processing apparatus in order to handle this expanded resource has a problem of deterioration of compatibility and a problem that requires an assembler / compiler to cope with it. In particular, it is generally difficult to extend the bit width of the register specification field in the instruction code format, and it is difficult to explicitly specify the extension register in the instruction code.

演算命令の種類によって使用するレジスタが標準レジスタか拡張レジスタかがあらかじめ決まっている場合には、命令コードフォーマット中のレジスタ指定フィールドのビット幅を拡張することなく、暗黙的に拡張レジスタを使用することは可能である。このような構成は、MIPS命令セットアーキテクチャのmult命令(乗算命令)とHi/Loレジスタなどに見られる(例えば非特許文献1参照)。   If the register to be used is a standard register or an extension register depending on the type of operation instruction, use the extension register implicitly without extending the bit width of the register specification field in the instruction code format. Is possible. Such a configuration can be found in a MIPS instruction set architecture, such as a multi instruction (multiplication instruction) and a Hi / Lo register (see Non-Patent Document 1, for example).

このように拡張演算命令で拡張レジスタを扱うことはできるが、これとは別に、拡張レジスタの読み出しまたは拡張レジスタへの書き込みのために拡張レジスタを対象としたデータ転送が必要になる。このような拡張レジスタへのデータ転送の実現方法として、主に次の3つの方法が知られている。   As described above, the extension register can be handled by the extension operation instruction, but separately, data transfer to the extension register is required for reading the extension register or writing to the extension register. As methods for realizing data transfer to such an extension register, the following three methods are mainly known.

一つ目は、プリフィックス命令を追加し、プリフィックス命令直後の命令では標準レジスタの代わりに拡張レジスタにアクセスするようにする(例えば特許文献1参照:プリフィックス命令=接頭部を含む命令)。プリフィックス(prefix)とは、機能を変更したり指示したりするためにオペコードの前に置いて使うコードのことであり、命令プリフィックスともいう。   First, a prefix instruction is added, and an extension register is accessed instead of a standard register in an instruction immediately after the prefix instruction (see, for example, Patent Document 1: Prefix instruction = an instruction including a prefix). A prefix is a code that is used in front of an opcode to change or indicate a function, and is also called an instruction prefix.

二つ目は、制御レジスタを設けて標準レジスタと拡張レジスタを切り替え可能にし、レジスタアクセス前に制御レジスタを設定することで、標準レジスタと拡張レジスタのうち所望のレジスタにアクセスできるようにする(例えば特許文献2参照:制御レジスタ=拡張レジスタ置換え手段)。   Second, a control register is provided to enable switching between a standard register and an extension register, and by setting the control register before register access, it is possible to access a desired register among the standard register and the extension register (for example, (See Patent Document 2: Control register = extended register replacement means).

三つ目は、標準レジスタと拡張レジスタ間のデータ転送命令を追加する(例えば、非特許文献1のmfhi・mflo命令)。この命令においても拡張レジスタは暗黙的にソース(データ送り元)またはデスティネーション(データ送り先)として用いられる。
ジョン・L・ヘネシー/デイビッド・A・パターソン著『コンピュータの構成と設計 第2版 [上]』日経BP社、1999年5月17日(ページ M−1) 特表2004−506263号公報(第11−15頁、第7−10図) 特開平2−146625号公報(第2−3頁、第1−2図)
Third, a data transfer instruction between the standard register and the extension register is added (for example, the mfhi / mflo instruction in Non-Patent Document 1). Also in this instruction, the extension register is implicitly used as a source (data source) or a destination (data destination).
John L. Hennessy / David A. Patterson, “Computer Configuration and Design 2nd edition [top]” Nikkei BP, May 17, 1999 (Page M-1) Japanese translation of PCT publication No. 2004-506263 (page 11-15, FIG. 7-10) JP-A-2-146625 (page 2-3, FIG. 1-2)

上記した従来技術にはそれぞれ次のような課題がある。   Each of the above conventional techniques has the following problems.

1.<プリフィックス命令を追加する場合>
プリフィックス命令を追加する場合、プリフィックス命令を実行しなければならないことによるコードサイズの増加、実行サイクルの増加、またアセンブラやコンパイラの対応が必須になり、トータルの開発工数が増大するなどの問題がある。プリフィックス命令を追加する場合のアセンブラプログラムの例を挙げると、以下のようになる。
1. <When adding a prefix instruction>
When adding a prefix instruction, there are problems such as an increase in code size due to having to execute the prefix instruction, an increase in the execution cycle, and assembler and compiler support, which increases the total development man-hours. . An example of an assembler program for adding a prefix instruction is as follows.

LD R0, (乗算第1オペランドのアドレス)
PFX
LD R0, (乗算第2オペランドのアドレス)
MUL R0
PFX
ST R0, (乗算結果のアドレス)
ここで、「PFX」はプリフィックス命令であり、この命令直後のロード命令・ストア命令において、標準レジスタRn(n=0,1…)の代わりに拡張レジスタERn(n=0,1…)をアクセス対象に切り替える。「LD Rn,(アドレス)」は、データメモリの指定されたアドレス番地のデータを標準レジスタRnの値に読み込む(ロード)命令を表す。上記の2番目のLD命令(ロード命令)はPFX命令の直後であるため、実際には拡張レジスタER0にロードされる。「ST Rn,(アドレス)」は、標準レジスタRnの値をデータメモリの指定されたアドレス番地に書き込む(ストア)命令を表す。ここではPFX命令の直後であるため、実際には拡張レジスタER0がストアされる。「MUL Rn」は乗算命令であり、乗算(Rn×ER0)の結果を拡張レジスタER0に格納する。拡張レジスタER0は乗算専用レジスタとして固定的に使用され、命令中で指定することはできない。この手法によると、MUL命令(乗算命令)で使用される拡張レジスタER0へのロード命令・ストア命令の直前にPFX命令が必要になり、この命令分のコードサイズの増加・実行サイクルの増加という問題がある。
LD R0, (address of first operand of multiplication)
PFX
LD R0, (address of second operand of multiplication)
MUL R0
PFX
STR0, (multiplication result address)
Here, “PFX” is a prefix instruction. In the load instruction / store instruction immediately after this instruction, the extension register ERn (n = 0, 1,...) Is accessed instead of the standard register Rn (n = 0, 1,...). Switch to the target. “LD Rn, (address)” represents a (load) instruction for reading data at a specified address in the data memory into the value of the standard register Rn. Since the second LD instruction (load instruction) is immediately after the PFX instruction, it is actually loaded into the extension register ER0. “ST Rn, (address)” represents a (store) instruction for writing the value of the standard register Rn to a specified address in the data memory. Since it is immediately after the PFX instruction here, the extension register ER0 is actually stored. “MUL Rn” is a multiplication instruction, and the result of multiplication (Rn × ER0) is stored in the extension register ER0. The extension register ER0 is fixedly used as a multiplication-dedicated register and cannot be specified in the instruction. According to this method, the PFX instruction is required immediately before the load instruction / store instruction to the extension register ER0 used in the MUL instruction (multiplication instruction), and the problem is that the code size for this instruction increases and the execution cycle increases. There is.

2.<制御レジスタを設ける場合>
制御レジスタを設ける場合は、レジスタアクセス前に制御レジスタを設定する必要があるため、実行サイクルが増加するという問題がある。制御レジスタを設ける場合のアセンブラプログラムの例を挙げると、以下のようになる。
2. <When providing a control register>
When the control register is provided, it is necessary to set the control register before accessing the register, which increases the execution cycle. An example of an assembler program for providing a control register is as follows.

LD R0, (乗算第1オペランドのアドレス)
MOV R1, 1
ST R1, (制御レジスタのアドレス)
LD R0, (乗算第2オペランドのアドレス)
MUL R0
ST R0, (乗算結果のアドレス)
ここで、「MOV Rn, 値」は、標準レジスタRnに指定された値を代入する命令を表す。また、制御レジスタは“0”または“1”の値をとり、制御レジスタが“1”のときには、LD命令またはST命令(ストア命令)において、標準レジスタRnの代わりに拡張レジスタERnにアクセスすることを示す。この手法によると、乗算第2オペランドを拡張レジスタER0にロードする前に、制御レジスタに“1”を設定するための命令が必要になり、この命令分のコードサイズの増加・実行サイクルの増加という問題がある。
LD R0, (address of first operand of multiplication)
MOV R1, 1
STR1, (control register address)
LD R0, (address of second operand of multiplication)
MUL R0
STR0, (multiplication result address)
Here, “MOV Rn, value” represents an instruction for substituting the value specified in the standard register Rn. The control register takes a value of “0” or “1”. When the control register is “1”, the LD register or ST instruction (store instruction) accesses the extension register ERn instead of the standard register Rn. Indicates. According to this method, before loading the multiplication second operand into the extension register ER0, an instruction for setting “1” in the control register is required, which means that the code size for this instruction is increased and the execution cycle is increased. There's a problem.

3.<標準レジスタと拡張レジスタ間のデータ転送命令を追加する>
標準レジスタと拡張レジスタ間のデータ転送命令を追加する場合は、拡張レジスタにロード・ストアしたいときに、いったん標準レジスタにロード・ストアする必要があるため、実行サイクルが増加する、またそのときに使用された標準レジスタの値が破壊されるという問題がある。制御レジスタを設ける場合のアセンブラプログラムの例を挙げると、以下のようになる。
3. <Add data transfer instruction between standard register and extension register>
When adding a data transfer instruction between a standard register and an extension register, when you want to load / store to the extension register, it is necessary to load / store to the standard register. There is a problem that the value of the standard register is destroyed. An example of an assembler program for providing a control register is as follows.

LD R0, (乗算第1オペランドのアドレス)
LD R1, (乗算第2オペランドのアドレス)
STER0 R1
MUL R0
LDER0 R0
ST R0, (乗算結果のアドレス)
「LDER0 Rn」は、標準レジスタRnの値を拡張レジスタER0に代入する命令を表す。「STER0 Rn」は、拡張レジスタR0の値を標準レジスタRnに代入する命令を表す。この手法によると、乗算第2オペランドのアドレスをいったん標準レジスタR1にロードする必要があるため、標準レジスタR1の値が破壊され(LDER0により標準レジスタR0の値も破壊される)、STER0とLDER0命令分のコードサイズの増加・実行サイクルの増加という問題がある。
LD R0, (address of first operand of multiplication)
LD R1, (address of second operand of multiplication)
STER0 R1
MUL R0
LDER0 R0
STR0, (multiplication result address)
“LDER0 Rn” represents an instruction for assigning the value of the standard register Rn to the extension register ER0. “STER0 Rn” represents an instruction for assigning the value of the extension register R0 to the standard register Rn. According to this method, since the address of the second operand of multiplication needs to be once loaded into the standard register R1, the value of the standard register R1 is destroyed (the value of the standard register R0 is also destroyed by LDER0), and the STER0 and LDER0 instructions There is a problem that the code size of the minute increases and the execution cycle increases.

本発明は、このような事情に鑑みて創作したものであり、命令追加や命令フォーマット変更を行わず、かつ制御レジスタを明示的に設定することなく、標準レジスタアクセスと同等の実行サイクル・命令数で拡張レジスタにアクセスすることが可能な情報処理装置を提供することを目的としている。   The present invention was created in view of such circumstances, and does not add an instruction or change an instruction format, and does not explicitly set a control register. An object of the present invention is to provide an information processing apparatus capable of accessing an extension register.

(1)本発明による情報処理装置は、
命令を格納する命令メモリと、
データを格納するデータメモリと、
前記命令メモリから読み出された命令に従って制御信号を生成する命令制御部と、
前記命令制御部による前記制御信号に従って前記データメモリに対してアクセスを行うロード・ストアユニットと、
前記命令制御部による前記制御信号に従って演算を行う演算器と、
前記演算器で用いるデータを格納する標準レジスタ群と、
前記演算器で用いるデータを格納する拡張レジスタ群と、
選択信号により前記標準レジスタ群と前記拡張レジスタ群とのいずれかを選択する選択手段と、
前記選択手段に対し前記選択信号を出力する選択条件判定手段とを備え、
前記選択条件判定手段は、装置内部の特定の状態信号に基づいて前記選択信号を生成するように構成されているものである。
(1) An information processing apparatus according to the present invention
An instruction memory for storing instructions;
Data memory for storing data;
An instruction control unit that generates a control signal according to an instruction read from the instruction memory;
A load / store unit that accesses the data memory in accordance with the control signal by the instruction control unit;
An arithmetic unit that performs an operation according to the control signal by the instruction control unit;
A group of standard registers for storing data used in the computing unit;
An extension register group for storing data used in the arithmetic unit;
A selection means for selecting one of the standard register group and the extension register group by a selection signal;
Selection condition determination means for outputting the selection signal to the selection means,
The selection condition determination means is configured to generate the selection signal based on a specific state signal inside the apparatus.

すなわち、標準レジスタ群と拡張レジスタ群とのいずれかを選択する選択手段を設け、さらに選択手段を制御するための選択信号を生成出力する選択条件判定手段を設け、この選択条件判定手段はさらに装置内部の特定の状態信号に基づいて選択信号を生成するように構成されている点に特徴がある。   That is, selection means for selecting either the standard register group or the extension register group is provided, and further, selection condition determination means for generating and outputting a selection signal for controlling the selection means is provided. It is characterized in that it is configured to generate a selection signal based on an internal specific state signal.

この構成によれば、選択条件判定手段が装置内部の特定の状態信号から選択手段に対する選択信号を生成し、選択手段がその選択信号に応じて標準レジスタ群と拡張レジスタ群とのいずれかを選択することになる。この場合、命令コードの追加や拡張は必要でない。また、明示的なレジスタ切り替えのための追加の実行サイクルは消費しないですむ。したがって、標準レジスタアクセスと同等の実行サイクル・命令数で拡張レジスタにアクセスすることが可能となる。   According to this configuration, the selection condition determination unit generates a selection signal for the selection unit from a specific state signal inside the apparatus, and the selection unit selects either the standard register group or the extension register group according to the selection signal. Will do. In this case, it is not necessary to add or extend the instruction code. Also, it is not necessary to consume additional execution cycles for explicit register switching. Therefore, it is possible to access the extension register with an execution cycle and the number of instructions equivalent to the standard register access.

(2)上記(1)の構成の情報処理装置において、前記選択条件判定手段は、メモリアクセスが発生する命令実行時に前記ロード・ストアユニットで生成されるアドレスを用いて前記選択信号を生成するという態様がある。この構成によれば、データメモリへのアクセスが発生する命令で、そのデータが位置するアドレスに応じて標準レジスタ群と拡張レジスタ群のいずれか一方を選択することが可能となる。すなわち、命令コードの追加や拡張を行うことなく、また明示的なレジスタ切り替えのための追加の実行サイクルを消費することなく、標準レジスタアクセスと同等の実行サイクル・命令数で拡張レジスタにアクセスすることが可能となる。   (2) In the information processing apparatus having the configuration of (1), the selection condition determination unit generates the selection signal using an address generated by the load / store unit when executing an instruction that causes a memory access. There are aspects. According to this configuration, it is possible to select either the standard register group or the extension register group in accordance with the address where the data is located by an instruction that causes access to the data memory. In other words, access to extension registers with the same number of execution cycles and number of instructions as standard register access, without adding or extending instruction codes or consuming additional execution cycles for explicit register switching. Is possible.

(3)上記(1)の構成の情報処理装置において、前記選択条件判定手段は、過去に実行された命令の履歴情報を保持する命令履歴保持手段を備え、前記命令履歴保持手段が保持する命令の履歴情報を基に前記選択信号を生成するという態様がある。例えば、命令履歴保持手段はステートマシンで構成され、ロードされた命令コードの任意のビットを用いてステートマシンの状態が遷移したときに、そのステートマシンの状態により選択信号を生成する。この構成によれば、レジスタを切り替えたい命令の1命令以上前に配置された命令列が特定の並びか否かに応じて標準レジスタ群と拡張レジスタ群のいずれか一方を選択することが可能となる。   (3) In the information processing apparatus having the configuration of (1), the selection condition determination unit includes a command history holding unit that holds history information of a command executed in the past, and the command held by the command history holding unit There is a mode in which the selection signal is generated based on the history information. For example, the instruction history holding means is composed of a state machine, and generates a selection signal according to the state of the state machine when the state machine changes using an arbitrary bit of the loaded instruction code. According to this configuration, it is possible to select either the standard register group or the extended register group depending on whether or not the instruction sequence arranged one or more instructions before the instruction whose register is to be switched is in a specific sequence. Become.

ところで、上記(3)の構成では、特定の命令列が発生するように命令コードを配置したとしても、割り込み処理が発生すると、割り込み処理の命令コードが途中で実行されるため、特定の命令列が検出できなくなる。そこで、次のように対応する。   By the way, in the configuration of (3) above, even if an instruction code is arranged so that a specific instruction sequence is generated, when an interrupt process occurs, the instruction code of the interrupt process is executed in the middle. Cannot be detected. Therefore, the following measures are taken.

(4)上記(3)の構成の情報処理装置において、前記命令履歴保持手段は、割り込み処理開始時に、過去に実行された命令の履歴情報を退避し、割り込み復帰時に前記命令の履歴情報を復帰させるという態様がある。この構成によれば、割り込み処理が発生しても、レジスタ切り替えを行いたい命令の前に配置された特定の命令列が検出されることを保証するので、特定命令列を検出してレジスタを自動的に選択することが可能となる。   (4) In the information processing apparatus having the configuration of (3), the instruction history holding unit saves the history information of instructions executed in the past at the start of interrupt processing, and restores the instruction history information at the time of interrupt return. There is an aspect of making it. According to this configuration, even if an interrupt process occurs, it is guaranteed that a specific instruction sequence arranged before the instruction for which register switching is to be performed is detected. Therefore, the register is automatically detected by detecting the specific instruction sequence. Can be selected automatically.

(5)上記(1)の構成の情報処理装置において、パイプライン方式で動作する情報処理装置として構成され、前記命令制御部は命令情報を生成するように構成され、さらに各パイプラインステージに対応した前記命令情報を保持する命令情報保持手段を備え、前記選択条件判定手段は、前記命令情報保持手段に保持されている前記命令情報を用いて前記選択信号を生成するように構成されているという態様がある。この構成によれば、情報処理装置は命令パイプライン方式であり、選択条件判定手段は各パイプラインステージの命令情報保持手段に保持している命令情報(命令コードまたは命令デコード結果)を用いて選択信号を生成する。したがって、レジスタを切り替えたい命令の1命令以上後に配置された命令列が特定の並びか否かにより、標準レジスタ群と拡張レジスタ群のいずれか一方を選択することが可能となる。上記の(3)の場合は「1命令以上前」であるのに対し、この項(5)では「1命令以上後」となっている。   (5) The information processing apparatus having the configuration (1) is configured as an information processing apparatus that operates in a pipeline manner, and the instruction control unit is configured to generate instruction information, and further corresponds to each pipeline stage. Command information holding means for holding the command information, and the selection condition determining means is configured to generate the selection signal using the command information held in the command information holding means. There are aspects. According to this configuration, the information processing apparatus is an instruction pipeline method, and the selection condition determining means selects using the instruction information (instruction code or instruction decode result) held in the instruction information holding means of each pipeline stage. Generate a signal. Therefore, it is possible to select either the standard register group or the extension register group depending on whether or not the instruction sequence arranged after one or more instructions of the instruction whose register is to be switched is in a specific sequence. In the case of (3) above, “1 instruction or more before”, whereas in this item (5), “1 instruction or more after”.

ところで、上記(5)の構成では、特定の命令列が発生するように命令コードを配置したとしても、割り込み処理が発生すると、割り込み処理の命令コードが命令パイプラインに保持されるため、特定の命令列が検出できなくなる。そこで、次のように対応する。   By the way, in the configuration of (5) above, even if an instruction code is arranged so that a specific instruction sequence is generated, when an interrupt process occurs, the instruction code of the interrupt process is held in the instruction pipeline. The instruction sequence cannot be detected. Therefore, the following measures are taken.

(6)上記(5)の構成の情報処理装置において、さらに、過去に実行された命令の履歴情報を保持する命令履歴保持手段を備え、前記命令履歴保持手段は、過去に実行された命令の特定の並びを検出し割り込み処理を禁止するという態様がある。この構成によれば、各パイプラインステージ中の命令が特定の命令列であることを検出中は割り込み処理を禁止するので、レジスタ切り替えのトリガとなる特定の命令列に至るまでの間は割り込みを禁止し、最終的に特定の命令列が検出されることを保証することが可能になる。したがって、レジスタ切り替えを行いたい命令の後に配置された特定命令列を検出してレジスタを自動的に選択することが可能となる。   (6) The information processing apparatus having the configuration of (5) further includes instruction history holding means for holding history information of instructions executed in the past, wherein the instruction history holding means stores instructions executed in the past. There is a mode in which a specific sequence is detected and interrupt processing is prohibited. According to this configuration, interrupt processing is prohibited while detecting that an instruction in each pipeline stage is a specific instruction sequence, so interrupts are not generated until a specific instruction sequence that triggers register switching is reached. It is possible to prohibit and guarantee that a specific instruction sequence is finally detected. Therefore, it is possible to automatically select a register by detecting a specific instruction sequence arranged after an instruction for which register switching is to be performed.

本発明によれば、標準レジスタ群と拡張レジスタ群とのいずれかを選択する選択手段を設け、さらに選択手段を制御するための選択信号を装置内部の特定の状態信号から生成する選択条件判定手段を設けたので、命令コードの追加や拡張を行うことなく、また明示的なレジスタ切り替えのための追加の実行サイクルを消費することなく、標準レジスタアクセスと同等の実行サイクル・命令数で拡張レジスタにアクセスすることができる。   According to the present invention, there is provided selection means for selecting either the standard register group or the extension register group, and further, selection condition determination means for generating a selection signal for controlling the selection means from a specific state signal inside the apparatus. Therefore, without adding or extending the instruction code, and without consuming additional execution cycles for explicit register switching, the extension registers can be used with the same number of execution cycles and number of instructions as standard register access. Can be accessed.

以下、本発明にかかわる情報処理装置の実施の形態を図面を用いて詳細に説明する。   Embodiments of an information processing apparatus according to the present invention will be described below in detail with reference to the drawings.

(実施の形態1)
<構成>
図1は本発明の実施の形態1における情報処理装置としてのマイコンの内部の構成を示すブロック図である。同図において、1は命令を格納する命令メモリ、2は命令メモリ1から読み出された命令を一時的に保持する命令レジスタ、3は命令レジスタ2の値をデコードし適切な制御信号を生成する命令デコーダ、4は命令レジスタ2と命令デコーダ3を構成要素とする命令制御部、A1は制御信号を含む命令デコード結果、5は命令制御部4による制御信号に従って演算を行うもので標準レジスタ群7は使用するが拡張レジスタ群8は使用しない演算器、6は命令制御部4による制御信号に従って演算を行うもので標準レジスタ群7および拡張レジスタ群8を使用する演算器、7は標準レジスタ群、8は拡張レジスタ群、9はデータを格納するデータメモリ、10は命令制御部4による制御信号に従ってデータメモリ9に対してアクセスを行うロード・ストアユニット、A2はデータメモリアクセス発生時のメモリアドレス、11は演算結果・メモリデータ・レジスタの値を各機能ブロック間でやり取りするためのデータバス、12は選択信号A3に従って標準レジスタ群7と拡張レジスタ群8のいずれか一方を選択する選択手段、13はロード・ストアユニット10がデータメモリ9へアクセスするときのアドレスA2から選択信号A3を生成する選択条件判定手段、A3は標準レジスタ群7と拡張レジスタ群8のいずれか一方を選択することを示す選択信号、A4は各レジスタへのリードイネーブル信号/リードデータ/ライトイネーブル信号/ライトデータである。
(Embodiment 1)
<Configuration>
FIG. 1 is a block diagram showing an internal configuration of a microcomputer as an information processing apparatus according to Embodiment 1 of the present invention. In the figure, 1 is an instruction memory for storing an instruction, 2 is an instruction register for temporarily holding an instruction read from the instruction memory 1, and 3 is for decoding an instruction register 2 value to generate an appropriate control signal. The instruction decoder 4 includes an instruction control unit having the instruction register 2 and the instruction decoder 3 as constituent elements, A1 indicates an instruction decoding result including a control signal, and 5 performs an operation according to the control signal from the instruction control unit 4, and the standard register group 7 Is used, but the extended register group 8 is not used. 6 is an arithmetic unit that operates according to the control signal from the instruction control unit 4 and uses the standard register group 7 and the extended register group 8. 7 is a standard register group. 8 is an extension register group, 9 is a data memory for storing data, and 10 is a row for accessing the data memory 9 in accordance with a control signal from the instruction control unit 4. A store unit, A2 is a memory address when a data memory access occurs, 11 is an operation result, memory data, a data bus for exchanging register values between functional blocks, and 12 is a standard register group 7 according to a selection signal A3 Selection means for selecting one of the extension register groups 8, 13 is a selection condition determination means for generating a selection signal A3 from the address A2 when the load / store unit 10 accesses the data memory 9, and A3 is a standard register group 7 A4 is a selection signal indicating that one of the extension register group 8 is selected and A4 is a read enable signal / read data / write enable signal / write data to each register.

この例では、標準レジスタ群7はR0〜R3の4個の標準レジスタから構成され、拡張レジスタ群8はER0〜ER3の4個の拡張レジスタから構成されている。基本的に、命令コード中のレジスタ指定フィールドにより標準レジスタR0〜R3が指定される。データメモリ9にアクセスする命令では、選択信号A3により拡張レジスタ側を指定する。選択手段12は、命令コード中のレジスタ指定フィールドで標準レジスタR0が指定されたときは拡張レジスタER0を選択し、標準レジスタR1が指定されたときは拡張レジスタER1を選択する、というように対応する拡張レジスタを選択するように構成されている。拡張レジスタ群8に含まれるレジスタの個数は、標準レジスタ群7に含まれるレジスタの個数より多くてもよいし少なくてもよい。標準レジスタ群7に対応する拡張レジスタ群8が2つ以上の場合、選択信号A3は3つ以上の状態を表現可能な信号になり、選択手段12は1つの標準レジスタ群7と2つ以上の拡張レジスタ群8から1つを選択する。   In this example, the standard register group 7 is composed of four standard registers R0 to R3, and the extension register group 8 is composed of four extension registers ER0 to ER3. Basically, the standard registers R0 to R3 are designated by the register designation field in the instruction code. In the instruction to access the data memory 9, the extension register side is designated by the selection signal A3. The selection unit 12 selects the extension register ER0 when the standard register R0 is designated in the register designation field in the instruction code, and selects the extension register ER1 when the standard register R1 is designated. It is configured to select an extension register. The number of registers included in the extended register group 8 may be larger or smaller than the number of registers included in the standard register group 7. When there are two or more extension register groups 8 corresponding to the standard register group 7, the selection signal A3 is a signal capable of expressing three or more states, and the selection means 12 includes one standard register group 7 and two or more state registers. One is selected from the extension register group 8.

命令レジスタ2にロードされた命令がデータメモリアクセスを発生させる命令の場合、ロード・ストアユニット10を適切に制御することでデータメモリ9へのアクセスを行うが、その際、アドレスA2にはアクセス対象となるメモリアドレスが出力される。命令メモリ1とデータメモリ9は独立した2つのメモリであっても、共通の1つのメモリであってもよい。   When the instruction loaded in the instruction register 2 is an instruction that causes data memory access, the data memory 9 is accessed by appropriately controlling the load / store unit 10. Is output. The instruction memory 1 and the data memory 9 may be two independent memories or one common memory.

選択条件判定手段13は、ロード・ストアユニット10によるデータメモリアクセス時のアドレスA2が入力され、そのアドレスA2の一部または全ビットを使用して選択信号A3を生成する。選択手段12は、選択条件判定手段13から選択信号A3を受け、選択信号A3の値に応じて標準レジスタR0〜R3と拡張レジスタER0〜ER3のいずれか一方を選択する。レジスタリード時には、選択手段12は、標準レジスタ群7と拡張レジスタ群8のいずれか一方のリードイネーブル信号A4を有効にする。これにより、命令で指定されたレジスタから読み出されたデータをデータバス11に出力する。また、レジスタライト時には、選択手段12は、標準レジスタ群7と拡張レジスタ群8のいずれか一方のライトイネーブル信号A4を有効にする。これにより、データバス11のデータが命令で指定されたレジスタにライトされる。   The selection condition determination means 13 receives an address A2 when the load / store unit 10 accesses the data memory, and generates a selection signal A3 using a part or all of the bits of the address A2. The selection unit 12 receives the selection signal A3 from the selection condition determination unit 13, and selects one of the standard registers R0 to R3 and the extension registers ER0 to ER3 according to the value of the selection signal A3. At the time of register reading, the selection unit 12 validates one of the read enable signals A4 of the standard register group 7 and the extension register group 8. As a result, the data read from the register designated by the instruction is output to the data bus 11. At the time of register write, the selection unit 12 validates the write enable signal A4 of either the standard register group 7 or the extension register group 8. As a result, the data on the data bus 11 is written to the register designated by the instruction.

以上のように構成することにより、特定範囲のアドレスに対するメモリアクセスが発生する命令(ロード命令・ストア命令等)の実行時には拡張レジスタをアクセス対象とし、それ以外のアドレスに対するメモリアクセスが発生する命令実行時には標準レジスタをアクセス対象とすることが可能となる。   By configuring as above, instruction execution that causes memory access to other addresses is performed when an instruction that causes memory access to a specific range of addresses (load instruction, store instruction, etc.) is executed. Sometimes it becomes possible to access standard registers.

<動作>
メモリアドレス空間(“0x0000”〜“0xFFFF”番地とする)の“0x8000”番地以降のアドレスにアクセスするときには、拡張レジスタにアクセスするものとする。データメモリ9上のデータの乗算を行い、結果をデータメモリ9にストアするアセンブラプログラムは、以下のようになる。
<Operation>
When accessing addresses after address “0x8000” in the memory address space (addresses “0x0000” to “0xFFFF”), the extension register is accessed. An assembler program that multiplies data on the data memory 9 and stores the result in the data memory 9 is as follows.

LD R0, (0x0000)
LD R0, (0x9000)
MUL R0
ST R0, (0x9000)
この場合の動作波形例を図2に基づいて説明する。この例では、選択信号A3は1ビットとし、拡張レジスタを選択する場合は選択信号A3を“1”にするものとする。
LD R0, (0x0000)
LD R0, (0x9000)
MUL R0
ST R0, (0x9000)
An example of operation waveforms in this case will be described with reference to FIG. In this example, the selection signal A3 is 1 bit, and the selection signal A3 is set to “1” when the extension register is selected.

時刻t=t1において、命令レジスタ2に命令「LD R0,(0x0000)」がロードされ、時刻t=t2においてアドレスA2にはロードアドレスである“0x0000”が出力される。アドレスA2の値が“0x8000”未満であるため、選択信号A3として“0”が出力され、レジスタへのライトイネーブル信号A4により標準レジスタ群7側が有効になる。データバス11にはデータメモリ9のアドレス“0x0000”番地のデータが出力されているので、結果としてデータメモリ9のアドレス“0x0000”番地のデータが標準レジスタR0にロードされる。   At time t = t1, the instruction “LD R0, (0x0000)” is loaded into the instruction register 2, and at time t = t2, “0x0000” which is the load address is output to the address A2. Since the value of the address A2 is less than “0x8000”, “0” is output as the selection signal A3, and the standard register group 7 side is enabled by the write enable signal A4 to the register. Since data at the address “0x0000” of the data memory 9 is output to the data bus 11, as a result, the data at the address “0x0000” of the data memory 9 is loaded into the standard register R0.

時刻t=t2において、命令レジスタ2に命令「LD R0,(0x9000)」がロードされ、時刻t=t3において、アドレスA2にはロードアドレスである“0x9000”が出力される。アドレスA2の値が“0x8000”以上であるため、選択信号A3として“1”が出力され、レジスタへのライトイネーブル信号A4により拡張レジスタ群8側が有効になる。データバス11にはデータメモリ9のアドレス“0x9000”番地のデータが出力されているので、結果としてデータメモリ9のアドレス“0x9000”番地のデータが拡張レジスタER0にロードされる。   At time t = t2, the instruction “LD R0, (0x9000)” is loaded into the instruction register 2, and at time t = t3, the load address “0x9000” is output to the address A2. Since the value of the address A2 is “0x8000” or more, “1” is output as the selection signal A3, and the extension register group 8 side is enabled by the write enable signal A4 to the register. Since data at the address “0x9000” in the data memory 9 is output to the data bus 11, as a result, the data at the address “0x9000” in the data memory 9 is loaded into the extension register ER0.

時刻t=t3において、命令レジスタ2に命令「MUL R0」がロードされ、時刻t=t4において、乗算(R0×ER0)の結果が拡張レジスタER0に代入される。   At time t = t3, the instruction “MUL R0” is loaded into the instruction register 2, and at time t = t4, the result of multiplication (R0 × ER0) is assigned to the extension register ER0.

時刻t=t4において、命令レジスタ2に命令「ST R0,(0x9000)」がロードされ、時刻t=t5において、アドレスA2にはストア先アドレスである“0x9000”が出力される。アドレスA2の値が“0x8000”以上であるため、選択信号A3として“1”が出力され、データバス11には拡張レジスタER0の値が出力され、データメモリ9には拡張レジスタER0の値がストアされる。   At time t = t4, the instruction “STR 0, (0x9000)” is loaded into the instruction register 2, and at time t = t5, “0x9000”, which is a store destination address, is output to the address A2. Since the value of the address A2 is “0x8000” or more, “1” is output as the selection signal A3, the value of the extension register ER0 is output to the data bus 11, and the value of the extension register ER0 is stored in the data memory 9 Is done.

この例のように、命令コード中では標準レジスタR0が指定されているにもかかわらず、実際には拡張レジスタER0をアクセス対象とすることができる。これが本発明の大きなポイントである。すなわち、マイコンに新たな命令の追加や命令フォーマットの変更を行うことなく、拡張レジスタにアクセスすることができる。   As in this example, although the standard register R0 is specified in the instruction code, the extension register ER0 can actually be accessed. This is a major point of the present invention. That is, the extension register can be accessed without adding a new instruction or changing the instruction format in the microcomputer.

ただし、“0x9000”番地のデータを標準レジスタにロードしたい場合でも、この実施例の範疇ではできない。この手法は、メモリ上の同一データが異なる2つ以上のCPUアドレス領域にミラーリングされている場合に適している。ミラーリングは、同一の物理メモリを複数のアドレス空間にマッピングする方式である。この実施例においてアドレス“0x0000”〜“0x7FFF”番地と同じデータがアドレス“0x8000”〜“0xFFFF”番地にミラーリングされているならば、“0x9000”番地のデータは「LD R0, (0x1000)」によって標準レジスタR0にロードすることが可能である。   However, even if it is desired to load the data at the address “0x9000” into the standard register, this cannot be done within the scope of this embodiment. This method is suitable when the same data on the memory is mirrored to two or more different CPU address areas. Mirroring is a method for mapping the same physical memory to a plurality of address spaces. In this embodiment, if the same data as the addresses “0x0000” to “0x7FFF” is mirrored to the addresses “0x8000” to “0xFFFF”, the data at the address “0x9000” is “LD R0, (0x1000)”. The standard register R0 can be loaded.

(実施の形態2)
<構成>
図3は実施の形態2における情報処理装置としてのマイコンの内部の構成を示すブロック図である。符号の1〜13については実施の形態1と同じであるので、その説明を省略する。14は過去に実行された命令の履歴情報を保持する命令履歴保持手段である。選択条件判定手段13は、命令履歴保持手段14が保持する命令の履歴情報を基に選択信号A3を生成するように構成されている。
(Embodiment 2)
<Configuration>
FIG. 3 is a block diagram showing an internal configuration of the microcomputer as the information processing apparatus according to the second embodiment. Since reference numerals 1 to 13 are the same as those in the first embodiment, description thereof is omitted. Reference numeral 14 denotes instruction history holding means for holding history information of instructions executed in the past. The selection condition determination means 13 is configured to generate the selection signal A3 based on the history information of the instruction held by the instruction history holding means 14.

本実施の形態において、命令履歴保持手段14には命令デコーダ3による命令デコード結果A1が入力され、命令履歴保持手段14は過去に実行された命令の履歴を保持し、選択条件判定手段13は命令履歴保持手段14に保持されている命令の履歴情報を基に選択信号A3を生成する。実施の形態1の場合のロード・ストアユニット10から選択条件判定手段13へのアドレスA2の送出はない。命令履歴保持手段14の実装の態様としては、ステートマシンや単純に1命令前の命令情報を保持することなどが考えられる。ここでの命令とは、プリフィックス命令などの特殊な命令に限らず、演算・データ転送命令等の通常の命令も含む。   In this embodiment, the instruction history holding means 14 receives the instruction decode result A1 from the instruction decoder 3, the instruction history holding means 14 holds the history of instructions executed in the past, and the selection condition judging means 13 The selection signal A3 is generated based on the history information of the instructions held in the history holding means 14. There is no transmission of the address A2 from the load / store unit 10 to the selection condition judging means 13 in the first embodiment. As an implementation mode of the instruction history holding unit 14, a state machine or simply holding instruction information of the previous instruction can be considered. The instruction here is not limited to a special instruction such as a prefix instruction but also includes a normal instruction such as an operation / data transfer instruction.

この構成により、レジスタ切り替えを行いたい命令の前に位置する命令の、特定の命令シーケンスを検出し、その結果を基に選択信号A3を生成することが可能になる。これは、ある演算命令(例えば乗除算)が拡張レジスタを暗黙的に使用する場合などに適しており、乗除算命令実行後に最初に実行されるST命令では、(乗除算用の)拡張レジスタをストア対象とすることが可能になる。   With this configuration, it is possible to detect a specific instruction sequence of an instruction positioned before an instruction to be switched, and generate a selection signal A3 based on the result. This is suitable when an operation instruction (for example, multiplication / division) implicitly uses an extension register. For the ST instruction that is executed first after execution of a multiplication / division instruction, the extension register (for multiplication / division) is set. It can be stored.

<動作>
実施の形態2において、
命令1
命令2
MUL R0
命令3
命令4
ST R0, (0x0000)
命令5
というアセンブラ命令で表現される命令を連続実行する場合の動作波形例を図4〜図6に基づいて説明する。
<Operation>
In the second embodiment,
Instruction 1
Instruction 2
MUL R0
Instruction 3
Command 4
ST R0, (0x0000)
Instruction 5
Examples of operation waveforms in the case of continuously executing instructions expressed by assembler instructions will be described with reference to FIGS.

「命令n」(n=0,1…)はMUL命令(乗算命令)とST命令(ストア命令)以外の意味のある命令である。一連の乗算処理のためには必要ないが、説明の都合上置かれている。その他の命令については、すでに説明済みなので、その説明を省略する。   “Instruction n” (n = 0, 1,...) Is a meaningful instruction other than the MUL instruction (multiplication instruction) and the ST instruction (store instruction). Although not necessary for a series of multiplication processes, it is provided for convenience of explanation. Since other instructions have already been described, the description thereof will be omitted.

この命令列の目的は、「乗算を行い、その結果をメモリアドレス“0x0000”番地にストアする」である。ST命令に直接拡張レジスタER0を指定することはできないが、この例では、MUL命令が実行されて以降に最初に実行されるST命令では、標準レジスタの代わりに拡張レジスタを選択する。   The purpose of this instruction sequence is “perform multiplication and store the result at memory address“ 0x0000 ””. Although the extension register ER0 cannot be directly specified in the ST instruction, in this example, the extension instruction is selected instead of the standard register in the ST instruction that is executed first after the MUL instruction is executed.

この条件では、選択条件判定手段13は図4に示すステートマシンで実装することができる。このステートマシンは初期状態でS0ステートであり、MUL命令が検出されるまでS0ステートであり続ける。S0ステートでMUL命令が検出されるとS1ステートに遷移し、ST命令が検出されるまでS1ステートであり続ける。S1ステートでST命令が検出されるとS0ステートに遷移する。また選択信号A3は、「ステートがS1かつST命令」のときに“1”を出力する。   Under this condition, the selection condition determination means 13 can be implemented by the state machine shown in FIG. This state machine is initially in the S0 state and remains in the S0 state until a MUL instruction is detected. When the MUL instruction is detected in the S0 state, the state transits to the S1 state and remains in the S1 state until the ST instruction is detected. When the ST instruction is detected in the S1 state, the state transits to the S0 state. The selection signal A3 outputs “1” when “state is S1 and ST instruction”.

このときの動作波形を図5に基づいて説明する。   The operation waveform at this time will be described with reference to FIG.

時刻t=t1,t2では、命令レジスタ2にロードされる命令がMUL命令ではないため、ステートはS0のままである。   At time t = t1, t2, since the instruction loaded into the instruction register 2 is not a MUL instruction, the state remains S0.

時刻t=t3において、命令レジスタ2にMUL命令がロードされたため、次のクロックでステートはS1に遷移する。   At time t = t3, since the MUL instruction is loaded into the instruction register 2, the state transitions to S1 at the next clock.

時刻t=t4,t5では、命令レジスタ2にロードされる命令がST命令ではないため、ステートはS1のままである。   At time t = t4, t5, since the instruction loaded into the instruction register 2 is not the ST instruction, the state remains S1.

時刻t=t6において、命令レジスタ2に命令「ST R0,(0x0000)」がロードされると、選択条件判定手段13は「ステートがS1かつST命令」であることを検出したため、次のクロックで選択信号A3として“1”が出力され、データバス11には拡張レジスタER0の値が出力される(時刻t7)。その結果、データメモリ9のアドレス“0x0000”番地に拡張レジスタER0の値がライトされる。またステートはS0に遷移する。   When the instruction “STR 0, (0x0000)” is loaded into the instruction register 2 at time t = t6, the selection condition determination unit 13 detects that “state is S1 and ST instruction”. “1” is output as the selection signal A3, and the value of the extension register ER0 is output to the data bus 11 (time t7). As a result, the value of the extension register ER0 is written to the address “0x0000” of the data memory 9. The state transitions to S0.

この例のST命令のように、命令コード中では標準レジスタR0が指定されているにもかかわらず、実際には拡張レジスタER0をアクセス対象とすることができる。   Although the standard register R0 is specified in the instruction code like the ST instruction in this example, the extension register ER0 can actually be accessed.

また、ST命令とMUL命令の間に途中で割り込み処理が入り、割り込み中の処理で何度かST命令が実行される場合の動作波形を図6に基づいて説明する。   An operation waveform when an interrupt process is inserted between the ST instruction and the MUL instruction and the ST instruction is executed several times in the interrupted process will be described with reference to FIG.

時刻t=t1,t2では、MUL命令ではないため、ステートはS0のままである。   At time t = t1, t2, since it is not a MUL instruction, the state remains S0.

時刻t=t3においてMUL命令が検出されたため、t=t4においてステートはS1に遷移する。   Since a MUL instruction is detected at time t = t3, the state transitions to S1 at t = t4.

時刻t=t4ではST命令ではないため、ステートはS1のままである。   Since it is not an ST instruction at time t = t4, the state remains S1.

時刻t=t5において割り込み処理が開始されると、現在のステートS1が退避され、ステートはS0にセットされる。これ以降時刻t=t5〜t7までST命令が実行されるが、ステートがS0であるため「ステートがS1かつST命令」は成立せず、選択手段12は標準レジスタ群7側を選択する。   When interrupt processing is started at time t = t5, the current state S1 is saved and the state is set to S0. Thereafter, the ST instruction is executed from time t = t5 to t7, but since the state is S0, the “state is S1 and ST instruction” is not established, and the selection unit 12 selects the standard register group 7 side.

時刻t=t8において割り込み処理から復帰すると、時刻t=t5で退避したステートの値S1が復帰される。   When returning from the interrupt process at time t = t8, the state value S1 saved at time t = t5 is restored.

時刻t=t9において、命令レジスタ2に命令「ST R0,(0x0000)」がロードされると、選択条件判定手段13は「ステートがS1かつST命令」であることを検出する。したがって、次のクロックで選択信号A3として“1”が出力され、データバス11には拡張レジスタER0の値が出力される。結果、データメモリ9のアドレス“0x0000”番地に拡張レジスタER0の値がライトされる(時刻t10)。またステートはS0に遷移する。   When the instruction “STR 0, (0x0000)” is loaded into the instruction register 2 at time t = t9, the selection condition determination unit 13 detects that the “state is S1 and ST instruction”. Therefore, “1” is output as the selection signal A3 at the next clock, and the value of the extension register ER0 is output to the data bus 11. As a result, the value of the extension register ER0 is written to the address “0x0000” of the data memory 9 (time t10). The state transitions to S0.

このように、MUL命令〜ST命令の間で割り込み処理により追加の命令が実行されても、「MUL命令が実行されて以降に最初に実行されるST命令」の命令列を検出することができる。   As described above, even if an additional instruction is executed by interrupt processing between the MUL instruction and the ST instruction, it is possible to detect the instruction sequence of “ST instruction executed first after the MUL instruction is executed”. .

(実施の形態3)
<構成>
図7は実施の形態3におけるパイプライン方式の情報処理装置としてのマイコンの内部の構成を示すブロック図である。この例では一般的な5段パイプライン方式のマイコンを想定しており、IF(Instruction Fetch:命令フェッチステージ)、ID(Instruction Decode:命令デコードステージ)、EX(Instruction Execution:実行ステージ)、MA(Memory Access:メモリアクセスステージ)、WB(Write/store Back:ライトバックステージ)の5ステージからなる。符号の1〜13については実施の形態1と同じであるので、その説明を省略する。21〜23は各ステージで保持されている命令デコード結果レジスタ、20は3つの命令デコード結果レジスタ21〜23からなる命令情報保持手段、24は演算に使用するデータを保持するレジスタ、25は演算器5の演算結果を保持するレジスタ、26は演算結果25かデータメモリ9のリードデータのいずれかを保持するレジスタ、A5は命令履歴保持手段14が出力する割り込み許可・禁止信号である。
(Embodiment 3)
<Configuration>
FIG. 7 is a block diagram showing an internal configuration of a microcomputer as a pipeline type information processing apparatus according to the third embodiment. In this example, a general five-stage pipeline type microcomputer is assumed, and IF (Instruction Fetch: Instruction Fetch Stage), ID (Instruction Decode: Instruction Decode Stage), EX (Instruction Execution: Execution Stage), MA ( Memory Access: memory access stage) and WB (Write / store Back: write back stage). Since reference numerals 1 to 13 are the same as those in the first embodiment, description thereof is omitted. 21-23 are instruction decode result registers held at each stage, 20 is instruction information holding means comprising three instruction decode result registers 21-23, 24 is a register holding data used for calculation, and 25 is an arithmetic unit 5 is a register for holding the calculation result of 5, the register 26 is for holding either the calculation result 25 or the read data of the data memory 9, and A5 is an interrupt enabling / disabling signal output by the instruction history holding means 14.

各パイプラインステージの動作について説明する。   The operation of each pipeline stage will be described.

命令フェッチステージ(IF)では、命令メモリ1から命令コードをフェッチし(取り出し)、命令レジスタ2に格納する。   In the instruction fetch stage (IF), an instruction code is fetched (taken out) from the instruction memory 1 and stored in the instruction register 2.

命令デコードステージ(ID)では、命令レジスタ2の命令コードを命令デコーダ3でデコードし、結果を命令情報保持手段20におけるデコード済み命令21に格納する。また、後段の実行ステージ(EX)での演算に使用するオペランドを演算オペランド24に格納する。   In the instruction decode stage (ID), the instruction code in the instruction register 2 is decoded by the instruction decoder 3 and the result is stored in the decoded instruction 21 in the instruction information holding means 20. In addition, an operand used for an operation in the subsequent execution stage (EX) is stored in the operation operand 24.

実行ステージ(EX)では、演算器5または演算器6を用いて演算を行い、演算結果25に格納する。ロード命令・ストア命令でのアドレス演算もこのステージで行われる。どのような演算を行うかは、デコード済み命令21により指示される。またデコード済み命令21の内容はデコード済み命令22に渡される。   In the execution stage (EX), the calculation is performed using the calculator 5 or the calculator 6 and stored in the calculation result 25. Address operations with load and store instructions are also performed at this stage. The operation to be performed is instructed by the decoded instruction 21. The content of the decoded instruction 21 is passed to the decoded instruction 22.

メモリアクセスステージ(MA)では、データメモリ9に対するロード・ストアを行う。アドレスは演算結果25に格納されている。ロード命令の場合は、データメモリ9からのリードデータが書き戻しデータ26に格納され、それ以外の(算術演算等の)命令では演算結果25のデータが書き戻しデータ26に保持される。またデコード済み命令22の内容はデコード済み命令23に渡される。   In the memory access stage (MA), the data memory 9 is loaded / stored. The address is stored in the calculation result 25. In the case of a load instruction, the read data from the data memory 9 is stored in the write-back data 26, and in other instructions (such as arithmetic operations), the data of the operation result 25 is held in the write-back data 26. The content of the decoded instruction 22 is passed to the decoded instruction 23.

ライトバックステージ(WB)では、書き戻しデータ26のデータを標準レジスタまたは拡張レジスタのいずれかのレジスタに書き込む。   In the write back stage (WB), the data of the write-back data 26 is written into either the standard register or the extension register.

マイコンのパイプライン段数は5段とは限らず、選択条件判定手段13はライトバックステージ(WB)に位置するとは限らない。また選択手段12は標準レジスタ群7、拡張レジスタ群8への書き込みに限らず、読み出しも制御できる。   The number of pipeline stages of the microcomputer is not necessarily five, and the selection condition determination means 13 is not necessarily located in the write back stage (WB). The selection means 12 can control reading as well as writing to the standard register group 7 and the extension register group 8.

この構成により、選択条件判定手段13は、ライトバックステージ(WB)で実行される命令を命令デコード結果23から得ることができるとともに、その1〜2命令後に実行される命令を命令デコード結果21〜22から得ることができる。そのため、レジスタ切り替えを行いたい命令の後に位置する命令の、特定の命令シーケンスを検出し、その結果を基に選択信号A3を生成することが可能になる(実施の形態2では、レジスタ切り替えを行いたい命令の「前」に位置する命令の、特定の命令シーケンスを検出することに注意。)。   With this configuration, the selection condition determination unit 13 can obtain an instruction to be executed in the write back stage (WB) from the instruction decode result 23, and an instruction to be executed after the 1-2 instruction can be obtained from the instruction decode result 21 to 21. 22 can be obtained. For this reason, it is possible to detect a specific instruction sequence of an instruction located after the instruction for which register switching is to be performed, and to generate the selection signal A3 based on the result (in the second embodiment, register switching is performed). (Note that it detects a specific instruction sequence for the instruction located "before" the instruction you want.)

これは、ある演算命令(例えば乗除算)が拡張レジスタを暗黙的に使用する場合などに適しており、乗除算命令の1または2命令前に実行されるロード命令では、(乗除算用の)拡張レジスタをロード対象とすることが可能になる。   This is suitable when a certain arithmetic instruction (for example, multiplication / division) implicitly uses an extension register. For a load instruction executed one or two instructions before the multiplication / division instruction (for multiplication / division) It becomes possible to load an extension register.

<動作>
実施の形態3において、
LD R0, (0x0000)
命令1
MUL R0
というアセンブラ命令で表現される命令を連続実行する場合の動作波形例を図8に基づいて説明する。
<Operation>
In the third embodiment,
LD R0, (0x0000)
Instruction 1
MUL R0
An operation waveform example in the case of continuously executing the instruction expressed by the assembler instruction will be described with reference to FIG.

「命令n」はMUL命令とLD命令以外の意味のある命令である。一連の乗算処理のためには必要ないが、説明の都合上置かれている。その他の命令の動作についてはすでに説明済みなので、その説明を省略する。   “Instruction n” is a meaningful instruction other than the MUL instruction and the LD instruction. Although not necessary for a series of multiplication processes, it is provided for convenience of explanation. Since the operation of other instructions has already been described, the description thereof is omitted.

この命令列の目的は、「乗算を行う前に、メモリアドレス“0x0000”番地のデータを拡張レジスタER0にロードする」である。LD命令に直接拡張レジスタER0を指定することはできないが、この例では、MUL命令の1〜2命令前に実行されるLD命令では、標準レジスタの代わりに拡張レジスタを選択する。   The purpose of this instruction sequence is “load data at memory address“ 0x0000 ”to extension register ER0 before multiplication”. Although the extension register ER0 cannot be directly specified in the LD instruction, in this example, the extension register is selected instead of the standard register in the LD instruction executed one or two instructions before the MUL instruction.

この例における動作を図8を用いて説明する。   The operation in this example will be described with reference to FIG.

時刻t=t1の命令デコードステージ(ID)で、命令レジスタ2にLD命令がロードされると、命令デコーダ3によりデコードされ、そのデコード結果が時刻t=t2にデコード済み命令21に保持される。   When an LD instruction is loaded into the instruction register 2 at the instruction decode stage (ID) at time t = t1, it is decoded by the instruction decoder 3, and the decoded result is held in the decoded instruction 21 at time t = t2.

時刻t=t2の実行ステージ(EX)で、演算器6によりLD命令のロード元メモリアドレスが計算され、その結果が時刻t=t3に演算結果25に保持される。それと同時に、デコード済み命令21の内容がデコード済み命令22に保持される。   At the execution stage (EX) at time t = t2, the arithmetic unit 6 calculates the load source memory address of the LD instruction, and the result is held in the operation result 25 at time t = t3. At the same time, the content of the decoded instruction 21 is held in the decoded instruction 22.

時刻t=t3のメモリアクセスステージ(MA)で、演算結果25の値(LD命令のアドレスである)がデータメモリ9のアドレスA2に出力され、時刻t=t4にメモリリードデータが書き戻しデータ26に保持される。それと同時に、デコード済み命令22の内容がデコード済み命令23に保持される。   At the memory access stage (MA) at time t = t3, the value of the operation result 25 (the address of the LD instruction) is output to the address A2 of the data memory 9, and the memory read data is written back at time t = t4. Retained. At the same time, the contents of the decoded instruction 22 are held in the decoded instruction 23.

一方、MUL命令に着目すると、MUL命令は時刻t=t3で命令レジスタ21にロードされ、時刻t=t4でデコード済み命令22に保持される。   On the other hand, paying attention to the MUL instruction, the MUL instruction is loaded into the instruction register 21 at time t = t3 and held in the decoded instruction 22 at time t = t4.

すなわち、時刻t=t4では、デコード済み命令23はLD命令を示しており、デコード済み命令21はMUL命令を示している。このことから、選択条件判定手段13は時刻t=t4において、この時刻にライトバックステージ(WB)で実行される命令がLD命令であることと、そのLD命令はMUL命令の2命令前に位置することが判定できることから、「MUL命令の1〜2命令前に実行されるLD命令」の条件に合致することになる。したがって、選択信号A3に“1”を出力することで、レジスタへのライトイネーブル信号A4は拡張レジスタ群8側が有効になる。同時にデータバス11には書き戻しデータ26の値(これはデータメモリアドレス“0x0000”番地のデータである)が出力されていることから、時刻t=t5でデータメモリアドレス“0x0000”番地のデータが拡張レジスタER0にロードされる。   That is, at time t = t4, the decoded instruction 23 indicates an LD instruction, and the decoded instruction 21 indicates a MUL instruction. Therefore, the selection condition determination means 13 determines that the instruction executed at the write back stage (WB) at this time is the LD instruction at the time t = t4, and that the LD instruction is located two instructions before the MUL instruction. Therefore, the condition of “LD instruction executed 1 to 2 instructions before the MUL instruction” is met. Therefore, by outputting “1” as the selection signal A3, the write enable signal A4 to the register becomes valid on the extension register group 8 side. At the same time, since the value of the write-back data 26 is output to the data bus 11 (this is the data at the data memory address “0x0000”), the data at the data memory address “0x0000” is stored at time t = t5. Loaded into extension register ER0.

この例のLD命令のように、命令コード中では標準レジスタR0が指定されているにもかかわらず、実際には拡張レジスタER0をアクセス対象とすることができる。   Although the standard register R0 is specified in the instruction code like the LD instruction in this example, the extension register ER0 can actually be the access target.

ただし、割り込み処理により、LD命令とMUL命令の間に2命令以上の命令が実行されると、「MUL命令の1〜2命令前に実行されるLD命令」であることを認識できない。したがって、実施の形態2で説明した命令履歴保持手段14より割り込み許可・禁止信号A5を出力することにより、LD命令を認識してからMUL命令を認識するまでの期間、割り込みを禁止する。   However, if two or more instructions are executed between the LD instruction and the MUL instruction by the interrupt process, it cannot be recognized that it is an “LD instruction executed one or two instructions before the MUL instruction”. Therefore, by outputting the interrupt permission / inhibition signal A5 from the instruction history holding unit 14 described in the second embodiment, the interruption is prohibited during the period from the recognition of the LD instruction to the recognition of the MUL instruction.

本発明の情報処理装置は、命令コードの追加や拡張を行うことなくレジスタ数拡張を行うことができ、拡張前の情報処理装置との高い互換性を保つことが可能な情報処理装置として有用である。   The information processing apparatus of the present invention is useful as an information processing apparatus that can expand the number of registers without adding or extending an instruction code and can maintain high compatibility with an information processing apparatus before expansion. is there.

また、明示的なレジスタ切り替えのための追加の実行サイクルを消費することなく、標準レジスタアクセスと同等の実行サイクル・命令数で拡張レジスタにアクセスすることが可能となるので、レジスタを拡張しながらコードサイズ・実行サイクルが拡張前の情報処理装置と比べて増加しない情報処理装置として有用である。   In addition, the extension register can be accessed with the same execution cycle and number of instructions as standard register access without consuming additional execution cycles for explicit register switching. This is useful as an information processing apparatus in which the size and execution cycle do not increase as compared with the information processing apparatus before expansion.

本発明の実施の形態1の情報処理装置としてのマイコンの内部の構成を示すブロック図The block diagram which shows the internal structure of the microcomputer as an information processing apparatus of Embodiment 1 of this invention 本発明の実施の形態1のタイミングチャートTiming chart of Embodiment 1 of the present invention 本発明の実施の形態2の情報処理装置としてのマイコンの内部の構成を示すブロック図The block diagram which shows the internal structure of the microcomputer as an information processing apparatus of Embodiment 2 of this invention 本発明の実施の形態2における命令シーケンス判定回路の状態遷移図State transition diagram of instruction sequence determination circuit in Embodiment 2 of the present invention 本発明の実施の形態2のタイミングチャート(その1)Timing chart of embodiment 2 of the present invention (part 1) 本発明の実施の形態2のタイミングチャート(その2)Timing chart of embodiment 2 of the present invention (part 2) 本発明の実施の形態3の情報処理装置としてのマイコンの内部の構成を示すブロック図The block diagram which shows the structure inside the microcomputer as information processing apparatus of Embodiment 3 of this invention 本発明の実施の形態3のタイミングチャートTiming chart of Embodiment 3 of the present invention

符号の説明Explanation of symbols

1 命令メモリ
2 命令レジスタ
3 命令デコーダ
4 命令制御部
5 拡張レジスタ群を使用しない演算器
6 拡張レジスタ群を使用する演算器
7 標準レジスタ群
8 拡張レジスタ群
9 データメモリ
10 ロード・ストアユニット
11 データバス
12 選択手段
13 選択条件判定手段
14 命令履歴保持手段
20 命令情報保持手段
21〜23 各ステージで保持されている命令デコード結果レジスタ
24 演算器5で使用するデータを保持するレジスタ
25 演算器5の演算結果を保持するレジスタ
26 演算結果25かデータメモリ9のリードデータのいずれかを保持するレジスタ
A1 命令デコード結果(制御信号)
A2 メモリアドレス
A3 選択信号
A4 各レジスタへのリードイネーブル信号/リードデータ/ライトイネーブル信号/ライトデータ
A5 割り込み許可・禁止信号
DESCRIPTION OF SYMBOLS 1 Instruction memory 2 Instruction register 3 Instruction decoder 4 Instruction control part 5 Arithmetic unit which does not use an extension register group 6 Arithmetic unit which uses an extension register group 7 Standard register group 8 Extension register group 9 Data memory 10 Load / store unit 11 Data bus DESCRIPTION OF SYMBOLS 12 Selection means 13 Selection condition determination means 14 Instruction log | history holding means 20 Instruction information holding means 21-23 Instruction decode result register | resistor 24 hold | maintained in each stage 24 Register which hold | maintains the data used with the calculator 5 Register 26 that holds the result Register that holds either the operation result 25 or the read data of the data memory 9 A1 Instruction decode result (control signal)
A2 Memory address A3 Select signal A4 Read enable signal / read data / write enable signal / write data to each register A5 Interrupt enable / disable signal

Claims (6)

命令を格納する命令メモリと、
データを格納するデータメモリと、
前記命令メモリから読み出された命令に従って制御信号を生成する命令制御部と、
前記命令制御部による前記制御信号に従って前記データメモリに対してアクセスを行うロード・ストアユニットと、
前記命令制御部による前記制御信号に従って演算を行う演算器と、
前記演算器で用いるデータを格納する標準レジスタ群と、
前記演算器で用いるデータを格納する拡張レジスタ群と、
選択信号により前記標準レジスタ群と前記拡張レジスタ群とのいずれかを選択する選択手段と、
前記選択手段に対し前記選択信号を出力する選択条件判定手段とを備え、
前記選択条件判定手段は、装置内部の特定の状態信号に基づいて前記選択信号を生成するように構成されている情報処理装置。
An instruction memory for storing instructions;
Data memory for storing data;
An instruction control unit that generates a control signal according to an instruction read from the instruction memory;
A load / store unit that accesses the data memory in accordance with the control signal by the instruction control unit;
An arithmetic unit that performs an operation according to the control signal by the instruction control unit;
A group of standard registers for storing data used in the computing unit;
An extension register group for storing data used in the arithmetic unit;
A selection means for selecting one of the standard register group and the extension register group by a selection signal;
Selection condition determination means for outputting the selection signal to the selection means,
The information processing apparatus configured to generate the selection signal based on a specific state signal inside the apparatus.
前記選択条件判定手段は、メモリアクセスが発生する命令実行時に前記ロード・ストアユニットで生成されるアドレスを用いて前記選択信号を生成する請求項1に記載の情報処理装置。   The information processing apparatus according to claim 1, wherein the selection condition determination unit generates the selection signal using an address generated by the load / store unit when executing an instruction that causes a memory access. 前記選択条件判定手段は、過去に実行された命令の履歴情報を保持する命令履歴保持手段を備え、前記命令履歴保持手段が保持する命令の履歴情報を基に前記選択信号を生成する請求項1に記載の情報処理装置。   2. The selection condition determining means includes instruction history holding means for holding history information of instructions executed in the past, and generates the selection signal based on instruction history information held by the instruction history holding means. The information processing apparatus described in 1. 前記命令履歴保持手段は、割り込み処理開始時に、過去に実行された命令の履歴情報を退避し、割り込み復帰時に前記命令の履歴情報を復帰させる請求項3に記載の情報処理装置。   The information processing apparatus according to claim 3, wherein the instruction history holding unit saves history information of instructions executed in the past when interrupt processing is started, and restores history information of the instructions when interrupt is restored. パイプライン方式で動作する情報処理装置として構成され、
前記命令制御部は命令情報を生成するように構成され、
さらに各パイプラインステージに対応した前記命令情報を保持する命令情報保持手段を備え、
前記選択条件判定手段は、前記命令情報保持手段に保持されている前記命令情報を用いて前記選択信号を生成するように構成されている請求項1に記載の情報処理装置。
It is configured as an information processing device that operates in a pipeline system,
The instruction control unit is configured to generate instruction information;
Furthermore, it comprises instruction information holding means for holding the instruction information corresponding to each pipeline stage,
The information processing apparatus according to claim 1, wherein the selection condition determination unit is configured to generate the selection signal using the command information held in the command information holding unit.
さらに、過去に実行された命令の履歴情報を保持する命令履歴保持手段を備え、前記命令履歴保持手段は、過去に実行された命令の特定の並びを検出し割り込み処理を禁止する請求項5に記載の情報処理装置。   6. The apparatus according to claim 5, further comprising instruction history holding means for holding history information of instructions executed in the past, wherein the instruction history holding means detects a specific sequence of instructions executed in the past and prohibits interrupt processing. The information processing apparatus described.
JP2008261759A 2008-10-08 2008-10-08 Information processor Pending JP2010092273A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008261759A JP2010092273A (en) 2008-10-08 2008-10-08 Information processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008261759A JP2010092273A (en) 2008-10-08 2008-10-08 Information processor

Publications (1)

Publication Number Publication Date
JP2010092273A true JP2010092273A (en) 2010-04-22

Family

ID=42254921

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008261759A Pending JP2010092273A (en) 2008-10-08 2008-10-08 Information processor

Country Status (1)

Country Link
JP (1) JP2010092273A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5822848B2 (en) * 2010-12-20 2015-11-25 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Exception control method, system and program
JP2018534671A (en) * 2015-10-14 2018-11-22 エイアールエム リミテッド Forward prefix instruction

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP5822848B2 (en) * 2010-12-20 2015-11-25 インターナショナル・ビジネス・マシーンズ・コーポレーションInternational Business Machines Corporation Exception control method, system and program
JP2018534671A (en) * 2015-10-14 2018-11-22 エイアールエム リミテッド Forward prefix instruction

Similar Documents

Publication Publication Date Title
JP7048612B2 (en) Vector generation instruction
JP5414057B2 (en) Microcomputer
CN110515656A (en) CASP instruction execution method, microprocessor and computer equipment
CN101201736B (en) Mathematical operation processing apparatus
US7523295B2 (en) Processor and method of grouping and executing dependent instructions in a packet
JP2010092273A (en) Information processor
JP4243271B2 (en) Data processing apparatus and data processing method
CN108920188B (en) Method and device for expanding register file
JP2008527559A (en) Processor and instruction issuing method thereof
KR19980024622A (en) Program execution method and device using the method
JP4889235B2 (en) Program control processor
US20110010529A1 (en) Instruction execution control method, instruction format, and processor
JP3915019B2 (en) VLIW processor, program generation device, and recording medium
JP4151497B2 (en) Pipeline processing equipment
JP4159586B2 (en) Information processing apparatus and information processing speed-up method
JP5263497B2 (en) Signal processor and semiconductor device
JP3147884B2 (en) Storage device and information processing device
JP5263498B2 (en) Signal processor and semiconductor device
JP5311008B2 (en) Signal processor and semiconductor device
JP4702004B2 (en) Microcomputer
KR100961242B1 (en) How to Delay Instructions and System to Delay Instructions
JP5679263B2 (en) Information processing apparatus and microinstruction processing method
JP2004362368A (en) Processor and exception handling method
JP2010020625A (en) Signal processing processor and semiconductor device
JP2007058330A (en) Microprocessor and I / O port replacement method