JP5480793B2 - Programmable controller - Google Patents
Programmable controller Download PDFInfo
- Publication number
- JP5480793B2 JP5480793B2 JP2010275719A JP2010275719A JP5480793B2 JP 5480793 B2 JP5480793 B2 JP 5480793B2 JP 2010275719 A JP2010275719 A JP 2010275719A JP 2010275719 A JP2010275719 A JP 2010275719A JP 5480793 B2 JP5480793 B2 JP 5480793B2
- Authority
- JP
- Japan
- Prior art keywords
- stage
- data
- address
- memory
- bit
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
- 230000015654 memory Effects 0.000 claims description 134
- 238000012545 processing Methods 0.000 claims description 52
- 230000007246 mechanism Effects 0.000 claims description 8
- 238000010586 diagram Methods 0.000 description 12
- 238000000034 method Methods 0.000 description 11
- 230000008569 process Effects 0.000 description 8
- 238000004891 communication Methods 0.000 description 3
- 229910000831 Steel Inorganic materials 0.000 description 1
- -1 electric power Substances 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 230000010354 integration Effects 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000004044 response Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 239000010865 sewage Substances 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 239000010959 steel Substances 0.000 description 1
- 238000012546 transfer Methods 0.000 description 1
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/30007—Arrangements for executing specific machine instructions to perform operations on data operands
- G06F9/30018—Bit or string instructions
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
- G06F9/30—Arrangements for executing machine instructions, e.g. instruction decode
- G06F9/30003—Arrangements for executing specific machine instructions
- G06F9/3004—Arrangements for executing specific machine instructions to perform operations on memory
- G06F9/30043—LOAD or STORE instructions; Clear instruction
Description
本発明は、鉄鋼、電力、上下水道等のプラントや各種機械に対してシーケンス制御を高速に行うビット演算プロセッサを搭載したプログラマブルコントローラに関する。 The present invention relates to a programmable controller equipped with a bit arithmetic processor that performs high-speed sequence control on plants and various machines such as steel, electric power, and water and sewage.
プログラマブルコントローラにおいては、従来からシーケンス制御を効率よく記述できるラダー言語が使われている。ラダー言語では、スイッチの開閉状態等、1ビットで表わされる情報を入力とし、リレー(継電器)出力等、1ビットで表わされる情報を出力とする場合が多い。そのため、プログラマブルコントローラは、ラダー言語特有の1ビットデータ処理を高速に行うため、専用のビット演算プロセッサを搭載することが多い。 In a programmable controller, a ladder language that can efficiently describe sequence control has been used. In the ladder language, information represented by 1 bit such as an open / closed state of a switch is input, and information represented by 1 bit such as a relay (relay) output is often output. For this reason, the programmable controller is often equipped with a dedicated bit arithmetic processor in order to perform 1-bit data processing unique to the ladder language at high speed.
ビット演算プロセッサは、1ビットのデータを扱うのに適した専用の命令セットをサポートしているが、演算結果を格納する先は汎用のメモリ素子であるため、8ビットや16ビットといったメモリ素子のアクセス単位サイズに合わせなければならない。汎用のメモリ素子に対して1ビットのデータを書き込むには、リードモディファイライト動作、即ち、メモリをアクセス単位サイズでリードし、リードしたデータの一部を変更し、再びアクセス単位サイズでライトする動作、が必要になるため、ラダー言語処理では汎用言語処理よりもメモリアクセス回数が多くなる特徴がある。 The bit arithmetic processor supports a dedicated instruction set suitable for handling 1-bit data. However, since the operation result is stored in a general-purpose memory element, a memory element such as 8-bit or 16-bit is used. Must match the access unit size. To write 1-bit data to a general-purpose memory device, a read-modify-write operation, that is, an operation of reading the memory with the access unit size, changing a part of the read data, and writing again with the access unit size Therefore, the ladder language processing has a feature that the number of memory accesses is larger than that of the general-purpose language processing.
ビット演算プロセッサの高速化に関連する従来技術として、特許文献1には、過去複数回分のワード単位のメモリアクセスアドレスとデータを高速アクセスが可能なバッファに記憶しておき、アクセスしようとするビットを含むワードデータのアドレスがバッファに記憶されているアドレスと一致する場合には、メモリでなくバッファ上のデータを使用することによりメモリアクセス回数を減らす工夫が記載されている。
As a prior art related to the speeding up of a bit arithmetic processor,
一方、汎用コンピュータの分野では、メモリアクセスの高速化のために従来からキャッシュメモリが使用されてきたが、近年の半導体微細化に伴い、キャッシュメモリ用内部SRAM(Static Random Access Memory)のソフトエラー対策が必要になり、キャッシュメモリにECC(Error Check and Correct:誤り検出・訂正符号)を付加して保護する場合も多くなってきている。ECCの付加単位は4バイト程度で設計されることが多いため、キャッシュメモリへの書き込み単位も4バイト以上になってしまう。汎用コンピュータの命令でも1バイトや2バイトの書き込みがサポートされるが、このようなECC付加単位以下のサイズの書き込みを行おうとするとキャッシュメモリに対してリードモディファイライトを行うことになる。 On the other hand, in the field of general-purpose computers, cache memory has been used for speeding up memory access. However, with recent miniaturization of semiconductors, measures against soft errors in cache memory internal SRAM (Static Random Access Memory) In many cases, the cache memory is protected by adding ECC (Error Check and Correct) to the cache memory. Since the ECC addition unit is often designed to be about 4 bytes, the unit of writing to the cache memory is also 4 bytes or more. Even general-purpose computer instructions support writing of 1 byte or 2 bytes. However, if a write of a size smaller than the ECC additional unit is to be performed, a read-modify-write is performed on the cache memory.
単純な構成のキャッシュメモリでリードモディファイライトを行う場合、キャッシュメモリが2サイクル以上占有され、その間プロセッサのパイプライン処理が中断されてしまう。リードモディファイライトがあってもパイプライン処理を中断させないための工夫としては、複数段のストアバッファを設け、ストア処理を置き去りにすることが行われている。特許文献2には、ECCを付加したキャッシュメモリのストアバッファの構成が記載されている。なお、ストアバッファによるストア処理の置き去りは、ロード・ストア命令以外を実行する際のキャッシュメモリの空き時間を利用してストア処理を行うものであるため、パイプライン処理の中断を確定的に無くすものではなく、中断の確率をできるだけ減らす工夫である。
When read-modify-write is performed with a cache memory having a simple configuration, the cache memory is occupied for two or more cycles, and the pipeline processing of the processor is interrupted during that time. As a device for preventing the pipeline processing from being interrupted even if there is a read-modify-write, a store buffer having a plurality of stages is provided and the store processing is left behind.
また、特許文献3には、キャッシュメモリを多ポート化し、オペランドフェッチ(リード)のパイプラインステージとオペランドライトのパイプラインステージを分けることにより、メモリ間データ転送を行う命令を効率よく実行するための工夫が記載されているが、キャッシュミス時の動作やオペランドフェッチとライトのアドレス競合時の動作については記載されていないし、リードモディファイライトの処理にも全く触れられていない。 Japanese Patent Laid-Open No. 2004-228561 has a multi-port cache memory and separates the operand fetch (read) pipeline stage and the operand write pipeline stage, thereby efficiently executing instructions for data transfer between memories. Although the device is described, the operation at the time of cache miss and the operation at the time of address conflict between operand fetch and write are not described, and the read modify write processing is not mentioned at all.
ラダー言語処理用のビット演算プロセッサにおいても高速化のためにパイプライン処理やキャッシュメモリを採用することが考えられるが、前述のようにラダー言語処理ではリードモディファイライトが多発するため、リードモディファイライトによるパイプライン処理のストール(中断)を防ぐ必要がある。特許文献2のようにアドレス比較器の付いた多段のストアバッファを使用すれば、パイプライン処理が中断する確率を減らすことができるが、ラダー言語で記述されるプログラムは汎用言語に比べてビット単位でのストア命令の比率が高い傾向があり、ストアバッファの段数をより大きくしなければならず、実現に必要な回路規模が大きくなってしまう。
It is conceivable to adopt pipeline processing and cache memory for speedup even in the bit arithmetic processor for ladder language processing. However, as described above, read modify write occurs frequently in ladder language processing. It is necessary to prevent stalling (interruption) of pipeline processing. If a multi-stage store buffer with an address comparator as in
一方、現在のほとんどの汎用プロセッサの命令セットは、RISC(Reduced Instruction Set Computer:縮小命令セットコンピュータ)の思想が取り入れられているため、演算処理とロード・ストア処理とはそれぞれ異なる命令で実行されるようになっている。即ち、演算処理は演算命令によって汎用レジスタ間で行い、メモリとレジスタ間のロード・ストアは別の命令で行うようになっている。このため、汎用プロセッサ用のパイプラインは、レジスタ間演算に適した構成になっているが、ラダー言語処理はメモリとアキュムレータ間の演算が中心であり、汎用プロセッサ用のパイプライン構成は必ずしも処理効率のよいものではない。 On the other hand, most current general-purpose processors have the instruction set of RISC (Reduced Instruction Set Computer), so that arithmetic processing and load / store processing are executed with different instructions. It is like that. In other words, arithmetic processing is performed between general-purpose registers by arithmetic instructions, and load / store between the memory and the registers is performed by different instructions. For this reason, the pipeline for general-purpose processors has a configuration suitable for register-to-register operations, but ladder language processing is centered on operations between memory and accumulators, and the pipeline configuration for general-purpose processors is not necessarily processing efficiency. Is not good.
従来技術によるパイプライン及びメモリの構成によってラダー言語処理を行った場合の課題を具体例によって示す。図14に典型的なRISCプロセッサのパイプライン構成を示す。PC(Program Counter)は命令アドレスを計算するステージ、IF(Instruction Fetch)は命令をフェッチするステージ、D(Decode)はフェッチした命令をデコードするステージ、EX(Execute)はレジスタ間演算またはメモリアドレス計算を行うステージ、M(Memory)はメモリをリード又はメモリにライトするステージ、WB(Write Back)は演算結果又はリード値をレジスタに書き戻すステージである。ビットデータ演算に伴うリードモディファイライトを行う場合には、MステージをM1とM2の2つに分け、M1サイクルでリードを、M2サイクルでビットデータのマージとライトを行う。 Specific problems will be described in the case where ladder language processing is performed by a pipeline and memory configuration according to the prior art. FIG. 14 shows a typical RISC processor pipeline configuration. PC (Program Counter) is a stage for calculating an instruction address, IF (Instruction Fetch) is a stage for fetching an instruction, D (Decode) is a stage for decoding a fetched instruction, and EX (Execute) is an operation between registers or memory address calculation. , M (Memory) is a stage where the memory is read or written to the memory, and WB (Write Back) is a stage where the calculation result or read value is written back to the register. When performing read modify write accompanying bit data calculation, the M stage is divided into two, M1 and M2, and read is performed in the M1 cycle, and bit data is merged and written in the M2 cycle.
ここで、図7(a)に例示したラダー図を前記従来技術のパイプライン構成で実行する場合を考える。図7(b)は、図7(a)に例示したラダー図を通常のラダー言語の命令列に変換したプログラムの例である。また、図7(c)は、それを前記従来技術のパイプライン構成で実行するための命令列に変換したプログラムの例である。 Here, consider a case where the ladder diagram illustrated in FIG. 7A is executed with the pipeline structure of the above-described prior art. FIG. 7B is an example of a program obtained by converting the ladder diagram illustrated in FIG. 7A into a normal ladder language instruction sequence. FIG. 7C shows an example of a program in which it is converted into an instruction sequence for execution in the conventional pipeline configuration.
変数X0〜X3は入力、変数Y2〜Y3は出力を表し、それぞれ1ビット長のデータとしてメモリ内の2つのワードデータ内に記憶されているものとする。図8はこれらの変数がメモリに割り付けられて格納される様子を示している。図7(b)において、LD(Load)はメモリからアキュムレータへのロード命令、ANDはメモリからロードした値とアキュムレータ値の論理積をアキュムレータに記憶する命令、ST(Store)はアキュムレータ値をメモリにストアする命令、ORはメモリからロードした値とアキュムレータ値の論理和をアキュムレータに記憶する命令である。また、図7(c)においては、LDはメモリからレジスタへのロード命令、ANDは2つのレジスタ値の論理積をレジスタに記憶する命令、STはレジスタ値をメモリにストアする命令、ORは2つのレジスタ値の論理和をレジスタに記憶する命令である。 Variables X0 to X3 represent inputs, and variables Y2 to Y3 represent outputs, each of which is stored in two word data in the memory as 1-bit data. FIG. 8 shows how these variables are allocated and stored in the memory. In FIG. 7B, LD (Load) is a load instruction from the memory to the accumulator, AND is an instruction for storing the logical product of the value loaded from the memory and the accumulator value in the accumulator, and ST (Store) is the accumulator value in the memory. The store instruction, OR, is an instruction for storing the logical sum of the value loaded from the memory and the accumulator value in the accumulator. In FIG. 7C, LD is a load instruction from the memory to the register, AND is an instruction for storing the logical product of two register values in the register, ST is an instruction for storing the register value in the memory, and OR is 2 This is an instruction for storing a logical sum of two register values in a register.
図15は、図7(c)に示した命令列を図14のパイプライン構成で実行した場合の動作を示すタイムチャートである。図15に示すように、1番目及び2番目のLD命令はそれぞれサイクルt0及びt1から開始され、サイクルt5及びt6までそのまま実行され、レジスタR1とR2にデータがロードされる。3番目のAND命令はサイクルt2からt4まではそのまま実行されるが、サイクルt5のEXステージで必要な変数X1のデータがまだリードされていないためパイプラインが1サイクルの間ストールする(「−」印)。変数X1のデータは2番目のLD命令のMステージの実行が完了する次のサイクルt6で利用可能となり、その後はサイクルt8までそのまま実行される。4番目のST命令はサイクルt3から開始されるが、サイクルt5での前命令のストールに伴い一緒にストールする。続いてサイクルt6及びt7が実行されたのち、Mステージではサイクルt8とt9との2サイクルをかけてリードモディファイライトが実行される。そのため、5番目のLD命令は、サイクルt5に加えてサイクルt9でもストールする。 FIG. 15 is a time chart showing an operation when the instruction sequence shown in FIG. 7C is executed in the pipeline configuration of FIG. As shown in FIG. 15, the first and second LD instructions start from cycles t0 and t1, respectively, and are executed as they are until cycles t5 and t6, and data is loaded into the registers R1 and R2. The third AND instruction is executed as it is from cycle t2 to t4. However, since the data of variable X1 necessary for the EX stage of cycle t5 has not been read yet, the pipeline stalls for one cycle ("-"). mark). The data of the variable X1 becomes available at the next cycle t6 when the execution of the M stage of the second LD instruction is completed, and thereafter is executed as it is until the cycle t8. The fourth ST instruction starts from cycle t3, but stalls together with the stall of the previous instruction in cycle t5. Subsequently, after cycles t6 and t7 are executed, in the M stage, read-modify-write is executed over two cycles of cycles t8 and t9. Therefore, the fifth LD instruction stalls at cycle t9 in addition to cycle t5.
以下同様にして、6番目のLD命令はサイクルt5及びt9が、7番目のOR命令及び8番目のST命令はサイクルt9及びt11が、それぞれストールすることになる。また、8番目のST命令はサイクルt14とt15の2サイクルをかけてリードモディファイライトが実行される。以上説明したように、従来技術のパイプライン構成では、通常のラダー言語では6命令で記述される処理を実行するのに8命令を要し、かつ、3つのサイクルにてパイプラインのストールが発生するため、全ての処理を完了するまでに計17サイクルを要することとなる。 Similarly, the sixth LD instruction stalls at cycles t5 and t9, and the seventh OR instruction and the eighth ST instruction stall at cycles t9 and t11, respectively. The eighth ST instruction is subjected to read-modify-write over two cycles t14 and t15. As described above, in the conventional pipeline configuration, the normal ladder language requires 8 instructions to execute the processing described in 6 instructions, and a pipeline stall occurs in 3 cycles. Therefore, a total of 17 cycles are required to complete all the processes.
本発明の目的は、ラダー言語を処理するビット演算プロセッサを備えたプログラマブルコントローラに好適な、リードモディファイライトなどによるパイプライン処理のストールを起こさないパイプラインの構成を提案することにある。さらには、キャッシュメモリを備えるビット演算プロセッサにおいて好適なパイプラインとキャッシュメモリの構成を提案することを目的とする。 An object of the present invention is to propose a pipeline configuration suitable for a programmable controller having a bit arithmetic processor for processing a ladder language and which does not cause a stall of pipeline processing by read-modify-write or the like. It is another object of the present invention to propose a pipeline and a cache memory configuration suitable for a bit arithmetic processor including a cache memory.
ラダー言語を処理するビット演算プロセッサにおいて、パイプライン処理のストールを起こさないためには、EXステージの演算結果を次のサイクルで実行される次命令のEXステージで利用可能とするとともに、リードモディファイライトの対象となるメモリの内容を事前にリードする新たなステージであるR(Read)ステージを設け、その次のEXステージにてビット演算及びビットデータのマージを行い、その結果を最後のW(Write)ステージにてメモリにストアするようにすればよい。 In order to prevent pipeline processing from stalling in a bit operation processor that processes the ladder language, the operation result of the EX stage can be used in the EX stage of the next instruction executed in the next cycle, and the read modify write can be performed. The R (Read) stage, which is a new stage for pre-reading the contents of the target memory, is provided, the bit operation and bit data merging are performed at the next EX stage, and the result is the last W (Write ) Store in memory on stage.
そこで、前記の目的を達成するために、本発明は、ビット演算処理の対象となる1ビットのデータを複数個まとめたワードの単位でメモリの読み書きを行うプログラマブルコントローラであって、プログラムに含まれるビット演算処理命令列を、パイプライン処理機構によって並列に実行するビット演算プロセッサを備え、前記ビット演算プロセッサが備えるパイプラインステージは、前記ビット演算処理命令を構成する各命令をデコードし、そのデコードした命令がメモリアクセスを伴う場合はデータアドレスを生成するデコードステージの次にリードステージがあり、ビット演算対象となるデータをワード単位でメモリから読み込む前記リードステージの次に演算ステージがあり、前記演算ステージの次に、前記演算ステージによって演算されたビット演算の結果を含むワードデータを前記リードステージで読み込んだデータと同じアドレスに書き込むライトステージがあることを特徴とする。
ここで、前記メモリは、前記リードステージにて読み込んだデータのアドレスを保持する第1アドレス保持レジスタと、前記第1アドレス保持レジスタからコピーされる前記データのアドレスを、前記ライトステージまで保持し、前記ライトステージの書き込み先アドレスとして使用させる第2アドレス保持レジスタと、を有するアドレス保持回路を備える。
Therefore, in order to achieve the above object, the present invention is a programmable controller that reads and writes a memory in units of words in which a plurality of 1-bit data to be subjected to bit operation processing are collected, and is included in a program The bit operation processor includes a bit operation processor that executes a bit operation instruction sequence in parallel by a pipeline processing mechanism, and the pipeline stage included in the bit operation processor decodes and decodes each instruction constituting the bit operation processing instruction. instructions are: a read stage of the decode stage for generating data addresses when involving memory access, the following the calculation stage of the read stage of reading from the memory the data to be bit operation target word by word, the operation stage Followed by the computation stage. It characterized in that there is a write stage for writing word data including the result of the bit operation to the same address as read data in the read stage.
Here, the memory holds a first address holding register holding an address of data read in the read stage, and an address of the data copied from the first address holding register until the write stage , And an address holding circuit having a second address holding register used as a write destination address of the write stage .
また、本発明は、前記メモリが、少なくとも2ウェイ以上のセットアソシアティブ方式又はフルアソシアティブ方式のキャッシュメモリであるとともに、
前記リードステージにて読み込んだキャッシュエントリのアドレスから抜き出されたインデックス情報を保持する第1インデックス保持レジスタと、
前記リードステージにてヒットしたウェイ情報を保持する第1ウェイ保持レジスタと、
前記第1インデックス保持レジスタからコピーされる前記インデックス情報を、前記ライトステージまで保持する第2インデックス保持レジスタと、
前記第1ウェイ保持レジスタからコピーされる前記ウェイ情報を、前記ライトステージまで保持する第2ウェイ保持レジスタと、を有しており、
前記第2インデックス保持レジスタ内の前記インデックス情報と、前記第2ウェイ保持レジスタ内の前記ウェイ情報との組み合わせを、前記ライトステージの書き込み先アドレスとして使用させるアドレス保持回路を備える
ことを特徴とする。
Further, the present invention, the memory is at least 2-way or more set associative or fully associative cache memory der Rutotomoni,
A first index holding register for holding index information extracted from the address of the cache entry read in the read stage ;
A first way holding register for holding way information hit in the read stage ;
A second index holding register for holding the index information copied from the first index holding register up to the write stage ;
A second way holding register for holding the way information copied from the first way holding register up to the write stage;
An address holding circuit that uses a combination of the index information in the second index holding register and the way information in the second way holding register as a write destination address of the write stage;
It is characterized by that.
また、メモリにアクセスする命令が連続した場合でもパイプライン処理をストールさせないために、前記メモリは単一のパイプライン処理サイクル時間内に1回以上のリードと1回以上のライトが独立に行える2ポート以上のメモリであることが好ましい。 Further, in order not to stall pipeline processing even when instructions accessing the memory are continuous, the memory can independently perform one or more reads and one or more writes within a single pipeline processing cycle time. The memory is preferably more than a port.
なお、特許文献3には、キャッシュリード、演算、キャッシュライト、という順番のパイプライン構成が記載されているが、リードとライトを独立に行うことが目的であるため、リードとライトには別なアドレスを指定でき、そのためキャッシュライト時にもキャッシュヒット判定が行われる。すなわち、リードモディファイライトを行うことは考慮されておらず、2リード+1ライトの3ポートメモリが必要となるなど、本発明とは目的と構成が異なっている。
Note that
本発明によれば、ビット演算プロセッサを備えたプログラマブルコントローラにおいて実行されるプログラムにおいて、リードモディファイライトに伴うパイプライン処理のストールが起こらないため、ラダー言語によって記述されたプログラムを効率よく処理することができる。また、キャッシュメモリを備えたビット演算プロセッサにおいても同様にパイプライン処理のストールが起こらないため、ラダー言語によって記述されたプログラムを効率よく処理することができる。また、ストア命令の実行時に先行するリードステージでキャッシュヒット判定を行うことにより、ライトステージでのキャッシュ入れ替え処理が不要となるので、パイプライン制御が単純になる。 According to the present invention, a program executed in a programmable controller having a bit arithmetic processor does not cause a stall of pipeline processing due to read-modify-write, so that a program written in a ladder language can be processed efficiently. it can. Similarly, since a stall of pipeline processing does not occur in a bit arithmetic processor having a cache memory, a program written in a ladder language can be processed efficiently. Also, by performing a cache hit determination at the preceding read stage at the time of execution of the store instruction, the cache replacement process at the write stage becomes unnecessary, so that pipeline control is simplified.
以下、本発明を実施するための形態につき、図1から図13を用いて説明する。
《第1実施形態》
図1は、本発明の第1実施形態に係るプログラマブルコントローラが備えるビット演算プロセッサの内部構成及びパイプライン構成を示す図である。また、図13は、第1実施形態に係るパイプライン構成を図14の従来技術と対比して表現したものである。図1及び図13に示すように、本実施形態に係るパイプライン構成は、(1)プログラムカウンタ(PC)ステージ、(2)命令フェッチ(IF)ステージ、(3)デコード(D)ステージ、(4)メモリリード(R)ステージ、(5)演算実行(EX)ステージ、(6)メモリライト(W)ステージ、の6段からなる。
Hereinafter, embodiments for carrying out the present invention will be described with reference to FIGS. 1 to 13.
<< First Embodiment >>
FIG. 1 is a diagram illustrating an internal configuration and a pipeline configuration of a bit arithmetic processor provided in the programmable controller according to the first embodiment of the present invention. FIG. 13 represents the pipeline configuration according to the first embodiment in comparison with the prior art of FIG. As shown in FIGS. 1 and 13, the pipeline configuration according to the present embodiment includes (1) a program counter (PC) stage, (2) an instruction fetch (IF) stage, (3) a decode (D) stage, ( 4) 6 stages of memory read (R) stage, (5) operation execution (EX) stage, and (6) memory write (W) stage.
PCステージは、直前の命令アドレスを示すPC(プログラムカウンタ)101の値に定数「1」又は指定されたレジスタ値を加算する加算器102、加算結果又は分岐先アドレスを示すレジスタ値を選択するセレクタ103を備え、直前に選択された命令の次に実行すべき命令の命令アドレスを、当該ステージの出力として命令アドレスレジスタ111にセットする。IFステージは命令アドレスレジスタ111にセットされた命令アドレスに対応する命令を命令バッファ30から読み出し、命令レジスタ121にセットする。
The PC stage includes an
Dステージは、読み出した命令を解釈するデコーダ122、デコーダ122によって命令から抜き出されたアドレスに指定されたレジスタ値を加算する加算器123を備え、デコードした命令がメモリアクセスを伴う場合はデータアドレスを生成してデータアドレスレジスタ131にセットする。また、図示は省略しているが、デコード結果に応じてレジスタ選択や演算機能選択などその後のステージの制御に必要な制御情報を取り出す。
The D stage includes a
Rステージは、データアドレスレジスタ131で示されたデータアドレスに該当するデータをデータメモリ20から読み出す。読み出されたデータは次のEXステージからのバイパスデータとの選択を行うセレクタ132を介してワードバッファ141にセットされる。また、データアドレスレジスタ131で示されたデータアドレスをWステージで再度利用できるように、データメモリ20内に備えるアドレス保持回路22にセットする。
The R stage reads data corresponding to the data address indicated by the data address register 131 from the
EXステージは、ALU(Arithmetic Logic Unit:演算器)142、及びビットマージ機構143をもち、ワードバッファ141にセットされたデータ値及び/又は指定されたレジスタ値を使って命令で指示された演算を行う。このとき、ビットデータの演算を行う場合は、演算対象のワードデータのなかから指定されたビット位置のビットデータを抽出して演算を実行し、ビットマージ機構143を使用して当該ビット位置に演算結果のビットデータを埋め込んでワードデータを生成する。結果を格納する先がレジスタの場合はレジスタファイル152に書き込みを行い、格納する先がデータメモリ20の場合は格納すべき演算結果のデータをライトバッファ151に書き込む。
The EX stage has an ALU (Arithmetic Logic Unit: arithmetic unit) 142 and a
Wステージは、Rステージにてアドレス保持回路22にセットされたデータアドレス、つまりRステージでデータを読み出したのと同じデータメモリ20内のデータアドレスにライトバッファ151にセットされたデータを格納する。
The W stage stores the data set in the
図2は、第1実施形態に係るプログラマブルコントローラの全体構成を示す図である。図2に示すように、プログラマブルコントローラ1000は、CPU(Central Proseccing Unit)モジュール1、I/O(Input/Output)モジュール2A及び2B、それらを接続するI/Oバス3、CPUモジュール1に着脱可能に接続されるプログラム入力装置4を備えて構成される。I/Oモジュール2A,2Bは、それぞれI/Oバス接続回路とI/Oインターフェース回路を有しており、必要なI/Oの仕様と接点数に応じて種類と数を変えられるようになっている。
FIG. 2 is a diagram illustrating an overall configuration of the programmable controller according to the first embodiment. As shown in FIG. 2, the
CPUモジュール1は、ビット演算プロセッサ10、データメモリ20、命令バッファ30、I/Oバス制御回路40、メモリコントローラ50、外部RAM(Random Access Memory)60、ROM(Read Only Memory)70、汎用マイクロプロセッサ80、通信I/F(Interface)90を備えて構成される。
The
データメモリ20に格納される所定アドレス範囲のデータ群は、それぞれがI/Oモジュール2A,2Bに接続された外部機器(図示省略)との間でやり取りされる入力データ又は出力データに対応する。I/Oバス制御回路40は、I/Oバス3を制御し、I/Oモジュール2A,2Bに接続された外部機器から得られる入力データをデータメモリ20に書き込み、また、データメモリ20から読み出した出力データをI/Oバス3経由でI/Oモジュール2A,2Bに接続された外部機器に出力する。
Data groups in a predetermined address range stored in the
命令バッファ30は、ビット演算プロセッサ10から要求される命令アドレスに対する命令がバッファ内に蓄えられていればそれを返し、当該命令がバッファ内にない場合にはメモリコントローラ50に外部RAM60からの命令の読み込みを要求する。メモリコントローラ50は、ビット演算プロセッサ10、命令バッファ30、I/Oバス制御回路40、汎用マイクロプロセッサ80からの要求に応じて外部RAM60のリードライト又はROM70のリードを行う。また、汎用マイクロプロセッサ80は、通信I/F90を介してプログラム入力装置4からローディングされるラダープログラムを外部RAM60に書き込む等、プログラマブルコントローラ1000全体の制御を司る。汎用マイクロプロセッサ80を動作させるプログラムはROM70に格納されている。
The
なお、本実施形態においては、ビット演算プロセッサ10、データメモリ20、命令バッファ30、I/Oバス制御回路40、及びメモリコントローラ50は、システムLSI(Large Scale Integration)100に内蔵されているものとする。
In this embodiment, the bit arithmetic processor 10, the
図3は、本実施形態に係るデータメモリ20として好適な2ポートメモリを用いた場合の構成を示す図である。図3に示すように、データメモリ20は、アドレスセレクタ201、アドレス保持レジスタ221及び222を有するアドレス保持回路22、ライトアドレスセレクタ215、ライトデータセレクタ204、メモリアレイ21を備えて構成される。
FIG. 3 is a diagram showing a configuration when a suitable 2-port memory is used as the
アドレスセレクタ201は、ビット演算プロセッサ10のデータアドレスレジスタ131(図1)の値とI/Oバス制御回路40から出力されるI/Oデータアドレスのいずれかを選択する。アドレス保持レジスタ221,222は、Rステージの実行に使用されたデータアドレスを2サイクル後のWステージまで保持する。すなわち、Rステージの出力データとして1段目のアドレス保持レジスタ221にデータアドレスを保持し、その値をEXステージの出力データとして2段目のアドレス保持レジスタ222にコピーして保持することによって、Wステージで使用できるようにする。
The
ライトアドレスセレクタ215は、データアドレスレジスタ131の値とアドレス保持レジスタ222の値のいずれかを選択する。ライトデータセレクタ204は、ライトバッファ151の値とI/Oバス制御回路40から出力されるI/Oデータの値のいずれかを選択する。
The
メモリアレイ21は、リード用のポート1とライト用のポート2の2つが単一のサイクル内でアクセス可能な2ポートメモリで構成される。そのため、パイプライン処理されるある命令のRステージの処理と並列に実行される別命令のWステージの処理とを同一サイクル内に並列に実行することが可能となる。ここでは、メモリアレイ21は2ポートメモリとしたが、単一のサイクル内で1以上のリード用ポートと1以上のライト用ポートがアクセス可能な3ポート以上のメモリとしてもよい。なお、I/Oバス制御回路40からのメモリアクセス時にはリードとライトはそれぞれ独立して行うので、アドレス保持回路22は使用されない。
The
図4は、第1実施形態に係るビット演算プロセッサの演算ステージ(EXステージ、一部他ステージの要素を含む)の詳細構成を示す図である。図4に示すように、演算ステージは、ALU142の他に、ALU142の入力を選択するセレクタ144及び145、データメモリ20からリードされた1ワード(16ビット)のデータもしくはこの演算ステージの演算結果を次命令で再び演算に使用するためのバイパスデータのいずれかを選択するセレクタ132(Rステージの要素)、その選択されたワードデータを保持するワードバッファ141、演算結果であるALU142の出力を入力されたワードデータにマージするビットマージ機構143、ビットマージされたデータを保持するライトバッファ151、アキュムレータや汎用レジスタなどのデータを保持するレジスタファイル152(Wステージの要素)を備えて構成される。ALU142は1ビット長又は1ワード即ち16ビット長の演算を行うことができる。
FIG. 4 is a diagram showing a detailed configuration of an operation stage (EX stage, including some elements of other stages) of the bit operation processor according to the first embodiment. As shown in FIG. 4, in addition to the
図9は、ビット演算プロセッサ10によって実行される命令の命令フォーマットを示す図である。図9に示すように、命令には2つの形式があるが、いずれも32ビット固定長である。命令形式1は、5ビットの命令コード(OP:Operation)、4ビットのビット位置フィールド(BA:Bit Address)、23ビットのワードアドレスフィールド(WA:Word Address)からなり、ビットデータを対象とする。命令形式2は、5ビットの命令コード(OP)、4ビットのレジスタ指定フィールド(RA:Register Address)、23ビットのワードアドレスフィールド(WA)からなり、ワードデータを対象とする。
FIG. 9 is a diagram illustrating an instruction format of an instruction executed by the bit arithmetic processor 10. As shown in FIG. 9, there are two types of instructions, both of which have a fixed length of 32 bits. The
次に、図7及び図8に示したラダープログラムを例にとり、図1を参照しつつ、本実施形態に係るビット演算プロセッサ10の動作を図11のタイムチャートを使って説明する。図10は、図7(b)のラダープログラムに対する前記した命令形式1の命令コード列がプログラムメモリ(外部RAM60)に格納された様子を示したものであり、アドレスA番地から順に命令コード列が格納されているものとする。
Next, taking the ladder program shown in FIGS. 7 and 8 as an example, the operation of the bit arithmetic processor 10 according to this embodiment will be described using the time chart of FIG. 11 with reference to FIG. FIG. 10 shows a state in which the instruction code string of the above-described
先ず、1番目のLD命令は、サイクルt0から開始され、サイクルt5までそのまま実行される。このとき、サイクルt0(PCステージ)では、LD命令のアドレスが計算されて命令アドレスレジスタ111にセットされる。サイクルt1(IFステージ)では、命令バッファ30から当該命令がリードされて命令レジスタ121にセットされる。サイクルt2(Dステージ)では、命令がデコードされ、LD命令であることが認識される。1番目のLD命令では、リードすべきワードアドレスは命令中で直接指定されているので、該当するワードアドレスがデータアドレスレジスタ131にセットされる。サイクルt3(Rステージ)では、データメモリ20から、対象となるビットデータを含む1ワード分のデータが読み込まれ、ワードバッファ141にセットされる。サイクルt4(EXステージ)では、対象となる変数X0のビットが抜き出されてレジスタファイル152に含まれるアキュムレータにセットされる。サイクルt5(Wステージ)では何の動作も行わない(図の網かけ表示部分)。
First, the first LD instruction starts from cycle t0 and is executed as it is until cycle t5. At this time, in cycle t0 (PC stage), the address of the LD instruction is calculated and set in the instruction address register 111. In cycle t 1 (IF stage), the instruction is read from the
2番目のAND命令は、サイクルt1から開始され、サイクルt6までそのまま実行される。なお、サイクルt6(Wステージ)では何の動作も行わない。このとき、PCステージからRステージまでは1番目のLD命令と同様に実行される。サイクルt5(EXステージ)では、対象となる変数X1のビットを抜き出したのちにALU142でアキュムレータの内容との論理積を計算し、再びアキュムレータにセットする。本実施例ではEXステージの前に実行されるRステージにおいて、変数X1を含むワードデータがリードされるので、従来技術の例(図15)のようにAND命令のEXステージでパイプライン処理がストールすることはない。
The second AND instruction starts from cycle t1 and is executed as it is until cycle t6. Note that no operation is performed in cycle t6 (W stage). At this time, the PC stage to the R stage are executed in the same manner as the first LD instruction. In cycle t5 (EX stage), after extracting the bit of the target variable X1, the
3番目のST命令は、サイクルt2から開始されサイクルt7までそのまま実行される。PCステージからRステージまでは1番目のLD命令と同様に実行される。ST命令においてもRステージにて事前にデータのリードを行うことが本実施形態の大きな特徴である。サイクルt6(EXステージ)では、アキュムレータ値(1ビット)が読み出され、ワードバッファ141の値(1ワード)にマージされた結果がライトバッファ151にセットされる。サイクルt7のWステージでは、データメモリ20にライトバッファ151の内容が格納される。その際、格納先のメモリアドレスとしては、Rステージで使用した値を保持しているアドレス保持回路22に記憶された内容が使用される。このように、本実施形態のパイプライン構成によれば、1ビットデータの書き込みを行う際においてもパイプライン処理のストールは発生しない。
The third ST instruction starts from cycle t2 and is executed as it is until cycle t7. The PC stage to the R stage are executed in the same manner as the first LD instruction. A major feature of this embodiment is that data is read in advance at the R stage even in the ST instruction. In cycle t6 (EX stage), the accumulator value (1 bit) is read, and the result merged with the value (1 word) of the
以下同様の動作により、4番目のLD命令はサイクルt3からサイクルt8にかけて、5番目のOR命令はサイクルt4からサイクルt9にかけて、6番目のST命令はサイクルt5からサイクルt10にかけて、それぞれパイプライン処理がストールすることなく実行される。このように、本実施形態によれば、6命令を実行する間にパイプライン処理のストールは全く発生せず、図7(b)に示した6命令で記述される処理を実行するのに要するサイクル数を、従来技術の17サイクルから11サイクルに短縮することができる。 By the same operation, the fourth LD instruction is cycled from cycle t3 to cycle t8, the fifth OR instruction is cycled from cycle t4 to cycle t9, and the sixth ST instruction is cycled from cycle t5 to cycle t10. It runs without stalling. As described above, according to the present embodiment, pipeline processing stall does not occur at all during execution of six instructions, and it is necessary to execute the process described by the six instructions shown in FIG. 7B. The number of cycles can be reduced from 17 cycles of the prior art to 11 cycles.
以上説明したように、第1実施形態に係るビット演算プロセッサを備えたプログラマブルコントローラによれば、ラダー言語処理に特有のビット演算処理をパイプライン処理のストールなしに1サイクルピッチで実行できるので、ラダー言語によって記述されたプログラムを高速に実行することができる。 As described above, according to the programmable controller including the bit arithmetic processor according to the first embodiment, the bit arithmetic processing peculiar to the ladder language processing can be executed at one cycle pitch without stalling the pipeline processing. A program written in a language can be executed at high speed.
《第2実施形態》
続いて、第1実施形態におけるデータメモリ20(図2参照)をキャッシュメモリによって構成する本発明の第2実施形態について説明する。図5は、第2実施形態に係るキャッシュメモリの構成を示す図である。図5に示すように、データメモリ20としてのキャッシュメモリ20Aは、2ウェイセットアソシアティブ方式のキャッシュメモリであり、アドレスセレクタ201A、インデックス保持レジスタ221A及び222A、ウェイセレクタ203、ライトデータセレクタ204A、ウェイ0タグメモリ205、ウェイ1タグメモリ206、LRU(Least Recently Used)メモリ207、ウェイ0データメモリ208、ウェイ1データメモリ209、ヒット判定回路210、ライトバック制御回路211、ウェイデータセレクタ212、ウェイ保持レジスタ213及び214を備えて構成される。図1のアドレス保持回路22は、インデックス保持レジスタ221A,222Aを有するアドレス保持回路1(22A)と、ウェイ保持レジスタ213,214を有するアドレス保持回路2(22B)によって構成される。
<< Second Embodiment >>
Next, a second embodiment of the present invention in which the data memory 20 (see FIG. 2) in the first embodiment is configured by a cache memory will be described. FIG. 5 is a diagram illustrating a configuration of the cache memory according to the second embodiment. As shown in FIG. 5, the cache memory 20A as the
ウェイデータメモリ208及び209は、それぞれ256個のエントリを持ち、各エントリはそれぞれ16バイト(8ワード)のデータを保持する。キャッシュメモリのアクセス単位は16バイトであり、この16バイト単位のデータを1ラインと呼ぶ。タグメモリ205及び206は、それぞれ256個のエントリを持ち、各エントリは、有効ビットV(Valid)、ダーティビットD(Dirty)及びタグアドレス(図5では「タグ」と略記)からなる。LRUメモリ207は256個のエントリを持ち、最近使用されたウェイを保持する。
The
アドレスセレクタ201Aは、ビット演算プロセッサ10のデータアドレスレジスタ131(図1)の値とI/Oバス制御回路40から出力されるI/Oデータアドレスのいずれかを選択し、そのなかから12ビットのタグアドレスと8ビットのインデックス値を抽出する。インデックス保持レジスタ221A,222Aは、Rステージの実行に使用されたデータアドレスから抜き出されたインデックス値の部分(8ビット)を2サイクル後のWステージまで保持する。同様に、ウェイ保持レジスタ213,214は、RステージにてヒットしたウェイをWステージまで保持する。
The
ウェイセレクタ203は、2段目のインデックス保持レジスタ222Aに記憶されたインデックス値と2段目のウェイ保持レジスタ214に記憶されたヒットウェイを、Wステージにて書き込みを行うインデックス値とウェイとしてウェイデータメモリ208,209に出力する。ライトデータセレクタ204Aは、後記するライトバッファ151Aの値とI/Oバス制御回路40から出力される1ライン分のI/Oデータの値のいずれかを選択する。
The
ヒット判定回路210は、アクセスするデータアドレスの上位12ビットとタグメモリ205,206から出力されるタグ値をウェイごとに比較し、ヒット又はミスを判定する。ウェイデータセレクタ212は、ヒット判定回路210の出力によってウェイ0データ又はウェイ1データのいずれかのラインデータを選択する。なお、I/Oバス制御回路40からのキャッシュアクセス時にはキャッシュのリードとライトをそれぞれ独立して行うため、アドレス保持回路1,2(22A,22B)は使用されない。
The
ライトバック制御回路211は、キャッシュミス時にLRUメモリ207の出力が示す追い出しウェイ(最近使用されたウェイでない方のウェイ)の対象エントリがライトバックモードの対象となるアドレス範囲に含まれていてダーティであった場合、つまり、データの更新が行われていた場合は、タグと同時に読み出されているデータをメモリコントローラ50に送って外部RAM60(図2)の記憶内容を更新させる。なお、I/Oデータアドレスに相当する所定のアドレス範囲については、動作をライトスルーモードに切り替えて直ちに記憶内容の更新を行わせるので、ライトバック動作は行わない。また、不図示のリード制御回路により、当該追い出した対象エントリにキャッシュミスとなったラインデータを読み込む。
The write-
なお、これらキャッシュメモリ20Aを構成するタグメモリ205,206及びウェイデータメモリ208,209は、単一サイクル内でリード用のポートとライト用のポートの2つが並列にアクセス可能な2ポート以上のメモリで構成することが好ましく、それによってメモリへのアクセスが競合することによって生じるパイプライン処理のストールをなくすことができる。また、ここではキャッシュメモリ20Aは2ウェイセットアソシアティブ方式としたが、3ウェイ以上のセットアソシアティブ方式やフルアソシアティブ方式としてもよい。
The
図6は、第2実施形態に係るビット演算プロセッサの演算ステージ(EXステージ、一部他ステージの要素を含む)の詳細構成を示す図である。図6に示すように、この演算ステージ構成は、前記の第1実施形態に係る演算ステージ構成(図4)における入力及び出力データのサイズを1ライン長(16バイト=128ビット)に変更するとともに、1ライン長のデータを保持しておいて演算結果のワードデータをマージするための手段を付加したものであり、その他の構成要素は図4と同様であるので重複する説明を省略する。 FIG. 6 is a diagram showing a detailed configuration of an operation stage (EX stage, including some elements of other stages) of the bit operation processor according to the second embodiment. As shown in FIG. 6, this operation stage configuration changes the size of input and output data in the operation stage configuration (FIG. 4) according to the first embodiment to one line length (16 bytes = 128 bits). Means for merging the word data of the operation result while holding data of one line length is added, and the other components are the same as in FIG.
セレクタ132A(Rステージの要素)は、キャッシュメモリ20Aからリードされた1ライン長(16バイト)のデータのなかの1ワード(16ビット)もしくはこの演算ステージの演算結果を次命令で再び演算に使用するためのバイパスデータのいずれかを選択する。ラインバッファ146は、リードされた1ライン長のデータを保持する。また、ワードマージ機構147は、ビットマージ機構143の出力である演算結果のワードデータをラインバッファ146に保持されているラインデータにマージする。ライトバッファ151Aはマージされた1ライン分のデータを保持する。
The
ここで、前記と同様に、図7及び図8に示したラダープログラムを例にとり、本実施形態に係るビット演算プロセッサの動作を説明する。キャッシュメモリ20Aがリード動作とライト動作を単一のサイクルで実行可能な2ポートメモリによって構成されており、かつ、対象データが全てキャッシュヒットするものと仮定した場合の動作は、前記した図11のタイムチャートと同様である。本実施形態の動作が前記の第1実施形態と異なるのは、Rステージ及びWステージにおけるデータのリード及びライトが1ラインの単位で行われ、EXステージでは、セレクタ132Aによって抽出された対象ワードに対して演算を実行し、演算結果のワードデータを、ラインバッファ146に保持しておいたラインデータにマージしてライトするラインデータを生成する点にある。
Here, as described above, the operation of the bit arithmetic processor according to the present embodiment will be described using the ladder program shown in FIGS. 7 and 8 as an example. The operation when the cache memory 20A is configured by a two-port memory capable of executing a read operation and a write operation in a single cycle, and all the target data hits the cache is as shown in FIG. It is the same as the time chart. The operation of this embodiment differs from that of the first embodiment in that data reading and writing in the R stage and W stage are performed in units of one line, and in the EX stage, the target word extracted by the
次に、図7(b)のラダープログラムにおける3番目のST命令でキャッシュミスが起こった場合の動作を図12のタイムチャートを使って説明する。1番目のLD命令と2番目のAND命令の動作は図11の場合と同じである。3番目のST命令のRステージ(サイクルt5)でキャッシュミスが発生すると、メモリコントローラ50を介して外部RAM60のデータを読み込むために、例えばサイクルt5からサイクルt14までパイプライン処理がストールする。しかし、サイクルt15でRステージが再開されたのちは、パイプライン処理のストールなしに実行される。このようにST命令に対するキャッシュミスが発生した場合であっても、Rステージにおいてキャッシュラインの入れ替えを行うだけで済むのでキャッシュの制御が単純になる。
Next, the operation when a cache miss occurs in the third ST instruction in the ladder program of FIG. 7B will be described using the time chart of FIG. The operations of the first LD instruction and the second AND instruction are the same as in FIG. When a cache miss occurs in the R stage (cycle t5) of the third ST instruction, the pipeline process stalls from cycle t5 to cycle t14, for example, in order to read data in the
なお、ST命令の次命令がアクセスするデータアドレスがST命令と同一インデックス値を有しており、かつ、次命令がキャッシュミスとなった場合でも、2ウェイセットアソシアティブ以上のキャッシュメモリであれば、当該ST命令がWステージでラインデータを上書きする前に当該エントリがパージされてしまっていることはない。 Even if the data address accessed by the next instruction of the ST instruction has the same index value as that of the ST instruction and the next instruction is a cache miss, if the cache memory is 2 way set associative or more, The entry is not purged before the ST instruction overwrites the line data at the W stage.
以上説明したように、第2実施形態に係るキャッシュメモリを内蔵したビット演算プロセッサを備えたプログラマブルコントローラによれば、ラダー言語処理に特有のビット演算処理をパイプライン処理のストールなしに1サイクルピッチで実行できるので、ラダー言語によって記述されたプログラムを高速に実行することができる。 As described above, according to the programmable controller including the bit arithmetic processor incorporating the cache memory according to the second embodiment, the bit arithmetic processing peculiar to the ladder language processing can be performed at one cycle pitch without stalling the pipeline processing. Since it can be executed, a program written in a ladder language can be executed at high speed.
以上にて本発明を実施する形態の説明を終えるが、本発明の実施の態様はこれに限られるものではなく、本発明の趣旨を逸脱しない範囲内で各種の変更が可能である。 Although the description of the embodiment of the present invention has been completed above, the embodiment of the present invention is not limited to this, and various modifications can be made without departing from the spirit of the present invention.
1 CPUモジュール
2A,2B I/Oモジュール
3 I/Oバス
4 プログラム入力装置
10 ビット演算プロセッサ
20 データメモリ
20A キャッシュメモリ
21 メモリアレイ
22,22A,22B アドレス保持回路
30 命令バッファ
40 I/Oバス制御回路
50 メモリコントローラ
60 外部RAM
70 ROM
80 汎用マイクロプロセッサ
90 通信I/F
100 システムLSI
1000 プログラマブルコントローラ
1
70 ROM
80 General-
100 system LSI
1000 Programmable controller
Claims (5)
プログラムに含まれるビット演算処理命令列を、パイプライン処理機構によって並列に実行するビット演算プロセッサを備え、
前記ビット演算プロセッサが備えるパイプラインステージは、前記ビット演算処理命令を構成する各命令をデコードし、そのデコードした命令がメモリアクセスを伴う場合はデータアドレスを生成するデコードステージの次にリードステージがあり、演算対象となるデータをワード単位でメモリから読み込む前記リードステージの次に演算ステージがあり、前記演算ステージの次に、前記演算ステージによって演算されたビット演算の結果を含むワードデータを前記リードステージで読み込んだデータと同じアドレスに書き込むライトステージがあり、
前記メモリは、
単一のパイプラインステージ処理サイクル時間内に1回以上のリードと1回以上のライトとを行うことができる2ポート以上のメモリであるとともに、
前記リードステージにて読み込んだデータのアドレスを保持する第1アドレス保持レジスタと、前記第1アドレス保持レジスタからコピーされる前記データのアドレスを、前記ライトステージまで保持し、前記ライトステージの書き込み先アドレスとして使用させる第2アドレス保持レジスタと、を有するアドレス保持回路を備える
ことを特徴とするプログラマブルコントローラ。 A programmable controller that reads and writes a memory in a unit of a word in which a plurality of 1-bit data to be subjected to bit operation processing are collected,
A bit operation processor that executes a bit operation processing instruction sequence included in the program in parallel by a pipeline processing mechanism;
The pipeline stage included in the bit operation processor has a read stage next to a decode stage that decodes each instruction constituting the bit operation processing instruction and generates a data address when the decoded instruction involves memory access. , are: the operation stage of the read stage of reading data to be calculated in units of words from the memory, the next computation stage, the read stage of the word data including the result of the computed bit calculated by the calculation stage There is a write stage that writes to the same address as the data read in
The memory is
A memory with two or more ports that can perform one or more reads and one or more writes within a single pipeline stage processing cycle time,
A first address holding register that holds an address of data read in the read stage, and an address of the data copied from the first address holding register up to the write stage, and a write destination address of the write stage A programmable controller comprising: an address holding circuit having a second address holding register to be used .
プログラムに含まれるビット演算処理命令列を、パイプライン処理機構によって並列に実行するビット演算プロセッサを備え、
前記ビット演算プロセッサが備えるパイプラインステージは、前記ビット演算処理命令を構成する各命令をデコードし、そのデコードした命令がメモリアクセスを伴う場合はデータアドレスを生成するデコードステージの次にリードステージがあり、演算対象となるデータをワード単位でメモリから読み込む前記リードステージの次に演算ステージがあり、前記演算ステージの次に、前記演算ステージによって演算されたビット演算の結果を含むワードデータを前記リードステージで読み込んだデータと同じアドレスに書き込むライトステージがあり、
前記メモリは、
単一のパイプラインステージ処理サイクル時間内に1回以上のリードと1回以上のライトとを行うことができる2ポート以上のメモリであり、かつ、少なくとも2ウェイ以上のセットアソシアティブ方式又はフルアソシアティブ方式のキャッシュメモリであるとともに、
前記リードステージにて読み込んだキャッシュエントリのアドレスから抜き出されたインデックス情報を保持する第1インデックス保持レジスタと、
前記リードステージにてヒットしたウェイ情報を保持する第1ウェイ保持レジスタと、
前記第1インデックス保持レジスタからコピーされる前記インデックス情報を、前記ライトステージまで保持する第2インデックス保持レジスタと、
前記第1ウェイ保持レジスタからコピーされる前記ウェイ情報を、前記ライトステージまで保持する第2ウェイ保持レジスタと、を有しており、
前記第2インデックス保持レジスタ内の前記インデックス情報と、前記第2ウェイ保持レジスタ内の前記ウェイ情報との組み合わせを、前記ライトステージの書き込み先アドレスとして使用させるアドレス保持回路を備える
ことを特徴とするプログラマブルコントローラ。 A programmable controller that reads and writes a memory in a unit of a word in which a plurality of 1-bit data to be subjected to bit operation processing are collected,
A bit operation processor that executes a bit operation processing instruction sequence included in the program in parallel by a pipeline processing mechanism;
The pipeline stage included in the bit operation processor has a read stage next to a decode stage that decodes each instruction constituting the bit operation processing instruction and generates a data address when the decoded instruction involves memory access. , are: the operation stage of the read stage of reading data to be calculated in units of words from the memory, the next computation stage, the read stage of the word data including the result of the computed bit calculated by the calculation stage There is a write stage that writes to the same address as the data read in
The memory is
A two-port or more memory capable of performing one or more reads and one or more writes within a single pipeline stage processing cycle time, and at least two-way set associative or full associative of cache memory der Rutotomoni,
A first index holding register for holding index information extracted from the address of the cache entry read in the read stage ;
A first way holding register for holding way information hit in the read stage ;
A second index holding register for holding the index information copied from the first index holding register up to the write stage ;
A second way holding register for holding the way information copied from the first way holding register up to the write stage;
A programmable memory device comprising: an address holding circuit that uses a combination of the index information in the second index holding register and the way information in the second way holding register as a write destination address of the write stage. controller.
前記ビット演算処理命令列のなかのビットデータのストア命令を実行するときに、
前記リードステージにてストア対象のビットを含む元のワードデータを読み込んで記憶部に保持しておき、
前記演算ステージにて演算された前記ビット演算の結果のビットデータを、前記保持した元のワードデータにマージする
ことを特徴とする請求項1または請求項2に記載のプログラマブルコントローラ。 The bit arithmetic processor is:
When executing a bit data store instruction in the bit operation processing instruction sequence ,
Read the original word data including the bits to be stored in the read stage and hold it in the storage unit,
The programmable controller according to claim 1 or 2, wherein the bit data obtained as a result of the bit operation calculated in the operation stage is merged with the original word data held.
ことを特徴とする請求項2に記載のプログラマブルコントローラ。 Cache hit determination is performed in the read stage, and in the write stage, the cache indicated by the index information held in the second index holding register of the address holding circuit and the way information held in the second way holding register The programmable controller according to claim 2, wherein line data in which word data including the result of the bit operation is merged is written in the entry.
ことを特徴とする請求項2に記載のプログラマブルコントローラ。 The programmable controller according to claim 2, wherein the write-through mode and the write-back mode are switched according to an address range to be stored.
Priority Applications (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010275719A JP5480793B2 (en) | 2010-12-10 | 2010-12-10 | Programmable controller |
CN201180059507.9A CN103262029B (en) | 2010-12-10 | 2011-11-28 | Programmable Logic Controller |
PCT/JP2011/077328 WO2012077516A1 (en) | 2010-12-10 | 2011-11-28 | Programmable controller |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010275719A JP5480793B2 (en) | 2010-12-10 | 2010-12-10 | Programmable controller |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2012123719A JP2012123719A (en) | 2012-06-28 |
JP5480793B2 true JP5480793B2 (en) | 2014-04-23 |
Family
ID=46207008
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2010275719A Active JP5480793B2 (en) | 2010-12-10 | 2010-12-10 | Programmable controller |
Country Status (3)
Country | Link |
---|---|
JP (1) | JP5480793B2 (en) |
CN (1) | CN103262029B (en) |
WO (1) | WO2012077516A1 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
GB2529892B (en) | 2014-09-08 | 2017-04-12 | Imagination Tech Ltd | Efficient loading and storing of data |
Family Cites Families (12)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH05120135A (en) * | 1991-10-25 | 1993-05-18 | Oki Electric Ind Co Ltd | Cache control system |
JPH0954694A (en) * | 1995-08-16 | 1997-02-25 | Nec Corp | Pipeline processor and its processing method |
US5933651A (en) * | 1995-09-29 | 1999-08-03 | Matsushita Electric Works, Ltd. | Programmable controller |
JPH0997180A (en) * | 1995-09-29 | 1997-04-08 | Matsushita Electric Works Ltd | Programmable controller |
JP3019818B2 (en) * | 1997-10-09 | 2000-03-13 | 日本電気株式会社 | Data processing method |
JP2001125770A (en) * | 1999-10-29 | 2001-05-11 | Matsushita Electric Works Ltd | Method and device for arithmetic |
JP3498673B2 (en) * | 2000-04-05 | 2004-02-16 | 日本電気株式会社 | Storage device |
JP2003044357A (en) * | 2001-07-27 | 2003-02-14 | Nec Computertechno Ltd | Cache prefetch system |
JP2003196084A (en) * | 2001-12-25 | 2003-07-11 | Toshiba Corp | System having read modifying write unit |
JP2005242457A (en) * | 2004-02-24 | 2005-09-08 | Matsushita Electric Works Ltd | Programmable controller |
JP2008129771A (en) * | 2006-11-20 | 2008-06-05 | Konica Minolta Business Technologies Inc | Memory system and information processor |
CN101689108A (en) * | 2007-05-17 | 2010-03-31 | 富士通株式会社 | Calculation unit, processor, and processor architecture |
-
2010
- 2010-12-10 JP JP2010275719A patent/JP5480793B2/en active Active
-
2011
- 2011-11-28 WO PCT/JP2011/077328 patent/WO2012077516A1/en active Application Filing
- 2011-11-28 CN CN201180059507.9A patent/CN103262029B/en active Active
Also Published As
Publication number | Publication date |
---|---|
CN103262029B (en) | 2015-10-14 |
CN103262029A (en) | 2013-08-21 |
JP2012123719A (en) | 2012-06-28 |
WO2012077516A1 (en) | 2012-06-14 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7434024B2 (en) | SIMD processor with register addressing, buffer stall and methods | |
US6813701B1 (en) | Method and apparatus for transferring vector data between memory and a register file | |
US6513107B1 (en) | Vector transfer system generating address error exception when vector to be transferred does not start and end on same memory page | |
KR101839479B1 (en) | Mode dependent partial width load to wider register processors, methods, and systems | |
JP4927840B2 (en) | Instruction cache with a fixed number of variable-length instructions | |
US7836253B2 (en) | Cache memory having pipeline structure and method for controlling the same | |
US8145804B2 (en) | Systems and methods for transferring data to maintain preferred slot positions in a bi-endian processor | |
JP2017538213A (en) | Method and apparatus for implementing and maintaining a stack of predicate values using stack synchronization instructions in an out-of-order hardware software co-design processor | |
JPH10228376A (en) | Method and program for processing multiple-register instruction | |
US10761844B2 (en) | Systems and methods to predict load data values | |
US20100100684A1 (en) | Set associative cache apparatus, set associative cache method and processor system | |
US20100318766A1 (en) | Processor and information processing system | |
WO1996008769A1 (en) | Computer instruction prefetch system | |
JP2008310693A (en) | Information processor | |
CN110554887A (en) | Indirect memory fetcher | |
CN110806900B (en) | Memory access instruction processing method and processor | |
JP5480793B2 (en) | Programmable controller | |
US7159078B2 (en) | Computer system embedding sequential buffers therein for performing a digital signal processing data access operation and a method thereof | |
US7290120B2 (en) | Microprocessor having a power-saving fetch and decoding unit for fetching and decoding compressed program instructions and having a program instruction sequencer | |
EP0706120A1 (en) | Method and system for memory addressing | |
JP2008257508A (en) | Cache control method, cache device, and microcomputer | |
US11003457B2 (en) | Power-saving mechanism for memory sub-system in pipelined processor | |
JP2877468B2 (en) | Electronic computer | |
JPH07200406A (en) | Cache system | |
JPH05173778A (en) | Data processor |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20121129 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20130604 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20130802 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20131119 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20140120 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20140204 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20140214 |
|
R150 | Certificate of patent or registration of utility model |
Ref document number: 5480793 Country of ref document: JP Free format text: JAPANESE INTERMEDIATE CODE: R150 |