JP7379932B2 - Control device, user program execution control method, and system program - Google Patents

Control device, user program execution control method, and system program Download PDF

Info

Publication number
JP7379932B2
JP7379932B2 JP2019152913A JP2019152913A JP7379932B2 JP 7379932 B2 JP7379932 B2 JP 7379932B2 JP 2019152913 A JP2019152913 A JP 2019152913A JP 2019152913 A JP2019152913 A JP 2019152913A JP 7379932 B2 JP7379932 B2 JP 7379932B2
Authority
JP
Japan
Prior art keywords
volatile memory
data
instruction
error
read
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
Application number
JP2019152913A
Other languages
Japanese (ja)
Other versions
JP2021033623A (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.)
Omron Corp
Original Assignee
Omron Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Omron Corp filed Critical Omron Corp
Priority to JP2019152913A priority Critical patent/JP7379932B2/en
Priority to PCT/JP2020/007778 priority patent/WO2021038923A1/en
Publication of JP2021033623A publication Critical patent/JP2021033623A/en
Application granted granted Critical
Publication of JP7379932B2 publication Critical patent/JP7379932B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B19/00Programme-control systems
    • G05B19/02Programme-control systems electric
    • G05B19/04Programme control other than numerical control, i.e. in sequence controllers or logic controllers
    • G05B19/048Monitoring; Safety
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/08Error detection or correction by redundancy in data representation, e.g. by using checking codes
    • G06F11/10Adding special bits or symbols to the coded information, e.g. parity check, casting out 9's or 11's
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/14Error detection or correction of the data by redundancy in operation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements 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/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Automation & Control Theory (AREA)
  • Retry When Errors Occur (AREA)
  • Stored Programmes (AREA)
  • Programmable Controllers (AREA)
  • Detection And Correction Of Errors (AREA)
  • Techniques For Improving Reliability Of Storages (AREA)

Description

本発明は、制御対象を制御するためにユーザプログラムを実行する制御装置と、当該制御装置におけるユーザプログラムの実行制御方法と、当該制御装置を実現するためのシステムプログラムに関する。 The present invention relates to a control device that executes a user program to control a controlled object, a method for controlling execution of a user program in the control device, and a system program for realizing the control device.

様々な製造現場において、PLC(Programmable Logic Controller)などの制御装置が導入されている。このような制御装置は、一種のコンピュータであり、RAM(Random Access Memory)などの揮発性メモリと、CPU(Central Processing Unit)などのプロセッサとを備える。揮発性メモリは、製造装置または製造設備などに応じて設計されたユーザプログラムを格納する。プロセッサは、揮発性メモリに格納されたユーザプログラムを構成する命令を順番に読み込み、逐次実行する。 Control devices such as PLCs (Programmable Logic Controllers) have been introduced at various manufacturing sites. Such a control device is a type of computer, and includes a volatile memory such as a RAM (Random Access Memory) and a processor such as a CPU (Central Processing Unit). The volatile memory stores a user program designed according to the manufacturing device or manufacturing equipment. A processor sequentially reads instructions constituting a user program stored in volatile memory and executes them sequentially.

揮発性メモリに格納されたユーザプログラムを実行する場合に、ユーザプログラムのデータが放射線の影響を受けて1ビット単位で破壊され、揮発性メモリにソフトエラーが発生することがある。このように、ユーザプログラムのデータが破壊されてソフトエラーが発生することがあるため、ソフトエラーの検出、および、検出したソフトエラーを修正する機能を制御装置に対して設けることが望まれている。 When executing a user program stored in a volatile memory, the data of the user program may be destroyed bit by bit due to the influence of radiation, and a soft error may occur in the volatile memory. In this way, data in the user program may be destroyed and soft errors may occur, so it is desired that the control device be provided with a function to detect and correct the detected soft errors. .

特開2004-220580号公報(特許文献1)は、ユーザプログラムが格納されるユーザプログラムメモリに加えて、ユーザプログラムメモリに格納されたユーザプログラムと同一内容のデータが格納されたバックアップメモリとを備えたプログラマブルコントローラ用ユニットを開示する。このプログラマブルコントローラ用ユニットは、バックアップメモリとユーザプログラムメモリの内容を比較することで異常を検知し、異常を検知した場合にユーザプログラムメモリに格納されたユーザプログラムをバックアップメモリに格納されたデータに基づいて修復する。 Japanese Unexamined Patent Application Publication No. 2004-220580 (Patent Document 1) discloses a system that includes, in addition to a user program memory in which a user program is stored, a backup memory in which data having the same contents as the user program stored in the user program memory is stored. A programmable controller unit is disclosed. This programmable controller unit detects an abnormality by comparing the contents of the backup memory and user program memory, and when an abnormality is detected, the user program stored in the user program memory is changed based on the data stored in the backup memory. and repair it.

特開2004-220580号公報Japanese Patent Application Publication No. 2004-220580

特許文献1に開示されたエラーの検知方法は、2つのメモリを互いに比較することでエラーを検知するため、比較結果を得るまでに時間がかかるという課題がある。 The error detection method disclosed in Patent Document 1 detects errors by comparing two memories with each other, so there is a problem that it takes time to obtain a comparison result.

本発明は、メモリに生じる誤りの検出および復元に要する時間を短縮することを目的とする。 An object of the present invention is to shorten the time required to detect and restore errors occurring in memory.

本開示の一例によれば、制御対象を制御するための制御装置が提供される。制御装置は、ユーザプログラムに含まれる命令を順次実行する命令実行部と、ユーザプログラムを格納する揮発性メモリと、揮発性メモリに格納されたユーザプログラムと同一内容のバックアップ用のユーザプログラムを格納するバックアップメモリと、所定の実行順序に従って、ユーザプログラムに含まれる命令を揮発性メモリから読み出して命令実行部へ提供するアクセス制御部とを含む。揮発性メモリは、誤り検出用の情報を付加してデータを格納するとともに、読み出し要求に応じて、指定された領域のデータ、および、指定された領域に対応する誤り検出用の情報に基づいて決定される指定された領域における誤りの発生有無、を応答するように構成されている。アクセス制御部は、揮発性メモリから命令を読み出した場合に、読み出した命令を格納していた領域に誤りが発生していることが揮発性メモリから応答されると、誤りが発生している領域のデータをバックアップメモリから揮発性メモリにロードしなおし、揮発性メモリから命令を再度読み出すように構成されている。 According to an example of the present disclosure, a control device for controlling a controlled object is provided. The control device includes an instruction execution unit that sequentially executes instructions included in the user program, a volatile memory that stores the user program, and a backup user program that has the same content as the user program stored in the volatile memory. It includes a backup memory and an access control section that reads instructions included in the user program from the volatile memory and provides them to the instruction execution section according to a predetermined execution order. Volatile memory stores data with error detection information added, and in response to a read request, reads data based on the data in a specified area and the error detection information corresponding to the specified area. The device is configured to respond with the presence or absence of an error in the determined designated area. When reading an instruction from volatile memory, if the volatile memory responds that an error has occurred in the area where the read instruction was stored, the access control unit reads the area where the error has occurred. The controller is configured to reload the data from the backup memory to the volatile memory and read the instructions again from the volatile memory.

本開示によれば、指定された領域の誤りの検出を誤り検出用の情報に基づいて誤りの発生有無が決定されるため、メモリ間を比較して誤りの発生を検知する場合に比べて、処理にかかる時間を短縮することができる。 According to the present disclosure, since the presence or absence of an error in a specified area is determined based on error detection information, compared to the case where the occurrence of an error is detected by comparing memories, The time required for processing can be shortened.

上述の開示において、揮発性メモリは、パリティチェックにより誤りの発生有無を応答するように構成されていてもよい。この構成によれば、1ビット単位の誤りを検知することができる。 In the above disclosure, the volatile memory may be configured to respond by parity check as to whether an error has occurred. According to this configuration, errors in 1-bit units can be detected.

上述の開示において、アクセス制御部は、命令実行部に命令を提供することを目的とした読み出しとは別に、揮発性メモリに格納されたデータを予め定められた順番に予め定められたタイミングで読み出し、読み出したデータを格納していた領域に誤りが発生していることが揮発性メモリから応答されると、バックアップメモリに格納されている命令を含むデータをバックアップメモリから揮発性メモリにロードしなおす。 In the above disclosure, the access control unit reads data stored in the volatile memory in a predetermined order at a predetermined timing, in addition to reading for the purpose of providing instructions to the instruction execution unit. When the volatile memory responds that an error has occurred in the area where the read data was stored, the data including instructions stored in the backup memory is reloaded from the backup memory to the volatile memory. .

この開示によれば、命令の実行順序によっては、呼び出される頻度が極めて低い命令にかかるデータに対しても、定期的に誤り検出と誤りの復元とが実行される。 According to this disclosure, error detection and error recovery are periodically performed on data related to instructions that are called extremely infrequently, depending on the execution order of the instructions.

上述の開示において、バックアップメモリは、バックアップ用のユーザプログラムを不揮発的に格納するメモリであってもよい。この場合に、揮発性メモリに格納されるユーザプログラムは、バックアップメモリからロードされる。 In the above disclosure, the backup memory may be a memory that non-volatilely stores a backup user program. In this case, the user program stored in volatile memory is loaded from backup memory.

この開示によれば、電断用のメモリをバックアップメモリに用いることができるため、バックアップメモリを別途用意する必要がなく、メモリ容量を削減することができる。 According to this disclosure, since the power-off memory can be used as a backup memory, there is no need to separately prepare a backup memory, and the memory capacity can be reduced.

上述の開示において、バックアップメモリは、バックアップ用のユーザプログラムを揮発的に格納するメモリであってもよい。アクセス制御部は、命令の実行に伴って揮発性メモリに格納されたデータの書き換えが必要な場合、揮発性メモリに格納されたデータおよびバックアップメモリに格納されたデータを書き換える。 In the above disclosure, the backup memory may be a memory that volatilely stores a backup user program. The access control unit rewrites the data stored in the volatile memory and the data stored in the backup memory when it is necessary to rewrite the data stored in the volatile memory due to execution of an instruction.

この開示によれば、揮発性メモリに格納されたデータに加えてバックアップメモリに格納されたデータを書き換えることで、データの書き換えが生じる命令を含むユーザプログラムのソフトエラーにも対応することができる。 According to this disclosure, by rewriting data stored in a backup memory in addition to data stored in a volatile memory, it is possible to cope with soft errors in user programs that include instructions that cause data to be rewritten.

本開示の別の一例によれば、制御対象を制御するための制御装置におけるユーザプログラムの実行制御方法が提供される。制御装置は、ユーザプログラムを格納する揮発性メモリと、揮発性メモリに格納されたユーザプログラムと同一内容のバックアップ用のユーザプログラムを格納するバックアップメモリとを含む。揮発性メモリは、誤り検出用の情報を付加してデータを格納するとともに、読み出し要求に応じて、指定された領域のデータ、および、指定された領域に対応する誤り検出用の情報に基づいて決定される指定された領域における誤りの発生有無、を応答するように構成されている。ユーザプログラムの実行制御方法は、所定の実行順序に従って、ユーザプログラムに含まれる命令を揮発性メモリから読み出すステップと、揮発性メモリから命令を読み出した場合に、読み出した命令を格納していた領域に誤りが発生していることが揮発性メモリから応答されると、誤りが発生している領域のデータをバックアップメモリから揮発性メモリにロードしなおし、揮発性メモリから命令を再度読み出すステップと、揮発性メモリから読み出した命令を実行するステップとを含む。 According to another example of the present disclosure, a method for controlling execution of a user program in a control device for controlling a controlled object is provided. The control device includes a volatile memory that stores a user program, and a backup memory that stores a backup user program having the same content as the user program stored in the volatile memory. Volatile memory stores data with error detection information added, and in response to a read request, reads data based on the data in a specified area and the error detection information corresponding to the specified area. The device is configured to respond with the presence or absence of an error in the determined designated area. A user program execution control method includes the steps of reading instructions included in a user program from volatile memory according to a predetermined execution order, and when reading instructions from volatile memory, the instructions are stored in the area where the read instructions were stored. When the volatile memory responds that an error has occurred, the steps of reloading the data in the area where the error has occurred from the backup memory to the volatile memory and rereading the instructions from the volatile memory; and executing the instructions read from the physical memory.

この開示によれば、指定された領域の誤りの検出を誤り検出用の情報に基づいて誤りの発生有無が決定されるため、メモリ間を比較して誤りの発生を検知する場合に比べて、処理にかかる時間を短縮することができる。 According to this disclosure, since the presence or absence of an error in a specified area is determined based on error detection information, compared to the case where the occurrence of an error is detected by comparing memories, The time required for processing can be shortened.

本開示のさらに別の一例によれば、制御対象を制御するための制御装置を実現するためのシステムプログラムが提供される。制御装置は、ユーザプログラムを格納する揮発性メモリと、揮発性メモリに格納されたユーザプログラムと同一内容のバックアップ用のユーザプログラムを格納するバックアップメモリとを含む。揮発性メモリは、誤り検出用の情報を付加してデータを格納するとともに、読み出し要求に応じて、指定された領域のデータ、および、指定された領域に対応する誤り検出用の情報に基づいて決定される指定された領域における誤りの発生有無、を応答するように構成されている。システムプログラムは制御装置のプロセッサに、所定の実行順序に従って、ユーザプログラムに含まれる命令を揮発性メモリから読み出すステップと、揮発性メモリから命令を読み出した場合に、読み出した命令を格納していた領域に誤りが発生していることが揮発性メモリから応答されると、誤りが発生している領域のデータをバックアップメモリから揮発性メモリにロードしなおし、揮発性メモリから命令を再度読み出すステップと、揮発性メモリから読み出した命令を実行するステップとを実行させる。 According to yet another example of the present disclosure, a system program for realizing a control device for controlling a controlled object is provided. The control device includes a volatile memory that stores a user program, and a backup memory that stores a backup user program having the same content as the user program stored in the volatile memory. Volatile memory stores data with error detection information added, and in response to a read request, reads data based on the data in a specified area and the error detection information corresponding to the specified area. The device is configured to respond with the presence or absence of an error in the determined designated area. The system program requires the processor of the control device to read the instructions included in the user program from volatile memory according to a predetermined execution order, and when the instructions are read from volatile memory, the area where the read instructions were stored. When the volatile memory responds that an error has occurred, reloading the data in the area where the error has occurred from the backup memory to the volatile memory, and rereading the instruction from the volatile memory; and executing the instructions read from the volatile memory.

この開示によれば、指定された領域の誤りの検出を誤り検出用の情報に基づいて誤りの発生有無が決定されるため、メモリ間を比較して誤りの発生を検知する場合に比べて、処理にかかる時間を短縮することができる。 According to this disclosure, since the presence or absence of an error in a specified area is determined based on error detection information, compared to the case where the occurrence of an error is detected by comparing memories, The time required for processing can be shortened.

本発明によれば、メモリに生じる誤りの検出および復元に要する時間を短縮することができる。 According to the present invention, the time required for detecting and restoring errors occurring in memory can be shortened.

本開示の適用例を模式的に説明するための図である。FIG. 2 is a diagram schematically illustrating an application example of the present disclosure. 制御装置100の構成を模式的に示した図である。1 is a diagram schematically showing the configuration of a control device 100. FIG. プロセッサ102が実行する処理の一例を説明するためのフローチャートである。3 is a flowchart for explaining an example of processing executed by the processor 102. FIG. プロセッサ102が実行する処理の変形例を示す。A modification of the processing executed by the processor 102 is shown. 図4に示した処理を実行したときのデータの読出/書込/復元の模式図である。FIG. 5 is a schematic diagram of reading/writing/restoring data when the process shown in FIG. 4 is executed. ログデータの一例を示す図である。It is a figure showing an example of log data.

以下、図面を参照しつつ、本発明に従う各実施の形態について説明する。以下の説明では、同一の部品および構成要素には同一の符号を付してある。それらの名称および機能も同じである。したがって、これらについての詳細な説明は繰り返さない。なお、以下で説明される各実施の形態および各変形例は、適宜選択的に組み合わせてもよい。 Hereinafter, each embodiment according to the present invention will be described with reference to the drawings. In the following description, the same parts and components are given the same reference numerals. Their names and functions are also the same. Therefore, detailed explanations thereof will not be repeated. Note that the embodiments and modifications described below may be selectively combined as appropriate.

§1.適用例
図1を参照して、本発明が適用される場面の一例について説明する。図1は、本開示の適用例を模式的に説明するための図である。図1を参照して、本開示に係る制御装置100Xは、例えば、PLC(プログラマブルコントローラ)と称される産業用のコントローラに相当し、図示しない各種の製造設備や機械を制御する。制御装置100Xによる制御においては、センサなどを用いて必要な情報を取得し、制御装置100Xで実行されるプログラムに従って、それらの取得された情報を用いて予め定められた制御演算を実行することで、制御出力を算出する。
§1. Application Example An example of a situation where the present invention is applied will be described with reference to FIG. FIG. 1 is a diagram for schematically explaining an application example of the present disclosure. Referring to FIG. 1, a control device 100X according to the present disclosure corresponds to, for example, an industrial controller called a PLC (programmable controller), and controls various manufacturing equipment and machines (not shown). In the control by the control device 100X, necessary information is acquired using sensors, etc., and predetermined control calculations are executed using the acquired information according to the program executed by the control device 100X. , calculate the control output.

制御装置100Xは、命令実行部202Xと、揮発性メモリ106Xと、バックアップメモリ110Xと、アクセス制御部204Xとを含む。 The control device 100X includes an instruction execution unit 202X, a volatile memory 106X, a backup memory 110X, and an access control unit 204X.

命令実行部202Xは、ユーザプログラム114に含まれる命令を順次実行する。ユーザプログラム114は、制御対象を制御することを目的として作成されたプログラム、制御装置100と通信可能な他の装置(たとえば、データベース、他の制御装置、HMI(Human Machine Interface)など)との間でデータの送受信を行うためのプログラムなど、任意のアプリケーションを実現するためのプログラムである。 The instruction execution unit 202X sequentially executes instructions included in the user program 114. The user program 114 is a program created for the purpose of controlling a controlled object, and is a program that is created for the purpose of controlling a controlled object, and is a program that is created for the purpose of controlling a controlled object. This is a program for implementing any application, such as a program for sending and receiving data.

アクセス制御部204Xは、所定の実行順序に従って、メインメモリ106からユーザプログラム114に含まれる命令を読み出して命令実行部202に提供する。 The access control unit 204X reads instructions included in the user program 114 from the main memory 106 and provides them to the instruction execution unit 202 in accordance with a predetermined execution order.

命令実行部202Xおよびアクセス制御部204Xは、たとえば、制御装置100のプロセッサが、制御装置の基本的な機能を実現するためのシステムプログラムを実行することで実現される機能である。なお、命令実行部202Xおよびアクセス制御部204Xの機能の一部または全部を、専用のハードウェア回路(例えば、ASIC(Application Specific Integrated Circuit)またはFPGA(Field-Programmable Gate Array)など)を用いて実装してもよい。たとえば、命令実行部202Xの機能を専用のハードウェア回路を用いて実装し、アクセス制御部204Xの機能を制御装置100Xのプロセッサがシステムプログラムを実行することで実現してもよい。 The instruction execution unit 202X and the access control unit 204X are functions realized, for example, by the processor of the control device 100 executing a system program for realizing the basic functions of the control device. Note that some or all of the functions of the instruction execution unit 202X and the access control unit 204X may be implemented using a dedicated hardware circuit (for example, an ASIC (Application Specific Integrated Circuit) or an FPGA (Field-Programmable Gate Array)). You may. For example, the function of the instruction execution unit 202X may be implemented using a dedicated hardware circuit, and the function of the access control unit 204X may be realized by the processor of the control device 100X executing a system program.

揮発性メモリ106Xは、ユーザプログラム114を揮発的に格納する。揮発性メモリ106Xに格納されたユーザプログラム114は、実行用のプログラムであって、ユーザデータ140である。 The volatile memory 106X stores the user program 114 in a volatile manner. The user program 114 stored in the volatile memory 106X is a program for execution and is user data 140.

バックアップメモリ110Xは、揮発性メモリ106Xに格納されたユーザプログラム114と同一内容のバックアップ用のユーザプログラム114であるバックアップデータ160を格納する。バックアップメモリ110Xは、揮発性のメモリであっても、不揮発性のメモリであってもよい。 The backup memory 110X stores backup data 160, which is a backup user program 114 having the same content as the user program 114 stored in the volatile memory 106X. Backup memory 110X may be volatile memory or nonvolatile memory.

バックアップデータ160は、ユーザデータ140が破壊された際に当該ユーザデータ140を復元するために利用される。たとえば、ユーザデータ140が宇宙線中性子などにより破壊された場合に、揮発性メモリ106Xにバックアップデータ160をロードしなおすことで、破壊されたデータを復元する。 The backup data 160 is used to restore the user data 140 when the user data 140 is destroyed. For example, if the user data 140 is destroyed by cosmic ray neutrons or the like, the destroyed data is restored by reloading the backup data 160 into the volatile memory 106X.

揮発性メモリ106Xは、誤り検出機能を搭載したメモリであって、具体的には、データ142を格納する際に、データ142に誤り検出用の情報(検出用情報144X)を付加して格納する。また、揮発性メモリ106Xは、読み出し要求に応じて、指定された領域のデータを出力する場合に、指定された領域に誤りの発生有無を合わせて出力する。誤りの発生有無は、検出用情報144Xに基づいて決定される。誤りの発生有無は、たとえば、従来から知られているパリティチェックに従って決定される。 The volatile memory 106X is a memory equipped with an error detection function, and specifically, when storing the data 142, it adds error detection information (detection information 144X) to the data 142 and stores it. . Further, when the volatile memory 106X outputs data in a designated area in response to a read request, it also outputs whether or not an error has occurred in the designated area. Whether or not an error has occurred is determined based on the detection information 144X. Whether or not an error has occurred is determined, for example, according to a conventionally known parity check.

アクセス制御部204Xは、読み出した命令を格納していた領域に誤りが発生していることが揮発性メモリ106Xから応答されると、誤りが発生している領域のデータについて、バックアップメモリ110Xから揮発性メモリ106Xにロードしなおす。アクセス制御部204Xは、ロードしなおした後、揮発性メモリ106Xから命令を再度読み出す。 When the volatile memory 106X responds that an error has occurred in the area where the read instruction was stored, the access control unit 204X transfers the data in the area where the error has occurred from the backup memory 110X to the volatile memory 110X. Reload the data into the physical memory 106X. After reloading, the access control unit 204X reads the instruction again from the volatile memory 106X.

このように、指定された領域の誤りの検出を誤り検出用の情報に基づいて誤りの発生有無が決定されるため、メモリ間を比較して誤りの発生を検知する場合に比べて、処理にかかる時間を短縮することができる。 In this way, the presence or absence of an error in a specified area is determined based on the error detection information, so the processing is faster than when detecting an error by comparing memories. The time required can be shortened.

また、データの誤りを検出する機能を備えた揮発性メモリは、市場に一般的に流通している。本開示に係る制御装置100Xは、このような一般的に流通している揮発性メモリ106Xを利用しつつ、誤りが発生している場合に揮発性メモリ106Xから命令を再度読み出す処理をプロセッサに実行させるように構成すればよく、容易に実現することが可能である。 Further, volatile memories equipped with a function of detecting data errors are generally available on the market. The control device 100X according to the present disclosure utilizes such a generally available volatile memory 106X and causes the processor to execute a process of re-reading instructions from the volatile memory 106X when an error occurs. It is possible to easily realize this by just configuring it so as to make it happen.

また、データの誤りをハードウェア的に検知し、かつ訂正する機能を有するメモリが存在するが、このようなメモリは高価である。本開示に係る制御装置100Xは、誤り検出機能のみを備えるメモリを利用することでも実現可能であるため、コストを抑えて実現することが可能である。 Furthermore, there are memories that have a function of detecting and correcting data errors using hardware, but such memories are expensive. The control device 100X according to the present disclosure can be realized by using a memory that only has an error detection function, so it can be realized at low cost.

なお、揮発性メモリ106Xは、データの誤りをハードウェア的に検知し、かつ訂正する機能を有するメモリであってもよい。この場合、たとえば、メモリによりデータの訂正ができない場合であっても、プロセッサの処理としてデータをロードしなおすように構成することで、メモリが備える訂正機能を補うことができる。 Note that the volatile memory 106X may be a memory having a function of detecting and correcting data errors using hardware. In this case, for example, even if data cannot be corrected by the memory, the correction function provided by the memory can be supplemented by configuring the data to be reloaded as a processor process.

また、本開示にかかる制御装置100Xは、命令を実行する前に、データをロードしなおすため、誤ったデータに従って命令が実行されることを防止することができる。 Furthermore, since the control device 100X according to the present disclosure reloads data before executing an instruction, it is possible to prevent the instruction from being executed according to incorrect data.

また、命令を実行した後に、誤ったデータをロードしなおす場合には、誤ったデータに従って命令を実行して更新される入出力データについてもバックアップをとっておくことが望まれる。これに対して、本開示にかかる制御装置100Xは、命令を実行する前に、誤ったデータをロードしなおすため、入出力データのバックアップを必ずしもとっておく必要がなく、メモリの削減をすることができる。 Further, when reloading erroneous data after executing an instruction, it is desirable to back up the input/output data that is updated by executing the instruction according to the erroneous data. In contrast, since the control device 100X according to the present disclosure reloads erroneous data before executing an instruction, it is not necessarily necessary to back up input/output data, and memory can be reduced. I can do it.

また、本開示に係る制御装置100Xは、データの読み出し要求に応じて、誤りの発生有無の応答がされる。そのため、ユーザプログラム114全体を実行した後に誤りの発生有無を行うような場合に比べてデータの誤りを早くに発見することができる。 Furthermore, in response to the data read request, the control device 100X according to the present disclosure responds to the presence or absence of an error. Therefore, data errors can be discovered earlier than in the case of checking whether an error has occurred after executing the entire user program 114.

なお、データを復元するタイミングは、誤りの発生有無の応答がされたときであってもよく、また、誤りの発生有無の応答がされたあと、当該誤りの発生有無にかかるデータの命令を実行するときであってもよい。 Note that the timing for restoring data may be when a response indicating whether an error has occurred is received, or after a response indicating whether an error has occurred, an instruction for the data related to whether an error has occurred may be executed. It may be time to do so.

また、誤りが発生している場合、誤りが発生しているデータのみをバックアップメモリ110Xからロードしなおしてもよく、また、読み出した命令単位でデータをバックアップメモリ110Xからロードしなおしてもよく、また、ユーザプログラム114全体をロードしなおすことで誤りが発生しているデータをロードしなおしてもよい。 Further, if an error has occurred, only the data in which the error has occurred may be reloaded from the backup memory 110X, or the data may be reloaded from the backup memory 110X in units of read instructions. Alternatively, data in which an error has occurred may be reloaded by reloading the entire user program 114.

なお、誤りが発生している場合にロードをしなおす場合、誤りが発生しているデータのみ、または、読み出した命令にかかるデータを読み出すようにした方が、ユーザプログラム114全体をロードしなおす場合に比べて、復元に要する時間を短縮することができる。 Note that when reloading when an error has occurred, it is better to read only the data where the error has occurred or the data related to the read instruction when reloading the entire user program 114. The time required for restoration can be reduced compared to

§2.具体例
<A.制御装置100の構成>
図2は、制御装置100の構成を模式的に示した図である。図2においては、制御装置100の中心的な処理を行う構成の一部を示している。
§2. Specific example <A. Configuration of control device 100>
FIG. 2 is a diagram schematically showing the configuration of the control device 100. In FIG. 2, a part of the configuration that performs central processing of the control device 100 is shown.

図2を参照して、制御装置100は、プロセッサ102、メインメモリ106およびフラッシュメモリ108を有する。プロセッサ102、メインメモリ106、およびフラッシュメモリ108は、ワンチップマイコンに搭載された形で制御装置100に設けられていてもよく、また、各々、別々に搭載された形で制御装置100に設けられていてもよい。 Referring to FIG. 2, control device 100 includes a processor 102, main memory 106, and flash memory 108. The processor 102, the main memory 106, and the flash memory 108 may be provided in the control device 100 in the form of being mounted on a one-chip microcomputer, or may be provided in the control device 100 in the form of being individually mounted. You can leave it there.

プロセッサ102は、フラッシュメモリ108に格納されたシステムプログラム112を直接実行することで、ユーザプログラム114をメインメモリ106に展開して順次実行する。プロセッサ102は、ユーザプログラム114を読み出して、メインメモリ106に展開して実行することで、制御対象に対する制御を実現する。なお、システムプログラム112をメインメモリ106に展開して実行するような構成であってもよいが、システムプログラム112がメインメモリ106に展開されることなく直接実行されることで、制御装置100を実現するための重要なプログラムが宇宙線中性子などの放射線の影響を受けて化けることを防止することができる。 By directly executing the system program 112 stored in the flash memory 108, the processor 102 expands the user program 114 into the main memory 106 and sequentially executes it. The processor 102 reads the user program 114, expands it to the main memory 106, and executes it, thereby realizing control over the controlled object. Note that the system program 112 may be configured to be expanded to the main memory 106 and executed, but the control device 100 may be implemented by directly executing the system program 112 without being expanded to the main memory 106. It is possible to prevent important programs that are needed for the program from being corrupted by the effects of radiation such as cosmic rays and neutrons.

フラッシュメモリ108は、不揮発性メモリであって、システムプログラム112およびユーザプログラム114を含む各種プログラムおよび、各種プログラムで利用される各種パラメータを保持する。本実施の形態において、フラッシュメモリ108は、メインメモリ106に展開される実行用のユーザプログラム114と同一内容のユーザプログラム114であるバックアップデータ160を格納するバックアップメモリとして機能する。 The flash memory 108 is a non-volatile memory and holds various programs including a system program 112 and a user program 114, and various parameters used by the various programs. In the present embodiment, the flash memory 108 functions as a backup memory that stores backup data 160 that is a user program 114 having the same content as the user program 114 for execution developed in the main memory 106 .

システムプログラム112は、ファームウェアであって、制御装置100を実現するためのプログラムである。ユーザプログラム114は、システムプログラム112以外のプログラムであって、たとえば、制御対象を制御することを目的として作成されたプログラム、制御装置100と通信可能な他の装置(たとえば、データベース、他の制御装置、HMIなど)との間でデータの送受信を行うためのプログラムなどを含み得る。 The system program 112 is firmware and is a program for realizing the control device 100. The user program 114 is a program other than the system program 112, for example, other devices that can be communicated with a program created for the purpose of controlling the control object, a database, other control device (for example, a database, other control device. , HMI, etc.).

なお、システムプログラム112、およびシステムプログラム112以外のユーザプログラム114などのデータを、互いに異なる不揮発性メモリに格納するように構成してもよい。この場合に、メインメモリ106に展開することなく直接実行されるシステムプログラム112は高速のフラッシュメモリに格納し、書き換え頻度の高いユーザプログラム114等のデータについては別の不揮発性メモリに格納してもよい。 Note that data such as the system program 112 and the user program 114 other than the system program 112 may be stored in different nonvolatile memories. In this case, the system program 112 that is executed directly without being expanded to the main memory 106 may be stored in a high-speed flash memory, and data such as the user program 114 that is frequently rewritten may be stored in another non-volatile memory. good.

メインメモリ106は、揮発性メモリであって、プロセッサ102がユーザプログラム114を実行するときの実行用のユーザデータ140を保持する。 Main memory 106 is a volatile memory and holds user data 140 for execution when processor 102 executes user program 114 .

なお、図2に記載していないものの、制御装置100は、他の装置と通信するためのインターフェイス、および、内部バスを通じて連結される機能ユニットとの間でデータを遣り取りするための内部バスコントローラ、メモリカードに格納されたデータの読み書きを行うためのメモリカードインターフェイスなどを備える。 Although not shown in FIG. 2, the control device 100 includes an interface for communicating with other devices, and an internal bus controller for exchanging data with functional units connected via an internal bus. It is equipped with a memory card interface for reading and writing data stored in the memory card.

制御装置100と連結される機能ユニットとしては、I/O(Input Output)ユニット、セーフティI/Oユニット、通信ユニット、モーションコントローラユニット、温度調整ユニット、パルスカウンタユニットなどを包含し得る。 Functional units connected to the control device 100 may include an I/O (Input Output) unit, a safety I/O unit, a communication unit, a motion controller unit, a temperature adjustment unit, a pulse counter unit, and the like.

また、制御装置100は、制御対象に関するセーフティ機能を実現するための制御演算を実行するセーフティユニットであってもよい。 Further, the control device 100 may be a safety unit that executes control calculations for realizing safety functions related to a controlled object.

<B.プロセッサおよびメインメモリの機能構成>
図2を参照して、プロセッサ102およびメインメモリ106の機能構成について説明する。プロセッサ102は、命令実行部202と、アクセス制御部204と、レジスタ206と、アクセスインターフェイス220とを含む。
<B. Functional configuration of processor and main memory>
The functional configuration of processor 102 and main memory 106 will be described with reference to FIG. 2. Processor 102 includes an instruction execution unit 202, an access control unit 204, a register 206, and an access interface 220.

命令実行部202は、演算器であって、1または複数の演算回路から構成されている。命令実行部202は、メインメモリ106から読み込んだ命令を実行する。 The instruction execution unit 202 is an arithmetic unit, and is composed of one or more arithmetic circuits. The instruction execution unit 202 executes instructions read from the main memory 106.

アクセス制御部204は、システムプログラム112が実行されることで実現される機能であって、アクセスインターフェイス220を制御することで、プロセッサ102とフラッシュメモリ108とメインメモリ106との間のデータの遣り取りを制御することで、所定の実行順序に従って、ユーザプログラム114に含まれる命令をメインメモリ106から読み出して命令実行部202へ提供する。 The access control unit 204 is a function realized by executing the system program 112, and controls the access interface 220 to exchange data between the processor 102, flash memory 108, and main memory 106. Under the control, instructions included in the user program 114 are read from the main memory 106 and provided to the instruction execution unit 202 in accordance with a predetermined execution order.

レジスタ206は、エラーアドレスレジスタ208と、エラーステータスレジスタ210と、命令レジスタ212とを含み得る。プロセッサ102は、他の種類のレジスタをさらに備えていてもよい。 Registers 206 may include an error address register 208, an error status register 210, and an instruction register 212. Processor 102 may further include other types of registers.

エラーアドレスレジスタ208は、メインメモリ106内においてソフトエラーの発生しているエリア(アドレス)を保持する。 The error address register 208 holds an area (address) in the main memory 106 where a soft error has occurred.

エラーステータスレジスタ210は、メインメモリ106内においてソフトエラーが発生している状態にあることを保持する。 The error status register 210 holds that a soft error has occurred in the main memory 106.

命令レジスタ212は、命令実行部202が実行する命令を保持する。プロセッサ102は、命令レジスタ212を複数備えてもよい。 The instruction register 212 holds instructions executed by the instruction execution unit 202. Processor 102 may include multiple instruction registers 212.

アクセスインターフェイス220は、アクセス制御部204の指示に従って制御され、メインメモリ106およびフラッシュメモリ108との間でデータの遣り取りを行う。 The access interface 220 is controlled according to instructions from the access control unit 204 and exchanges data between the main memory 106 and the flash memory 108.

メインメモリ106は、アドレスデコーダ602と、メモリセル604と、読出/書込回路606と、パリティチェック回路610とを備える。 Main memory 106 includes address decoder 602, memory cells 604, read/write circuit 606, and parity check circuit 610.

アドレスデコーダ602は、アドレスバス402を介してプロセッサ102に接続されている。アドレスデコーダ602は、アドレスバス402上に出力された信号をデコードすることでアドレスを特定し、メモリセル604のうち特定したアドレスのセルを活性化させる。アドレスデコーダ602によってデコードされた結果は、パリティチェック回路610に出力される。 Address decoder 602 is connected to processor 102 via address bus 402. The address decoder 602 specifies the address by decoding the signal output on the address bus 402, and activates the cell at the specified address among the memory cells 604. The result decoded by address decoder 602 is output to parity check circuit 610.

メモリセル604には、実行用のユーザプログラム114であるユーザデータ140が格納される。メモリセル604には、データ142が誤り検出用の情報としてパリティビット144が付加された状態で格納される。 Memory cell 604 stores user data 140, which is user program 114 for execution. Data 142 is stored in memory cell 604 with parity bit 144 added as information for error detection.

読出/書込回路606は、コントロールバス404およびデータバス406を介してプロセッサ102に接続されている。読出/書込回路606は、コントロールバス404からの制御信号に応じて、メモリセル604に対し、データの読み出しまたは書き込みを行う。 Read/write circuit 606 is connected to processor 102 via control bus 404 and data bus 406. Read/write circuit 606 reads or writes data to memory cell 604 in response to a control signal from control bus 404 .

読出/書込回路606は、パリティ生成回路608を有する。パリティ生成回路608は、データバス406を介して送信されたデータ142からパリティビット144を生成する。読出/書込回路606は、データの書き込みを行う場合、アドレスデコーダ602によって活性化されたセルに、パリティ生成回路608が生成したパリティビット144を付加して、データバス406を介して送られたデータ142を格納する。 Read/write circuit 606 has parity generation circuit 608. Parity generation circuit 608 generates parity bits 144 from data 142 transmitted via data bus 406 . When writing data, the read/write circuit 606 adds a parity bit 144 generated by the parity generation circuit 608 to the cell activated by the address decoder 602 and sends the cell via the data bus 406. Data 142 is stored.

読出/書込回路606は、データの読み出しを行う場合、アドレスデコーダ602によって活性化されたセルに格納されたデータ(データ142およびパリティビット144)を読み出し、データバス406に出力する。また、読出/書込回路606は、読み出したデータ(データ142およびパリティビット144)をパリティチェック回路610に出力する。なお、読出/書込回路606は、データバス406にデータ142だけを出力するようにしてもよい。 When reading data, read/write circuit 606 reads data (data 142 and parity bit 144) stored in cells activated by address decoder 602 and outputs it to data bus 406. Further, read/write circuit 606 outputs the read data (data 142 and parity bit 144) to parity check circuit 610. Note that the read/write circuit 606 may output only the data 142 to the data bus 406.

パリティチェック回路610は、エラーバス408を介してプロセッサ102に接続されている。パリティチェック回路610は、読出/書込回路606から出力されたデータに誤りが発生しているか否かをパリティチェックによりチェックする。たとえば、書き込み時のデータ142が、宇宙線中性子などにより破壊される場合、1ビット単位で破壊される。パリティビット144が付与されたデータ142が宇宙線中性子により2ビット以上破壊される可能性は低いため、パリティチェックをすることで宇宙線中性子により破壊されているか否かを検知することができる。なお、パリティチェックの方法について、従来技術であるため、詳細な説明は省略する。 Parity check circuit 610 is connected to processor 102 via error bus 408. Parity check circuit 610 checks whether an error has occurred in the data output from read/write circuit 606 by performing a parity check. For example, if the data 142 at the time of writing is destroyed by cosmic ray neutrons or the like, it will be destroyed bit by bit. Since it is unlikely that two or more bits of the data 142 to which the parity bit 144 has been added will be destroyed by cosmic ray neutrons, it is possible to detect whether the data 142 has been destroyed by cosmic ray neutrons by performing a parity check. Note that since the parity check method is a conventional technique, a detailed explanation will be omitted.

パリティチェック回路610は、データ誤りの発生有無と、アドレスデコーダ602から出力されたアドレス(パリティチェックをしたセルのアドレス)とをエラーバス408に出力する。なお、パリティチェック回路610は、データ誤りが発生している場合にのみ、データ誤りの発生と、アドレスとをエラーバス408に出力するようにしてもよい。 The parity check circuit 610 outputs to the error bus 408 whether or not a data error has occurred and the address output from the address decoder 602 (the address of the cell subjected to the parity check). Note that the parity check circuit 610 may output the occurrence of a data error and the address to the error bus 408 only when a data error has occurred.

なお、図2に示した構成は一例であって、データ誤りを検出するための回路を有する揮発性メモリであれば、図2に示した構成に限られない。また、データ誤りを検出する方法は、パリティチェックに限られず、任意の方法を適用可能である。 Note that the configuration shown in FIG. 2 is an example, and the configuration is not limited to that shown in FIG. 2 as long as the volatile memory has a circuit for detecting data errors. Furthermore, the method for detecting data errors is not limited to parity checking, and any method can be applied.

プロセッサ102とフラッシュメモリ108とは、アドレスバス410、コントロールバス412、およびデータバス414を介して接続されている。プロセッサ102は、これらのバスを介してシステムプログラム112を実行する。また、プロセッサ102は、これらのバスを介して、適宜、フラッシュメモリ108からプログラムをメインメモリ106に展開して、ユーザプログラム114を実行する。 Processor 102 and flash memory 108 are connected via address bus 410, control bus 412, and data bus 414. Processor 102 executes system programs 112 via these buses. Further, the processor 102 appropriately loads programs from the flash memory 108 into the main memory 106 via these buses, and executes the user program 114.

<プロセッサの処理>
図3は、プロセッサ102が実行する処理の一例を説明するためのフローチャートである。以下では、ステップは、単に「S」と記載する。図3に示すフローチャートは、プロセッサ102がシステムプログラム112を実行することで実現される。図3に示すフローチャートは、制御装置100に電源が供給されると実行される。
<Processor processing>
FIG. 3 is a flowchart for explaining an example of processing executed by the processor 102. Hereinafter, a step will be simply written as "S". The flowchart shown in FIG. 3 is realized by the processor 102 executing the system program 112. The flowchart shown in FIG. 3 is executed when power is supplied to the control device 100.

S102において、プロセッサ102は、ユーザプログラム114をメインメモリ106に展開する。S102の処理により、メインメモリ106のメモリセル604にパリティビット144を付加したデータ142が格納される。 In S102, the processor 102 loads the user program 114 into the main memory 106. Through the process of S102, the data 142 with the parity bit 144 added is stored in the memory cell 604 of the main memory 106.

S104において、プロセッサ102は、実行対象の命令をメインメモリ106からフェッチする。より具体的には、アクセスインターフェイス220は、アクセス制御部204の指示に従って、実行対象の命令に対応するデータが格納されたアドレスをアドレスバス402に出力し、コントロールバス404に読み出しを要求する信号を出力する。 In S104, the processor 102 fetches an instruction to be executed from the main memory 106. More specifically, the access interface 220 outputs an address in which data corresponding to an instruction to be executed is stored to the address bus 402 according to instructions from the access control unit 204, and sends a signal requesting readout to the control bus 404. Output.

メインメモリ106は、プロセッサ102からの読み出し要求に対して、指定されたアドレスのデータ142と、当該指定されたアドレスのデータ142に対するパリティチェックの結果とを出力することで応答する。具体的には、アドレスデコーダ602は、アドレスバス402に出力されたアドレスのセルを活性化させ、また、アドレスをパリティチェック回路610に出力する。読出/書込回路606は、読み出しを要求する信号を受けて、活性化されているセルのデータ142およびパリティビット144をデータバス406と、パリティチェック回路610とに出力する。パリティチェック回路610は、データ142およびパリティビット144に基づいて、データ142の誤りの有無をチェックし、チェック結果と、チェックしたデータ142のアドレスとをエラーバス408に出力する。 The main memory 106 responds to the read request from the processor 102 by outputting data 142 at a designated address and a parity check result for the data 142 at the designated address. Specifically, address decoder 602 activates the cell of the address output to address bus 402 and outputs the address to parity check circuit 610. Read/write circuit 606 receives a signal requesting reading and outputs data 142 and parity bit 144 of activated cells to data bus 406 and parity check circuit 610. Parity check circuit 610 checks data 142 for errors based on data 142 and parity bit 144, and outputs the check result and the address of checked data 142 to error bus 408.

データバス406を介して送られたデータ142は、命令レジスタ212に格納される。エラーバス408を介して送られたデータのうちのチェックしたデータ142のアドレスは、エラーアドレスレジスタ208に格納される。エラーバス408を介して送られたデータのうちのチェック結果は、エラーステータスレジスタ210に格納される。 Data 142 sent via data bus 406 is stored in instruction register 212. The address of the checked data 142 of the data sent via the error bus 408 is stored in the error address register 208. The check results of the data sent via the error bus 408 are stored in the error status register 210.

S106において、プロセッサ102は、エラーがあるか否かを判定する。具体的には、プロセッサ102は、エラーステータスレジスタ210に格納されたチェック結果に基づいて判定する。 In S106, the processor 102 determines whether there is an error. Specifically, the processor 102 makes the determination based on the check result stored in the error status register 210.

エラーがあると判定された場合(S106においてYES)、S108において、プロセッサ102は、データを復元する。具体的には、アクセス制御部204は、エラーアドレスレジスタ208に格納されているアドレスのデータをフラッシュメモリ108からメインメモリ106に再度ロードするようにアクセスインターフェイス220を制御する。 If it is determined that there is an error (YES in S106), the processor 102 restores the data in S108. Specifically, the access control unit 204 controls the access interface 220 to reload the data at the address stored in the error address register 208 from the flash memory 108 to the main memory 106.

たとえば、アクセス制御部204は、エラーアドレスレジスタ208に格納されているアドレスに基づいて、当該アドレスのデータが格納されたフラッシュメモリ108内のアドレスを特定する。アクセスインターフェイス220は、アクセス制御部204の指示に従って、特定されたアドレスをアドレスバス410に、読み出しを要求する信号をコントロールバス412に出力する。 For example, based on the address stored in the error address register 208, the access control unit 204 identifies the address in the flash memory 108 where data at the address is stored. The access interface 220 outputs the specified address to the address bus 410 and a read request signal to the control bus 412 in accordance with instructions from the access control unit 204.

そして、アクセスインターフェイス220は、アクセス制御部204の指示に従って、復元対象のデータ142が格納されたアドレスをアドレスバス402に、フラッシュメモリ108が読み出し要求に応じて出力したデータをデータバス406に、書き込みを要求する信号をコントロールバス404に、それぞれ出力する。 Then, the access interface 220 writes the address where the data 142 to be restored is stored to the address bus 402 and the data output by the flash memory 108 in response to the read request to the data bus 406 in accordance with the instruction from the access control unit 204. A signal requesting the same is output to the control bus 404, respectively.

メインメモリ106は、プロセッサ102からの書き込みを要求する信号を受けて、アドレスバス402を介して指定されたアドレスに、データバス406を介して送られたデータ142およびパリティビット144が書き込まれる。これにより、誤りのあるデータが、復元されることとなる。 Main memory 106 receives a write request signal from processor 102 and writes data 142 and parity bit 144 sent via data bus 406 to an address specified via address bus 402 . As a result, the erroneous data will be restored.

S110において、プロセッサ102は、エラーアドレスレジスタ208とエラーステータスレジスタ210のデータをクリアする。プロセッサ102は、S110の処理を実行した後、再度S104およびS106の処理を実行し、データが復元されたことでパリティエラーが解消されたことを確認する。 In S110, the processor 102 clears the data in the error address register 208 and error status register 210. After executing the process in S110, the processor 102 executes the processes in S104 and S106 again, and confirms that the parity error has been resolved by restoring the data.

図3に示す例では、エラーがないと判定されるまで、S108およびS110の処理を繰り返すものとしている。なお、S108およびS110の処理を所定回数繰り返し実行した場合には、ユーザプログラム114の実行を停止して、エラーをユーザに対して通知するようにしてもよい。 In the example shown in FIG. 3, the processes of S108 and S110 are repeated until it is determined that there is no error. Note that when the processes of S108 and S110 are repeatedly executed a predetermined number of times, the execution of the user program 114 may be stopped and the error may be notified to the user.

また、本実施の形態において、エラーバス408を介して送られたデータは、エラーアドレスレジスタ208とエラーステータスレジスタ210とに格納されるとした。なお、エラーバス408を介して送られたデータに基づいてエラーがあるか否かを判定し、エラーがある場合に、エラーアドレスレジスタ208とエラーステータスレジスタ210とにデータを格納するようにしてもよい。 Further, in this embodiment, data sent via the error bus 408 is stored in the error address register 208 and the error status register 210. Note that it is also possible to determine whether or not there is an error based on the data sent via the error bus 408, and to store the data in the error address register 208 and error status register 210 if there is an error. good.

エラーがないと判定された場合(S106においてNO)、S112において、プロセッサ102は、フェッチした命令を実行する。具体的には、プロセッサ102の命令実行部202は、命令レジスタ212に格納されたデータ142が示す命令を実行する。 If it is determined that there is no error (NO in S106), the processor 102 executes the fetched instruction in S112. Specifically, the instruction execution unit 202 of the processor 102 executes the instruction indicated by the data 142 stored in the instruction register 212.

S114において、プロセッサ102は、ユーザプログラム114を1サイクル分実行したか否かを判定する。ユーザプログラム114を1サイクル分実行していないと判定された場合(S114においてNO)、プロセッサ102は、S126に処理を切り替える。 In S114, the processor 102 determines whether the user program 114 has been executed for one cycle. If it is determined that the user program 114 has not been executed for one cycle (NO in S114), the processor 102 switches the process to S126.

ユーザプログラム114を1サイクル分実行したと判定された場合(S114においてYES)、S116において、プロセッサ102は、データ142をダミーでメインメモリ106からフェッチする。 If it is determined that the user program 114 has been executed for one cycle (YES in S114), the processor 102 fetches dummy data 142 from the main memory 106 in S116.

S118,120,122の処理は、S106,108,110の処理と共通するため、説明を省略する。 The processing in S118, 120, and 122 is the same as the processing in S106, 108, and 110, so the description thereof will be omitted.

S118においてエラーがないと判定された場合、または、S120およびS122の処理が実行された後、S124において、プロセッサ102は、ダミーで読み出すアドレスを更新する。具体的には、プロセッサ102は、命令の実行結果に関わらず、アドレスを順次更新し、S118からS124の処理を繰り返すことで、ユーザプログラム114を複数サイクル実行したときに、メモリセル604内の全てのデータ142を少なくとも1度は読み出す。すなわち、プロセッサ102は、メモリセル604に格納されたデータを予め定められた順で読み出されるように、ダミーで読み出すアドレスを更新する。 If it is determined in S118 that there is no error, or after the processes in S120 and S122 are executed, in S124, the processor 102 updates the dummy read address. Specifically, the processor 102 sequentially updates the addresses regardless of the instruction execution result and repeats the processing from S118 to S124, so that when the user program 114 is executed for multiple cycles, all of the memory cells 604 are updated. The data 142 is read out at least once. That is, the processor 102 updates the dummy read address so that the data stored in the memory cell 604 is read out in a predetermined order.

S126において、プロセッサ102は、S112において実行した命令の結果に応じて、次に実行する命令が格納されたアドレスを特定する。プロセッサ102は、S104~S126の処理を繰り返すことで、ユーザプログラム114を実行する。 In S126, the processor 102 identifies the address where the next instruction to be executed is stored, depending on the result of the instruction executed in S112. The processor 102 executes the user program 114 by repeating the processing from S104 to S126.

ユーザプログラム114を構成する命令の中には、実行頻度の低いものも存在する。S116~S124の処理を実行しなかった場合には、実行頻度の低い命令を実行するためのデータについては、長期間に亘ってチェックされないこととなる。また、パリティチェックは、1ビットの誤りしか検出することができない。そのため、長期間に亘ってチェックされることなく放置されて2ビット以上の破壊が生じている場合、当該破壊を検出することができない。 Some of the instructions making up the user program 114 are executed less frequently. If the processes from S116 to S124 are not executed, data for executing instructions that are executed infrequently will not be checked for a long period of time. Furthermore, parity check can only detect a 1-bit error. Therefore, if two or more bits are destroyed due to being left unchecked for a long period of time, the destruction cannot be detected.

本実施の形態においては、S116~S124が繰り返し実行されることで、メインメモリ106に格納されたデータ142が少なくとも1度は読み出されることになるため、実行頻度の低い命令を実行するためのデータが長期間に亘ってチェックされることなく放置されてしまうことを防止することができる。 In this embodiment, by repeatedly executing steps S116 to S124, the data 142 stored in the main memory 106 is read out at least once. can be prevented from being left unchecked for a long period of time.

なお、命令の実行とは別にデータの読み出しをするタイミングは、ユーザプログラム114を1サイクル分実行した後としたが(S116)、これに限られない。命令の実行とは別にデータの読み出しをするタイミングは、たとえば、ユーザプログラム114を複数サイクル分実行した後であってもよく、また、複数の命令を実行した後であってもよい。また、制御装置100に複数のプロセッサが搭載されている場合には、命令の実行とは別にデータの読み出しをするタイミングは、ユーザプログラム114の実行中であってもよい。また、S116において読み出すデータの量は、任意であり、限定されるものではない。 Note that the timing at which data is read separately from the instruction execution is after the user program 114 has been executed for one cycle (S116), but is not limited to this. The timing for reading data separately from the execution of an instruction may be, for example, after the user program 114 has been executed for a plurality of cycles, or after a plurality of instructions have been executed. Further, when the control device 100 is equipped with a plurality of processors, the timing for reading data separately from the execution of instructions may be during the execution of the user program 114. Further, the amount of data read in S116 is arbitrary and not limited.

<変形例>
(変形例1)
上記実施の形態においては、データの復元に用いるバックアップデータ160を保持するメモリは、不揮発性メモリであるフラッシュメモリ108とした。すなわち、上記実施の形態においては、フラッシュメモリ108のような不揮発性メモリに格納された電断保持用のデータを、バックアップ用のデータとして用いた。そのため、新たにバックアップ用のデータを用意する必要がなく、メモリを削減することができる。
<Modified example>
(Modification 1)
In the embodiment described above, the memory that holds the backup data 160 used for restoring data is the flash memory 108, which is a nonvolatile memory. That is, in the embodiment described above, data for maintaining power outage stored in a nonvolatile memory such as the flash memory 108 is used as backup data. Therefore, there is no need to newly prepare data for backup, and memory can be reduced.

なお、バックアップデータ160は、電断保持用のデータとは別に保持されていてもよい。たとえば、バックアップデータ160は、メインメモリ106のような揮発性メモリに、ユーザデータ140とは別に格納されていてもよい。プロセッサ102からのアクセスがフラッシュメモリ108に比べて早い揮発性メモリにバックアップデータ160を格納することで、復元にかかる時間を短縮することができる。バックアップデータ160は、メインメモリ106に格納されてもよく、また、メインメモリ106とは異なる別の揮発性メモリに格納されてもよい。 Note that the backup data 160 may be held separately from the data for holding power outage. For example, backup data 160 may be stored separately from user data 140 in volatile memory, such as main memory 106. By storing the backup data 160 in a volatile memory that is faster to access from the processor 102 than the flash memory 108, the time required for restoration can be shortened. Backup data 160 may be stored in main memory 106 or may be stored in another volatile memory different from main memory 106.

なお、バックアップデータ160を保持するメモリを揮発性メモリとする場合、プロセッサ102は、ユーザプログラム114をメインメモリ106に展開する際に、バックアップデータ160を保持するメモリにもユーザプログラム114を読み出す。 Note that when the memory that holds the backup data 160 is a volatile memory, the processor 102 also reads the user program 114 into the memory that holds the backup data 160 when expanding the user program 114 to the main memory 106.

<変形例2>
上記実施の形態においては、命令の実行に伴ってユーザプログラム114のデータが更新されることについて言及しなかった。なお、ユーザプログラム114によっては、命令の実行に伴って、ユーザプログラム114のデータが動的に変化することもある。このような場合には、バックアップデータ160についても、実行用のデータと同様に更新されるように構成することが好ましい。
<Modification 2>
In the above embodiments, no mention was made of updating the data of the user program 114 with the execution of instructions. Note that depending on the user program 114, the data of the user program 114 may change dynamically as instructions are executed. In such a case, it is preferable to configure the backup data 160 to be updated in the same way as the execution data.

ユーザプログラム114の実行に伴いデータを更新する場合、バックアップデータ160へのアクセス回数が増える。そのため、ユーザプログラム114が動的に変化する場合は、電断保持用のデータとは別に揮発性メモリにバックアップデータ160を格納しておくことが好ましい。 When updating data as the user program 114 is executed, the number of accesses to the backup data 160 increases. Therefore, when the user program 114 changes dynamically, it is preferable to store the backup data 160 in a volatile memory separately from the data for maintaining power outage.

図4は、プロセッサ102が実行する処理の変形例を示す。図4において、図3と共通する処理には共通のステップ番号を付す。図4に示す処理は、新たにS103、S113-1およびS113-2の処理を、S108およびS120の代わりにS108’およびS120’の処理を実行する点で図3に示す処理と異なる。以下では、図3に示す処理と異なる処理を中心に説明する。 FIG. 4 shows a modification of the processing executed by the processor 102. In FIG. 4, common step numbers are assigned to processes common to those in FIG. 3. The process shown in FIG. 4 differs from the process shown in FIG. 3 in that the processes in S103, S113-1, and S113-2 are newly executed, and the processes in S108' and S120' are newly executed in place of S108 and S120. Below, processing that is different from the processing shown in FIG. 3 will be mainly explained.

S103において、プロセッサ102は、バックアップデータ160をメインメモリに格納する。すなわち、プロセッサ102は、メインメモリ106のメモリセル604に、ユーザデータ140と、当該ユーザデータ140と同じバックアップデータ160とを格納する。 In S103, the processor 102 stores the backup data 160 in the main memory. That is, the processor 102 stores the user data 140 and the same backup data 160 as the user data 140 in the memory cell 604 of the main memory 106 .

S108’の処理は、S108の処理と比べて、再度ロードするときに参照するデータが、フラッシュメモリ108に格納されたデータではなく、メインメモリ106に格納されているバックアップデータ160である点が異なる(図5参照)。S120’の処理とS120の処理との違いは、S108’の処理とS108の処理との違いと共通する。 The processing in S108' differs from the processing in S108 in that the data referred to when reloading is not the data stored in the flash memory 108 but the backup data 160 stored in the main memory 106. (See Figure 5). The difference between the processing at S120' and the processing at S120 is the same as the difference between the processing at S108' and the processing at S108.

S113-1において、プロセッサ102は、データの変更があるか否かを判定する。データの変更がある場合には、データを書き換える必要がある。すなわち、データの変更があるか否かを判定することで、データを書き換える必要があるか否かが判定される。具体的には、プロセッサ102は、S112において実行した命令の結果、データの変更が生じたか否かを判定する。 In S113-1, the processor 102 determines whether there is a change in data. If there is a change in data, it is necessary to rewrite the data. That is, by determining whether there is a change in the data, it is determined whether the data needs to be rewritten. Specifically, the processor 102 determines whether data has been changed as a result of the instruction executed in S112.

データの変更がある場合(S113-1においてYES)、すなわち、データを書き換える必要がある場合、プロセッサ102は、S113-2において、ユーザデータ140とバックアップデータ160とを書き換える。データの変更がない場合(S113-1においてNO)、すなわち、データを書き換える必要がない場合、プロセッサ102は、S113-2の処理を実行することなく、S114以降の処理を実行する。 If there is a data change (YES in S113-1), that is, if the data needs to be rewritten, the processor 102 rewrites the user data 140 and backup data 160 in S113-2. If there is no data change (NO in S113-1), that is, if there is no need to rewrite the data, the processor 102 executes the processes from S114 onwards without executing the process of S113-2.

図5は、図4に示した処理を実行したときのデータの読出/書込/復元の模式図である。メモリセル604には、実行用のユーザデータ140と、バックアップデータ160とがそれぞれ格納されている。書き込み時は、ユーザデータ140およびバックアップデータ160の双方にデータが書き込まれる(図4のS113-2)。データを復元する場合は、バックアップデータ160を用いてユーザデータ140のデータを復元する(図4のS108’、S120’)。また、データを読み出す時は、ユーザデータ140から読み出され、バックアップデータ160からは読み出されない(図4のS104)。 FIG. 5 is a schematic diagram of data read/write/restore when the process shown in FIG. 4 is executed. The memory cell 604 stores user data 140 for execution and backup data 160, respectively. At the time of writing, data is written to both the user data 140 and the backup data 160 (S113-2 in FIG. 4). When restoring data, the user data 140 is restored using the backup data 160 (S108', S120' in FIG. 4). Furthermore, when reading data, it is read from the user data 140 and not from the backup data 160 (S104 in FIG. 4).

なお、バックアップデータ160が破壊されることも考えられるが、ユーザデータ140とバックアップデータ160とについて、共通のデータが両方とも破壊される確率は極めて低い。そのため、バックアップデータ160が破壊されることを考慮する必要性は低い。 Although it is possible that the backup data 160 may be destroyed, the probability that common data between the user data 140 and the backup data 160 will be destroyed is extremely low. Therefore, there is little need to consider that the backup data 160 will be destroyed.

なお、バックアップデータ160とユーザデータ140とを共通のメインメモリ106に格納する例を示したが、バックアップデータ160を格納するための揮発性メモリを別途設けてもよい。 Note that although an example has been shown in which the backup data 160 and the user data 140 are stored in the common main memory 106, a volatile memory for storing the backup data 160 may be provided separately.

また、S116~S124の処理を実行することで、命令の実行とは別にユーザデータ140だけをチェックするようにしてもよく、ユーザデータ140に加えてバックアップデータ160についてもチェックするようにしてもよい。 Furthermore, by executing the processes of S116 to S124, only the user data 140 may be checked separately from the execution of the command, or the backup data 160 may also be checked in addition to the user data 140. .

また、S108’およびS120’においてデータの復元をする場合に、プロセッサ102は、バックアップデータ160のデータについてもチェックするようにし、エラーがある場合には、復元することができないとしてエラーを通知するように構成してもよい。 Further, when restoring data in S108' and S120', the processor 102 also checks the data in the backup data 160, and if there is an error, notifies the user that the data cannot be restored. It may be configured as follows.

<変形例3>
上記実施の形態においては、パリティチェックをした結果、エラーとなった場合は、単にデータを復元するに留めたが、プロセッサ102は、エラーの情報をログとして残しても良い。
<Modification 3>
In the above embodiment, if an error occurs as a result of the parity check, the data is simply restored, but the processor 102 may leave error information as a log.

図6は、ログデータの一例を示す図である。プロセッサ102は、エラーが発生した場合に、エラーを検出した日と、エラーとなったデータが格納されているアドレスと、復元前のデータ142と、復元後のデータ142とをログデータ180として残す。 FIG. 6 is a diagram showing an example of log data. When an error occurs, the processor 102 records the date on which the error was detected, the address where the data in error is stored, the data 142 before restoration, and the data 142 after restoration as log data 180. .

なお、プロセッサ102は、バックアップデータ160を残していないデータに対してエラーが検知された場合においても、当該エラーが検知された日時と、エラーが発生したデータと、当該データが格納されているアドレスとをログデータとして残しても良い。 Note that even if an error is detected for data for which the backup data 160 is not left, the processor 102 stores the date and time when the error was detected, the data in which the error occurred, and the address where the data is stored. may be left as log data.

このように、ログデータ180を残すことで、ユーザは、ログデータ180を確認することで、パリティチェックエラーが発生している頻度、発生原因などを解析することができる。 By leaving the log data 180 in this way, the user can analyze the frequency of occurrence of parity check errors, the cause of their occurrence, etc. by checking the log data 180.

<その他の変形例>
上記実施の形態において、誤りの発生有無を決定する方法は、パリティチェックによる方法とした。これは、市場に流通している誤り検出機能付きの揮発性メモリは、誤りの発生有無の決定をパリティチェックにより実現していることが多いため、誤りの発生有無を決定する方法の一例としてパリティチェックによる方法を挙げた。なお、誤りの発生有無を決定する方法は、これに限られない。なお、コストの面を考慮すると、市場に一般的に流通しているパリティチェック機能付きの揮発性メモリを制御装置100に設けることが好ましい。
<Other variations>
In the above embodiment, the method for determining whether an error has occurred is a parity check method. Volatile memories with error detection functions on the market often use a parity check to determine whether an error has occurred, so parity is an example of a method for determining whether an error has occurred. The method of checking was mentioned. Note that the method for determining whether an error has occurred is not limited to this. Note that in consideration of cost, it is preferable that the control device 100 be provided with a volatile memory with a parity check function that is generally available on the market.

上記実施の形態において、バックアップデータ160として、ユーザプログラム114のみを格納する例を示した。なお、バックアップデータ160は、ユーザプログラム114を実行する上で必要なパラメータ等のユーザプログラム114とは別のデータを含み得る。 In the embodiment described above, an example was shown in which only the user program 114 is stored as the backup data 160. Note that the backup data 160 may include data other than the user program 114, such as parameters necessary for executing the user program 114.

§3.付記
以上のように、上記の実施の形態および変形例は以下のような開示を含む。
§3. Supplementary Notes As described above, the above embodiments and modifications include the following disclosures.

<構成1>
制御対象を制御するための制御装置(100,100X)であって、
ユーザプログラムに含まれる命令を順次実行する命令実行部(202,202X)と、
前記ユーザプログラムを格納する揮発性メモリ(106,106X)と、
前記揮発性メモリに格納された前記ユーザプログラムと同一内容のバックアップ用のユーザプログラムを格納するバックアップメモリ(108,110X,106)と、
所定の実行順序に従って、前記ユーザプログラムに含まれる命令を前記揮発性メモリから読み出して前記命令実行部へ提供するアクセス制御部(204,204X)とを備え、
前記揮発性メモリは、誤り検出用の情報(144,144X)を付加してデータ(142)を格納するとともに、読み出し要求に応じて、指定された領域のデータ、および、当該指定された領域に対応する誤り検出用の情報に基づいて決定される当該指定された領域における誤りの発生有無、を応答するように構成されており(606,608,610)、
前記アクセス制御部は、前記揮発性メモリから命令を読み出した場合に、当該読み出した命令を格納していた領域に誤りが発生していることが前記揮発性メモリから応答されると、誤りが発生している領域のデータを前記バックアップメモリから前記揮発性メモリにロードしなおし、前記揮発性メモリから当該命令を再度読み出すように構成されている(S104,S106,S108,S108’)、制御装置。
<Configuration 1>
A control device (100, 100X) for controlling a controlled object,
an instruction execution unit (202, 202X) that sequentially executes instructions included in the user program;
a volatile memory (106, 106X) that stores the user program;
a backup memory (108, 110X, 106) that stores a backup user program having the same content as the user program stored in the volatile memory;
an access control unit (204, 204X) that reads instructions included in the user program from the volatile memory and provides them to the instruction execution unit according to a predetermined execution order;
The volatile memory stores data (142) with error detection information (144, 144 It is configured to respond with the presence or absence of an error in the specified area determined based on the corresponding error detection information (606, 608, 610),
When the access control unit reads an instruction from the volatile memory, if the volatile memory responds that an error has occurred in the area where the read instruction was stored, the access control unit determines whether an error has occurred. The control device is configured to reload data in an area from the backup memory to the volatile memory, and read out the instruction again from the volatile memory (S104, S106, S108, S108').

<構成2>
前記揮発性メモリは、パリティチェックにより誤りの発生有無を応答するように構成されている(610)、構成1に記載の制御装置。
<Configuration 2>
The control device according to configuration 1, wherein the volatile memory is configured to respond whether or not an error has occurred through a parity check (610).

<構成3>
前記アクセス制御部は、前記命令実行部に命令を提供することを目的とした読み出しとは別に、前記揮発性メモリに格納されたデータを予め定められた順番に予め定められたタイミングで読み出し、当該読み出したデータを格納していた領域に誤りが発生していることが前記揮発性メモリから応答されると、前記バックアップメモリに格納されている当該命令を含むデータを前記バックアップメモリから前記揮発性メモリにロードしなおす(S116,S118,S120,S120’,S124)、構成1または構成2に記載の制御装置。
<Configuration 3>
The access control unit reads data stored in the volatile memory in a predetermined order at a predetermined timing, in addition to reading data for the purpose of providing instructions to the instruction execution unit. When the volatile memory responds that an error has occurred in the area where the read data was stored, the data including the instruction stored in the backup memory is transferred from the backup memory to the volatile memory. (S116, S118, S120, S120', S124), the control device according to Configuration 1 or Configuration 2.

<構成4>
前記バックアップメモリは、前記バックアップ用のユーザプログラムを不揮発的に格納するメモリ(108)であって、
前記揮発性メモリに格納される前記ユーザプログラムは、前記バックアップメモリからロードされる(S102)、構成1~構成3のうちいずれか1に記載の制御装置。
<Configuration 4>
The backup memory is a memory (108) that stores the backup user program in a non-volatile manner,
The control device according to any one of configurations 1 to 3, wherein the user program stored in the volatile memory is loaded from the backup memory (S102).

<構成5>
前記バックアップメモリは、前記バックアップ用のユーザプログラムを揮発的に格納するメモリであって(106)、
前記アクセス制御部は、前記命令の実行に伴って前記揮発性メモリに格納されたデータの書き換えが必要な場合、前記揮発性メモリに格納されたデータおよび前記バックアップメモリに格納されたデータを書き換える(S113-1,S113-2)、構成1~構成3のうちいずれか1に記載の制御装置。
<Configuration 5>
The backup memory is a memory that volatilely stores the backup user program (106),
The access control unit rewrites the data stored in the volatile memory and the data stored in the backup memory when it is necessary to rewrite the data stored in the volatile memory due to execution of the instruction. S113-1, S113-2), the control device according to any one of configurations 1 to 3.

<構成6>
制御対象を制御するための制御装置におけるユーザプログラムの実行制御方法であって、
前記制御装置(100,100X)は、
前記ユーザプログラムを格納する揮発性メモリ(106,106X)と、
前記揮発性メモリに格納された前記ユーザプログラムと同一内容のバックアップ用のユーザプログラムを格納するバックアップメモリ(108,110X,106)とを備え、
前記揮発性メモリは、誤り検出用の情報(144,144X)を付加してデータ(142)を格納するとともに、読み出し要求に応じて、指定された領域のデータ、および、当該指定された領域に対応する誤り検出用の情報に基づいて決定される当該指定された領域における誤りの発生有無、を応答するように構成されており(606,608,610)、
所定の実行順序に従って、前記ユーザプログラムに含まれる命令を前記揮発性メモリから読み出すステップ(S104)と、
前記揮発性メモリから命令を読み出した場合に、当該読み出した命令を格納していた領域に誤りが発生していることが前記揮発性メモリから応答されると、誤りが発生している領域のデータを前記バックアップメモリから前記揮発性メモリにロードしなおし、前記揮発性メモリから当該命令を再度読み出すステップ(S104,S106,S108,S108’)と、
前記揮発性メモリから読み出した命令を実行するステップ(S112)とを備える、ユーザプログラムの実行制御方法。
<Configuration 6>
A method for controlling execution of a user program in a control device for controlling a controlled object, the method comprising:
The control device (100, 100X) is
a volatile memory (106, 106X) that stores the user program;
A backup memory (108, 110X, 106) for storing a backup user program having the same content as the user program stored in the volatile memory,
The volatile memory stores data (142) with error detection information (144, 144 It is configured to respond with the presence or absence of an error in the specified area determined based on the corresponding error detection information (606, 608, 610),
reading instructions included in the user program from the volatile memory according to a predetermined execution order (S104);
When an instruction is read from the volatile memory, if the volatile memory responds that an error has occurred in the area where the read instruction was stored, the data in the area where the error has occurred is reloading the instruction from the backup memory to the volatile memory and rereading the instruction from the volatile memory (S104, S106, S108, S108');
A method for controlling execution of a user program, the method comprising: executing an instruction read from the volatile memory (S112).

<構成7>
制御対象を制御するための制御装置を実現するためのシステムプログラムであって、
前記制御装置(100,100X)は、
ユーザプログラムを格納する揮発性メモリ(106,106X)と、
前記揮発性メモリに格納された前記ユーザプログラムと同一内容のバックアップ用のユーザプログラムを格納するバックアップメモリ(108,110X,106)とを備え、
前記揮発性メモリは、誤り検出用の情報(144,144X)を付加してデータ(142)を格納するとともに、読み出し要求に応じて、指定された領域のデータ、および、当該指定された領域に対応する誤り検出用の情報に基づいて決定される当該指定された領域における誤りの発生有無、を応答するように構成されており(606,608,610)、
前記システムプログラムは前記制御装置のプロセッサ(102)に、
所定の実行順序に従って、前記ユーザプログラムに含まれる命令を前記揮発性メモリから読み出すステップ(S104)と、
前記揮発性メモリから命令を読み出した場合に、当該読み出した命令を格納していた領域に誤りが発生していることが前記揮発性メモリから応答されると、誤りが発生している領域のデータを前記バックアップメモリから前記揮発性メモリにロードしなおし、前記揮発性メモリから当該命令を再度読み出すステップ(S104,S106,S108,S108’)と、
前記揮発性メモリから読み出した命令を実行するステップ(S112)とを実行させる、システムプログラム。
<Configuration 7>
A system program for realizing a control device for controlling a controlled object,
The control device (100, 100X) is
volatile memory (106, 106X) for storing user programs;
A backup memory (108, 110X, 106) for storing a backup user program having the same content as the user program stored in the volatile memory,
The volatile memory stores data (142) with error detection information (144, 144 It is configured to respond with the presence or absence of an error in the specified area determined based on the corresponding error detection information (606, 608, 610),
The system program causes the processor (102) of the control device to:
reading instructions included in the user program from the volatile memory according to a predetermined execution order (S104);
When an instruction is read from the volatile memory, if the volatile memory responds that an error has occurred in the area where the read instruction was stored, the data in the area where the error has occurred is reloading the instruction from the backup memory to the volatile memory and rereading the instruction from the volatile memory (S104, S106, S108, S108');
A system program that executes a step (S112) of executing an instruction read from the volatile memory.

今回開示された実施の形態はすべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は、上記した説明ではなく、特許請求の範囲によって示され、特許請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。また、実施の形態および各変形例において説明された発明は、可能な限り、単独でも、組み合わせても、実施することが意図される。 The embodiments disclosed this time should be considered to be illustrative in all respects and not restrictive. The scope of the present invention is indicated by the claims rather than the above description, and it is intended that all changes within the meaning and range equivalent to the claims are included. Further, the inventions described in the embodiments and each modification are intended to be implemented alone or in combination to the extent possible.

100,100X 制御装置、102 プロセッサ、106 メインメモリ、106X 揮発性メモリ、108 フラッシュメモリ、110X バックアップメモリ、112 システムプログラム、114 ユーザプログラム、140 ユーザデータ、142 データ、144 パリティビット、144X 検出用情報、160 バックアップデータ、180 ログデータ、202,202X 命令実行部、204,204X アクセス制御部、206 レジスタ、208 エラーアドレスレジスタ、210 エラーステータスレジスタ、212 命令レジスタ、220 アクセスインターフェイス、402,410 アドレスバス、404,412 コントロールバス、406,414 データバス、408 エラーバス、602 アドレスデコーダ、604 メモリセル、606 読出/書込回路、608 パリティ生成回路、610 パリティチェック回路。 100, 100X control device, 102 processor, 106 main memory, 106X volatile memory, 108 flash memory, 110X backup memory, 112 system program, 114 user program, 140 user data, 142 data, 144 parity bit, 144X detection information, 160 backup data, 180 log data, 202, 202X instruction execution unit, 204, 204X access control unit, 206 register, 208 error address register, 210 error status register, 212 instruction register, 220 access interface, 402, 410 address bus, 404 , 412 control bus, 406, 414 data bus, 408 error bus, 602 address decoder, 604 memory cell, 606 read/write circuit, 608 parity generation circuit, 610 parity check circuit.

Claims (6)

制御対象を制御するための制御装置であって、
ユーザプログラムに含まれる命令を順次実行する命令実行部と、
前記ユーザプログラムを格納する揮発性メモリと、
前記揮発性メモリに格納された前記ユーザプログラムと同一内容のバックアップ用のユーザプログラムを格納するバックアップメモリと、
所定の実行順序に従って、前記ユーザプログラムに含まれる命令を前記揮発性メモリから読み出して前記命令実行部へ提供するアクセス制御部とを備え、
前記揮発性メモリは、誤り検出用の情報を付加してデータを格納するとともに、読み出し要求に応じて、指定された領域のデータ、および、当該指定された領域に対応する誤り検出用の情報に基づいて決定される当該指定された領域における誤りの発生有無、を応答するように構成されており、
前記アクセス制御部は、
前記揮発性メモリから命令を読み出した場合に、当該読み出した命令を格納していた領域に誤りが発生していることが前記揮発性メモリから応答されると、誤りが発生している領域のデータを前記バックアップメモリから前記揮発性メモリにロードしなおし、前記揮発性メモリから当該命令を再度読み出し、当該読み出した命令を格納していた領域に誤りが発生していないことが前記揮発性メモリから応答されると、当該命令を前記命令実行部に提供して当該命令を実行させるとともに、当該命令の実行結果に応じて次に実行する命令を特定するように構成されており、
前記命令実行部に命令を提供することを目的とした読み出しとは別に、当該命令が実行されてから前記次に実行する命令が特定されるまでの間において所定条件が成立する度に、前記揮発性メモリに格納されたデータのうち指定された領域のデータを読み出し、当該読み出したデータを格納していた領域に誤りが発生していることが前記揮発性メモリから応答されると、前記バックアップメモリに格納されている当該命令を含むデータを前記バックアップメモリから前記揮発性メモリにロードしなおし、当該読み出したデータを格納していた領域に誤りが発生していないことが前記揮発性メモリから応答されると、前記揮発性メモリに格納されたデータが予め定められた順番で読み出されるように当該所定条件が次に成立したときに読み出す領域を指定する、一連の処理を行うように構成されている、制御装置。
A control device for controlling a controlled object,
an instruction execution unit that sequentially executes instructions included in the user program;
a volatile memory that stores the user program;
a backup memory that stores a backup user program having the same content as the user program stored in the volatile memory;
an access control unit that reads instructions included in the user program from the volatile memory and provides the instructions to the instruction execution unit according to a predetermined execution order;
The volatile memory stores data with error detection information added thereto, and also stores data in a specified area and error detection information corresponding to the specified area in response to a read request. The system is configured to respond with the presence or absence of an error in the specified area determined based on the
The access control unit includes:
When an instruction is read from the volatile memory, if the volatile memory responds that an error has occurred in the area where the read instruction was stored, the data in the area where the error has occurred is is reloaded from the backup memory to the volatile memory, the instruction is read again from the volatile memory, and it is determined that no error has occurred in the area where the read instruction was stored in the volatile memory. When a response is received from the instruction execution unit, the instruction execution unit is configured to provide the instruction to the instruction execution unit to execute the instruction, and to specify the instruction to be executed next according to the execution result of the instruction.
In addition to reading for the purpose of providing instructions to the instruction execution unit , each time a predetermined condition is satisfied between the execution of the instruction and the identification of the next instruction to be executed , the volatile When data in a specified area of the data stored in the volatile memory is read out and a response is received from the volatile memory that an error has occurred in the area where the read data was stored, the data in the backup memory is read out. The data containing the instruction stored in the read data is reloaded from the backup memory to the volatile memory, and a response is received from the volatile memory indicating that no error has occurred in the area where the read data was stored. Then, the device is configured to perform a series of processing to specify an area to be read when the predetermined condition is satisfied next time so that the data stored in the volatile memory is read in a predetermined order. ,Control device.
前記揮発性メモリは、パリティチェックにより誤りの発生有無を応答するように構成されている、請求項1に記載の制御装置。 2. The control device according to claim 1, wherein the volatile memory is configured to respond by parity check as to whether an error has occurred. 前記バックアップメモリは、前記バックアップ用のユーザプログラムを不揮発的に格納するメモリであって、
前記揮発性メモリに格納される前記ユーザプログラムは、前記バックアップメモリからロードされる、請求項1または請求項2に記載の制御装置。
The backup memory is a memory that stores the backup user program in a non-volatile manner,
3. The control device according to claim 1, wherein the user program stored in the volatile memory is loaded from the backup memory.
前記バックアップメモリは、前記バックアップ用のユーザプログラムを揮発的に格納するメモリであって、
前記アクセス制御部は、前記命令の実行に伴って前記揮発性メモリに格納されたデータの書き換えが必要な場合、前記揮発性メモリに格納されたデータおよび前記バックアップメモリに格納されたデータを書き換える、請求項1または請求項2に記載の制御装置。
The backup memory is a memory that volatilely stores the backup user program,
The access control unit rewrites the data stored in the volatile memory and the data stored in the backup memory when it is necessary to rewrite the data stored in the volatile memory due to execution of the instruction. The control device according to claim 1 or claim 2.
制御対象を制御するための制御装置におけるユーザプログラムの実行制御方法であって、
前記制御装置は、
前記ユーザプログラムを格納する揮発性メモリと、
前記揮発性メモリに格納された前記ユーザプログラムと同一内容のバックアップ用のユーザプログラムを格納するバックアップメモリとを備え、
前記揮発性メモリは、誤り検出用の情報を付加してデータを格納するとともに、読み出し要求に応じて、指定された領域のデータ、および、当該指定された領域に対応する誤り検出用の情報に基づいて決定される当該指定された領域における誤りの発生有無、を応答するように構成されており、
ユーザプログラムの実行制御方法は、
所定の実行順序に従って、前記ユーザプログラムに含まれる命令を前記揮発性メモリから読み出すステップと、
前記揮発性メモリから命令を読み出した場合に、当該読み出した命令を格納していた領域に誤りが発生していることが前記揮発性メモリから応答されると、誤りが発生している領域のデータを前記バックアップメモリから前記揮発性メモリにロードしなおし、前記揮発性メモリから当該命令を再度読み出すステップと
当該読み出した命令を格納していた領域に誤りが発生していないことが前記揮発性メモリから応答されると、前記揮発性メモリから読み出した命令を実行するステップと、
当該命令の実行結果に応じて次に実行する命令を特定するステップと、
命令の実行を目的とした読み出しとは別に、当該命令が実行されてから前記次に実行する命令が特定されるまでの間において所定条件が成立する度に実行する、前記揮発性メモリに格納されたデータのうち指定された領域のデータを読み出し、当該読み出したデータを格納していた領域に誤りが発生していることが前記揮発性メモリから応答されると、前記バックアップメモリに格納されている当該命令を含むデータを前記バックアップメモリから前記揮発性メモリにロードしなおし、当該読み出したデータを格納していた領域に誤りが発生していないことが前記揮発性メモリから応答されると、前記揮発性メモリに格納されたデータが予め定められた順番で読み出されるように当該所定条件が次に成立したときに読み出す領域を指定するという一連のステップとを含む、を備える、ユーザプログラムの実行制御方法。
A method for controlling execution of a user program in a control device for controlling a controlled object, the method comprising:
The control device includes:
a volatile memory that stores the user program;
comprising a backup memory for storing a backup user program having the same content as the user program stored in the volatile memory;
The volatile memory stores data with error detection information added thereto, and also stores data in a specified area and error detection information corresponding to the specified area in response to a read request. The system is configured to respond with the presence or absence of an error in the specified area determined based on the
The user program execution control method is as follows:
reading instructions included in the user program from the volatile memory according to a predetermined execution order;
When an instruction is read from the volatile memory, if the volatile memory responds that an error has occurred in the area where the read instruction was stored, the data in the area where the error has occurred is reloading the instruction from the backup memory to the volatile memory and rereading the instruction from the volatile memory ;
When the volatile memory responds that no error has occurred in the area storing the read instruction, executing the instruction read from the volatile memory;
identifying an instruction to be executed next according to the execution result of the instruction;
In addition to reading for the purpose of executing an instruction, a method for storing information in the volatile memory that is executed every time a predetermined condition is satisfied between the execution of the instruction and the identification of the instruction to be executed next. When the volatile memory responds that an error has occurred in the area where the read data was stored, the data stored in the backup memory is read. The data including the instruction is reloaded from the backup memory to the volatile memory, and when the volatile memory responds that no error has occurred in the area where the read data was stored, the volatile memory a series of steps of specifying an area to be read when the predetermined condition is satisfied next time so that the data stored in the storage memory is read in a predetermined order. .
制御対象を制御するための制御装置を実現するためのシステムプログラムであって、
前記制御装置は、
ユーザプログラムを格納する揮発性メモリと、
前記揮発性メモリに格納された前記ユーザプログラムと同一内容のバックアップ用のユーザプログラムを格納するバックアップメモリとを備え、
前記揮発性メモリは、誤り検出用の情報を付加してデータを格納するとともに、読み出し要求に応じて、指定された領域のデータ、および、当該指定された領域に対応する誤り検出用の情報に基づいて決定される当該指定された領域における誤りの発生有無、を応答するように構成されており、
前記システムプログラムは前記制御装置のプロセッサに、
所定の実行順序に従って、前記ユーザプログラムに含まれる命令を前記揮発性メモリから読み出すステップと、
前記揮発性メモリから命令を読み出した場合に、当該読み出した命令を格納していた領域に誤りが発生していることが前記揮発性メモリから応答されると、誤りが発生している領域のデータを前記バックアップメモリから前記揮発性メモリにロードしなおし、前記揮発性メモリから当該命令を再度読み出すステップと、
当該読み出した命令を格納していた領域に誤りが発生していないことが前記揮発性メモリから応答されると、前記揮発性メモリから読み出した命令を実行するステップと
当該命令の実行結果に応じて次に実行する命令を特定するステップと、を実行させ、
前記システムプログラムは前記プロセッサに、
命令の実行を目的とした読み出しとは別に、当該命令が実行されてから前記次に実行する命令が特定されるまでの間において所定条件が成立する度に、前記揮発性メモリに格納されたデータのうち指定された領域のデータを読み出し、当該読み出したデータを格納していた領域に誤りが発生していることが前記揮発性メモリから応答されると、前記バックアップメモリに格納されている当該命令を含むデータを前記バックアップメモリから前記揮発性メモリにロードしなおし、当該読み出したデータを格納していた領域に誤りが発生していないことが前記揮発性メモリから応答されると、前記揮発性メモリに格納されたデータが予め定められた順番で読み出されるように当該所定条件が次に成立したときに読み出す領域を指定するという一連のステップを実行させる、システムプログラム。
A system program for realizing a control device for controlling a controlled object,
The control device includes:
volatile memory for storing user programs;
comprising a backup memory for storing a backup user program having the same content as the user program stored in the volatile memory;
The volatile memory stores data with error detection information added thereto, and also stores data in a specified area and error detection information corresponding to the specified area in response to a read request. The system is configured to respond with the presence or absence of an error in the specified area determined based on the
The system program causes the processor of the control device to
reading instructions included in the user program from the volatile memory according to a predetermined execution order;
When an instruction is read from the volatile memory, if the volatile memory responds that an error has occurred in the area where the read instruction was stored, the data in the area where the error has occurred is reloading the instruction from the backup memory to the volatile memory and rereading the instruction from the volatile memory;
When the volatile memory responds that no error has occurred in the area storing the read instruction, executing the instruction read from the volatile memory ;
specifying the next instruction to be executed according to the execution result of the instruction ;
The system program causes the processor to
In addition to reading for the purpose of executing an instruction, data stored in the volatile memory is read every time a predetermined condition is satisfied between the execution of the instruction and the identification of the next instruction to be executed. When data in a specified area is read out from the volatile memory, and the volatile memory responds that an error has occurred in the area where the read data was stored, the instruction stored in the backup memory is read out. is loaded from the backup memory to the volatile memory, and when the volatile memory responds that no error has occurred in the area where the read data was stored, the volatile memory A system program that executes a series of steps of specifying an area to be read when the predetermined condition is satisfied next time so that data stored in the computer is read out in a predetermined order.
JP2019152913A 2019-08-23 2019-08-23 Control device, user program execution control method, and system program Active JP7379932B2 (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
JP2019152913A JP7379932B2 (en) 2019-08-23 2019-08-23 Control device, user program execution control method, and system program
PCT/JP2020/007778 WO2021038923A1 (en) 2019-08-23 2020-02-26 Control device, execution control method for user program, and system program

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2019152913A JP7379932B2 (en) 2019-08-23 2019-08-23 Control device, user program execution control method, and system program

Publications (2)

Publication Number Publication Date
JP2021033623A JP2021033623A (en) 2021-03-01
JP7379932B2 true JP7379932B2 (en) 2023-11-15

Family

ID=74675878

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2019152913A Active JP7379932B2 (en) 2019-08-23 2019-08-23 Control device, user program execution control method, and system program

Country Status (2)

Country Link
JP (1) JP7379932B2 (en)
WO (1) WO2021038923A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115714908A (en) * 2021-08-20 2023-02-24 荣耀终端有限公司 Working mode switching control method, electronic equipment and readable storage medium

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003131955A (en) 2001-10-19 2003-05-09 Kyocera Corp Data-backup circuit
WO2012172645A1 (en) 2011-06-14 2012-12-20 富士通株式会社 Memory control device and control method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS63142449A (en) * 1986-12-04 1988-06-14 Fujitsu Ltd Patrol check system for control memory
JPH02178862A (en) * 1988-12-29 1990-07-11 Nec Corp Information processor

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003131955A (en) 2001-10-19 2003-05-09 Kyocera Corp Data-backup circuit
WO2012172645A1 (en) 2011-06-14 2012-12-20 富士通株式会社 Memory control device and control method

Also Published As

Publication number Publication date
WO2021038923A1 (en) 2021-03-04
JP2021033623A (en) 2021-03-01

Similar Documents

Publication Publication Date Title
US7376887B2 (en) Method for fast ECC memory testing by software including ECC check byte
JP4868216B2 (en) Firmware update circuit and firmware update method
US7299400B2 (en) Error correction circuit
JP5780174B2 (en) System and method for handling bad bit errors
EP2770507B1 (en) Memory circuits, method for accessing a memory and method for repairing a memory
JP2016167669A (en) Programmable logic circuit device and error detection method
KR20130031888A (en) Method for monitoring a data memory
JP6290303B2 (en) Circuit and method for testing error correction capability
US10379946B2 (en) Controller
JP7379932B2 (en) Control device, user program execution control method, and system program
JP2010181990A (en) Data processor
JP4950214B2 (en) Method for detecting a power outage in a data storage device and method for restoring a data storage device
JP4135413B2 (en) MEMORY CHECK SYSTEM, MEMORY CHECK METHOD, SIGNAL PROCESSING DEVICE, SIGNAL PROCESSING DEVICE MEMORY CHECK METHOD, AND MEMORY CHECK PROGRAM
JP5964265B2 (en) Semiconductor integrated circuit device
El-Bayoumi An enhanced algorithm for memory systematic faults detection in multicore architectures suitable for mixed-critical automotive applications
US20080270830A1 (en) Data Processing System and Method for Operating a Data Processing System
JP7142731B2 (en) programmable device
US20240134743A1 (en) Electronic device, electronic system, method for operating an electronic device, and method for operating an electronic system
JP4543505B2 (en) Microcomputer control method and abnormality monitoring device
JP5935319B2 (en) Circuit emulation apparatus, circuit emulation method, and circuit emulation program
CN113961227A (en) General software online maintenance control device
JP2017059017A (en) Control device with memory access part
JP2002150795A (en) Semiconductor integrated circuit
WO2019231691A1 (en) Combinational address repair in memory controller
JP2018013988A (en) Control device, control method, and control program; and built-in apparatus

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20220607

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230322

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230420

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20230725

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20230822

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: 20231003

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20231016

R150 Certificate of patent or registration of utility model

Ref document number: 7379932

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150