JPH081606B2 - Single chip microcomputer - Google Patents

Single chip microcomputer

Info

Publication number
JPH081606B2
JPH081606B2 JP61095561A JP9556186A JPH081606B2 JP H081606 B2 JPH081606 B2 JP H081606B2 JP 61095561 A JP61095561 A JP 61095561A JP 9556186 A JP9556186 A JP 9556186A JP H081606 B2 JPH081606 B2 JP H081606B2
Authority
JP
Japan
Prior art keywords
test mode
data
built
address
permission
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Lifetime
Application number
JP61095561A
Other languages
Japanese (ja)
Other versions
JPS62251841A (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.)
NEC Corp
Original Assignee
NEC 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 NEC Corp filed Critical NEC Corp
Priority to JP61095561A priority Critical patent/JPH081606B2/en
Publication of JPS62251841A publication Critical patent/JPS62251841A/en
Publication of JPH081606B2 publication Critical patent/JPH081606B2/en
Anticipated expiration legal-status Critical
Expired - Lifetime legal-status Critical Current

Links

Description

【発明の詳細な説明】 〔産業上の利用分野〕 本発明は、単一半導体基盤上にテストモード機能及び
コンピュータ機能を集積したシングルチップマイクロコ
ンピュータに関する。
The present invention relates to a single chip microcomputer in which a test mode function and a computer function are integrated on a single semiconductor substrate.

〔従来の技術〕[Conventional technology]

近年、LSI製造技術の進歩により、シングルチップマ
イクロコンピュータの分野においても高集積化が進み、
単一半導体基盤上に集積される機能もより高度化してい
る。例えば、内蔵メモリの容量の増加、データ処理能力
の向上などである。これに伴ってシングルチップマイク
ロコンピュータの制御の司るソフトウェアもしだいに高
度化し、各社のノウハウを結集したソフトウェアがチッ
プ内に内蔵されるに至っているが、最近ではこれらのソ
フトウェアが盗用される問題が起こっている。例えば、
TVゲームマシンのプログラムコピーや紙幣両替機の制御
ソフトウェアを悪用した疑似紙幣の作成など大きな社会
問題となったものもある。従って、この様なソフトウェ
アの盗用に対して、最近ではソフトウェアのセキュリテ
ィに対する関心と要求が高まってきている。
In recent years, due to advances in LSI manufacturing technology, high integration has progressed even in the field of single-chip microcomputers,
The functions integrated on a single semiconductor substrate are becoming more sophisticated. For example, increasing the capacity of the built-in memory and improving the data processing capacity. Along with this, the software that controls single-chip microcomputers has become more sophisticated, and software that brings together the know-how of each company has been built into the chip, but recently there has been the problem of these softwares being stolen. ing. For example,
There were also major social problems such as the program copy of a TV game machine and the creation of pseudo banknotes that abused the control software of a currency exchange machine. Therefore, in order to steal such software, interest and demand for software security have been increasing recently.

一般にシングルチップマイクロコンピュータの内蔵プ
ログラムのコピーは、内蔵メモリに格納されたユーザプ
ログラム及びデータを出力ポートから読み出す機能(以
下、この機能をテストモード機能という)を利用して簡
単に行なうことができる。上記機能は本来内蔵メモリに
格納されたプログラム及びデータの確認用に付加された
もので、ほとんどすべてのシングルチップマイクロコン
ピュータにおいて内蔵されている。
Generally, copying of a built-in program of a single-chip microcomputer can be easily performed by using a function of reading a user program and data stored in a built-in memory from an output port (hereinafter, this function is called a test mode function). The above function is originally added to confirm the program and data stored in the built-in memory, and is incorporated in almost all single-chip microcomputers.

第3図に従来のテストモード機能を内蔵したシングル
チップマイクロコンピュータのブロック図を示し、以下
同図に基づき動作を説明する。第3図において、アドレ
スバス1はアドレスデータを転送するバスである。デー
タバス2は中央処理装置(以下、CPUという)の処理デ
ータを転送するバスである。内蔵ROMブロック3はプロ
グラムカウンタ及びユーザプログラムやデータを格納す
るメモリブロックである。一般にROMにはマスク固定さ
れたROM(以下、マスクROMという)とデータの書き込み
が可能な読み出し専用メモリ(以下、PROMという)があ
り、またPROMとしては紫外線でメモリ内のデータを消去
するUVEPROM、及び電気的にデータの書込み消去が行な
えるE2PROMが存在する。命令レジスタ4は内蔵ROMブロ
ック3から読み出した命令コードを格納するレジスタで
ある。CPU制御部5は命令レジスタ4に格納された命令
コードで指定されたプログラム動作を制御するブロック
である。アキュムレータ6はデータ処理の中心となるレ
ジスタである。テンポラリレジスタ7は算術論理演算ユ
ニット8への入力データを一時保持するためのレジスタ
である。算術論理演算ユニット8は、アキュムレータ
6、テンポラリレジスタ7に格納されたデータに対し指
定された算術論理演算を行ない、結果をデータバス2へ
出力する。RAM9は汎用レジスタ及び様々な処理データ格
納用として用いられる読出し及び書込みが可能なメモリ
で、アドレスバス1でアドレス指定される格納データを
データバス2へ出力するか、データバス2上のデータを
アドレスバス1で指定される内部RAM9のアドレス位置に
格納する。ポート10はデータバス2上のデータを外部へ
出力する機能を有する出力ポートである。
FIG. 3 shows a block diagram of a conventional single-chip microcomputer incorporating a test mode function, and the operation will be described below with reference to FIG. In FIG. 3, address bus 1 is a bus for transferring address data. The data bus 2 is a bus for transferring processing data of a central processing unit (hereinafter referred to as CPU). The built-in ROM block 3 is a memory block that stores a program counter, a user program, and data. Generally, ROM has a mask fixed ROM (hereinafter, referred to as mask ROM) and a read-only memory (hereinafter, referred to as PROM) capable of writing data, and the PROM is a UVEPROM that erases data in the memory with ultraviolet rays, In addition, there is an E 2 PROM that can electrically write and erase data. The instruction register 4 is a register for storing the instruction code read from the built-in ROM block 3. The CPU control unit 5 is a block that controls the program operation designated by the instruction code stored in the instruction register 4. The accumulator 6 is a register which is the center of data processing. The temporary register 7 is a register for temporarily holding input data to the arithmetic logic operation unit 8. The arithmetic logic operation unit 8 performs a specified arithmetic logic operation on the data stored in the accumulator 6 and the temporary register 7, and outputs the result to the data bus 2. The RAM 9 is a general-purpose register and a readable / writable memory used for storing various processed data, and outputs stored data addressed by the address bus 1 to the data bus 2 or addresses data on the data bus 2. It is stored in the address position of internal RAM 9 specified by bus 1. The port 10 is an output port having a function of outputting the data on the data bus 2 to the outside.

次に動作説明を行なう。従来のテストモード機能内蔵
シングルチップマイクロコンピュータにおいては、内蔵
ROMブロック3内のプログラムカウンタで指定されるア
ドレスの命令コードを内蔵ROMブロック3から読み出
し、データバス2を介して命令レジスタ4に格納する。
命令レジスタ4に格納された命令コードはCPU制御部5
へ入力され、PLA(プログラマブルロジックアレイ)な
どのハードウェアによってデコードされて、命令機能が
実行される。例えばアキュムレータ6と汎用レジスタ間
の二項演算の場合、汎用レジスタの内容をRAM9から読み
出し、テンポラリレジスタ7に格納する。次に算術論理
演算ユニット8を動作させ、演算結果をデータバス2を
介して、デスティネーションがアキュムレータ8の場合
はそこに書き込み、汎用レジスタの場合はRAM9内の汎用
レジスタに書き込む。上記動作は全てCPU制御部5内のP
LAなどのハードウェアにより、デコードされた制御信号
により行なわれる。
Next, the operation will be described. Built-in in conventional single-chip microcomputer with test mode function
The instruction code at the address designated by the program counter in the ROM block 3 is read from the built-in ROM block 3 and stored in the instruction register 4 via the data bus 2.
The instruction code stored in the instruction register 4 is the CPU control unit 5
Is input to and decoded by hardware such as PLA (Programmable Logic Array) to execute the instruction function. For example, in the case of the binary operation between the accumulator 6 and the general-purpose register, the contents of the general-purpose register are read from the RAM 9 and stored in the temporary register 7. Next, the arithmetic logic operation unit 8 is operated and the operation result is written to the accumulator 8 via the data bus 2 when the destination is the accumulator 8 or to the general purpose register in the RAM 9 when the general purpose register is used. All the above operations are performed in P in the CPU control unit 5.
It is performed by a control signal decoded by hardware such as LA.

次に第4図を用いて、従来のテストモード機能に関し
てその動作説明を行なう。第4図は第3図における内蔵
ROMブロック3の詳細構成を示したものである。第4図
においてプログラムカウンタ31は、内蔵ROM(PROMまた
はマスクROM)32に格納された命令コードの格納アドレ
スを指すアドレスポインタである。内蔵ROM32はユーザ
プログラム及びデータの格納に用いる読出し専用メモリ
であり、メモリ内の命令コード及びデータはデータバス
2に出力される。なおデータを読み出す場合は、プログ
ラムカウンタ3は経由せずにバス37上のアドレス値によ
って、直接アドレス指定して読み出す。テストモード制
御部33はテストモード要求線36に信号が出力されると動
作するブロックで、テストモード機能の動作制御を司
る。プログラムカウンタリセット線34はテストモード機
能実行時にプログラムカウンタ31をリセットするための
信号線で、テストモード制御部33より信号がプログラム
カウンタ31に対し出力される。プログラムカウンタイン
クリメント線35はテストモード機能実行時にプログラム
カウンタ31をインクリメントするための制御線で、テス
トモード制御部33より信号がプログラムカウンタ31に対
し出力される。
Next, the operation of the conventional test mode function will be described with reference to FIG. FIG. 4 shows the built-in structure of FIG.
3 shows a detailed configuration of the ROM block 3. In FIG. 4, the program counter 31 is an address pointer that points to the storage address of the instruction code stored in the built-in ROM (PROM or mask ROM) 32. The built-in ROM 32 is a read-only memory used for storing user programs and data, and the instruction code and data in the memory are output to the data bus 2. When reading data, the program counter 3 does not go through and is directly addressed and read by the address value on the bus 37. The test mode control unit 33 is a block that operates when a signal is output to the test mode request line 36, and controls the operation of the test mode function. The program counter reset line 34 is a signal line for resetting the program counter 31 when the test mode function is executed, and a signal is output from the test mode control unit 33 to the program counter 31. The program counter increment line 35 is a control line for incrementing the program counter 31 when the test mode function is executed, and a signal is output from the test mode control unit 33 to the program counter 31.

従来のシングルチップマイクロコンピュータの特定外
部端子に高電圧を印加すると、テストモード要求線36に
信号が出力され、テストモード制御部33に入力される。
テストモード制御部33は、信号線入力後、直ちにプログ
ラムカウンタリセット線34に信号を出力し、プログラム
カウンタ31の内部をQにクリアする。そしてプログラム
カウンタ31によって指定されたアドレスの命令コードま
たはデータを内蔵ROM32より読み出し、データバス2上
に出力し、さらにデータバス2上のデータをポート10を
経由して外部に出力する。その後、テストモード制御部
33はプログラムカウンタインクリメント線35に信号を出
力し、プログラムカウンタ31をインクリメントして、プ
ログラムカウンタ31で指定される内蔵ROM32内の命令コ
ードまたはデータをポート10により外部へ出力する。そ
して以下は同様にプログラムカウンタインクリメント線
35に信号を出力し、プログラムカウンタ31を順次インク
リメントしていき、内蔵メモリ32内のデータを順次デー
タバス2及びポート10を経由して外部へ出力する。この
ようにして、テストモード制御部33は、ユーザプログラ
ムおよびデータの格納された内蔵ROM32の内容を順次デ
ータバス2に送り出し、ポート10を経由して外部に出力
する。
When a high voltage is applied to a specific external terminal of a conventional single chip microcomputer, a signal is output to the test mode request line 36 and input to the test mode control unit 33.
The test mode control unit 33 outputs a signal to the program counter reset line 34 immediately after inputting the signal line, and clears the inside of the program counter 31 to Q. Then, the instruction code or data at the address designated by the program counter 31 is read from the built-in ROM 32 and output to the data bus 2, and the data on the data bus 2 is output to the outside via the port 10. After that, the test mode controller
33 outputs a signal to the program counter increment line 35, increments the program counter 31, and outputs the instruction code or data in the internal ROM 32 designated by the program counter 31 to the outside through the port 10. And the following is the same as the program counter increment line
A signal is output to 35, the program counter 31 is sequentially incremented, and the data in the internal memory 32 is sequentially output to the outside via the data bus 2 and the port 10. In this way, the test mode control unit 33 sequentially sends the contents of the built-in ROM 32 in which the user program and data are stored to the data bus 2 and outputs them to the outside via the port 10.

上記手段を用いてユーザはチップの特定外部端子に高
電圧を印加し、前記テストモード機能を実行することに
より、内蔵ROM32内のプログラムおよびデータをポート1
0を経由して外部に読み出してチェックすることができ
る。
By using the above means, the user applies a high voltage to a specific external terminal of the chip and executes the test mode function to transfer the program and data in the internal ROM 32 to the port 1
It can be read out via 0 and checked.

〔発明が解決しようとする問題点〕[Problems to be solved by the invention]

上述したテストモード機能を内蔵したシングルチップ
マイクロコンピュータにおいては、テストモード機能を
用いることにより、内蔵されたユーザプログラム及びデ
ータを容易に外部に読み出すことができるので、機密性
の高いプログラム及びデータが内蔵されている場合でも
悪意の第3者が外部から簡単に読み出すことができ、内
蔵ソフトウェアに対する保護が全くなされていないとい
う欠点があった。
In the above-described single-chip microcomputer having the built-in test mode function, the built-in user program and data can be easily read out by using the test mode function. Even if it is done, a malicious third party can easily read it from the outside, and there is a drawback that the built-in software is not protected at all.

〔問題点を解決するための手段〕[Means for solving problems]

本発明によるシングルチップマイクロコンピュータ
は、単一半導体基盤上に、ユーザソフトウェア格納用の
メモリと、命令機能を実行するためのマイクロプログラ
ムを格納するマイクロプログラムメモリと、前記マイク
ロプログラムメモリに格納された処理ルーチンの開始ア
ドレスを設定するアドレス設定回路とを備えており、ま
た、テストモード機能の実行許可/不許可を指定する指
定情報をストアする指定手段を設けるとともに前記マイ
クロプログラムメモリにテストモード処理ルーチンを設
けており、かつ前記アドレス設定回路はテストモードが
指定されたときに前記テストモード処理ルーチンの開始
アドレスを設定するように構成され、前記テストモード
処理ルーチンの実行により、前記指定手段にストアされ
ている前記指定情報を検出し、当該指定情報が実行許可
を指定しているときは前記テストモード処理ルーチンに
従ったテストを行ない、前記指定情報が実行不許可を指
定しているときはテストの実行を禁止することを特徴と
している。
A single-chip microcomputer according to the present invention comprises, on a single semiconductor substrate, a memory for storing user software, a microprogram memory for storing a microprogram for executing an instruction function, and a process stored in the microprogram memory. An address setting circuit for setting a start address of the routine is provided, and a designating means for storing designation information for designating permission / non-permission of execution of the test mode function is provided and a test mode processing routine is stored in the microprogram memory. And the address setting circuit is configured to set a start address of the test mode processing routine when a test mode is specified, and is stored in the specifying means by execution of the test mode processing routine. The specified information When the designated information specifies execution permission, the test is performed according to the test mode processing routine, and when the designated information specifies execution non-permission, the test execution is prohibited. I am trying.

〔実施例〕〔Example〕

次に本発明に係わるシングルチップマイクロコンピュ
ータの一実施例を第1図,第2図を用いて説明する。
Next, one embodiment of a single chip microcomputer according to the present invention will be described with reference to FIGS.

第1図は本発明に係わるシングルチップマイクロコン
ピュータの第1の実施例の構成を示したものである。ま
ず、構成要素の説明を行なう。第1図において、マスク
ROMブロック103とCPU制御部105は従来例の第3図におけ
る内蔵ROMブロック3及びCPU制御部5に各々対応してい
る。また第3図におけるアキュムレータ6,テンポラリレ
ジスタ7,算術論理演算ユニット8をまとめて第1図では
実行部101として示してある。本発明に係わるシングル
チップマイクロコンピュータにおいてマスクROMブロッ
ク103とCPU制御部105以外の構成要素は第3図に示す従
来例と相異がないので、以下マスクROMブロック103とCP
U制御部105の構成のみ説明する。
FIG. 1 shows the configuration of a first embodiment of a single-chip microcomputer according to the present invention. First, the components will be described. In Figure 1, the mask
The ROM block 103 and the CPU control unit 105 correspond to the built-in ROM block 3 and the CPU control unit 5 in FIG. Further, the accumulator 6, the temporary register 7, and the arithmetic logic operation unit 8 in FIG. 3 are collectively shown as the execution unit 101 in FIG. In the single-chip microcomputer according to the present invention, the components other than the mask ROM block 103 and the CPU control unit 105 are the same as those of the conventional example shown in FIG.
Only the configuration of the U control unit 105 will be described.

マスクROMブロック103はプログラムカウンタ103−1
とマスクROM103−2から構成され、プログラムカウンタ
103−1はマスクROM103−2内の命令コード格納アドレ
スを指すアドレスポインタである。マスクROM103−2は
ユーザプログラムもしくはデータ格納に用いる読出し専
用メモリであり、メモリ内の命令コードはデータバス2
を経由して、命令レジスタ4に格納され、各命令に対応
した処理がCPU制御部105により実行される。またデータ
を読み出す場合はバス103−3上のアドレス値により、
直接アドレス指定して、マスクROM103−2内のデータを
データバス2に出力する。CPU制御部105は命令実行の制
御及びテストモード機能動作の制御を行なうブロック
で、マイクロアドレス設定回路105−1,マイクロプログ
ラムカウンタ105−2,マイクロプログラムROM105−3,デ
コーダ105−4,テストモード許可フラグ105−5,テストモ
ード要求線105−6から構成されている。マイクロアド
レス設定回路105−1はテストモード要求信号をテスト
モード要求線105−6を介して受け取ると、テストモー
ド処理ルーチン開始アドレスをマイクロプログラムカウ
ンタ105−2に設定する。マイクロプログラムカウンタ1
05−2は、命令レジスタ4に取り込まれた命令コードに
より、その命令に対応した処理の格納されたマイクロプ
ログラムROM105−3内のマイクロ命令のアドレスを指し
示すもので、インクリメント機能を有している。マイク
ロプログラムROM105−3は各命令に対応した制御情報を
格納した読み出し専用メモリで、デコーダ105−4を介
して各部に制御信号を出力する。またこのマイクロプロ
グラムR−105−3内にはテストモード機能の動作及び
テストモード機能実行の許可判定を司るテストモード処
理ルーチンも含んでいる。テストモード許可フラグ105
−5はテストモードの許可,禁止を判別するためのフラ
グで、このフラグへのデータの書込み及び読出しはCPU
の専用命令で行なう。またこのフラグは初期状態におい
てクリアされており、一度セットされると、消去ができ
ない半固定フラグである。
The mask ROM block 103 is the program counter 103-1.
And a program ROM 103-2, and a program counter
Reference numeral 103-1 is an address pointer that points to an instruction code storage address in the mask ROM 103-2. The mask ROM 103-2 is a read-only memory used for storing user programs or data, and the instruction code in the memory is the data bus 2
Is stored in the instruction register 4 via the, and the processing corresponding to each instruction is executed by the CPU control unit 105. When reading data, use the address value on the bus 103-3.
Data in the mask ROM 103-2 is output to the data bus 2 by direct addressing. The CPU control unit 105 is a block that controls instruction execution and test mode function operation, and includes a micro address setting circuit 105-1, a micro program counter 105-2, a micro program ROM 105-3, a decoder 105-4, and a test mode enable. It is composed of a flag 105-5 and a test mode request line 105-6. When the micro address setting circuit 105-1 receives the test mode request signal via the test mode request line 105-6, it sets the test mode processing routine start address in the micro program counter 105-2. Micro program counter 1
Reference numeral 05-2 indicates the address of the microinstruction in the microprogram ROM 105-3 in which the processing corresponding to the instruction is stored by the instruction code fetched in the instruction register 4, and has an increment function. The microprogram ROM 105-3 is a read-only memory that stores control information corresponding to each instruction, and outputs a control signal to each unit via the decoder 105-4. The micro program R-105-3 also includes a test mode processing routine that controls the operation of the test mode function and the permission determination of the test mode function execution. Test mode enable flag 105
-5 is a flag for determining whether the test mode is enabled or disabled. The CPU writes data to and reads data from this flag.
It is performed by the dedicated instruction of. Further, this flag is a semi-fixed flag which is cleared in the initial state and cannot be erased once set.

次に前記構成要素を用いて動作説明を行なう。本第1
の実施例におけるシングルチップマイクロコンピュータ
においては、マスクROMブロック103内のプログラムカウ
ンタ103−1で指定されるアドレスのデータをマスクROM
103−2から読み出し、データバス2を介して命令レジ
スタ4に格納する。命令レジスタ4に格納された命令コ
ードはCPU制御部105へ出力され、テストモード要求線10
5−6に信号が出力されない時、マイクロアドレス設定
回路105−1によりそのままマイクロプログラムカウン
タ105−2に格納され、各命令に対応した処理を行なう
マイクロプログラムROM105−3内のエントリアドレスを
与える。そしてマイクロプログラムカウンタ105−2は
自動的にインクリメントされ、各命令実行シーケンスが
格納された、マイクロプログラムROM内のアドレスを順
次指し示す。次にマイクロプログラムROM105−3により
出力された信号はデコータ105−4によりデコードさ
れ、各部へ制御信号を送り、命令機能が実行される。
Next, the operation will be described using the above-mentioned components. Book first
In the single-chip microcomputer of the embodiment, the mask ROM block 103 stores the data of the address designated by the program counter 103-1 in the mask ROM.
It is read from 103-2 and stored in the instruction register 4 via the data bus 2. The instruction code stored in the instruction register 4 is output to the CPU control unit 105, and the test mode request line 10
When the signal is not output to 5-6, it is stored in the micro program counter 105-2 as it is by the micro address setting circuit 105-1 and gives the entry address in the micro program ROM 105-3 for performing the processing corresponding to each instruction. Then, the micro program counter 105-2 is automatically incremented and sequentially points to the addresses in the micro program ROM in which each instruction execution sequence is stored. Next, the signal output from the microprogram ROM 105-3 is decoded by the decoder 105-4, sends a control signal to each unit, and the instruction function is executed.

以上が第1の実施例のシングルチップマイクロコンピ
ュータの命令実行形態であるが、次に第1の実施例にお
けるテストモード機能の実行について説明する。本チッ
プの特定の外部端子に高電圧を印加すると、テストモー
ド要求線105−6に信号が出力され、マイクロアドレス
設定回路105−1に入力される。マイクロアドレス設定
回路105−1はマイクロプログラムカウンタ105−2にマ
イクロプログラムROM105−3内のテストモード処理ルー
チンの先頭アドレスを設定するその後テストモード機能
の許可判定及び実行がマイクロプログラムによって行な
われる。
The above is the instruction execution form of the single-chip microcomputer of the first embodiment. Next, the execution of the test mode function in the first embodiment will be described. When a high voltage is applied to a specific external terminal of this chip, a signal is output to the test mode request line 105-6 and input to the micro address setting circuit 105-1. The micro address setting circuit 105-1 sets the start address of the test mode processing routine in the micro program ROM 105-3 to the micro program counter 105-2, and then the micro program performs permission determination and execution of the test mode function.

さてマイクロプログラムROM105−3内のテストモード
処理ルーチンにおいては次に示すシーケンスで処理を行
なう。
Now, in the test mode processing routine in the microprogram ROM 105-3, processing is performed in the following sequence.

:テストモード許可フラグ105−5の値を読み出す。: Read the value of the test mode permission flag 105-5.

:においてテストモード許可フラグ105−5がセッ
トされていた場合は、テストモード機能実行が禁止され
たと判断し、このテストモード処理ルーチンはそのまま
無限ループに入り、テストモード機能を実行しない。
If the test mode permission flag 105-5 is set at :, it is determined that the test mode function execution is prohibited, and this test mode processing routine enters the infinite loop and does not execute the test mode function.

:においてテストモード許可フラグ105−5がセッ
トされていない場合は、テストモード機能実行が許可さ
れたと判断し、マスクROMブロック103内のプログラムカ
ウンタ103−1をリセットする。
If the test mode permission flag 105-5 is not set at :, it is determined that the test mode function execution is permitted, and the program counter 103-1 in the mask ROM block 103 is reset.

:プログラムカウンタ103−1によって指定されたア
ドレスに対応したデータをマスクROM103−2内から取り
出し、データバス2に出力する。
: The data corresponding to the address designated by the program counter 103-1 is taken out from the mask ROM 103-2 and output to the data bus 2.

:データバス2上のデータを実行部101に出力し、実
行部101において、パリティビット付加,暗号化など所
定のデータ処理を施し、処理されたデータを再びデータ
バス2上に出力する。
: The data on the data bus 2 is output to the execution unit 101, the execution unit 101 performs predetermined data processing such as adding a parity bit and encryption, and outputs the processed data again to the data bus 2.

:データバス2上のデータをポート10を経由して、外
部へ出力する。
: Output the data on the data bus 2 to the outside via the port 10.

:プログラムカウンタ103−1の値とマスクROM103−
2の最終アドレス値とを比較し、一致した場合はこのテ
ストモード処理ルーチンは無限ループに入る。一致しな
い場合は次のステップへ移行する。
: Program counter 103-1 value and mask ROM 103-
The final address value of 2 is compared, and if they match, the test mode processing routine enters an infinite loop. If they do not match, move to the next step.

:プログラムカウンタ103−1をインクリメントす
る。
: Increment the program counter 103-1.

:処理ステップへ移行する。: Move to processing step.

以上が、マイクロプログラムを用いたテストモード機
能の許可判定及びテストモード機能実行形態である。
The above is the test mode function permission determination and test mode function execution mode using the microprogram.

なお、上記実施例においてはマイクロプログラムカウ
ンタ105−2によってマイクロプログラムROM105−3の
アドレス指定を行なっているが、マイクロ命令内特定フ
ィールドによりアドレス指定する方法でもよい。
Although the micro program counter 105-2 addresses the micro program ROM 105-3 in the above embodiment, a method of addressing by the specific field in the micro instruction may be used.

従来テストモード機能はシングルチップマイコンの製
造時の動作検査時に用いる目的で製造メーカにより内蔵
されたものであり、上記機能を利用すると簡単に内蔵の
プログラム及びデータを読み出すことができ、ソフトウ
ェアの保護対策が全くなされていなかった。しかるに本
発明の第1の実施例においては、テストモード許可フラ
グ105−5を内蔵し、マイクロプログラムを用いること
により、容易に高度な内蔵ソフトウェア保護を実現して
いる。
The conventional test mode function is built in by the manufacturer for the purpose of using it during operation inspection during the manufacturing of single-chip microcomputers. Using the above function, the built-in program and data can be read easily, and software protection measures can be taken. Was not done at all. However, in the first embodiment of the present invention, the built-in test mode permission flag 105-5 and the use of the microprogram easily realize the high-level built-in software protection.

テストモード許可フラグ105−5は前記の通り、CPUの
専用命令によってのみ読出し,書込みが可能であるが、
一度セットすると消去が不可能な半固定フラグである。
よってメーカはマスクROM103−2内のソフトウェアの開
発及びテバック中は上記フラグをセットせずテストモー
ド機能によって内蔵ソフトウェアを読み出せるようにし
ておく。そして内蔵ソフトウェアのデバッグが完了後製
品を市場に出荷する時に、テストモード許可フラグ105
−5をセットして以後のテストモード機能実行を禁止す
ることによって、内蔵プログラム及びデータを読み出せ
ないようにする。上記手段により、テストモード機能を
内蔵したまま内蔵ソフトウェアに対する保護が実現でき
る。
As described above, the test mode enable flag 105-5 can be read and written only by the dedicated instruction of the CPU.
It is a semi-fixed flag that cannot be erased once it is set.
Therefore, the manufacturer makes it possible to read the built-in software by the test mode function without setting the above flag during the development and the debug of the software in the mask ROM 103-2. When the product is shipped to the market after the built-in software has been debugged, the test mode enable flag 105
By setting -5 to prohibit the subsequent test mode function execution, the built-in program and data cannot be read. By the above means, it is possible to protect the built-in software with the built-in test mode function.

さらに本第1の実施例においては、上記テストモード
許可フラグの判定及びテストモード機能の実行をマイク
ロプログラムで実現しているので、内蔵プログラムに対
し、パリティビットの追加,暗号化等のデータ処理を行
なって、データの確実性,安全性の向上を容易に実現で
き、さらに上記処理シーケンスの解読は非常に困難であ
り、マクロプログラムによる実行に比べ、内蔵ソフトウ
ェアに対して高度な保護が可能である。
Further, in the first embodiment, the determination of the test mode permission flag and the execution of the test mode function are realized by the microprogram, so that data processing such as addition of the parity bit and encryption is performed on the built-in program. It is possible to easily improve the certainty and safety of data, and it is very difficult to decipher the above processing sequence, and it is possible to protect the built-in software to a higher degree than execution by a macro program. .

また、テストモード許可フラグ105−5のセットをCPU
の専用命令で実行しているので、外部操作によるフラグ
値の変更が絶対に不可能であり、上記手段は非常に安全
性の高いものとなる。
Also, set the test mode enable flag 105-5 to the CPU
Since it is executed by the dedicated instruction, it is absolutely impossible to change the flag value by an external operation, and the above means becomes very safe.

次に本発明に係わるシングルチップマイクロコンピュ
ータの第2の実施例を第2図を用いて説明する。まず構
成要素の説明を行なう。第2図におけるPROMブロック20
3は、本発明に係わるシングルチップマイクロコンピュ
ータの第1の実施例の構成を示す第1図のマスクROMブ
ロック103に対応し、さらにPROM203−2は第1図のマス
クROM103−2に対応している。また第1図におけるCPU
制御部105内のテストモード許可フラグ105−5に対応し
て、第2図ではテストモード許可パラメータ203−3がP
ROM203−2内の特定なアドレスに割り付けられており、
第2の実施例においては、テストモード許可フラグ105
−5は存在しない。上記以外の構成要素は第1図と全く
同様である。故に以下はPROMブロック203の構成につい
てのみ説明する。
Next, a second embodiment of the single chip microcomputer according to the present invention will be described with reference to FIG. First, the components will be described. PROM block 20 in FIG.
Reference numeral 3 corresponds to the mask ROM block 103 in FIG. 1 showing the configuration of the first embodiment of the single-chip microcomputer according to the present invention, and PROM 203-2 corresponds to the mask ROM 103-2 in FIG. There is. The CPU in Fig. 1
Corresponding to the test mode permission flag 105-5 in the control unit 105, the test mode permission parameter 203-3 is set to P in FIG.
It is assigned to a specific address in ROM203-2,
In the second embodiment, the test mode permission flag 105
-5 does not exist. The components other than the above are the same as those in FIG. Therefore, only the configuration of the PROM block 203 will be described below.

PROMブロック203はプログラムカウンタ203−1とPROM
203−2から構成され、プログラムカウンタ203−1はPR
OM203−2の命令コード格納アドレスを指すアドレスポ
インタである。PROM203−2はユーザプログラムもしく
はデータ格納に用いるプログラマブルな読み出し専用メ
モリであり、メモリ内の命令コードはデータバス2を経
由して、命令レジスタ4に格納され、各命令に対応した
処理がCPU制御部105により実行される。またデータを読
み出す場合はバス203−4上のアドレス値により直接ア
ドレス指定して、PROM203−2内のデータをデータバス
2に出力する。テストモード許可パラメータ203−3は
テストモードの許可,禁止を判別するために用いるパラ
メータで、PROM203−2内の特定なアドレスの内容に割
り付ける。上記パラメータへのデータの書込み及び読出
しはCPUの専用命令で行なう。
The PROM block 203 includes a program counter 203-1 and a PROM.
It consists of 203-2, the program counter 203-1 is PR
An address pointer that points to the instruction code storage address of the OM203-2. The PROM 203-2 is a programmable read-only memory used for storing user programs or data. The instruction code in the memory is stored in the instruction register 4 via the data bus 2 and the processing corresponding to each instruction is performed by the CPU control unit. Executed by 105. When reading data, the data in the PROM 203-2 is output to the data bus 2 by directly addressing it with the address value on the bus 203-4. The test mode permission parameter 203-3 is a parameter used to determine whether the test mode is permitted or prohibited, and is assigned to the content of a specific address in the PROM 203-2. Data is written to and read from the above parameters using dedicated CPU instructions.

次に第2図を用いて動作説明を行なう。 Next, the operation will be described with reference to FIG.

第2の実施例におけるシングルチップマイクロコンピ
ュータの動作は第1の実施例と同様で、マイクロプログ
ラムにより、命令機能が実行される。また上記構成要素
におけるテストモード機能実行形態は、第1の実施例に
おける実行形態とほぼ同一である。すなわち、本チップ
の特定外部端子に高電圧が印加されると、テストモード
要求線105−6に信号が出力され、マイクロアドレス設
定回路105−1に入力される。そしてマイクロアドレス
設定回路105−1はマイクロプログラムカウンタ105−2
にマイクロプログラムROM105−3内のテストモード処理
ルーチンの先頭アドレスを設定する。その後テストモー
ド機能の許可判定及び実行がマイクロプログラムによっ
て行なわれる。マイクロプログラムにより、テストモー
ド許可パラメータ203−3の内容をチェックし、“Q"で
あればテストモード機能を実行する。ただし、テストモ
ード許可パラメータ203−3は初期状態において“Q"の
値をとる。テストモード機能禁止の場合は第1の実施例
における場合と同様にCPUの専用命令により、テストモ
ード許可パラメータ203−3に“Q"以外のデータを書込
み、以後PROM203−2内のプログラム及びデータの読み
出しを禁止する。
The operation of the single-chip microcomputer in the second embodiment is similar to that of the first embodiment, and the command function is executed by the microprogram. The test mode function execution form in the above-mentioned components is almost the same as the execution form in the first embodiment. That is, when a high voltage is applied to the specific external terminal of this chip, a signal is output to the test mode request line 105-6 and input to the micro address setting circuit 105-1. The micro address setting circuit 105-1 is the micro program counter 105-2.
The start address of the test mode processing routine in the microprogram ROM 105-3 is set to. After that, permission determination and execution of the test mode function are performed by the microprogram. The contents of the test mode permission parameter 203-3 are checked by the microprogram, and if "Q", the test mode function is executed. However, the test mode permission parameter 203-3 has a value of "Q" in the initial state. When the test mode function is prohibited, data other than "Q" is written to the test mode permission parameter 203-3 by the dedicated instruction of the CPU as in the case of the first embodiment, and thereafter, the program and data in the PROM 203-2 are changed. Prohibit reading.

また第2の実施例においては、テストモード許可パラ
メータ203−3の値の消去および書き換えが可能である
が、PROM203−2がUVEPROMの場合は、テストモード許可
パラメータ203−3内のデータを紫外線で消去すること
により、他のプログラム及びデータも消去されてしまう
ので問題はない。またE2PROMの場合は内蔵プログラムに
よって、テストモード許可パラメータ203−3へのデー
タ書き込み及びを禁止することにより、対処可能であ
る。よって本第2の実施例においても、PROM203−2内
のプログラム及びデータに対する保護が実現されてお
り、内蔵ソフトウェアに対するセキュリティ性が高度化
している。またCPUの命令によってのみテキストモード
許可パラメータ203−3の値の操作が可能であるため、
外部からの変更は不可能であり、よって上記処理シーケ
ンスは安全性の高いものである。
Further, in the second embodiment, the value of the test mode permission parameter 203-3 can be erased and rewritten. However, when the PROM 203-2 is UVEPROM, the data in the test mode permission parameter 203-3 is changed by ultraviolet rays. There is no problem because other programs and data are also erased by erasing. Further, in the case of E 2 PROM, it can be dealt with by prohibiting the writing and writing of data to the test mode permission parameter 203-3 by the built-in program. Therefore, also in the second embodiment, protection of the programs and data in the PROM 203-2 is realized, and the security of the built-in software is enhanced. Also, since the value of the text mode permission parameter 203-3 can be operated only by the instruction of the CPU,
It cannot be changed from the outside, so the above processing sequence is highly secure.

〔発明の効果〕〔The invention's effect〕

以上説明した様に本発明に係わるシングルチップマイ
クロコンピュータにおいては、従来のテストモード機能
を内蔵したシングルチップマイクロコンピュータに対
し、CPU制御部内にテストモード許可フラグ(内蔵プロ
グラム領域がマスクROMの場合)を内蔵するか、または
内蔵メモリ内にテストモード許可パラメータ(内蔵プロ
グラム領域がPROMの場合)を設定することにより、これ
らの値をマイクロプログラムにより判定し、テストモー
ドの許可,禁止を決定することができる。よって製品の
出荷時にテストモード許可フラグをセットするかもしく
はテストモード許可パラメータに“Q"以外のデータを書
き込んでテストモード機能を禁止すれば、内蔵メモリの
プログラム及びデータがチップ外部に読み出せず、内蔵
ソフトウェア及びデータ保護において多大な効果があ
る。
As described above, in the single-chip microcomputer according to the present invention, the test mode enable flag (when the built-in program area is the mask ROM) is provided in the CPU control unit in comparison with the conventional single-chip microcomputer having the test mode function. By setting the test mode enable parameter (when the built-in program area is PROM) in the built-in memory or in the built-in memory, these values can be judged by the micro program and the enable / disable of the test mode can be determined. . Therefore, if the test mode function is disabled by setting the test mode enable flag at the time of product shipment or writing data other than "Q" to the test mode enable parameter, the program and data in the internal memory cannot be read out of the chip. It has a great effect on built-in software and data protection.

また本発明に係るシングルチップマイクロコンピュー
タにおいては前述したようにマイクロプログラムによ
り、テストモード許可フラグもしくはテストモード許可
パラメータのチェック、及びテストモード機能の動作制
御を行なっているので、上記処理シーケンスの解読が非
常に困難であり、内蔵のプログラム及びデータに対し、
非常に高度なセキュリティ効果が得られる。
Further, in the single-chip microcomputer according to the present invention, as described above, the microprogram checks the test mode permission flag or the test mode permission parameter and controls the operation of the test mode function. It's very difficult, for built-in programs and data,
Very high security effect can be obtained.

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

第1図は本発明に係わるシングルチップマイクロコンピ
ュータの第1の実施例のブロック構成図、第2図は本発
明に係わるシングルチップマイクロコンピュータの第2
の実施例のブロック構成図、第3図は従来のテストモー
ド機能を内蔵したシングルチップマイクロコンピュータ
のブロック構成図、第4図は第3図における内蔵ROMブ
ロック3の構成図である。 1……アドレスバス 2……データバス 3……内蔵ROMブロック 4……命令レジスタ 5……CPU制御部 6……アキュムレータ 7……テンポラリレジスタ 8……算術論理演算ユニット 9……RAM 10……ポート 31……プログラムカウンタ 32……内蔵ROM 33……テストモード制御部 34……プログラムカウンタリセット線 35……プログラムカウンタインクリメント線 36……テストモード要求線 37……バス 101……実行部 103……マスクROMブロック 103−1……プログラムカウンタ 103−2……マスクROM 103−3……バス 105……CPU制御部 105−1……マイクロアドレス設定回路 105−2……マイクロプログラムカウンタ 105−3……マイクロROM 105−4……デコーダ 105−5……テストモード許可フラグ 105−6……テストモード要求線 203……PROMブロック 203−1……プログラムカウンタ 203−2……PROM 203−3……テストモード許可パラメータ 203−4……バス
FIG. 1 is a block configuration diagram of a first embodiment of a single-chip microcomputer according to the present invention, and FIG. 2 is a second block diagram of a single-chip microcomputer according to the present invention.
FIG. 3 is a block diagram of the embodiment, FIG. 3 is a block diagram of a conventional single-chip microcomputer incorporating a test mode function, and FIG. 4 is a block diagram of the built-in ROM block 3 in FIG. 1 ...... Address bus 2 ...... Data bus 3 ...... Built-in ROM block 4 ...... Instruction register 5 ...... CPU control unit 6 ...... Accumulator 7 ...... Temporary register 8 ...... Arithmetic logic operation unit 9 ...... RAM 10 ...... Port 31 …… Program counter 32 …… Built-in ROM 33 …… Test mode control unit 34 …… Program counter reset line 35 …… Program counter increment line 36 …… Test mode request line 37 …… Bus 101 …… Execution unit 103… ... Mask ROM block 103-1 ... Program counter 103-2 ... Mask ROM 103-3 ... Bus 105 ... CPU control unit 105-1 ... Micro address setting circuit 105-2 ... Micro program counter 105-3 Micro ROM 105-4 Decoder 105-5 Test mode enable flag 105-6 Test mode request line 203 PROM block 203-1 Pro Lamb counter 203-2 ...... PROM 203-3 ...... test mode enable parameter 203-4 ...... bus

───────────────────────────────────────────────────── フロントページの続き (56)参考文献 特開 昭60−245057(JP,A) 特開 昭59−153240(JP,A) 特開 昭57−182865(JP,A) 特開 昭60−83157(JP,A) ─────────────────────────────────────────────────── --Continued from the front page (56) Reference JP-A-60-245057 (JP, A) JP-A-59-153240 (JP, A) JP-A-57-182865 (JP, A) JP-A-60- 83157 (JP, A)

Claims (1)

【特許請求の範囲】[Claims] 【請求項1】単一半導体基盤上に、ユーザソフトウェア
格納用のメモリと、命令機能を実行するためのマイクロ
プログラムを格納するマイクロプログラムメモリと、前
記マイクロプログラムメモリに格納された処理ルーチン
の開始アドレスを設定するアドレス設定回路とを備えた
シングルチップマイクロコンピュータにおいて、テスト
モード機能の実行許可/不許可を指定する指定情報をス
トアする指定手段を設けるとともに前記マイクロプログ
ラムメモリにテストモード処理ルーチンを設け、かつ前
記アドレス設定回路はテストモードが指定されたときに
前記テストモード処理ルーチンの開始アドレスを設定す
るように構成され、前記テストモード処理ルーチンの実
行により、前記指定手段にストアされている前記指定情
報を検出し、当該指定情報が実行許可を指定していると
きは前記テストモード処理ルーチンに従ったテストを行
ない、前記指定情報が実行不許可を指定しているときは
テストの実行を禁止することを特徴とするシングルチッ
プマイクロコンピュータ。
1. A memory for storing user software, a microprogram memory for storing a microprogram for executing an instruction function, and a start address of a processing routine stored in the microprogram memory on a single semiconductor substrate. In a single-chip microcomputer provided with an address setting circuit for setting, a designating means for storing designation information for designating permission / non-permission of test mode function is provided, and a test mode processing routine is provided in the microprogram memory. Further, the address setting circuit is configured to set a start address of the test mode processing routine when a test mode is specified, and the specification information stored in the specifying means by execution of the test mode processing routine. Detected, When the fixed information specifies execution permission, the test is performed according to the test mode processing routine, and when the specified information specifies execution non-permission, the test execution is prohibited. Chip microcomputer.
JP61095561A 1986-04-23 1986-04-23 Single chip microcomputer Expired - Lifetime JPH081606B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP61095561A JPH081606B2 (en) 1986-04-23 1986-04-23 Single chip microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP61095561A JPH081606B2 (en) 1986-04-23 1986-04-23 Single chip microcomputer

Publications (2)

Publication Number Publication Date
JPS62251841A JPS62251841A (en) 1987-11-02
JPH081606B2 true JPH081606B2 (en) 1996-01-10

Family

ID=14141000

Family Applications (1)

Application Number Title Priority Date Filing Date
JP61095561A Expired - Lifetime JPH081606B2 (en) 1986-04-23 1986-04-23 Single chip microcomputer

Country Status (1)

Country Link
JP (1) JPH081606B2 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPH0484348A (en) * 1990-07-27 1992-03-17 Nec Corp Rom data protecting system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JPS57182865A (en) * 1981-05-06 1982-11-10 Mitsubishi Electric Corp Microprocessor
JPS59153240A (en) * 1983-02-21 1984-09-01 Hitachi Ltd Secret protection system of program in single chip microcomputer
JPS6083157A (en) * 1983-10-14 1985-05-11 Toshiba Corp One chip microcomputer
JPS60245057A (en) * 1984-05-21 1985-12-04 Hitachi Ltd One-chip microcomputer

Also Published As

Publication number Publication date
JPS62251841A (en) 1987-11-02

Similar Documents

Publication Publication Date Title
JP2597153B2 (en) Write protector
US7461268B2 (en) E-fuses for storing security version data
KR100929870B1 (en) How to keep BIOS security of computer system
JP2682700B2 (en) IC card
CN101238473A (en) A secure terminal, a routine and a method of protecting a secret key
US10923203B2 (en) Semiconductor device and method of operating semiconductor device
JP2000122931A (en) Digital integrated circuit
TW202013196A (en) Data processing apparatus and data protection method thereof
JPH03276337A (en) Microcontroller
US6405311B1 (en) Method for storing board revision
JPH04215194A (en) Ic card
US20040186947A1 (en) Access control system for nonvolatile memory
JP2000148594A (en) Read protection circuit for rom data
JPH081606B2 (en) Single chip microcomputer
JPH03204053A (en) Read-only memory
US20060080519A1 (en) Program-controlled unit
JPS6356749A (en) Single chip microcomputer
JP3404354B2 (en) In-circuit emulator and unauthorized access detection method
JP3039479B2 (en) Extended BIOS protection system
JP4236808B2 (en) Microcomputer with built-in nonvolatile memory and self-rewriting method of the nonvolatile memory
JPH0778126A (en) Microcomputer for ic card
JPH05334195A (en) Information processor
JPH01261760A (en) Computer system
JPH07271751A (en) Microcontroller incorporated with security circuit
JPH09146845A (en) Privacy protection mechanism for nonvolatile semiconductor memory