JP2004094981A - Microcomputer - Google Patents
Microcomputer Download PDFInfo
- Publication number
- JP2004094981A JP2004094981A JP2003407344A JP2003407344A JP2004094981A JP 2004094981 A JP2004094981 A JP 2004094981A JP 2003407344 A JP2003407344 A JP 2003407344A JP 2003407344 A JP2003407344 A JP 2003407344A JP 2004094981 A JP2004094981 A JP 2004094981A
- Authority
- JP
- Japan
- Prior art keywords
- program
- rom
- data
- processing unit
- central processing
- 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.)
- Granted
Links
Images
Landscapes
- Stored Programmes (AREA)
- Microcomputers (AREA)
Abstract
Description
この発明は、マイクロ・コンピュータ技術、さらにはEEP−ROM(エレクトリカリ・エレーサブル・アンド・プログラマブル・リード・オンリ・メモリ)のような電気的に書込または消去が可能なROMを内蔵したシングルチップ型マイクロ・コンピュータに適用して有効な技術に関するもので、たとえば、ICカードに内蔵されるマイクロ・コンピュータに利用して有効な技術に関するものである。 The present invention relates to a microcomputer technology and a single-chip type having a built-in electrically erasable or erasable ROM such as an EEP-ROM (Electrically Erasable and Programmable Read Only Memory). The present invention relates to a technology that is effective when applied to a microcomputer, for example, a technology that is effective to be used for a microcomputer built in an IC card.
最近、磁気カードなどに代わるものとして、いわゆるICカードが注目されている。このICカードは、たとえば特許文献1(特公昭56−19665号公報)などに記載されているように、ID(識別コード)などのデータを記憶させたP−ROM(紫外線消去型のプログラマブル・ROM)を内蔵することにより、たとえばキーの代わりをなす識別カードとして機能させることができる。 Recently, so-called IC cards have been attracting attention as an alternative to magnetic cards and the like. This IC card is a P-ROM (ultraviolet erasable programmable ROM) storing data such as an ID (identification code) as described in, for example, Patent Document 1 (Japanese Patent Publication No. 56-19665). ) Can function as, for example, an identification card instead of a key.
ここで、本発明者は、たとえば上述したごときICカードに内蔵するのに適したEEP−ROM内蔵型のシングルチップ型マイクロ・コンピュータについて検討した。以下は、公知とされた技術ではないが、本発明者によって検討された技術であり、その概要は次のとおりである。 Here, the present inventor has studied a single-chip microcomputer with an EEP-ROM built-in suitable for being built in an IC card as described above, for example. The following is not a known technique, but is a technique studied by the present inventor, and its outline is as follows.
図6は、本発明者によって検討されたマイクロ・コンピュータ10の構成を示す。同図に示すマイクロ・コンピュータ10はEEP−ROM内蔵のシングルチップ型であって、CPU(中央処理ユニット)1、RAM(ランダム・アクセス・メモリ)2、マスクROM(固定記憶ROM)3、EEP−ROM41,42、I/O(入出力ユニット)5、周辺回路6、及びEEP−ROM書込制御回路7などを同一半導体チップ内に有する。各部(1〜7)はアドレスバスLA及びデータバスLDによって相互に接続されている。
FIG. 6 shows the configuration of the
このシングルチップ型マイクロ・コンピュータ10は、たとえばICカード内に内蔵されて使用される。そして、図7に示すように、外部とのデータDxの授受はすべてCPU1を介して行われるようになっている。図7は、図6に示したマイクロ・コンピュータ10をデータDxの流れに着目して示したものである。このマイクロ・コンピュータ10は適切なソフトウェアによる「鍵」を使用しない限り内蔵ソフトウェアを知ることができない構成とすることができ、ICカード内に内蔵されるシングルチップ型マイクロ・コンピュータとしての適正を持たせている。
This single-
ここで、EEP−ROM41,42は同等のものが互いに独立して2つ設けられている。そして、図8に示すように、一方のEEP−ROM41は、いわゆるユーザ・プログラム領域(M1)として利用される。ここには、ユーザが任意に作成したプログラムが予め書き込まれる。このプログラムの書込は外部からの制御によってCPU1を停止し、外部から直接EEP−ROM41に対して行われる。このようなP−ROMのプログラム方法は、たとえば非特許文献1((株)日立製作所、昭和59年8月発行「日立マイクロコンピュータデータブック8ビットシングルチップ」823〜865頁)によって公知である。これにより製造工程におけるマスクROMの書換えが不要となり、ユーザの多様な応用に即座に応ずることができる。さらに、EEP−ROM41に対するプログラムが行われた後、このEEP−ROMに対する再書込あるいは読出しを禁止することを可能とする手段を有する構成とすれば内蔵ソフトウェアの保護として効果がある。他方のEEP−ROM42はデータ領域(M2)として利用される。ここには、CPU1によって管理される入出力データのうち、保存を要するデータDxが必要に応じて随時に書き込まれる。このEEP−ROM42に対する書込はCPU1によって制御される書込制御回路7を介して行われる。一般にEEP−ROMの書込に要する時間はCPUの平均的な命令実行時間に比べ1000倍程度であって、この書込期間、EEP−ROM42はCPU1から電気的に切離され、EEP−ROM42の読出し、書込ともに不可能となっている。
Here, two EEP-
他方、CPU1は、プログラム格納用EEP−ROM41に書き込まれたユーザ・プログラムIx2を1命令ずつ読込みながら、所定の処理動作を実行する。そして、その処理動作の過程にて要保存データDxをデータ格納用EEP−ROM42に書き込む必要が生じた場合には、EEP−ROM書込制御回路7を介して、そのEEP−ROM42への書込を行う。この処理動作の実行に際しては、マスクROM3に予め標準プログラムIx1として用意されているプログラム・ルーチン(あるいはプログラム・モジュール)が適宜参照される。前記プログラム・ルーチンは、たとえばソフトウェアタイマや除算のプログラムであって、多くの用途あるいは応用によって有用なプログラムが用意されている。一般にマスクROMは同容量のEEP−ROMに比べて小さい面積で実現可能である。このため、全てのプログラムをEEP−ROM41に格納せずに前記ROM3を利用することで半導体チップ全体のサイズを縮小することが可能となっている。
On the other hand, the
しかし、全体的な処理はEEP−ROM41に書き込まれたユーザ・プログラムに従って行われる。
However, the overall processing is performed according to the user program written in the EEP-
図7において示されるようなEEP−ROM書込制御回路7は、たとえば一方のEEP−ROM41に書き込まれたプログラムに基づく制御を受けながら、他方のEEP−ROM42への書込動作を行う。この他方のEEP−ROM42は、書込が行われている間、CPU1から切り離される。
(7) The EEP-ROM write
以上のようにして、ユーザの多様な仕様要求及び多様な用途に対して即座に応じられ、かつデータDxを必要に応じてEEP−ROMに半永久的に保存させることが可能なマイクロ・コンピュータ10が構成されている。
しかしながら、上述した技術には、次のような問題点があることが本発明者によって明らかとされた。 However, it has been clarified by the present inventors that the above-described technology has the following problems.
すなわち、上述したマイクロ・コンピュータ10では、ユーザ・プログラムIx2を書き込むためと要保存データDxを記憶するために、互いに独立した2つのEEP−ROM41,42が必要となる。EEP−ROMが1つだけでは、そのEEP−ROMに書込を行っている間、そのEEP−ROMに対する読出しアクセスができなくなって、CPU1が実行すべき命令を読み出せなくなってしまうからである。したがって、上述したように、プログラムとデータとをそれぞれに独立した2つのEEP−ROM41,42に格納させ、一方のEEP−ROM41から命令を読み出しながら、その読み出した命令に基づいて他方のEEP−ROM42の書込制御を実行するように構成しなければならなかった。
That is, in the above-described
しかし、そのためには、互いに独立した2つのEEP−ROM41,42が必要であり、しかも各EEP−ROM41,42は、各方面のユーザからの種々多様な仕様要求に対応できるようにするために、それぞれに十分に大きな記憶領域M1,M2を用意できるものでなければならない。たとえば、データサイズは小さくてよいがプログラムサイズは大きく、あるいはプログラムサイズは小さくてよいがデータサイズは大きく、といったような2通りの要求のいずれにも対応できるようにするためには、結局、2つのEEP−ROM41,42のそれぞれの記憶容量をどちらも大きくせざるを得ない。さらに、2つのEEP−ROM41,42の各記憶容量を両方ともに大きくしても、そのどちらかは記憶容量が大きく余って有効に利用されない、という無駄が生じやすい。
However, for this purpose, two EEP-
なお、EEP−ROM41,42のそれぞれは、メモリアレイとともにセンスアンプ、ドライバ回路のようなデータ入出力のための回路やアドレスを選択するための回路からなる周辺回路を持つ。それ故に、EEP−ROMが複数個独立して形成された場合、センスアンプ、ドライバなどの周辺回路がそれぞれのEEP−ROM内に設けられることになるので、多くの回路要素が必要とされる。これに応じて、EEP−ROMの全体のサイズを大きくせざるを得なくなっている。
Each of the EEP-
そこで、本発明者は、EEP−ROM41に、EEP−ROM42の制御のためのプログラムを格納するとともにEEP−ROM42のプログラムによって参照されるべきデータを格納し、またEEP−ROM42に、EEP−ROM41の制御のためのプログラムとともにEEP−ROM41のプログラムによって参照されるデータを格納することも検討した。このようにすると、EEP−ROM41及び42のそれぞれにおけるプログラム格納エリアとデータ格納エリアとを可変にすることが可能になる。この場合、前述のようなメモリエリアもしくはサイズに関する問題は幾分緩和される。しかしながら、この場合であっても、各EEP−ROM41及び42が互いに独立的なセンスアンプやデコーダ回路のような周辺回路をそれぞれに持つので、EEP−ROM全体のサイズもしくは半導体チップ全体のサイズに関しての不利益は十分に除去されない。
Therefore, the present inventor stores a program for controlling the EEP-
以上のように、上述したマイクロ・コンピュータでは、ユーザの多様な仕様要求及び多様な用途に対して即座に応じられ、かつデータDxを必要に応じてEEP−ROMに半永久的に保存させることができるという利点を有するものの、それぞれに十分に大きな記憶容量を持つ2つの独立したEEP−ROM41,42が必要であった。このため、そのハードウェア的な構成負担が大きく、特に、シングルチップ型のものにあっては、その半導体チップサイズがどうしても大きくなってしまい、その割にハードウェア資源の利用効率が必ずしもよくない、という問題点のあることが本発明者によって始めて明らかとされた。特にICカードに内蔵する場合に半導体チップサイズの縮小はカード強度の向上のために強い要求があり、上記の半導体チップはこれに反するものとなっている。
As described above, in the above-described microcomputer, it is possible to immediately respond to various specification requirements and various applications of the user, and to semi-permanently store the data Dx in the EEP-ROM as necessary. However, two independent EEP-
本発明の目的は、上述したマイクロ・コンピュータの利点、すなわちユーザの多様な仕様要求及び多様な用途に対して即座に応じられ、かつデータを必要に応じてEEP−ROMに半永久的に保存させることができるという利点を保持しつつ、そのハードウェア的な構成規模の縮小を可能にし、かつハードウェア資源の利用効率を高められるようにする、という技術を提供することにある。特に、CPUの処理速度より、書込または消去の時間が長かったり、素子特性のバラツキの大きいEEP−ROMなどの電気的に書込(または消去)が可能なROMを内蔵した場合のように、素子特性にあった高速かつ確実な書込を実現することができ、書込時間の短縮、さらに応答時間の短縮が図れるようにする技術を提供するものである。 SUMMARY OF THE INVENTION An object of the present invention is to provide an advantage of the microcomputer described above, that is, it is possible to immediately respond to various specification requirements and various applications of a user, and to store data in an EEP-ROM semi-permanently when necessary. It is an object of the present invention to provide a technique capable of reducing the size of a hardware configuration and increasing the use efficiency of hardware resources while maintaining the advantage that the hardware resources can be used. In particular, as in the case where an electrically writable (or erasable) ROM such as an EEPROM such as an EEP-ROM having a large variation in element characteristics is built in, the writing or erasing time is longer than the processing speed of the CPU. An object of the present invention is to provide a technique capable of realizing high-speed and reliable writing suited to element characteristics, shortening the writing time, and shortening the response time.
本願において開示される発明のうち、代表的なものの概要を簡単に説明すれば、下記のとおりである。 の う ち The following is a brief description of an outline of typical inventions disclosed in the present application.
すなわち、本発明のマイクロ・コンピュータは、中央処理ユニット(CPU)と、上記中央処理ユニットが実行する第1プログラムを格納する領域を有するマスクROMと、上記中央処理ユニットが実行する第2プログラムとデータとを格納する領域を有する電気的に書込及び消去可能なROM(EEP−ROMなど)と、RAMとを有し、上記第1プログラムは、上記RAMに用意されたデータを上記ROMに書き込むためのプログラムであり、上記第2プログラムは、上記第1プログラムへジャンプする命令を有しているものである。 That is, a microcomputer according to the present invention includes a central processing unit (CPU), a mask ROM having an area for storing a first program executed by the central processing unit, a second program executed by the central processing unit, and data. An electrically writable and erasable ROM (such as an EEP-ROM) having an area for storing data and a RAM, and the first program is for writing data prepared in the RAM to the ROM. The second program has an instruction to jump to the first program.
さらに、本発明の他のマイクロ・コンピュータは、上記第2プログラムが、上記中央処理ユニットが上記第1プログラムによって上記電気的に書込及び消去可能なROMにデータを書き込むための処理に移行するための命令を有している、上記第1プログラムが、上記電気的に書込及び消去可能なROMへのデータの書込処理が完了した後に、上記中央処理ユニットが上記第2プログラムの実行へと復帰するための命令を有している、あるいはフラグを有して上記中央処理ユニットが、上記フラグに基づき、上記電気的に書込及び消去可能なROMへのデータの書込処理の完了を判定し、上記判定結果に基づき上記中央処理ユニットが上記第2プログラムの実行へと復帰する、などの特徴を組み合わせて有しているものである。 Further, in another microcomputer of the present invention, the second program shifts to processing for the central processing unit to write data in the electrically writable and erasable ROM by the first program. After the first program has completed the process of writing data to the electrically writable and erasable ROM, the central processing unit starts executing the second program. The central processing unit having an instruction for returning, or having a flag, determines, based on the flag, completion of the process of writing data to the electrically writable and erasable ROM. The central processing unit has a combination of features such as returning to the execution of the second program based on the determination result.
また、本発明の他のマイクロ・コンピュータは、中央処理ユニット(CPU)と、上記中央処理ユニットによって実行されるプログラムの格納領域と、データの格納領域とを有する電気的に書込及び消去可能なROM(EEP−ROMなど)と、上記電気的に書込及び消去可能なROMに書込を行うための書込制御プログラムを格納する領域を有する記憶手段(マスクROM、RAMなど)と、入出力手段(I/O)とを有するマイクロ・コンピュータであって、上記中央処理ユニットは、上記書込制御プログラムに基づき、上記電気的に書込及び消去可能なROMの上記プログラムの格納領域に、上記入出力手段を介して上記マイクロ・コンピュータ外より受信したプログラムを書き込み、上記電気的に書込及び消去可能なROMに格納されたプログラムは、上記中央処理ユニットが上記書込制御プログラムによって上記電気的に書込及び消去可能なROMにプログラムを書き込むための処理に移行するための命令を有しているものである。 Another microcomputer according to the present invention includes a central processing unit (CPU), a storage area for a program executed by the central processing unit, and a storage area for data. ROM (EEPROM, etc.), storage means (mask ROM, RAM, etc.) having an area for storing a write control program for writing in the electrically writable and erasable ROM, Means (I / O), the central processing unit stores the program in a storage area of the program in the electrically writable and erasable ROM based on the write control program. Writes the program received from outside the microcomputer via the entry / output means and stores it in the electrically writable / erasable ROM Programs are those in which the central processing unit has an instruction to shift to the processing for writing a program to the electrically writing and erasable ROM by the write control program.
さらに、本発明の他のマイクロ・コンピュータは、上記書込制御プログラムが、上記電気的に書込及び消去可能なROMへのプログラムの書込処理が完了した後に、上記中央処理ユニットが上記電気的に書込及び消去可能なROMに格納されたプログラムの実行へと復帰するための命令を有している、フラグを有して上記中央処理ユニットが、上記フラグに基づき、上記電気的に書込及び消去可能なROMへのプログラムの書込処理の完了を判定し、上記判定結果に基づき上記中央処理ユニットが上記電気的に書込及び消去可能なROMに格納されたプログラムの実行へと復帰する、上記記憶手段が、上記電気的に書込及び消去可能なROMから上記書込制御プログラムの転送を受けたRAMである、あるいは上記電気的に書込及び消去可能なROMの上記プログラムの格納領域あるいは上記データの格納領域にプログラムあるいはデータを書き込み、そのプログラムあるいはデータを書き込むための処理に移行するための命令を有する、などの特徴を組み合わせて有しているものである。 Further, in another microcomputer of the present invention, after the write control program completes the process of writing the program into the electrically writable and erasable ROM, the central processing unit executes A central processing unit having an instruction for returning to the execution of a program stored in a writable and erasable ROM, the central processing unit having a flag, And the completion of the process of writing the program into the erasable ROM is determined, and the central processing unit returns to the execution of the program stored in the electrically rewritable ROM based on the determination result. The storage means is a RAM that receives the transfer of the write control program from the electrically writable and erasable ROM, or the electrically writable and erasable ROM is A combination of features such as writing a program or data in a storage area of the above-mentioned program or the above-mentioned data in a simple ROM and having an instruction to shift to processing for writing the program or data. It is.
よって、前記マイクロ・コンピュータによれば、書込可能なROMにデータを書き込むのに際し、そのときだけCPUを別の記憶装置へジャンプさせて、そこに予め格納された所定の書込制御プログラムを実行させることにより、書込可能なROMへの書込動作中にもCPUに所定の書込制御処理を実行させることができる。これにより、ユーザ・プログラム領域とデータ領域とを1つの書込可能なROM内に置くことができ、さらに各領域の大きさの割合を任意に選ぶことができる。これによって、ユーザの多様な仕様要求に即座に応じられ、かつデータを必要に応じて上記ROMに半永久的に保存させることができるという利点を保持しつつ、そのハードウェア的な構成規模の縮小を可能にし、かつハードウェア資源の利用効率を高められるようにする、という目的が達成される。特に、制御プログラムによってフラグを操作してROMの書込(または消去)を制御することにより、素子特性にあった高速かつ確実な書込を実現することができ、書込時間の短縮、さらに応答時間の短縮を図ることができる。 Therefore, according to the microcomputer, when writing data to the writable ROM, the CPU is jumped to another storage device only at that time, and the predetermined write control program stored in advance is executed. This allows the CPU to execute a predetermined write control process even during a write operation to the writable ROM. Thus, the user program area and the data area can be placed in one writable ROM, and the size ratio of each area can be arbitrarily selected. As a result, it is possible to immediately respond to various specification requirements of the user, and to maintain the advantage that data can be semi-permanently stored in the ROM as needed, while reducing the hardware configuration scale. The object of the present invention is made possible, and the utilization efficiency of hardware resources can be improved. In particular, by controlling the writing (or erasing) of the ROM by operating the flag by the control program, it is possible to realize high-speed and reliable writing according to the element characteristics, shorten the writing time, and further reduce the response time. Time can be reduced.
本願において開示される発明のうち、代表的なものによって得られる効果を簡単に説明すれば、下記のとおりである。 効果 Of the inventions disclosed in the present application, the effects obtained by typical ones will be briefly described as follows.
すなわち、EEP−ROM内蔵型のマイクロ・コンピュータにあって、ユーザの多様な仕様要求及び多様な用途に対して即座に応じることができる。 That is, in the microcomputer with the built-in EEP-ROM, it is possible to immediately respond to various specification requirements and various applications of the user.
以下、本発明の好適な実施の形態を図面に基づいて説明する。なお、各図中、同一符号は同一あるいは相当部分を示す。 Hereinafter, preferred embodiments of the present invention will be described with reference to the drawings. In the drawings, the same reference numerals indicate the same or corresponding parts.
図1はこの発明による技術が適用されたマイクロ・コンピュータ10の主要部における一実施の形態を示す。
FIG. 1 shows an embodiment of a main part of a
同図にその主要部を示すマイクロ・コンピュータ10はシングルチップ型のものであって、CPU1とともに、ユーザ・プログラムIx2と要保存データの両方が任意の割合で書き込まれるEEP−ROM4を備える。これとともに、そのEEP−ROM4に書込を行うための書込制御プログラムが標準プログラムIx1の一部として予め固定的に格納されたいわゆるマスクROM3を備える。
The
マスクROM3は、書込制御プログラムのみを格納したものであってもよく、あるいはさらに前記した標準プログラム・ルーチンを格納したものであってもよい。ここで、書込制御プログラムはたとえば書込制御回路7に対する起動のためのプログラムあるいは書込の終了を検出するためのプログラムを含むようなものである。さらに書込データが多量である場合にはRAM2内の所定の領域に用意されたデータを順次EEP−ROM4に対して転送し、書込を行うものであってもよい。さらに、そのEEP−ROM4とマスクROM3はそれぞれ、上記CPU1のアドレス空間上にて、互いに異なるアドレス位置に配置されている。ここで、図1におけるスイッチは仮想的なものであって、CPU1の実行プログラムがEEP−ROM4に対する書込時にはコール命令によってマスクROM3に移り、書込終了後リターン命令によってEEP−ROM4に戻ることを示すものである。
The
この場合、EEP−ROM4内には、そのEEP−ROM4への書込制御プログラムの代わりに、マスクROM3内の特定ルーチンへのコール命令が書き込まれるようになっている。他方、マスクROM3内には、EEP−ROM4のための書込制御プログラムとともに、この書込制御プログラムの最後にEEP−ROM4へのリターン命令が書き込まれるようになっている。
In this case, in the EEP-
図2は、図1に示したマイクロプロセッサ10の全体的な構成の一実施の形態を示す。
FIG. 2 shows an embodiment of the overall configuration of the
同図に示すように、上記マイクロ・コンピュータ10には、上述した構成要素すなわちCPU1、マスクROM3、及びEEP−ROM4の他に、CPU1の作業領域を提供するRAM2、外部に対してデータDxの受け渡しを行うI/O(入出力ユニット)5、周辺回路6、及びEEP−ROM書込制御回路7などが内蔵されている。これらを内蔵することにより、たとえばICカード内に内蔵されるシングルチップ型マイクロ・コンピュータとしての適性を持たせられている。マイクロ・コンピュータ10内の各部(1〜7)はアドレスバスLA及びデータバスLDによって相互に接続されている。各メモリや周辺回路に対する制御信号は省略されている。
As shown in FIG. 1, in addition to the above-mentioned components, that is, the
図3は、図2に示したマイクロ・コンピュータ10を、データDxの流れに着目して示す。同図に示すように、外部とのデータDxの授受は全てCPU1を介して行われるようになっている。これにより適切なソフトウェアによる「鍵」を使用しない限り、内蔵ソフトウェアを知ることができない構成とすることが可能である。
FIG. 3 shows the
図4は、上記CPU1のアドレス空間の状態の3つの例をそれぞれメモリ・マップによって示す。同図に示すように、上記EEP−ROM4による記憶領域M内には、ユーザ・プログラム領域M1と、データ領域M2の両方が任意の割合でもって割り当てられるようになっている。
FIG. 4 shows three examples of the state of the address space of the
図5は、上記CPU1がEEP−ROM4への書込制御を行う場合の処理動作例をフローチャートによって示す。
FIG. 5 is a flowchart showing an example of a processing operation when the
図2において、CPU1は、ユーザ・プログラム領域M1に書き込まれたプログラムIx2を1命令ずつ読込みながら、所定の処理動作を実行する(ステップS6)。
2, in FIG. 2, the
ここで、その処理動作の過程にて要保存データDxをEEP−ROM4に書き込む必要が生じると(ステップS1)、CPU1は、コール命令によって、マスクROM3に格納された標準プログラム領域Ix1中の書込制御プログラムの先頭アドレスにジャンプする(ステップS2)。そして、その書込制御プログラムにしたがってEEP−ROM4の書込制御処理を実行する(ステップS3)。これにより、EEP−ROM書込制御回路7を介して、そのEEP−ROM4への書込が行われる。この書込が行われている間、EEP−ROM4はCPU1から切り離される。
Here, when it becomes necessary to write the storage required data Dx to the EEP-
この後、書込が完了すると、CPU1は、たとえば書込制御回路7側から発せられるフラグあるいは割込要求に基づいて、書込の完了を判定する(ステップS4)。すると、CPU1は、マスクROM3からEEP−ROM4のプログラム領域M1にリターンし、ジャンプ時のアドレスの次の番地からユーザ・プログラムの読込みを再開する(ステップS5)。そして、処理の終了あるいは次のデータ書込要求が発生するまで、EEP−ROM4のユーザ・プログラムを実行する(ステップS6)。
After that, when the writing is completed, the
以上のようにして、ユーザ・プログラム領域M1とデータ領域M2とを1つのEEP−ROM4内に置くことができるようになっている。これとともに、両領域M1とM2の大きさの割合を任意に選ぶことができるので、EEP−ROM全体の記憶領域Mのサイズがそれほど大きくなくとも、たとえば図4に3つの例を示すように、データ領域M2のサイズを小さくする代わりにプログラム領域M1のサイズを大きくとったり、あるいはプログラム領域M1のサイズを小さくする代わりにデータ領域M2のサイズを大きくとったり、といったように記憶領域Mを融通し合って効率良く利用することができる。
As described above, the user program area M1 and the data area M2 can be stored in one EEP-
これによって、ユーザの多様な用途に対して即座に応じられ、かつデータDxを必要に応じてEEP−ROM4に半永久的に保存させることができるという利点を保持しつつ、そのハードウェア的な構成規模の縮小を可能にし、かつハードウェア資源の利用効率を高められるようにする、という目的が達成される。
Thereby, the hardware configuration scale is maintained while maintaining the advantage that the user can immediately respond to various uses of the user and that the data Dx can be semipermanently stored in the EEP-
ここで、EEP−ROMの書込が完了されたときのユーザ・プログラムへのリターンは、実施の形態のように書込制御回路7から発せられるフラグあるいは割込要求によらなくてもよい。たとえば、CPU1内の適当な作業レジスタが、EEP−ROMへの書込動作の開始と同時に動作開始されて、その動作中に一定周期で更新される一種のカウンタもしくはタイマとして利用され、かかる作業レジスタの内容が所定値に達したときに上記リターン動作が実行されるように構成されてもよい。つまり、CPU1が予め見込まれる所定の書込所要時間を計時し、この計時が完了した時点でEEP−ROMへの書込動作の完了をソフトウェア的にチェックする構成であってもよい。この場合、書込時間の設定とその後のリターン動作の制御は、タイマ回路のような専用回路によってハードウェア的に行わせるようにしてもよい。
Here, the return to the user program when the writing of the EEP-ROM is completed may not be based on the flag or the interrupt request issued from the
上記した例では、ユーザ・プログラムは、特に制限されないものの、外部からの制御によってCPU1を停止し、外部から直接EEP−ROM4のユーザ・プログラム領域M1に対して書込を行う構成となっている。
In the example described above, the user program is configured to stop the
このユーザ・プログラムの書込は、マスクROM3のプログラムに従ってCPU1がI/Oユニット5を介して外部よりプログラムを受信し、順次EEP−ROM4のユーザ・プログラム領域M1に対して書き込む構成としてもよい。この例では、内蔵EEP−ROM4に対して外部から直接アクセスする手段を持たないために、機密保護機能が強化され、ICカード内に内蔵されるシングルチップ型マイクロ・コンピュータとしての適正を増大させることができる。
The writing of the user program may be configured so that the
この場合、ユーザ・プログラム4に対する書込が既に行われているか否かは、EEP−ROM4内にフラグを有してその状態で判定すればよい。このフラグの状態に応じて、CPU1のリセット後のスタートアドレスを変更するような構成にしてもよい。
In this case, whether or not writing to the
また、書込可能なROMとしては、EEP−ROMのような電気的に書込及び消去可能なROMだけではなく、紫外線消去型のEP−ROMも利用できる。 (4) As a writable ROM, not only an electrically writable and erasable ROM such as an EEP-ROM but also an ultraviolet-erasable EP-ROM can be used.
上記の例では、特に制限はされないものの、書込は書込制御回路7によって行われ、一定時間の書込が行われている。
In the above example, although not particularly limited, writing is performed by the
EP−ROMの場合には、一般にEEP−ROMに比して書込時間が長い。このために、上記のような書込時間一定の方法ではICカードに内蔵した場合には応答時間の増加を招いてしまう。ここで、EP−ROM素子のプロセスバラツキが大きいことにより、ワーストケースを考慮して書込時間は設定されるために多くの場合、書込時間が必要以上に費やされてしまっている。 (4) In the case of an EP-ROM, writing time is generally longer than that of an EEP-ROM. For this reason, the above-described method with a fixed writing time causes an increase in response time when the IC card is incorporated in an IC card. Here, due to the large process variation of the EP-ROM element, the writing time is set in consideration of the worst case, so that in many cases, the writing time is spent more than necessary.
そこで、本発明者は書込制御回路7に対してCPU1が起動をかけるとともにさらに、停止も可能とできる構成とすることを考えた。すなわち、書込制御回路7内にフラグPGMを設け、このフラグPGMをCPU1がセットすると書込が開始され、前記フラグをリセットすると書込が終了されるというものである。書込時間は、たとえば前記したようにソフトウェアによって計時されてもよいし、あるいはタイマ回路を内蔵しているものにあっては、これを利用してもよい。
Therefore, the present inventor has considered a configuration in which the
図9は上記の場合のマスクROM3内に格納されるべき書込制御プログラムの一実施の形態を示すフローチャートである。
FIG. 9 is a flowchart showing an embodiment of a write control program to be stored in the
まず、CPU1がEP−ROMに対する書込アドレス・データを設定し、EP−ROMはこれらをラッチする(ステップS1)。次にCPU1は特定レジスタNの内容をクリアし(ステップS2)、上記レジスタNに+1の加算を行った(ステップS3)後に、フラグPGMをセットする(ステップS4)。所定の単位時間たとえば1msの計時を行い(ステップS5)、その後にフラグPGMをリセットし(ステップS6)、単位時間の書込を終了する。
First, the
この後、正しく書込が行われたか否かを判定する(ステップS7)。この判定は、EP−ROMの読出しを行い、この読出された内容と書込データを比較する。特に制限はされないが、この読出し時には前記ラッチされたデータを破壊しないように構成されている。この比較結果が不一致であればCPU1は前記レジスタNの値を判定して(ステップS11)、24以下であれば上記ステップS3に戻り再び単位時間の書込を実行する。上記単位時間の書込が25回行われても、すなわちN=25となっても不一致の場合は不良と判定して(ステップS12)終了する。
Then, it is determined whether or not the writing has been correctly performed (step S7). For this determination, the EP-ROM is read, and the read contents are compared with the write data. Although there is no particular limitation, it is configured such that the latched data is not destroyed during this reading. If the comparison results do not match, the
上記判定の結果が一致していれば、CPU1はフラグPGMをセットし(ステップS8)、さらに3×Nmsの計時を行った(ステップS9)後に、フラグPGMをクリアして(ステップS10)終了する。すなわち、上記判定結果が一致するまでに要した時間Nmsの3倍の時間による重ね書込が行われる。
If the result of the determination is a coincidence, the
これによって、素子特性にあった高速かつ確実な書込を実現することができ、書込時間の短縮、さらに応答時間の短縮を図ることができる。 (4) Thereby, high-speed and reliable writing suitable for the element characteristics can be realized, and the writing time and the response time can be shortened.
上記した方法によって、ユーザの多様な仕様要求及び多様な用途に対して即座に応じられ、かつデータDxを必要に応じてEP−ROMに半永久的に保存させることができるという利点を有しつつ、そのハードウェア的な構成規模の縮小を可能にし、かつハードウェア資源の利用効率を高められるようにし、さらに応答時間を短縮することができる。 According to the above-described method, there is an advantage that it is possible to immediately respond to various specification requirements and various applications of the user, and to store the data Dx in the EP-ROM semi-permanently as needed. It is possible to reduce the scale of the hardware configuration, increase the utilization efficiency of hardware resources, and further reduce the response time.
以上、本発明者によってなされた発明を実施の形態に基づき具体的に説明したが、本発明は上記実施の形態に限定されるものではなく、その要旨を逸脱しない範囲で種々変更可能であることはいうまでもない。たとえば、書込制御プログラムをマスクROM3あるいはEEP−ROM4に予め格納し、EEP−ROM4の書込動作を行うときに、その格納された書込制御プログラムをRAM2へ転送してCPU1に実行させるような構成でもよい。
As described above, the invention made by the inventor has been specifically described based on the embodiment. However, the present invention is not limited to the above embodiment, and various modifications can be made without departing from the gist of the invention. Needless to say. For example, a write control program is stored in the
また、ICカード用シングルチップ型マイクロ・コンピュータに適用した場合について説明したが、それに限定されるものではなく、たとえば、ボード型のマイクロ・コンピュータなどにも適用できる。 Also, the case where the present invention is applied to a single-chip microcomputer for an IC card has been described. However, the present invention is not limited to this. For example, the present invention can be applied to a board-type microcomputer.
少なくとも、EEP−ROMにプログラムとデータの両方を記憶させる条件のものには適用できる。 At least, the present invention can be applied to the condition that both the program and the data are stored in the EEP-ROM.
1 CPU
2 RAM
3 マスクROM
4,41,42 EEP−ROM
5 I/O
6 周辺回路
7 書込制御回路
10 マイクロ・コンピュータ
1 CPU
2 RAM
3 Mask ROM
4,41,42 EEP-ROM
5 I / O
6
Claims (4)
上記中央処理ユニットが実行する第1プログラムを格納する領域を有するマスクROMと、
上記中央処理ユニットが実行する第2プログラムを格納する領域を有する電気的に書込及び消去可能なROMと、
RAMと、
外部からデータが入力されるIO回路とを有し、
上記RAMと上記電気的に書込及び消去可能なROMは、異なるアドレス空間に配置され、
上記中央処理ユニットは、上記電気的に書込及び消去可能なROMに上記IO回路から入力されたデータを書き込む場合において、上記第1プログラムに基づいて、上記IO回路から入力されたデータを上記RAMに格納し、上記RAMに用意された上記データを上記電気的に書込及び消去可能なROMに転送することにより書き込み、
上記第2プログラムは、上記第1プログラムへジャンプする命令を有していることを特徴とするマイクロ・コンピュータ。 A central processing unit;
A mask ROM having an area for storing a first program executed by the central processing unit;
An electrically writable and erasable ROM having an area for storing a second program executed by the central processing unit;
RAM,
An IO circuit to which data is input from the outside,
The RAM and the electrically writable and erasable ROM are arranged in different address spaces,
The central processing unit, when writing data input from the IO circuit into the electrically writable and erasable ROM, stores the data input from the IO circuit into the RAM based on the first program. And by writing the data prepared in the RAM to the electrically writable and erasable ROM,
The said 2nd program has the instruction | indication which jumps to the said 1st program, The microcomputer characterized by the above-mentioned.
上記中央処理ユニットが実行する第1プログラムを格納する領域を有するマスクROMと、
上記中央処理ユニットが実行する第2プログラムを格納する領域を有する電気的に書込及び消去可能なROMと、
RAMと、
外部からデータが入力されるIO回路とを有し、
上記RAMと上記電気的に書込及び消去可能なROMは、異なるアドレス空間に配置され、
上記中央処理ユニットは、上記電気的に書込及び消去可能なROMに上記IO回路から入力されたデータを書き込む場合において、上記第1プログラムに基づいて、上記IO回路から入力されたデータを上記RAMに格納し、上記RAMに用意された上記データを上記電気的に書込及び消去可能なROMに転送することにより書き込み、
上記第2プログラムは、上記中央処理ユニットが上記第1プログラムによって上記電気的に書込及び消去可能なROMにデータを書き込むための処理に移行するための命令を有していることを特徴とするマイクロ・コンピュータ。 A central processing unit;
A mask ROM having an area for storing a first program executed by the central processing unit;
An electrically writable and erasable ROM having an area for storing a second program executed by the central processing unit;
RAM,
An IO circuit to which data is input from the outside,
The RAM and the electrically writable and erasable ROM are arranged in different address spaces,
The central processing unit, when writing data input from the IO circuit into the electrically writable and erasable ROM, stores the data input from the IO circuit into the RAM based on the first program. And by writing the data prepared in the RAM to the electrically writable and erasable ROM,
The second program is characterized in that the central processing unit has an instruction for shifting to processing for writing data to the electrically writable and erasable ROM by the first program. Micro computer.
上記中央処理ユニットが実行する第1プログラムを格納する領域を有するマスクROMと、
上記中央処理ユニットが実行する第2プログラムを格納する領域を有する電気的に書込及び消去可能なROMと、
RAMと、
外部からデータが入力されるIO回路とを有し、
上記RAMと上記電気的に書込及び消去可能なROMは、異なるアドレス空間に配置され、
上記中央処理ユニットは、上記電気的に書込及び消去可能なROMに上記IO回路から入力されたデータを書き込む場合において、上記第1プログラムに基づいて、上記IO回路から入力されたデータを上記RAMに格納し、上記RAMに用意された上記データを上記電気的に書込及び消去可能なROMに転送することにより書き込み、
上記第2プログラムは、上記中央処理ユニットが上記第1プログラムによって上記電気的に書込及び消去可能なROMにデータを書き込むための処理に移行するための命令を有しており、
上記第1プログラムは、上記電気的に書込及び消去可能なROMへのデータの書込処理が完了した後に、上記中央処理ユニットが上記第2プログラムの実行へと復帰するための命令を有していることを特徴とするマイクロ・コンピュータ。 A central processing unit;
A mask ROM having an area for storing a first program executed by the central processing unit;
An electrically writable and erasable ROM having an area for storing a second program executed by the central processing unit;
RAM,
An IO circuit to which data is input from the outside,
The RAM and the electrically writable and erasable ROM are arranged in different address spaces,
The central processing unit, when writing data input from the IO circuit into the electrically writable and erasable ROM, stores the data input from the IO circuit into the RAM based on the first program. And by writing the data prepared in the RAM to the electrically writable and erasable ROM,
The second program has an instruction for causing the central processing unit to shift to a process for writing data in the electrically writable and erasable ROM by the first program,
The first program has an instruction for causing the central processing unit to return to the execution of the second program after the data writing process to the electrically writable and erasable ROM is completed. A microcomputer.
上記中央処理ユニットによって実行されるプログラムの格納領域を有する電気的に書込及び消去可能なROMと、
上記電気的に書込及び消去可能なROMに書込を行うための書込制御プログラムを格納する領域を有する記憶手段と、
RAMと、
入出力手段とを有するマイクロ・コンピュータであって、
上記RAMと上記ROMは、異なるアドレス空間に配置され、
上記中央処理ユニットは、上記書込制御プログラムに基づき、上記入出力手段を介して上記マイクロ・コンピュータ外より受信したデータを上記RAMに格納し、上記ROMに上記RAMに用意されたデータを書き込み、
上記電気的に書込及び消去可能なROMに格納されたプログラムは、上記中央処理ユニットが上記書込制御プログラムによって上記電気的に書込及び消去可能なROMにプログラムあるいはデータを書き込むための処理に移行するための命令を有しており、
上記書込制御プログラムは、上記電気的に書込及び消去可能なROMへのプログラムあるいはデータの書込処理が完了した後に、上記中央処理ユニットが上記電気的に書込及び消去可能なROMに格納されたプログラムの実行へと復帰するための命令を有していることを特徴とするマイクロ・コンピュータ。 A central processing unit;
An electrically writable and erasable ROM having a storage area for a program executed by the central processing unit;
Storage means having an area for storing a write control program for writing to the electrically writable and erasable ROM;
RAM,
A microcomputer having input / output means,
The RAM and the ROM are arranged in different address spaces,
The central processing unit stores data received from outside the microcomputer via the input / output means in the RAM based on the write control program, and writes data prepared in the RAM into the ROM.
The program stored in the electrically writable and erasable ROM is used by the central processing unit to write a program or data into the electrically writable and erasable ROM by the write control program. Have an order to migrate,
The write control program is stored in the electrically writable and erasable ROM by the central processing unit after the process of writing the program or data to the electrically writable and erasable ROM is completed. A computer having instructions for returning to execution of a programmed program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003407344A JP3840510B2 (en) | 2003-12-05 | 2003-12-05 | Micro computer |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2003407344A JP3840510B2 (en) | 2003-12-05 | 2003-12-05 | Micro computer |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP11317935A Division JP2000200257A (en) | 1999-01-01 | 1999-11-09 | Microcomputer |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2004094981A true JP2004094981A (en) | 2004-03-25 |
JP3840510B2 JP3840510B2 (en) | 2006-11-01 |
Family
ID=32064746
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2003407344A Expired - Lifetime JP3840510B2 (en) | 2003-12-05 | 2003-12-05 | Micro computer |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3840510B2 (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007095241A (en) * | 2005-09-30 | 2007-04-12 | Citizen Watch Co Ltd | Semiconductor memory device, its data writing method and data erasing method, and system ic |
-
2003
- 2003-12-05 JP JP2003407344A patent/JP3840510B2/en not_active Expired - Lifetime
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2007095241A (en) * | 2005-09-30 | 2007-04-12 | Citizen Watch Co Ltd | Semiconductor memory device, its data writing method and data erasing method, and system ic |
Also Published As
Publication number | Publication date |
---|---|
JP3840510B2 (en) | 2006-11-01 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7213117B2 (en) | 1-chip microcomputer having controlled access to a memory and IC card using the 1-chip microcomputer | |
JP2682700B2 (en) | IC card | |
JP2727520B2 (en) | Memory card and operating method thereof | |
JPS63145531A (en) | Microprocessor | |
KR100604877B1 (en) | Apparatus and method for controlling memory address mapping in embedded system | |
EP0239283B1 (en) | Microcomputer | |
JP3032207B2 (en) | Micro computer | |
JPH06275084A (en) | Nonvolatile semiconductor storage and data processor using the same | |
KR100310486B1 (en) | Microcumputer | |
JP2001075941A (en) | Microcomputer with built-in flash memory and operating method therefor | |
JP3923546B2 (en) | IC card | |
JP2004094981A (en) | Microcomputer | |
JP2000200257A (en) | Microcomputer | |
JPH08129628A (en) | Information recording medium with incorporated cpu | |
JP2003203063A (en) | Microcomputer | |
JPS62131354A (en) | Method for controlling information write on ic card | |
JP3168572B2 (en) | IC card with CPU runaway detection function | |
JP2000276461A (en) | Microcomputer | |
GB2304209A (en) | Starting up a processor system | |
JP4203165B2 (en) | IC card | |
JPH0855204A (en) | Ic card with cpu and accessible address limiting method of ic card with cpu | |
JP4549731B2 (en) | Multi-application IC card with command code that is commonly used by applications | |
JP2006302130A (en) | Ic card and program for ic card | |
JP4026796B2 (en) | IC card with command distribution function | |
JPH1050086A (en) | Microcomputer having eeprom and its rewriting method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20040622 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20040823 |
|
A02 | Decision of refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A02 Effective date: 20050322 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20050523 |
|
A911 | Transfer of reconsideration by examiner before appeal (zenchi) |
Free format text: JAPANESE INTERMEDIATE CODE: A911 Effective date: 20050608 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20060606 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20060703 |
|
R150 | Certificate of patent (=grant) or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
EXPY | Cancellation because of completion of term | ||
FPAY | Renewal fee payment (prs date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20070818 Year of fee payment: 1 |