JPH01200454A - Protection system for write to random access memory - Google Patents

Protection system for write to random access memory

Info

Publication number
JPH01200454A
JPH01200454A JP63025374A JP2537488A JPH01200454A JP H01200454 A JPH01200454 A JP H01200454A JP 63025374 A JP63025374 A JP 63025374A JP 2537488 A JP2537488 A JP 2537488A JP H01200454 A JPH01200454 A JP H01200454A
Authority
JP
Japan
Prior art keywords
program
area
write
cpu
address
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP63025374A
Other languages
Japanese (ja)
Inventor
Yojiro Nomura
洋二郎 野村
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.)
NEC Engineering Ltd
Original Assignee
NEC Engineering Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by NEC Engineering Ltd filed Critical NEC Engineering Ltd
Priority to JP63025374A priority Critical patent/JPH01200454A/en
Publication of JPH01200454A publication Critical patent/JPH01200454A/en
Pending legal-status Critical Current

Links

Landscapes

  • Storage Device Security (AREA)

Abstract

PURPOSE:To prevent the breakage of the memory contents due to a program debugging action by outputting an instruction which loads the memory contents in response to a program to an instruction identifying means when a CPU loads the program to a random access memory RAM. CONSTITUTION:When a CPU 1 loads a program to an RAM3-1 or 3-2, the CPU 1 outputs an instruction to a write protection circuit 4-1 or 4-2 in response to a program to load the contents of an external storage 6. The instruction identifying means of both circuits 4-1 and 4-2 set the contents of the memory 6 in response to the instruction given from the CPU 1. Thus the write enable and write unable areas are set in accordance with the program which is loaded in a program loading state. In case the address of the RAM to which the CPU 1 gave an access for writing is equal to an address stored in an area that is instructed to be turned into a write unable area by the information stored in the memory 6, the circuit 4-1 or 4-2 invalidates the access to said address.

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は電子計算機に於けるランダムアクセスメモリ 
(RAM)の書込保護方式に関し、特にプログラムミス
によるメモリ内容の破壊を防止することができるランダ
ムアクセスメモリ書込保護方式に関する。
[Detailed Description of the Invention] [Industrial Field of Application] The present invention relates to random access memory in electronic computers.
The present invention relates to a write protection method for (RAM), and particularly to a random access memory write protection method that can prevent memory contents from being destroyed due to a program error.

〔従来の技術〕[Conventional technology]

従来、記憶データ、プログラム等に対する書込保護は、
アドレス空間の一部をリードオンリメモリ (ROM)
に割当て、ROMに書換不可のデータ2プログラム等を
記憶させるか、或いはソフトウェアでRAMに書込不可
エリアを設定するようにしている。
Traditionally, write protection for stored data, programs, etc.
Part of the address space is read-only memory (ROM)
2 and store non-rewritable data 2 programs in the ROM, or set a non-writable area in the RAM using software.

〔発明が解決しようとする問題点〕[Problem that the invention seeks to solve]

しかし、ROMを使用する方法では、記憶内容の変更が
容易でなく、また、プログラムを作成する場合もROM
に割当てられているアドレス空間を考慮してプログラム
を作成しなければならないため、システムの自由度が低
いという問題がある。
However, with the method of using ROM, it is not easy to change the memory contents, and when creating a program, it is difficult to use ROM.
Since the program must be created taking into consideration the address space allocated to the system, there is a problem that the degree of freedom of the system is low.

また、ソフトウェアによる方法では、ソフトウェアに対
する制約が大きくなり、しかもプログラムバグにより簡
単に書込不可エリアにデータが書込まれてしまう場合が
あるという問題点もあった。
Furthermore, the software method has the problem that there are significant restrictions on the software, and data may easily be written to a write-inhibited area due to a program bug.

本発明はこのような問題点を解決したものであり、その
目的は、システム上の自由度が高く、且つプログラムバ
グによるメモリ内容の破壊を防止できるようにすること
にある。
The present invention solves these problems, and its purpose is to provide a system with a high degree of freedom and to prevent memory contents from being destroyed by program bugs.

C問題点を解決するための手段〕 本発明は前述の如き問題点を解決するため、ランダムア
クセスメモリとCPUとを含むシステムに於いて、 前記ランダムアクセスメモリの各エリアを書込可エリア
にするか、書込不可エリアにするかを示す情報が記憶さ
れる記憶手段と、 該記憶手段の記憶内容を前記cpuからの命令に従った
ものとする命令識別手段と、 前記CPUが書込みのためにアクセスした前記ランダム
アクセスメモリのアドレスが、前記記憶手段に記憶され
ている情報によって書込不可エリアにすることが指示さ
れているエリア内のアドレスである場合、そのアクセス
を無効にする書込保護手段とを設け、 前記CPUは前記ランダムアクセスメモリにプログラム
をロードする際、前記記憶手段の記憶内容をロードする
プログラムに応じたものにする命令を前記命令識別手段
に出力する。
Means for Solving Problem C] In order to solve the above problems, the present invention provides a system including a random access memory and a CPU, in which each area of the random access memory is made a writable area. a storage means for storing information indicating whether the area is a write-inhibited area; an instruction identification means for determining the storage contents of the storage means in accordance with an instruction from the CPU; write protection means for disabling access when the accessed address of the random access memory is within an area that is instructed to be a write-inhibited area by information stored in the storage means; and when the CPU loads a program into the random access memory, the CPU outputs a command to the command identifying means to make the stored contents of the storage means correspond to the program to be loaded.

〔作 用〕[For production]

CPUはランダムアクセスメモリにプログラムをロード
する際、記憶手段の記憶内容をロードするプログラムに
応じたものにする命令を出力する。
When loading a program into the random access memory, the CPU outputs an instruction to make the stored contents of the storage means correspond to the program to be loaded.

命令識別手段は記憶手段の記憶内容をCPUからの命令
に応じたものとする。従って、プログラムロード時に、
ロードするプログラムに応じて書込可エリアと書込不可
エリアとが設定される。また、命令識別手段は記憶手段
の記憶内容をCPUからの命令に応じたものとするので
、プログラムロード後に於いても、CPUから命令識別
手段に命令を加えることにより、記憶手段の記憶内容を
変更することができる。CPUが書込みのためにアクセ
スしたランダムアクセスメモリのアドレスが、記憶手段
に記憶されている情報によって書込不可エリアにするこ
とが指示されているエリア内のアドレスである場合、書
込保護手段はそのアクセスを無効とする。
The command identifying means determines the contents of the storage means according to the command from the CPU. Therefore, when loading the program,
A writable area and a writable area are set depending on the program to be loaded. In addition, since the instruction identification means changes the storage contents of the storage means according to the command from the CPU, even after the program is loaded, the storage contents of the storage means can be changed by adding an instruction from the CPU to the instruction identification means. can do. If the address of the random access memory accessed by the CPU for writing is within an area that is instructed to be a write-inhibited area by information stored in the storage means, the write protection means Disable access.

〔実施例〕〔Example〕

次に本発明の実施例について図面を参照して詳細に説明
する。
Next, embodiments of the present invention will be described in detail with reference to the drawings.

第1図は本発明の実施例のブロック図であり、CPUI
と、メモリ使用状況記憶回路2と、RAM3−1.3−
2と、書込保護回路4−1.4−2と、異常検知回路5
−1.5−2と、RAM3−1.3−2ヘロードするプ
ログラムが記憶されている外部記憶袋W6と、バス7と
を含んでいる。
FIG. 1 is a block diagram of an embodiment of the present invention, in which the CPU
, memory usage status storage circuit 2, and RAM3-1.3-
2, write protection circuit 4-1.4-2, and abnormality detection circuit 5
-1.5-2, an external storage bag W6 in which a program to be loaded into the RAM 3-1.3-2 is stored, and a bus 7.

尚、RAM3−1.3−2は連続したアドレス空間を持
っているものである。
Note that the RAMs 3-1 and 3-2 have continuous address spaces.

外部記憶装置6に格納され、RAM3−1.3−2にロ
ードされるプログラムは、第2図に示すファイル構造を
有するプログラムロードモジュールファイルとして外部
記憶装置6に格納されている。RAM3−1.3−2に
ロードするプログラム22.23.・・・が格納された
プログラムロードモジュールファイルの先頭には256
バイトのヘッダー部21が設けられ、モジュールの名称
の他、含まれるプログラムの本数、各プログラムの名称
、各プログラム22.23.・・・のデータ/ワークエ
リア部22−1.23−1.・・・とプログラムエリア
部22−2゜23−2.・・・との大きさ及び相対スタ
ートアドレス(各プログラム22.23.・・・をRA
M3−1.3−2にロードした際のデータ/ワークエリ
ア部22−1.23−1.・・・及びプログラムエリア
部22−2゜23−2. ・・・の先頭アドレス)が格
納されている。
The program stored in the external storage device 6 and loaded into the RAM 3-1.3-2 is stored in the external storage device 6 as a program load module file having the file structure shown in FIG. Program 22.23. Loaded into RAM3-1.3-2. 256 at the beginning of the program load module file that stores...
A byte header section 21 is provided, in which, in addition to the name of the module, the number of included programs, the name of each program, and each program 22.23. ... data/work area section 22-1.23-1. ... and program area section 22-2゜23-2. ... and the relative start address (each program 22, 23... is RA
Data/work area section 22-1.23-1 when loaded to M3-1.3-2. ...and program area section 22-2゜23-2. ...) is stored.

また、各データ/ワークエリア部22−1.23−1゜
・・・及びプログラムエリア部22−2.23−2.・
・・は256バイトの整数倍の大きさを持つ。
In addition, each data/work area section 22-1.23-1°... and program area section 22-2.23-2.・
... has a size that is an integral multiple of 256 bytes.

第3図はRAM3−1に対応して設けられている書込保
護回路4−1の一例を示すブロック図であり、命令識別
回路41と、アドレス選択回路42と、フリップフロッ
プFFO〜FFnと、アントゲ−)ANDI 〜AND
1Bと、オアゲートORI、OR2と、インバータIN
I、IN2とから構成されている。命令識別回路41は
バス7を介してCPU1から書込不可設定命令が加えら
れることによりその出力信号Sを“1”とし、書込可設
定命令が加えられることにより、その出力信号rを“1
”とする。アドレス選択回路42はCPUIからバス7
を介して加えられたアドレスが16進表示で0〜FFの
時はその出力信号aO〜anの内、信号aOのみを″ど
と°し、100〜IFFの時は信号a1のみを“1”と
し、noO〜nFFの時は信号anのみを1″とする。
FIG. 3 is a block diagram showing an example of a write protection circuit 4-1 provided corresponding to the RAM 3-1, and includes an instruction identification circuit 41, an address selection circuit 42, flip-flops FFO to FFn, Antogame) ANDI ~AND
1B, OR gate ORI, OR2, and inverter IN
It is composed of I and IN2. The instruction identification circuit 41 sets its output signal S to "1" when a write-disable setting instruction is added from the CPU 1 via the bus 7, and sets its output signal r to "1" when a write-enable setting instruction is added.
”.The address selection circuit 42 is connected to the bus 7 from the CPUI.
When the address added via the address is 0 to FF in hexadecimal notation, only the signal aO is set to "1" among the output signals aO to an, and when it is from 100 to IFF, only the signal a1 is set to "1". When noO to nFF, only the signal an is set to 1''.

フリップフロップFF0=FFnはRAM3−1を25
6バイト毎のエリアに分割した際の各エリア対応に設け
られているものであり、対応するエリアが書込可エリア
である場合はリセット状態にされ、書込不可エリアであ
る場合はセット状態にされる。尚、RAM3−2対応に
設けられている書込保護回路4−2も書込保護回路4−
1と同様の構成を有するものである。
Flip-flop FF0=FFn sets RAM3-1 to 25
This is provided for each area when it is divided into areas of 6 bytes each, and if the corresponding area is a writable area, it is set to the reset state, and if it is a non-writable area, it is set to the set state. be done. Note that the write protection circuit 4-2 provided for RAM3-2 is also the write protection circuit 4-2.
It has the same configuration as 1.

次に、本実施例の動作を説明する。Next, the operation of this embodiment will be explained.

電源がオンされると、CPIJIはメモリ使用状況記憶
回路2をクリアして各アドレスの内容をオール“0゛と
すると共に書込保護回路4−1内に設けられているフリ
ップフロップFFO〜FFn及び書込保護回路4−2内
に設けられているフリップフロップを全てリセット状態
にする。書込保護回路4−1内のフリップフロップFF
0−FFnのリセットは、ハス7に書込可設定命令を出
力すると共に、出力するアドレスを16進表示で例えば
0.100,200.・・・というように100番地ず
つnX100番地まで歩進させることにより行なう。前
述したように、命令識別回路41は書込可設定命令が加
えられることにより信号rを“l”とし、アドレス選択
回路42は加えられるアドレスがO〜OFF、100〜
IFF、 ・−5neo−nFFの時、信号ao、al
、−,anを“1”とするものであるので、上述したよ
うにすることにより、フリップフロップFFO〜FFn
のリセット端子Rに加えられる信号が順次“1”となり
、フリップフロップFFO〜FFnはリセット状態にさ
れる。また、書込保護回路4−2内のフリップフロップ
のリセットも同様にして行なう。
When the power is turned on, CPIJI clears the memory usage status storage circuit 2 and sets the contents of each address to all "0", and also clears the flip-flops FFO to FFn and FFn provided in the write protection circuit 4-1. All the flip-flops provided in the write protection circuit 4-2 are reset.Flip-flop FF in the write protection circuit 4-1
To reset 0-FFn, a write enable setting command is output to the lotus 7, and the address to be output is expressed in hexadecimal, for example, 0.100, 200, etc. . . . This is done by incrementing by 100 addresses up to address nX100. As described above, the instruction identification circuit 41 sets the signal r to "L" when a write enable setting instruction is applied, and the address selection circuit 42 selects whether the applied address is 0~OFF, 100~
IFF, -5neo-nFF, signals ao, al
, -, an are set to "1", so by doing as described above, the flip-flops FFO to FFn
The signals applied to the reset terminals R of the flip-flops sequentially become "1", and the flip-flops FFO to FFn are put into a reset state. Further, the flip-flop in write protection circuit 4-2 is reset in the same manner.

外部記憶装置6に格納されているプログラム22゜23
、・・・をRAM3−1.3−2にロードする際、CP
UIはヘンダ一部21の情報(相対ステータスアドレス
、データ/ワークエリア部の大きさ、プログラムエリア
部の大きさ)に基づいて、プログラム22.23. ・
・・をロードした後のRAM3−1゜3−2の使用状況
を示す情報(データ/ワーク部が格納されているか、プ
ログラムエリア部が格納されているかを示す情報)をメ
モリ使用状況記憶回路2に記憶させる。
Programs 22 and 23 stored in the external storage device 6
When loading ,... into RAM3-1.3-2, CP
The UI executes programs 22, 23, .・
The memory usage status storage circuit 2 stores information indicating the usage status of RAM3-1゜3-2 after loading (information indicating whether the data/work section or program area section is stored). to be memorized.

第4図はメモリ使用状況記憶回路2の記憶内容と、RA
M3−1.3−2の使用状況及び書込保護との関係を示
す図である。メモリ使用状況記憶回路2の各1ビツトは
、第0行の50ビツトがRAM3−1.3−2のアドレ
ス空間の0−FFに、第1行のす、ビットがRAM3−
1.3−2のアドレス空間のFOO−FFFに対応する
というように、RAM3−1.3−2のアドレス空間を
256バイト毎のエリアに分割した際の各エリアに対応
しており、1″がプログラムエリア、0”がデータ/ワ
ークエリアであることを示している。
FIG. 4 shows the memory contents of the memory usage status storage circuit 2 and the RA
It is a diagram showing the usage status of M3-1.3-2 and its relationship with write protection. Each bit of the memory usage status storage circuit 2 is as follows: 50 bits in the 0th row are stored in 0-FF of the address space of RAM3-1.3-2, and 50 bits in the first row are stored in RAM3-FF.
It corresponds to each area when the address space of RAM3-1.3-2 is divided into areas of 256 bytes, such as corresponding to FOO-FFF of the address space of 1.3-2, and 1" indicates the program area and 0'' indicates the data/work area.

第4図の例では、I6進表示で0〜7FF、COO〜D
FF、1000〜IFFF、2200〜2FFF番地(
斜線を施した部分)がプログラムエリアとして書込不可
エリアになることを示し、800〜BFF、EOO〜F
FF、2000〜21FF番地がデータ/ワークエリア
として書込可エリアになることを示している。尚、前述
したように、書込保護回路4−1内のフリップフロップ
FFO〜FFn及び書込保護回路4−2内のフリップフ
ロップはRAM3−1.3−2のアドレス空間を256
バイト毎のエリアに分割した際の各エリアに対応するも
のであるので、メモリ使用状況記憶回路2の各ビットは
書込保護回路4−1.4−2内のフリップフロップとも
一対一に対応することになる。
In the example in Figure 4, 0 to 7FF, COO to D in hexadecimal notation.
FF, 1000~IFFF, 2200~2FFF addresses (
800~BFF, EOO~F
This indicates that addresses FF and 2000 to 21FF become writable areas as data/work areas. As mentioned above, the flip-flops FFO to FFn in the write protection circuit 4-1 and the flip-flops in the write protection circuit 4-2 cover the address space of the RAM 3-1.3-2 by 256.
Since it corresponds to each area when divided into areas for each byte, each bit of the memory usage status storage circuit 2 has a one-to-one correspondence with the flip-flops in the write protection circuit 4-1 and 4-2. It turns out.

プログラムのロードが終了すると、CPU 1は書込保
護回路4−1内のフリップフロップFFO〜FFn及び
書込保護回路4−2内のフリップフロップの状態を、メ
モリ使用状況記憶回路2の対応するビットの内容が“1
”である場合にはセット状態にし、10″である場合に
はリセット状態にする。書込保護回路4−1内のフリッ
プフロップF F O” F F nのセットはバス7
に書込不可設定命令を出力すると共に、セット状態にす
るフリップフロップと対応しているエリア内のアドレス
の内の1つ(例えば、エリアの先頭アドレス)を出力す
ることにより行ない、リセットはバス7に書込可設定命
令を出力すると共に、リセット状態にするフリップフロ
ップと対応しているエリア内のアドレスの内の1つを出
力することにより行なう。後述する説明から明らかにな
るが、セント状態にされたフリッププロップ対応のエリ
アは書込不可エリアとなり、リセット状態にされたフリ
ップフロップ対応のエリアは書込可エリアとなる。
When the program loading is completed, the CPU 1 stores the states of the flip-flops FFO to FFn in the write protection circuit 4-1 and the flip-flops in the write protection circuit 4-2 to the corresponding bits of the memory usage status storage circuit 2. The content of “1”
If the value is "10", the state is set, and if the value is 10, the state is reset. The set of the flip-flop F F O” F F n in the write protection circuit 4-1 is connected to the bus 7.
The reset is performed by outputting a write disable setting command to the bus 7 and one of the addresses in the area corresponding to the flip-flop to be set (for example, the start address of the area). This is done by outputting a writable setting command to the flip-flop and outputting one of the addresses in the area corresponding to the flip-flop to be reset. As will become clear from the explanation that will be given later, the area corresponding to the flip-flop in the cent state becomes a writable area, and the area corresponding to the flip-flop in the reset state becomes a writable area.

即ち、プログラムロード時に於いて、RAM3−1.3
−2のプログラムエリアが書込不可エリアとされ、デー
タ/ワークエリアが書込可エリアとされる。
That is, when loading the program, RAM3-1.3
The program area -2 is set as a non-writable area, and the data/work area is set as a writable area.

上述したように、プログラムロード時に、RAM3−1
.3−2のプログラムエリアが書込不可エリアとされ、
データ/ワークエリアが書込可エリアとされるが、更に
、データ/ワークエリアに於いて、再書込みを不可とし
たいデータ/ワークエリアに関しては、次のようにする
。即ち、CPU1は用意されているプログラムによる書
込不可設定命令をバス7に出力すると共に書込不可とし
たいデータ/ワークエリア内のアドレスの内の1つを出
力する。これにより、書込不可としたいエリア対応のフ
リップフロップがセットされ、そのエリアは書込不可エ
リアとされるので、重要データが誤って書換えられる危
険を防止することができる。また、上述したようにして
、書込不可エリアとしたエリアを再び書込可エリアとす
る場合は、書込可設定命令をバス7に出力すると共に上
記エリア内のアドレスの内の1つを出力すれば良い。
As mentioned above, when loading a program, RAM3-1
.. The program area of 3-2 is designated as a non-writable area,
The data/work area is set as a writable area, but for the data/work area where you want to make rewriting impossible, do the following. That is, the CPU 1 outputs a write-disable setting command according to a prepared program to the bus 7, and also outputs one of the addresses in the data/work area to be made write-disabled. As a result, a flip-flop corresponding to an area to be made unwritable is set, and that area is made a writable area, so that it is possible to prevent important data from being erroneously rewritten. Also, as described above, if you want to make an area that has been set as a non-writable area a writable area again, output a writable setting command to the bus 7 and output one of the addresses in the above area. Just do it.

次に、CPUIがデータを書込むためにRAM3−1.
3−2をアクセスした場合の動作を説明する。
Next, the CPU writes data to RAM3-1.
The operation when accessing 3-2 will be explained.

先ず、書込不可エリアにCPUIがデータを書込もうと
した場合の動作を説明する。今、例えば、フリップフロ
ップFFOがセット状態にされ、対応するO〜FF(1
6進表示)番地のエリアが書込不可エリアにされている
時に、CPUIが上記エリア内のあるアドレスA、にデ
ータを書込もうとして、リード/ライト信号R/Wを“
0”とし、バス7にアドレスA、とデータを出力したと
する。
First, an explanation will be given of the operation when the CPUI attempts to write data to a write-disabled area. Now, for example, flip-flop FFO is set, and corresponding O to FF(1
When the area at the address (in hexadecimal notation) is set as a write-disabled area, the CPU attempts to write data to a certain address A within the area, and the read/write signal R/W is output as “
0'' and output data such as address A to bus 7.

書込保護回路4−1内のアドレス選択回路42はアドレ
スA、が加えられると、その出力信号aOを′1″とし
、アンドゲートAND7.ANDIOをオン状態にする
。また、リード/ライト信号R/Wが“0”となること
により、アントゲ−)AND13.AND16がオン状
態となる。この時、フリップフロップFFOは七ノド状
態にされており、Q、 Q出力はそれぞれ“1“、“0
”となっているので、オアゲートOR1,OR2の出力
信号はそれぞれ“1″、“0″となる。オアゲートOR
2の出力信号はインバータrN2を介してRAM3−1
に加えられており、RAM3−1に加わるリード/ライ
ト信号R/Wは“l”となるので、RAM3−1はデー
タの書込みを行なわない。即ち、0−FF番地は書込み
保護されたことになる。
When the address selection circuit 42 in the write protection circuit 4-1 is applied with the address A, the output signal aO is set to '1'', and the AND gate AND7.ANDIO is turned on. When /W becomes "0", AND13 and AND16 are turned on. At this time, the flip-flop FFO is in the seven-node state, and the Q and Q outputs are "1" and "0", respectively.
”, the output signals of OR gates OR1 and OR2 are “1” and “0”, respectively.OR gate OR
The output signal of 2 is sent to RAM3-1 via inverter rN2.
Since the read/write signal R/W applied to the RAM 3-1 becomes "1", the RAM 3-1 does not write data. In other words, the 0-FF address is write-protected.

オアゲートORIの出力信号が加えられている異常検知
回路5−1はオアゲー)OR1の出力信号が“1”とな
ることにより、CPUIに対して割込みを発生する。C
PUIのモニタプログラムは異常検知回路5−1からの
割込み発生により、プログラム異常と見做して、実行プ
ログラムの処理を打切り、障害復旧処理を行なう。
The abnormality detection circuit 5-1 to which the output signal of the OR gate ORI is applied generates an interrupt to the CPUI when the output signal of the OR gate OR1 becomes "1". C
Upon occurrence of an interrupt from the abnormality detection circuit 5-1, the PUI monitor program considers the program to be abnormal, terminates the processing of the execution program, and performs failure recovery processing.

次に、書込可エリアにCPUIがデータを書込もうとし
た場合の動作を説明する。今、例えば、フリップフロッ
プFFIがリセット状態にされ、対応する100−IF
F(16進表示)のエリアが書込可エリアにされている
時に、CPUIが上記エリア内の成るアドレスA1にデ
ータを書込もうとして、リード/ライト信号R/Wを“
0”とし、バス7にアドレスA、とデータを出力したと
する。
Next, the operation when the CPUI attempts to write data to the writable area will be explained. Now, for example, flip-flop FFI is put into the reset state and the corresponding 100-IF
When area F (in hexadecimal notation) is set as a writable area, the CPU attempts to write data to address A1 in the above area, and the read/write signal R/W is set to “
0'' and output data such as address A to bus 7.

書込保護回路4−1内のアドレス選択回路42はアドレ
スA1が加えられると、その出力信号a1を“1”とし
、アンドゲートAND8.ANDIIをオン状態にする
。また、リード/ライト信号R/Wが“0”となること
により、アンドゲートAND14.AND17がオン状
態となる。この時、フリップフロップFFIはリセント
状態にされており、Q、 Q出力はそれぞれ“O”、”
1”となっているので、オアゲートORI、OR2の出
力信号はそれぞれ“0”、“l”となる。オアゲートO
R2の出力信号はインバータIN2を介してRAM3−
1に加えられており、RAM3−1に加わるリード/ラ
イト信号R/Wは“0”となるので、RAM3−1はバ
ス7を介して加えられたデータをアドレスA、に書込む
When the address selection circuit 42 in the write protection circuit 4-1 is applied with the address A1, the output signal a1 is set to "1", and the AND gate AND8. Turn on ANDII. Also, when the read/write signal R/W becomes "0", the AND gate AND14. AND17 is turned on. At this time, the flip-flop FFI is in the recent state, and the Q and Q outputs are "O" and "O", respectively.
1", the output signals of OR gates ORI and OR2 become "0" and "l", respectively. OR gate O
The output signal of R2 is sent to RAM3- through inverter IN2.
Since the read/write signal R/W applied to the RAM 3-1 becomes "0", the RAM 3-1 writes the data added via the bus 7 to the address A.

尚、上述した実施例に於いては、メモリ使用状況記憶回
路2にRAM3−1.3−2の使用状況を示す情報を記
憶させ、その後、メモリ使用状況記tQ回路2の内容に
基づいて書込保護回路4−1゜4−2内のフリップフロ
ップの状態を制御するようにしたが、メモリ使用状況記
憶回路2に使用状況を示す情報を記憶させることなく、
プログラムロード時に書込保護回路4−1.4−2内の
フリップフロップの状態を制御するようにすることもで
きる。しかし、本実施例のように、メモリ使用状況記憶
回路2にRAM3−1.3−2の使用状況を示す情報を
記憶させておくことにより、RAM3−1.3−2の使
用状況を容易に知ることが可能となる。
In the above-described embodiment, the memory usage status storage circuit 2 stores information indicating the usage status of the RAM 3-1. Although the state of the flip-flops in the internal protection circuits 4-1 and 4-2 is controlled, the memory usage status storage circuit 2 does not store information indicating usage status.
It is also possible to control the states of the flip-flops in the write protection circuit 4-1, 4-2 at the time of program loading. However, as in this embodiment, by storing information indicating the usage status of RAM3-1.3-2 in the memory usage status storage circuit 2, the usage status of RAM3-1.3-2 can be easily checked. It becomes possible to know.

〔発明の効果〕〔Effect of the invention〕

以上説明したように、本発明は、RAMの各エリアを書
込可エリアにするか、書込不可エリアにするかを示す情
報が記憶される記憶手段と、記憶手段の記憶内容をCP
Uからの命令に従ったものにする命令識別手段とを設け
、プログラムをロードする際及び任意の時点でCPUか
ら命令を出力することにより、書込可エリア、書込不可
エリアを設定できるようにしたものであり、ROMを使
用した従来例のように、ROMに割当てられているアド
レス空間を考慮してプログラムを作成する必要がなく、
また、プログラムの変更も容易であるので、ROMを使
用した従来例に比較してシステム上の自由度を高いもの
にできる効果がある。
As explained above, the present invention provides storage means for storing information indicating whether each area of a RAM is a writable area or a writable area, and a CP that stores the storage contents of the storage means.
A writable area and a writable area can be set by outputting an instruction from the CPU when loading a program and at any arbitrary time. Unlike conventional examples that use ROM, there is no need to create a program taking into account the address space allocated to ROM.
Furthermore, since it is easy to change the program, there is an effect that the degree of freedom in the system can be increased compared to the conventional example using a ROM.

また、更に、本発明はCPUが書込みのためにアクセス
したRAMのアドレスが、記憶手段に記憶されている情
報によって書込不可エリアにすることが指示されている
エリア内のアドレスである場合、そのアクセスを無効に
する書込保護手段を備えているので、プログラムミスに
より記憶内容が破壊されることを防止できる効果もある
Further, the present invention provides that when the address of the RAM accessed by the CPU for writing is within an area that is instructed to be a write-inhibited area by information stored in the storage means, Since it is equipped with write protection means that disables access, it also has the effect of preventing memory contents from being destroyed due to programming errors.

【図面の簡単な説明】[Brief explanation of the drawing]

第1図は本発明の実施例のブロック図、第2図はプログ
ラムロードモジュールファイルの構成例を示す図、 第3図は書込保護回路の一例を示すブロック図及び、 −第4図はメモリ使用状況記憶回路の記憶内容とRAM
の使用状況及び書込保護との関係を示す図である。 図に於いて、1・・・CPU、2・・・メモリ使用状況
記憶回路、3−1.3−2・・・RAM、4−1.4−
2・・・書込保護回路、5−1.5−2・・・異常検知
回路、6・・・外部記憶装置、7・・・バス、21・・
・ヘッダ一部、22.23・・・プログラム、22−1
 、23−1・・・データ/ワークエリア部、22−2
 、23−2・・・プログラムエリア部、41・・・命
令識別回路、42・・・アドレス選択回路、F F O
= F F n・・・フリップフロップ、AND 1〜
AND18・・・アンドゲート、ORI、OR2・・・
オアゲート、INI、IN2・・・インバータ。
Fig. 1 is a block diagram of an embodiment of the present invention, Fig. 2 is a diagram showing an example of the configuration of a program load module file, Fig. 3 is a block diagram showing an example of a write protection circuit, and - Fig. 4 is a memory Memory contents of usage status memory circuit and RAM
FIG. 3 is a diagram showing the usage status of and the relationship with write protection. In the figure, 1...CPU, 2...Memory usage status storage circuit, 3-1.3-2...RAM, 4-1.4-
2... Write protection circuit, 5-1.5-2... Abnormality detection circuit, 6... External storage device, 7... Bus, 21...
・Part of header, 22.23...Program, 22-1
, 23-1...data/work area section, 22-2
, 23-2...Program area section, 41...Instruction identification circuit, 42...Address selection circuit, FFO
= F F n...Flip-flop, AND 1~
AND18...and gate, ORI, OR2...
OR gate, INI, IN2...inverter.

Claims (1)

【特許請求の範囲】 ランダムアクセスメモリとCPUとを含むシステムに於
いて、 前記ランダムアクセスメモリの各エリアを書込可エリア
にするか、書込不可エリアにするかを示す情報が記憶さ
れる記憶手段と、 該記憶手段の記憶内容を前記CPUからの命令に従った
ものとする命令識別手段と、 前記CPUが書込みのためにアクセスした前記ランダム
アクセスメモリのアドレスが、前記記憶手段に記憶され
ている情報によって書込不可エリアにすることが指示さ
れているエリア内のアドレスである場合、そのアクセス
を無効にする書込保護手段とを設け、 前記CPUは前記ランダムアクセスメモリにプログラム
をロードする際、前記記憶手段の記憶内容をロードする
プログラムに応じたものにする命令を前記命令識別手段
に出力することを特徴とするランダムアクセスメモリ書
込保護方式。
[Scope of Claims] In a system including a random access memory and a CPU, a memory that stores information indicating whether each area of the random access memory is a writable area or a writable area. means for determining the storage contents of the storage means according to an instruction from the CPU; and an address of the random access memory accessed by the CPU for writing is stored in the storage means. write protection means for disabling access if the address is in an area that is instructed to be a write-inhibited area by information contained in the memory; . A random access memory write protection system, characterized in that a command is output to the command identification means to make the storage contents of the storage means correspond to a program to be loaded.
JP63025374A 1988-02-05 1988-02-05 Protection system for write to random access memory Pending JPH01200454A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP63025374A JPH01200454A (en) 1988-02-05 1988-02-05 Protection system for write to random access memory

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP63025374A JPH01200454A (en) 1988-02-05 1988-02-05 Protection system for write to random access memory

Publications (1)

Publication Number Publication Date
JPH01200454A true JPH01200454A (en) 1989-08-11

Family

ID=12164068

Family Applications (1)

Application Number Title Priority Date Filing Date
JP63025374A Pending JPH01200454A (en) 1988-02-05 1988-02-05 Protection system for write to random access memory

Country Status (1)

Country Link
JP (1) JPH01200454A (en)

Similar Documents

Publication Publication Date Title
US5199032A (en) Microcontroller having an EPROM with a low voltage program inhibit circuit
US20030088728A1 (en) Method for flashing ESCD and variables into a ROM
JP2504137B2 (en) Memory write protect circuit
US7680976B2 (en) Method and apparatus for emulating rewritable memory with non-rewritable memory in an MCU
JPH0476681A (en) Microcomputer
US6542955B1 (en) Microcontroller virtual memory system and method
US6556476B1 (en) Non-volatile memory data protection
CN110647764A (en) Protection method and system for user-mode nonvolatile memory file system
JP2021515308A (en) Devices and methods for accessing metadata when debugging devices
JPH01200454A (en) Protection system for write to random access memory
JP2000276461A (en) Microcomputer
JPH05225361A (en) Register rewriting system
US20020166036A1 (en) Multiple memory block disable function
JPH03129446A (en) Microcomputer incorporating eeprom
JPS60145596A (en) Program controller of mask rom
JPH0934795A (en) Copy protection method for cpu program
JPH06231072A (en) Microcomputer
JPS62286143A (en) Semiconductor memory device
JPS5947624A (en) Loading system of system program
JP2581057B2 (en) Evaluation microcomputer
JPS5914060A (en) Switching circuit of memory bank
JP3048199B2 (en) IC memory card
JPS62160555A (en) Storage protecting device of storage circuit
JPH01116854A (en) Memory read error preventing system
JPH0731440Y2 (en) EEPROM control device