JPS61168045A - One-chip microcomputer - Google Patents

One-chip microcomputer

Info

Publication number
JPS61168045A
JPS61168045A JP60008592A JP859285A JPS61168045A JP S61168045 A JPS61168045 A JP S61168045A JP 60008592 A JP60008592 A JP 60008592A JP 859285 A JP859285 A JP 859285A JP S61168045 A JPS61168045 A JP S61168045A
Authority
JP
Japan
Prior art keywords
data
instruction
internal
stored
external memory
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
JP60008592A
Other languages
Japanese (ja)
Inventor
Sakae Otake
大竹 榮
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 JP60008592A priority Critical patent/JPS61168045A/en
Publication of JPS61168045A publication Critical patent/JPS61168045A/en
Pending legal-status Critical Current

Links

Landscapes

  • Storage Device Security (AREA)
  • Microcomputers (AREA)

Abstract

PURPOSE:To make improper program decoding by a third person impossible, by separately storing operational codes in an internal ROM and operands in an external memory. CONSTITUTION:When the storing content of an external memory 2 and internal ROM4 are as shown in the table, the data '00' of an address '1,000' are first read into an one-chip CPU from the external memory 2 by means of a program controller (PC) 1 and stored in a pointer 3 and, at the same time, the PC 1 is subjected to increment. The data stored in the pointer 3 are then utilized to designate one of operational codes of addresses '0'-'FF' written in the internal ROM4. Since the data are '00', the data '69' at the address '0' of the internal ROM4 are designated as an operational code and stored in an instruction register 5. After the storage, the operational code is interpreted as a byte instruction having an one-byte operand for setting immediate data in A-register by means of an instruction decoder 6.

Description

【発明の詳細な説明】 (産業上の利用分野) 本発明はメーカやユーザー以外の第三者のプログラム解
読を困難にした外部メモリ拡張性のある1チツプマイク
ロコンピユータに関する。
DETAILED DESCRIPTION OF THE INVENTION (Field of Industrial Application) The present invention relates to a one-chip microcomputer with external memory expandability that makes it difficult for a third party other than the manufacturer or the user to decipher the program.

(従来の技術) 通常、1チツプマイクロコンピユータでは、内部のRO
Mを有効に使用できるという利点があるが、外部メモリ
拡張性のある1チツプマイクロコンビ二一タでは、仕様
変更や納期確保に対処する為内部ROMを使用せず外部
にROMを置く場合が多い。すなわち、従来の外部メモ
リ拡張のある1チツプマイクロコンビ二一夕では外付の
ROMの内容を読み出すことにより第三者がプログラム
を解読するのが容易で1模造品が作られる危険性があっ
た。
(Prior art) Usually, in a 1-chip microcomputer, the internal RO
Although it has the advantage of being able to effectively use M, in 1-chip microcomputers with external memory expandability, ROM is often placed externally instead of using internal ROM in order to cope with specification changes and securing delivery deadlines. . In other words, in conventional one-chip microcombiners with external memory expansion, it was easy for a third party to decipher the program by reading the contents of the external ROM, and there was a risk that counterfeit products could be created. .

第3図は従来のマイクロコンビエータを説明するための
メモリクリアブ(グラムの一例のフローチャートを示し
ている。以下の説明で現われる数字は16進数とする。
FIG. 3 shows a flowchart of an example of a memory clear program for explaining a conventional micro combiator. Numbers appearing in the following explanation are in hexadecimal.

この図のプログラムは、0FFOO〜oPFFF番地の
256バイトの領域を0にクリアするものである。まず
、Aレジスタにはクリアするだめのデータ「0」を設定
する。次に、Cレジスタにカウント数−1でわるrFF
Jt−設定する。セしてHLレジスタにはクリアする最
初のアドレスである[FFooJを設定する。8TAX
H十命令は、Aレジスタの内容をHLレジスタで示され
る番地に格納したのち)ILレジスタを+1だけ自動的
にインクリメントする命令である。DCRCはCレジス
タの内容をデクリメントする命令であり、デクリメント
の結果ボローが発生しなければ直後の命令(本例ではJ
MP  LOOP)が引き続き実行されるが、ボローが
発生した場合は直後の命令がスキップされ、スキップさ
れた命令の直後の命令から実行が再開される。
The program in this figure clears a 256-byte area from addresses 0FFOO to oPFFF to 0. First, data "0" that should not be cleared is set in the A register. Next, rFF divided by the count number - 1 is stored in the C register.
Jt-set. Set [FFooJ, which is the first address to be cleared, in the HL register. 8TAX
The H0 instruction is an instruction that automatically increments the IL register by +1 after storing the contents of the A register at the address indicated by the HL register. DCRC is an instruction that decrements the contents of the C register, and if a borrow does not occur as a result of decrement, the instruction immediately after (in this example, J
MP LOOP) continues to be executed, but if a borrow occurs, the immediately following instruction is skipped, and execution resumes from the instruction immediately after the skipped instruction.

この場合のソースプログラムは次のように示される。The source program in this case is shown below.

CL几MEM:MVI  A、0     6900M
VI  C,0FPH68FF LXI  H,0FFOO)I 340OFFLOOP
:5TAX )(+      3DDCRC53 JMP  LOOP     540710ND このプログラムのCLRMBMとLOOPはラベルf1
7、CIRMEMKはrxoooJが、LOOPにはl
−1007Jが割夛当てられる。また、ラベルの右に書
かれた[MVI  A、QJなどはアセンブリ言語によ
って記述された二−モニツクでアシ、さらにその右に書
かれたr6900Jなどは二一モニツクを機械語に変換
した16進数である。すなわち、[MVI  A、OJ
をアセンブルした結果r6900Jという16進数が得
られたことを示している。以下同様に「MVI C,0
FF)IJは「5BFFJlc。
CL MEM: MVI A, 0 6900M
VI C,0FPH68FF LXI H,0FFOO)I 340OFFLOOP
:5TAX) (+3DDCRC53 JMP LOOP 540710ND CLRMBM and LOOP of this program are labeled f1
7. CIRMEMK is rxoooJ, LOOP is l
-1007J is allocated. Also, the [MVI A, QJ, etc. written to the right of the label are binary symbols written in assembly language, and the r6900J, etc. written to the right are hexadecimal numbers that are converted from the 21 monic to machine language. be. That is, [MVI A, OJ
As a result of assembling, a hexadecimal number r6900J was obtained. Similarly, “MVI C,0
FF) IJ is “5BFFJlc.

「LXI H,oFFooHJはr 340OFF J
にJ8TAXH+Jは「3D」に「DCRC」は「53
」に、「JMPLOOPJはr 540710Jに変換
されたことを示している。
“LXI H, oFFooHJ is r 340OFF J
J8TAXH+J is "3D" and "DCRC" is "53"
" indicates that "JMPLOOPJ has been converted to r540710J.

次の第1表は外部ROM中の機械語のデータ配列とオペ
コードあるいはオペランドとの対応を示している。
Table 1 below shows the correspondence between the machine language data arrangement in the external ROM and the operation code or operand.

この表ではこのプログラムの機械語を1000番地以降
のメモリに薔き込んだ時の各番地に対応する機械語とそ
の機械語がオペコードであるのかめるいはオペランドで
あるのかの丸印とを示し、たとえば、1000番地には
「69」というオペコードが書き込まれていることを示
している。
This table shows the machine language corresponding to each address when the machine language of this program is stored in memory starting from address 1000, and the circle mark indicating whether the machine language is an opcode or an operand. , for example, indicates that the operation code "69" is written at address 1000.

第1表 以上の説明したように、従来の1チツプマイクロコンビ
エータは、外部メモリに書き込まれるブータラ(、ソー
スプログラムをそのままアセンブルすること罠よって得
られる機械語データそのものであるので、第三者が外部
メモリの内容を読み出して機械語からアセンブリ言語に
変換するのは容易であり、プログラムを模造されるとい
う危険性があるという欠点があった。
As explained above in Table 1, conventional one-chip microcombiators are machine language data obtained by assembling the source program as it is, which is written in external memory. It is easy to read the contents of external memory and convert from machine language to assembly language, but there is a risk that the program may be copied.

(発明の目的) 本発明の目的は、このような欠点を解決するため、機械
語の命令のオペコードのすべてを内部ROM中に格納さ
せ、外部メモ17 Kは内部ROMに格納されたオペコ
ードの1つを指定するためのポイントデータとオペラン
ドのみを格納させることにより、第三者によるプログラ
ムの解析を困難にした1チツプマイクロコンビエータを
提供することにある。
(Object of the Invention) In order to solve such drawbacks, the object of the present invention is to store all the opcodes of machine language instructions in the internal ROM, and the external memory 17K stores one of the opcodes stored in the internal ROM. An object of the present invention is to provide a one-chip micro combinator which makes it difficult for a third party to analyze a program by storing only point data and operands for specifying one.

(発明の構成) 本発明の1チツプマイクロコンビエータの構成は、命令
のオペコード部を格納する内部ROMと、この内部1(
、OM K格納したオペコードおよびオペランド部をア
ドレスするためのポイントデータ2を格納する外部RO
Mとを備え、これら内部ROMおよび外部ROMに分離
して格納することにより第三者によるプログラムの解読
を困難にすることを特徴とする。
(Configuration of the Invention) The configuration of the one-chip microcomviator of the present invention includes an internal ROM that stores an operation code section of an instruction, and an internal ROM (
, OM K An external RO that stores the stored operation code and point data 2 for addressing the operand part.
M, and is characterized in that it is made difficult for a third party to decipher the program by storing it separately in the internal ROM and external ROM.

(実施例) 次に本発明を図面によシ詳細に説明する。(Example) Next, the present invention will be explained in detail with reference to the drawings.

第1図は本発明の一実施例のブロック図、第2図は第1
図の動作を説明するフローチャートである。本実施例は
、1バイトのオペコードとO〜2バイトのオペランドと
からなる命令体系をもつ内部ROM4にバイトの外部メ
モリ拡張性のある8ビツトの1チツプマイクロコンピユ
ータとしている。第1図において、1はアクセスすべき
番地を示すプログラムカウンタ(PC)、2はプログラ
ムカウンタ1によりアドレッシングされる外部メモリ、
3は内部ROMの0番地からFF番地に格納されたオペ
コードを指定するポインタ、4は1チツプマイクロコン
ピユータに内蔵された内部ROM、5はオペコードを命
令実行サイクルの間フェッチする命令レジスタ(IkL
)、 6は命令レジスタ5よシ与えられる命令を解読す
る命令デコーダ、7は命令デコーダ6のpsa結果によ
るデコード信号やタイミング信号を各回路に与える制御
回路、8はレジスタやメモリからのデータを入力として
演算を行う算術論理演算装置(ALU)、9はデータを
一時的に格納しておくためのレジスタ、10は1チツプ
マイクロコンピユータに内蔵された内部RAMである。
FIG. 1 is a block diagram of one embodiment of the present invention, and FIG. 2 is a block diagram of an embodiment of the present invention.
3 is a flowchart illustrating the operation shown in the figure. This embodiment is an 8-bit, 1-chip microcomputer with an instruction system consisting of a 1-byte opcode and 0 to 2 bytes of operands, and an internal ROM 4 with byte external memory expandability. In FIG. 1, 1 is a program counter (PC) indicating the address to be accessed, 2 is an external memory addressed by the program counter 1,
3 is a pointer that specifies the opcode stored at addresses 0 to FF in the internal ROM, 4 is the internal ROM built into the 1-chip microcomputer, and 5 is an instruction register (IkL) that fetches the opcode during the instruction execution cycle.
), 6 is an instruction decoder that decodes the instructions given from the instruction register 5, 7 is a control circuit that provides each circuit with a decode signal and a timing signal based on the PSA result of the instruction decoder 6, and 8 is an input circuit that inputs data from registers and memory. 9 is a register for temporarily storing data, and 10 is an internal RAM built into the 1-chip microcomputer.

また、次の第2表は本実施例の番地と機械語データとの
対応表であり、従来の第1表に相当するものである。
Further, the following Table 2 is a correspondence table between addresses and machine language data in this embodiment, and corresponds to the conventional Table 1.

第2表 この表において、0番地から5−II地までは内部RO
M領域であシ、書き込まれている機械語データはすべて
オペコードだけからなる。また、1000番地以降は外
部メモリ領域であり、書き込まれている機械語データは
、オペコードを全く含まず、オペランドとポイントデー
タだけからなる。ここでポイントデータとは、内部RO
MK書き込まれたオペコードを指定するためのアドレス
情報でろシ、とり得る値はθ〜FFの8ビツトデータで
ある。
Table 2 In this table, addresses 0 to 5-II are internal ROs.
The machine language data written in the M area consists entirely of opcodes. Furthermore, the area after address 1000 is an external memory area, and the written machine language data does not include any opcodes, but consists only of operands and point data. Here, point data refers to internal RO
The address information for specifying the operation code written in the MK is 8-bit data from θ to FF.

次にプログラムが1000番地から実行された場合につ
いて説明する(第2図参照)。
Next, the case where the program is executed from address 1000 will be explained (see FIG. 2).

1)CPUは1000番地のデータをオペコードとして
でなくポイントデータと解釈して読込む。
1) The CPU reads the data at address 1000 by interpreting it as point data, not as an opcode.

2)このポイントデータが「00」であるので、CPU
は内部ROMのO番地のデータをオペコードと解釈して
読込む。
2) Since this point data is "00", the CPU
reads the data at address O in the internal ROM, interpreting it as an operation code.

3)このオペコードとして読込まれた「69」は命令デ
コーダにより2バイト命令であると解釈され、同時にA
レジスタに即値データを設定する命令であると解釈され
る。
3) “69” read as this opcode is interpreted as a 2-byte instruction by the instruction decoder, and at the same time
It is interpreted as an instruction to set immediate data in a register.

4)この命令が1バイト以上の2バイト命令であるので
、1001番地のデータがオペランドとして読込まれる
4) Since this instruction is a 2-byte instruction of 1 byte or more, the data at address 1001 is read as an operand.

5)  ;fF!込まれたデータはAレジスタに格納さ
れることによシ1つの命令動作が完了する。
5) ;fF! One command operation is completed by storing the loaded data in the A register.

以下の動作は同様に行なわれる。The following operations are performed in the same way.

次に第1図のブロック図の動作について、外部メモリと
内部ROMの状態が第2表のようになっているとして説
明する。
Next, the operation of the block diagram of FIG. 1 will be explained assuming that the states of the external memory and internal ROM are as shown in Table 2.

(1)Pctにより外部メモリ2から1000番地のデ
ータ「00」が1チツプマイクロコンピユータに読込ま
れる。
(1) Data "00" at address 1000 is read from the external memory 2 into the 1-chip microcomputer by Pct.

(2)最初に読込まれるデータは、必ずポイントデータ
として読込まれるので、「00」がポインタ3に格納さ
れると共にPCIは+1インクリメントされる。
(2) Since the first data read is always read as point data, "00" is stored in pointer 3 and PCI is incremented by +1.

(3)ポインタ3に格納されたデータは内部ROM4に
書込まれているθ〜FF番地のオペコードの1つを指定
するために使われる。このデ−タは「00」であるから
内部ROM4のO番地のデータ「69」がオペコードと
して指定される。
(3) The data stored in the pointer 3 is used to specify one of the operation codes written in the internal ROM 4 at addresses θ to FF. Since this data is "00", data "69" at address O in the internal ROM 4 is designated as the operation code.

(4)このオペコード「69」は命令レジスタ5に格納
される。
(4) This operation code “69” is stored in the instruction register 5.

(5)命令レジスタ5に格納されたオペコード「69」
は次に命令デコーダ6で解読される。
(5) Operation code “69” stored in instruction register 5
is then decoded by the instruction decoder 6.

(6)この解読の結果、オペコード「69」はAレジス
タに即値データを設定する1バイトのオペランドを持っ
てバイト命令であると解釈される。
(6) As a result of this decoding, the operation code "69" is interpreted as a byte instruction with a 1-byte operand that sets immediate value data in the A register.

(7)次にオペランド「OO」が外部メモリから読み込
まれるが、これはポイントデータではないのでオペラン
ド「OO」はポインタ3には格納されず、レジスタ9の
中のAレジスタに格納されると共に、PCIが+1イン
クリメントされ、MVIA、0の命令の動作が終了する
(7) Next, operand "OO" is read from external memory, but since this is not point data, operand "OO" is not stored in pointer 3, but is stored in register A in register 9, and PCI is incremented by +1, and the operation of the MVIA, 0 instruction is completed.

(81PCIにより外部メモリ2から1002番地のデ
ータ「01」が再びポイントデータとして読込まれポイ
ンタ3に格納されると共にPCIは+1インクリメント
される。
(Data "01" at address 1002 from external memory 2 is read again as point data by 81 PCI and stored in pointer 3, and PCI is incremented by +1.

(9)ポインタ3に格納されたポイントデータ「01」
により、内部ROM4に格納されたオペコードの中から
1番地の「6B」というオペコードが指定される。
(9) Point data “01” stored in pointer 3
As a result, the operation code "6B" at address 1 is designated from among the operation codes stored in the internal ROM 4.

Q(1内部ROM4から読出されたオペコード「6B」
は命令レジスタ5に格納された後、命令デコーダ6によ
シ解胱される。
Q(1 Operation code “6B” read from internal ROM4
is stored in the instruction register 5 and then decoded by the instruction decoder 6.

aυ 解読の結果、オペコードr6BJはCレジスタに
ν0値データを設定する1バイトのオペランドを持って
2バイト命令であると解釈される。
As a result of the aυ decoding, the operation code r6BJ is interpreted as a 2-byte instruction with a 1-byte operand that sets ν0 value data in the C register.

Q21  次にオペランド「FFjが外部メモリから読
み込まれるが、これはポイントデータではないので、こ
のオペランドl’−FFJはポインタ3には格納されず
、レジスタ9の中のCレジスタに格納されると共に、P
CIが+1インクリメントされ、MVI C,QFF)
I命令の動作が終了する。
Q21 Next, the operand "FFj" is read from the external memory, but since this is not point data, this operand "l'-FFJ" is not stored in pointer 3, but is stored in the C register in register 9, and P
CI is incremented by +1, MVI C, QFF)
The operation of the I instruction ends.

(13以下同様に次々と命令が実行される。(13 and subsequent instructions are executed one after another in the same manner.

(発明の効果) 以上説明したように、本発明によれば、オペコードとオ
ペランドを分離、すなわちオペコードを内部ROMに、
オペランドを外部メモリに別々に格納するので、第三者
が外部メモリのデータを読み出しても、どのようなプロ
グラムになっているのか解読するのは困難であシブログ
ラムの秘密保護の点で非常に有効である。
(Effects of the Invention) As explained above, according to the present invention, the operation code and the operand are separated, that is, the operation code is stored in the internal ROM.
Since the operands are stored separately in external memory, even if a third party reads the data in external memory, it is difficult to decipher what kind of program is being written, making it extremely effective in protecting the confidentiality of the program. It is.

また、本発明は、1チツプマイコンを使用するにもかか
わらず、仕様変更などの為に、プログラムを外部に置か
なければならないような情況において、プログラムの第
三者による解読を困難にしたい場合に特に有利である。
Furthermore, the present invention can be used in situations where the program must be placed externally due to specification changes, even though a single-chip microcontroller is used, and when it is desired to make it difficult for a third party to decode the program. Particularly advantageous.

なお、本実施例では、1バイトのオペコードと0〜2バ
イトのオペランドとからなる命令体系をもつ内部ROM
4にバイトの外部メモリ拡張性のある8ビツトマイコン
を例に説明したが、オペコードを格納できる内蔵ROM
を有し、外部メモリ拡張性のあるマイコンであれば、本
発明を適用可能である。また、本実施例ではオペコード
の格納領域をθ〜FF番地固定にしたが特に定める必要
はない。
Note that in this embodiment, an internal ROM having an instruction system consisting of a 1-byte opcode and 0 to 2-byte operands is used.
The explanation was given using an 8-bit microcontroller with external memory expandability of 4 to 4 bytes, but the built-in ROM that can store opcodes is also used as an example.
The present invention is applicable to any microcomputer that has external memory expandability. Further, in this embodiment, the storage area for the operation code is fixed at addresses θ to FF, but there is no need to specify it in particular.

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

第1図は本発明の一実施例のブロック図、第2図は本実
施例のフローチャート、第3図は従来の1チツプマイク
ロコンピユータの一例のフローチャートである。図にお
いて 1・・・・・・プログラムカウンタ、2・・・・・・外
付ROM。 3・・・・・・アドレスポインタ、4・・・・・・内部
ROM15・・・・・・命令レジスタ、6・・・・・・
命令デコーダ、7・・・・・・制御回路、8・・・・・
・人LU19・・・・・・汎用レジスタ、10・・・・
・・几AM である。
FIG. 1 is a block diagram of an embodiment of the present invention, FIG. 2 is a flowchart of this embodiment, and FIG. 3 is a flowchart of an example of a conventional one-chip microcomputer. In the figure, 1...program counter, 2...external ROM. 3...Address pointer, 4...Internal ROM15...Instruction register, 6...
Instruction decoder, 7... Control circuit, 8...
・Person LU19... General purpose register, 10...
...This is 几AM.

Claims (1)

【特許請求の範囲】[Claims] 命令のオペコード部を格納する内部ROMと、この内部
ROMに格納したオペコードおよびオペランド部をアド
レスするためのポイントデータを格納する外部ROMと
を備え、これら内部ROMおよび外部ROMに分離に格
納することにより第三者によるプログラムの解読を困難
にすることを特徴とする1チップマイクロコンピュータ
It is equipped with an internal ROM that stores the opcode part of the instruction, and an external ROM that stores the opcode stored in this internal ROM and point data for addressing the operand part, and by storing them separately in the internal ROM and external ROM. A one-chip microcomputer characterized by making it difficult for a third party to decipher the program.
JP60008592A 1985-01-21 1985-01-21 One-chip microcomputer Pending JPS61168045A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP60008592A JPS61168045A (en) 1985-01-21 1985-01-21 One-chip microcomputer

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP60008592A JPS61168045A (en) 1985-01-21 1985-01-21 One-chip microcomputer

Publications (1)

Publication Number Publication Date
JPS61168045A true JPS61168045A (en) 1986-07-29

Family

ID=11697252

Family Applications (1)

Application Number Title Priority Date Filing Date
JP60008592A Pending JPS61168045A (en) 1985-01-21 1985-01-21 One-chip microcomputer

Country Status (1)

Country Link
JP (1) JPS61168045A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008133061A (en) * 2006-11-27 2008-06-12 Kyocera Mita Corp Paper feeder

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008133061A (en) * 2006-11-27 2008-06-12 Kyocera Mita Corp Paper feeder

Similar Documents

Publication Publication Date Title
US7725736B2 (en) Message digest instruction
US4954943A (en) Data processing system
US20020188830A1 (en) Bit replacement and extraction instructions
JPH0827716B2 (en) Data processing device and data processing method
US7356710B2 (en) Security message authentication control instruction
JP2845433B2 (en) Integrated circuit device
US5742801A (en) Microprocessor to which additional instructions are added and instructions addition method thereof
KR100229056B1 (en) Microprocessor executing instruction having operand field including portion used as part of operation code
JPS645330B2 (en)
EP1393183B1 (en) Modified harvard architecture processor having data memory space mapped to program memory space with erroneous execution protection
JPS61168045A (en) One-chip microcomputer
JPH0574096B2 (en)
JPH056281A (en) Information processor
JPS6217773B2 (en)
US5187782A (en) Data processing system
JPH0475137A (en) Data processor
JPS622332B2 (en)
JPH03291786A (en) Ic card
JPH03201133A (en) Information processor
JPS62271143A (en) Coprocessor
US7003543B2 (en) Sticky z bit
JPH05108463A (en) Microprocessor
JP2002063030A (en) Microcontroller
JPS62174833A (en) Data processing system
JPH0575130B2 (en)