JP7280600B2 - processor - Google Patents
processor Download PDFInfo
- Publication number
- JP7280600B2 JP7280600B2 JP2019082048A JP2019082048A JP7280600B2 JP 7280600 B2 JP7280600 B2 JP 7280600B2 JP 2019082048 A JP2019082048 A JP 2019082048A JP 2019082048 A JP2019082048 A JP 2019082048A JP 7280600 B2 JP7280600 B2 JP 7280600B2
- Authority
- JP
- Japan
- Prior art keywords
- register
- area
- instruction
- program
- executed
- 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.)
- Active
Links
Images
Description
本発明は、プロセッサに関する。 The present invention relates to processors.
複数のレジスタバンクを有するプロセッサが知られている。従来のプロセッサのレジスタバンクそれぞれは、スタックポインタ(SP)レジスタを有しておらず、複数のレジスタバンク全体で1つのSPレジスタが用いられている。 Processors with multiple register banks are known. Each register bank of a conventional processor does not have a Stack Pointer (SP) register, and one SP register is used across multiple register banks.
従来の2つのレジスタバンクを持つプロセッサにおいて、CALL命令などの処理を実行するときに、CALLされた処理で第1のレジスタバンクから第2のレジスタバンクを選択してサブルーチンを実行し、CALLされた処理から元の呼び出し元の処理に戻るRETURN命令を実行する直前で、第2のレジスタバンクから第1のレジスタバンクを選択して利用する。その際、CALLされた処理を開始するとき、SPレジスタの値を他の記憶領域に退避し、RETURN命令を実行するときに、CALL命令を開始したときに退避した値をSPレジスタに復帰させる必要がある。 In a conventional processor having two register banks, when executing a process such as a CALL instruction, the called process selects the second register bank from the first register bank, executes a subroutine, and The first register bank is selected from the second register bank and used immediately before executing the RETURN instruction to return from the process to the original caller process. At that time, it is necessary to save the value of the SP register to another storage area when starting the CALLed process, and restore the value saved when the CALL instruction started to the SP register when executing the RETURN instruction. There is
SPレジスタの値の退避及び復帰に関する処理は、プロセッサを利用するユーザであるプログラムの作成者が準備する必要がある。 The process for saving and restoring the value of the SP register must be prepared by the program creator who is the user who uses the processor.
レジスタバンクの切り替えをより簡単に実現する。 To more easily realize switching of a register bank.
複数のレジスタバンクそれぞれがSPレジスタを有するプロセッサを提供する。 A plurality of register banks each provide a processor having SP registers.
本発明によるプロセッサの実施例は、第1のレジスタバンクと、第2のレジスタバンクとを備え、前記第1のレジスタバンク及び前記第2のレジスタバンクそれぞれが、スタックポインタレジスタを有することができる。 An embodiment of the processor according to the invention comprises a first register bank and a second register bank, each of said first register bank and said second register bank may comprise a stack pointer register.
プロセッサコアの概要
図1は、本発明の実施例によるマイコンにおけるプロセッサコアの概要を示す。プロセッサコア100は、外部入力ユニット105、状態制御ユニット110、中央制御ユニット115、レジスタユニット120、算術論理演算装置(ALU)140、リードデータ(DI)145、ライトデータ(DO)150、データバス155を有する。外部入力ユニット105は、外部信号を受信し、状態制御ユニット110及び中央制御ユニット115に提供する。状態制御ユニット110は、中央制御ユニット115との情報入出力を制御する。中央制御ユニット115は、リードデータ(DI)145より入力されたオペコード(命令)を命令デコーダ117によってデコードした結果によりALU140を制御する。中央制御ユニット115は、さらに、デコードした結果によりレジスタユニット120の各レジスタから必要な情報を取得や更新の制御を行う。
Overview of Processor Core FIG. 1 shows an overview of a processor core in a microcomputer according to an embodiment of the present invention.
レジスタユニット120は、プログラムカウンタ(PC)レジスタ122、インタラプト(I)レジスタ124、リフレッシュ(R)レジスタ126、現在使用中のレジスタ群(レジスタバンク)を示すRBレジスタ128、宛先セレクタポート130、宛先バンクセレクタ132、第1のレジスタバンク133、第2のレジスタバンク134、送信元バンクレジスタ135、送信元セレクタポートA136、送信元セレクタポートB137及びアドレスポート138を有する。
The
遊技機におけるプロセッサコアについて
遊技機メーカであるユーザは、遊技機制御用プログラムを作成し、プロセッサコアを実装したマイクロコンピュータに記憶させる。これにより、遊技機は、プログラムに基づいて動作する。一方で、パチンコやパチスロなどの遊技機のマイクロコンピュータにおいて、遊技機における不正などを防止するために遊技機の検査が検査用プログラムを用いて実施される。
Regarding processor cores in game machines A user who is a game machine maker creates a game machine control program and stores it in a microcomputer in which the processor core is mounted. Thereby, the gaming machine operates based on the program. On the other hand, in a microcomputer of a game machine such as pachinko or pachislot, the game machine is inspected using an inspection program in order to prevent fraud in the game machine.
記憶装置は、ユーザが遊技機制御プログラムに使用可能なROMとワークエリアとして使用されるRAMが含まれる使用可能領域(使用領域内)と、ユーザの検査用プログラム格納されるROMと検査用プログラムがワークエリアとして使用するRAMが含まれ遊技機制御プログラムの使用が不可な使用領域外とに区別される。遊技機制御用プログラムは、使用領域外のRAMを更新することがでない。検査用プログラムは、使用領域内のRAMを更新することができない。(規則で定まっている)
上記遊技機制御プログラム、検査用プログラムのワークエリアにはプログラム実行時の演算のためのワークエリアの他にレジスタやサブルーチンCALL時の復帰アドレスを格納するスタックエリアも含まれる。
The storage device has a usable area (within the usable area) that includes a ROM that can be used by the user for the game machine control program and a RAM that is used as a work area, and a ROM that stores the user's inspection program and the inspection program. It is distinguished from the non-use area where the RAM used as a work area is included and the game machine control program cannot be used. The game machine control program cannot update the RAM outside the use area. The test program cannot update the RAM in the used area. (as defined by regulations)
The work areas for the game machine control program and the inspection program include not only work areas for calculations during program execution, but also stack areas for storing registers and return addresses at subroutine CALL.
記憶装置は、図1において、図示されていないが、データバス155を含むバスを介してプロセッサコア100に接続される。図2は、遊技機で用いられる記憶装置のメモリマップの例を示す。アドレス0000hからXXXX1hまでのY1バイトは、ユーザプログラムエリア205であり、アドレスXXXX2hからXXXX3hまでのY2バイトは、ユーザデータエリア210である(下付文字が付されたXは、1桁以上の整数及び/又は文字を意味し、例えば、1桁分の値は0-9及びA~Fとすることができる。下付文字が付されたYは、1桁以上の整数を意味し、例えば、Yは、0以上の整数とすることができる。以下、同様とする)。ユーザプログラムエリア205には、遊技機制御用プログラムが記憶され、ユーザデータエリア210には、遊技機制御用プログラムが参照するデータが記憶されている。ユーザプログラムエリア205及びユーザデータエリア210のメモリは、リードオンリーメモリである。
The storage devices are connected to
アドレスXXXX7hからXXXX8hまでのY4バイトは、第1のユーザRAMのエリア225であり、アドレスXXXX9hからXXXX10hまでのY5バイトは、第2のユーザRAMのエリア230である。第1のユーザRAMのエリア225及び第2のユーザRAMのエリア230は、遊技機制御用プログラムが実行されているときに用いられるワークエリアである。第1のユーザRAMのエリア225及び第2のユーザRAMのエリア230のメモリは、ランダムアクセスメモリである。
Y 4 bytes from address XXXX 7 h to XXXX 8 h are
遊技機制御プログラムが実行されると、制御プログラムとともに、割込みプログラムも実行される。したがって、第1のユーザRAMのエリア225及び第2のユーザRAMのエリア230は、ワークエリアとして制御プログラムや、割込みプログラムに用いられるとともに、レジスタの情報の退避や、サブルーチン、割込み処理の復帰アドレスを一時的に記憶するスタックエリアとしても用いられる。ユーザプログラムエリア205、ユーザデータエリア210、第1のユーザRAMのエリア225及び第2のユーザRAMのエリア230は、遊技機制御プログラムによって用いられる使用領域内に対応する。
When the game machine control program is executed, the interrupt program is also executed together with the control program. Therefore, the
アドレスXXXX5hからXXXX6hまでのY9バイトは、外部プログラムエリア220である。外部プログラムエリア220には、遊技機における動作を検査する検査用プログラムが記憶されている。外部プログラムエリア220のメモリは、リードオンリーメモリである。
The Y 9 bytes from addresses XXXX 5 h to XXXX 6 h are the
アドレスXXXX11hからXXXX12hまでのY6バイトは、外部ユーザRAMのエリア235である。外部ユーザRAMのエリア235は、検査用プログラムが実行されているときに用いられるワークエリアであり、レジスタの情報の退避や、サブルーチン、割込み処理の復帰アドレスを一時的に記憶するスタックエリアとしても用いられる。外部ユーザRAMのエリア235のメモリは、ランダムアクセスメモリである。
Y 6 bytes from address XXXX 11 h to XXXX 12 h are
外部プログラムエリア220及び外部ユーザRAMのエリア235は、遊技機制御プログラムによって用いられず、検査用プログラムに用いられる使用領域外に対応する。
The
上記のとおり、使用領域内のメモリエリアと使用領域外のメモリエリアとを準備することによって、それぞれのエリアで使用領域を独立させることができる。すなわち、使用領域内において遊技機制御プログラムが実行され、使用領域外において検査用プログラムが実行され、遊技機制御プログラムと検査用プログラムは互いに干渉させない必要がある。これに関し、遊技機制御プログラムから検査用プログラムにプログラムの実行が移動したとき、スタックポインタの値を使用領域内に対応する値から使用領域外に対応する値に切り替える必要がある。切り替えを行わない場合、使用領域外で用いられるサブルーチンコールやレジスタの退避等のスタックを更新する操作によって、使用領域内に配置されているスタック領域や他のRAM領域が更新されてしまうからである。サブルーチンや割込み動作が規則正しく動作していれば、スタック以外の領域は更新されないが、プログラムミスや暴走によりスタックの領域以外のRAM領域が更新される可能性がある。 As described above, by preparing a memory area within the use area and a memory area outside the use area, the use area can be made independent in each area. That is, it is necessary that the game machine control program is executed within the use area and the inspection program is executed outside the use area so that the game machine control program and the inspection program do not interfere with each other. Regarding this, when the execution of the program moves from the game machine control program to the inspection program, it is necessary to switch the value of the stack pointer from the value corresponding to the inside of the use area to the value corresponding to the outside of the use area. This is because if the switching is not performed, the stack area and other RAM areas located within the used area will be updated by operations that update the stack, such as subroutine calls and register saving that are used outside the used area. . If subroutines and interrupt operations operate regularly, areas other than the stack will not be updated.
従来技術
図1に示したプロセッサコアは、本発明のものであり、従来のプロセッサコアは、レジスタユニット120のプログラムカウンタ(PC)レジスタ122、インタラプト(I)レジスタ124、リフレッシュ(R)レジスタ126及びRBレジスタ128と並んでスタックポインタレジスタを有する。以下、図3を用いて従来のプロセッサコアによる処理を説明する。
PRIOR ART The processor core shown in FIG . Alongside the
図3は、従来のプロセッサコアによる処理フローを示す。処理は、記憶装置の使用領域内を用いて実行される処理302と記憶装置の使用領域外を用いて実行される処理352とを含む。 FIG. 3 shows a processing flow by a conventional processor core. The processing includes processing 302 that is executed using the inside of the storage device's usable area and processing 352 that is executed using the non-used area of the storage device.
まず、プロセッサコアによって実行される使用領域内を用いた処理302から開始する。始めに、アキュムレータレジスタA及びフラグレジスタFが退避(セーブ)される(ステップ304)。命令としては、PUSH AFが実行される。(この命令を実行する意味は後のLD (aaa)、SPを実行するとフラグレジスタFの内容が変化するため、フラグレジスタFの内容を退避する必要がある)割込みを禁止する(ステップ306)。命令としては、DIが実行される。DI命令により、マスカブル割込み処理が禁止される。使用領域内を用いた処理352を呼び出す(ステップ308)。命令としては、CALL xyz(xyzは記憶装置の領域外を用いて実行される処理、例えば、検査用プログラムによる処理)が実行される。これにより、使用領域外を用いて実行されるサブルーチンが呼び出され、サブルーチンに実行が移る。 First, we start with a process 302 using within the used area that is executed by the processor core. First, the accumulator register A and flag register F are saved (step 304). As an instruction, PUSH AF is executed. (The execution of this instruction means that the contents of the flag register F will be changed when the LD (aaa) and SP are executed. Therefore, the contents of the flag register F must be saved.) Interrupts are prohibited (step 306). As an instruction, DI is executed. The DI instruction disables maskable interrupt processing. A process 352 using the used area is called (step 308). As an instruction, CALL xyz (xyz is a process executed using an area outside the storage device, for example, a process by an inspection program) is executed. As a result, a subroutine that is executed using the area outside the usage area is called, and execution is transferred to the subroutine.
処理の呼び出しに応じて、プロセッサコアによって実行される使用領域外を用いた処理352を開始する。スタックポインタが退避される(ステップ354)。命令としては、LD (aaa)、SPが実行される(aaaは領域外の退避先のアドレスを示す)。使用領域外のアドレスを指定するスタックポインタを設定する(ステップ356)。命令としては、LD SP、mnが実行される(mnは、使用領域外のアドレスを示す)。全てのレジスタ(BC、DE、HL、IX、IYレジスタ)を退避する(ステップ358)。命令としては、PUSH ALLが実行される。検査用プログラムなどによる処理が実行される(ステップ360)。ステップ360において、プロセッサコアは、記憶装置の使用領域外を用いて処理を実行する。その後、退避したレジスタの情報に基づいて全てのレジスタを復帰させる(ステップ362)。命令としては、POP ALLが実行される。退避したスタックポインタの情報に基づいてスタックポインタを復帰させる(ステップ364)。LD SP、(aaa)が実行される。ステップ308に処理を返す(ステップ366)。これにより、使用領域内を用いるプログラムの処理に復帰する。命令としては、RETが実行される。 In response to a process call, a process 352 using out-of-use regions executed by the processor core is started. The stack pointer is saved (step 354). As instructions, LD (aaa) and SP are executed (aaa indicates a save destination address outside the area). A stack pointer specifying an address outside the used area is set (step 356). As an instruction, LD SP, mn is executed (mn indicates an address outside the used area). All registers (BC, DE, HL, IX, IY registers) are saved (step 358). As an instruction, PUSH ALL is executed. A process such as an inspection program is executed (step 360). At step 360, the processor core executes processing using the non-use area of the storage device. Thereafter, all registers are restored based on the saved register information (step 362). As an instruction, POP ALL is executed. The stack pointer is restored based on the saved stack pointer information (step 364). LD SP, (aaa) is executed. Processing is returned to step 308 (step 366). As a result, the process returns to the processing of the program using the inside of the used area. As an instruction, RET is executed.
命令が返されると、割込みの許可を行う(ステップ310)。命令としては、EIが実行される。EI命令により、ステップ306において禁止されていたマスカブル割込み処理が許可される。退避したAレジスタ及びFレジスタの情報に基づいて、それらレジスタを復帰させる(ステップ312)。命令としては、POP AFが実行される。処理が終了する(ステップ314)。 When the instruction returns, enable interrupts (step 310). EI is executed as an instruction. The EI instruction enables maskable interrupt processing that was prohibited in step 306 . Based on the saved information of the A and F registers, these registers are restored (step 312). As an instruction, POP AF is executed. Processing ends (step 314).
上記処理ではDI命令を実行してもNMI処理は禁止できないため、NMIによる割込み処理は実行されてしまう。このため、スタックポインタの領域外への変更を行わないと割込み時のスタックは領域内のRAMを使用することとなる。また、RAMエリアは限りがあるため、領域内の呼出し側の処理がサブルーチンのネストをしてスタック領域が少なくなった時点でCALL命令を実行すると呼びだされた領域外処理でさらにサブルーチンCALLなどによりスタックのネストが深くなると、スタックの領域がオーバーしたり、プログラムの暴走により、領域内のスタックやワークエリアが更新されてしまう恐れがある。さらに、スタックに全てのレジスタをセーブするとスタックエリアを使うためスタック領域を多量に確保しておく必要があり、遊技機制御に使うワークエリアが少なくなる。 In the above processing, even if the DI instruction is executed, the NMI processing cannot be inhibited, so the NMI interrupt processing is executed. Therefore, if the stack pointer is not changed outside the area, the stack at the time of interrupt uses the RAM within the area. In addition, since the RAM area is limited, when the calling side processing within the area nests subroutines and the stack area is reduced, when the CALL instruction is executed, the subroutine CALL, etc. If the nesting of the stack becomes deep, there is a risk that the stack area will be overrun or that the stack and work area within the area will be updated due to program runaway. Furthermore, if all registers are saved in the stack, the stack area is used, so a large amount of stack area must be secured, and the work area used for game machine control is reduced.
したがって、上記の処理フローによって、記憶装置の使用領域内及び使用領域外のワークエリアとスタックエリアを分離することにより、割込み処理による、各領域への影響を少なくしていた。 Therefore, by separating the work area and the stack area inside and outside the use area of the storage device according to the above processing flow, the influence of interrupt processing on each area is reduced.
レジスタバンク
図4は、本発明による実施例のレジスタバンクを示す。図4には、図1に示した第1のレジスタバンク133及び第2のレジスタバンク134が示されている。第1のレジスタバンク133は、表レジスタ群400と裏レジスタ群420を有する。表レジスタ群400は、Qレジスタ401、Uレジスタ402、Aレジスタ403、Fレジスタ404、Bレジスタ405、Cレジスタ406、Dレジスタ407、Eレジスタ408、Hレジスタ409、Lレジスタ410、IXレジスタ411、IYレジスタ412及びSPレジスタ413を有する。
Register Bank FIG. 4 shows the register bank of an embodiment according to the invention. FIG. 4 shows the
裏レジスタ群420は、Q’レジスタ421、U’レジスタ422、A’レジスタ423、F’レジスタ424、B’レジスタ425、C’レジスタ426、D’レジスタ427、E’レジスタ428、H’レジスタ429、L’レジスタ430、IX’レジスタ431及びIY’レジスタ432を有する。
The reverse register group 420 includes a Q'
第2のレジスタバンク134は、第1のレジスタバンク133と同様に、表レジスタ群440及び裏レジスタ群460を有する。表レジスタ群440及び裏レジスタ群460は、第1のレジスタバンク133の表レジスタ群400及び裏レジスタ群420と同様の構成である。従来のプロセッサコアは、各レジスタバンクにスタックポインタレジスタを有しておらず、プロセッサコアに1つのスタックポインタレジスタを配置していた。本発明は、図4からも理解されるように、各レジスタバンクにおいてスタックポインタ413、453を備えている。
The
上記実施例において、2つのレジスタバンクを有する実施例を説明したが、他の実施例において、レジスタバンクは、3以上であってもよい。 Although the above embodiment describes an embodiment having two register banks, in other embodiments there may be three or more register banks.
本発明のプロセッサコアにより処理フローProcessing flow by the processor core of the present invention
図5は、本発明のプロセッサコアによる処理フローを示す。処理は、記憶装置の使用領域内を用いて実行される処理502と記憶装置の使用領域外を用いて実行される処理552とを含む。 FIG. 5 shows a processing flow by the processor core of the present invention. The processing includes processing 502 that is executed using the inside of the storage device's available area and processing 552 that is executed using the outside of the storage device's usage area.
まず、プロセッサコアによって実行される使用領域内を用いた処理502から開始する。始めに、プロセッサコア100は、使用するレジスタバンクを第1のレジスタバンク133から第2のレジスタバンク134に切り替える(ステップ504)。具体的には、プロセッサコア100は、使用するレジスタバンクを示す情報を保持するRBレジスタ128の情報が第1のレジスタバンクから第2のレジスタバンクを示すように変更する。これにより、宛先バンクセレクタ132は、RBレジスタ128の情報に基づいて、書き込み先のレジスタバンクが第1のレジスタバンク133であるか第2のレジスタバンク134であるかを決定する。送信元バンクレジスタ135は、宛先バンクセレクタ132と同様に、読み込み先のレジスタ群を決定する。
First, we start with a process 502 using within the used area that is executed by the processor core. First, the
割込みを禁止する(ステップ506)。DI命令により、マスカブル割込み処理が禁止される。使用領域内を用いた処理552を呼び出す(ステップ508)。記憶装置の領域外を用いて実行される処理、例えば、検査用プログラムによる処理が実行される。これにより、使用領域外を用いて実行されるサブルーチンが呼び出され、サブルーチンに実行が移る。 Disable interrupts (step 506). The DI instruction disables maskable interrupt processing. A process 552 using the used area is called (step 508). Processing executed using the area outside the storage device, for example, processing by an inspection program is executed. As a result, a subroutine that is executed using the area outside the usage area is called, and execution is transferred to the subroutine.
処理の呼び出しに応じて、プロセッサコアによって実行される使用領域外を用いた処理552を開始する。使用領域外のアドレスを指定するスタックポインタを設定する(ステップ556)。命令としては、LD SP、mnが実行される(mnは、使用領域外のアドレスを示す)。検査用プログラムなどによる処理が実行される(ステップ560)。ステップ560において、プロセッサコアは、記憶装置の使用領域外を用いて処理を実行する。ステップ508に処理を返す(ステップ566)。これにより、使用領域内を用いるプログラムの処理に復帰する。命令としては、RETが実行される。 In response to the process call, a process 552 using out-of-use regions executed by the processor core is started. A stack pointer specifying an address outside the used area is set (step 556). As an instruction, LD SP, mn is executed (mn indicates an address outside the used area). A process such as an inspection program is executed (step 560). At step 560, the processor core performs processing using the non-use area of the storage device. Processing is returned to step 508 (step 566). As a result, the process returns to the processing of the program using the inside of the used area. As an instruction, RET is executed.
命令が返されると、割込みの許可を行う(ステップ510)。EI命令により、ステップ306において禁止されていたマスカブル割込み処理が許可される。プロセッサコア100は、使用するレジスタバンクを第2のレジスタバンク134から第1のレジスタバンク133に切り替える(ステップ512)。具体的には、プロセッサコア100は、ステップ504と同様に、使用するレジスタバンクを示す情報を保持するRBレジスタ128の情報が第1のレジスタバンクから第2のレジスタバンクを示すように変更する。処理が終了する(ステップ514)。
When the instruction returns, enable interrupts (step 510). The EI instruction enables maskable interrupt processing that was prohibited in step 306 . The
各レジスタバンクにスタックポインタを設けることによって、それぞれのレジスタを選択的に退避及び復帰させる必要がなくなる。さらに、レジスタバンクの切り替えによって、レジスタを、使用領域内を用いた処理及び使用領域外を用いた処理のそれぞれのために切り替えることができる。これにより、本発明は、プログラムの作成量を削減することができる。 By providing a stack pointer for each register bank, the need to selectively save and restore each register is eliminated. Furthermore, by switching the register bank, the registers can be switched for processing using the inside of the usage area and for processing using the outside of the usage area. As a result, the present invention can reduce the amount of program creation.
割込み処理の制御Controlling interrupt processing
使用領域外のプログラムが実行されている場合、割込み処理の禁止を行う必要がある。使用領域外のプログラムが実行されているときに、使用領域内で記憶されている割込み処理のプログラムが実行されると、割込み処理のプログラムは、使用領域内のワークメモリにアクセスし、メモリを更新してしまうからである。例えば、プロセッサ装置としてよく用いられるZ80プロセッサのノンマスカブル割込み処理(NMI割込み処理)が実行されると、0066h(図2において、アドレス「0066h」は、ユーザプログラムエリア205であると仮定する)のメモリ領域が参照されてしまうことから、使用領域外のプログラムの実行中に、NMI割込み処理が実行されると、使用領域内であるユーザプログラムエリア205が参照されてしまう。
Interrupt processing must be disabled when a program outside the area of use is being executed. If an interrupt processing program stored in the used area is executed while a program outside the used area is running, the interrupt processing program accesses the work memory in the used area and updates the memory. This is because For example, when non-maskable interrupt processing (NMI interrupt processing) of the Z80 processor, which is often used as a processor device, is executed, a memory area of 0066h (in FIG. 2, address "0066h" is assumed to be user program area 205) is referred to, the
割込み処理は、図3及び5で示したとおり、従来技術及び本発明の実施例において、DI命令によって、マスク可能な割込み処理(INT割込み処理)の実行を禁止することができる。しかしながら、DI命令では、INT割込み処理の実行を禁止することはできるが、ノンマスカブル割込み処理(NMI割込み処理)の実行を禁止することはできない。 Interrupt processing can be inhibited from executing maskable interrupt processing (INT interrupt processing) by the DI instruction in the prior art and embodiments of the present invention, as shown in FIGS. However, although the DI instruction can inhibit execution of INT interrupt processing, it cannot inhibit execution of non-maskable interrupt processing (NMI interrupt processing).
割込み処理の制御の例としては、レジスタや記憶装置にノンマスカブル割込み許可フラグを設けてもよい。プロセッサコア100は、許可フラグを確認し、ノンマスカブル割込み処理の実行を許可しているか否かを判定する。これにより、プロセッサコア100は、ノンマスカブル割込み処理の実行の許可及び禁止を制御することができる。
As an example of interrupt processing control, a non-maskable interrupt permission flag may be provided in a register or storage device. The
割込み処理の制御の他の例としては、プロセッサコアの外部回路がNMIの受付信号を制御することによって、NMI割込み処理の実行を禁止することができる。 As another example of control of interrupt processing, execution of NMI interrupt processing can be prohibited by controlling an NMI acceptance signal by an external circuit of the processor core.
プロセッサ装置としてよく用いられるZ80プロセッサの割込み処理には割込みマスク可能な割込み処理(INT割込み処理)とノンマスカブル割込み処理(NMI割込み処理)が実行可能である。INT割込み処理の実行の許可及び禁止を制御するために、割込み制御フラグIFF1とIFF2が用いられている。IFF1はプロセッサのINT割込み処理の禁止及び許可を制御するために用いられる。 The interrupt processing of the Z80 processor, which is often used as a processor device, can execute interrupt maskable interrupt processing (INT interrupt processing) and non-maskable interrupt processing (NMI interrupt processing). Interrupt control flags IFF1 and IFF2 are used to control permission and prohibition of execution of INT interrupt processing. IFF1 is used to control disabling and enabling of INT interrupt processing of the processor.
IFF2は、割込み処理の禁止命令(DI命令)及び許可命令(EI命令)が実行されると、IFF1と同じ値が設定される。具体的には、DI命令により、IFF1=IFF2=0となり割込み処理の実行が禁止され、EI命令により、IFF1=IFF2=1となり割込み処理の実行が許可される。また、プロセッサのリセット及び割込み(INT割込み)処理が発生すると、IFF1=IFF2=0となり、割込み処理の実行が禁止される。 IFF2 is set to the same value as IFF1 when an interrupt processing prohibiting instruction (DI instruction) and an interrupt processing enabling instruction (EI instruction) are executed. Specifically, the DI instruction sets IFF1=IFF2=0 and prohibits the execution of interrupt processing, and the EI instruction sets IFF1=IFF2=1 and permits the execution of interrupt processing. Further, when the processor is reset and an interrupt (INT interrupt) process occurs, IFF1=IFF2=0, and execution of the interrupt process is prohibited.
プロセッサのNMI割込み処理が発生したとき、IFF1=0となり割込み処理の実行が禁止され、IFF2の状態は変化させない。これにより、IFF2の値は、NMI割込み処理前のIFF1の値を保持する。NMI割込み処理が終了するとき、RETN命令の実行によりIFF2の値をIFF1へコピーする操作が行われる。これにより、NMI割込み処理が発生したときのプロセッサの割込み処理の状態が、INT割込み処理が禁止(IFF1=0)であるか、割込み処理が許可(IFF1=1)であることを示す値としてIFF2に保持される。NMI割込み処理から復帰するとき、RETN命令の実行により、IFF1にIFF2の値がコピーされ、NMI割込み処理の発生前の割込み状態へもどすことができる。 When NMI interrupt processing of the processor occurs, IFF1=0, execution of interrupt processing is prohibited, and the state of IFF2 is not changed. As a result, the value of IFF2 holds the value of IFF1 before NMI interrupt processing. When NMI interrupt processing ends, the RETN instruction is executed to copy the value of IFF2 to IFF1. As a result, when the NMI interrupt processing occurs, the state of the processor interrupt processing is set to IFF2 as a value indicating whether the INT interrupt processing is disabled (IFF1=0) or interrupt processing is enabled (IFF1=1). is held to When returning from NMI interrupt processing, the value of IFF2 is copied to IFF1 by executing the RETN instruction, and the interrupt state before the occurrence of NMI interrupt processing can be restored.
本発明による実施例は、INT割込み処理の禁止及び許可の制御に加え、NMI割込み処理の禁止及び許可を制御するためのノンマスカブル割込み許可フラグ(NMIENフラグ)を有する。 Embodiments in accordance with the present invention have a non-maskable interrupt enable flag (NMIEN flag) for controlling disabling and enabling of NMI interrupt processing, in addition to controlling disabling and enabling of INT interrupt processing.
図6は、フラグIFF及びNMIENを用いたプロセッサコアの例を示す。図6は図1のプロセッサコアに示したものの割込み制御とレジスタバンク切替えの詳細である。
中央制御ユニット115は命令フェッチを行うと命令デコーダ117により命令を解析し、割込み制御に関する命令をデコードすると結果を外部入力ユニット105(605)内の割込み制御回路640に通知し、バンク切替えに関する命令をデコードするとレジスタユニット120内のRB制御回路655に結果を通知する。
割込み制御回路640は命令デコーダ117からの各命令のデコード結果(641~647)を受けIFF1回路620及びIFF2回路625及び割込み制御回路635のセット/リセットを行う。制御回路635は、ノンマスカブル割込み許可フラグ(NMIENフラグ)を有する。また、割込み制御回路640は、外部から割込み信号(INT信号及びNMI信号)を受信し、当該割込み信号に基づく割込み指示641を中央制御ユニット115に送信する。
外部入力ユニット105(605)は、さらに、INT用入力制御回路610、NMI用入力制御回路630備える。INT用入力制御回路610は通過情報制御信号としてIFF1回路620に接続されIFF1回路620の状態によってINT信号の入力に対し通過可否の制御を行う。またNMI用入力制御回路630は通過制御信号として割込み制御回路635に接続され、割込み制御回路635の状態によってNMI信号の入力に対して通過可否の制御を行う。
INT制御回路、NMI制御回路は、例えば、トライステートバッファ等の回路で通過信号に対する制御信号(0/1)により通過信号を通過させる(制御信号=1)か、通過させない(制御信号=0)かの制御を行う。
IFF1回路620、IFF2回路625及び割込み制御回路635は、例えば、フリップフロップ回路とすることができるが、これは例示であり、少なくとも1ビットの情報を保持できる回路であればよい。
FIG. 6 shows an example of a processor core using flags IFF and NMIEN. FIG. 6 details the interrupt control and register bank switching shown in the processor core of FIG.
When the
The interrupt
The external input unit 105 ( 605 ) further includes an INT
The INT control circuit and the NMI control circuit are circuits such as tri-state buffers, for example, which pass the pass signal (control signal=1) or not pass the pass signal (control signal=0) according to the control signal (0/1) for the pass signal. or control.
The
外部入力ユニット605は、中央制御ユニット115からEI命令を受信し、IFF1=IFF2=1とすることにより、プロセッサコアをINT割込み処理の許可状態にする。また、外部入力ユニット605は、中央制御ユニット115からDI命令を受信し、IFF1=IFF2=0とすることにより、プロセッサコアをINT割込み処理の不許可状態にする。外部入力ユニット605は、INT信号を受信すると、IFF1回路620の値が「1」であることに応じて、中央制御ユニット115に割込み指示641を行う。INT用入力制御回路610は、INT信号及びIFF1フラグの値が共に「1」の場合に、INT割込みを受け付けるように制御する。中央制御ユニット115は、割込み指示641に応じて、INT割込み処理を行う。INT割込み処理が終了すると、中央制御ユニット115は、RETI命令644を外部入力ユニット605に送信し、外部入力ユニット605はINT割込み処理を終了する。外部入力ユニット605は、INT信号を受信しても、IFF1回路620の値が「0」であることに応じて、中央制御ユニット115にINT割込み処理の指示641を行わない。
The
外部入力ユニット605は、NMI信号を受信すると、割込み制御回路635の値が「1」であることに応じて、中央制御ユニット115に割込み指示641を行う。NMI用入力制御回路630は、NMI信号及びNMIENフラグの値が共に「1」の場合に、NMI割込みを受け付けるように制御する。中央制御ユニット115は、割込み指示641に応じて、NMI割込み処理を行う。NMI割込み処理が終了すると、中央制御ユニット115は、RETN命令645を外部入力ユニット605に送信し、外部入力ユニット605はNMI割込み処理を終了する。外部入力ユニット605は、NMI信号を受信しても、割込み制御回路635の値が「0」であることに応じて、中央制御ユニット115にNMI割込み処理の指示641を行わない。
When the
レジスタバンクの切り替え及び割込み制御回路に関する命令
中央制御ユニット115によるレジスタバンクの切り替えに関する実施例をより具体的に説明する。中央制御ユニット115が、CALLEX命令646をフェッチすると、命令の実行を使用領域内から使用領域外に移し、RETEX命令647をフェッチすると、命令の実行を使用領域外から使用領域内に移す。
Instructions for Register Bank Switching and Interrupt Control Circuit An example of register bank switching by the
図6を再度参照すると、中央制御ユニット115が命令コードをフェッチすると命令デコーダが解析しデコード結果(642~647)を、外部入力ユニット605及びレジスタユニット120に送信する。外部入力ユニット605は、CALLEX命令のデコード結果646を受信したことに応じて、割込み制御回路635の値を「0」に設定する。さらに、レジスタユニット120がCALLEX命令のデコード結果646を受信したことに応じて、RB制御回路655は、RBレジスタの値を「1」に設定する。宛先バンクセレクタ132及び送信元バンクレジスタ135は、RBレジスタの値が「1」であることに応じて、利用するレジスタバンクが第2のレジスタバンク134であることを特定する。これにより、記憶装置において、使用領域外が用いられるとき、第2のレジスタバンク134における各レジスタにおいて、情報の取得及び設定が行われる。
Referring to FIG. 6 again, when the
外部入力ユニット605は、RETEX命令のデコード結果647を受信したことに応じて、割込み制御回路635の値を「1」に設定する。レジスタユニット120がRETEX命令647を受信したことに応じて、RB制御回路655は、RBレジスタの値を「0」に設定する。宛先バンクセレクタ132及び送信元バンクレジスタ135は、RBレジスタの値が「0」であることに応じて、利用するレジスタバンクが第1のレジスタバンク133であることを特定する。これにより、記憶装置において、使用領域内が用いられるとき、第1のレジスタバンク133における各レジスタにおいて、情報の取得及び設定が行われる。
The
各フラグなどが変更されるタイミング
下記表を用いて、プロセッサコアの動作によるフラグなどの変化を示す。下記表のフラグ等の値の意味について、以下にまとめる。
RBレジスタの値が「0」のとき、第1のレジスタバンク133(使用領域内用)が参照され、RBレジスタの値が「1」のとき、第2のレジスタバンク134(使用領域外用)が参照される。
IFF1が「1」のとき、INT割込みの受付が許可され、IFF1が「0」のとき、INT割込みの受付が禁止される。
IFF2は、NMI割込みなどを受け付けると、割込みを受け付ける前のIFF1の値を保持する。
NMIENが「1」のとき、NMI割込みの受付が許可され、NMIENが「0」のとき、NMI割込みの受付が禁止される。
Timing of Change of Each Flag etc. The following table shows changes of flags etc. due to the operation of the processor core. The meanings of values such as flags in the table below are summarized below.
When the value of the RB register is "0", the first register bank 133 (for inside the use area) is referenced, and when the value of the RB register is "1", the second register bank 134 (for outside the use area) is referred to. Referenced.
When IFF1 is "1", acceptance of INT interrupt is permitted, and when IFF1 is "0", acceptance of INT interrupt is prohibited.
When IFF2 receives an NMI interrupt or the like, IFF2 holds the value of IFF1 before receiving the interrupt.
When NMIEN is "1", NMI interrupt acceptance is permitted, and when NMIEN is "0", NMI interrupt acceptance is prohibited.
#1:プロセッサに電源が投入などされて、リセットが行われると、RBレジスタの値は「0」、IFF2フラグには「0」、IFF1フラグには「0」、NMIENには「1」が設定される。
#2:DI命令が実行され、INT割込みが禁止されると、RBレジスタの値は変化せず、IFF2フラグには「0」及びIFF1フラグには「0」が設定され、NMIENは変化しない。
#3:EI命令が実行され、INT割込みが許可されると、RBレジスタの値は変化せず、IFF2フラグには「1」及びIFF1フラグには「1」が設定され、NMIENは変化しない。
#4:INT割込みを受け付け、INT割込み処理が実行されると、RBレジスタの値は変化せず、IFF2フラグには「0」及びIFF1フラグには「0」が設定され、NMIENは変化しない。
#5:NMI割込みを受け付け、NMI割込み処理が実行されると、RBレジスタの値は変化せず、IFF2フラグにはNMI割込みを受け付け時のIFF1フラグがコピーされてIFF1の前の値が保持され、IFF1フラグには「0」が設定され、NMIENには「0」が設定される。
#6:RETI命令により、INT割込み処理が終了しリターンが実行されると、RBレジスタの値は変化せず、IFF2フラグは変化せず前の値が保持され、IFF1フラグにはIFF2フラグの値が設定され、NMIENは変化しない。
#7:RETN命令により、NMI割込み処理が終了しリターンが実行されると、RBレジスタの値は変化せず、IFF2フラグは変化せず前の値が保持され、IFF1フラグにはIFF2フラグの値が設定され、NMIENには「1」が設定される。
#8:RBレジスタの値が「0」のときにCALLEX命令が実行され、記憶装置の使用領域が使用領域内から使用領域外に変更されると、RBレジスタには「1」が設定され、IFF2フラグは変化せず前の値が保持され、IFF1フラグには「1」が設定され、NMIENには「0」が設定される。
#9:RBレジスタの値が「1」のときにCALLEX命令が実行され、記憶装置の使用領域外が用いられると(CALLEX命令実行後に、RETEX命令が実行されず、さらに他のCALLEX命令が実行された場合)、RBレジスタには「1」が設定され、IFF2フラグ及びIFF1フラグは変化せず前の値が保持され、NMIENには「0」が設定される。
#10:RBレジスタの値が「1」のときにRETEX命令が実行され、記憶装置の使用領域が使用領域外から使用領域内に変更されると、RBレジスタには「0」が設定され、IFF2フラグは変化せず前の値が保持され、IFF1フラグにはIFF2フラグの値が設定され、NMIENには「1」が設定される。
#11:RBレジスタの値が「0」のときにRETEX命令が実行され、記憶装置の使用領域内が用いられると(領域内実行中にRETEX命令が実行された場合)、RBレジスタには「0」が設定され、IFF2フラグは変化せず前の値が保持され、IFF1フラグにはIFF2フラグの値が設定され、NMIENには「1」が設定される。
#1: When the processor is powered on and reset, the RB register value is "0", the IFF2 flag is "0", the IFF1 flag is "0", and NMIEN is "1". set.
#2: When the DI instruction is executed and the INT interrupt is disabled, the value of the RB register does not change, the IFF2 flag is set to "0" and the IFF1 flag is set to "0", and NMIEN remains unchanged.
#3: When the EI instruction is executed and the INT interrupt is enabled, the value of the RB register does not change, the IFF2 flag is set to "1" and the IFF1 flag is set to "1", and NMIEN remains unchanged.
#4: When the INT interrupt is accepted and the INT interrupt process is executed, the value of the RB register does not change, the IFF2 flag is set to "0" and the IFF1 flag is set to "0", and NMIEN remains unchanged.
#5: When an NMI interrupt is accepted and NMI interrupt processing is executed, the value of the RB register does not change, and the IFF1 flag at the time of accepting the NMI interrupt is copied to the IFF2 flag and the value before IFF1 is retained. , and IFF1 flags are set to "0", and NMIEN is set to "0".
#6: When the RETI instruction terminates the INT interrupt processing and executes a return, the value of the RB register does not change, the IFF2 flag does not change and retains the previous value, and the IFF1 flag contains the value of the IFF2 flag. is set and NMIEN is unchanged.
#7: When NMI interrupt processing ends and a return is executed by the RETN instruction, the value of the RB register does not change, the IFF2 flag does not change and the previous value is retained, and the IFF1 flag has the value of the IFF2 flag. is set, and NMIEN is set to "1".
#8: When the CALLEX instruction is executed when the value of the RB register is "0", and the used area of the storage device is changed from inside the used area to outside the used area, "1" is set in the RB register, The IFF2 flag does not change and retains its previous value, the IFF1 flag is set to "1", and NMIEN is set to "0".
#9: When the CALLEX instruction is executed when the value of the RB register is "1", and the outside of the storage area is used (after the CALLEX instruction is executed, the RETEX instruction is not executed and another CALLEX instruction is executed). is set), the RB register is set to "1", the IFF2 and IFF1 flags do not change and retain their previous values, and NMIEN is set to "0".
#10: When the RETEX instruction is executed when the value of the RB register is "1" and the used area of the storage device is changed from outside the used area to within the used area, "0" is set in the RB register, The IFF2 flag does not change and retains its previous value, the IFF1 flag is set to the value of the IFF2 flag, and NMIEN is set to "1".
#11: When the RETEX instruction is executed when the value of the RB register is "0" and the area used in the storage device is used (when the RETEX instruction is executed while executing within the area), "0" is set, the IFF2 flag does not change and retains its previous value, the IFF1 flag is set to the value of the IFF2 flag, and NMIEN is set to "1".
各命令の具体的な例
記憶装置の使用領域外に記憶されたプログラムを実行するための命令の例として、CALLEX命令を用いてもよい。CALLEX命令は、機械語の命令として「CALLEX mn」及び「CALLEX Yn」の形態で用いられてもよい(ここで、Yは、CALLEXの呼び出し先のアドレスのうちの上位アドレスを示す文字列とする)。使用領域外のサブルーチンからのリターン命令、すなわち、「CALLEX」命令のリターン命令は、機械語命令として「RETEX」の形態で用いられてもよい。
Concrete Examples of Instructions A CALLEX instruction may be used as an example of an instruction for executing a program stored outside the available area of the storage device. The CALLEX instruction may be used as a machine language instruction in the form of "CALLEX mn" and "CALLEX Yn" (where Y is a character string indicating the upper address of the call destination address of CALLEX). ). A return instruction from a subroutine outside the use area, that is, a return instruction of the "CALLEX" instruction may be used in the form of "RETEX" as a machine language instruction.
機械語命令とはアセンブラ言語プログラムを記述するためのニーモニックでありアセンブラプログラムで命令コード(実際にプロセッサが読込み実行する機械語コード)に変換され実行される。上記「CALLEX mn」は「命令コード1、n、m」に変換され、「CALLEX Yn」は「命令コード2、n」に変換され、「RETEX」は「命令コード3」に変換される。ここで、命令コードは1からNバイトの機械語コードで2進整数(00h-FFh)、m、nは、それぞれ、1バイトの2進整数(00h-FFh)を示す変数である。これにより、「CALLEX mn」は、呼び出し先のアドレスを2バイトの情報を用いて指定することができる。「CALLEX Yn」は、「Y」を上位1バイトの情報として固定値として指定し、「n」については、ユーザが下位1バイトの情報を指定することができる。図2から理解されるとおり、外部プログラムエリア220は、アドレス「XXXX5h」から始まるので、「CALLEX Yn」(例えば、XXXX5=abcdである場合、Y=abとなる)は有用である。したがって、「CALLEX Yn」における「Y」は、記憶装置におけるメモリマップに応じて異なる値が用いられてもよい。
A machine language instruction is a mnemonic for describing an assembler language program, which is converted into an instruction code (machine language code actually read and executed by a processor) and executed by the assembler program. The above "CALLEX mn" is converted to "
以下、フローチャートを用いて、各命令の動作を説明する。フローチャートにおいて、各機械語命令の内部動作が示され、内部クロックに同期して各ステップが実行される。動作の説明では命令フェッチの動作は省略して説明してあるが、各命令は、メモリよりフェッチ後に実行されることは理解されるであろう。以下では、スタックポインタが16ビットであり、スタックポインタの値のアドレスが示す先が8ビットであるプロセッサを例にして説明する。 The operation of each command will be described below with reference to flowcharts. The flowchart shows the internal operation of each machine language instruction, and each step is executed in synchronization with the internal clock. In the description of the operation, the instruction fetch operation is omitted, but it will be understood that each instruction is executed after being fetched from memory. In the following description, a processor with a 16-bit stack pointer and an 8-bit address indicated by the value of the stack pointer will be described as an example.
1.CALLEX mn命令
プロセッサは、命令をフェッチすると、プログラムカウンタ(PC)は次の実行アドレス(メインルーチンでCALLEX命令がコールされたとき、メインルーチンで実行されていたプログラムの次の処理がPCに格納されている)を示しているので、RBレジスタが示すレジスタバンクの現在のスタックポインタ(SP)から1減じたスタックポインタ(1つ前のスタックポインタ)の値のアドレスの示すスタックにプログラムカウンタの上位バイト(PCH、2バイト中の上位1バイト)を格納する(ステップ702)。プロセッサは、続けて、現在のスタックポインタ(SP)から1減じたスタックポインタ(1つ前のスタックポインタ、ステップ700のスタックポインタからみると、2減じた(2つ前の)スタックポインタ)の値のアドレスの示すスタックにプログラムカウンタの下位バイト(PCL、2バイト中の下位1バイト)を格納する(ステップ704)。プロセッサは、プログラムカウンタ(PC)にmnを格納する。
1. CALLEX mn instruction When the processor fetches an instruction, the program counter (PC) is set to the next execution address (when the CALLEX instruction is called in the main routine, the next processing of the program being executed in the main routine is stored in the PC). ), the upper byte of the program counter is stored in the stack indicated by the address of the stack pointer (previous stack pointer) value obtained by subtracting 1 from the current stack pointer (SP) of the register bank indicated by the RB register. (PC H , upper 1 byte in 2 bytes) is stored (step 702). The processor then subtracts 1 from the current stack pointer (SP) (the value of the stack pointer (one previous stack pointer, the stack pointer before
プロセッサは、RBレジスタの値を判定する(ステップ708)。プロセッサは、RBレジスタの値が「0」である(CALLEX命令実行時の記憶装置の領域が使用領域内である)場合、割込みフラグ1(IFF1)に「0」を設定し、INT割込みを禁止する(ステップ710)。プロセッサは、RBレジスタの値が「1」である(CALLEX命令実行時の記憶装置の領域が使用領域外である)場合、ステップ710を実行しない。プロセッサは、RBレジスタの値に「1」を設定し、記憶装置の使用領域として使用領域外を設定する(ステップ712)。プロセッサは、ノンマスカブル割込み許可フラグ(NMIEN)に「0」を設定し、NMI割込みを禁止する(ステップ714)。プロセッサは、次の命令としてプログラムカウンタ(PC)の命令をフェッチすることによりCALL先のプログラム(使用領域外に記憶されているプログラム)へ実行を移す(ステップ716)。CALLEX mn命令では、サブルーチン呼出しアドレスをmnの2バイトで示す値で指定でき、命令は命令コード+2バイトの命令とすることができる。
The processor determines the value of the RB register (step 708). If the value of the RB register is "0" (the area of the storage device when executing the CALLEX instruction is within the used area), the processor sets the interrupt flag 1 (IFF1) to "0" and disables the INT interrupt. (step 710). The processor does not execute
2.CALLEX Yn命令
プロセッサは、命令をフェッチすると、プログラムカウンタ(PC)は次の実行アドレスを示しているので、RBレジスタが示すレジスタバンクの現在のスタックポインタ(SP)から1減じたスタックポインタ(1つ前のスタックポインタ)の値のアドレスの示すスタックにプログラムカウンタの上位バイト(PCH、2バイト中の上位1バイト)を格納する(ステップ732)。プロセッサは、続けて、現在のスタックポインタ(SP)から1減じたスタックポインタ(1つ前のスタックポインタ、ステップ730のスタックポインタからみると、2減じた(2つ前の)スタックポインタ)の値のアドレスの示すスタックにプログラムカウンタの下位バイト(PCL、2バイト中の下位1バイト)を格納する(ステップ734)。プロセッサは、プログラムカウンタの上位バイト(PCH)に20hを格納し、プログラムカウンタの下位バイト(PCL)にnを格納する(ステップ736)。
2. CALLEX Yn instruction When the processor fetches an instruction, the program counter (PC) indicates the next execution address, so the stack pointer (1 The upper byte of the program counter (PC H , upper 1 byte in 2 bytes) is stored in the stack indicated by the address of the previous stack pointer (step 732). The processor continuously subtracts 1 from the current stack pointer (SP) to obtain the value of the stack pointer (one previous stack pointer, 2 subtracted from the stack pointer in step 730 (two stack pointers before)). The lower byte of the program counter (PC L , lower 1 byte in 2 bytes) is stored in the stack indicated by the address of (step 734). The processor stores 20h in the high byte of the program counter (PC H ) and n in the low byte of the program counter (PC L ) (step 736).
プロセッサは、RBレジスタの値を判定する(ステップ738)。プロセッサは、RBレジスタの値が「0」である(CALLEX命令実行時の記憶装置の領域が使用領域内である)場合、割込みフラグ1(IFF1)に「0」を設定し、INT割込みを禁止する(ステップ740)。プロセッサは、RBレジスタの値が「1」である(CALLEX命令実行時の記憶装置の領域が使用領域外である)場合、ステップ740を実行しない。プロセッサは、RBレジスタの値に「1」を設定し、記憶装置の使用領域として使用領域外を設定する(ステップ742)。プロセッサは、ノンマスカブル割込み許可フラグ(NMIEN)に「0」を設定し、NMI割込みを禁止する(ステップ744)。プロセッサは、次の命令としてプログラムカウンタ(PC)の命令をフェッチすることによりCALL先のプログラム(使用領域外に記憶されているプログラム)へ実行を移す(ステップ746)。CALLEX Yn命令では、サブルーチン呼出しアドレスをXXXX5h(Y00h)からYxxh(xxは、nで示される値であり、00hからFFhの値となる)、すなわち、Y00hから始まる256番地のうちの一つを指定できる。CALLEX Yn命令は、「CALLEX mn命令」で必要であった上位バイト「m」を省略できることから、命令コードを最少の1バイトとすると、命令は、2バイト命令とすることができる。
The processor determines the value of the RB register (step 738). If the value of the RB register is "0" (the area of the storage device when executing the CALLEX instruction is within the used area), the processor sets the interrupt flag 1 (IFF1) to "0" and disables the INT interrupt. (step 740). The processor does not execute
3.RETEX命令
CALLEX命令が実行された後、RETEX命令が実行されることにより、CALLEX命令が呼び出されていたときに実行されていた処理に復帰することができる。プロセッサは、RBレジスタの値に「1」を設定し、記憶装置の使用領域として使用領域内を設定する(ステップ762)。プロセッサは、現在のスタックポインタの値(ステップ704又は734で設定されたスタックポインタの値に相当)のアドレスが示すスタックをプログラムカウンタの下位バイト(PCL、2バイト中の下位1バイト)にロードする(ステップ764)。プロセッサは、現在のスタックポインタを1加算したスタックポインタ(1つ後のスタックポインタ)の値(ステップ702又は732で設定されたスタックポインタの値に相当)が示すアドレスのスタックをプログラムカウンタ(PCH)にロードする(ステップ766)。プロセッサは、続けて、現在のスタックポインタ(SP)から1加算したスタックポインタ(1つ後のスタックポインタ、ステップ760のスタックポインタからみると、2加算した(2つ後の)スタックポインタ)の値を現在スタックポインタに格納する(ステップ768)。
3. RETEX Instruction After the CALLEX instruction is executed, the RETEX instruction is executed to return to the process that was being executed when the CALLEX instruction was called. The processor sets the value of the RB register to "1" and sets the inside of the used area as the used area of the storage device (step 762). The processor loads the stack indicated by the address of the current stack pointer value (equivalent to the stack pointer value set in step 704 or 734) into the lower byte of the program counter (PC L , lower 1 byte out of 2 bytes). (step 764). The processor increments the current stack pointer by 1 (the next stack pointer) and allocates the stack at the address indicated by the value of the stack pointer (corresponding to the value of the stack pointer set in
プロセッサは、割込みフラグ2(IFF2)を割込みフラグ1(IFF1)にコピーし、INT割込みを許可又は禁止が設定される(ステップ770)。プロセッサは、さらに、ノンマスカブル割込み許可フラグ(NMIEN)に「1」を設定し、NMI割込みを許可する。プロセッサは、次の命令としてプログラムカウンタ(PC)の命令をフェッチすることによりCALLされたプログラムへ復帰する。 The processor copies interrupt flag 2 (IFF2) to interrupt flag 1 (IFF1) and the INT interrupt is enabled or disabled (step 770). The processor also sets a non-maskable interrupt enable flag (NMIEN) to "1" to enable NMI interrupts. The processor returns to the CALLed program by fetching the program counter (PC) instruction as the next instruction.
その他
上記の各実施例において、示したプロセッサコアは、プロセッサに実装することができる。プロセッサは、遊技機用プロセッサであってもよい。遊技機用プロセッサは、遊戯用制御基板にプロセッサとして実装されてもよい。遊戯用制御基板は、遊技機に実装される。
In each of the other examples above, the processor cores shown may be implemented in a processor. The processor may be a gaming machine processor. The game machine processor may be mounted as a processor on the game control board. The game control board is mounted on the game machine.
上記の実施例において、ハードウエアで実現するよう説明されたいくつかの要素の一部又は全ては、ソフトウエアで実現することができ、そして、ソフトウエアで実現するよう説明されたいくつかの要素の一部又は全ては、ハードウエアで実現することができることは理解されるであろう。 Some or all of the elements described as being implemented in hardware in the above embodiments can be implemented in software, and some elements described as being implemented in software. may be implemented in hardware.
以上に説明した処理又は処理順序において、ある処理において、その処理ではまだ利用することができないはずのデータを利用しているなどの処理又は処理順序上の矛盾が生じない限りにおいて、処理又は処理順序を自由に変更することができる。 In the processing or processing order described above, as long as there is no inconsistency in the processing or processing order, such as using data that should not be used yet in a certain processing, the processing or processing order can be changed freely.
以上に説明してきた各実施例に関し、各実施例の一部又は全部を組み合わせて一つの実施例として実現されてもよい。 Regarding each of the embodiments described above, a part or all of the embodiments may be combined to be realized as one embodiment.
以上に説明してきた各実施例は、本発明を説明するための例示であり、本発明はこれらの実施例に限定されるものではない。本発明は、その要旨を逸脱しない限り、種々の形態で実施することができる。 Each embodiment described above is an illustration for explaining the present invention, and the present invention is not limited to these examples. The present invention can be embodied in various forms without departing from the gist thereof.
上記の各実施例において、本発明の実施例を用いたプロセッサで用いることができる命令を説明したが、以下にプロセッサで用いることができる命令をさらに示す。 In each of the above embodiments, instructions that can be used in processors using embodiments of the present invention have been described, and further instructions that can be used in processors are provided below.
100 :プロセッサコア
105 :外部入力ユニット
110 :状態制御ユニット
115 :中央制御ユニット
117 :命令デコーダ
120 :レジスタユニット
122 :プログラムカウンタ(PC)レジスタ
124 :インタラプト(I)レジスタ
126 :リフレッシュ(R)レジスタ
128 :RBレジスタ
130 :宛先セレクタポート
132 :宛先バンクセレクタ
133 :第1のレジスタバンク
134 :第2のレジスタバンク
135 :送信元バンクレジスタ
138 :アドレスポート
145 :リード信号
150 :ライト信号線
155 :データバス
205 :ユーザプログラムエリア
210 :ユーザデータエリア
220 :外部プログラムエリア
225 :第1のユーザRAMのエリア
230 :第2のユーザRAMのエリア
235 :外部ユーザRAMのエリア
400 :表レジスタ群
401 :Qレジスタ
402 :Uレジスタ
403 :Aレジスタ
404 :Fレジスタ
405 :Bレジスタ
406 :Cレジスタ
407 :Dレジスタ
408 :Eレジスタ
409 :Hレジスタ
410 :Lレジスタ
411 :IXレジスタ
412 :IYレジスタ
413 :スタックポインタレジスタ
420 :裏レジスタ群
421 :Q’レジスタ
422 :U’レジスタ
423 :A’レジスタ
424 :F’レジスタ
425 :B’レジスタ
426 :C’レジスタ
427 :D’レジスタ
428 :E’レジスタ
429 :H’レジスタ
430 :L’レジスタ
431 :IX’レジスタ
432 :IY’レジスタ
440 :表レジスタ群
441 :Qレジスタ
442 :Uレジスタ
443 :Aレジスタ
444 :Fレジスタ
445 :Bレジスタ
446 :Cレジスタ
447 :Dレジスタ
448 :Eレジスタ
449 :Hレジスタ
450 :Lレジスタ
451 :IXレジスタ
452 :IYレジスタ
453 :スタックポインタレジスタ
460 :裏レジスタ群
461 :Q’レジスタ
462 :U’レジスタ
463 :A’レジスタ
464 :F’レジスタ
465 :B’レジスタ
466 :C’レジスタ
467 :D’レジスタ
468 :E’レジスタ
469 :H’レジスタ
470 :L’レジスタ
471 :IX’レジスタ
472 :IY’レジスタ
100: processor core 105: external input unit 110: state control unit 115: central control unit 117: instruction decoder 120: register unit 122: program counter (PC) register 124: interrupt (I) register 126: refresh (R) register 128 : RB register 130 : destination selector port 132 : destination bank selector 133 : first register bank 134 : second register bank 135 : source bank register 138 : address port 145 : read signal 150 : write signal line 155 : data bus 205: user program area 210: user data area 220: external program area 225: first user RAM area 230: second user RAM area 235: external user RAM area 400: table register group 401: Q register 402 : U register 403 : A register 404 : F register 405 : B register 406 : C register 407 : D register 408 : E register 409 : H register 410 : L register 411 : IX register 412 : IY register 413 : Stack pointer register 420 : Back register group 421 : Q' register 422 : U' register 423 : A' register 424 : F' register 425 : B' register 426 : C' register 427 : D' register 428 : E' register 429 : H' register 430 : L' register 431 : IX' register 432 : IY' register 440 : Table register group 441 : Q register 442 : U register 443 : A register 444 : F register 445 : B register 446 : C register 447 : D register 448 : E register 449: H register 450: L register 451: IX register 452: IY register 453: Stack pointer register 460: Back register group 461: Q' register 462: U' register 463: A' register 464: F' register 465: B' Register 466: C' register 467: D' register 468: E' register 469: H' register 470: L' register 471: IX' register 472: IY' register
Claims (4)
第1のレジスタバンクと、
第2のレジスタバンクと、
ユーザが使用可能な領域である記憶装置の使用領域内及び当該ユーザが使用不可な領域である記憶装置の使用領域外を有し、前記使用領域内及び前記使用領域外それぞれにおいてプログラムを記憶した記憶装置と、
を備え、
前記第1のレジスタバンク及び前記第2のレジスタバンクそれぞれが、スタックポインタレジスタを有し、
前記第1のレジスタバンクのスタックポインタレジスタは、前記使用領域内のプログラムで用いられ、前記第2のレジスタバンクのスタックポインタレジスタは、前記使用領域外のプログラムで用いられる、遊技機用プロセッサ。 A processor for a gaming machine,
a first register bank;
a second register bank;
A memory having a usable area of a storage device that is usable by a user and a non-usable area of a storage device that cannot be used by the user, and stores programs in the usable area and outside the usable area, respectively. a device;
with
each of the first register bank and the second register bank having a stack pointer register;
A processor for gaming machines, wherein the stack pointer register of the first register bank is used by a program within the usage area, and the stack pointer register of the second register bank is used by a program outside the usage area.
前記使用領域外のプログラムを実行するとき、前記RBレジスタの値を前記第2のレジスタバンクを示す値に変更し、前記使用領域外のプログラムから前記使用領域内のプログラムに実行を移すとき、前記RBレジスタの値を前記第1のレジスタバンクを示す値に変更する、請求項1に記載の遊技機用プロセッサ。 further comprising an RB register indicating the currently used register bank;
When executing the program outside the usage area, changing the value of the RB register to a value indicating the second register bank, and when transferring execution from the program outside the usage area to the program inside the usage area, 2. The gaming machine processor according to claim 1, wherein the value of the RB register is changed to a value indicating said first register bank.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019082048A JP7280600B2 (en) | 2019-04-23 | 2019-04-23 | processor |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2019082048A JP7280600B2 (en) | 2019-04-23 | 2019-04-23 | processor |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2019141675A JP2019141675A (en) | 2019-08-29 |
JP7280600B2 true JP7280600B2 (en) | 2023-05-24 |
Family
ID=67771551
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2019082048A Active JP7280600B2 (en) | 2019-04-23 | 2019-04-23 | processor |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP7280600B2 (en) |
Families Citing this family (43)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2019051276A (en) * | 2017-09-19 | 2019-04-04 | 株式会社ユニバーサルエンターテインメント | Game machine |
JP7368700B2 (en) * | 2019-09-10 | 2023-10-25 | サミー株式会社 | gaming machine |
JP7368703B2 (en) * | 2019-09-10 | 2023-10-25 | サミー株式会社 | gaming machine |
JP7368704B2 (en) * | 2019-09-10 | 2023-10-25 | サミー株式会社 | gaming machine |
JP7368702B2 (en) * | 2019-09-10 | 2023-10-25 | サミー株式会社 | gaming machine |
JP7277763B2 (en) * | 2019-09-10 | 2023-05-19 | サミー株式会社 | game machine |
JP7277764B2 (en) * | 2019-09-10 | 2023-05-19 | サミー株式会社 | game machine |
JP7341818B2 (en) * | 2019-09-24 | 2023-09-11 | 株式会社藤商事 | gaming machine |
JP7282643B2 (en) * | 2019-09-24 | 2023-05-29 | 株式会社藤商事 | game machine |
JP7356014B2 (en) * | 2019-10-23 | 2023-10-04 | サミー株式会社 | gaming machine |
JP7356015B2 (en) * | 2019-10-23 | 2023-10-04 | サミー株式会社 | gaming machine |
JP2021112399A (en) * | 2020-01-20 | 2021-08-05 | 株式会社平和 | Game machine |
JP2021112396A (en) * | 2020-01-20 | 2021-08-05 | 株式会社平和 | Game machine |
JP2021112398A (en) * | 2020-01-20 | 2021-08-05 | 株式会社平和 | Game machine |
JP2021112397A (en) * | 2020-01-20 | 2021-08-05 | 株式会社平和 | Game machine |
JP2021112392A (en) * | 2020-01-20 | 2021-08-05 | 株式会社平和 | Game machine |
JP2021112391A (en) * | 2020-01-20 | 2021-08-05 | 株式会社平和 | Game machine |
JP2021112400A (en) * | 2020-01-20 | 2021-08-05 | 株式会社平和 | Game machine |
JP2021112395A (en) * | 2020-01-20 | 2021-08-05 | 株式会社平和 | Game machine |
JP2021112389A (en) * | 2020-01-20 | 2021-08-05 | 株式会社平和 | Game machine |
JP2021112393A (en) * | 2020-01-20 | 2021-08-05 | 株式会社平和 | Game machine |
JP2021119907A (en) * | 2020-01-30 | 2021-08-19 | 株式会社平和 | Game machine |
JP7211989B2 (en) * | 2020-01-30 | 2023-01-24 | 株式会社平和 | game machine |
JP2021119909A (en) * | 2020-01-30 | 2021-08-19 | 株式会社平和 | Game machine |
JP2021122324A (en) * | 2020-01-31 | 2021-08-30 | 株式会社平和 | Game machine |
JP7208938B2 (en) * | 2020-02-06 | 2023-01-19 | 株式会社平和 | game machine |
JP7174727B2 (en) * | 2020-02-06 | 2022-11-17 | 株式会社平和 | game machine |
JP2021122563A (en) * | 2020-02-06 | 2021-08-30 | 株式会社平和 | Game machine |
JP2021122564A (en) * | 2020-02-06 | 2021-08-30 | 株式会社平和 | Game machine |
JP2021126280A (en) * | 2020-02-13 | 2021-09-02 | 株式会社平和 | Game machine |
JP2021126283A (en) * | 2020-02-13 | 2021-09-02 | 株式会社平和 | Game machine |
JP2021126277A (en) * | 2020-02-13 | 2021-09-02 | 株式会社平和 | Game machine |
JP7084434B2 (en) * | 2020-02-13 | 2022-06-14 | 株式会社平和 | Pachinko machine |
JP2021126282A (en) * | 2020-02-13 | 2021-09-02 | 株式会社平和 | Game machine |
JP2021126279A (en) * | 2020-02-13 | 2021-09-02 | 株式会社平和 | Game machine |
JP7174975B2 (en) * | 2020-03-13 | 2022-11-18 | 株式会社ユニバーサルエンターテインメント | game machine |
JP7174976B2 (en) * | 2020-03-13 | 2022-11-18 | 株式会社ユニバーサルエンターテインメント | game machine |
JP7440765B2 (en) | 2020-05-19 | 2024-02-29 | サミー株式会社 | gaming machine |
JP7455087B2 (en) * | 2021-05-13 | 2024-03-25 | 株式会社平和 | gaming machine |
JP7329272B1 (en) | 2022-02-17 | 2023-08-18 | 株式会社ユニバーサルエンターテインメント | game machine |
JP7329271B1 (en) | 2022-02-17 | 2023-08-18 | 株式会社ユニバーサルエンターテインメント | game machine |
JP7329270B1 (en) | 2022-02-17 | 2023-08-18 | 株式会社ユニバーサルエンターテインメント | game machine |
JP7329269B1 (en) | 2022-02-17 | 2023-08-18 | 株式会社ユニバーサルエンターテインメント | game machine |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003518287A (en) | 1999-12-23 | 2003-06-03 | ジェネラル・インスツルメント・コーポレイション | Dual mode processor |
JP2009205351A (en) | 2008-02-27 | 2009-09-10 | Denso Corp | Microcomputer |
JP2016112055A (en) | 2014-12-11 | 2016-06-23 | 株式会社三共 | Game machine |
JP2017121451A (en) | 2016-01-08 | 2017-07-13 | 株式会社オリンピア | Game machine |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPS6243734A (en) * | 1985-08-20 | 1987-02-25 | Nec Corp | Microprocessor |
-
2019
- 2019-04-23 JP JP2019082048A patent/JP7280600B2/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2003518287A (en) | 1999-12-23 | 2003-06-03 | ジェネラル・インスツルメント・コーポレイション | Dual mode processor |
JP2009205351A (en) | 2008-02-27 | 2009-09-10 | Denso Corp | Microcomputer |
JP2016112055A (en) | 2014-12-11 | 2016-06-23 | 株式会社三共 | Game machine |
JP2017121451A (en) | 2016-01-08 | 2017-07-13 | 株式会社オリンピア | Game machine |
Also Published As
Publication number | Publication date |
---|---|
JP2019141675A (en) | 2019-08-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP7280600B2 (en) | processor | |
KR101673990B1 (en) | Programmable exception processing latency | |
US9003422B2 (en) | Microprocessor architecture having extendible logic | |
US9619231B2 (en) | Programmable CPU register hardware context swap mechanism | |
US8006114B2 (en) | Software programmable timing architecture | |
US10740105B2 (en) | Processor subroutine cache | |
TW201706829A (en) | Central processing unit with DSP engine and enhanced context switch capabilities | |
US20230084523A1 (en) | Data Processing Method and Device, and Storage Medium | |
US5410660A (en) | System and method for executing branch on bit set/clear instructions using microprogramming flow | |
EP1502182B1 (en) | Automatic task distribution in scalable processors | |
GB2461848A (en) | Processor with a privileged stack pointer and a stack pointer used in privileged and non-privileged modes | |
WO2001093022A2 (en) | Method and apparatus for chaining interrupt service routines | |
US6044455A (en) | Central processing unit adapted for pipeline process | |
GB2461851A (en) | Processor, which stores interrupt enable flags in a location used for other functions | |
JP2004030224A (en) | Processor, method for retracting register and method for designating register | |
US20180137051A1 (en) | Information processing apparatus and central processing device | |
JP3395727B2 (en) | Arithmetic device and method | |
JP3583918B2 (en) | Microprocessor | |
JP2005275703A (en) | Processor, and context switching method | |
Groote et al. | An elementary processor | |
JP3168663B2 (en) | Information processing device | |
JP6127883B2 (en) | Semiconductor device and semiconductor device operation control method | |
JP2019046138A (en) | Processor including a plurality of register groups | |
JP2696578B2 (en) | Data processing device | |
US7281121B2 (en) | Pipeline processing device and interrupt processing method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20190508 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A821 Effective date: 20190425 |
|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20220404 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20230118 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20230123 |
|
A521 | Request for written amendment filed |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20230214 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20230406 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20230502 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 7280600 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |