JPH11167526A - Memory read and write method and device - Google Patents

Memory read and write method and device

Info

Publication number
JPH11167526A
JPH11167526A JP9332741A JP33274197A JPH11167526A JP H11167526 A JPH11167526 A JP H11167526A JP 9332741 A JP9332741 A JP 9332741A JP 33274197 A JP33274197 A JP 33274197A JP H11167526 A JPH11167526 A JP H11167526A
Authority
JP
Japan
Prior art keywords
memory
data
cpu
bus
scramble
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
JP9332741A
Other languages
Japanese (ja)
Inventor
Yasuhisa Oshima
靖久 大嶋
Shigeru Suzuki
鈴木  茂
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.)
Tamura Electric Works Ltd
Original Assignee
Tamura Electric Works Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tamura Electric Works Ltd filed Critical Tamura Electric Works Ltd
Priority to JP9332741A priority Critical patent/JPH11167526A/en
Publication of JPH11167526A publication Critical patent/JPH11167526A/en
Pending legal-status Critical Current

Links

Landscapes

  • Memory System (AREA)
  • Storage Device Security (AREA)
  • Bus Control (AREA)

Abstract

PROBLEM TO BE SOLVED: To prevent an outsider from analyzing the program stored in a memory and also transforming wrong the program by switching a bus to a pattern different from the normal one when a CPU writes the data into the memory and switching again the bus to the normal pattern when the CPU reads the data out of the memory. SOLUTION: The scramble value is set to a data scramble/descramble circuit 5 and an address scramble circuit 6 which are contained in a scramble circuit 7. Thus, a data bus DB and an address bus AB are partly scrambled and connected to a data terminal DT and an address terminal AD of an SRAM 3 or a flash memory 4 as a scramble data bus SQDB and a scramble address bus SQAB respectively. A CPU 1 writes the scramble value into a non-scramble area of the memory 4. Then the CPU 1 copies an application program of the SRAM 3 to the memory 4.

Description

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

【0001】[0001]

【発明の属する技術分野】本発明は、メモリに対しデー
タの書き込みを行うメモリリード・ライト方法及びその
装置に関する。
The present invention relates to a memory read / write method for writing data to a memory and an apparatus therefor.

【0002】[0002]

【従来の技術】一般にCPUにROMやRAMなどのメ
モリを接続する場合、メモリにはCPUからのアドレス
バスが、上位の例えばアドレスビット線AB15から下
位のアドレスビット線AB0まで順番に接続される。ま
た、データバスについても、上位の例えばデータビット
線DB7から下位のデータビット線DB0まで順番に接
続される。したがって、上記メモリにプログラムが格納
されている場合は、そのプログラムはメモリの下位アド
レスから上位アドレスの方向へ順番に格納される。
2. Description of the Related Art Generally, when a memory such as a ROM or a RAM is connected to a CPU, an address bus from the CPU is connected to the memory in order from an upper address bit line AB15 to a lower address bit line AB0. The data bus is also connected in order from the upper data bit line DB7 to the lower data bit line DB0. Therefore, when a program is stored in the memory, the program is stored in order from a lower address to an upper address of the memory.

【0003】[0003]

【発明が解決しようとする課題】このようにメモリのプ
ログラムは、下位アドレスから上位アドレスの方向へ順
番に格納されるため、上記メモリに対し上記CPUと同
様なアドレス順序で接続される例えばROMライタやイ
ンサーキットエミュレータなどを使用することにより、
上記メモリのプログラムは容易に読み出すことができ
る。こうしてメモリから読み出されたプログラムは第三
者により解析され、そのプログラムが第三者により不正
に書き替えされる恐れがあるという問題があった。した
がって本発明は、メモリに格納されたプログラムの第三
者による解析を防止し、プログラムの不正改造を阻止す
ることを目的とする。
As described above, since the programs of the memory are stored in order from the lower address to the upper address, for example, a ROM writer is connected to the memory in the same address order as the CPU. And using an in-circuit emulator, etc.
The program in the memory can be easily read. The program read from the memory in this way is analyzed by a third party, and there is a problem that the program may be illegally rewritten by the third party. Therefore, an object of the present invention is to prevent a program stored in a memory from being analyzed by a third party and prevent unauthorized modification of the program.

【0004】[0004]

【課題を解決するための手段】このような課題を解決す
るために本発明は、CPUと、アドレスバス及びデータ
バスからなるバスを介しCPUに接続されるメモリとか
らなり、CPUはメモリに対しバスを介してデータの書
き込みを行うメモリリード・ライト装置において、CP
Uがメモリにデータを書き込む際にはバスを通常のパタ
ーンと異なるパターンに切り替える第1のステップと、
CPUがメモリからデータを読み出す際にはバスを通常
のパターンに復旧する第2のステップとを有するメモリ
リード・ライト方法である。また、CPUとメモリとの
間に、CPUがメモリにデータを書き込む際にデータバ
スを通常のパターンと異なるパターンに切り替える第1
のスクランブル回路と、CPUがメモリからデータを読
み出す際にデータバスを通常のパターンに復旧する第2
のディスクランブル回路とを設けたものである。また、
CPUがメモリにデータを書き込む際にアドレスバスを
通常のパターンと異なるパターンに切り替える第2のス
クランブル回路及びCPUがメモリからデータを読み出
す際にアドレスバスを通常のパターンに復旧する第2の
ディスクランブル回路の少なくとも一方を設けたもので
ある。また、CPUとメモリとの間に、前記第1のスク
ランブル回路と第1のディスクランブル回路とを設ける
と共に、第2のスクランブル回路及び第2のディスクラ
ンブル回路の少なくとも一方を設けたものである。ま
た、メモリにプログラムデータを書き込む書き込み手段
と、CPUとメモリとの間に設けられバス切替を行うス
クランブル回路とを設け、CPUはプログラムデータを
受信すると所定のパターンに基づきスクランブル回路に
バスの切替を行わせるとともに、書き込み手段によりス
クランブル回路を介しメモリにプログラムデータを書き
込ませるものである。
SUMMARY OF THE INVENTION In order to solve such a problem, the present invention comprises a CPU and a memory connected to the CPU via a bus including an address bus and a data bus. In a memory read / write device that writes data via a bus,
A first step of switching the bus to a pattern different from the normal pattern when U writes data to the memory;
A second step of restoring the bus to a normal pattern when the CPU reads data from the memory. Further, between the CPU and the memory, when the CPU writes data to the memory, the data bus switches to a pattern different from the normal pattern.
And a second circuit for restoring the data bus to a normal pattern when the CPU reads data from the memory.
And a descrambling circuit. Also,
A second scramble circuit for switching an address bus to a pattern different from a normal pattern when the CPU writes data to the memory, and a second descramble circuit for restoring the address bus to the normal pattern when the CPU reads data from the memory At least one of which is provided. Further, between the CPU and the memory, the first scramble circuit and the first descramble circuit are provided, and at least one of the second scramble circuit and the second descramble circuit is provided. Further, a writing means for writing program data to the memory and a scramble circuit provided between the CPU and the memory for switching the bus are provided. When the CPU receives the program data, the CPU switches the bus to the scramble circuit based on a predetermined pattern. The program data is written into the memory via the scramble circuit by the writing means.

【0005】[0005]

【発明の実施の形態】以下、本発明について図面を参照
して説明する。図1は、本発明に係るメモリリード・ラ
イト装置の構成を示すブロック図である。同図におい
て、この装置は、CPU1と、ROM2と、データが書
き込まれる際にスクランブルの対象となるSRAM3及
びフラッシュメモリ4等のスクランブル対象メモリと、
CPU1とスクランブル対象メモリとの間に接続されデ
ータバスDBのスクランブル及びディスクランブルを行
うデータスクランブル/ディスクランブル回路5及びア
ドレスバスABのスクランブルを行うアドレススクラン
ブル回路6からなるスクランブル回路7とから構成され
る。
DESCRIPTION OF THE PREFERRED EMBODIMENTS The present invention will be described below with reference to the drawings. FIG. 1 is a block diagram showing a configuration of a memory read / write device according to the present invention. In this figure, this device comprises a CPU 1, a ROM 2, a scramble target memory such as an SRAM 3 and a flash memory 4 which are scrambled when data is written,
A scramble circuit 7 is connected between the CPU 1 and the memory to be scrambled and includes a data scramble / descramble circuit 5 for scrambling and descrambling the data bus DB and an address scramble circuit 6 for scrambling the address bus AB. .

【0006】ここで、図示しないROMライタにより、
ROM2に、本装置のリセット直後に起動され本装置の
イニシャライズ(初期化処理)を行うプログラム,SR
AM3などのスクランブル対象メモリのバスにスクラン
ブルをかけるためのプログラム及びSRAM3等にアプ
リケーションプログラムをダウンロードするためのプロ
グラムを格納し、そのR0M2をCPU1やSRAM3
などが搭載される基板(図示省略)に実装した後、その
基板とパソコンなどのダウンロード装置である上位装置
8とを接続し、基板に電源を投入する。この場合、CP
U1は電源供給されてリセットされそのリセットが解除
された直後に、まずROM2のプログラムを実行して装
置の初期化処理を行った後、フラッシュメモリ4にプロ
グラムが書き込み済みか否かをチェックし、初期状態で
はフラッシュメモリ4にはプログラムが格納されていな
いことからプログラムダウンロード待ち状態に移行す
る。その後、CPU1は、後述するスクランブルキーレ
ジスタにスクランブル値を設定してSRAM3またはフ
ラッシュメモリ4へのバスに対しスクランブルをかけ
る。
Here, a ROM writer (not shown)
A program, SR, which is started immediately after resetting the apparatus and is used to initialize the apparatus (initialization process)
A program for scrambling a bus of a memory to be scrambled such as AM3 and a program for downloading an application program to SRAM3 or the like are stored, and the R0M2 is stored in the CPU1 or SRAM3.
Are mounted on a board (not shown) on which the board is mounted, and the board is connected to the host device 8 which is a download device such as a personal computer, and the power is turned on to the board. In this case, CP
Immediately after power is supplied and reset and the reset is released, U1 first executes a program in the ROM 2 to perform initialization processing of the device, and then checks whether or not the program has been written in the flash memory 4. In the initial state, since no program is stored in the flash memory 4, the state shifts to a program download waiting state. Thereafter, the CPU 1 sets a scramble value in a scramble key register described later and scrambles the bus to the SRAM 3 or the flash memory 4.

【0007】即ち、スクランブル回路7内のデータスク
ランブル/ディスクランブル回路5及びアドレススクラ
ンブル回路6に対し、それぞれスクランブル値を設定す
ることによりデータバスDBの一部及びアドレスバスA
Bの一部にスクランブルをかけさせスクランブルデータ
バスSQDB及びスクランブルアドレスバスSQABと
してSRAM3またはフラッシュメモリ4のデータ端子
DT及びアドレス端子ADに接続させるようにする。そ
してその後、CPU1はフラッシュメモリ4の非スクラ
ンブルエリアに上記スクランブル値を書き込む。なお、
既にフラッシュメモリ4にスクランブル値が設定されて
いる場合はこの設定値を読み出してスクランブルキーレ
ジスタに設定する。こうしたスクランブル処理の後、C
PU1は引き続きROM2のプログラムを実行し上位装
置8からダウンロードされるアプリケーションプログラ
ムを受信すると、一部にスクランブルがかけられたバス
を介しまずSRAM3へそのプログラムデータを順次書
き込む。その後、CPU1はSRAM3のアプリケーシ
ョンプログラムをフラッシュメモリ4にコピーするとと
もに、そのフラッシュメモリ4のプログラムを実行しア
プリケーション処理を行う。
That is, a part of the data bus DB and the address bus A are set by setting scramble values for the data scramble / descramble circuit 5 and the address scramble circuit 6 in the scramble circuit 7, respectively.
A part of B is scrambled so as to be connected to a data terminal DT and an address terminal AD of the SRAM 3 or the flash memory 4 as a scramble data bus SQDB and a scramble address bus SQAB. Thereafter, the CPU 1 writes the scramble value in the non-scramble area of the flash memory 4. In addition,
If a scramble value has already been set in the flash memory 4, this set value is read out and set in the scramble key register. After such scrambling, C
When the PU 1 continuously executes the program in the ROM 2 and receives the application program downloaded from the host device 8, the PU 1 sequentially writes the program data into the SRAM 3 via a partially scrambled bus. Thereafter, the CPU 1 copies the application program in the SRAM 3 to the flash memory 4 and executes the program in the flash memory 4 to perform application processing.

【0008】図2はアドレススクランブル回路6の一例
を示す回路図であり、この回路6はスクランブルキーレ
ジスタ6Aと、バス接続切替部6Bとからなる。なお、
バス接続切替部6Bは、アンドゲート81〜84と、オ
アゲート85,86とから構成される。スクランブルキ
ーレジスタ6Aは、上記のリセット信号RESETの入
力によりリセット直後は、出力端子SEL1,SEL2
はそれぞれHレベル(即ち、「1」),Lレベル(即ち
「0」)となっている。
FIG. 2 is a circuit diagram showing an example of the address scramble circuit 6, which comprises a scramble key register 6A and a bus connection switching section 6B. In addition,
The bus connection switching unit 6B includes AND gates 81 to 84 and OR gates 85 and 86. Immediately after the reset signal RESET is input, the scramble key register 6A outputs the output terminals SEL1 and SEL2.
Are H level (ie, “1”) and L level (ie, “0”), respectively.

【0009】なお、このスクランブルキーレジスタ6A
の出力端子SEL1はバス接続切替部6Bのアンドゲー
ト81,83の一方の入力端子に、また、スクランブル
キーレジスタ6Aの出力端子SEL2はバス接続切替部
6Bのアンドゲート82,84の一方の入力端子に接続
されている。ここで、図2に示すように、CPU1から
のアドレスバスABのうち最上位のアドレスビット線A
Bnがアンドゲート81,82の他方の入力端子に、ま
た次位のアドレスビット線ABn−1がアンドゲート8
3,84の他方の入力端子に接続されるように構成され
ているため、各アドレスビット線ABn,ABn−1が
それぞれ「0」,「0」の場合は、各アンドゲート81
〜84の出力は「0」となり、したがってオアゲート8
5,86を経由してSRAM3またはフラッシュメモリ
4に出力される対応のスクランブルアドレスビット線S
QABn,SQABn−1もそれぞれ「0」,「0」と
なる。
The scramble key register 6A
Is an input terminal of one of AND gates 81 and 83 of the bus connection switching unit 6B, and an output terminal SEL2 of the scramble key register 6A is one input terminal of AND gates 82 and 84 of the bus connection switching unit 6B. It is connected to the. Here, as shown in FIG. 2, the uppermost address bit line A of the address bus AB from the CPU 1
Bn is connected to the other input terminal of the AND gates 81 and 82, and the next address bit line ABn-1 is connected to the AND gate 8
3 and 84 are connected to the other input terminals, so that when each of the address bit lines ABn and ABn-1 is "0" and "0", respectively, each AND gate 81
The output of .about.84 becomes "0", so that the OR gate 8
5 and 86, the corresponding scramble address bit line S output to the SRAM 3 or the flash memory 4
QABn and SQABn-1 are also "0" and "0", respectively.

【0010】また、各アドレスビット線ABn,ABn
−1がそれぞれ「0」,「1」の場合は、リセット直後
にはスクランブルキーレジスタ6Aの出力端子SEL
1,SEL2はそれぞれ「1」,「0」であることか
ら、各アンドゲート81〜84のうちアンドゲート83
の出力のみが「1」となり、従ってこれと接続されるオ
アゲート86の出力が「1」となり、この結果、SRA
M3またはフラッシュメモリ4に出力される対応のスク
ランブルアドレスビット線SQABn,SQABn−1
はそれぞれ「0」,「1」となる。また、各アドレスビ
ット線ABn,ABn−1がそれぞれ「1」,「0」の
場合は、リセット直後にはアンドゲート81の出力のみ
が「1」となり、したがってオアゲート85,86を経
由してSRAM3またはフラッシュメモリ4に出力され
る対応のスクランブルアドレスビット線SQABn,S
QABn−1はそれぞれ「1」,「0」となる。
Further, each address bit line ABn, ABn
When -1 is "0" and "1" respectively, the output terminal SEL of the scramble key register 6A immediately after the reset.
1 and SEL2 are “1” and “0”, respectively.
Is "1", and the output of the OR gate 86 connected to this is "1". As a result, the SRA
M3 or corresponding scramble address bit lines SQABn, SQABn-1 output to flash memory 4
Are "0" and "1", respectively. When the address bit lines ABn and ABn-1 are "1" and "0", respectively, only the output of the AND gate 81 becomes "1" immediately after resetting. Alternatively, the corresponding scramble address bit lines SQABn, S output to the flash memory 4
QABn-1 is "1" and "0", respectively.

【0011】さらに、各アドレスビット線ABn,AB
n−1がそれぞれ「1」,「1」の場合は、リセット直
後にはアンドゲート81,83の各出力のみが「1」と
なり、したがってオアゲート85,86を経由してSR
AM3またはフラッシュメモリ4に出力される対応のス
クランブルアドレスビット線SQABn,SQABn−
1はそれぞれ「1」,「1」となる。このように、リセ
ット直後には、CPU1から出力される各アドレスビッ
ト線ABn,ABn−1の値に応じた値がそれぞれスク
ランブルアドレスビット線SQABn,SQABn−1
からSRAM3またはフラッシュメモリ4に出力され
る。
Further, each address bit line ABn, AB
When n-1 is "1" and "1", respectively, only the outputs of the AND gates 81 and 83 become "1" immediately after the reset.
The corresponding scramble address bit lines SQABn, SQABn- output to the AM 3 or the flash memory 4
1 is “1” and “1”, respectively. Thus, immediately after the reset, the values corresponding to the values of the address bit lines ABn and ABn-1 output from the CPU 1 are respectively set to the scramble address bit lines SQABn and SQABn-1.
Is output to the SRAM 3 or the flash memory 4.

【0012】ここで、リセット直後にCPU1がアドレ
スバスABによりスクランブルキーレジスタ6Aを指定
するとともに、この指定したスクランブルキーレジスタ
6Aに対しデータバスDBを介して所定値を設定し、そ
の出力端子SEL1,SEL2がそれぞれ「0」,
「1」となったとすると、各アドレスビット線ABn,
ABn−1がそれぞれ「0」,「0」の場合は、対応の
スクランブルアドレスビット線SQABn,SQABn
−1はそれぞれ「0」,「0」となるが、各アドレスビ
ット線ABn,ABn−1がそれぞれ「0」,「1」の
場合は、アンドゲート84の出力のみが「1」となり、
従ってこれと接続されるオアゲート85の出力が「1」
となることから、SRAM3またはフラッシュメモリ4
に出力される対応のスクランブルアドレスビット線SQ
ABn,SQABn−1はそれぞれ「1」,「0」とな
る。
Immediately after the reset, the CPU 1 designates the scramble key register 6A by the address bus AB, sets a predetermined value to the designated scramble key register 6A via the data bus DB, and sets its output terminals SEL1, SEL2 is "0",
If it becomes "1", each address bit line ABn,
When ABn-1 is "0" and "0", respectively, the corresponding scramble address bit lines SQABn, SQABn
-1 are "0" and "0", respectively. When the address bit lines ABn and ABn-1 are "0" and "1" respectively, only the output of the AND gate 84 becomes "1".
Therefore, the output of the OR gate 85 connected thereto is "1".
Therefore, the SRAM 3 or the flash memory 4
Corresponding scramble address bit line SQ output to
ABn and SQABn-1 are "1" and "0", respectively.

【0013】また、各アドレスビット線ABn,ABn
−1がそれぞれ「1」,「0」の場合は、アンドゲート
82の出力のみが「1」となり、従ってこれと接続され
るオアゲート86の出力が「1」となることから、RA
M3またはフラッシュメモリ4に出力される対応のスク
ランブルアドレスビット線SQABn,SQABn−1
はそれぞれ「0」,「1」となる。このように、リセッ
ト直後にスクランブルキーレジスタ6Aに所定値を設定
することにより、CPU1から出力されるアドレスビッ
ト線ABnがSRAM3またはフラッシュメモリ4に入
力されるスクランブルアドレスビット線SQABn−1
に切り替えられ、CPU1から出力されるアドレスビッ
ト線ABn−1がSRAM3またはフラッシュメモリ4
に入力されるスクランブルアドレスビット線SQABn
に切り替えられる。
Each address bit line ABn, ABn
When -1 is "1" and "0", respectively, only the output of the AND gate 82 becomes "1", and the output of the OR gate 86 connected thereto becomes "1".
M3 or corresponding scramble address bit lines SQABn, SQABn-1 output to flash memory 4
Are "0" and "1", respectively. By setting a predetermined value in the scramble key register 6A immediately after the reset, the address bit line ABn output from the CPU 1 is changed to the scramble address bit line SQABn-1 input to the SRAM 3 or the flash memory 4.
And the address bit line ABn-1 output from the CPU 1 is switched to the SRAM 3 or the flash memory 4.
Address bit line SQABn input to
Can be switched to

【0014】したがって、CPU1がアドレスビット線
ABnによりSRAM3またはフラッシュメモリ4へ書
き込むプログラムデータは、SRAM3またはフラッシ
ュメモリ4のスクランブルアドレスビット線SQABn
−1に対応するエリアに書き込まれる。また、CPU1
がアドレスビット線ABn−1によりSRAM3または
フラッシュメモリ4へ書き込むプログラムデータは、S
RAM3またはフラッシュメモリ4のスクランブルアド
レスビット線SQABnに対応するエリアに書き込まれ
る。この結果、こうしてフラッシュメモリ4に書き込ま
れたプログラムデータを第三者がアドレスバスAB及び
データバスDBを介して読み出したとしても、フラッシ
ュメモリ4からは、例えば連続すべきプログラムが分断
されて別のプログラムがそれに続くといったようなラン
ダムなプログラムデータが読み出されるため、第三者に
よるプログラム解析が不可能になる。
Therefore, the program data written by the CPU 1 to the SRAM 3 or the flash memory 4 through the address bit line ABn is the scramble address bit line SQABn of the SRAM 3 or the flash memory 4.
It is written to the area corresponding to -1. CPU1
Is written to the SRAM 3 or the flash memory 4 by the address bit line ABn-1.
The data is written to an area of the RAM 3 or the flash memory 4 corresponding to the scramble address bit line SQABn. As a result, even if a third party reads out the program data written in the flash memory 4 through the address bus AB and the data bus DB, for example, a program to be continued is divided from the flash memory 4 and another program is read out. Since random program data such as the one following the program is read, program analysis by a third party becomes impossible.

【0015】なお、図2の例では、CPU1からのアド
レスバスABの各アドレスビット線AB0〜ABnのう
ち上位のアドレスビット線ABn,ABn−1について
スクランブルをかけ、他のアドレスビット線AB0〜A
Bn−2についてはスクランブルをかけずにSRAM3
またはフラッシュメモリ4に直接接続した例について説
明したが、全てのアドレスビット線AB0〜ABnにつ
いてスクランブルをかけるようにしてもよい。
In the example shown in FIG. 2, the upper address bit lines ABn and ABn-1 of the address bit lines AB0 to ABn of the address bus AB from the CPU 1 are scrambled, and the other address bit lines AB0 to ABn are scrambled.
Bn-2 SRAM3 without scrambling
Alternatively, although an example of direct connection to the flash memory 4 has been described, scrambling may be applied to all the address bit lines AB0 to ABn.

【0016】次に、図3は図1に示すデータスクランブ
ル/ディスクランブル回路5の具体的な構成を示す回路
図である。この回路5はスクランブルキーレジスタ5A
と、バス接続切替部5Bとからなる。なお、バス接続切
替部6Bは、スクランブル回路5B1及びディスクラン
ブル回路5B2などから構成される。スクランブル回路
5B1は、アンドゲート51〜54と、オアゲート5
5,56と、ゲート回路57,58とから構成される。
また、ディスクランブル回路5B2は、アンドゲート6
1〜64と、オアゲート65,66と、ゲート回路6
7,68とから構成される。
FIG. 3 is a circuit diagram showing a specific configuration of the data scramble / descramble circuit 5 shown in FIG. This circuit 5 has a scramble key register 5A.
And a bus connection switching unit 5B. The bus connection switching unit 6B includes a scramble circuit 5B1 and a descramble circuit 5B2. The scramble circuit 5B1 includes AND gates 51 to 54 and an OR gate 5
5 and 56, and gate circuits 57 and 58.
The descramble circuit 5B2 includes an AND gate 6
1 to 64, OR gates 65 and 66, and gate circuit 6
7, 68.

【0017】また、バス接続切替部6B内のゲート回路
71は、SRAM3またはフラッシュメモリ4へのデー
タ書き込み時にCPU1から「L」レベル(=「0」)
のチップセレクト信号CSが出力されたときに「0」を
出力してスクランブル回路5B1の各ゲート回路57,
58に与え各ゲート回路57,58をオンさせることに
より、信号を通過させるものである。また、バス接続切
替部6B内のゲート回路72は、SRAM3またはフラ
ッシュメモリ4のデータ読み出し時にCPU1からそれ
ぞれ「L」レベル(=「0」)のチップセレクト信号C
S及びリード信号RDが出力されたときに「0」を出力
してディスクランブル回路5B2の各ゲート回路67,
68に与え各ゲート回路67,68をオンさせることに
より、信号を通過させるものである。なお、スクランブ
ルキーレジスタ5Aは、図2のアドレススクランブル回
路6のスクランブルキーレジスタ6Aと同様、リセット
信号RESETの入力によりリセット直後は、出力端子
SEL1,SEL2はそれぞれ「1」,「0」となって
いる。
The gate circuit 71 in the bus connection switching section 6B receives an "L" level (= "0") from the CPU 1 when writing data to the SRAM 3 or the flash memory 4.
Is output when the chip select signal CS is output, and each gate circuit 57 of the scramble circuit 5B1 is output.
The signal is passed to the gate circuit 58 to turn on the respective gate circuits 57 and 58 to pass the signal. Further, the gate circuit 72 in the bus connection switching unit 6B receives the “L” level (= “0”) chip select signal C from the CPU 1 when reading data from the SRAM 3 or the flash memory 4.
When the read signal S and the read signal RD are output, “0” is output and each gate circuit 67 of the descrambling circuit 5B2,
The signal is passed to the gate circuit 68 to turn on the gate circuits 67 and 68. In the scramble key register 5A, just like the scramble key register 6A of the address scramble circuit 6 in FIG. 2, the output terminals SEL1 and SEL2 become "1" and "0", respectively, immediately after being reset by the input of the reset signal RESET. I have.

【0018】また、スクランブルキーレジスタ5Aの出
力端子SEL1はスクランブル回路5B1のアンドゲー
ト51,53及びディスクランブル回路5B2のアンド
ゲート61,63の一方の入力端子に、また、スクラン
ブルキーレジスタ5Aの出力端子SEL2はスクランブ
ル回路5B1のアンドゲート52,54及びディスクラ
ンブル回路5B2のアンドゲート62,64の一方の入
力端子に接続されている。ここで、図3に示すように、
CPU1からのデータバスDBのうち最上位のデータビ
ット線DBnがアンドゲート51,52の他方の入力端
子に、また次位のデータビット線DBn−1がアンドゲ
ート53,54の他方の入力端子に接続されるように構
成されているため、CPU1がSRAM3またはフラッ
シュメモリ4を選択してデータバスDBを介しデータを
書き込む際に各データビット線DBn,DBn−1がそ
れぞれ「0」,「0」の場合は、各アンドゲート51〜
54の出力は「0」となり、したがってオアゲート5
5,56及びゲート回路57,58を経由してSRAM
3またはフラッシュメモリ4に出力される対応のスクラ
ンブルデータビット線SQDBn,SQDBn−1もそ
れぞれ「0」,「0」となる。
The output terminal SEL1 of the scramble key register 5A is connected to one of the input terminals of the AND gates 51 and 53 of the scramble circuit 5B1 and the AND gates 61 and 63 of the descramble circuit 5B2, and the output terminal of the scramble key register 5A. SEL2 is connected to one input terminal of the AND gates 52, 54 of the scramble circuit 5B1 and one of the AND gates 62, 64 of the descramble circuit 5B2. Here, as shown in FIG.
The uppermost data bit line DBn of the data bus DB from the CPU 1 is connected to the other input terminal of the AND gates 51 and 52, and the next data bit line DBn-1 is connected to the other input terminal of the AND gates 53 and 54. When the CPU 1 selects the SRAM 3 or the flash memory 4 and writes data via the data bus DB, the data bit lines DBn and DBn−1 are “0” and “0”, respectively. In the case of, each AND gate 51-
The output of the OR gate 5 becomes "0", and
SRAM via the gate circuits 5 and 56 and the gate circuits 57 and 58
3 or the corresponding scrambled data bit lines SQDBn and SQDBn-1 output to the flash memory 4 also become "0" and "0", respectively.

【0019】また、各データビット線DBn,DBn−
1がそれぞれ「0」,「1」の場合は、リセット直後に
はスクランブルキーレジスタ5Aの出力端子SEL1,
SEL2はそれぞれ「1」,「0」であることから、各
アンドゲート51〜54のうちアンドゲート53の出力
のみが「1」となり、従ってこれと接続されるオアゲー
ト56の出力が「1」となり、この結果、SRAM3ま
たはフラッシュメモリ4に出力される対応のスクランブ
ルデータビット線SQDBn,SQDBn−1もそれぞ
れ「0」,「1」となる。また、各データビット線DB
n,DBn−1がそれぞれ「1」,「0」の場合は、リ
セット直後にはアンドゲート51の出力のみが「1」と
なり、従って対応のスクランブルデータビット線SQD
Bn,SQDBn−1もそれぞれ「1」,「0」とな
る。さらに、各データビット線DBn,DBn−1がそ
れぞれ「1」,「1」の場合は、リセット直後にはアン
ドゲート51,53の各出力のみが「1」となり、従っ
て対応のスクランブルデータビット線SQDBn,SQ
DBn−1はそれぞれ「1」,「1」となる。このよう
にリセット直後にはスクランブル回路5B1は機能せ
ず、CPU1がデータバスDBを介してデータを出力す
る場合は、各データビット線DBn,DBn−1の値に
応じた値がそれぞれスクランブルデータビット線SQD
Bn,SQDBn−1からSRAM3またはフラッシュ
メモリ4に出力される。
Each data bit line DBn, DBn-
When 1 is “0” and “1”, respectively, the output terminals SEL1 and SEL1 of the scramble key register 5A immediately after reset.
Since SEL2 is "1" and "0", only the output of the AND gate 53 among the AND gates 51 to 54 becomes "1", and the output of the OR gate 56 connected thereto becomes "1". As a result, the corresponding scrambled data bit lines SQDBn and SQDBn-1 output to the SRAM 3 or the flash memory 4 also become "0" and "1", respectively. Also, each data bit line DB
When n and DBn-1 are "1" and "0", respectively, only the output of the AND gate 51 becomes "1" immediately after reset, and therefore, the corresponding scrambled data bit line SQD
Bn and SQDBn-1 are also "1" and "0", respectively. Further, when the data bit lines DBn and DBn-1 are "1" and "1", respectively, only the outputs of the AND gates 51 and 53 become "1" immediately after the reset, and accordingly, the corresponding scrambled data bit lines SQDBn, SQ
DBn-1 is "1" and "1", respectively. Thus, immediately after the reset, the scramble circuit 5B1 does not function, and when the CPU 1 outputs data via the data bus DB, the values corresponding to the values of the data bit lines DBn and DBn-1 are respectively scrambled data bits. Line SQD
Bn and SQDBn−1 are output to the SRAM 3 or the flash memory 4.

【0020】そして、リセット直後にSRAM3または
フラッシュメモリ4から各スクランブルデータビット線
SQDBn,SQDBn−1を介してデータを読み出し
たときにスクランブルデータビット線SQDBn,SQ
DBn−1がそれぞれ「0」,「0」の場合は、ディス
クランブル回路5B2の各アンドゲート61〜64の出
力は「0」となり、したがってオアゲート65,66及
びゲート回路67,68を経由してCPU1に出力され
る対応のデータビット線DBn,DBn−1もそれぞれ
「0」,「0」となる。
When data is read from the SRAM 3 or the flash memory 4 via the scrambled data bit lines SQDBn and SQDBn-1 immediately after the reset, the scrambled data bit lines SQDBn and SQDB
When DBn-1 is "0" and "0" respectively, the output of each of the AND gates 61 to 64 of the descramble circuit 5B2 becomes "0", and therefore, via the OR gates 65 and 66 and the gate circuits 67 and 68. The corresponding data bit lines DBn and DBn-1 output to the CPU 1 also become "0" and "0", respectively.

【0021】また、各スクランブルデータビット線SQ
DBn,SQDBn−1がそれぞれ「0」,「1」の場
合は、リセット直後にはアンドゲート63の出力のみが
「1」となり、従ってこれと接続されるオアゲート66
の出力も「1」になることから、CPU1に出力される
対応のデータビット線DBn,DBn−1もそれぞれ
「0」,「1」となる。また、各スクランブルデータビ
ット線SQDBn,SQDBn−1がそれぞれ「1」,
「0」の場合は、リセット直後にはアンドゲート61の
出力のみが「1」となり、従ってこれと接続されるオア
ゲート65の出力も「1」になることから、対応のデー
タビット線DBn,DBn−1もそれぞれ「1」,
「0」となる。さらに、各スクランブルデータビット線
SQDBn,SQDBn−1がそれぞれ「1」,「1」
の場合は、リセット直後にはアンドゲート61,63の
各出力のみが「1」となり、したがって対応のデータビ
ット線DBn,DBn−1はそれぞれ「1」,「1」と
なる。このようにリセット直後にはディスクランブル回
路5B2も機能せず、CPU1がSRAM3またはフラ
ッシュメモリ4からデータを入力する場合は、各スクラ
ンブルデータビット線SQDBn,SQDBn−1の値
に応じた値がそれぞれデータビット線DBn,DBn−
1からCPU1に出力される。
Each scramble data bit line SQ
When DBn and SQDBn-1 are "0" and "1", respectively, only the output of the AND gate 63 becomes "1" immediately after the reset, and therefore, the OR gate 66 connected thereto is provided.
Also becomes "1", the corresponding data bit lines DBn and DBn-1 outputted to the CPU 1 also become "0" and "1", respectively. Also, each of the scrambled data bit lines SQDBn and SQDBn-1 is "1",
In the case of "0", only the output of the AND gate 61 becomes "1" immediately after the reset, and therefore the output of the OR gate 65 connected thereto also becomes "1". Therefore, the corresponding data bit lines DBn, DBn -1 is also "1",
It becomes "0". Further, each of the scrambled data bit lines SQDBn and SQDBn-1 is "1" and "1", respectively.
In the case of, only the outputs of the AND gates 61 and 63 become "1" immediately after the reset, and the corresponding data bit lines DBn and DBn-1 become "1" and "1", respectively. Thus, immediately after the reset, the descramble circuit 5B2 also does not function, and when the CPU 1 inputs data from the SRAM 3 or the flash memory 4, the value corresponding to the value of each of the scrambled data bit lines SQDBn and SQDBn-1 is set to the data. Bit lines DBn, DBn-
1 to the CPU 1.

【0022】ここで、リセット直後にCPU1がアドレ
スバスABによりスクランブルキーレジスタ5Aを指定
するとともに、この指定したスクランブルキーレジスタ
5Aに対しデータバスDBを介して所定値を設定し、そ
の出力端子SEL1,SEL2がそれぞれ「0」,
「1」となったとすると、各データビット線DBn,D
Bn−1がそれぞれ「0」,「0」の場合は、スクラン
ブル回路5B1の対応のスクランブルデータビット線S
QDBn,SQDBn−1はそれぞれ「0」,「0」と
なるが、各データビット線DBn,DBn−1がそれぞ
れ「0」,「1」の場合は、アンドゲート54の出力の
みが「1」となり、従ってこれと接続されるオアゲート
55の出力が「1」になることからゲート回路57,5
8を経由してSRAM3またはフラッシュメモリ4に出
力される対応のスクランブルデータビット線SQDB
n,SQDBn−1は、それぞれ「1」,「0」とな
る。
Immediately after the reset, the CPU 1 designates the scramble key register 5A by the address bus AB, sets a predetermined value to the designated scramble key register 5A via the data bus DB, and sets its output terminals SEL1, SEL2 is "0",
If it becomes "1", each data bit line DBn, D
When Bn-1 is "0" and "0", respectively, the corresponding scramble data bit line S of the scramble circuit 5B1
QDBn and SQDBn-1 are "0" and "0", respectively. When the data bit lines DBn and DBn-1 are "0" and "1", only the output of the AND gate 54 is "1". Therefore, the output of the OR gate 55 connected thereto becomes "1", so that the gate circuits 57, 5
8, the corresponding scrambled data bit line SQDB output to the SRAM 3 or the flash memory 4
n and SQDBn−1 are “1” and “0”, respectively.

【0023】また、各データビット線DBn,DBn−
1がそれぞれ「1」,「0」の場合は、アンドゲート5
2の出力のみが「1」となり、従ってこれと接続される
オアゲート56の出力が「1」になることからゲート回
路57,58を経由してSRAM3またはフラッシュメ
モリ4に出力される対応のスクランブルデータビット線
SQDBn,SQDBn−1はそれぞれ「0」,「1」
となる。このようにして、リセット直後にスクランブル
キーレジスタ5Aに所定値を設定しスクランブル回路5
B1を機能させることにより、CPU1から出力される
データビット線DBnを経由するデータはスクランブル
データビット線SQDBn−1を経由してSRAM3ま
たはフラッシュメモリ4に格納されると共に、CPU1
から出力されるデータビット線DBn−1を経由するデ
ータはクランブルデータビット線SQDBnを経由して
RAM3またはフラッシュメモリ4に格納される。この
結果、例えばフラッシュメモリ4に書き込まれたプログ
ラムデータを読み出したとしても、フラッシュメモリ4
にはCPU1から出力されるデータとは異なるスクラン
ブルされたプログラムデータが格納されているため、第
三者による解読が不可能になる。
Each data bit line DBn, DBn-
If 1 is “1” and “0” respectively, AND gate 5
2 becomes "1" and the output of the OR gate 56 connected thereto becomes "1". Therefore, the corresponding scrambled data output to the SRAM 3 or the flash memory 4 via the gate circuits 57 and 58 is output. Bit lines SQDBn and SQDBn−1 are “0” and “1”, respectively.
Becomes Thus, immediately after the reset, the predetermined value is set in the scramble key register 5A, and the scramble circuit 5A is set.
By making B1 function, the data output from the CPU 1 via the data bit line DBn is stored in the SRAM 3 or the flash memory 4 via the scrambled data bit line SQDBn-1, and the CPU 1
Is output from the RAM 3 or the flash memory 4 via the data bit line DBn-1 via the data bit line SQDBn. As a result, for example, even if the program data written in the flash memory 4 is read,
Stores scrambled program data different from the data output from the CPU 1 and thus cannot be decrypted by a third party.

【0024】また、こうしたスクランブルデータをSR
AM3またはフラッシュメモリ4から各スクランブルデ
ータビット線SQDBn,SQDBn−1を介して読み
出したときにスクランブルデータビット線SQDBn,
SQDBn−1がそれぞれ「0」,「1」の場合は、デ
ィスクランブル回路5B2の各アンドゲート61〜64
のうち、アンドゲート64の出力のみが「1」となり、
従ってこれと接続されるオアゲート65の出力が「1」
になることからゲート回路67,68を介してCPU1
に出力される対応のデータビット線DBn,DBn−1
がそれぞれ「1」,「0」となる。また、各スクランブ
ルデータビット線SQDBn,SQDBn−1がそれぞ
れ「1」,「0」の場合は、ディスクランブル回路5B
2のアンドゲート62の出力のみが「1」となり、従っ
てこれと接続されるオアゲート66の出力が「1」とな
ることから対応のデータビット線DBn,DBn−1は
それぞれ「0」,「1」となる。
Further, such scramble data is converted to SR
When reading from the AM 3 or the flash memory 4 via each of the scrambled data bit lines SQDBn, SQDBn-1, the scrambled data bit lines SQDBn,
If SQDBn-1 is "0" and "1", respectively, the AND gates 61 to 64 of the descramble circuit 5B2
Among them, only the output of the AND gate 64 becomes “1”,
Therefore, the output of the OR gate 65 connected thereto is "1".
CPU 1 through gate circuits 67 and 68
Corresponding data bit lines DBn, DBn-1 output to
Are "1" and "0", respectively. When the scrambled data bit lines SQDBn and SQDBn-1 are "1" and "0", respectively, the descramble circuit 5B
2 and only the output of the AND gate 62 becomes "1" and the output of the OR gate 66 connected thereto becomes "1". Therefore, the corresponding data bit lines DBn and DBn-1 are "0" and "1", respectively. ".

【0025】このようにしてCPU1からスクランブル
回路5B1を介してSRAM3またはフラッシュメモリ
4に書き込まれたデータは、ディスクランブル回路5B
2により復元されてCPU1に出力される。なお、図3
の例では、CPU1からのデータバスDBの各データビ
ット線DB0〜DBnのうち上位のデータビット線DB
n,DBn−1についてスクランブル/ディスクランブ
ル処理を行い、他のデータビット線DB0〜DBn−2
については上記のスクランブル/ディスクランブル処理
を行わないようにしているが、全てのデータビット線D
B0〜DBnについてスクランブル/ディスクランブル
処理を行うようにしてもよい。
The data written in the SRAM 3 or the flash memory 4 from the CPU 1 through the scramble circuit 5B1 in this manner is transmitted to the descramble circuit 5B.
2 and output to the CPU 1. Note that FIG.
Of the data bit lines DB0 to DBn of the data bus DB from the CPU 1, the upper data bit line DB
n and DBn-1 are scrambled / descrambled, and the other data bit lines DB0 to DBn-2
, The above scramble / descramble processing is not performed, but all the data bit lines D
The scrambling / descrambling process may be performed on B0 to DBn.

【0026】次に図5(a)は、CPU1と、SRAM
3またはフラッシュメモリ4との間を18本のアドレス
線からなるアドレスバスABで接続して、そのうちスク
ランブルされるアドレスビット線をAB12〜AB15
とした場合の例を示す図である。この場合、0番地から
FFFH(16進)番地までの4Kバイトの領域は非ス
クランブルエリアとなり、この非スクランブルエリアに
はリセット時の飛び先アドレスや上述のイニシャライズ
プログラムを格納する。また、1000H(16進)番
地以降の領域はスクランブルエリアであり、そのスクラ
ンブルエリアには、ダウンロードされたアプリケーショ
ンプログラムを格納する。また、図5(b)は、CPU
1とメモリ間を8本のデータ線からなるデータバスDB
で接続し、そのうちスクランブルされるデータビット線
をDB4〜DB7の4ビットとした場合の例を示す図で
ある。
Next, FIG. 5A shows the CPU 1 and the SRAM.
3 or the flash memory 4 via an address bus AB consisting of 18 address lines, of which the address bit lines to be scrambled are AB12 to AB15.
It is a figure showing the example in the case of having set it. In this case, an area of 4 Kbytes from address 0 to FFFH (hexadecimal) is a non-scramble area, in which a jump destination address at the time of reset and the above-described initialization program are stored. The area after the address 1000H (hexadecimal) is a scramble area, and the downloaded application program is stored in the scramble area. FIG. 5B shows the CPU.
Data bus DB consisting of 8 data lines between 1 and memory
FIG. 6 is a diagram showing an example in which the data bit lines to be scrambled are four bits DB4 to DB7.

【0027】上記の図5(a)に示すエリア構成を実現
する場合、図4に示すように、図3のデータスクランブ
ル/ディスクランブル回路5に対し、アドレスバスをデ
コードするデコーダ5Cを付加する。このデコーダ5C
は、アドレスバスABのうち非スクランブルエリアを検
出するもので、その出力をオアゲート73及びアンドゲ
ート74の一方の入力端子に接続する。一方、オアゲー
ト73及びアンドゲート74の他方の入力端子には、ス
クランブルキーレジスタ5Aの各出力端子SEL1,S
EL2を各個に接続する。そして、オアゲート73の出
力はスクランブル回路5B1のアンドゲート51,53
及びディスクランブル回路5B2のアンドゲート61,
63の一方の入力端子に、また、アンドゲート74の出
力はスクランブル回路5B1のアンドゲート52,54
及びディスクランブル回路5B2のアンドゲート62,
64の一方の入力端子にそれぞれ接続する。
In order to realize the area configuration shown in FIG. 5A, a decoder 5C for decoding an address bus is added to the data scramble / descramble circuit 5 shown in FIG. 3, as shown in FIG. This decoder 5C
Detects an unscrambled area of the address bus AB, and connects its output to one input terminal of an OR gate 73 and an AND gate 74. On the other hand, the other input terminals of the OR gate 73 and the AND gate 74 are connected to the respective output terminals SEL1, S1 of the scramble key register 5A.
EL2 is connected to each. The output of the OR gate 73 is supplied to the AND gates 51 and 53 of the scramble circuit 5B1.
And the AND gate 61 of the descramble circuit 5B2,
63 and the output of the AND gate 74 are connected to the AND gates 52 and 54 of the scramble circuit 5B1.
AND gate 62 of descramble circuit 5B2,
64, respectively.

【0028】このように構成することで、CPU1がデ
ータをスクランブルするためにスクランブルキーレジス
タ5Aに所定値を設定し、その出力SEL1,SEL2
が「0」,「1」となった場合でも、デコーダ5Cが非
スクランブルエリアを検出して「1」になると、オアゲ
ート73及びアンドゲート74の各出力はともに「1」
となり、したがってスクランブル回路5B1によるデー
タビット線DBn,DBn−1のスクランブルは行われ
ずにそのままメモリに書き込まれる。また、メモリから
読み出したデータについても、ディスクランブル回路5
B2によるディスクランブルは行われずにそのままCP
U1へ伝達することができる。
With this configuration, the CPU 1 sets a predetermined value in the scramble key register 5A in order to scramble the data, and outputs the outputs SEL1 and SEL2.
Are "0" and "1", when the decoder 5C detects the non-scramble area and becomes "1", the outputs of the OR gate 73 and the AND gate 74 are both "1".
Therefore, the data bit lines DBn and DBn-1 are not scrambled by the scramble circuit 5B1 and are written in the memory as they are. The data read from the memory is also stored in the descramble circuit 5.
CP without performing descrambling by B2
U1.

【0029】このように、アドレスデコーダ2により非
スクランブルエリアを検出するとともに、検出した非ス
クランブルエリアのデータについてはスクランブル/デ
ィスクランブル処理を行わないようにしたものである。
この結果、その非スクランブルエリアをフラッシュメモ
リ4の一部に割り当てるとともに、そのエリアにイニシ
ャライズプログラムやロードプログラムを格納して図1
のROM2のように使用することができ、したがってR
OM2を省略することができる。
As described above, the non-scramble area is detected by the address decoder 2, and the data of the detected non-scramble area is not subjected to the scramble / descramble processing.
As a result, the non-scramble area is allocated to a part of the flash memory 4, and an initialize program and a load program are stored in the area, and FIG.
Can be used like the ROM 2 of
OM2 can be omitted.

【0030】なお、本実施の形態では、スクランブルキ
ーレジスタ5A,6Aに所定のスクランブル値を設定し
てアドレスのスクランブル処理及びデータのスクランブ
ル/ディスクランブル処理を行っているが、この場合、
スクランブルキーレジスタ5A,6Aに固定の設定値の
他に2バイトの他のデータを設定しないと設定が不可能
になるようにしてスクランブルキーレジスタに対するラ
イトプロテクトを強化するようにしても良い。また、リ
セット後にタイマを起動しそのタイマの一定時間内以外
は設定禁止とするようにしても良い。
In the present embodiment, a predetermined scramble value is set in the scramble key registers 5A and 6A to perform address scrambling and data scrambling / descrambling.
The write protection for the scramble key register may be strengthened by setting the scramble key register 5A, 6A in such a manner that the setting becomes impossible unless other data of 2 bytes is set in addition to the fixed set value. Alternatively, a timer may be started after reset, and the setting may be prohibited except within a certain time of the timer.

【0031】[0031]

【発明の効果】以上説明したように本発明によれば、C
PUとメモリとの間に、CPUがメモリにデータを書き
込む際にデータバスを通常のパターンと異なるパターン
に切り替えるスクランブル回路と、CPUがメモリから
データを読み出す際にデータバスを上記異なるパターン
から通常のパターンに復旧するディスクランブル回路と
を設けるようにしたので、メモリからデータが読み出さ
れる際には第三者により解読が不可能なデータが読み出
され、この結果、メモリに格納されたプログラムの第三
者による不正改造を阻止することができる。また、デー
タ書き込み時にアドレスバスを通常のパターンと異なる
パターンに切り替えるスクランブル回路とデータ読み出
し時にアドレスバスを通常のパターンに復旧するディス
クランブル回路の少なくとも一方を設けるようにしたの
で、同様に第三者によるメモリデータの解読を不可とす
ることができる。また、メモリにプログラムデータを書
き込む書き込み手段と、バス切替を行うスクランブル回
路とを設け、CPUはプログラムデータを受信すると所
定のパターンに基づきスクランブル回路にバスの切替を
行わせるとともに、書き込み手段によりスクランブル回
路を介しメモリにプログラムデータを書き込ませるよう
にしたので、メモリには第三者に解読不可能なスクラン
ブルデータが書き込まれ、その結果、メモリのデータを
読み出したとしても、第三者による解読が不可能とな
り、したがってメモリに格納されたプログラムの第三者
による不正改造を阻止できる。
As described above, according to the present invention, C
A scrambling circuit between the PU and the memory for switching the data bus to a different pattern from the normal pattern when the CPU writes data to the memory; and a scramble circuit for switching the data bus from the different pattern to the normal pattern when the CPU reads data from the memory. Since a descrambling circuit for restoring the pattern is provided, when data is read from the memory, data that cannot be decrypted by a third party is read, and as a result, the program stored in the memory is read. It is possible to prevent unauthorized modification by three parties. Also, at least one of a scramble circuit for switching the address bus to a pattern different from the normal pattern when writing data and a descrambling circuit for restoring the address bus to the normal pattern when reading data is provided. Decryption of memory data can be disabled. Further, a writing means for writing program data to the memory and a scramble circuit for switching the bus are provided. When the CPU receives the program data, the CPU causes the scramble circuit to switch the bus based on a predetermined pattern. The program data is written to the memory via the memory, so that the scrambled data that cannot be decoded by a third party is written into the memory. As a result, even if the data in the memory is read, the data cannot be decoded by the third party. This makes it possible to prevent unauthorized modification of the program stored in the memory by a third party.

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

【図1】 本発明に係るメモリリード・ライト装置の構
成を示すブロック図である。
FIG. 1 is a block diagram showing a configuration of a memory read / write device according to the present invention.

【図2】 上記装置内のアドレススクランブル回路の構
成を示す回路図である。
FIG. 2 is a circuit diagram showing a configuration of an address scramble circuit in the device.

【図3】 上記装置内のデータスクランブル/ディスク
ランブル回路の構成を示す回路図である。
FIG. 3 is a circuit diagram showing a configuration of a data scramble / descramble circuit in the device.

【図4】 上記データスクランブル/ディスクランブル
回路の他の構成例を示す回路図である。
FIG. 4 is a circuit diagram showing another configuration example of the data scramble / descramble circuit.

【図5】 上記装置のアドレススクランブル,データク
ランブルの他の例を示す図である。
FIG. 5 is a diagram showing another example of address scrambling and data scrambling of the above device.

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

1…CPU、2…ROM、3…SRAM、4…フラッシ
ュメモリ、5…データスクランブル/ディスクランブル
回路、5A,6A…スクランブルキーレジスタ、5B,
6B…バス接続切替部、5B1…スクランブル回路、5
B2…ディスクランブル回路、5C…デコーダ。
DESCRIPTION OF SYMBOLS 1 ... CPU, 2 ... ROM, 3 ... SRAM, 4 ... Flash memory, 5 ... Data scramble / descramble circuit, 5A, 6A ... Scramble key register, 5B,
6B: bus connection switching unit, 5B1: scramble circuit, 5
B2: descrambling circuit, 5C: decoder.

Claims (5)

【特許請求の範囲】[Claims] 【請求項1】 CPUと、アドレスバス及びデータバス
からなるバスを介し前記CPUに接続されるメモリとか
らなり、前記CPUは前記メモリに対し前記バスを介し
てデータの書き込みを行うメモリリード・ライト装置に
おいて、 CPUがメモリにデータを書き込む際には所定の条件に
応じ前記バスを通常のパターンと異なるパターンに切り
替える第1のステップと、CPUがメモリからデータを
読み出す際には前記バスを通常のパターンに復旧する第
2のステップとを有することを特徴とするメモリリード
・ライト方法。
1. A CPU comprising: a CPU; and a memory connected to the CPU via a bus including an address bus and a data bus, wherein the CPU writes data to the memory via the bus. In the apparatus, a first step of switching the bus to a pattern different from a normal pattern according to a predetermined condition when the CPU writes data to the memory; and a step of switching the bus to a normal pattern when the CPU reads data from the memory. And a second step of restoring to a pattern.
【請求項2】 CPUと、アドレスバス及びデータバス
からなるバスを介し前記CPUに接続されるメモリとか
らなり、前記CPUは前記メモリに対し前記バスを介し
てデータの書き込みを行うメモリリード・ライト装置に
おいて、 前記CPUとメモリとの間に、CPUがメモリにデータ
を書き込む際に前記データバスを所定の条件に応じ通常
のパターンと異なるパターンに切り替える第1のスクラ
ンブル回路と、CPUがメモリからデータを読み出す際
に前記データバスを通常のパターンに復旧する第1のデ
ィスクランブル回路とを備えたことを特徴とするメモリ
リード・ライト装置。
2. A memory read / write which comprises a CPU and a memory connected to the CPU via a bus including an address bus and a data bus, wherein the CPU writes data to the memory via the bus. In the apparatus, a first scramble circuit for switching the data bus to a pattern different from a normal pattern according to a predetermined condition between the CPU and the memory when the CPU writes data to the memory; And a first descramble circuit for restoring the data bus to a normal pattern when reading data from the memory.
【請求項3】 CPUと、アドレスバス及びデータバス
からなるバスを介し前記CPUに接続されるメモリとか
らなり、前記CPUは前記メモリに対し前記バスを介し
てデータの書き込みを行うメモリリード・ライト装置に
おいて、 前記CPUとメモリとの間に、CPUがメモリにデータ
を書き込む際に前記アドレスバスを所定の条件に応じ通
常のパターンと異なるパターンに切り替えるスクランブ
ル回路及びCPUがメモリからデータを読み出す際に前
記アドレスバスを通常のパターンに復旧するディスクラ
ンブル回路の少なくとも一方を備えたことを特徴とする
メモリリード・ライト装置。
And a memory connected to the CPU via a bus including an address bus and a data bus, wherein the CPU writes data to the memory via the bus. In the device, a scramble circuit for switching the address bus to a pattern different from a normal pattern according to a predetermined condition when the CPU writes data to the memory between the CPU and the memory, and a CPU for reading data from the memory. A memory read / write device comprising at least one of a descramble circuit for restoring the address bus to a normal pattern.
【請求項4】 請求項2において、 前記CPUとメモリとの間に、CPUがメモリにデータ
を書き込む際に前記アドレスバスを所定の条件に応じ通
常のパターンと異なるパターンに切り替える第2のスク
ランブル回路及びCPUがメモリからデータを読み出す
際に前記アドレスバスを通常のパターンに復旧する第2
のディスクランブル回路の少なくとも一方を備えたこと
を特徴とするメモリリード・ライト装置。
4. The second scramble circuit according to claim 2, wherein, between the CPU and the memory, when the CPU writes data to the memory, the address bus switches to a pattern different from a normal pattern according to a predetermined condition. And a second method for restoring the address bus to a normal pattern when the CPU reads data from the memory.
A memory read / write device comprising at least one of the following descrambling circuits.
【請求項5】 CPUと、アドレスバス及びデータバス
からなるバスを介し前記CPUに接続されるメモリとか
らなり、前記CPUは前記メモリに対し前記バスを介し
てデータの書き込みを行うメモリリード・ライト装置に
おいて、 前記メモリにプログラムデータを書き込む書き込み手段
と、 前記CPUとメモリとの間に設けられバス切替を行うス
クランブル回路とを備え、前記CPUは前記プログラム
データを受信すると所定のパターンに基づき前記スクラ
ンブル回路に前記バスの切替を行わせるとともに、前記
書き込み手段により該スクランブル回路を介し前記メモ
リにプログラムデータを書き込ませることを特徴とする
メモリリード・ライト装置。
5. A memory read / write comprising a CPU and a memory connected to the CPU via a bus comprising an address bus and a data bus, wherein the CPU writes data to the memory via the bus. An apparatus, comprising: writing means for writing program data to the memory; and a scramble circuit provided between the CPU and the memory for switching a bus, wherein the CPU receives the program data and performs the scrambling based on a predetermined pattern. A memory read / write device, wherein a circuit switches the bus and program data is written to the memory by the writing means via the scramble circuit.
JP9332741A 1997-12-03 1997-12-03 Memory read and write method and device Pending JPH11167526A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP9332741A JPH11167526A (en) 1997-12-03 1997-12-03 Memory read and write method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP9332741A JPH11167526A (en) 1997-12-03 1997-12-03 Memory read and write method and device

Publications (1)

Publication Number Publication Date
JPH11167526A true JPH11167526A (en) 1999-06-22

Family

ID=18258346

Family Applications (1)

Application Number Title Priority Date Filing Date
JP9332741A Pending JPH11167526A (en) 1997-12-03 1997-12-03 Memory read and write method and device

Country Status (1)

Country Link
JP (1) JPH11167526A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003500786A (en) * 1999-05-12 2003-01-07 ギーゼッケ ウント デフリエント ゲーエムベーハー Memory array with address scrambling function
US8141057B2 (en) 2001-02-16 2012-03-20 Sony Corporation Data processing apparatus and associated method
US8230234B2 (en) 2007-08-06 2012-07-24 Samsung Electronics Co., Ltd. Semiconductor memory devices that are resistant to power attacks and methods of operating semiconductor memory devices that are resistant to power attacks

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2003500786A (en) * 1999-05-12 2003-01-07 ギーゼッケ ウント デフリエント ゲーエムベーハー Memory array with address scrambling function
US8141057B2 (en) 2001-02-16 2012-03-20 Sony Corporation Data processing apparatus and associated method
US8230234B2 (en) 2007-08-06 2012-07-24 Samsung Electronics Co., Ltd. Semiconductor memory devices that are resistant to power attacks and methods of operating semiconductor memory devices that are resistant to power attacks

Similar Documents

Publication Publication Date Title
US5214697A (en) Program execution apparatus for ensuring security of a program
JPH01296361A (en) Memory card
US4523271A (en) Software protection method and apparatus
US4278837A (en) Crypto microprocessor for executing enciphered programs
EP1387238B1 (en) Method and apparatus for reproducing information using a security module
WO1983004356A1 (en) Software protection methods and apparatus
WO1981002351A1 (en) Digital computer
JPH08305558A (en) Ciphering program arithmetic unit
JPS59139200A (en) Protector for solid memory
JPH0156413B2 (en)
US5671275A (en) Protection of software programs stored in read-only memory from unauthorized access
JPH11167526A (en) Memory read and write method and device
US6665782B2 (en) Method and apparatus for preventing unauthorized access of memory devices
JP2000235523A (en) Circuit device for processing electronic data
US5153921A (en) Microcomputer
JP2820938B2 (en) External memory and information processing device using it
JP3705255B2 (en) Semiconductor device and in-circuit emulator using the same
US5657444A (en) Microprocessor with secure programmable read only memory circuit
US5894515A (en) Random access memory device having inconsistent write-in and read-out data
JPH02128266A (en) Register with protective function
JPS61173341A (en) Method and apparatus for protecting safeguard program from illegal use in microcomputer
JPS63279341A (en) Memory integrated circuit
JP2739197B2 (en) Anti-duplication device
JPH05298187A (en) Protection system of initialization information in function circuit
KR950003384Y1 (en) Software protect apparatus

Legal Events

Date Code Title Description
A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A712

Effective date: 20040506

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20040616

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20040812

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20040831

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20041101

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20050817

A521 Request for written amendment filed

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20051017

A02 Decision of refusal

Free format text: JAPANESE INTERMEDIATE CODE: A02

Effective date: 20060207