JP2001014161A - Programmable controller - Google Patents
Programmable controllerInfo
- Publication number
- JP2001014161A JP2001014161A JP11180582A JP18058299A JP2001014161A JP 2001014161 A JP2001014161 A JP 2001014161A JP 11180582 A JP11180582 A JP 11180582A JP 18058299 A JP18058299 A JP 18058299A JP 2001014161 A JP2001014161 A JP 2001014161A
- Authority
- JP
- Japan
- Prior art keywords
- instruction
- stage
- pipeline
- execution
- programmable controller
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- 230000015654 memory Effects 0.000 claims abstract description 139
- 238000000034 method Methods 0.000 claims description 15
- 230000006870 function Effects 0.000 claims description 14
- 230000008569 process Effects 0.000 claims description 14
- 241000120694 Thestor Species 0.000 claims description 2
- 239000006144 Dulbecco’s modified Eagle's medium Substances 0.000 abstract description 29
- 238000010586 diagram Methods 0.000 description 20
- 238000001514 detection method Methods 0.000 description 17
- 230000008859 change Effects 0.000 description 3
- 230000002250 progressing effect Effects 0.000 description 2
- 230000007704 transition Effects 0.000 description 2
- 101000650817 Homo sapiens Semaphorin-4D Proteins 0.000 description 1
- 102100027744 Semaphorin-4D Human genes 0.000 description 1
- 230000004913 activation Effects 0.000 description 1
- 230000006399 behavior Effects 0.000 description 1
- 238000004891 communication Methods 0.000 description 1
- 230000010485 coping Effects 0.000 description 1
- 230000006872 improvement Effects 0.000 description 1
- 230000007257 malfunction Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- SYOKIDBDQMKNDQ-XWTIBIIYSA-N vildagliptin Chemical compound C1C(O)(C2)CC(C3)CC1CC32NCC(=O)N1CCC[C@H]1C#N SYOKIDBDQMKNDQ-XWTIBIIYSA-N 0.000 description 1
Landscapes
- Advance Control (AREA)
- Executing Machine-Instructions (AREA)
- Programmable Controllers (AREA)
Abstract
Description
【0001】[0001]
【発明の属する技術分野】本発明は、基本的なビット演
算命令処理と、複数ビットの応用命令処理の両方を処理
することのできる専用ハードウェア(プロセッサ)を備
えたプログラマブルコントローラに関するものである。The present invention relates to a programmable controller having dedicated hardware (processor) capable of processing both basic bit operation instruction processing and multi-bit application instruction processing.
【0002】[0002]
【従来の技術】プログラマブルコントローラは産業用装
置、機械、FA機器の制御に広く用いられており、対象
となる装置の複雑化、高速化に応じて、より多数の入出
力信号を高速に処理することが求められている。このた
め、ビット処理を主とする基本命令と、複数ビットの応
用命令処理を行うことのできる専用ハードウェア(プロ
セッサ)で高速化を実現し、通信処理・周辺処理などを
行う汎用マイクロプロセッサと組み合わせてプログラマ
ブルコントーラを構成している。この専用ハードウェア
(プロセッサ)の構造として、従来は、以下のような3
段パイプライン構造で命令を実行していた。2. Description of the Related Art Programmable controllers are widely used for controlling industrial equipment, machines and factory automation equipment, and process a greater number of input / output signals at high speed in accordance with the complexity and speed of the target equipment. Is required. For this reason, a basic instruction mainly for bit processing is combined with a general-purpose microprocessor that performs high-speed processing using dedicated hardware (processor) capable of processing multi-bit applied instructions and performs communication processing and peripheral processing. To form a programmable controller. Conventionally, as the structure of the dedicated hardware (processor), the following 3 is used.
Instructions were executed in a staged pipeline structure.
【0003】 第1ステージ:命令フェッチ 第2ステージ:命令デコード、レジスタフェッチ、算術
論理演算、データアドレス計算、分岐先計算 第3ステージ:メモリアクセス(リード/ライト)、分
岐、ビット演算、レジスタ書き込みFirst stage: instruction fetch Second stage: instruction decode, register fetch, arithmetic logic operation, data address calculation, branch destination calculation Third stage: memory access (read / write), branch, bit operation, register write
【0004】上記の3段パイプライン構造では、各ステ
ージのうち一番遅い実行ステージの処理速度で、全体の
命令実行速度が決まってしまう。このようなパイプライ
ン処理の高速化のためには、各ステージの処理速度を均
等にする必要があるが、この例では命令メモリとデータ
メモリに同じアクセス時間のメモリを使用すると、第1
ステージに対して第3ステージの方がビット演算を行う
分、処理時間が必要になるというアンバランスがある。
実行速度向上のためには、パイプラインステージをさら
に分割して多段にすれば良い。In the above three-stage pipeline structure, the overall instruction execution speed is determined by the processing speed of the slowest execution stage among the stages. In order to speed up such pipeline processing, it is necessary to equalize the processing speed of each stage. In this example, if memories having the same access time are used for the instruction memory and the data memory, the first processing is performed.
There is an imbalance that the processing time is required as much as the third stage performs the bit operation on the stage.
In order to improve the execution speed, the pipeline stage may be further divided into multiple stages.
【0005】そこで、本発明者らは、専用ハードウェア
(プロセッサ)の命令実行サイクルを以下のような5段
に要素分割した、5段パイプライン構造を持ったプログ
ラマブルコントローラを開発した。 第1ステージ:命令フェッチ 第2ステージ:命令デコード、レジスタフェッチ 第3ステージ:算術論理演算、データアドレス計算、分
岐先計算 第4ステージ:メモリアクセス(リード/ライト) 第5ステージ:分岐、ビット演算、レジスタ書き込みTherefore, the present inventors have developed a programmable controller having a five-stage pipeline structure in which an instruction execution cycle of dedicated hardware (processor) is divided into the following five stages. 1st stage: instruction fetch 2nd stage: instruction decode, register fetch 3rd stage: arithmetic logic operation, data address calculation, branch destination calculation 4th stage: memory access (read / write) 5th stage: branch, bit operation, Write register
【0006】この5段パイプライン構造を採用すると、
従来の3段パイプライン構造のプログラマブルコントロ
ーラに比べてパイプラインステージ間のアンバランスが
改善され、パイプラインステージ1段あたりの所要時間
も短縮されるため、全体の命令実行速度を向上させるこ
とができる。この5段パイプライン構造のプログラマブ
ルコントローラの概略構成図を、図30に示す。When this five-stage pipeline structure is adopted,
Compared to a conventional programmable controller having a three-stage pipeline structure, the imbalance between pipeline stages is improved, and the time required for one stage of the pipeline stage is reduced, so that the overall instruction execution speed can be improved. . FIG. 30 shows a schematic configuration diagram of the programmable controller having the five-stage pipeline structure.
【0007】図で、IF(Instruction F
etch)で示される第1ステージは、命令メモリIM
EMから命令レジスタIRヘ次に実行する命令を読み込
む命令フェッチ処理を行うステージで、命令を格納する
命令メモリIMEMと、プログラムカウンタ制御のため
のアドレス計算回路ADDRCALCからの信号を受け
て、次に実行する命令が格納された命令メモリIMEM
のアドレスを計数するプログラムカウンタPCとで構成
されている。プログラムカウンタPCのアドレス指定に
従って命令メモリIMEMから読み出された命令が格納
される命令レジスタIRは、第1ステージIFの実行結
果を保存して、次の第2ステージであるIDにその結果
を伝える、パイプラインレジスタIF/IDを兼ねてい
る。In the figure, an IF (Instruction F)
The first stage, denoted by (etch), is the instruction memory IM
At the stage of performing an instruction fetch process of reading the next instruction to be executed from the EM to the instruction register IR, receiving the signals from the instruction memory IMEM for storing the instruction and the address calculation circuit ADDRCALC for controlling the program counter, and executing the next instruction Instruction memory IMEM in which instructions to be stored are stored
And a program counter PC for counting the address of the program. An instruction register IR in which an instruction read from the instruction memory IMEM is stored in accordance with the address designation of the program counter PC stores an execution result of the first stage IF and transmits the result to the next second stage ID. , Pipeline register IF / ID.
【0008】ID(Instruction Deco
de)で示される第2ステージは、命令デコーダDCに
よる命令デコード、および、レジスタファイルRFを構
成する複数の汎用レジスタのいずれかより値を取り出す
レジスタフェッチ処理を行うステージで、命令のオペレ
ーションコード部を解読するデコーダDCと、複数の汎
用レジスタで構成された汎用レジスタファイルRFとで
構成されている。汎用レジスタファイルRFには、2つ
の出力が設けられており、一方の出力はパイプラインレ
ジスタID/EXのS1に接続され、他方の出力はパイ
プラインレジスタID/EXのS2に接続されている。
また、命令デコーダDCで解読された値もパイプライン
レジスタID/EXの所定の箇所に格納される。[0008] ID (Instruction Deco)
The second stage indicated by de) is a stage for performing instruction decoding by the instruction decoder DC and register fetch processing for extracting a value from one of a plurality of general-purpose registers constituting the register file RF. It comprises a decoder DC for decoding and a general-purpose register file RF composed of a plurality of general-purpose registers. The general register file RF is provided with two outputs, one output is connected to S1 of the pipeline register ID / EX, and the other output is connected to S2 of the pipeline register ID / EX.
The value decoded by the instruction decoder DC is also stored in a predetermined location of the pipeline register ID / EX.
【0009】次に、EX(EXecute)で示される
第3ステージは、算術論理演算ユニットALUによっ
て、算術論理演算またはデータアドレス計算または分岐
先の実効アドレスを計算する分岐先計算を行うステージ
で、算術論理演算ユニットALUの一方の入力は、パイ
プラインレジスタID/EXのS1の出力に接続され、
他方の入力は、パイプラインレジスタID/EXのS2
の出力に接続されている。また、算術論理演算ユニット
ALUは、パイプラインレジスタID/EXの所定の箇
所に格納された、デコードされた命令の値によって制御
され、算術論理演算ユニットALUの出力は、パイプラ
インレジスタEX/MEMのDの箇所に格納される。Next, a third stage indicated by EX (Execute) is a stage in which the arithmetic and logic operation unit ALU performs an arithmetic and logic operation or a data address calculation or a branch destination calculation for calculating an effective address of a branch destination. One input of the logical operation unit ALU is connected to the output of S1 of the pipeline register ID / EX,
The other input is S2 of the pipeline register ID / EX.
Connected to the output. The arithmetic and logic unit ALU is controlled by the value of the decoded instruction stored at a predetermined location of the pipeline register ID / EX, and the output of the arithmetic and logic unit ALU is output from the pipeline register EX / MEM. D is stored.
【0010】次に、MEM(MEMory acces
s)で示される第4ステージは、データメモリDMEM
ヘのメモリアクセス処理を行うステージで、パイプライ
ンレジスタEX/MEMのDの箇所に格納されていた値
は、データメモリDMEMの所定アドレスのメモリに格
納されると共に、パイプラインレジスタMEM/WBの
所定箇所に出力される。または、データメモリDMEM
の所定アドレスに格納されていた値がパイプラインレジ
スタMEM/WBの所定箇所に格納される。Next, MEM (MEMory acces)
The fourth stage indicated by s) is a data memory DMEM
In the stage where the memory access process is performed, the value stored in the location D of the pipeline register EX / MEM is stored in the memory at the predetermined address of the data memory DMEM, and the value stored in the pipeline register MEM / WB is stored in the predetermined address. Is output to the location. Or data memory DMEM
Is stored in a predetermined location of the pipeline register MEM / WB.
【0011】最後に、WB(Write Back)で
示される第5ステージは、ビット演算または汎用レジス
タへの書き込み処理または分岐処理を行うステージで、
汎用レジスタへの書き込み処理の場合は、パイプライン
レジスタMEM/WBの所定箇所に格納されていた値
が、レジスタファイルRFの所定の汎用レジスタに格納
される。但し、図30では本発明に関する部分のみ図示
しており、他の構成は図示を省略している。Finally, a fifth stage represented by WB (Write Back) is a stage for performing a bit operation, a write process to a general-purpose register, or a branch process.
In the case of a write process to a general-purpose register, a value stored in a predetermined location of the pipeline register MEM / WB is stored in a predetermined general-purpose register of the register file RF. However, FIG. 30 shows only a portion related to the present invention, and other components are not shown.
【0012】ところで、プログラマブルコントローラに
必要とされる機能の中には、データメモリDMEMの1
ワード中のある1ビットの値を参照、更新したり、命令
実行中に複数ワードのデータメモリDMEMの参照、更
新を行うビット処理命令がある。このビット処理命令を
実行するには複数のメモリアクセスサイクルが必要とな
るため、上記の5段パイプライン構造をそのまま用いた
場合には、これらのビット処理命令を実行させることが
できない。そこで、この従来例では、ビット処理命令を
処理するBPU(Bit Processing Un
it)のブロックと、ビット処理演算により更新される
レジスタ:BITACC(Bit Accumulat
or)を有する構造となっている。The functions required for the programmable controller include one of the data memories DMEM.
There is a bit processing instruction for referring to and updating a certain 1-bit value in a word, and for referring to and updating a multiple-word data memory DMEM during execution of an instruction. Since the execution of the bit processing instruction requires a plurality of memory access cycles, the bit processing instruction cannot be executed if the above-described five-stage pipeline structure is used as it is. Therefore, in this conventional example, a BPU (Bit Processing Un
It) block and a register updated by the bit processing operation: BITACC (Bit Accumulate)
or).
【0013】この5段パイプライン構造を持つプログラ
マブルコントローラでは、例えば、図31に示すよう
に、IF:命令フェッチ、ID:命令デコード、レジス
タフェッチ、EX:算術論理演算、データアドレス計
算、分岐先計算、MEM:メモリアクセス(リード/ラ
イト)、WB:分岐、レジスタ書き込みのように、1つ
の命令を5つのパイプラインステージに分けて実行す
る。このような命令に加えて、プログラマブルコントロ
ーラに必要とされる命令として、データメモリ1ワード
中のある1ビットの値を参照したり更新したりする“ビ
ット処理命令”というものが存在する。ビット処理命令
と呼ばれる命令には様々なものがあり、読み込んだデー
タメモリ1ワードのあるビットの状態によりプログラマ
ブルコントローラ内部のレジスタ:BITACC(ビッ
トアキュムレータ)を更新したり、このレジスタBIT
ACCの更新に加えてデータメモリ中のある1ビットの
値も更新する命令が存在する。このビット処理命令で
は、ビット処理命令以外の命令がレジスタ書き込みなど
を行っていたWBステージに相当する部分に、MEMス
テージで読み込んだデータメモリの値によりBITAC
Cの更新やデータメモリ中のある1ビットの値の更新、
データメモリ書き込み等の動作を行うBPUステージが
存在する。ビット処理命令には多くの種類の命令があ
り、命令に応じて必要となるBPUステージの数も後述
の図15(b),(c)に示すように変わってくる。In a programmable controller having this five-stage pipeline structure, for example, as shown in FIG. 31, IF: instruction fetch, ID: instruction decode, register fetch, EX: arithmetic logic operation, data address calculation, branch destination calculation , MEM: memory access (read / write), WB: branch, register write, and executes one instruction in five pipeline stages. In addition to such an instruction, there is an instruction required by the programmable controller called a “bit processing instruction” for referring to or updating a certain 1-bit value in one word of the data memory. There are various types of instructions called bit processing instructions, and a register: BITACC (bit accumulator) inside the programmable controller is updated according to the state of a certain bit of one word of the read data memory.
There is an instruction to update a certain 1-bit value in the data memory in addition to updating the ACC. In this bit processing instruction, an instruction other than the bit processing instruction writes a BITAC in a portion corresponding to the WB stage in which a register write or the like was performed by using the value of the data memory read in the MEM stage.
Update of C, update of a 1-bit value in data memory,
There is a BPU stage that performs operations such as data memory writing. There are many types of bit processing instructions, and the number of BPU stages required according to the instruction also changes as shown in FIGS. 15B and 15C described later.
【0014】[0014]
【発明が解決しようとする課題】上記5段パイプライン
構成の従来例は、3段パイプライン構成の従来例に比べ
て命令実行速度は向上している。しかし、更に高速化の
要求は高まり、専用ハードウェアであるプロセッサを実
現するための半導体プロセスの微細化が進み、専用ハー
ドウェア(プロセッサ)を構成する各回路ブロックの高
速化が進むと、従来例の5段パイプライン構成は高速化
を図るためには最適な構成ではない場合が発生する。例
えば、回路の専用ハードウェア(プロセッサ)自身の動
作速度の向上により、5段パイプライン構成の第3ステ
ージである各種演算処理よりも、第1ステージや第4ス
テージで実行するメモリアクセスの方により時間を要す
る場合が想定されるが、この第4ステージはデータメモ
リDMEMへのアクセスを行うだけであるのに対し、第
1ステージは命令メモリIMEMのアドレスであるプロ
グラムカウンタPCの値を決定した後、命令メモリIM
EMにアクセスしなければならないので、命令メモリI
MEMとデータメモリDMEMに同じアクセス時間のメ
モリを使用すると、プログラムカウンタPCの更新処理
が追加される分だけ第1ステージの方により多くの処理
時間が必要になるというアンバランスが発生する。The conventional example having the five-stage pipeline configuration has an improved instruction execution speed as compared with the conventional example having the three-stage pipeline configuration. However, the demand for higher speed is increasing, and the miniaturization of the semiconductor process for realizing a processor which is dedicated hardware is progressing, and the speed of each circuit block constituting the dedicated hardware (processor) is progressing. In some cases, the five-stage pipeline configuration is not an optimal configuration for achieving high speed. For example, due to the improvement of the operation speed of the dedicated hardware (processor) of the circuit itself, the memory access executed in the first stage or the fourth stage is more effective than the various arithmetic processes which are the third stage of the five-stage pipeline configuration. Although it may take time, the fourth stage only accesses the data memory DMEM, whereas the first stage determines the value of the program counter PC which is the address of the instruction memory IMEM. , Instruction memory IM
Since the EM must be accessed, the instruction memory I
When memories having the same access time are used for the MEM and the data memory DMEM, an unbalance occurs in that the first stage needs more processing time by the amount of the update processing of the program counter PC.
【0015】本発明はこのような点に鑑みてなされたも
のであり、その目的とするところは、パイプラインサイ
クル1つの処理に要する時間を短くし、全体の命令実行
時間を短くすることができるプログラマブルコントロー
ラを提供することにある。The present invention has been made in view of such a point, and an object of the present invention is to shorten the time required for one processing of a pipeline cycle and to shorten the entire instruction execution time. It is to provide a programmable controller.
【0016】[0016]
【課題を解決するための手段】上述のように、パイプラ
イン構成の専用ハードウェア(プロセッサ)の性能を最
大限に引き出すためには、パイプライン処理の各ステー
ジの実行時間を均等にする必要がある。そこで、5段パ
イプライン構成の中で最も処理に時間を費やしている第
1ステージを、プログラムカウンタPCを更新するステ
ージと命令メモリIMEMにアクセスするステージとの
2つに分割し、全体として6段パイプライン構成とする
(請求項1,2)。また、従来例では、専用ハードウェ
ア(プロセッサ)は内部動作の制御のために複数のクロ
ック信号で動作する構成を採用していたが、クロック信
号を区別することが処理時間のアンバランスの原因にな
る場合もあるので、本発明では専用ハードウェア(プロ
セッサ)は単一のクロック信号で動作する構成を採用す
る(請求項3)。As described above, in order to maximize the performance of dedicated hardware (processor) having a pipeline configuration, it is necessary to equalize the execution time of each stage of pipeline processing. is there. Therefore, the first stage, which spends the most time in processing in the five-stage pipeline configuration, is divided into two stages, one for updating the program counter PC and the other for accessing the instruction memory IMEM. A pipeline configuration is used (claims 1 and 2). In the conventional example, the dedicated hardware (processor) employs a configuration in which a plurality of clock signals are used to control internal operations. However, discrimination of clock signals may cause an unbalance in processing time. Therefore, the present invention employs a configuration in which the dedicated hardware (processor) operates with a single clock signal (claim 3).
【0017】[0017]
【発明の実施の形態】本発明の6段パイプライン構成の
プログラマブルコントローラの実施例1の概略構成を図
1のブロック図に示す。また、その動作タイミング図を
図2に示す。本実施例にあっては、従来例の5段パイプ
ライン構成のうち、第1番目の命令読み込みステージを
プログラムカウンタPCの更新と命令メモリIMEMの
読み込みの2つに分割することで、メモリアクセスに必
要な時間だけをパイプラインサイクルにすることがで
き、パイプラインサイクルに要する時間を短くし、処理
速度の高速化を図ることができる。従来例の図31と実
施例1の図2を比べると、実施例1の方が時間を多く費
やしているように見えるが、ここで表している時間はパ
イプラインサイクルを時間1と表記したもので、実際に
は図2のパイプラインサイクルの時間の方が図31のそ
れよりも短く、実施例1の方が処理速度は速い。FIG. 1 is a block diagram showing a schematic configuration of a first embodiment of a programmable controller having a six-stage pipeline according to the present invention. FIG. 2 shows an operation timing chart thereof. In this embodiment, of the five-stage pipeline configuration of the conventional example, the first instruction reading stage is divided into two, that is, the updating of the program counter PC and the reading of the instruction memory IMEM. Only the necessary time can be set as the pipeline cycle, the time required for the pipeline cycle can be shortened, and the processing speed can be increased. Comparing FIG. 31 of the conventional example with FIG. 2 of the first embodiment, it seems that the first embodiment spends more time, but the time shown here is the pipeline cycle represented by time 1. Actually, the pipeline cycle time of FIG. 2 is shorter than that of FIG. 31, and the processing speed of the first embodiment is faster.
【0018】また、図4の実施例2のように、専用ハー
ドウェア(プロセッサ)内部のフリップフロップや汎用
レジスタ、パイプラインレジスタなどの順序回路を駆動
するクロック信号として単相クロック信号を用いること
により、処理速度の高速化を図ることができる(請求項
3)。従来は図3に示すように、パイプラインレジスタ
を駆動するクロック信号Φ1の他に補助的な役割を果た
す追加のクロック信号を用いていた。図3ではパイプラ
インサイクルを4等分した4相クロックΦ1,Φ2,Φ
3,Φ4で動作させる場合を例に示している。そして、
パイプラインレジスタ以外の順序回路(例えばプログラ
ムカウンタPC)をΦ1以外のクロック信号、図3では
Φ2で駆動していた。このような構成にすると、設計の
柔軟性は向上するが、回路の内部ではパイプラインサイ
クルのΦ1の周期ではなく、例えばΦ1からΦ2までと
いう、隣接するクロック信号のエッジ間で演算を完了さ
せなければならない部分が生じる可能性がある。つま
り、図3の例ではパイプラインサイクルの1/4の時間
で演算が完了しなければならないパスも発生し、その部
分が専用ハードウェアの高速化の妨げになっていた。ま
た、動作周波数が向上するにつれて、LSIの異なるク
ロック系のエッジのタイミングの相対関係を保証するこ
とも難しくなってきた。そこで、図4のように内部の順
序回路を駆動するクロック信号を単相クロックに定める
ことにより、考慮しなければならない回路の演算時間を
パイプラインサイクルだけに単純化することができる。
また、同一系統のクロック信号の場合はLSI実デバイ
ス上のクロックスキューを小さく抑えることも容易であ
る。Further, as in the second embodiment shown in FIG. 4, a single-phase clock signal is used as a clock signal for driving a sequential circuit such as a flip-flop, a general-purpose register, or a pipeline register in dedicated hardware (processor). In addition, the processing speed can be increased (claim 3). Conventionally, as shown in FIG. 3, an additional clock signal serving an auxiliary role is used in addition to the clock signal Φ1 for driving the pipeline register. In FIG. 3, four-phase clocks Φ1, Φ2, Φ obtained by dividing the pipeline cycle into four equal parts
3 and Φ4 are shown as an example. And
A sequential circuit (for example, a program counter PC) other than the pipeline register is driven by a clock signal other than Φ1, that is, Φ2 in FIG. With such a configuration, the design flexibility is improved, but the operation must be completed between adjacent clock signal edges, for example, from Φ1 to Φ2, instead of the period of Φ1 of the pipeline cycle inside the circuit. Some parts may have to be created. That is, in the example of FIG. 3, there is also a path in which the operation must be completed in one-fourth of the pipeline cycle, which hinders the speeding up of the dedicated hardware. Further, as the operating frequency increases, it has become difficult to guarantee the relative relationship between the timings of the edges of different clock systems of the LSI. Therefore, by determining the clock signal for driving the internal sequential circuit to be a single-phase clock as shown in FIG. 4, the operation time of the circuit which must be considered can be simplified to only the pipeline cycle.
Further, in the case of clock signals of the same system, it is easy to reduce the clock skew on the LSI real device.
【0019】このように、単相クロックで動作する専用
ハードウェア(プロセッサ)の回路構成は、例えば図5
のようになる。従来はレジスタファイルはパイプライン
レジスタとは別のクロック信号で駆動していたが、この
実施例2は単相クロックで動作するため、図5のよう
に、第3ステージのレジスタファイルRFの出力がその
まま第4ステージで用いられている。As described above, the circuit configuration of the dedicated hardware (processor) that operates with a single-phase clock is, for example, as shown in FIG.
become that way. Conventionally, the register file is driven by a clock signal different from the pipeline register. However, since the second embodiment operates with a single-phase clock, the output of the register file RF in the third stage is output as shown in FIG. It is used as it is in the fourth stage.
【0020】次に、実施例3の要部回路構成を図6に示
す。実際の演算を行う算術論理演算ユニットALUへの
入力は、実施例2ではレジスタファイルの出力が用いら
れていたが、実施例3ではそれに加えてパイプラインレ
ジスタEX/MEMやMEM/WB上に転送されたAL
Uの出力も選択できるようにする(請求項4)。図6は
専用ハードウェアのうち関連する部分のみを図示してお
り、ここではALUの2つの入力のうちの片方のみを示
している。ALUの他方の入力についても同様の構成を
有していても良いことは言うまでもない。図中、ALU
RSLTはALUでの演算結果(ALU Resul
t)であり、パイプラインレジスタEX/MEMやME
M/WB上を転送されて、最後にはレジスタファイルに
格納される。SRCFBは選択手段であり、ALUの入
力として、レジスタファイルに格納されているデータS
1を用いるか、ALUの演算結果であるパイプラインレ
ジスタEX/MEM上のデータALURSLTを用いる
か、ALUの演算結果であるパイプラインレジスタME
M/WB上のデータALURSLTを用いるかを選択す
る手段である。パイプライン動作を実行すると、演算が
完了してからその値がレジスタに格納されるまでに遅れ
が発生するが、実施例3はその遅れによる不具合を回避
するものである。図7に実施例3の動作タイミングを示
す。Next, FIG. 6 shows a main part circuit configuration of the third embodiment. In the second embodiment, the input to the arithmetic and logic unit ALU for performing the actual operation uses the output of the register file in the second embodiment, but in the third embodiment, it is additionally transferred to the pipeline register EX / MEM or MEM / WB. AL done
The output of U can be selected (claim 4). FIG. 6 illustrates only the relevant portions of the dedicated hardware, and here shows only one of the two inputs of the ALU. It goes without saying that the other input of the ALU may have the same configuration. In the figure, ALU
RSLT calculates the operation result in ALU (ALU Resul
t), the pipeline registers EX / MEM and ME
The data is transferred on the M / WB and finally stored in the register file. SRCFB is a selection means. As an input of the ALU, data SRCFB is stored in the register file.
1 or the data ALURSLT on the pipeline register EX / MEM which is the operation result of the ALU, or the pipeline register ME which is the operation result of the ALU.
This is a means for selecting whether to use the data ALURSLT on the M / WB. When the pipeline operation is executed, a delay occurs between the completion of the operation and the time when the value is stored in the register. In the third embodiment, a problem due to the delay is avoided. FIG. 7 shows the operation timing of the third embodiment.
【0021】図7の命令1はレジスタR1とR2のAN
D演算の結果をレジスタR3に格納するというものであ
るが、時刻4で演算が完了したAND演算の結果は、時
刻6の時点で初めてレジスタR3に格納される。ここで
命令1に続く命令で、命令1で更新されるレジスタR3
を用いた場合、図7では命令1の2つ後ろの命令3が演
算の引数にレジスタR3の値を必要とするが、この命令
3が引数を読み出すのは時刻5の時点であり、このとき
にはまだ命令1で更新されたレジスタR3の値がレジス
タファイル内に反映されておらず、そのまま演算を実行
すると、誤った引数による演算を実行することになる。
そこで、実施例3では図6に示すように、レジスタファ
イルにはまだ書き込まれていないが、レジスタファイル
に書き込むためにパイプラインレジスタ上を転送されて
いる値を演算の引数に用いることにより、矛盾なく演算
を実行することを可能とする。The instruction 1 shown in FIG. 7 corresponds to the AN of the registers R1 and R2.
The result of the D operation is stored in the register R3. The result of the AND operation completed at time 4 is stored in the register R3 for the first time at time 6. Here, in the instruction following the instruction 1, the register R3 updated by the instruction 1
In FIG. 7, the instruction 3 immediately after the instruction 1 in FIG. 7 requires the value of the register R3 as an operation argument. However, the instruction 3 reads the argument at the time 5; The value of the register R3 updated by the instruction 1 has not yet been reflected in the register file, and if the operation is executed as it is, the operation with an incorrect argument will be executed.
Therefore, as shown in FIG. 6, in the third embodiment, the values which have not yet been written to the register file, but are transferred on the pipeline register for writing to the register file, are used as the arguments of the operation. It is possible to execute an operation without any change.
【0022】このようにパイプライン構造上のデータを
用いることで、レジスタファイルに値が書き込まれてい
なくても正しい引数を用いた演算を行うことができる
が、データメモリDMEMから値を読み込むLOAD命
令の場合は事情が変わってくる。図8に示すように、L
OAD命令でデータメモリDMEMから値を読み込む場
合は、専用ハードウェア(プロセッサ)内部にその値が
現れるのは時刻5の時点で、その値がレジスタファイル
RFに書き込まれるのは時刻6の時点である。従って後
続命令をそのまま実行した場合は正しい引数に基づく演
算を実行することができず、何サイクルかはパイプライ
ン動作を止めてデータメモリDMEMから値が読み込ま
れるのを待つ必要がある。By using the data on the pipeline structure in this way, the operation using the correct argument can be performed even if the value is not written in the register file, but the LOAD instruction for reading the value from the data memory DMEM is used. In the case, the situation changes. As shown in FIG.
When a value is read from the data memory DMEM by the OAD instruction, the value appears in the dedicated hardware (processor) at time 5 and the value is written in the register file RF at time 6. . Therefore, if the subsequent instruction is executed as it is, an operation based on a correct argument cannot be executed, and it is necessary to stop the pipeline operation and wait for a value to be read from the data memory DMEM for several cycles.
【0023】図8において、命令2の正常動作例と不具
合発生例を比較すると明らかなように、データメモリD
MEMからレジスタファイルRFにデータを読み込むL
OAD命令1の実行後に、そのレジスタファイルRFに
格納されるデータを引数とする命令2を実行するときに
は、命令2のパイプライン動作におけるIF部とID部
の間に、パイプラインの単位時間で2回分の休止(スト
ール)を挿入すれば正常に動作するが、ストールを設け
ないと、不具合が発生する。In FIG. 8, it is apparent from a comparison between the normal operation example of the instruction 2 and the failure occurrence example that the data memory D
L to read data from MEM to register file RF
When the instruction 2 having the data stored in the register file RF as the argument is executed after the execution of the OAD instruction 1, the unit time of the pipeline between the IF unit and the ID unit in the pipeline operation of the instruction 2 is 2 units. Normal operation can be achieved by inserting a pause (stall) for a number of times, but a malfunction occurs if a stall is not provided.
【0024】このようなLOAD命令の後続命令に関す
る実行矛盾に対処する実施例4を図9に示す。6段パイ
プライン構成の第3ステージである命令解読ステージで
命令をデコードし、その命令がLOAD命令であるこ
と、LOAD命令によりレジスタファイルRF内のどの
汎用レジスタに値を格納するのかという制御情報を、パ
イプラインレジスタ上を順次転送する。図中の斜線を施
した部分に制御情報が転送されており、これをハザード
検出ユニットHDUにより分析する。デコーダDCによ
る命令解読時に汎用レジスタの値を引数に用いる命令で
あることを検出すると、そのことがハザード検出ユニッ
トHDUに通知される。ハザード検出ユニットHDUは
先行するLOAD命令で引数となる汎用レジスタが更新
されるかどうかをチェックし、必要に応じてパイプライ
ン動作を止めてレジスタの値が正しい値に更新されるま
で待つ。FIG. 9 shows a fourth embodiment for coping with the execution inconsistency relating to the instruction following the LOAD instruction. An instruction is decoded in an instruction decoding stage which is a third stage of a six-stage pipeline configuration, and control information indicating that the instruction is a LOAD instruction and which general-purpose register in the register file RF stores a value by the LOAD instruction is transmitted. , Sequentially on the pipeline register. The control information is transferred to the hatched portion in the figure, and is analyzed by the hazard detection unit HDU. When it is detected that the instruction uses the value of the general-purpose register as an argument when the instruction is decoded by the decoder DC, this is notified to the hazard detection unit HDU. The hazard detection unit HDU checks whether the general-purpose register serving as an argument is updated by the preceding LOAD instruction, stops the pipeline operation as necessary, and waits until the register value is updated to a correct value.
【0025】ハザード検出ユニットHDUがパイプライ
ン動作を止めるときには、PC_HZD(プログラムカ
ウンタのハザード)を“1”とする。通常のパイプライ
ン動作を実行しているときには、PC_HZDは“0”
である。このとき、パイプラインレジスタPC/IFの
プログラムカウンタPCにはアドレス計算部ADDRC
ALCの出力が格納され、パイプラインレジスタPC/
IFのプログラムカウンタPCの内容は命令メモリIM
EMの読み出しに用いられると共に、パイプラインレジ
スタIF/IDのプログラムカウンタPCに転送され、
命令メモリIMEMから読み出された命令は、パイプラ
インレジスタIF/IDのインストラクションレジスタ
IRに格納されるように動作する。一方、ハザード検出
ユニットHDUがパイプライン動作を止めるためにPC
_HZDを“1”とすると、パイプラインレジスタPC
/IFのプログラムカウンタPCにはパイプラインレジ
スタIF/IDのプログラムカウンタPCの出力が格納
され、パイプラインレジスタPC/IFのプログラムカ
ウンタPCの内容はパイプラインレジスタIF/IDの
プログラムカウンタPCに転送されると共に、命令メモ
リIMEMの読み出しに用いられるが、パイプラインレ
ジスタIF/IDのインストラクションレジスタIRは
命令メモリIMEMから読み出された命令を格納するの
ではなく、前回の内容をそのまま保持する。When the hazard detection unit HDU stops the pipeline operation, PC_HZD (hazard of the program counter) is set to "1". When a normal pipeline operation is being executed, PC_HZD is “0”.
It is. At this time, the program counter PC of the pipeline register PC / IF has an address calculation unit ADDRC.
The output of the ALC is stored in the pipeline register PC /
The contents of the IF program counter PC are stored in the instruction memory IM.
Used for reading the EM, transferred to the program counter PC of the pipeline register IF / ID,
The instruction read from the instruction memory IMEM operates so as to be stored in the instruction register IR of the pipeline register IF / ID. On the other hand, the hazard detection unit HDU requires the PC to stop the pipeline operation.
_HZD is set to “1”, the pipeline register PC
The output of the pipeline counter IF / ID program counter PC is stored in the / IF program counter PC, and the contents of the pipeline register PC / IF program counter PC are transferred to the pipeline register IF / ID program counter PC. At the same time, the instruction memory IR is used for reading the instruction memory IMEM. The instruction register IR of the pipeline register IF / ID does not store the instruction read from the instruction memory IMEM, but retains the previous contents.
【0026】実施例4の動作タイミング図を図10に示
す。図10では命令メモリIMEMの1番地にLOAD
命令を、続く2番地にLOAD命令で更新されるレジス
タR1を引数に用いる命令を配置し、それらの命令を順
次実行させている。図中のPC_IF_PCはパイプラ
インレジスタPC/IF上のPCであることを、IF_
ID_PCはパイプラインレジスタIF/ID上のPC
であることを、IF_ID_IRはパイプラインレジス
タIF/ID上のIRであることを示している。図10
のタイミング図に示す通り、命令1のLOAD命令がレ
ジスタR1を更新する時刻6より後で、後続命令の命令
2が引数を読み出す動作を実現している。FIG. 10 shows an operation timing chart of the fourth embodiment. In FIG. 10, LOAD is at address 1 of the instruction memory IMEM.
As instructions, instructions using a register R1 updated by a LOAD instruction as an argument are arranged at the following address 2, and those instructions are sequentially executed. PC_IF_PC in the figure is a PC on pipeline register PC / IF,
ID_PC is PC on pipeline register IF / ID
Indicates that the IF_ID_IR is an IR on the pipeline register IF / ID. FIG.
As shown in the timing chart, after the time 6 when the LOAD instruction of the instruction 1 updates the register R1, the operation of the instruction 2 of the succeeding instruction reads the argument.
【0027】ところで、実施例4に示したように、LO
AD命令の後続命令でLOAD命令により更新されるレ
ジスタを参照する場合はパイプライン動作が止まるが、
このような動作速度を低下させる振る舞いは可能な限り
避けることが望ましい。例えば、LOAD命令の後続命
令がデータメモリDMEMに値を書き込むSTORE命
令の場合には、実施例4のようにパイプライン動作を停
止させずに済む。STORE命令はその他のレジスタ間
演算命令などとは異なり、ALUで値を演算する必要が
ないためである。By the way, as shown in Embodiment 4, the LO
When an instruction following the AD instruction refers to a register updated by the LOAD instruction, the pipeline operation stops.
It is desirable to avoid such a behavior that reduces the operation speed as much as possible. For example, if the instruction following the LOAD instruction is a STORE instruction that writes a value to the data memory DMEM, it is not necessary to stop the pipeline operation as in the fourth embodiment. This is because the STORE instruction does not need to calculate a value in the ALU, unlike other inter-register operation instructions.
【0028】この場合の例外処理を実現する実施例5の
動作タイミング図を図11に示す。命令1のLOAD命
令がデータメモリDMEMから値を読み込むとき、専用
ハードウェア(プロセッサ)内にその値が現れるのは時
刻5の時点で、それがレジスタR1に格納されるのは時
刻6の時点である。そして、すぐ後ろの命令2がレジス
タR1の値をデータメモリDMEMに書き込むSTOR
E命令の場合は、本来ならばEXステージを実行する前
にレジスタR1の値が正しい値に更新されていなければ
ならないが、STORE命令はALUで値を加工するこ
となく汎用レジスタの値をそのまま書き込む命令なの
で、汎用レジスタに書き込まれる前の値をSTORE命
令にそのまま流用することができる(請求項6)。図1
1の命令2の場合は時刻5から始まるMEMステージ
で、命令3の場合は同じくEXステージで、命令1がデ
ータメモリDMEMから読み込んだ値を汎用レジスタか
ら読み出した値の代わりに用いることで、正しく命令を
実行することができる。FIG. 11 shows an operation timing chart of the fifth embodiment for realizing the exception processing in this case. When the LOAD instruction of instruction 1 reads a value from the data memory DMEM, the value appears in the dedicated hardware (processor) at time 5 and is stored in the register R1 at time 6 is there. Then, the instruction 2 immediately after the STOR writes the value of the register R1 into the data memory DMEM.
In the case of the E instruction, the value of the register R1 must be updated to a correct value before the execution of the EX stage, but the STORE instruction writes the value of the general-purpose register as it is without processing the value with the ALU. Since the instruction is an instruction, the value before being written to the general-purpose register can be directly used for the STORE instruction. FIG.
In the case of the instruction 2 of the instruction 1, the MEM stage starting from the time 5 is used. In the case of the instruction 3, the instruction is also the EX stage. Instructions can be executed.
【0029】この実施例5の回路構成のブロック図を図
12に示す。図12のMEMFB2が図11の命令2の
STORE命令のためのデータの選択手段で、図12の
MEMFB1が図11の命令3のSTORE命令のため
のデータ選択手段である。つまり、命令1のLOAD命
令がデータメモリDMEMから値を読み込むとき、専用
ハードウェア(プロセッサ)内にその値が現れるのは時
刻5の時点で、その値はパイプラインレジスタMEM/
WBのSRCMEMの部分に現れる。この値を、命令2
のMEMステージで利用するために、WBステージのマ
ルチプレクサMUXとMEMステージの選択手段MEM
FB2を介してデータメモリDMEMにデータを書き込
む。また、同じ値を命令3のEXステージで利用するた
めに、WBステージのマルチプレクサMUXとEXステ
ージの選択手段MEMFB1を介してパイプラインレジ
スタEX/MEMのSRCMEMの部分に命令1で読み
込んだ値を格納しておく。命令3のMEMステージで
は、パイプラインレジスタEX/MEMのSRCMEM
の部分に格納されたデータが選択手段MEMFB2を介
してデータメモリDMEMに書き込まれることになる。FIG. 12 is a block diagram showing the circuit configuration of the fifth embodiment. MEMFB2 in FIG. 12 is data selection means for the STORE instruction of instruction 2 in FIG. 11, and MEMFB1 in FIG. 12 is data selection means for the STORE instruction of instruction 3 in FIG. That is, when the LOAD instruction of instruction 1 reads a value from the data memory DMEM, the value appears in the dedicated hardware (processor) at time 5 and the value is stored in the pipeline register MEM /
Appears in the SRCMEM part of WB. This value is
MUX and MEM stage selection means MEM for use in the MEM stage
The data is written to the data memory DMEM via the FB2. In order to use the same value in the EX stage of the instruction 3, the value read by the instruction 1 is stored in the SRCMEM portion of the pipeline register EX / MEM via the multiplexer MUX of the WB stage and the selecting means MEMFB1 of the EX stage. Keep it. In the MEM stage of the instruction 3, the SRCMEM of the pipeline register EX / MEM is used.
Will be written to the data memory DMEM via the selection means MEMFB2.
【0030】パイプライン動作が乱れる場合としてこれ
まで述べたLOAD命令に関するものの他に、分岐命令
に関するものが挙げられる。図13に分岐命令を実行し
ている様子を示す。命令メモリIMEMの1番地に格納
されている命令1が分岐命令で、この命令の分岐条件が
成立し、命令1の次は命令メモリIMEMの100番地
に格納されている命令に分岐するものとする。命令1は
EXステージで分岐条件の判別を行い、その結果に基づ
いて時刻5に分岐先アドレスをプログラムカウンタPC
にセットし、そのプログラムカウンタPCの値に基づい
て命令メモリIMEMから分岐先の命令100が読み出
されて実行されることになるが、分岐先の命令100の
実行が始まる前に命令1の後続命令である命令2,3,
4がパイプライン内に投入されており、このままでは分
岐条件成立時には実行してはならない命令2,3,4が
実行されてしまう。As a case where the pipeline operation is disturbed, there is a branch instruction in addition to the LOAD instruction described above. FIG. 13 shows how the branch instruction is being executed. It is assumed that the instruction 1 stored at the address 1 of the instruction memory IMEM is a branch instruction, the branch condition of this instruction is satisfied, and the instruction 1 branches to the instruction stored at the address 100 of the instruction memory IMEM. . The instruction 1 determines a branch condition in the EX stage, and based on the result, at time 5, sets the branch destination address to the program counter PC.
The instruction 100 at the branch destination is read from the instruction memory IMEM based on the value of the program counter PC and is executed. However, before the execution of the instruction 100 at the branch destination starts, Instructions 2, 3, which are instructions
4 is input into the pipeline, and instructions 2, 3, and 4, which must not be executed when the branch condition is satisfied, are executed.
【0031】そこで、図14に示すように、4つの選択
手段MUX(マルチプレクサ)を設けて、これらをME
Mステージのハザード検出ユニットHDUから出力され
る選択信号PC_SEL、IF_HZD、ID_HZ
D、EX_HZDにより制御する。パイプラインレジス
タEX/MEMの制御情報のうち、JPはIDステージ
のデコーダDCで解読された命令がジャンプ命令であっ
たことを示すフラグ、PCはジャンプ命令の分岐先アド
レス、DはALUの演算結果のデータ、EQ(Equa
l)はALUで2つの値を比較して一致したときに分岐
先アドレスに分岐する条件ジャンプ命令の条件が成立し
たことを示すフラグ、GT(Greater tha
n)はALUで2つの値を比較して一方が他方よりも大
きいときに分岐先アドレスに分岐する条件ジャンプ命令
の条件が成立したことを示すフラグ、LT(Less
than)はALUで2つの値を比較して一方が他方よ
りも小さいときに分岐先アドレスに分岐する条件ジャン
プ命令の条件が成立したことを示すフラグである。Therefore, as shown in FIG. 14, four selection means MUX (multiplexer) are provided,
Selection signals PC_SEL, IF_HZD, ID_HZ output from hazard detection unit HDU of M stage
D, EX_HZD. In the control information of the pipeline registers EX / MEM, JP is a flag indicating that the instruction decoded by the decoder DC in the ID stage is a jump instruction, PC is the branch destination address of the jump instruction, and D is the operation result of the ALU. Data, EQ (Equa
l) is a flag indicating that the condition of the conditional jump instruction that branches to the branch destination address when the two values are compared and matched in the ALU is satisfied, GT (Greater that)
n) is a flag indicating that the condition of the conditional jump instruction that branches to the branch destination address when one value is larger than the other by comparing two values in the ALU is satisfied, LT (Less)
(tan) is a flag indicating that the condition of the conditional jump instruction that branches to the branch destination address when one is smaller than the other in the ALU is satisfied.
【0032】MEMステージのハザード検出ユニットH
DUは、パイプラインレジスタEX/MEMの制御情報
のうち、ジャンプ命令JPまたは条件付きジャンプ命令
EQ、GT、LTの条件成立を示すフラグが立ったとき
には、図13に示すように、選択信号PC_SEL(I
F_HZD、ID_HZD、EX_HZDも同じ)を
“1”とする。図13において、PC_IF_PCはパ
イプラインレジスタPC_IF上のプログラムカウンタ
PCであること、IF_ID_IRはパイプラインレジ
スタIF_ID上の命令レジスタIRであることを示
す。Hazard detection unit H for MEM stage
When the flag indicating the satisfaction of the condition of the jump instruction JP or the conditional jump instructions EQ, GT, and LT is set in the control information of the pipeline register EX / MEM, as shown in FIG. 13, the DU selects the selection signal PC_SEL ( I
F_HZD, ID_HZD, and EX_HZD are the same). In FIG. 13, PC_IF_PC indicates a program counter PC on the pipeline register PC_IF, and IF_ID_IR indicates an instruction register IR on the pipeline register IF_ID.
【0033】以下、MEMステージのハザード検出ユニ
ットHDUから出力される選択信号PC_SEL、IF
_HZD、ID_HZD、EX_HZDによる制御につ
いて説明する。パイプライン構造のID部とEX部には
命令を解読した結果の制御信号を“0”で上書きする選
択手段MUX(マルチプレクサ)を設け、それぞれID
_HZDとEX_HZDが“1”の時は制御信号のう
ち、レジスタ更新やデータメモリ更新といった結果を残
すための制御信号を無効化する機能を実現する。また、
IF部にはIF_HZDが“1”の時は、命令メモリI
MEMから読み込んだ値の代わりに何も実行しないNO
P命令に相当するデータを命令レジスタIRに書き込む
選択手段MUXを設ける。これらのIF_HZD,ID
_HZD,EX_HZDは分岐先アドレスをパイプライ
ンレジスタPC/IFのプログラムカウンタPCに書き
込ませるための制御信号PC_SELと同じタイミング
で変化し、それにより、図13の時刻5の時点で後続命
令2,3,4をまとめて無効化することができる(請求
項7)。分岐先アドレスの計算には、パイプラインレジ
スタIF/IDの命令レジスタIRからパイプラインレ
ジスタID/EXのレジスタIに転送された相対アドレ
ス値を、パイプラインレジスタID/EXのプログラム
カウンタPCの値と加算することにより、パイプライン
レジスタEX/MEM上のプログラムカウンタPCに格
納され、制御信号PC_SELが“1”になると、パイ
プラインレジスタPC/IF上のプログラムカウンタP
Cに転送されるものである。Hereinafter, selection signals PC_SEL, IF output from the hazard detection unit HDU of the MEM stage
_HZD, ID_HZD and EX_HZD will be described. The ID section and the EX section of the pipeline structure are provided with selection means MUX (multiplexer) for overwriting the control signal as a result of decoding the instruction with "0".
When _HZD and EX_HZD are “1”, a function of invalidating a control signal for leaving a result such as register update or data memory update among control signals is realized. Also,
When IF_HZD is “1”, the instruction memory I
NO to execute nothing instead of the value read from MEM
A selection means MUX for writing data corresponding to the P instruction into the instruction register IR is provided. These IF_HZD, ID
_HZD and EX_HZD change at the same timing as the control signal PC_SEL for writing the branch destination address to the program counter PC of the pipeline register PC / IF, so that the subsequent instructions 2, 3, at time 5 in FIG. 4 can be invalidated collectively (claim 7). To calculate the branch destination address, the relative address value transferred from the instruction register IR of the pipeline register IF / ID to the register I of the pipeline register ID / EX is used as the value of the program counter PC of the pipeline register ID / EX. The addition is stored in the program counter PC on the pipeline register EX / MEM, and when the control signal PC_SEL becomes “1”, the program counter P on the pipeline register PC / IF is
C.
【0034】ところで、今まで述べた命令はすべて図1
5の(a)や(b)のように6つのパイプラインサイク
ルで命令を実行するものばかりであったが、プログラマ
ブルコントローラに特有のビット処理命令の中には、図
15(c)のように6つ以上のパイプラインサイクルで
命令を実行するものがある。どれだけのパイプラインサ
イクルが必要なのかは命令により様々に変化するが、こ
ういった命令は、図16(a)に示すようにメモリアク
セスが1回だけ発生する通常とは異なり、図16(b)
に示すように複数回のメモリアクセスが発生する。LO
AD命令やSTORE命令はメモリアクセス用のアドレ
ス計算はレジスタの値と命令語の中の即値データの加算
という単純なものなので、アドレス計算はALUで実行
されるが、ビット処理命令の場合はもっと複雑な計算が
必要になるため、図17の実施例7に示すように、AL
Uではなく専用のアドレス計算ブロックBPUADRを
設けることにする。By the way, all the instructions described so far are shown in FIG.
Although instructions are only executed in six pipeline cycles as in (a) and (b) of FIG. 5, some of the bit processing instructions unique to the programmable controller are as shown in FIG. Some execute instructions in six or more pipeline cycles. How many pipeline cycles are required varies depending on the instruction, but these instructions are different from the usual case in which memory access occurs only once as shown in FIG. b)
As shown in (1), a plurality of memory accesses occur. LO
For the AD and STORE instructions, the address calculation for memory access is a simple addition of the register value and the immediate data in the instruction word, so the address calculation is performed by the ALU, but the bit processing instruction is more complicated. As shown in the seventh embodiment in FIG.
A dedicated address calculation block BPUADR is provided instead of U.
【0035】図17では6段パイプライン構造のうち、
EX、MEM、WB(BPU)の3つのステージのう
ち、特にデータメモリアクセスに関する部分を示してい
る。図17のEXステージにおいて、LOAD命令やS
TORE命令でメモリアドレスを計算させていたALU
とは別に、ビット処理命令専用のアドレス計算ブロック
BPUADRを設け、ビット処理命令実行時にはALU
の出力ではなく、BPUADRの出力をメモリアクセス
用のアドレスに用いる。そのために、マルチプレクサM
UXを設けて、ALUの出力とBPUADRの出力を選
択してパイプラインレジスタEX/MEMのアドレス部
分ADに書き込んでいる。ビット処理命令では、ビット
処理命令専用のアドレス計算ブロックBPUADRによ
りメモリアクセス用のアドレスを計算し、マルチプレク
サMUXを介してパイプラインレジスタEX/MEMの
アドレス部分ADに書き込むものである。また、メモリ
のアクセスが読み出しである場合には、パイプラインレ
ジスタEX/MEMのメモリ読み出し制御信号RDを
“1”とし、メモリのアクセスが書き込みである場合に
は、パイプラインレジスタEX/MEMのメモリ書き込
み制御信号WTを“1”とする。このように、ビット処
理命令では、ビット処理命令専用のアドレス計算ブロッ
クBPUADRがデータメモリDMEMのアドレスAD
DRを計算し、読み出し制御信号RD又は書き込み制御
信号WTを発行する。なお、LOAD命令やSTORE
命令ではALUによりメモリアドレスを計算させて、マ
ルチプレクサMUXを介してパイプラインレジスタEX
/MEMのアドレス部分ADに書き込む。LOAD命令
の場合には、パイプラインレジスタEX/MEMのメモ
リ読み出し制御信号RDが“1”となり、STORE命
令の場合には、パイプラインレジスタEX/MEMのメ
モリ書き込み制御信号WTが“1”となる。In FIG. 17, of the six-stage pipeline structure,
Of the three stages of EX, MEM, and WB (BPU), a portion particularly relating to data memory access is shown. In the EX stage of FIG. 17, a LOAD instruction or S
ALU for which memory address was calculated by TORE instruction
Separately, an address calculation block BPUADR dedicated to a bit processing instruction is provided.
, But the output of BPUADR is used for the address for memory access. Therefore, the multiplexer M
A UX is provided to select the output of the ALU and the output of the BPUADR, and write it to the address portion AD of the pipeline register EX / MEM. In the bit processing instruction, an address for memory access is calculated by an address calculation block BPUADR dedicated to the bit processing instruction, and is written to the address portion AD of the pipeline register EX / MEM via the multiplexer MUX. When the memory access is a read, the memory read control signal RD of the pipeline register EX / MEM is set to “1”. When the memory access is a write, the memory of the pipeline register EX / MEM is set. The write control signal WT is set to “1”. As described above, in the bit processing instruction, the address calculation block BPUADR dedicated to the bit processing instruction stores the address AD of the data memory DMEM.
DR is calculated, and a read control signal RD or a write control signal WT is issued. In addition, LOAD instruction and STORE instruction
In the instruction, the memory address is calculated by the ALU, and the pipeline register EX is output via the multiplexer MUX.
Write to the address portion AD of / MEM. In the case of the LOAD instruction, the memory read control signal RD of the pipeline register EX / MEM becomes "1", and in the case of the STORE instruction, the memory write control signal WT of the pipeline register EX / MEM becomes "1". .
【0036】また、EXパイプラインサイクルで計算し
た値だけでなく、ビット処理命令を実行するブロックB
PUからデータメモリDMEMのアドレスADDRや書
き込み値WTDT、メモリの制御信号RD、WTを発行
し、それを元にメモリアクセスを実行することができる
ようなデータパスをMEMステージに設けている。図1
7では、メモリの制御信号RD、WTは「“1”の時に
実行」を意味するものとし、パイプラインレジスタEX
/MEMの上のメモリ制御信号WTやRDの値が“0”
であっても、ビット処理命令実行回路ブロックBPUか
らメモリアクセス要求を発行することにより、メモリア
クセスを実行することができる。すなわち、ビット処理
命令実行回路ブロックBPUからデータメモリDMEM
を読み出すときには、マルチプレクサMUXを切り替え
て、パイプラインレジスタEX/MEMのアドレス部分
ADに代えて、ビット処理命令実行回路ブロックBPU
からデータメモリDMにメモリアドレスADDRを与え
ると共に、ビット処理命令実行回路ブロックBPUから
ORゲートを介してデータメモリDMにメモリ読み出し
制御信号RDを与える。これにより、データメモリDM
EMから読み出されたデータRDDTは、パイプライン
レジスタMEM/WBを介してビット処理命令実行回路
ブロックBPUに入力される。また、ビット処理命令実
行回路ブロックBPUからデータメモリDMEMに書き
込むときには、マルチプレクサMUXを切り替えて、パ
イプラインレジスタEX/MEMのアドレス部分ADに
代えて、ビット処理命令実行回路ブロックBPUからデ
ータメモリDMEMにメモリアドレスADDRを与える
と共に、マルチプレクサMUXを切り替えて、パイプラ
インレジスタEX/MEMのデータ部分DTに代えて、
ビット処理命令実行回路ブロックBPUからデータメモ
リDMEMに書き込みデータWTDTを与え、さらに、
ビット処理命令実行回路ブロックBPUからORゲート
を介してデータメモリDMEMにメモリ書き込み制御信
号WTを与える。これにより、ビット処理命令実行回路
ブロックBPUからデータメモリDMEMにデータを書
き込むことが可能となる。In addition to the value calculated in the EX pipeline cycle, a block B for executing a bit processing instruction
The PU issues the address ADDR and write value WTDT of the data memory DMEM and the control signals RD and WT of the memory, and the MEM stage is provided with a data path through which the memory access can be executed based on the data. FIG.
7, the control signals RD and WT of the memory mean “execute when“ 1 ””, and the pipeline register EX
The value of the memory control signal WT or RD on / MEM is "0"
However, the memory access can be executed by issuing a memory access request from the bit processing instruction execution circuit block BPU. That is, the bit processing instruction execution circuit block BPU is
Is read, the multiplexer MUX is switched so that the bit processing instruction execution circuit block BPU is replaced with the address part AD of the pipeline register EX / MEM.
, A memory address ADDR to the data memory DM, and a memory read control signal RD from the bit processing instruction execution circuit block BPU to the data memory DM via an OR gate. Thereby, the data memory DM
The data RDDT read from the EM is input to the bit processing instruction execution circuit block BPU via the pipeline register MEM / WB. When writing data from the bit processing instruction execution circuit block BPU to the data memory DMEM, the multiplexer MUX is switched to replace the address part AD of the pipeline register EX / MEM with the data from the bit processing instruction execution circuit block BPU to the data memory DMEM. The address ADDR is given, and the multiplexer MUX is switched to replace the data part DT of the pipeline register EX / MEM,
The write data WTDT is given from the bit processing instruction execution circuit block BPU to the data memory DMEM.
A memory write control signal WT is applied from the bit processing instruction execution circuit block BPU to the data memory DMEM via the OR gate. This makes it possible to write data from the bit processing instruction execution circuit block BPU to the data memory DMEM.
【0037】以上のタイムチャートを図16に示す。図
16の(a)はLOAD/STORE命令を、(b)は
命令実行時にデータメモリDMEMを3ワード読み込ん
で、3ワード書き込むようなビット処理命令を示してい
る。図16(a)では、EXステージのALUでアドレ
ス計算を行い、MEMステージでメモリのRead/W
riteを行っている。それに対して図16(b)では
EXステージのBPUADRでアドレス計算を行い、そ
の値を元にMEMステージでメモリReadを行ってい
る。さらにBPUADRはアドレス計算に必要なビット
処理命令の命令語の一部を自分の内部に記憶し、MEM
ステージの直後のパイプラインサイクルでもメモリRe
adができるよう、EXステージに続いてMEMステー
ジでもアドレス計算を実行し、併せてメモリRead要
求を発行することで、BPU1ステージでもメモリRe
adを実行している。さらにもう1ワードのメモリRe
adが必要になるが、BPU1ステージになるとビット
処理命令の命令語はパイプラインレジスタ上を移動して
BPUに到達しているので、BPU2サイクルのメモリ
Readは必要な信号をすべてBPUから発行し、実現
させている。その後の3ワードのメモリ書き込みも、必
要な値をすべてBPUから発行し、3サイクルにわたる
メモリWriteを実行している。The above time chart is shown in FIG. FIG. 16A shows a LOAD / STORE instruction, and FIG. 16B shows a bit processing instruction for reading three words from the data memory DMEM and writing three words when the instruction is executed. In FIG. 16A, address calculation is performed by the ALU in the EX stage, and Read / W of the memory is performed in the MEM stage.
writing. On the other hand, in FIG. 16B, the address is calculated in the BPUADR of the EX stage, and the memory read is performed in the MEM stage based on the value. Further, the BPUADR stores therein a part of the instruction word of the bit processing instruction necessary for the address calculation, and stores the MEM in the MEM.
Memory Re even in the pipeline cycle immediately after the stage
The address calculation is performed in the MEM stage following the EX stage and a memory read request is also issued so that the memory read request can be performed in the BPU1 stage.
running ad. One more word of memory Re
However, at the BPU1 stage, since the instruction word of the bit processing instruction moves on the pipeline register and reaches the BPU, the memory read of the BPU2 cycle issues all necessary signals from the BPU, Has been realized. In the subsequent three-word memory write, all necessary values are issued from the BPU, and the memory write over three cycles is executed.
【0038】このように、本実施例では、ビット処理命
令専用のアドレス計算ブロックBPUADRが複数サイ
クルにわたってアドレスを生成し、メモリアクセス要求
も併せて発行する機能を有する。また、命令がパイプラ
インレジスタ上で転送されてWBステージに到達した後
は、メモリアクセスが必要ならそのためのアドレスや書
き込みデータ、また、Read要求やWrite要求は
ビット処理命令を実行する回路ブロックBPUから発行
される。従ってこれまで述べた命令実行動作のメモリア
クセスのように、パイプラインレジスタEX/MEMの
値だけではなく、BPUからの信号によってもメモリア
クセスが可能な構造とすることができる(請求項8,
9)。As described above, in this embodiment, the address calculation block BPUADR dedicated to the bit processing instruction has a function of generating an address over a plurality of cycles and issuing a memory access request together. After the instruction is transferred on the pipeline register and reaches the WB stage, if a memory access is required, an address and write data for the memory access, and a Read request and a Write request are transmitted from the circuit block BPU executing the bit processing instruction. publish. Therefore, as in the memory access of the instruction execution operation described above, the memory can be accessed not only by the value of the pipeline register EX / MEM but also by the signal from the BPU.
9).
【0039】こういった命令:例えば図16(b)のよ
うにメモリアクセスを多く発生させるビット処理命令を
実行するときは、自分自身がメモリアクセスが完了する
まで後続命令がデータメモリDMEMにアクセスしない
よう、後続命令の実行を一時停止させておく必要があ
る。この機能を実現した実施例8の動作タイミング図を
図18に示す。図18の命令1は時刻4から時刻10ま
での6サイクルにわたってメモリアクセスを行っている
ので、後続の命令2は時刻10以降にメモリアクセスを
行うよう、実行を止めておく必要がある。この実行制御
は実施例4(図9)と同様の構成を活用して実現するこ
とができる。実施例8の回路構成を図19に示す。ハザ
ード検出ユニットHDUの入力がビット処理命令に関す
る制御情報となっている点が実施例4(図9)と異な
る。このように、メモリアクセスを多く発生し、後続命
令の実行を停止させなければならないビット処理命令で
あることを示す制御信号をパイプラインレジスタID/
EX、EX/MEM、MEM/WB上に転送し、必要に
応じてビット処理命令を実行する回路ブロックBPUか
らも同様の制御信号を発行し、これによりプログラムカ
ウンタPCの更新を停止させるための制御信号PC_H
ZDや命令解読を停止させるための制御信号ID_HZ
Dを発行し、ビット処理命令の後続命令の実行を必要な
期間だけ停止させる(請求項10,11)。Such an instruction: For example, when executing a bit processing instruction that causes a large number of memory accesses as shown in FIG. 16B, the subsequent instruction does not access the data memory DMEM until the memory access itself is completed. Thus, it is necessary to suspend the execution of the subsequent instruction. FIG. 18 shows an operation timing chart of the eighth embodiment which realizes this function. Since instruction 1 in FIG. 18 performs memory access over six cycles from time 4 to time 10, execution of subsequent instruction 2 must be stopped so that memory access is performed after time 10. This execution control can be realized by utilizing the same configuration as in the fourth embodiment (FIG. 9). FIG. 19 shows a circuit configuration of the eighth embodiment. The difference from the fourth embodiment (FIG. 9) is that the input of the hazard detection unit HDU is control information relating to a bit processing instruction. As described above, the control signal indicating that the bit processing instruction requires a large number of memory accesses and must stop the execution of the subsequent instruction is transmitted to the pipeline register ID /
A control signal for transferring the data to EX, EX / MEM, and MEM / WB, and issuing a similar control signal from a circuit block BPU that executes a bit processing instruction as necessary, thereby stopping the update of the program counter PC. Signal PC_H
Control signal ID_HZ for stopping ZD and instruction decoding
D is issued to halt the execution of the instruction following the bit processing instruction for a required period (claims 10 and 11).
【0040】ところで、プログラマブルコントローラの
命令の中には命令を常に実行するのではなく、複数のフ
ラグから構成される命令実行条件が成立したときにのみ
命令を実行するものがある。実施例9では、ある命令は
以下の条件が成立したときに命令を実行するものとす
る。Incidentally, some instructions of the programmable controller do not always execute the instruction, but execute the instruction only when an instruction execution condition including a plurality of flags is satisfied. In the ninth embodiment, it is assumed that a certain instruction is executed when the following condition is satisfied.
【0041】[0041]
【数1】 ここで、EXEFLGは強制実行フラグ、ERRCNT
RLはエラーフラグであり、これらのフラグは他のフラ
グと共に、図21のフラグレジスタFRの中に存在して
いる。また、BITACCはビット処理命令により更新
されるフラグで、このBITACCは図20(b)ある
いは(c)に示すように、パイプライン動作の第6ステ
ージの終わりか、更にその後のタイミングで更新され
る。実施例9では上記命令実行条件により実行/非実行
が左右される命令の実行制御を行うため、実行条件を構
成するフラグを元に制御信号ID_HZD,EX_HZ
Dを生成し、これらの信号の値により命令を解読した結
果を“0”で上書きし、命令を非実行にする機能を実現
する。また、実行条件を構成するフラグのうち、BIT
ACCは更新されるタイミングが他のものよりも遅いた
め、上記命令実行条件により実行/非実行が左右される
命令の前にBITACCを更新するビット処理命令が存
在するときは、BITACCが更新されるまでEXステ
ージの実行を行わないよう、パイプライン動作を一時停
止させる。これは先に述べた実施例8(図19)と同様
の回路構成で実現する(請求項12,13)。(Equation 1) Here, EXEFLG is a forced execution flag, ERRCNT
RL is an error flag, and these flags are present together with other flags in the flag register FR of FIG. BITACC is a flag updated by a bit processing instruction. This BITACC is updated at the end of the sixth stage of the pipeline operation or at a later timing as shown in FIG. 20 (b) or (c). . In the ninth embodiment, in order to control the execution of the instruction whose execution / non-execution depends on the instruction execution condition, the control signals ID_HZD, EX_HZ are determined based on the flags constituting the execution condition.
D is generated, and the result of decoding the instruction with the values of these signals is overwritten with “0” to realize the function of making the instruction non-executable. Also, among the flags constituting the execution condition, BIT
Since the ACC is updated later than the others, if there is a bit processing instruction that updates BITACC before an instruction whose execution / non-execution depends on the instruction execution condition, BITACC is updated. The pipeline operation is suspended so that the execution of the EX stage is not performed until that time. This is realized by a circuit configuration similar to that of the eighth embodiment (FIG. 19).
【0042】これまで述べたことは専用ハードウェア
(プロセッサ)が命令を実行している場合だけに注目し
ていたが、この専用ハードウェアが停止している状態か
ら起動要求により命令実行を開始したり、命令を実行し
ている最中に停止条件が成立して動作を停止したりする
ための回路構造も必要になる。この起動/停止に関する
制御を行う構成を実施例10のブロック図として図22
に示す。この実施例ではプロセッサの起動は外部から与
えられる起動要求信号により行われ、プロセッサの停止
は停止命令を実行したときか、外部から割り込み要求が
入力されたときに行われるものとする。停止命令を実行
したときは即座に停止し、割り込み要求が入力されたと
きは常に停止せず、命令語の中に停止マークがつけられ
たものが現れるまで命令を実行し、停止マークがついた
命令を実行した後、停止するものとする。また、この停
止命令を実行したときは、停止後のプログラムカウンタ
PCの値は停止命令自身のアドレスであるとし、割り込
み要求で停止するときは停止マークがついた命令の次の
命令のアドレスであるとする。Although the description so far has focused only on the case where the dedicated hardware (processor) is executing the instruction, the instruction execution is started by the start request from the state where the dedicated hardware is stopped. Also, a circuit structure for stopping the operation when the stop condition is satisfied during execution of the instruction is required. FIG. 22 is a block diagram showing a configuration for performing control relating to the start / stop shown in FIG.
Shown in In this embodiment, the processor is activated by an externally supplied activation request signal, and the processor is stopped when a stop instruction is executed or when an external interrupt request is input. When a stop instruction is executed, it stops immediately, does not always stop when an interrupt request is input, executes the instruction until a stop mark appears in the instruction word, and the stop mark is attached After executing the instruction, it shall stop. When the stop instruction is executed, the value of the program counter PC after the stop is assumed to be the address of the stop instruction itself, and when stopping by an interrupt request, the value is the address of the instruction next to the instruction with the stop mark. And
【0043】このような起動/停止の動作は、図22中
にSTMと表記したステートマシンにより実現する。こ
のステートマシンの状態遷移の様子を図23に示す。電
源投入時やリセット時にはステートマシンの状態はID
LEに設定され、起動要求が与えられると、状態はS0
に変化し、命令を実行する。状態がS0の間は専用ハー
ドウェア(プロセッサ)は命令の実行を続けるが、停止
命令を実行したときは状態はS11に変化し、S12,
S13と状態が変化する間に停止に必要な手続きを実行
し、更にIDLEに状態が変化し、プロセッサは停止す
る。また、状態がS0で命令を実行している時に割り込
み要求が入力されると、状態はS21に変化し、引き続
き命令を実行しつつ、停止マークがつけられた命令が実
行されるのを待つ。そして、停止マークがつけられた命
令を実行すると、ステートマシンの状態はS22,S2
3と変化していき、必要な停止動作を行った後、プロセ
ッサは停止する。Such a start / stop operation is realized by a state machine denoted by STM in FIG. FIG. 23 shows the state transition of the state machine. At power-on or reset, the state of the state machine is ID
When set to LE and a start request is given, the state becomes S0
To execute the instruction. While the state is S0, the dedicated hardware (processor) continues to execute the instruction, but when the stop instruction is executed, the state changes to S11, and S12,
The procedure necessary for the stop is executed during the state change from S13, and further the state changes to IDLE, and the processor stops. If an interrupt request is input while the state is S0 and an instruction is being executed, the state changes to S21, and the execution of the instruction with the stop mark is waited while the instruction is continuously executed. When the instruction with the stop mark is executed, the state of the state machine is changed to S22, S2.
After performing the necessary stop operation, the processor stops.
【0044】これらの停止動作のうち、停止命令実行に
よる場合を図24に、割り込み要求により停止する場合
を図25に示す(請求項14,15,16)。各図にお
いて、STATEは上述のステートマシンSTMの状態
を示している。また、PC_HZD,IF_HZD,I
D_HZD,EX_HZDはハザード検出ユニットHD
UがPCステージ、IFステージ、IDステージ、EX
ステージのために出力するハザード信号を示している。
PC_IF_PCはパイプラインレジスタPC/IF上
のPCであることを、IF_ID_IRはパイプライン
レジスタIF/ID上のIRであることを示している。
PCWTRQはプログラムカウンタPCの書き込み要求
信号、PCKEEPは停止後のプログラムカウンタPC
の値を示している。また、図24において、ID_ST
OPはIDステージのデコーダDCによる命令解読の結
果、停止命令であると判定されたことを示す信号であ
る。また、図25において、INTRQは割込要求信号
であり、ID_ENDはIDステージのデコーダDCに
よる命令解読の結果、停止マークがある命令であると判
定されたことを示す信号である。FIG. 24 shows a case in which a stop command is executed among these stop operations, and FIG. 25 shows a case in which a stop is caused by an interrupt request (claims 14, 15, and 16). In each figure, STATE indicates the state of the state machine STM. PC_HZD, IF_HZD, I
D_HZD and EX_HZD are hazard detection units HD
U is PC stage, IF stage, ID stage, EX
3 shows a hazard signal output for a stage.
PC_IF_PC indicates a PC on the pipeline register PC / IF, and IF_ID_IR indicates an IR on the pipeline register IF / ID.
PCWTRQ is a write request signal of the program counter PC, and PCKEEP is a program counter PC after stopping.
Are shown. In FIG. 24, ID_ST
OP is a signal indicating that it is determined that the instruction is a stop instruction as a result of decoding the instruction by the decoder DC in the ID stage. In FIG. 25, INTRQ is an interrupt request signal, and ID_END is a signal indicating that it is determined that the instruction has a stop mark as a result of instruction decoding by the decoder DC in the ID stage.
【0045】ところで、専用ハードウェア(プロセッ
サ)が実行する命令の中には、パイプラインサイクルの
時間内に演算を終了することができず、複数のパイプラ
インサイクルを用いて演算を実行するものがある。例え
ば乗算や除算など、加減算に比べて演算量が多い算術演
算が、そのような命令に相当する。この種の命令を実行
するための実施例11の回路構成を図26に示す。ま
た、その動作タイミングチャートを図27に示す。各図
において、PC/IFはPCステージとIFステージ間
のパイプラインレジスタ、IF/IDはIFステージと
IDステージ間のパイプラインレジスタ、ID/EXは
IDステージとEXステージ間のパイプラインレジス
タ、EX/MEMはEXステージとMEMステージ間の
パイプラインレジスタ、MEM/WBはMEMステージ
とWBステージ間のパイプラインレジスタを意味する。
また、IMEMは命令メモリ、DMEMはデータメモ
リ、REG.FILEはレジスタファイル、SUBAL
UはサブALU、EXALUは乗算や除算など、加減算
に比べて演算量が多い算術演算命令を実行するためのA
LU、EXALU REG.はEXALUの引数S1,
S2を記憶しておくためのレジスタである。また、FS
Mは乗算や除算など、加減算に比べて演算量が多い算術
演算命令を実行するためのステートマシンである。By the way, some instructions executed by the dedicated hardware (processor) cannot complete the operation within the time of the pipeline cycle and execute the operation using a plurality of pipeline cycles. is there. For example, an arithmetic operation such as multiplication or division, which requires a larger amount of operation than addition and subtraction, corresponds to such an instruction. FIG. 26 shows a circuit configuration of the eleventh embodiment for executing this type of instruction. FIG. 27 shows an operation timing chart thereof. In each figure, PC / IF is a pipeline register between the PC stage and the IF stage, IF / ID is a pipeline register between the IF stage and the ID stage, ID / EX is a pipeline register between the ID stage and the EX stage, EX / MEM means a pipeline register between the EX stage and the MEM stage, and MEM / WB means a pipeline register between the MEM stage and the WB stage.
Also, IMEM is an instruction memory, DMEM is a data memory, and REG. FILE is a register file, SUBAL
U is a sub-ALU, and EXALU is an A for executing an arithmetic operation instruction such as multiplication or division, which requires a larger amount of operation than addition and subtraction.
LU, EXALU REG. Is the EXALU argument S1,
This is a register for storing S2. Also, FS
M is a state machine for executing an arithmetic operation instruction such as multiplication or division, which requires a larger amount of operation than addition and subtraction.
【0046】図26の専用ハードウェア(プロセッサ)
において、IFステージで読み出した命令をIDステー
ジのデコーダDCがデコードした際、その命令がパイプ
ライン1段の時間内で演算を実行できない種類の命令で
あると判断すると、デコーダDCはステートマシンFS
M、ハザード検出ユニットHDU、およびパイプライン
レジスタID/EXのMULT_RQ部(乗算要求の制
御情報)に対し、MULT_RQ_ID信号(1クロッ
クの間“1”)を出力する。MULT_RQ_ID信号
を受けたステートマシンFSMは直後のクロックから動
作を始め、M2ステージからM7ステージの間、ハザー
ド検出ユニットHDUに対し、乗算命令等であることを
示すMULT信号(“1”)を出力する。なお、ステー
トマシンFSMはMULT_RQ_ID=“1”でM1
ステージに遷移し、命令実行完了を示すDONE=
“1”でM5ステージに遷移する。一方、パイプライン
レジスタID/EXのMULT_RQ部はハザード検出
ユニットHDUとEXALUレジスタに対し、MULT
_RQ_EX信号を出力する。EXALUレジスタはM
ULT_RQ_EX=“1”の時のみデータ(引数S
1,S2)を更新するレジスタである。すなわち、ステ
ートマシンFSMが動作し、EXALUにおいて演算が
行われている間、演算に必要な引数はEXALUレジス
タに保持される。The dedicated hardware (processor) shown in FIG.
In the above, when the instruction read out in the IF stage is decoded by the decoder DC in the ID stage and it is determined that the instruction is of a type that cannot execute the operation within the time of one stage of the pipeline, the decoder DC sets the state machine FS
The MULT_RQ_ID signal ("1" for one clock) is output to M, the hazard detection unit HDU, and the MULT_RQ section (control information of the multiplication request) of the pipeline register ID / EX. The state machine FSM that has received the MULT_RQ_ID signal starts operating from the immediately following clock, and outputs a MULT signal (“1”) indicating a multiplication instruction or the like to the hazard detection unit HDU during the M2 stage to the M7 stage. . It should be noted that the state machine FSM uses MULT_RQ_ID = "1" and M1
Moves to the stage, and indicates DONE = instruction execution completion
The state transits to the M5 stage with “1”. On the other hand, the MULT_RQ part of the pipeline register ID / EX provides the hazard detection unit HDU and the EXALU register with the MULT_RQ.
_RQ_EX signal. EXALU register is M
Data only when ULT_RQ_EX = "1" (argument S
1, S2). That is, while the state machine FSM operates and the operation is performed in the EXALU, arguments required for the operation are held in the EXALU register.
【0047】この時点でハザード検出ユニットHDUは
IDステージからのMULT_RQ_ID信号、ステー
トマシンFSMからのMULT信号、EXステージから
のMULT_RQ_EX信号を受け取ることになる。ハ
ザード検出ユニットHDUはこれらの信号を用い、以下
の関係によりハザード信号HZD_PC,HZD_ID
を生成する。At this point, the hazard detection unit HDU receives the MULT_RQ_ID signal from the ID stage, the MULT signal from the state machine FSM, and the MULT_RQ_EX signal from the EX stage. The hazard detection unit HDU uses these signals, and according to the following relationship, the hazard signals HZD_PC, HZD_ID
Generate
【0048】HZD_PC=(MULT_RQ_ID)
or(MULT)or(MULT_RQ_EX) HZD_ID=(MULT)or(MULT_RQ_E
X)HZD_PC = (MULT_RQ_ID)
or (MULT) or (MULT_RQ_EX) HZD_ID = (MULT) or (MULT_RQ_E)
X)
【0049】HZD_PC信号はハザード検出ユニット
HDUからPCステージに出力される。PCステージで
はHZD_PC=“1”の間、HZD_PCの立ち上が
り時のプログラムカウンタPCの値を継続して出力す
る。これによりパイプライン1段の時間内で演算を実行
できない命令直後のプログラムカウンタPCが必要なサ
イクルだけ引き延ばされる。しかし、このままではパイ
プライン1段の時間内で演算を実行できない命令直後の
命令については演算が実行されてしまう。そこで、ハザ
ード検出ユニットHDUはHZD_ID信号をIDステ
ージのマルチプレクサMUXに対して出力する。HZD
_ID信号を受けたマルチプレクサMUXは、パイプラ
インレジスタID/EXに対して“0”を出力する。E
Xステージにおいて、この信号を受けたALU,SUB
ALUはそれ以後の演算を非実行(EX=“0”)とす
る。また、引数S1,S2についても先に述べたとお
り、EXALUにおいて演算が行われている間、更新さ
れることはなく、後続命令は前の命令の演算が終了する
まで、IDステージで待機することになる。The HZD_PC signal is output from the hazard detection unit HDU to the PC stage. In the PC stage, the value of the program counter PC at the time of the rise of HZD_PC is continuously output while HZD_PC = “1”. As a result, the program counter PC immediately after the instruction that cannot execute the operation within the time of one stage of the pipeline is extended by a necessary cycle. However, in this state, the operation is executed for the instruction immediately after the instruction that cannot execute the operation within the time of one stage of the pipeline. Therefore, the hazard detection unit HDU outputs the HZD_ID signal to the multiplexer MUX of the ID stage. HZD
The multiplexer MUX receiving the _ID signal outputs “0” to the pipeline register ID / EX. E
ALU, SUB receiving this signal at X stage
The ALU does not execute the subsequent operation (EX = "0"). As described above, the arguments S1 and S2 are not updated while the operation is performed in the EXALU, and the subsequent instruction waits in the ID stage until the operation of the previous instruction is completed. become.
【0050】図26の専用ハードウェア(プロセッサ)
において、先行命令(通常命令)、パイプライン1段の
時間内で演算を実行できない命令1、後続命令1(パイ
プライン1段の時間内で演算を実行できない命令)、後
続命令2を処理しようとする場合の動作タイミング図を
図27に示す(請求項17)。Dedicated hardware (processor) shown in FIG.
To process a preceding instruction (normal instruction), an instruction 1 that cannot execute an operation within one pipeline stage, a subsequent instruction 1 (an instruction that cannot execute an operation within one pipeline stage), and a subsequent instruction 2. FIG. 27 shows an operation timing chart in the case where the operation is performed.
【0051】また、先にも述べたが、プログラマブルコ
ントローラの命令の中には、常に実行されるのではな
く、命令実行条件が成立したときにのみ実行される命令
が存在する。実施例11で述べた複数のパイプラインサ
イクルを用いて演算を実行する命令が命令実行条件に実
行/非実行を左右される命令である場合の実施例12を
図28に示す。また、その動作タイミングチャートを図
29に示す。各図において、PC/IFはPCステージ
とIFステージ間のパイプラインレジスタ、IF/ID
はIFステージとIDステージ間のパイプラインレジス
タ、ID/EXはIDステージとEXステージ間のパイ
プラインレジスタ、EX/MEMはEXステージとME
Mステージ間のパイプラインレジスタ、MEM/WBは
MEMステージとWBステージ間のパイプラインレジス
タである。また、IMEMは命令メモリ、DMEMはデ
ータメモリ、REG.FILEはレジスタファイル、F
LAGREGはフラグレジスタ、SUBALUはサブA
LU、EXALUは乗算や除算など、加減算に比べて演
算量が多い算術演算命令を実行するためのALU、EX
ALU REG.はEXALUの引数S1,S2を記憶
しておくためのレジスタである。また、FSMは乗算や
除算など、加減算に比べて演算量が多い算術演算命令を
実行するためのステートマシンである。As described above, among the instructions of the programmable controller, there are instructions that are not always executed but are executed only when an instruction execution condition is satisfied. FIG. 28 shows a twelfth embodiment in which the instruction for executing an operation using a plurality of pipeline cycles described in the eleventh embodiment is an instruction whose execution / non-execution depends on the instruction execution condition. FIG. 29 shows an operation timing chart thereof. In each figure, PC / IF is a pipeline register between the PC stage and the IF stage, and IF / ID.
Is a pipeline register between the IF stage and the ID stage, ID / EX is a pipeline register between the ID stage and the EX stage, and EX / MEM is an EX stage and the ME stage.
A pipeline register between M stages, MEM / WB, is a pipeline register between MEM stage and WB stage. Also, IMEM is an instruction memory, DMEM is a data memory, and REG. FILE is a register file, F
LAGREG is a flag register, SUBALU is sub-A
LU and EXALU are ALUs and EXs for executing arithmetic operation instructions, such as multiplication and division, which require more operation than addition and subtraction.
ALU REG. Is a register for storing arguments S1 and S2 of EXALU. The FSM is a state machine for executing an arithmetic operation instruction such as multiplication or division, which requires a larger amount of operation than addition and subtraction.
【0052】図28の専用ハードウェア(プロセッサ)
において、フラグレジスタFLAGREGで非実行条件
が成立している場合、IDステージのデコーダDCから
の出力信号MULT_RQ_ID1はFLAGREG=
“0”とのアンド信号MULT_RQ_ID2=“0”
として各部に伝達される。これにより、ステートマシン
FSMはデコードした命令に関わらずIDLE状態を継
続する。また、パイプライン1段の時間内で演算を実行
できない命令を処理する際に生成される一連の信号も生
成されない。したがって、フラグレジスタFLAGRE
Gで非実行条件が成立している場合、図29に示すよう
にパイプライン1段の時間内で演算を実行できない命令
(図ではMULT命令)は実行されず、通常の命令のご
とくパイプライン上を流れていくことになる(請求項1
8)。図29は、図28の専用ハードウェア(プロセッ
サ)において、先行命令(通常命令)、パイプライン1
段の時間内で演算を実行できない命令(MULT命
令)、後続命令1、後続命令2を処理しようとする場合
の動作タイミング図である。The dedicated hardware (processor) shown in FIG.
In the case where the non-execution condition is satisfied in the flag register FLAGREG, the output signal MULT_RQ_ID1 from the decoder DC in the ID stage becomes FLAGREG =
AND signal MULT_RQ_ID2 with “0” = “0”
Is transmitted to each part. As a result, the state machine FSM continues the IDLE state regardless of the decoded instruction. Also, a series of signals generated when processing an instruction that cannot execute an operation within the time of one stage of the pipeline is not generated. Therefore, the flag register FLAGRE
When the non-execution condition is satisfied in G, as shown in FIG. 29, an instruction (MULT instruction in the figure) that cannot execute an operation within the time of one stage of the pipeline is not executed, and the instruction is not executed on the pipeline like a normal instruction. (Claim 1
8). FIG. 29 is a diagram showing a case where the dedicated hardware (processor) of FIG.
FIG. 9 is an operation timing diagram when processing an instruction (MULT instruction), a subsequent instruction 1, and a subsequent instruction 2 that cannot execute an operation within the time of a stage;
【0053】[0053]
【発明の効果】請求項1,2の構成により、パイプライ
ンサイクル1つの処理に要する時間を短くし、命令実行
時間を短くすることができる。請求項3の構成により、
パイプラインサイクルよりも短い時間で演算が完了しな
ければならない回路が必要となり、この回路部分の制約
によりパイプライン構造全体の高速化が妨げられるとい
う事態を防ぐことができ、命令実行時間を短くすること
ができる。請求項4の構成により、汎用レジスタ読み出
し時のハザードを解決するためのNOP命令の挿入が不
要になり、プログラムサイズを小さくすることができ
る。また、NOP命令を挿入する場合に比べて、命令実
行時間を短くすることができる。According to the configurations of claims 1 and 2, the time required for processing one pipeline cycle can be shortened, and the instruction execution time can be shortened. According to the configuration of claim 3,
A circuit that requires an operation to be completed in a shorter time than a pipeline cycle is required, and it is possible to prevent a situation in which the speed of the entire pipeline structure is hindered by the restriction of this circuit portion, and shorten the instruction execution time. be able to. According to the configuration of the fourth aspect, it becomes unnecessary to insert a NOP instruction for solving a hazard at the time of reading a general-purpose register, and the program size can be reduced. Further, the instruction execution time can be reduced as compared with the case where the NOP instruction is inserted.
【0054】請求項5の構成により、LOAD命令とそ
の後続命令がLOAD命令で更新される汎用レジスタを
参照する場合のハザードを解決するためのNOP命令の
挿入が不要になり、プログラムサイズを小さくすること
ができる。請求項6の構成により、LOAD命令とその
LOAD命令で更新される汎用レジスタを参照する後続
命令がSTORE命令である場合、STORE命令を停
止させることが不要になり、命令実行時間を短くするこ
とができる。請求項7の構成により、分岐条件が成立し
た場合に不正な命令が実行されることを防ぐためのNO
P命令の挿入が不要になり、プログラムサイズを小さく
することができる。According to the fifth aspect of the present invention, there is no need to insert a NOP instruction for solving a hazard when the LOAD instruction and the following instruction refer to a general-purpose register updated by the LOAD instruction, thereby reducing the program size. be able to. According to the configuration of claim 6, when the LOAD instruction and the subsequent instruction referring to the general-purpose register updated by the LOAD instruction are STORE instructions, it is not necessary to stop the STORE instruction, and the instruction execution time can be shortened. it can. According to the configuration of claim 7, NO for preventing execution of an illegal instruction when a branch condition is satisfied is established.
This eliminates the need for inserting a P instruction, thereby reducing the program size.
【0055】請求項8,9の構成により、無駄にパイプ
ラインサイクルを浪費することなく、効率よく命令を実
行することが可能になる。請求項10,11の構成によ
り、ビット処理命令がメモリアクセスを行っている際に
NOP命令を挿入することなく、そのビット処理命令の
後続命令を矛盾なく実行することが可能になり、プログ
ラムサイズを小さくすることができる。請求項12,1
3の構成により、複数のフラグの値から構成される命令
実行条件を定めて、特定の命令は命令実行ステージで命
令実行条件が成立している時にのみ命令を実行するとい
う命令の実行/非実行の制御を矛盾なく行うことができ
る。According to the eighth and ninth aspects, it is possible to efficiently execute an instruction without wasting a pipeline cycle. According to the tenth and eleventh aspects, it is possible to execute a subsequent instruction of the bit processing instruction without inconsistency without inserting a NOP instruction when the bit processing instruction performs memory access, and to reduce the program size. Can be smaller. Claim 12, 1
According to the configuration 3, an instruction execution condition composed of a plurality of flag values is determined, and a specific instruction is executed / non-executed such that the instruction is executed only when the instruction execution condition is satisfied in the instruction execution stage. Can be controlled without contradiction.
【0056】請求項14の構成により、様々な停止条件
と停止後の仕様を満足することが可能になる。また、請
求項15の構成により、容易に停止時のプログラムカウ
ンタの仕様を満足することができる。また、請求項16
の構成により、停止動作を開始した後に不正な命令を実
行することを防ぐことができる。請求項17の構成によ
り、パイプラインステージ1段の時間内に演算を完了さ
せることが困難な命令を、容易に実装することが可能に
なる。請求項18の構成により、パイプラインステージ
1段の時間内に演算を完了させることが困難な命令の命
令実行条件が成立しない場合には、無駄にパイプライン
動作を止めることを防止することができる。According to the configuration of claim 14, various stop conditions and specifications after stop can be satisfied. According to the configuration of claim 15, the specifications of the program counter at the time of stop can be easily satisfied. Claim 16
With the configuration described above, it is possible to prevent execution of an illegal instruction after the start of the stop operation. According to the configuration of claim 17, it is possible to easily implement an instruction that is difficult to complete the operation within the time of one pipeline stage. According to the configuration of the eighteenth aspect, it is possible to prevent unnecessary stoppage of the pipeline operation when an instruction execution condition of an instruction that is difficult to complete the operation within one pipeline stage is not satisfied. .
【図1】本発明の6段パイプライン構成のプログラマブ
ルコントローラの実施例1の概略構成を示すブロック図
である。FIG. 1 is a block diagram illustrating a schematic configuration of a programmable controller having a six-stage pipeline configuration according to a first embodiment of the present invention.
【図2】本発明の実施例1の動作タイミング図である。FIG. 2 is an operation timing chart according to the first embodiment of the present invention.
【図3】従来例の複数のクロックを用いる場合の動作タ
イミング図である。FIG. 3 is an operation timing chart when a plurality of clocks of a conventional example are used.
【図4】本発明の実施例2の動作タイミング図である。FIG. 4 is an operation timing chart according to the second embodiment of the present invention.
【図5】本発明の実施例2の全体回路構成を示すブロッ
ク図である。FIG. 5 is a block diagram illustrating an overall circuit configuration according to a second embodiment of the present invention.
【図6】本発明の実施例3の要部回路構成を示すブロッ
ク図である。FIG. 6 is a block diagram illustrating a main circuit configuration according to a third embodiment of the present invention.
【図7】本発明の実施例3の動作タイミング図である。FIG. 7 is an operation timing chart according to a third embodiment of the present invention.
【図8】本発明の実施例4で解決しようとする課題を説
明するための動作タイミング図である。FIG. 8 is an operation timing chart for explaining a problem to be solved in a fourth embodiment of the present invention.
【図9】本発明の実施例4の全体回路構成を示すブロッ
ク図である。FIG. 9 is a block diagram illustrating an overall circuit configuration according to a fourth embodiment of the present invention.
【図10】本発明の実施例4の動作タイミング図であ
る。FIG. 10 is an operation timing chart according to the fourth embodiment of the present invention.
【図11】本発明の実施例5の動作タイミング図であ
る。FIG. 11 is an operation timing chart according to the fifth embodiment of the present invention.
【図12】本発明の実施例5の要部回路構成を示すブロ
ック図である。FIG. 12 is a block diagram illustrating a main circuit configuration according to a fifth embodiment of the present invention.
【図13】本発明の実施例6の動作タイミング図であ
る。FIG. 13 is an operation timing chart according to the sixth embodiment of the present invention.
【図14】本発明の実施例6の全体回路構成を示すブロ
ック図である。FIG. 14 is a block diagram illustrating an overall circuit configuration according to a sixth embodiment of the present invention.
【図15】本発明の実施例7の第1の動作タイミング図
である。FIG. 15 is a first operation timing chart according to the seventh embodiment of the present invention.
【図16】本発明の実施例7の第2の動作タイミング図
である。FIG. 16 is a second operation timing chart according to the seventh embodiment of the present invention.
【図17】本発明の実施例7の要部回路構成を示すブロ
ック図である。FIG. 17 is a block diagram illustrating a main circuit configuration according to a seventh embodiment of the present invention.
【図18】本発明の実施例8の動作タイミング図であ
る。FIG. 18 is an operation timing chart according to the eighth embodiment of the present invention.
【図19】本発明の実施例8の要部回路構成を示すブロ
ック図である。FIG. 19 is a block diagram illustrating a main circuit configuration according to an eighth embodiment of the present invention.
【図20】本発明の実施例9の動作タイミング図であ
る。FIG. 20 is an operation timing chart according to the ninth embodiment of the present invention.
【図21】本発明の実施例9の要部回路構成を示すブロ
ック図である。FIG. 21 is a block diagram illustrating a main circuit configuration according to a ninth embodiment of the present invention.
【図22】本発明の実施例10の全体回路構成を示すブ
ロック図である。FIG. 22 is a block diagram illustrating an overall circuit configuration according to a tenth embodiment of the present invention.
【図23】本発明の実施例10の状態遷移図である。FIG. 23 is a state transition diagram of the tenth embodiment of the present invention.
【図24】本発明の実施例10の停止命令実行時の動作
タイミング図である。FIG. 24 is an operation timing chart when a stop instruction is executed according to the tenth embodiment of the present invention.
【図25】本発明の実施例10の割り込み要求により停
止する場合の動作タイミング図である。FIG. 25 is an operation timing chart when the operation is stopped by an interrupt request according to the tenth embodiment of the present invention.
【図26】本発明の実施例11の全体回路構成を示すブ
ロック図である。FIG. 26 is a block diagram illustrating an overall circuit configuration according to an eleventh embodiment of the present invention.
【図27】本発明の実施例11の動作タイミング図であ
る。FIG. 27 is an operation timing chart of the eleventh embodiment of the present invention.
【図28】本発明の実施例12の全体回路構成を示すブ
ロック図である。FIG. 28 is a block diagram illustrating an overall circuit configuration according to a twelfth embodiment of the present invention.
【図29】本発明の実施例12の動作タイミング図であ
る。FIG. 29 is an operation timing chart of the twelfth embodiment of the present invention.
【図30】従来の5段パイプライン構成のプログラマブ
ルコントローラの概略構成を示すブロック図である。FIG. 30 is a block diagram showing a schematic configuration of a conventional programmable controller having a five-stage pipeline configuration.
【図31】従来例の動作タイミング図である。FIG. 31 is an operation timing chart of the conventional example.
IMEM 命令メモリ DMEM データメモリ PC プログラムカウンタ ALU 算術論理演算ユニット DC 命令デコーダ RF レジスタファイル BPU ビット処理命令実行回路ブロック BITACC ビットアキュムレータ BPUADR ビット処理命令専用アドレス計算ブロッ
クIMEM instruction memory DMEM data memory PC program counter ALU arithmetic logic unit DC instruction decoder RF register file BPU bit processing instruction execution circuit block BITACC bit accumulator BPUADR Address calculation block dedicated to bit processing instruction
───────────────────────────────────────────────────── フロントページの続き Fターム(参考) 5B013 AA00 BB18 DD00 5B033 AA03 AA13 CA22 CA25 5H220 BB03 CC03 CC05 CX01 EE04 EE07 EE14 FF07 JJ16 JJ34 ──────────────────────────────────────────────────続 き Continued on the front page F term (reference) 5B013 AA00 BB18 DD00 5B033 AA03 AA13 CA22 CA25 5H220 BB03 CC03 CC05 CX01 EE04 EE07 EE14 FF07 JJ16 JJ34
Claims (18)
の応用処理を行うプログラマブルコントローラにおい
て、命令実行ステージを、プログラムカウンタの更新を
行う第1ステージと、命令メモリから命令を取り出す命
令フェッチ処理を行う第2ステージと、命令デコードお
よび汎用レジスタから値を取り出すレジスタフェッチ処
理を行う第3ステージと、算術論理演算またはデータア
ドレス計算または分岐先の実効アドレスを計算する分岐
計算を行う第4ステージと、データメモリへのメモリア
クセス処理または分岐処理を行う第5ステージと、ビッ
ト演算処理または前記汎用レジスタへの書き込み処理を
行う第6ステージとで構成し、この6つのステージをパ
イプライン動作させることを特徴とするプログラマブル
コントローラ。1. A programmable controller that performs basic bit processing operation and multi-bit application processing, performs an instruction execution stage, a first stage that updates a program counter, and an instruction fetch process that fetches an instruction from an instruction memory. A second stage, a third stage for performing instruction decoding and register fetch processing for extracting a value from a general-purpose register, a fourth stage for performing an arithmetic logic operation or data address calculation, or a branch calculation for calculating an effective address of a branch destination, A fifth stage for performing a memory access process or a branch process for a memory, and a sixth stage for performing a bit operation process or a write process to the general-purpose register, wherein the six stages are operated in a pipeline. Programmable controller.
ジに対応したハードウェアとして、プログラムカウンタ
を備えたPC部と、命令メモリを備えたIF部と、命令
デコーダと汎用レジスタを備えたID部と、算術論理演
算ユニットALUを備えたEX部と、データメモリとそ
のデータメモリへのアクセス制御を行うメモリアクセス
インターフェースとを備えたMEM部と、ビット処理演
算を行うビットプロセッシングユニットBPUを備えた
WB部とを備え、パイプライン処理の制御のため、複数
のパイプラインレジスタを前記命令実行ステージに対応
したハードウェア間に備え、そのパイプラインレジスタ
に前記命令実行ステージの実行結果や命令実行仕様情報
を保存することを特徴とするプログラマブルコントロー
ラ。2. A hardware corresponding to each instruction execution stage of the pipeline processing includes a PC having a program counter, an IF having an instruction memory, an ID having an instruction decoder and a general-purpose register, and An EX unit having an arithmetic and logic unit ALU, a MEM unit having a data memory and a memory access interface for controlling access to the data memory, and a WB unit having a bit processing unit BPU for performing bit processing operation; In order to control the pipeline processing, a plurality of pipeline registers are provided between hardware corresponding to the instruction execution stages, and the execution results of the instruction execution stages and instruction execution specification information are stored in the pipeline registers. A programmable controller, characterized in that:
ラにおいて、パイプラインレジスタ、汎用レジスタ、お
よびプログラムカウンタなどのプログラマブルコントロ
ーラ内部の順序回路を駆動するクロック信号として、単
相クロック信号を用いることを特徴とするプログラマブ
ルコントローラ。3. The programmable controller according to claim 2, wherein a single-phase clock signal is used as a clock signal for driving a sequential circuit inside the programmable controller such as a pipeline register, a general-purpose register, and a program counter. controller.
ントローラにおいて、前記第4ステージの算術論理演算
ユニットALUの入力として前記第3ステージの汎用レ
ジスタの出力、前記第5ステージに取り込まれた前記A
LUの出力、前記第6ステージに取り込まれた前記AL
Uの出力のいずれかを選択することができる選択手段を
備えたことを特徴とするプログラマブルコントローラ。4. The programmable controller according to claim 2, wherein an output of said general-purpose register of said third stage as an input of said arithmetic and logic unit ALU of said fourth stage, and said A taken into said fifth stage.
LU output, the AL captured in the sixth stage
A programmable controller comprising selection means for selecting one of the outputs of U.
マブルコントローラにおいて、LOAD命令で取り込む
データがそのLOAD命令の後続命令で必要になる場
合、前記汎用レジスタにLOAD命令で取り込んだ値が
書き込まれるまでは、前記LOAD命令の後ろのLOA
D命令で更新する汎用レジスタの値を参照する命令の実
行を停止させる機能を有することを特徴とするプログラ
マブルコントローラ。5. The programmable controller according to claim 1, wherein when data taken in by a LOAD instruction is required in an instruction subsequent to the LOAD instruction, the data fetched by the LOAD instruction is written in the general-purpose register. , LOA after the LOAD instruction
A programmable controller having a function of stopping execution of an instruction that refers to a value of a general-purpose register updated by a D instruction.
命令であり、そのSTORE命令が必要とする前記汎用
レジスタがLOAD命令で更新される場合、LOAD命
令の前記第6ステージで汎用レジスタに格納されるデー
タを、STORE命令の前記第5ステージまたは第4ス
テージに取り込んでデータメモリに書き込むことで、S
TORE命令の実行を停止させない機能を有することを
特徴とする請求項5記載のプログラマブルコントロー
ラ。6. An instruction subsequent to the LOAD instruction is STORE.
If the general-purpose register required by the STORE instruction is updated by a LOAD instruction, the data stored in the general-purpose register in the sixth stage of the LOAD instruction is replaced by the fifth or fourth stage of the STORE instruction. By taking in the stage and writing to the data memory, S
6. The programmable controller according to claim 5, having a function of not stopping execution of the TORE instruction.
マブルコントローラにおいて、分岐命令実行時に分岐条
件が成立した場合に、すでにパイプライン内に投入され
ている無効な命令の実行を抑止する機能を有することを
特徴とするプログラマブルコントローラ。7. The programmable controller according to claim 1, further comprising a function of suppressing execution of an invalid instruction already entered in a pipeline when a branch condition is satisfied during execution of a branch instruction. A programmable controller.
マブルコントローラにおいて、LOAD命令やSTOR
E命令等のメモリアクセス命令実行時にアドレス計算を
行う算術論理演算ブロックALUとは別に、ビット処理
命令を実行するためにビット処理命令専用のアドレス計
算ブロックを有し、かつ、前記アドレス計算ブロックに
複数のパイプラインサイクルにわたってデータメモリの
アドレスを計算させ、メモリアクセス要求を発行させる
ことにより、連続する複数のパイプラインステージでメ
モリアクセスを行う機能を有することを特徴とするプロ
グラマブルコントローラ。8. The programmable controller according to claim 1, wherein the LOAD instruction or the STOR
In addition to an arithmetic and logic operation block ALU for performing an address calculation when a memory access instruction such as an E instruction is executed, an address calculation block dedicated to a bit processing instruction for executing a bit processing instruction is provided. A programmable controller having a function of performing a memory access in a plurality of continuous pipeline stages by causing an address of a data memory to be calculated over a pipeline cycle and issuing a memory access request.
ブロックを備え、この回路ブロックからメモリアドレス
とメモリ読み出し要求、またはメモリアドレスとメモリ
の書き込みデータとメモリの書き込み要求を発行し、こ
れによりデータメモリへの読み書きを実行する機能を有
することを特徴とする請求項8記載のプログラマブルコ
ントローラ。9. A dedicated circuit block for executing a bit processing instruction, and issues a memory address and a memory read request or a memory address and a memory write data and a memory write request from the circuit block. 9. The programmable controller according to claim 8, wherein the programmable controller has a function of executing reading / writing from / to the memory.
がビット処理命令であることを示す制御信号を設け、こ
れによりビット処理命令の後続命令の実行を停止させる
必要がある場合には、プログラムカウンタのインクリメ
ントを停止させ、必要に応じて命令をデコードした結果
である命令実行仕様情報も書き換えることにより、ビッ
ト処理命令の後続命令の実行を停止させる機能を有する
ことを特徴とする請求項8記載のプログラマブルコント
ローラ。10. A program signal is provided on a pipeline register to indicate that the instruction is a bit processing instruction, and when it is necessary to stop execution of an instruction following the bit processing instruction, the program counter is incremented. 9. The programmable controller according to claim 8, further comprising a function of stopping the execution of an instruction subsequent to the bit processing instruction by stopping the execution of the instruction and, if necessary, rewriting the instruction execution specification information as a result of decoding the instruction. .
路ブロックを備え、この回路ブロックから制御信号を発
行し、これによりビット処理命令の後続命令の実行を停
止させる必要がある場合には、プログラムカウンタのイ
ンクリメントを停止させ、必要に応じて命令をデコード
した結果である命令実行仕様情報も書き換えることによ
り、ビット処理命令の後続命令の実行を停止させる機能
を有することを特徴とする請求項8記載のプログラマブ
ルコントローラ。11. A program counter which is provided with a dedicated circuit block for executing a bit processing instruction and which issues a control signal from the circuit block to stop execution of an instruction following the bit processing instruction. 9. The function according to claim 8, further comprising the step of stopping the execution of the instruction following the bit processing instruction by stopping the increment of the bit processing instruction and rewriting the instruction execution specification information as a result of decoding the instruction as necessary. Programmable controller.
ラマブルコントローラにおいて、複数のフラグの値から
構成される命令実行条件を定めて、特定の命令は命令実
行ステージである前記第4ステージで実行条件が成立し
ている場合にのみ命令を実行することを特徴とするプロ
グラマブルコントローラ。12. The programmable controller according to claim 1, wherein an instruction execution condition composed of a plurality of flag values is determined, and a specific instruction is executed in the fourth stage which is an instruction execution stage. A programmable controller characterized by executing an instruction only when it is satisfied.
を行うためのビット処理命令により更新されるフラグが
命令実行条件を構成し、パイプラインレジスタ上に該当
命令が命令実行条件に関するフラグを更新するビット処
理命令であることを示す制御信号を設け、この制御信号
を元に命令実行条件が確定しない間は命令の実行を停止
させることにより、矛盾なく命令の実行/非実行の制御
を行いつつ命令を実行する構造を有することを特徴とす
る請求項12に記載のプログラマブルコントローラ。13. A bit which is updated by a bit processing instruction for performing bit operation processing in the sixth stage and constitutes an instruction execution condition, and the corresponding instruction updates a flag relating to the instruction execution condition on the pipeline register. A control signal indicating a processing instruction is provided, and execution of the instruction is stopped while the instruction execution condition is not determined based on the control signal. 13. The programmable controller according to claim 12, having a structure for executing.
ラマブルコントローラにおいて、様々な停止条件に基づ
く停止動作を仕様上求められた通りに実行するための起
動/停止の制御を行うステートマシンを有することを特
徴とするプログラマブルコントローラ。14. The programmable controller according to claim 1, further comprising a state machine for performing start / stop control for executing a stop operation based on various stop conditions as required by specifications. Features a programmable controller.
タの値をパイプラインレジスタ上に転送し、停止時のプ
ログラムカウンタの値を計算するために前記起動/停止
の制御を行うステートマシンがパイプライン上に転送さ
れたプログラムカウンタの値を読み込み、その値を元に
停止の仕様に合わせて停止時のプログラムカウンタの値
を計算し、計算した値を停止前にプログラムカウンタに
書き込むことを特徴とした請求項14に記載のプログラ
マブルコントローラ。15. A state machine for controlling start / stop for transferring the value of a program counter at the time of instruction fetch to a pipeline register and calculating the value of the program counter at the time of stop is transferred to the pipeline. 15. The program counter according to claim 14, wherein the value of the program counter is read, the value of the program counter at the time of stop is calculated based on the value according to the stop specification, and the calculated value is written to the program counter before the stop. 4. The programmable controller according to 1.
したときに、すでにパイプラインに投入されている命令
の実行を無効化し、不正な命令の実行を防ぐ機能を有す
ることを特徴とする請求項14に記載のプログラマブル
コントローラ。16. A function having a function of invalidating the execution of an instruction already input to a pipeline and preventing execution of an illegal instruction when a stop condition is satisfied and a stop operation is started. Item 15. The programmable controller according to item 14.
ラマブルコントローラにおいて、パイプラインステージ
1段の時間内に演算を終了することができない命令を実
行する際に、前記命令を実行する演算ブロックから演算
終了信号が到着するまでの間、または命令により予め設
定される前記命令の演算終了に必要な時間だけプログラ
ムカウンタのインクリメントを停止させ、レジスタ書き
戻し、データメモリ書き込み等の制御信号を無効にする
ことでパイプライン動作を停止させ、前記命令を実行す
るように構成されていることを特徴とするプログラマブ
ルコントローラ。17. The programmable controller according to claim 1, wherein when executing an instruction whose operation cannot be completed within one pipeline stage, the operation is terminated from an operation block executing the instruction. By stopping the increment of the program counter until the signal arrives or for the time required for the completion of the operation of the instruction set in advance by the instruction, and disabling control signals such as register write back and data memory write, A programmable controller configured to stop a pipeline operation and execute the instruction.
ラマブルコントローラにおいて、パイプラインステージ
1段の時間内に演算を終了することができない命令を実
行するか非実行にするかを決めるフラグが設けられてお
り、このフラグの値が非実行の場合には前記命令の実行
を開始させず、パイプラインの動作を停止させないよう
に構成されていることを特徴とするプログラマブルコン
トローラ。18. The programmable controller according to claim 1, further comprising a flag for determining whether to execute or not to execute an instruction whose operation cannot be completed within one pipeline stage. The programmable controller is configured such that when the value of the flag is non-execution, the execution of the instruction is not started and the operation of the pipeline is not stopped.
Priority Applications (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP11180582A JP2001014161A (en) | 1999-06-25 | 1999-06-25 | Programmable controller |
Applications Claiming Priority (1)
| Application Number | Priority Date | Filing Date | Title |
|---|---|---|---|
| JP11180582A JP2001014161A (en) | 1999-06-25 | 1999-06-25 | Programmable controller |
Publications (1)
| Publication Number | Publication Date |
|---|---|
| JP2001014161A true JP2001014161A (en) | 2001-01-19 |
Family
ID=16085794
Family Applications (1)
| Application Number | Title | Priority Date | Filing Date |
|---|---|---|---|
| JP11180582A Pending JP2001014161A (en) | 1999-06-25 | 1999-06-25 | Programmable controller |
Country Status (1)
| Country | Link |
|---|---|
| JP (1) | JP2001014161A (en) |
Cited By (5)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108287730A (en) * | 2018-03-14 | 2018-07-17 | 武汉市聚芯微电子有限责任公司 | A kind of processor pipeline structure |
| CN111860808A (en) * | 2019-04-27 | 2020-10-30 | 中科寒武纪科技股份有限公司 | Fractal computing device, method, integrated circuit and board |
| CN116187455A (en) * | 2022-12-16 | 2023-05-30 | 中国人民解放军战略支援部队信息工程大学 | Classical and quantum mixed instruction pipeline design method and device |
| US11841822B2 (en) | 2019-04-27 | 2023-12-12 | Cambricon Technologies Corporation Limited | Fractal calculating device and method, integrated circuit and board card |
| WO2023240842A1 (en) * | 2022-06-15 | 2023-12-21 | 奥比中光科技集团股份有限公司 | Method and apparatus for solving pipelining computation conflicts |
-
1999
- 1999-06-25 JP JP11180582A patent/JP2001014161A/en active Pending
Cited By (9)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| CN108287730A (en) * | 2018-03-14 | 2018-07-17 | 武汉市聚芯微电子有限责任公司 | A kind of processor pipeline structure |
| CN108287730B (en) * | 2018-03-14 | 2023-12-29 | 武汉市聚芯微电子有限责任公司 | Processor pipeline device |
| CN111860808A (en) * | 2019-04-27 | 2020-10-30 | 中科寒武纪科技股份有限公司 | Fractal computing device, method, integrated circuit and board |
| US11841822B2 (en) | 2019-04-27 | 2023-12-12 | Cambricon Technologies Corporation Limited | Fractal calculating device and method, integrated circuit and board card |
| US12026606B2 (en) | 2019-04-27 | 2024-07-02 | Cambricon Technologies Corporation Limited | Fractal calculating device and method, integrated circuit and board card |
| US12093811B2 (en) | 2019-04-27 | 2024-09-17 | Cambricon Technologies Corporation Limited | Fractal calculating device and method, integrated circuit and board card |
| WO2023240842A1 (en) * | 2022-06-15 | 2023-12-21 | 奥比中光科技集团股份有限公司 | Method and apparatus for solving pipelining computation conflicts |
| CN116187455A (en) * | 2022-12-16 | 2023-05-30 | 中国人民解放军战略支援部队信息工程大学 | Classical and quantum mixed instruction pipeline design method and device |
| CN116187455B (en) * | 2022-12-16 | 2024-10-25 | 中国人民解放军战略支援部队信息工程大学 | Classical and quantum mixed instruction pipeline design method and device |
Similar Documents
| Publication | Publication Date | Title |
|---|---|---|
| KR950003552B1 (en) | Programmable controller | |
| TWI541658B (en) | Data processing apparatus and semiconductor integrated circuit device | |
| KR100210205B1 (en) | Apparatus and method for providing a stall cache | |
| KR100260012B1 (en) | Programmable controller | |
| US6006325A (en) | Method and apparatus for instruction and data serialization in a computer processor | |
| JP3790626B2 (en) | Method and apparatus for fetching and issuing dual word or multiple instructions | |
| US6012138A (en) | Dynamically variable length CPU pipeline for efficiently executing two instruction sets | |
| JP2008077294A (en) | Microprocessor and microcomputer using it | |
| US7539847B2 (en) | Stalling processor pipeline for synchronization with coprocessor reconfigured to accommodate higher frequency operation resulting in additional number of pipeline stages | |
| KR102379886B1 (en) | Vector instruction processing | |
| US6993674B2 (en) | System LSI architecture and method for controlling the clock of a data processing system through the use of instructions | |
| JP2001014161A (en) | Programmable controller | |
| US8074061B2 (en) | Executing micro-code instruction with delay field and address of next instruction which is decoded after indicated delay | |
| JP4800582B2 (en) | Arithmetic processing unit | |
| JP3146058B2 (en) | Parallel processing type processor system and control method of parallel processing type processor system | |
| US5737562A (en) | CPU pipeline having queuing stage to facilitate branch instructions | |
| JP3182591B2 (en) | Microprocessor | |
| JPH0384632A (en) | data processing equipment | |
| US20100005276A1 (en) | Information processing device and method of controlling instruction fetch | |
| JP2000029696A (en) | Processor and pipeline processing control method | |
| KR20010101498A (en) | Processor and method of executing instructions from several instruction sources | |
| JP3063593B2 (en) | Programmable controller | |
| JP3405106B2 (en) | Programmable controller | |
| JP3206394B2 (en) | Programmable controller with 5-stage pipeline structure | |
| JP3414579B2 (en) | Programmable controller |
Legal Events
| Date | Code | Title | Description |
|---|---|---|---|
| A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20041215 |
|
| A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20050104 |
|
| A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20050517 |