JPH07262087A - Processor - Google Patents

Processor

Info

Publication number
JPH07262087A
JPH07262087A JP5615194A JP5615194A JPH07262087A JP H07262087 A JPH07262087 A JP H07262087A JP 5615194 A JP5615194 A JP 5615194A JP 5615194 A JP5615194 A JP 5615194A JP H07262087 A JPH07262087 A JP H07262087A
Authority
JP
Japan
Prior art keywords
bank
ram
address
cbp
register
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
JP5615194A
Other languages
Japanese (ja)
Inventor
Seiji Shiino
誠治 子井野
Toshiyuki Yaguchi
俊行 矢口
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 JP5615194A priority Critical patent/JPH07262087A/en
Publication of JPH07262087A publication Critical patent/JPH07262087A/en
Pending legal-status Critical Current

Links

Abstract

PURPOSE:To provide a processor which controls a register bank in order to enable the mapping area of general-purpose register to keep out of saving area of a control register and can improve the register-using efficiency and the program-executing speed. CONSTITUTION:This processor is provided with a state control part 1 which generates a bank RAM address with a current bank pointer and the bank size and performs the bank switch control when true mapping (saving/returning) of data is performed between a RAM and a register, a latch circuit L31 which stores the saving area vague of the RAM of a control register, and an address generating part 7 which changes the bank RAM address when the saving area value is coincident with the bank RAM address and generates a new bank RAM address to change the mapping area of the bank RAM.

Description

【発明の詳細な説明】Detailed Description of the Invention

【0001】[0001]

【産業上の利用分野】この発明は、RAM(ランダム・
アクセス・メモリ)と汎用レジスタをバスで結合し、カ
レントバンクポインタで示されるRAMの内容と汎用レ
ジスタの内容を一致させるように構成して切り替え制御
されるレジスタバンクを有するプロセッサに関する。
BACKGROUND OF THE INVENTION The present invention relates to a RAM (random
The present invention relates to a processor having a register bank which is configured to connect the access memory) and a general-purpose register via a bus, and which is configured to match the contents of the RAM indicated by the current bank pointer with the contents of the general-purpose register and which is switch-controlled.

【0002】[0002]

【従来の技術】汎用レジスタとバンクRAM(以下RA
Mと呼ぶ)とを高速バスで結合し、バンクポインタで示
されるRAMの内容と汎用レジスタの内容を一致させる
ようにして構成したレジスタバンクを備えたマイクロプ
ロセッサにおいては、命令のデスティネーションオペラ
ンドでカレントバンクポインタ(CBP)を指定するこ
とにより、図6に示すように、汎用レジスタのデータを
元のCBP(旧CBP)で与えられるアドレスのRAM
領域に退避し、CBPの書き換えを行い、書き換え後の
CBPで与えられるアドレスのRAM領域からデータを
汎用レジスタに復帰しバンクを切り替えることによって
バンクの写像(退避/復帰)を行い、タスクチェンジを
行う場合には、自動的にバンクバスを介したレジスタデ
ータの退避/復帰が行われる。
2. Description of the Related Art General-purpose registers and bank RAMs (hereinafter RA
(Referred to as M) by a high-speed bus to match the contents of the RAM indicated by the bank pointer with the contents of the general-purpose register. By designating the bank pointer (CBP), as shown in FIG. 6, the data of the general-purpose register is the RAM of the address given by the original CBP (old CBP).
Saving the area, rewriting the CBP, restoring the data from the RAM area at the address given by the rewritten CBP to the general-purpose register, and switching the bank to perform bank mapping (saving / restoring) and task change. In this case, the register data is automatically saved / restored via the bank bus.

【0003】このようなレジスタバンクの制御は、プロ
セッサに備えられた例えば図7に示すレジスタバンク制
御部によって行われる。
Such control of the register bank is performed by, for example, a register bank controller shown in FIG. 7 provided in the processor.

【0004】図7において、例えば汎用レジスタ16ビ
ット×16本、4レジスタを1バンクとし、制御レジス
タの退避領域を(CBP−1)とした場合に、ステート
制御部1は、演算制御部(図示せず)から与えられるC
BP書換制御信号(CBPC)とバンクサイズ指定レジ
スタで指定されるバンクサイズ(BS)を受けて、リー
ド/ライト信号(R/W),バンクアドレス(BNK
A)を生成し、生成したバンクアドレスはクロック信号
(CLK2)に同期してステート制御部1に取り込まれ
る。また、このバンクアドレスはCBPと加算器2によ
り加算されてラッチ回路L62(以下、ラッチ回路の符
号の末尾の数字1又は2はクロック信号CLK1又はC
LK2に同期していることを示す)にラッチされ、RA
Mアドレス(RAMAD)として出力される。このよう
なステート制御部1により、図8のステート状態遷移に
示すように、4つのバンクが切り替え制御される。
In FIG. 7, for example, when the general-purpose register is 16 bits × 16, four registers are one bank, and the save area of the control register is (CBP-1), the state control unit 1 has an arithmetic control unit (FIG. C given by (not shown)
In response to the BP rewrite control signal (CBPC) and the bank size (BS) designated by the bank size designation register, the read / write signal (R / W), the bank address (BNK)
A) is generated, and the generated bank address is taken into the state controller 1 in synchronization with the clock signal (CLK2). Further, this bank address is added by CBP and the adder 2 to generate the latch circuit L62 (hereinafter, the numeral 1 or 2 at the end of the code of the latch circuit is the clock signal CLK1 or C).
(Indicating that it is synchronized with LK2), RA
It is output as an M address (RAMAD). The state controller 1 controls switching of four banks as shown in the state transition of FIG.

【0005】具体的には、命令デコード部で命令コード
をデコードした結果、CBPの書き換えを伴う命令であ
ることが判明すると、演算制御部からCBP書換制御信
号(CBPC)が出力され、16ビットレジスタ×16
本構成の汎用レジスタにおいてレジスタ4本を1バンク
とした場合に、レジスタR0〜R3(バンク1)、R4
〜R7(バンク2)、R8〜R11(バンク3)、R1
2〜R15(バンク4)がそれぞれ1バンクとなり、汎
用レジスタとRAMとのデータの受け渡しは、64ビッ
ト単位のバンクバスを介して1バンクづつ行われる。
Specifically, when the instruction decoding unit decodes the instruction code and finds that the instruction involves rewriting of the CBP, the arithmetic control unit outputs a CBP rewriting control signal (CBPC) to the 16-bit register. X16
In the general-purpose register of this configuration, if four registers are set as one bank, registers R0 to R3 (bank 1), R4
To R7 (bank 2), R8 to R11 (bank 3), R1
2 to R15 (bank 4) are each one bank, and data transfer between the general-purpose register and the RAM is performed one bank at a time through the bank bus in units of 64 bits.

【0006】次に、汎用レジスタの退避/復帰動作につ
いて説明する。
Next, the saving / restoring operation of the general-purpose register will be described.

【0007】汎用レジスタのデータはバンク1から順に
バンクサイズ指定レジスタのバンクサイズで示されるバ
ンク(BS+1)まで、まず汎用レジスタからアドレス
(CBP×8)のRAMの領域に転送される。すなわ
ち、バンク1〜4はそれぞれCBP×8、(CBP+
1)×8、(CBP+2)×8、(CBP+3)×8で
示される領域のRAMに転送される。そして、汎用レジ
スタからRAMへの転送が終了するサイクルにおいてC
BPの書き込み要求信号がラッチされ、データレジスタ
から内部バスを介してCBPの書き込みが行われる。次
のサイクルから、(新CBP×8)のRAMの領域から
バンク1へのデータ転送が開始される。以下、バンク2
〜4も同様にして転送される。
The data of the general purpose register is transferred from the bank 1 to the bank (BS + 1) indicated by the bank size of the bank size designation register in order from the general purpose register to the RAM area of the address (CBP × 8). That is, banks 1 to 4 are CBP × 8 and (CBP +
1) × 8, (CBP + 2) × 8, (CBP + 3) × 8. Then, in the cycle in which the transfer from the general-purpose register to the RAM ends, C
The write request signal of BP is latched, and CBP is written from the data register via the internal bus. From the next cycle, data transfer from the (new CBP × 8) RAM area to bank 1 is started. Below, Bank 2
4 are similarly transferred.

【0008】次に、CBPの書き換え制御中のバンク制
御部の動作を説明する。
Next, the operation of the bank controller during the CBP rewriting control will be described.

【0009】バンク制御部では、バンクアドレスとRA
Mアドレスを生成し、それぞれに対するリード/ライト
制御を行っている。CBPの転送時のバンクアドレスは
例えば2ビットで00(バンク1)、01(バンク
2)、10(バンク3)、11(バンク4)に対応して
いる。したがって、CBPの書き換え開始時にはバンク
アドレスは“00”にセットされ、1クロック毎に1つ
づつインクリメントされる。RAMアドレスは、CBP
とバンクアドレスを加算し、3ビット左シフトして得ら
れる。このように、バンクアドレスをインクリメントに
よって算出しているので、CBPの書き換え時には連続
した(BS+1)バンクが退避/復帰される。
In the bank controller, the bank address and RA
M addresses are generated, and read / write control is performed for each. The bank address at the time of CBP transfer is, for example, 2 bits and corresponds to 00 (bank 1), 01 (bank 2), 10 (bank 3), and 11 (bank 4). Therefore, the bank address is set to "00" at the start of rewriting of the CBP and incremented by one for each clock. RAM address is CBP
And the bank address are added, and the value is obtained by shifting left by 3 bits. In this way, since the bank address is calculated by incrementing, consecutive (BS + 1) banks are saved / restored when the CBP is rewritten.

【0010】このようなバンク切り替え動作において、
旧CBPの汎用レジスタの写像領域と新しいCBP(新
CBP)の汎用レジスタの写像領域を重ね合わせるよう
にCBPを書き換えるようにすると、パラメータの受け
渡しが実現できる。
In such a bank switching operation,
When the CBP is rewritten so that the mapping area of the general purpose register of the old CBP and the mapping area of the general purpose register of the new CBP (new CBP) are rewritten, the parameter can be passed.

【0011】バンクチェンジによるパラメータの受け渡
しはCBPを結果的に減算することによって行われる。
汎用レジスタが例えば4バンク構成の場合は、任意の命
令のデスティネーションとしてCBPを指定し、演算結
果が現在のCBPよりバンクサイズ(BS)以内でかつ
小さい場合にパラメータの受け渡しが実現できる。
The transfer of parameters by bank change is performed by subtracting CBP as a result.
When the general-purpose register has, for example, a 4-bank configuration, CBP can be designated as the destination of an arbitrary instruction, and the parameter can be passed when the operation result is within the bank size (BS) and smaller than the current CBP.

【0012】一方、RAMは割込み発生時の汎用レジス
タの退避/復帰にも使用される。したがって、RAM使
用中のタスクでは、(CBP−1)×8のRAMの領域
がプログラムカウンタ、プロセッサステータスワード等
の制御レジスタの退避領域として設定されており、制御
レジスタは割込み発生時にはこの領域に退避される。
On the other hand, the RAM is also used for saving / restoring general purpose registers when an interrupt occurs. Therefore, in the task using the RAM, the RAM area of (CBP-1) × 8 is set as the save area for the control register such as the program counter and the processor status word, and the control register is saved in this area when an interrupt occurs. To be done.

【0013】しかしながら、上述したようなレジスタバ
ンク構成では、制御レジスタの退避領域が汎用レジスタ
のデータ領域を1〜4バンク毎に分断するため、汎用レ
ジスタの写像領域の重ね合わせによるパラメータの受け
渡しを行う際の障害となることがある。
However, in the register bank configuration as described above, the save area of the control register divides the data area of the general-purpose register into 1 to 4 banks, so that the parameters are transferred by superimposing the mapping areas of the general-purpose register. It may be an obstacle.

【0014】サブルーチンコール時のパラメータの受け
渡しの場合は、受け渡す変数以外の領域は作業領域であ
るので特に問題はない。しかし、プログラムで扱う変数
が汎用レジスタ数より大きい場合にはバンク切り替えを
行い、メモリアクセスをできるだけ少なくすることが望
ましい場合がある。しかしながら、ノンマスカブル割込
み(NMI)は禁止できないので、制御レジスタ用の退
避領域にパラメータを常駐させることはできない。
In the case of passing parameters at the time of subroutine call, there is no particular problem because the area other than the passed variables is the work area. However, if the variables handled by the program are larger than the number of general-purpose registers, it may be desirable to perform bank switching to minimize memory access. However, since non-maskable interrupts (NMI) cannot be prohibited, parameters cannot be made resident in the save area for control registers.

【0015】例えば、CBPを“2”減算して2バンク
をパラメータの受け渡しに使用する場合は、新たにデー
タ領域として使用できる2バンクのうちレジスタR4〜
R7に相当するRAM領域は旧CBPの時に割込み発生
時の制御レジスタ退避用として使用されるので、CBP
の書き換え後には中間変数としてしか使用することがで
きない。
For example, when CBP is subtracted by "2" and two banks are used for passing parameters, among the two banks which can be newly used as a data area, the registers R4 to R4.
Since the RAM area corresponding to R7 is used for saving the control register when an interrupt occurs in the old CBP, the CBP
Can be used only as an intermediate variable after rewriting.

【0016】このため、レジスタR4〜R7をデータ領
域として使用したい場合には、他のデータ領域から必要
なデータを汎用レジスタに命令でロードし、CBPを書
き戻す前にストアしなければならない。したがって、メ
モリアクセスが必要となり、実行時間が長くなることに
なる。
For this reason, when it is desired to use the registers R4 to R7 as a data area, it is necessary to load necessary data from another data area into a general-purpose register by an instruction and store the CBP before writing it back. Therefore, memory access becomes necessary and the execution time becomes long.

【0017】[0017]

【発明が解決しようとする課題】以上説明したように、
従来のバンク切り替え制御においては、バンクアドレス
とCBPを加算した値を3ビット左シフトした結果をバ
ンクの写像領域のRAMアドレスとして使用しており、
汎用レジスタの写像領域のRAMは連続した(BS+
1)バンク分に対応していた。
As described above,
In the conventional bank switching control, the result of shifting the value obtained by adding the bank address and CBP to the left by 3 bits is used as the RAM address of the mapping area of the bank.
The RAM in the mapping area of the general-purpose register is continuous (BS +
1) It corresponded to the bank.

【0018】このため、バンクアドレスとRAMアドレ
スを独立して制御することができず、レジスタの使用効
率が悪化し、プログラムの実行速度の低下を招いてい
た。
Therefore, the bank address and the RAM address cannot be controlled independently, the use efficiency of the register is deteriorated, and the execution speed of the program is lowered.

【0019】また、割込み退避領域が汎用レジスタのデ
ータ領域と重複する場合が発生し、これを回避するため
にプログラムに制約を受けるといった不具合を招いてい
た。
In addition, the interrupt save area sometimes overlaps with the data area of the general-purpose register, which causes a problem that the program is restricted to avoid this.

【0020】そこで、この発明は、上記に鑑みてなされ
たものであり、第1の目的とするところは、汎用レジス
タの写像領域が制御レジスタの退避領域を避けるように
レジスタバンクを制御して、レジスタの使用効率を向上
させてプログラムの実行速度を高めたプロセッサを提供
することにある。
Therefore, the present invention has been made in view of the above, and a first object thereof is to control a register bank so that a mapping area of a general-purpose register avoids a saving area of a control register, It is to provide a processor with improved register usage efficiency and increased program execution speed.

【0021】また、第2の目的とするところは、割込み
時の制御レジスタの退避領域と汎用レジスタのデータ領
域との重複を回避して、プログラミングの自由度を高め
たプロセッサを提供することにある。
A second object is to provide a processor with a high degree of programming freedom by avoiding duplication of the control register save area and the general register data area at the time of interruption. .

【0022】[0022]

【課題を解決するための手段】上記目的を達成するため
に、請求項1記載の発明は、バンク化されたRAMとレ
ジスタとの間でデータの写像(退避/復帰)が行われる
際に、カレントバンクポインタ(CBP)とバンクサイ
ズを受けて、バンクアドレスとRAMのアクセスアドレ
スとなるバンクRAMアドレスを生成して、バンクを切
り替えを制御するステート制御部と、RAM上における
レジスタデータの写像領域が重複するようにCBPが書
き換えられた場合に、制御レジスタのRAM上における
退避領域を示す退避領域値を算出して写像が終了するま
で記憶し、退避領域値とバンクRAMアドレスとが一致
した場合にRAMアドレスを変更し、RAMの写像領域
を変更する新たなバンクRAMアドレスを生成するアド
レス変更部とから構成される。
In order to achieve the above object, the invention according to claim 1 is such that when data mapping (saving / restoring) is performed between a banked RAM and a register, A state control unit that controls a bank switching by generating a bank RAM address that is a bank address and a RAM access address by receiving a current bank pointer (CBP) and a bank size, and a register data mapping area on the RAM. When the CBPs are rewritten so as to overlap, a save area value indicating the save area on the RAM of the control register is calculated and stored until the mapping ends, and when the save area value and the bank RAM address match. From the address changing unit that changes the RAM address and generates a new bank RAM address that changes the mapping area of the RAM It is made.

【0023】請求項2記載の発明は、請求項1記載の発
明において、前記アドレス変更部が、新CBPと旧CB
Pとを保持し、RAM上におけるレジスタデータの写像
領域が重複するようにCBPが書き換えられた場合に、
保持した両値を比較することによってカレントバンクポ
インタの増減を判別する判別部と、判別部によって保持
された旧CBPから制御レジスタのRAM上における退
避領域を示す退避領域値を算出し、算出した退避領域値
を判別部の判別結果に基づいて取り込み、データの写像
が終了するまで記憶する記憶部と、記憶部に記憶された
退避領域値とステート制御部で生成されたバンクRAM
アドレスとを比較して、両者が一致した場合には予め設
定されたバンクRAMアドレスのスキップ値を出力する
比較部と、比較部から出力されたスキップ値にステート
制御部で生成されたバンクRAMアドレスを加えてRA
Mアドレスを変更し、バンクRAMの写像領域を変更す
る新たなバンクRAMアドレスを生成するアドレス生成
部とを備えて構成される。
According to a second aspect of the present invention, in the first aspect of the invention, the address changing unit is a new CBP and an old CB.
When P and P are held and CBP is rewritten so that the mapping areas of the register data on the RAM overlap,
A discriminating unit that discriminates an increase / decrease of the current bank pointer by comparing the stored values, and a save region value indicating a save region on the RAM of the control register from the old CBP held by the discriminating unit, and the calculated save A storage unit that captures an area value based on the determination result of the determination unit and stores the data until the mapping of data is completed, a save area value stored in the storage unit, and a bank RAM generated by the state control unit
The address is compared with each other, and when the two match, the comparison unit that outputs the skip value of the preset bank RAM address, and the bank RAM address generated by the state control unit to the skip value output from the comparison unit Add RA
And an address generation unit that generates a new bank RAM address that changes the M address and changes the mapping area of the bank RAM.

【0024】請求項3記載の発明は、請求項2記載の発
明において、命令でCBPを書き換える場合に、CBP
の相対的な増減がデコード結果により判明する命令に対
して命令デコード後、制御レジスタの退避領域と新CB
Pで示されるレジスタの写像領域が重なるか否かを判別
する判別回路を命令デコード部に備え、前記記憶回路
は、判別回路の判別結果に応じて退避領域値を取り込み
記憶して構成される。
According to the invention of claim 3, in the invention of claim 2, when the CBP is rewritten by an instruction, the CBP is changed.
After the instruction is decoded for the instruction whose relative increase / decrease is found from the decoding result, the save area of the control register and the new CB
The instruction decoding unit is provided with a discriminating circuit for discriminating whether or not the mapping areas of the register indicated by P overlap each other, and the memory circuit is configured to fetch and store the save area value according to the discrimination result of the discriminating circuit.

【0025】請求項4記載の発明は、請求項2又は3記
載の発明において、複数の前記記憶部と、複数の記憶部
にそれぞれ対応して設けられた複数の前記比較部と、記
憶部に記憶される退避領域をそれぞれの記憶部に振り分
け制御するデマルチプレクサと、複数の比較部における
比較結果の論理和を前記アドレス生成部に与える論理ゲ
ートとから構成される。
According to a fourth aspect of the invention, in the invention according to the second or third aspect, the plurality of storage units, the plurality of comparison units provided respectively corresponding to the plurality of storage units, and the storage unit are provided. It is composed of a demultiplexer for controlling the storage area to be stored in each storage unit, and a logic gate for giving a logical sum of comparison results of a plurality of comparison units to the address generation unit.

【0026】[0026]

【作用】上記構成において、請求項1又は2記載の発明
は、命令によりCBPを書き換えることによってバンク
チェンジを行う場合に、特にレジスタの写像領域を重ね
合わせてパラメータの受け渡しを行う場合に、制御レジ
スタの退避領域を避けて汎用レジスタの写像領域となる
ようにレジスタバンクを制御するようにしている。
In the above structure, the invention according to claim 1 or 2 is a control register when a bank change is performed by rewriting a CBP by an instruction, particularly when parameter mapping is performed by superimposing register mapping areas. The register bank is controlled so as to avoid the save area and become the mapping area of the general-purpose register.

【0027】請求項3記載の発明は、命令デコード部に
おいて命令デコード後直ちに退避領域と新CBPで示さ
れるレジスタの写像領域が重なるか否かを判別するよう
にしている。
According to the third aspect of the present invention, the instruction decoding unit determines whether or not the save area and the mapping area of the register indicated by the new CBP overlap immediately after the instruction is decoded.

【0028】請求項4記載の発明は、プログラム実行後
の複数の退避領域を記憶して、パラメータの受け渡しを
多重に行えるようにしている。
According to a fourth aspect of the present invention, a plurality of save areas after the execution of the program are stored so that the parameters can be transferred in multiple ways.

【0029】[0029]

【実施例】以下、図面を用いてこの発明の実施例を説明
する。
Embodiments of the present invention will be described below with reference to the drawings.

【0030】図1は請求項1又は2記載の発明の一実施
例に係わるプロセッサの構成を示す図である。図1に示
す実施例は、汎用レジスタの退避/復帰領域が割込み時
の制御レジスタの退避領域をスキップさせ、RAMアド
レスを独立して制御できるようにしたものである。
FIG. 1 is a diagram showing the configuration of a processor according to an embodiment of the invention described in claim 1 or 2. In the embodiment shown in FIG. 1, the save / restore area of the general-purpose register skips the save area of the control register at the time of interrupt, and the RAM address can be controlled independently.

【0031】図1において、レジスタバンクの切り替え
を制御するレジスタバンク制御部は、図7に示すと同様
のステート制御部1及び加算器2と、新CBPを受けて
ラッチするラッチ回路L12、及びCBPの書き換え信
号(CBPC)の入力により旧CBPを取り込みラッチ
するラッチ回路L22、及びラッチ回路L12,L22
に保持されたCPBに対して(新CBP−旧CBP)の
減算を行い両者を比較して比較結果が負になるとネガテ
ィブCBP書き換え信号(NCBPC)を出力する第1
の減算器3からなるCBPの増減(書き換え方向)を判
別する判別部と、ラッチ回路L22に保持された旧CB
Pから“1”を減算(旧CBP−1)してRAMにおけ
る旧CBPの制御レジスタの退避領域を算出する第2の
減算器4、及び算出された内容をラッチして旧CBPの
制御レジスタの退避領域を記憶する記憶回路となるラッ
チ回路L31からなる退避領域算出記憶部と、ラッチ回
路L31にラッチされた内容と加算器2の出力(ADD
OUT)とを比較して一致した際に“1”レベルの一致
検出信号(HIT)を出力する比較器5と、HIT信号
をラッチするラッチ回路L42、及びステート制御部1
からバンクアドレスを受けてバンクのステート状態がア
イドル(IDLE)状態もしくはバンク1の状態もしく
はHIT信号が1レベルにある場合にラッチ回路L42
にラッチを指示するタイミング回路6、及びRAMアド
レスをラッチするラッチ回路L52、及びラッチ回路L
42,L52にラッチされた内容を加算して3ビット目
以降のRAMアドレス(RAMAD)を算出する加算器
7からなるRAMアドレス生成部とを備えて構成されて
おり、判別部、退避領域算出記憶部、比較器5、タイミ
ング回路6、RAMアドレス生成部によってRAMアド
レスを変更するアドレス変更部を構成している。
In FIG. 1, a register bank control unit for controlling register bank switching includes a state control unit 1 and an adder 2 similar to those shown in FIG. 7, a latch circuit L12 for receiving and latching a new CBP, and a CBP. Latch circuit L22 for latching and latching the old CBP by inputting the rewriting signal (CBPC) of the latch circuit L12, L22
The new CBP-old CBP is subtracted from the CPB held in the table, and the two are compared. When the comparison result becomes negative, the negative CBP rewrite signal (NCBPC) is output.
Of the old CB held in the latch circuit L22 and the discriminator composed of the subtractor 3 for discriminating the increase / decrease (rewriting direction) of the CBP.
The second subtracter 4 which subtracts "1" from P (old CBP-1) to calculate the save area of the control register of the old CBP in the RAM, and the calculated content is latched to control the control register of the old CBP. A save area calculation storage unit including a latch circuit L31 serving as a storage circuit for storing the save area, the content latched by the latch circuit L31, and the output of the adder 2 (ADD
OUT) and a match detection signal (HIT) of "1" level when they match, a latch circuit L42 for latching the HIT signal, and a state control section 1
Latch circuit L42 when the state of the bank is received in the idle state (IDLE) or the state of the bank 1 or the HIT signal is at 1 level by receiving the bank address from
Timing circuit 6 for instructing latching, and latch circuit L52 for latching RAM address
42, L52, and a RAM address generation unit including an adder 7 that calculates the RAM address (RAMAD) of the third bit and thereafter by adding the latched contents to the determination unit and the save area calculation storage. The unit, the comparator 5, the timing circuit 6, and the RAM address generation unit constitute an address changing unit that changes the RAM address.

【0032】なお、新旧CBPの比較は(新CBP−旧
CBP)の減算に基づいて判定しているが、(旧CBP
−新CBP)の減算により減算結果が正となった場合に
NCBPC信号が出力されるようにしてもよい。
The comparison between the old and new CBP is made based on the subtraction of (new CBP-old CBP).
The NCBPC signal may be output when the subtraction result becomes positive by subtraction of (new CBP).

【0033】このような構成において、この実施例では
加算器2の出力と(旧CBP−1)を比較した結果等し
い場合に、RAMADの3ビット目に“1”を加算する
ことによってRAMアドレスを算出し、図2に示すよう
に汎用レジスタの写像領域を変更するようにしている。
以下に具体的な動作を説明する。
In this configuration, in this embodiment, when the output of the adder 2 and the (old CBP-1) are equal to each other, they are equal to each other, a "1" is added to the third bit of the RAMAD to determine the RAM address. It is calculated and the mapping area of the general-purpose register is changed as shown in FIG.
The specific operation will be described below.

【0034】まず、新旧CBPが比較されて、正負いず
れの方向のCBP書き換えかが判定される。新CBPは
CLK2(クロック信号)でラッチされ、旧CBPはラ
ッチ回路L22にCBPC信号が入力されたときのみラ
ッチされ、(新CBP−旧CBP)の結果が負(又は旧
CBP−新CBPの結果が正)になったとき、ネガティ
ブCBP書換信号(NCBPC)が出力される。
First, the old and new CBPs are compared to determine whether the CBP is rewritten in the positive or negative direction. The new CBP is latched by CLK2 (clock signal), the old CBP is latched only when the CBPC signal is input to the latch circuit L22, and the result of (new CBP-old CBP) is negative (or the result of old CBP-new CBP). Becomes positive, a negative CBP rewrite signal (NCBPC) is output.

【0035】また、旧CBPから“1”が減算され、
(旧CBP−1)が生成される。この内容がNCBPC
信号がアクティブになったときだけCLK1(クロック
信号)でラッチされる。(旧CBP−1)と、同じくC
LK1に同期した8ビットの加算器2の出力(ADDO
UT)が比較され、一致すると“1”レベルのHIT信
号が出力される。HIT信号はバンクのステート状態が
IDLEもしくはバンク1もしくは“1”レベルの時に
CLK2でラッチされる。
Also, "1" is subtracted from the old CBP,
(Old CBP-1) is generated. This content is NCBPC
It is latched on CLK1 (clock signal) only when the signal becomes active. (Formerly CBP-1) and C
Output of 8-bit adder 2 synchronized with LK1 (ADDO
UT) is compared, and if they match, a HIT signal of "1" level is output. The HIT signal is latched by CLK2 when the state state of the bank is IDLE, bank 1 or "1" level.

【0036】したがって、HIT信号がアクティブにな
ったバンク以降の退避/復帰のすべてのRAMアドレス
にはキップ値となるHIT=1が加算される。バンク
(BS+1)の退避/復帰が終了すると再びHIT信号
はリセットされる。これにより、HIT信号のラッチ出
力とADDOUTをCLK2でラッチしたものを加算す
ると、RAMADの3ビット目以上が得られる。
Therefore, HIT = 1, which is a kip value, is added to all the RAM addresses for saving / restoring after the bank where the HIT signal becomes active. When the saving / restoring of the bank (BS + 1) is completed, the HIT signal is reset again. As a result, when the latched output of the HIT signal and ADDOUT latched by CLK2 are added, the third bit or more of RAMAD can be obtained.

【0037】このようにして算出されたRAMアドレス
に基づいて汎用レジスタの退避/復帰が行われるので、
汎用レジスタの退避/復帰領域が割込み時の制御レジス
タの退避領域をスキップさせることが可能となり、RA
Mアドレスをバンクアドレスに対して独立して制御する
ことができる。したがって、命令でCBPを書き換える
ことによってバンクチェンジを行う場合に、特にレジス
タの写像領域を重複させてパラメータの受け渡しを行う
場合に、制御レジスタの退避領域を避けて汎用レジスタ
の写像領域となるようにレジスタバンクを制御すること
ができるようになる。
Since the general-purpose registers are saved / restored based on the RAM address calculated in this way,
The general-purpose register save / restore area can skip the control register save area at the time of interrupt, and RA
The M address can be controlled independently of the bank address. Therefore, when performing a bank change by rewriting the CBP with an instruction, especially when passing the parameters by overlapping the mapping areas of the registers, avoid the save area of the control register to become the mapping area of the general-purpose register. It becomes possible to control the register bank.

【0038】これにより、レジスタの使用効率が向上し
てプログラムの実行速度が向上し、かつ割込み退避領域
が汎用レジスタのデータ領域と重複することがなくな
り、プログラミングの自由度を増大させることができ
る。
As a result, the use efficiency of the register is improved, the program execution speed is improved, the interrupt save area does not overlap with the data area of the general-purpose register, and the degree of freedom in programming can be increased.

【0039】図3は請求項3記載の発明の一実施例に係
わるプロセッサの構成を示す図である。図3に示す実施
例の特徴とするところは、制御レジスタの退避領域と汎
用レジスタの写像領域が重複するか否かを判別する判別
回路(CHKCBP)31をプロセッサの命令デコード
部(DEC)内に備えるようにしたことにあり、他の構
成は図1に示す実施例と同様である。
FIG. 3 is a diagram showing a configuration of a processor according to an embodiment of the present invention. The feature of the embodiment shown in FIG. 3 is that a decision circuit (CHKCBP) 31 for deciding whether or not the save area of the control register and the mapping area of the general-purpose register overlap is provided in the instruction decoding unit (DEC) of the processor. The other configuration is the same as that of the embodiment shown in FIG.

【0040】図3において、バスインタフェース部(B
IU)でフェッチした命令コードを命令デコード部(D
EC)でデコードし、マイクロアドレスを生成する。マ
イクロアドレスにしたがって得られたマイクロコードに
よって各ブロックの制御が決定される。演算のデスティ
ネーションと算術演算装置(ALU)への指示もここで
得られる。
In FIG. 3, the bus interface (B
The instruction code fetched by the IU)
EC) to generate a micro address. The control of each block is determined by the microcode obtained according to the microaddress. Instructions to the arithmetic destination and arithmetic unit (ALU) are also obtained here.

【0041】したがって、加算/減算などCBPの相対
的な増減数が明らかな命令ではこの時点で汎用レジスタ
の写像領域と制御レジスタの退避領域の重なりの可能性
が判別できる。例えば、制御レジスタの退避領域を(C
BP+4)とする場合は、 旧CBP+5−BS < 新CBP < 旧CBP+5 の場合に重なりが生じる。上式に基づいて汎用レジスタ
の重複が生じるか否かを判別する判別回路(CHKCB
P)31をDEC内に備え、判別結果にしたがってレジ
スタバンク制御部(BNKC)32に対して領域重複信
号(BNKCNF)が出力される。
Therefore, in the case of an instruction such as addition / subtraction in which the relative increase / decrease in CBP is clear, it is possible to determine the possibility that the mapping area of the general-purpose register and the save area of the control register overlap at this point. For example, if the save area of the control register is (C
In the case of BP + 4), overlap occurs in the case of old CBP + 5-BS <new CBP <old CBP + 5. A discriminating circuit (CHKCB) for discriminating whether or not duplication of general-purpose registers occurs based on the above equation.
P) 31 is provided in the DEC, and a region overlap signal (BNKCNF) is output to the register bank control unit (BNKC) 32 according to the determination result.

【0042】この信号BNKCNFによって、図4のレ
ジスタバンク制御部(BNKC)32に示すように、
(旧CBP−1)の内容が図1に示したと同様なラッチ
回路L31にラッチされ、これ以降の動作は図1に示す
実施例と同様となる。
By this signal BNKCNF, as shown in the register bank controller (BNKC) 32 of FIG.
The contents of (old CBP-1) are latched by the latch circuit L31 similar to that shown in FIG. 1, and the operation thereafter is the same as that of the embodiment shown in FIG.

【0043】したがって、このような実施例においても
上記実施例と同様な効果を得ることができるとともに、
バンク制御部における比較部を構成するラッチ回路L1
2及び減算器3が不要となり、構成の小型化を図ること
ができる。。
Therefore, also in such an embodiment, the same effect as the above embodiment can be obtained, and
Latch circuit L1 forming a comparison unit in the bank control unit
2 and the subtractor 3 are unnecessary, and the structure can be downsized. .

【0044】図5は請求項4記載の発明の一実施例に係
わるプロセッサの構成を示す図である。図5に示す実施
例の特徴とするところは、パラメータの受け渡しが多重
に行われる場合であっても適用できるようにしたことに
ある。
FIG. 5 is a diagram showing the configuration of a processor according to an embodiment of the present invention. The feature of the embodiment shown in FIG. 5 is that it can be applied even in the case where the parameters are transferred in multiples.

【0045】前述した実施例では、バンク切り替えによ
るパラメータの受け渡しを行う場合に、多重に行わない
場合に限り有効である。パラメータの受け渡しを多重に
行う場合や転送命令などで不特定なCBPに変更するこ
とを2度以上行った場合には、制御レジスタの退避領域
を記憶するラッチ回路L31が1組のみであるため、制
御レジスタの退避領域と汎用レジスタの写像領域の重な
りを検出することはできない。
The above-described embodiment is effective only when the parameters are exchanged by switching the banks and when the parameters are not multiplexed. When multiple parameters are passed or when an unspecified CBP is changed by a transfer instruction or the like twice or more, only one set of the latch circuit L31 stores the save area of the control register. It is not possible to detect the overlap between the save area of the control register and the mapping area of the general-purpose register.

【0046】この実施例では、制御レジスタの退避領域
を記憶する記憶回路となるラッチ回を増加して複数の値
を保持しておくことができるようにしている。
In this embodiment, the number of latches serving as a memory circuit for storing the save area of the control register is increased so that a plurality of values can be held.

【0047】なお、制御レジスタの退避領域を記憶する
記憶回路の記憶容量は任意の大きさでよく、また記憶回
路の構造、記憶方法は様々考えられる。
The storage capacity of the storage circuit for storing the save area of the control register may be any size, and various structures and storage methods of the storage circuit are conceivable.

【0048】しかし、実行時間的に無駄がない実施例と
しては、図5に示すように、前述した実施例に示すラッ
チ回路L31を複数並列に設け、それまでにプログラム
で使用した(旧CBP−1)の値を順に保持するように
して、汎用レジスタの写像領域と保持している内容のそ
れぞれが一致するか否かをラッチ回路L31に対応して
設けられた比較器51により同時に比較し、いずれか1
つでも一致するものがあれば、対応する比較器51から
論理和ゲート52を介して出力されるHIT信号を
“1”にしてADDOUTに加算する。それぞれのラッ
チ回路L31に与えられてラッチされる内容は、信号C
BPCがアクティブになる度に1づつインクリメントさ
れるカウンタ53の出力に基づいてデマルチプレクサ5
4により供給される。これ以降の動作は図1に示す実施
例と同様となる。
However, as an embodiment in which there is no waste in execution time, as shown in FIG. 5, a plurality of latch circuits L31 shown in the above-mentioned embodiment are provided in parallel and used by the program up to that time (old CBP- By holding the values of 1) in order, whether or not the mapping area of the general-purpose register and the held contents match is compared at the same time by the comparator 51 provided corresponding to the latch circuit L31, Either one
If there is any match, the HIT signal output from the corresponding comparator 51 via the OR gate 52 is set to "1" and added to ADDOUT. The content given to and latched by each latch circuit L31 is the signal C
Based on the output of the counter 53, which is incremented by 1 each time the BPC becomes active, the demultiplexer 5
4 supplied. The subsequent operation is similar to that of the embodiment shown in FIG.

【0049】したがって、このような実施例において
は、前記実施例と同様な効果を得ることができるととも
に、パラメータの受け渡しを多重に行うことが可能とな
り、バンクチェンジの頻度が高く多量に汎用レジスタを
使用する場合に有効となる。
Therefore, in such an embodiment, it is possible to obtain the same effect as that of the above-mentioned embodiment, and it is possible to pass the parameters in a multiple manner. It is effective when used.

【0050】[0050]

【発明の効果】以上説明したように、請求項1又は2記
載の発明によれば、命令でCBPを書き換えることによ
ってバンクチェンジを実現する場合に、特にレジスタの
写像領域を重複させてパラメータの受け渡しを行う場合
に、制御レジスタの退避領域を避けて汎用レジスタの写
像領域となるようにレジスタバンクを制御するようにし
たので、レジスタの使用効率が向上してプログラムの実
行速度が高められ、かつ割込み退避領域が汎用レジスタ
のデータ領域と重複することがなくなり、プログラミン
グの自由度を増大させることができる。
As described above, according to the first or second aspect of the invention, when a bank change is realized by rewriting the CBP with an instruction, the mapping areas of the registers are overlapped and the parameters are passed. In this case, the register bank is controlled so as to avoid the save area of the control register and become the mapping area of the general-purpose register, so that the register usage efficiency is improved, the program execution speed is increased, and the interrupt The save area does not overlap with the data area of the general-purpose register, and the degree of freedom in programming can be increased.

【0051】請求項3記載の発明によれば、退避領域と
汎用レジスタの写像領域が重複するか否かを判別する判
別回路を命令デコード部内に設けるようにしたので、ア
ドレス変更部の構成を小型化することができる。
According to the third aspect of the present invention, since the discriminating circuit for discriminating whether or not the save area and the mapping area of the general-purpose register overlap is provided in the instruction decoding section, the configuration of the address changing section is small. Can be converted.

【0052】請求項4記載の発明によれば、複数の退避
領域を記憶するようにしたので、パラメータの受け渡し
を多重に行うことが可能となり、バンクチェンジの頻度
が高く多量に汎用レジスタを使用する場合に有効とな
る。
According to the invention as set forth in claim 4, since a plurality of save areas are stored, it becomes possible to pass and receive parameters in a multiplexed manner, and the frequency of bank changes is high and a large number of general-purpose registers are used. It will be effective if.

【図面の簡単な説明】[Brief description of drawings]

【図1】請求項1又は2記載の発明の一実施例に係わる
プロセッサの要部構成を示す図である。
FIG. 1 is a diagram showing a main part configuration of a processor according to an embodiment of the invention described in claim 1 or 2;

【図2】本発明のレジスタバンクにおける写像の様子を
示す図である。
FIG. 2 is a diagram showing a state of mapping in a register bank of the present invention.

【図3】請求項3記載の発明の一実施例に係わるプロセ
ッサの要部構成を示す図である。
FIG. 3 is a diagram showing a main configuration of a processor according to an embodiment of the invention as set forth in claim 3;

【図4】図3に示すバンク制御部の構成を示す図であ
る。
FIG. 4 is a diagram showing a configuration of a bank controller shown in FIG.

【図5】請求項4記載の発明の一実施例に係わるプロセ
ッサの要部構成を示す図である。
FIG. 5 is a diagram showing a main configuration of a processor according to an embodiment of the invention as set forth in claim 4;

【図6】従来のレジスタバンクにおける写像の様子を示
す図である。
FIG. 6 is a diagram showing a state of mapping in a conventional register bank.

【図7】従来のプロセッサにおけるバンク制御部の構成
を示す図である。
FIG. 7 is a diagram showing a configuration of a bank controller in a conventional processor.

【図8】図7に示すバンク制御部によって制御されるバ
ンクの状態遷移を示す図である。
8 is a diagram showing state transitions of banks controlled by the bank control unit shown in FIG.

【符号の説明】[Explanation of symbols]

1 ステート制御部 2,7 加算器 3,4 減算器 5,51 比較器 6 タイミング回路 31 判別回路 32 バンク制御部 52 論理ゲート 53 カウンタ 54 デマルチプレクサ L12〜L82 ラッチ回路 1 State Control Unit 2,7 Adder 3,4 Subtractor 5,51 Comparator 6 Timing Circuit 31 Discrimination Circuit 32 Bank Control Unit 52 Logic Gate 53 Counter 54 Demultiplexer L12 to L82 Latch Circuit

Claims (4)

【特許請求の範囲】[Claims] 【請求項1】 バンク化されたRAMとレジスタとの間
でデータの写像(退避/復帰)が行われる際に、カレン
トバンクポインタ(CBP)とバンクサイズを受けて、
バンクアドレスとRAMのアクセスアドレスとなるバン
クRAMアドレスを生成して、バンクを切り替え制御す
るステート制御部と、 RAM上におけるレジスタデータの写像領域が重複する
ようにCBPが書き換えられた場合に、制御レジスタの
RAM上における退避領域を示す退避領域値を算出して
写像が終了するまで記憶し、退避領域値とバンクRAM
アドレスとが一致した場合にRAMアドレスを変更し、
RAMの写像領域を変更する新たなバンクRAMアドレ
スを生成するアドレス変更部とを有することを特徴とす
るプロセッサ。
1. A current bank pointer (CBP) and a bank size are received when data mapping (saving / restoring) is performed between a banked RAM and a register,
When the CBP is rewritten so that the bank address and the bank RAM address, which is the access address of the RAM, are generated and the bank switching control is performed, and the mapping area of the register data on the RAM overlaps. The save area value indicating the save area on the RAM is stored and stored until the mapping ends, and the save area value and the bank RAM are stored.
If the address matches, change the RAM address,
An address changing unit for generating a new bank RAM address for changing a mapping area of the RAM.
【請求項2】 前記アドレス変更部は、 新CBPと旧CBPとを保持し、RAM上におけるレジ
スタデータの写像領域が重複するようにCBPが書き換
えられた場合に、保持した両値を比較することによって
カレントバンクポインタの増減を判別する判別部と、 判別部によって保持された旧CBPから制御レジスタの
RAM上における退避領域を示す退避領域値を算出し、
算出した退避領域値を判別部の判別結果に基づいて取り
込み、データの写像が終了するまで記憶する記憶部と、 記憶部に記憶された退避領域値とステート制御部で生成
されたバンクRAMアドレスとを比較して、両者が一致
した場合には予め設定されたバンクRAMアドレスのス
キップ値を出力する比較部と、 比較部から出力されたスキップ値にステート制御部で生
成されたバンクRAMアドレスを加えてRAMアドレス
を変更し、バンクRAMの写像領域を変更する新たなバ
ンクRAMアドレスを生成するアドレス生成部とからな
ることを特徴とする請求項1記載のプロセッサ。
2. The address changing unit holds the new CBP and the old CBP, and compares the held values when the CBP is rewritten so that the mapping areas of the register data on the RAM overlap. A discriminator that discriminates whether the current bank pointer is increased or decreased, and a save area value indicating a save area on the RAM of the control register is calculated from the old CBP held by the determiner.
A storage unit that captures the calculated save area value based on the determination result of the determination unit and stores the data until the mapping of data is completed, the save area value stored in the storage unit, and the bank RAM address generated by the state control unit. When the two match, the comparison unit that outputs the skip value of the preset bank RAM address and the bank RAM address generated by the state control unit are added to the skip value output from the comparison unit. 2. The processor according to claim 1, further comprising: an address generation unit that changes a RAM address to change a mapping area of the bank RAM and generates a new bank RAM address.
【請求項3】 命令でCBPを書き換える場合に、CB
Pの相対的な増減がデコード結果により判明する命令に
対して命令デコード後、制御レジスタの退避領域と新C
BPで示されるレジスタの写像領域が重なるか否かを判
別する判別回路を命令デコード部に備え、 前記記憶回路は、判別回路の判別結果に応じて退避領域
値を取り込み記憶してなることを特徴とする請求項2記
載のプロセッサ。
3. When rewriting the CBP with an instruction, the CB
After the instruction is decoded for the instruction whose relative increase or decrease of P is found by the decoding result, the save area of the control register and the new C
The instruction decoding unit is provided with a discriminating circuit for discriminating whether or not the mapping areas of the register indicated by BP overlap, and the storage circuit captures and stores the save area value according to the discrimination result of the discriminating circuit. The processor according to claim 2,
【請求項4】 複数の前記記憶部と、 複数の記憶部にそれぞれ対応して設けられた複数の前記
比較部と、 記憶部に記憶される退避領域をそれぞれの記憶部に振り
分け制御するデマルチプレクサと、 複数の比較部における比較結果の論理和を前記アドレス
生成部に与える論理ゲートとを有することを特徴とする
請求項2又は3記載のプロセッサ。
4. A demultiplexer for controlling distribution of the plurality of storage units, the plurality of comparison units respectively provided corresponding to the plurality of storage units, and the save areas stored in the storage units to the respective storage units. 4. The processor according to claim 2, further comprising: a logic gate that gives a logical sum of comparison results of a plurality of comparison units to the address generation unit.
JP5615194A 1994-03-25 1994-03-25 Processor Pending JPH07262087A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP5615194A JPH07262087A (en) 1994-03-25 1994-03-25 Processor

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP5615194A JPH07262087A (en) 1994-03-25 1994-03-25 Processor

Publications (1)

Publication Number Publication Date
JPH07262087A true JPH07262087A (en) 1995-10-13

Family

ID=13019097

Family Applications (1)

Application Number Title Priority Date Filing Date
JP5615194A Pending JPH07262087A (en) 1994-03-25 1994-03-25 Processor

Country Status (1)

Country Link
JP (1) JPH07262087A (en)

Similar Documents

Publication Publication Date Title
KR100805027B1 (en) Memory address generation device and processor having the same, and memory address generation method
US5418917A (en) Method and apparatus for controlling conditional branch instructions for a pipeline type data processing apparatus
JPH07262087A (en) Processor
JP2000353092A (en) Information processor and register file switching method for the processor
JP2009093344A (en) Microcomputer, method of using the same, and electronic control unit
JPS5821304B2 (en) Data search
JPH0246970B2 (en) MEMORIKA KUCHOHOSHIKI
JP2568760B2 (en) Product-sum operation circuit
JP4498705B2 (en) Cash system
JPH0689229A (en) Device and method for invalidating buffer memory
JP2818562B2 (en) Address translation circuit
JPH0512106A (en) Memory bank switching system
JP2000194554A (en) Arithmetic processor
JPH0488537A (en) Information processing system
JP2003280923A (en) Microprocessor
JPH05324316A (en) Microprocessor
JPS5821303B2 (en) Data search
JPH01300352A (en) Dump area instruction control system
JPH0219495B2 (en)
JPH058451B2 (en)
JP2000235516A (en) Memory system with operation function, method for controlling memory to be used for the system and recording medium recording control program
JPH06139084A (en) Information processor
JPH05100842A (en) Instruction processor
JPH08235071A (en) Virtual computr system
JPS6259341B2 (en)