JP2721611B2 - Programmable controller - Google Patents

Programmable controller

Info

Publication number
JP2721611B2
JP2721611B2 JP602392A JP602392A JP2721611B2 JP 2721611 B2 JP2721611 B2 JP 2721611B2 JP 602392 A JP602392 A JP 602392A JP 602392 A JP602392 A JP 602392A JP 2721611 B2 JP2721611 B2 JP 2721611B2
Authority
JP
Japan
Prior art keywords
instruction
address
memory
data
data memory
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.)
Expired - Lifetime
Application number
JP602392A
Other languages
Japanese (ja)
Other versions
JPH05189015A (en
Inventor
明 薮田
稔 黒田
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Panasonic Electric Works Co Ltd
Original Assignee
Matsushita Electric Works Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Works Ltd filed Critical Matsushita Electric Works Ltd
Priority to JP602392A priority Critical patent/JP2721611B2/en
Publication of JPH05189015A publication Critical patent/JPH05189015A/en
Application granted granted Critical
Publication of JP2721611B2 publication Critical patent/JP2721611B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】DETAILED DESCRIPTION OF THE INVENTION

【0001】[0001]

【産業上の利用分野】本発明は、パイプライン処理が可
能なプロセッサを備えるプログラマブルコントローラに
関するものである。
BACKGROUND OF THE INVENTION 1. Field of the Invention The present invention relates to a programmable controller having a processor capable of pipeline processing.

【0002】[0002]

【従来の技術】従来より、プログラマブルコントローラ
の処理速度を向上させることなどを目的として、図3に
示すように、従来から用いられている汎用のメインプロ
セッサ11と並行動作する命令実行専用のコプロセッサ
21を設けることが提案されている。コプロセッサ21
としては、処理の高速化を図るために、縮小命令セット
プロセッサ(RISCプロセッサ)を用いることが考え
られている。この場合、ユーザ等により設計されてソー
スプログラムメモリ12に格納されたシーケンスプログ
ラムのソースコードは、コンパイルされて縮小命令に変
換された後にオブジェクトプログラムメモリ22に格納
され、基本命令や応用命令はオブジェクトプログラムメ
モリ22に格納された縮小命令よりなるオブジェクトコ
ードに基づいてコプロセッサ21で実行される。ソース
コードのコンパイルは、システムメモリ13に格納され
たコンパイラを用いてメインプロセッサ11によって行
われる。また、メインプロセッサ11は、シーケンスプ
ログラムの命令の実行には用いられず、ソースコードの
コンパイルのほか、インタフェース14を通して行われ
る周辺装置の制御や通信の制御に用いられる。メインプ
ロセッサ11とコプロセッサ21との間の通信はバスコ
ントローラ15を介して行われる。ここに、メインプロ
セッサ11のデータバスは16ビットであり、コプロセ
ッサ21のデータバスは、オブジェクトプログラムメモ
リ22との間では32ビット、データメモリ23との間
では16ビットになっている。バスコントローラ15
は、メインプロセッサ11の16ビットのデータバスと
コプロセッサ21の32ビットのデータバスとを結合す
る機能を有している。コプロセッサ21の内部処理は3
2ビットで行われるから、RISCプロセッサであるこ
ととあいまって命令をメインプロセッサ11よりも高速
に実行できるのである。
2. Description of the Related Art Conventionally, as shown in FIG. 3, for the purpose of improving the processing speed of a programmable controller, a coprocessor dedicated to instruction execution which operates in parallel with a conventional general-purpose main processor 11 is used. It has been proposed to provide 21. Coprocessor 21
In order to speed up the processing, it has been considered to use a reduced instruction set processor (RISC processor). In this case, the source code of the sequence program designed by the user or the like and stored in the source program memory 12 is compiled and converted into a reduced instruction, and then stored in the object program memory 22. The processing is executed by the coprocessor 21 based on the object code including the reduction instruction stored in the memory 22. Compilation of the source code is performed by the main processor 11 using a compiler stored in the system memory 13. The main processor 11 is not used for executing the instructions of the sequence program, but is used for compiling the source code and for controlling peripheral devices and communication performed through the interface 14. Communication between the main processor 11 and the coprocessor 21 is performed via the bus controller 15. Here, the data bus of the main processor 11 has 16 bits, and the data bus of the coprocessor 21 has 32 bits with the object program memory 22 and 16 bits with the data memory 23. Bus controller 15
Has a function of connecting the 16-bit data bus of the main processor 11 and the 32-bit data bus of the coprocessor 21. The internal processing of the coprocessor 21 is 3
The instruction is executed in two bits, so that the instruction can be executed faster than the main processor 11 in combination with the RISC processor.

【0003】ソースコードとオブジェクトコードとの関
係は、図4のようになる。たとえば、ソースコードでは
3命令であって、各命令のワード数が2、4、4である
とき、縮小命令を用いたオブジェクトコードのワード数
は、ソースコードの各命令に対して、たとえば、3、
7、5などとなる。オブジェクトコードでは、1ワード
が1命令に対応するのであって、上述した例では、ソー
スコードで2ワードを用いる1命令が、オブジェクトコ
ードでは3命令などとなっている。
[0003] The relationship between the source code and the object code is as shown in FIG. For example, when the source code has three instructions and the number of words in each instruction is 2, 4, and 4, the number of words in the object code using the reduced instruction is, for example, 3 for each instruction in the source code. ,
7, 5, etc. In the object code, one word corresponds to one instruction. In the above example, one instruction using two words in the source code is three instructions in the object code.

【0004】[0004]

【発明が解決しようとする課題】ところで、コプロセッ
サ21の命令セットには入力の立ち上がりや立ち下がり
を検出する微分処理を伴う応用命令としてパルス型応用
命令と称するものが用意されている。また、パルス型応
用命令では、スキャン毎ではなく1スキャンのみ微分処
理を行う形式が普通である。この種のパルス型応用命令
は、ほとんどの応用命令に対して用意され、たとえば、
加算命令であるADDの前に微分処理を行う命令PAD
Dや、ワード単位でデータを転送する命令であるMVの
前に微分処理を行う命令PMVがある。パルス型応用命
令を用いれば、通常は微分命令と応用命令との2命令に
なる処理を1命令で行うことができるから、オブジェク
トプログラムメモリ22のメモリ容量が節約され、ま
た、実行速度が向上する。
By the way, the instruction set of the coprocessor 21 is provided with a so-called pulse-type application instruction as an application instruction accompanied by differential processing for detecting a rising or falling edge of an input. In addition, the pulse-type application instruction usually has a form in which the differential processing is performed only for one scan, not for each scan. This kind of pulse type application instruction is prepared for most application instructions. For example,
Instruction PAD for performing differential processing before ADD which is an addition instruction
D and an instruction PMV for performing a differentiation process before an MV which is an instruction for transferring data in word units. When the pulse-type application instruction is used, processing that normally becomes two instructions of a differentiation instruction and an application instruction can be performed by one instruction, so that the memory capacity of the object program memory 22 is saved and the execution speed is improved. .

【0005】いま、オブジェクトプログラムが図5
(a)のようなものであるとする。ここでは、入力の立
ち上がりを1回だけ検出して加算を行うパルス型応用命
令である命令PADDを用いている。入力X0がオフか
らオンに立ち上がると加算演算が行われ、出力Y30が
オンになるのである。この処理は1スキャンだけ行わ
れ、以後のスキャンでは加算演算は行われない。このよ
うな処理を行うには、前スキャンの入力X0の値を保持
しておくことが必要である。すなわち、命令PADDを
1スキャンのみで実行するためには、入力X0がオフか
らオンに一旦立ち上がると、以後は入力X0がオンに保
たれるようにすることが必要であって、入力X0を次ス
キャン以降ではオンに保つことによって、命令PADD
で立ち上がりが検出されないようにし、加算演算が行わ
れないようにするのである。このように入力X0のオン
・オフの状態を保持するために、図5(b)のように、
オブジェクトプログラムメモリ22と同じアドレスを有
し、各メモリセルが1ビットであるデータメモリ23を
設けることが考えられている。
Now, the object program is shown in FIG.
Assume that it is as shown in FIG. Here, an instruction PADD, which is a pulse-type application instruction that detects the rising of the input only once and performs addition, is used. When the input X0 rises from off to on, an addition operation is performed, and the output Y30 is turned on. This processing is performed only for one scan, and the addition operation is not performed in subsequent scans. To perform such processing, it is necessary to hold the value of the input X0 of the previous scan. That is, in order to execute the instruction PADD in only one scan, it is necessary to keep the input X0 on once after the input X0 rises from off to on. By keeping it on after the scan, the instruction PADD
To prevent the rise from being detected and prevent the addition operation from being performed. In order to maintain the on / off state of the input X0 in this manner, as shown in FIG.
It is considered to provide a data memory 23 having the same address as the object program memory 22 and each memory cell having one bit.

【0006】たとえば、図5(a)のラダー図に対応し
て図5(b)に示すように、オブジェクトプログラムメ
モリ22のアドレス0に入力X0を取込む命令、アドレ
ス1に入力X0とデータメモリ23に保持されている値
との比較により立ち上がりの有無を検出する命令、アド
レス2に出力Y30を出す命令が格納されているものと
する。アドレス0の命令を実行して入力X0がオフから
オンに立ち上がると、アドレス1ではデータメモリ23
のアドレス1に格納されている前スキャンの入力X0
(初期状態では入力X0はオフである)とアドレス0の
実行により得た入力X0とを比較して立ち上がりを検出
し、加算演算を実行する。その後、出力Y30を得るの
である。ここで、入力X0が一旦オンになると、以後は
データメモリ23のアドレス1はオンに保たれるから、
アドレス0で取り込んだ入力X0がオンであってもアド
レス1で加算演算は行われることがないのである。
For example, as shown in FIG. 5B corresponding to the ladder diagram of FIG. 5A, an instruction to take input X0 at address 0 of object program memory 22, and input X0 and data memory at address 1 It is assumed that an instruction for detecting the presence or absence of a rise by comparison with the value held in 23 and an instruction for outputting an output Y30 at address 2 are stored. When the instruction at address 0 is executed and the input X0 rises from off to on, at address 1, the data memory 23
Input X0 of the previous scan stored at address 1 of
(In the initial state, the input X0 is off.) And the input X0 obtained by executing the address 0 is detected to detect a rise, and an addition operation is performed. Thereafter, the output Y30 is obtained. Here, once the input X0 is turned on, since the address 1 of the data memory 23 is kept on thereafter,
Even if the input X0 fetched at the address 0 is on, the addition operation is not performed at the address 1.

【0007】一方、コプロセッサ21では、図6に示す
ように、パイプライン処理を行うことによって実行速度
の向上を図っている。すなわち、コプロセッサ21にお
いて命令を実行する際には、オブジェクトプログラムメ
モリ22から命令を1つずつフェッチする命令フェッチ
サイクルIF、フェッチした命令をデコードするデコー
ドサイクルDEC、デコードした命令を実行する実行サ
イクルEXEの3段階を要するのが普通であり、1つの
命令のデコードの間に次命令のフェッチを行う動作を繰
り返すことによって全体としての命令の実行時間を短縮
することが考えられている。ここに、命令フェッチサイ
クルIF、デコードサイクルDEC、実行サイクルEX
Eはそれぞれ1マシンサイクルであり、1マシンサイク
ルはたとえばクロック信号の3周期分(6フェーズ)に
規定される。
On the other hand, as shown in FIG. 6, the execution speed of the coprocessor 21 is improved by performing pipeline processing. That is, when executing instructions in the coprocessor 21, an instruction fetch cycle IF for fetching instructions one by one from the object program memory 22, a decode cycle DEC for decoding fetched instructions, and an execution cycle EXE for executing decoded instructions Usually, it is necessary to reduce the execution time of the instruction by repeating the operation of fetching the next instruction during the decoding of one instruction. Here, instruction fetch cycle IF, decode cycle DEC, execution cycle EX
E is one machine cycle, and one machine cycle is defined, for example, for three cycles (six phases) of a clock signal.

【0008】コプロセッサ21は、1ビットの命令であ
る基本命令を実行するビット処理部を備え、ビット処理
部は演算処理が施される1ビットのデータを保持するア
キュムレータであるビットアキュムレータを備える。図
5(b)のオブジェクトプログラムにおいてアドレス
(0)で取り込んだ入力X0がオンであったとすると、
ビットアキュムレータに1が格納される。次に、アドレ
ス(1)でパルス型応用命令である命令PADDがフェ
ッチされると、同時にデータメモリ23の同じアドレス
のデータが読み出される。データメモリ23には前スキ
ャンの入力X0が格納されている。たとえば、初期状態
で入力X0がオフ(=「0」)であったとすると、デー
タメモリ23の値は「0」である。命令PADDの実行
サイクルでは、データメモリ23から読み出した値をビ
ットアキュムレータの値と比較する。ここで、データメ
モリ23から読み出した値が「0」、ビットアキュムレ
ータの値が「1」であるとすれば、入力X0が立ち上が
ったことになるから、条件が満たされてパルス型応用命
令が実行され、さらに次命令OT Y30が実行される
のである。ここにおいて、パルス型応用命令を実行した
ときに、データメモリ23のアドレス(1)に「1」を
書き込んでおけば、次スキャン以降は、入力X0の立ち
上がりが検出されないことになり、1スキャンのみの立
ち上がり検出が行えることになる。
The coprocessor 21 includes a bit processing unit that executes a basic instruction that is a 1-bit instruction, and the bit processing unit includes a bit accumulator that is an accumulator that holds 1-bit data on which arithmetic processing is performed. If the input X0 fetched at the address (0) in the object program of FIG.
1 is stored in the bit accumulator. Next, when the instruction PADD, which is a pulse-type application instruction, is fetched at the address (1), data at the same address in the data memory 23 is read at the same time. The data memory 23 stores the input X0 of the previous scan. For example, if input X0 is off (= "0") in the initial state, the value of data memory 23 is "0". In the execution cycle of the instruction PADD, the value read from the data memory 23 is compared with the value of the bit accumulator. Here, if the value read from the data memory 23 is “0” and the value of the bit accumulator is “1”, the input X0 has risen, so that the condition is satisfied and the pulse-type application instruction is executed. Then, the next instruction OTY30 is executed. Here, if "1" is written to the address (1) of the data memory 23 when the pulse type application instruction is executed, the rising edge of the input X0 is not detected after the next scan, and only one scan is performed. Can be detected.

【0009】ところで、コプロセッサ21では、1マシ
ンサイクルごとにアドレスがインクリメントされるので
あって、アドレスが(1)であるときに命令ST X0
がデコードされ、命令PADDがフェッチされる。さら
に、アドレスが(2)になると、命令ST X0の実
行、命令PADDのデコード、命令OT Y30のフェ
ッチが行われる。このようにパイプライン処理を行って
いるから、アドレスが(2)であるマシンサイクルにお
いて命令PADDがパルス型応用命令であることが識別
されるのであって、命令PADDに対応してデータメモ
リ23のアドレス(1)にデータを書き込まなければな
らないにもかかわらず、指定アドレスがすでに(2)に
なっており、アドレス(1)にデータを書き込むことが
できないという問題がある。すなわち、上述したような
メモリ構成でパイプライン処理を行うようにすると、パ
ルス型応用命令の処理ができないという問題が生じる。
In the coprocessor 21, the address is incremented every machine cycle, and when the address is (1), the instruction ST X0
Is decoded, and the instruction PADD is fetched. Further, when the address becomes (2), execution of the instruction ST X0, decoding of the instruction PADD, and fetching of the instruction OT Y30 are performed. Since the pipeline processing is performed in this manner, it is identified that the instruction PADD is a pulse-type application instruction in the machine cycle at the address (2), and the data memory 23 of the data memory 23 is corresponding to the instruction PADD. Although data must be written to address (1), the designated address is already (2), and there is a problem that data cannot be written to address (1). That is, if the pipeline processing is performed with the above-described memory configuration, there is a problem that the pulse-type application instruction cannot be processed.

【0010】この問題を解決するには、オブジェクトプ
ログラムメモリ22とデータメモリ23とのアドレスを
各別に管理することも考えられるが、アドレスの管理が
複雑になってハードウェアが複雑化するという問題があ
る。また、パルス型応用命令についてはメインプロセッ
サ11に実行を移すことも考えられているが、コプロセ
ッサ21による処理速度の向上という効果が半減するこ
とになる。
In order to solve this problem, it is conceivable to separately manage the addresses of the object program memory 22 and the data memory 23. is there. Although it is considered that the execution of the pulse type application instruction is transferred to the main processor 11, the effect of improving the processing speed by the coprocessor 21 is reduced by half.

【0011】本発明は上記問題点の解決を目的とするも
のであり、オブジェクトプログラムメモリとデータメモ
リとのアドレスを共通化してアドレス管理を容易にしな
がらも、パイプライン処理を不都合なく行えるようにし
たプログラマブルコントローラを提供しようとするもの
である。
SUMMARY OF THE INVENTION An object of the present invention is to solve the above-mentioned problem, and to simplify the address management by making the addresses of the object program memory and the data memory common and to perform the pipeline processing without any inconvenience. It is intended to provide a programmable controller.

【0012】[0012]

【課題を解決するための手段】本発明では、上記目的を
達成するために、シーケンスプログラムを格納したプロ
グラムメモリと、プログラムメモリと同じアドレスを有
した各1ビットのメモリセルを有するデータメモリと、
プログラムメモリおよびデータメモリのアドレスを指定
するアドレス発生器と、アドレス発生器により指定され
たアドレスに格納されている命令をプログラムメモリか
らフェッチする命令レジスタと、命令レジスタに格納さ
れた命令をデコードする命令デコーダと、デコードされ
た命令を実行する演算部と、1つの命令のフェッチとデ
コードと実行とを順に行うとともにデコードから実行ま
での間に次命令をフェッチするようにパイプライン制御
を行うコントローラとを備えたプログラマブルコントロ
ーラにおいて、コントローラは、命令デコーダでデコー
ドした命令が微分処理を含む応用命令であるパルス型応
用命令であるときに、アドレス発生器による指定アドレ
スをデクリメントさせるとともに、命令レジスタへの次
命令のフェッチを中断させて微分処理に要するデータを
データメモリに書込み、その後、次命令のフェッチを再
開させるのである。
According to the present invention, to achieve the above object, a program memory storing a sequence program, a data memory having 1-bit memory cells each having the same address as the program memory, and
An address generator that specifies the addresses of the program memory and the data memory; an instruction register that fetches the instruction stored at the address specified by the address generator from the program memory; and an instruction that decodes the instruction stored in the instruction register A decoder, an operation unit for executing the decoded instruction, and a controller for performing fetch, decoding, and execution of one instruction in order and performing pipeline control so as to fetch the next instruction from decoding to execution. When the instruction decoded by the instruction decoder is a pulse-type application instruction which is an application instruction including a differentiation process, the controller decrements the designated address by the address generator and sets the next instruction to the instruction register. Fetch It writes data required for the differential processing to the data memory by cross, then, is the resuming fetch the next instruction.

【0013】[0013]

【作用】上記構成によれば、プログラムメモリとデータ
メモリとがアドレスを共有している構成において、パイ
プライン処理を行う際に、パルス型応用命令であると識
別されると、指定アドレスをデクリメントさせるととも
に、次命令のフェッチを中断させて微分処理に要するデ
ータをデータメモリに書込み、その後、次命令のフェッ
チを再開させるので、微分処理を含む応用命令であるパ
ルス型応用命令の実行の際に、パイプライン処理を一時
的に中断してデータメモリへの所要データの書込みなど
を行うことができ、プログラムメモリとデータメモリと
でアドレスを共用した簡単なハードウェアを用いながら
も、コプロセッサの内部のみで処理を行うことができ、
高速な処理が可能になるのである。
According to the above configuration, in a configuration in which an address is shared between a program memory and a data memory, a specified address is decremented when it is identified as a pulse-type application instruction during pipeline processing. At the same time, the fetch of the next instruction is interrupted, the data required for the differential processing is written to the data memory, and then the fetch of the next instruction is restarted. Pipeline processing can be temporarily interrupted to write required data to data memory, etc., while using simple hardware that shares addresses between program memory and data memory, but only inside the coprocessor. Can be processed by
High-speed processing becomes possible.

【0014】[0014]

【実施例】図1はコプロセッサ21の内部の要部構成を
示す。クロックジェネレータ31は、内部回路の同期を
とるようにクロック信号を発生する。クロック信号に
は、マシンサイクルに同期する通常の同期クロックsclk
のほか、命令をフェッチするタイミングを与えるフェッ
チクロックfclk、オブジェクトプログラムメモリ22お
よびデータメモリ23の読込タイミングを設定するリー
ドクロックrclk、データメモリ23への書込タイミング
を設定するライトクロックwclk、後述するプログラムカ
ウンタ41への書換クロックcclkがある。
FIG. 1 shows the structure of the main part of a coprocessor 21. Clock generator 31 generates a clock signal so as to synchronize internal circuits. The clock signal includes a normal synchronous clock sclk synchronized with the machine cycle.
A fetch clock fclk for giving a timing for fetching an instruction, a read clock rclk for setting a read timing for the object program memory 22 and the data memory 23, a write clock wclk for setting a write timing for the data memory 23, and a program to be described later. There is a rewrite clock cclk to the counter 41.

【0015】命令は、フェッチクロックfclkに同期して
命令レジスタ32に読み込まれる。また、次命令が命令
レジスタ32に読み込まれると同時に、前命令は命令デ
コーダ33に入力されてデコードされる。すなわち、フ
ェッチクロックfclkは、各マシンサイクルごとに1つず
つ発生するのである。命令デコーダ33において微分命
令を含むパルス型応用命令または微分命令であると判定
されると、これらの命令に対応するパルスが発生する。
これらのパルスは、コプロセッサ21の内部動作を制御
するコントローラ34に入力されると同時に、オア回路
35を通してカウンタ36に入力され、カウンタ36を
動作可能にする。カウンタ36は動作可能な状態では、
同期クロックsclkをカウントするから、結果的に、カウ
ンタ36の出力値は微分処理を含むパルス型応用命令お
よび微分命令の合計個数に相当することになる。このカ
ウンタ36の出力はコントローラ34に入力される。
The instruction is read into the instruction register 32 in synchronization with the fetch clock fclk. At the same time that the next instruction is read into the instruction register 32, the previous instruction is input to the instruction decoder 33 and decoded. That is, one fetch clock fclk is generated for each machine cycle. When the instruction decoder 33 determines that the instruction is a pulse-type application instruction including a differential instruction or a differential instruction, a pulse corresponding to these instructions is generated.
These pulses are input to a controller 34 that controls the internal operation of the coprocessor 21 and at the same time, are input to a counter 36 through an OR circuit 35 to enable the counter 36 to operate. When the counter 36 is in an operable state,
Since the synchronous clock sclk is counted, as a result, the output value of the counter 36 corresponds to the total number of pulse-type application instructions including differentiation processing and differentiation instructions. The output of the counter 36 is input to the controller 34.

【0016】コントローラ34は、データメモリ23の
値を取り込むビットメモリレジスタ37の値を読み込む
ことができ、またビットアキュムレータ(図示せず)に
対して信号wb,rb を授受することによって、ビットアキ
ュムレータのデータを読み出したり、ビットアキュムレ
ータにデータを書き込んだりすることができる。さら
に、コントローラ34はコプロセッサ21の内部に設け
たMPU(多ビットデータ処理用のALU)の動作を制
御し、また、クロックジェネレータ31を制御して、フ
ェッチクロックfclkやライトクロックwclkの出力タイミ
ングを制御するための、フェッチイネーブル信号fe、ラ
イトイネーブル信号weを出力する。コントローラ34か
らは、プログラムカウンタ41の出力値をインクリメン
トするかデクリメントするかを選択するための増減信号
indeも出力される。
The controller 34 can read the value of the bit memory register 37 which takes in the value of the data memory 23, and sends and receives signals wb and rb to and from a bit accumulator (not shown). Data can be read and data can be written to the bit accumulator. Further, the controller 34 controls the operation of an MPU (ALU for multi-bit data processing) provided inside the coprocessor 21 and controls the clock generator 31 to adjust the output timing of the fetch clock fclk and the write clock wclk. It outputs a fetch enable signal fe and a write enable signal we for controlling. An increase / decrease signal for selecting whether to increment or decrement the output value of the program counter 41 from the controller 34.
inde is also output.

【0017】プログラムカウンタ41の出力値は、オブ
ジェクトプログラムメモリ22およびデータメモリ23
のアドレスを指定するのであって、プログラムカウンタ
41の出力端には、出力値をインクリメントするインク
リメンタ43と、出力値をデクリメントするデクリメン
タ44とが接続される。インクリメンタ43とデクリメ
ンタ45との出力はマルチプレクサであるセレクタ42
に入力され、セレクタ42に増減信号indeが入力される
ことによって、プログラムカウンタ41の出力値をイン
クリメントするかデクリメントするかが選択される。す
なわち、プログラムカウンタ41の出力値を増減して指
定アドレスを増減できるのである。
The output value of the program counter 41 is stored in the object program memory 22 and the data memory 23.
The increment terminal 43 for incrementing the output value and the decrementer 44 for decrementing the output value are connected to the output terminal of the program counter 41. The outputs of the incrementer 43 and the decrementer 45 are output from a selector 42 which is a multiplexer.
, And the increase / decrease signal inde is input to the selector 42, thereby selecting whether to increment or decrement the output value of the program counter 41. That is, the designated address can be increased or decreased by increasing or decreasing the output value of the program counter 41.

【0018】以下に、図5の命令を実行する場合を例示
して動作を説明する。ここで説明を容易にするために、
図2に示すように、各マシンサイクルに対して第1サイ
クルから順に1〜7の数字を付すことにする。第1サイ
クルおよび第2サイクルは従来と同様になる。第2サイ
クルでは、アドレス(1)が指定されているから、パル
ス型応用命令である命令PADDがフェッチされるとと
もに、ビットメモリレジスタ37にデータメモリ23の
アドレス(1)のデータが取り込まれる。第3サイクル
では、命令ST X0が実行され、同時に命令PADD
がデコードされる。ここに、命令PADDのデコードは
第3サイクルの前半で行われる。また、命令PADDの
デコードによってオア回路35を通してカウンタ36が
動作可能になり、カウンタ36によって同期クロックsc
lkが計数される。コントローラ34では命令デコーダ3
3の出力およびカウンタ36の出力を受けて、図2
(c)のように増減信号をインクリメントからデクリメ
ントに立ち下げ、プログラムカウンタ41の出力値をデ
クリメントするように要求する。また、図2(e)のよ
うにフェッチイネーブル信号feを命令のフェッチを禁止
するように立ち下げる。このとき同時に、命令ST X
0が実行され、図2(f)のように、入力X0がビット
アキュムレータに書込信号wbによって書き込まれる。
Hereinafter, the operation will be described by exemplifying a case where the instruction of FIG. 5 is executed. Here, for ease of explanation,
As shown in FIG. 2, numbers 1 to 7 are assigned to each machine cycle in order from the first cycle. The first cycle and the second cycle are the same as the conventional one. In the second cycle, since the address (1) is specified, the instruction PADD which is a pulse-type application instruction is fetched, and the data of the address (1) in the data memory 23 is taken into the bit memory register 37. In the third cycle, the instruction ST X0 is executed, and at the same time, the instruction PADD is executed.
Is decoded. Here, the decoding of the instruction PADD is performed in the first half of the third cycle. Also, the decoding of the instruction PADD enables the counter 36 to operate through the OR circuit 35, and the counter 36 allows the synchronous clock sc
lk is counted. In the controller 34, the instruction decoder 3
3 and the output of the counter 36, FIG.
As shown in (c), the increase / decrease signal falls from the increment to the decrement, and a request is made to decrement the output value of the program counter 41. Also, as shown in FIG. 2E, the fetch enable signal fe falls so as to inhibit the fetch of the instruction. At this time, the instruction ST X
0 is executed, and the input X0 is written to the bit accumulator by the write signal wb as shown in FIG.

【0019】第3サイクルにおいてプログラムカウンタ
41の出力値をデクリメントするように増減信号による
要求が出されるから、第4サイクルでは図2(b)のよ
うにプログラムカウンタの出力値であるアドレスは
(1)に戻ることになる。ここで、フェッチイネーブル
信号feがフェッチを禁止しているから、第4サイクルで
は次命令OT Y30はフェッチされず、命令PADD
の実行のみがなされる。また、第4サイクルの開始時に
はライトイネーブル信号weが立ち上がってビットアキュ
ムレータに格納された値(すなわち、現在のスキャンに
おけるX0の値)がデータメモリ23に書き込まれるの
である。第4サイクルでは命令デコーダ33からコント
ローラ34への入力がないから増減信号indeはインクリ
メント側に復帰する。
In the third cycle, a request by the increase / decrease signal is issued to decrement the output value of the program counter 41. Therefore, in the fourth cycle, the address which is the output value of the program counter is (1) as shown in FIG. ). Here, since the fetch enable signal fe inhibits the fetch, the next instruction OTY30 is not fetched in the fourth cycle, and the instruction PADD is not executed.
Is performed only. At the start of the fourth cycle, the write enable signal we rises and the value stored in the bit accumulator (that is, the value of X0 in the current scan) is written to the data memory 23. In the fourth cycle, since there is no input from the instruction decoder 33 to the controller 34, the increase / decrease signal inde returns to the increment side.

【0020】第5サイクルになると、プログラムカウン
タ41の出力値はインクリメントされてアドレス(2)
が指定され、第5サイクルの後半部でフェッチイネーブ
ル信号feが立ち上がって命令OT Y30がフェッチさ
れることになる。第5サイクルでは命令PADDが実行
されるのであって、ビットアキュムレータの値と第2サ
イクルでビットメモリレジスタ37に格納された値とが
比較され、ビットメモリレジスタ37に格納された値が
「0」、ビットアキュムレータに格納された値が1であ
ると、立ち上がりの条件を満たすからビットアキュムレ
ータを「1」にセットする。ただし、ここではビットア
キュムレータはすでに「1」になっている。以後は通常
のパイプライン制御に復帰する。第6サイクルでは、ビ
ットアキュムレータが「1」になっていればメモリへの
書込を行うが、アキュムレータが「0」であれば無動作
になる。
At the fifth cycle, the output value of the program counter 41 is incremented to the address (2).
Is specified, the fetch enable signal fe rises in the second half of the fifth cycle, and the instruction OTY30 is fetched. In the fifth cycle, the instruction PADD is executed, and the value of the bit accumulator is compared with the value stored in the bit memory register 37 in the second cycle, and the value stored in the bit memory register 37 is set to “0”. If the value stored in the bit accumulator is 1, the rising condition is satisfied, so that the bit accumulator is set to "1". However, here, the bit accumulator is already "1". Thereafter, the control returns to the normal pipeline control. In the sixth cycle, writing to the memory is performed if the bit accumulator is “1”, but no operation is performed if the accumulator is “0”.

【0021】以上説明したようにパイプライン制御の乱
れを最小限に抑えてコプロセッサ21内で命令実行の処
理を継続しているので、データメモリ23のアドレスを
オブジェクトコードメモリ22と共有していることとあ
いまって、ハードウェアを比較的簡単にすることがで
き、また、高速な処理が可能になるのである。また、上
記動作と並行してMPU(コプロセッサ内で多ビット命
令を処理するALUを備えたプロセッサ)では、第3サ
イクルにおいてレジスタフェッチとALUでの演算を行
い、第6サイクルにおいてビットアキュムレータの値が
確定した後に、メモリへのアクセスまたはレジスタへの
書込を行うようにする。このような並行的な処理を行う
ことによって、微分命令に対する処理と並行して応用命
令部分の処理を行うことができるのであって高速な処理
が可能になる。
As described above, since the instruction execution processing is continued in the coprocessor 21 while the disturbance of the pipeline control is minimized, the address of the data memory 23 is shared with the object code memory 22. In combination with this, the hardware can be relatively simple and high-speed processing is possible. In parallel with the above operation, the MPU (processor having an ALU for processing multi-bit instructions in the coprocessor) performs register fetch and operation in the ALU in the third cycle, and stores the value of the bit accumulator in the sixth cycle. Is determined, access to the memory or writing to the register is performed. By performing such parallel processing, the processing of the application instruction portion can be performed in parallel with the processing for the differential instruction, and high-speed processing becomes possible.

【0022】なお、上記例では説明を簡単にするため
に、パルス型応用命令を命令PADDのみとしている
が、実際のプログラムでは他の命令が続くのはもちろん
のことである。また、このようなパルス型応用命令をプ
ログラムの先頭に置けば、微分処理後に応用命令を実行
することと等価になる。
In the above example, for simplicity of explanation, the pulse-type applied instruction is only the instruction PADD, but it goes without saying that other instructions follow in the actual program. If such a pulse type application instruction is placed at the head of the program, it is equivalent to executing the application instruction after the differentiation processing.

【0023】[0023]

【発明の効果】本発明は上述のように、プログラムメモ
リとデータメモリとがアドレスを共有している構成にお
いて、パイプライン処理を行う際に、パルス型応用命令
であると識別されると、指定アドレスをデクリメントさ
せるとともに、次命令のフェッチを中断させて微分処理
に要するデータをデータメモリに書込み、その後、次命
令のフェッチを再開させるので、微分処理を含む応用命
令であるパルス型応用命令の実行の際に、パイプライン
処理を一時的に中断してデータメモリへの所要データの
書込みなどを行うことができ、プログラムメモリとデー
タメモリとでアドレスを共用した簡単なハードウェアを
用いながらも、コプロセッサの内部のみで処理を行うこ
とができ、高速な処理が可能になるという効果がある。
According to the present invention, as described above, in a configuration in which an address is shared between a program memory and a data memory, when a pipeline-type application instruction is identified as a pulse type application instruction, Since the address is decremented, the fetch of the next instruction is interrupted, the data required for the differential processing is written to the data memory, and then the fetch of the next instruction is restarted, so that the pulse-type application instruction which is an application instruction including the differential processing is executed. In this case, the pipeline processing can be temporarily interrupted to write the required data to the data memory, etc., while using simple hardware that shares addresses between the program memory and the data memory. Processing can be performed only inside the processor, and high-speed processing can be performed.

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

【図1】実施例を示す要部ブロック図である。FIG. 1 is a main block diagram showing an embodiment.

【図2】実施例の動作説明図である。FIG. 2 is an operation explanatory diagram of the embodiment.

【図3】本発明に係るプログラマブルコントローラのブ
ロック図である。
FIG. 3 is a block diagram of a programmable controller according to the present invention.

【図4】本発明に係るプログラマブルコントローラでの
ソースコードとオブジェクトコードとの関係の例を示す
説明図である。
FIG. 4 is an explanatory diagram showing an example of a relationship between a source code and an object code in the programmable controller according to the present invention.

【図5】(a)はラダー図により表現した命令の一部を
示し、(b)はメモリの構成を示す説明図である。
5A is a diagram illustrating a part of an instruction represented by a ladder diagram, and FIG. 5B is an explanatory diagram illustrating a configuration of a memory.

【図6】従来の動作を示す動作説明図である。FIG. 6 is an operation explanatory view showing a conventional operation.

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

31 クロックジェネレータ 32 命令レジスタ 33 命令デコーダ 34 コントローラ 41 プログラムカウンタ 42 セレクタ 43 インクリメンタ 44 デクリメンタ 31 clock generator 32 instruction register 33 instruction decoder 34 controller 41 program counter 42 selector 43 incrementer 44 decrementer

Claims (1)

(57)【特許請求の範囲】(57) [Claims] 【請求項1】 シーケンスプログラムを格納したプログ
ラムメモリと、プログラムメモリと同じアドレスを有し
た各1ビットのメモリセルを有するデータメモリと、プ
ログラムメモリおよびデータメモリのアドレスを指定す
るアドレス発生器と、アドレス発生器により指定された
アドレスに格納されている命令をプログラムメモリから
フェッチする命令レジスタと、命令レジスタに格納され
た命令をデコードする命令デコーダと、デコードされた
命令を実行する演算部と、1つの命令のフェッチとデコ
ードと実行とを順に行うとともにデコードから実行まで
の間に次命令をフェッチするようにパイプライン制御を
行うコントローラとを備えたプログラマブルコントロー
ラにおいて、コントローラは、命令デコーダでデコード
した命令が微分処理を含む応用命令であるパルス型応用
命令であるときに、アドレス発生器による指定アドレス
をデクリメントさせるとともに、命令レジスタへの次命
令のフェッチを中断させて微分処理に要するデータをデ
ータメモリに書込み、その後、次命令のフェッチを再開
させることを特徴とするプログラマブルコントローラ。
1. A program memory storing a sequence program, a data memory having 1-bit memory cells having the same address as the program memory, an address generator designating addresses of the program memory and the data memory, and an address An instruction register for fetching the instruction stored at the address specified by the generator from the program memory, an instruction decoder for decoding the instruction stored in the instruction register, an operation unit for executing the decoded instruction, A controller that sequentially fetches, decodes, and executes instructions and performs a pipeline control so that the next instruction is fetched between decoding and execution. Differential processing When it is a pulse type application instruction which is an application instruction including, the specified address by the address generator is decremented, the fetch of the next instruction to the instruction register is interrupted, and the data required for the differential processing is written to the data memory, and then A programmable controller for resuming the fetch of the next instruction.
JP602392A 1992-01-16 1992-01-16 Programmable controller Expired - Lifetime JP2721611B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP602392A JP2721611B2 (en) 1992-01-16 1992-01-16 Programmable controller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP602392A JP2721611B2 (en) 1992-01-16 1992-01-16 Programmable controller

Publications (2)

Publication Number Publication Date
JPH05189015A JPH05189015A (en) 1993-07-30
JP2721611B2 true JP2721611B2 (en) 1998-03-04

Family

ID=11627090

Family Applications (1)

Application Number Title Priority Date Filing Date
JP602392A Expired - Lifetime JP2721611B2 (en) 1992-01-16 1992-01-16 Programmable controller

Country Status (1)

Country Link
JP (1) JP2721611B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP6992600B2 (en) * 2018-03-02 2022-01-13 株式会社明電舎 Programmable controller memory access control system, programmable controller memory access control method

Also Published As

Publication number Publication date
JPH05189015A (en) 1993-07-30

Similar Documents

Publication Publication Date Title
US5680581A (en) Microcomputer having a read protection circuit to secure the contents of an internal memory
JPS6243764A (en) Bus state control circuit
KR20070004705A (en) Electronic circuit
EP0240606B1 (en) Pipe-line processing system and microprocessor using the system
US4896264A (en) Microprocess with selective cache memory
EP0279953A2 (en) Computer system having mixed macrocode and microcode instruction execution
KR100321745B1 (en) A micro controller unit for external memory access
JP2721611B2 (en) Programmable controller
JP2721610B2 (en) Programmable controller
JP2003233509A (en) Digital signal processor
JP3699796B2 (en) Processor
US6266764B1 (en) Program controller for switching between first program and second program
EP0333231A2 (en) Microcomputer system capable of accessing to memory at high speed
EP0573071A2 (en) A microprocessor
US5734855A (en) Processor with pipeline processing function having read buffer register and latch for storing register information where the result of external access type instruction is stored
JP3043341B2 (en) Microcomputer system
US20040103267A1 (en) Data processor having cache memory
JP3954159B2 (en) Synchronous RAM access control circuit, data processor and control method thereof
JP3366235B2 (en) Data read control device
EP0332849B1 (en) Sequence controller for controlling next operating state with a short delay
JP3476314B2 (en) Microprocessor
JP2504263B2 (en) Data processing device
JP2002268876A (en) Pipeline processing method and information processor
JPS6250855B2 (en)
JPH08161222A (en) Processor and program preparation method therefor

Legal Events

Date Code Title Description
A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

Effective date: 19971104

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081121

Year of fee payment: 11

S533 Written request for registration of change of name

Free format text: JAPANESE INTERMEDIATE CODE: R313533

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20081121

Year of fee payment: 11

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091121

Year of fee payment: 12

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20091121

Year of fee payment: 12

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20101121

Year of fee payment: 13

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111121

Year of fee payment: 14

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111121

Year of fee payment: 14

S111 Request for change of ownership or part of ownership

Free format text: JAPANESE INTERMEDIATE CODE: R313111

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20111121

Year of fee payment: 14

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20121121

Year of fee payment: 15

EXPY Cancellation because of completion of term
FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20121121

Year of fee payment: 15