JP2011180963A - Semiconductor integrated circuit device - Google Patents
Semiconductor integrated circuit device Download PDFInfo
- Publication number
- JP2011180963A JP2011180963A JP2010046453A JP2010046453A JP2011180963A JP 2011180963 A JP2011180963 A JP 2011180963A JP 2010046453 A JP2010046453 A JP 2010046453A JP 2010046453 A JP2010046453 A JP 2010046453A JP 2011180963 A JP2011180963 A JP 2011180963A
- Authority
- JP
- Japan
- Prior art keywords
- page
- data
- function
- ram
- physical
- 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.)
- Withdrawn
Links
Images
Abstract
Description
本発明は、不揮発性メモリを内蔵した半導体集積回路装置における電源遮断対策技術に関し、例えば非接触式ICカードに搭載されるカード用マイクロコンピュータに適用して有効な技術に関する。 The present invention relates to a power cutoff countermeasure technique in a semiconductor integrated circuit device incorporating a nonvolatile memory, and relates to a technique effective when applied to a card microcomputer mounted on, for example, a non-contact type IC card.
不揮発性メモリを内蔵した半導体集積回路装置の一例として、非接触式ICカードに搭載されるカード用マイクロコンピュータを挙げることができる。非接触式ICカードは、カードの内部にアンテナを持ち、外部装置(リーダライタ)との間で、電波を利用したデータ通信を行うことができる。非接触式ICカードの動作用電源も電波から生成することができるため、バッテリー無しで動作可能になっているが、書き込み最中にカードを磁界から遠ざけた場合には、電源遮断により書き込みが不完全となる虞れがある。 As an example of a semiconductor integrated circuit device incorporating a nonvolatile memory, a card microcomputer mounted on a non-contact IC card can be cited. The non-contact type IC card has an antenna inside the card, and can perform data communication using radio waves with an external device (reader / writer). The power supply for operating the contactless IC card can also be generated from radio waves, so it can be operated without a battery. However, if the card is moved away from the magnetic field during writing, writing is not possible due to power interruption. There is a risk of becoming perfect.
特許文献1には、消去及び書き込み処理中に動作電源が遮断されても記憶情報が不所望に消失しないメモリカードが記載されている。それによれば、不揮発性メモリは、そのメモリ領域の物理アドレス毎に空き情報フラグを対応付けた消去テーブルと、論理アドレス毎にメモリ領域の物理アドレスを対応付けたアドレス変換テーブルとを有し、空き情報フラグは対応メモリ領域が消去許可か否かを示す。制御回路は、消去テーブルの空き情報フラグを参照して書き換えデータを書き込むメモリ領域を決定し、データを書き込んだメモリ領域の物理アドレスと論理アドレスとを対応をアドレス変換テーブルに反映し、消去テーブルの空き情報フラグを更新する。書き換えデータを書き込むメモリ領域は消去テーブルの空き情報フラグを参照して決定し、書き換え前のメモリ領域と同じメモリ領域で書き換えを行わない。
特許文献2には、仮想的なセクタ消去の最中に電源が切れてしまっても、差分のデータが損なわれることのない記録技術が記載されている。それによれば、複数のブロック化された記録単位領域を有する不揮発記録媒体に対し、その各記録単位領域に連続的な書込み動作を行い、かつ記録単位領域毎に一括消去動作を行う。そして新たにファイルを上書き保存する際に、記録単位領域の既に書き込まれた既存ファイル直後の空き領域から書込み動作を開始するとともに、かかる書込み動作終了するまでの間、記録単位領域に書き込まれている上書きファイル対応のファイルを保持するようにしている。
非接触インタフェースを有するOS(Operating System;オペレーティングシステム)規格では、デバイスとして書き込み最中に電源遮断(Tear off)が発生した場合、中途半端な状態で不揮発性メモリ上のデータを放置することはデバイスの信頼性低下となると考え、書込みが正常に終了しなかった場合、次に同アドレスの読み出し要求があったときは書込み実施前のデータを出力するよう規定されている。 In the OS (Operating System) standard having a non-contact interface, if a power-off occurs during writing as a device, it is not possible to leave the data in the nonvolatile memory in a halfway state. Therefore, if the writing is not normally completed, the next data read request is made to output the data before the writing is performed.
特許文献1によれば、データ書き込み要求の発生時には不揮発性メモリの空き領域への書き込みを実施し、旧データへの上書きを実施しないようにしている。そして、論理アドレスと物理アドレスとの変換に用いられるアドレス変換テーブルが不揮発性メモリ内に形成され、不揮発性メモリへのデータ書き込み処理時に、不揮発性メモリ内のアドレス変換テーブル更新が行われる。つまり、不揮発性メモリへのデータ書き込み毎に、不揮発性メモリへのデータ書き込みと、当該不揮発性メモリ内のアドレス変換テーブル更新のために、結果的に不揮発性メモリへの書き込み動作が2度必要とされる。不揮発性メモリへの書き込み処理について本願発明者が検討したところ、不揮発性メモリとは別のメモリ例えばRAM(Random Access Memory)にアドレス変換テーブルを形成すれば、不揮発性メモリ内のアドレス変換テーブル更新のための不揮発性メモリへの書き込み動作が不要になるため、不揮発性メモリへのデータ書き込み処理全体としてのパフォーマンスの向上が図れることを見いだした。しかし、RAMにアドレス変換テーブルを形成する場合には、電源遮断によりRAM内のアドレス変換テーブルが失われてしまうため、それについての対策が不可欠となる。
According to
特許文献2においては、論理アドレスと物理アドレスとの変換に用いられるアドレス変換テーブルが用いられていないため、電源遮断とRAM内のアドレス変換テーブルとの関係については考慮されていない。
In
本発明の目的は、不揮発性メモリへのデータ書き込み処理全体としてのパフォーマンスの向上を図るための技術を提供することにある。 An object of the present invention is to provide a technique for improving the performance of the entire data writing process to the nonvolatile memory.
本発明の前記並びにその他の目的と新規な特徴は本明細書の記述及び添付図面から明らかになるであろう。 The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.
本願において開示される発明のうち代表的なものの概要を簡単に説明すれば下記の通りである。 The following is a brief description of an outline of typical inventions disclosed in the present application.
すなわち、不揮発性メモリと、上記不揮発性メモリへのデータ書き込み及び上記不揮発性メモリからのデータ読み出しを制御可能な制御部と、上記制御部によってランダムアクセス可能なRAMとを設ける。上記不揮発性メモリは、書き込み単位とされるページを含み、上記ページは、それぞれデータを記憶可能な複数のブロックと、上記複数のブロックに書き込まれたデータを上記ページ単位で管理するためのページ管理情報とを含む。上記制御部は、上記不揮発性メモリについての論理アドレスを物理アドレスに変換するためのアドレス変換テーブルを、電源投入時の初期設定により上記RAMの第1記憶エリアに形成するアドレス変換テーブル形成機能と、上記RAMの第1記憶エリアに形成された上記アドレス変換テーブルを参照して、上記不揮発性メモリにおけるブロックへのデータ書き込みを制御するデータ書き込み機能とを含む。上記データ書き込み機能は、データ書き込みの対象となるブロックを含むページの記憶データを上記RAMの第2記憶エリアにコピーする第1機能と、上記RAMの第2記憶エリアに対して、上記データ書き込みの対象となるブロックへのデータ書き込みを行う第2機能とを含む。さらに上記データ書き込み機能は、上記第2機能によるデータ書き込みに対応して、上記RAMの第2記憶エリアのページ管理情報を更新する第3機能と、上記ページ管理情報が更新された後に、上記RAMの第2記憶エリアの記憶データを、上記アドレス変換テーブルで空きページとされる上記不揮発性メモリの物理ページに書き込む第4機能とを含む。 That is, a nonvolatile memory, a control unit that can control data writing to the nonvolatile memory and data reading from the nonvolatile memory, and a RAM that can be randomly accessed by the control unit are provided. The non-volatile memory includes a page as a unit of writing, and the page includes a plurality of blocks each capable of storing data, and page management for managing data written in the plurality of blocks in units of the page. Information. An address conversion table forming function for forming an address conversion table for converting a logical address of the nonvolatile memory into a physical address in a first storage area of the RAM by an initial setting at power-up; A data writing function for controlling data writing to the block in the nonvolatile memory with reference to the address conversion table formed in the first storage area of the RAM. The data writing function includes a first function for copying stored data of a page including a block to which data is to be written to a second storage area of the RAM, and writing the data to the second storage area of the RAM. And a second function for writing data to the target block. Further, the data writing function includes a third function for updating page management information in the second storage area of the RAM in response to data writing by the second function, and the RAM after the page management information is updated. And a fourth function for writing data stored in the second storage area into a physical page of the nonvolatile memory that is a free page in the address conversion table.
本願において開示される発明のうち代表的なものによって得られる効果を簡単に説明すれば下記のとおりである。 The effects obtained by the representative ones of the inventions disclosed in the present application will be briefly described as follows.
すなわち、不揮発性メモリへのデータ書き込み処理全体としてのパフォーマンスの向上を図るための技術を提供することができる。 That is, it is possible to provide a technique for improving the performance of the entire data writing process to the nonvolatile memory.
1.実施の形態の概要
先ず、本願において開示される発明の代表的な実施の形態について概要を説明する。代表的な実施の形態についての概要説明で括弧を付して参照する図面中の参照符号はそれが付された構成要素の概念に含まれるものを例示するに過ぎない。
1. First, an outline of a typical embodiment of the invention disclosed in the present application will be described. Reference numerals in the drawings referred to in parentheses in the outline description of the representative embodiments merely exemplify what are included in the concept of the components to which the reference numerals are attached.
〔1〕本発明の代表的な実施の形態に係る半導体集積回路装置(10)は、不揮発性メモリ(108)と、上記不揮発性メモリへのデータ書き込み及び上記不揮発性メモリからのデータ読み出しを制御可能な制御部(101)と、上記制御部によってランダムアクセス可能なRAM(107)とを含む。上記不揮発性メモリは、書き込み単位とされるページを含み、上記ページは、それぞれデータを記憶可能な複数のブロックと、上記複数のブロックに書き込まれたデータを上記ページ単位で管理するためのページ管理情報とを含む。上記制御部は、上記不揮発性メモリについての論理アドレスを物理アドレスに変換するためのアドレス変換テーブルを、電源投入時の初期設定により上記RAMの第1記憶エリアに形成するアドレス変換テーブル形成機能と、上記RAMの第1記憶エリアに形成された上記アドレス変換テーブルを参照して、上記不揮発性メモリにおけるブロックへのデータ書き込みを制御するデータ書き込み機能とを含む。上記データ書き込み機能は、データ書き込みの対象となるブロックを含むページの記憶データを上記RAMの第2記憶エリアにコピーする第1機能と、上記RAMの第2記憶エリアに対して、上記データ書き込みの対象となるブロックへのデータ書き込みを行う第2機能とを含む。さらに上記データ書き込み機能は、上記第2機能によるデータ書き込みに対応して、上記RAMの第2記憶エリアのページ管理情報を更新する第3機能と、上記ページ管理情報が更新された後に、上記RAMの第2記憶エリアの記憶データを、上記アドレス変換テーブルで空きページとされる上記不揮発性メモリの物理ページに書き込む第4機能とを含む。 [1] A semiconductor integrated circuit device (10) according to a typical embodiment of the present invention controls a nonvolatile memory (108), data writing to the nonvolatile memory, and data reading from the nonvolatile memory. And a RAM (107) that can be randomly accessed by the control unit. The non-volatile memory includes a page as a unit of writing, and the page includes a plurality of blocks each capable of storing data, and page management for managing data written in the plurality of blocks in units of the page. Information. An address conversion table forming function for forming an address conversion table for converting a logical address of the nonvolatile memory into a physical address in a first storage area of the RAM by an initial setting at power-up; A data writing function for controlling data writing to the block in the nonvolatile memory with reference to the address conversion table formed in the first storage area of the RAM. The data writing function includes a first function for copying stored data of a page including a block to which data is to be written to a second storage area of the RAM, and writing the data to the second storage area of the RAM. And a second function for writing data to the target block. Further, the data writing function includes a third function for updating page management information in the second storage area of the RAM in response to data writing by the second function, and the RAM after the page management information is updated. And a fourth function for writing data stored in the second storage area into a physical page of the nonvolatile memory that is a free page in the address conversion table.
論理/物理アドレス変換テーブルが不揮発性メモリ内に設けられている場合には、当該不揮発性メモリへのデータ書き込み毎に、不揮発性メモリへのデータ書き込みと、当該不揮発性メモリ内のアドレス変換テーブル更新のために、結果的に不揮発性メモリへの書き込み動作が2度必要とされる。 When the logical / physical address conversion table is provided in the nonvolatile memory, the data writing to the nonvolatile memory and the address conversion table update in the nonvolatile memory are performed every time the data is written to the nonvolatile memory. Therefore, as a result, the write operation to the nonvolatile memory is required twice.
これに対して、上記構成の半導体集積回路装置においては、論理/物理アドレス変換テーブルがRAM内に設けられているため、不揮発性メモリ内のアドレス変換テーブル更新のための不揮発性メモリへの書き込み動作が不要になる。RAM内の論理/物理アドレス変換テーブルの更新は、不揮発性メモリの場合に比べて高速に行うことができる。このため、不揮発性メモリへのデータ書き込み処理全体としてのパフォーマンスの向上を図ることができる。 On the other hand, in the semiconductor integrated circuit device having the above configuration, since the logical / physical address conversion table is provided in the RAM, the write operation to the nonvolatile memory for updating the address conversion table in the nonvolatile memory is performed. Is no longer necessary. The logical / physical address conversion table in the RAM can be updated at a higher speed than in the case of the nonvolatile memory. For this reason, it is possible to improve the performance of the entire data writing process to the nonvolatile memory.
また制御部は、上記不揮発性メモリについての論理アドレスを物理アドレスに変換するためのアドレス変換テーブルを、電源投入時の初期設定により上記RAMの第1記憶エリアに形成するため、電源投入毎に適切なアドレス変換テーブルを得ることができる。 In addition, the control unit forms an address conversion table for converting the logical address of the nonvolatile memory into a physical address in the first storage area of the RAM by the initial setting when the power is turned on. A simple address conversion table can be obtained.
〔2〕上記〔1〕において、上記ページ管理情報は、データが正常に書き込まれたことを示す確認フラグを含む。上記データ書き込み機能は、上記アドレス変換テーブルで空きページとされる上記不揮発性メモリの物理ページに書き込まれたデータと、それに対応する上記RAMの第2エリアのデータとが一致するか否かを判別する第5機能を含む。また、上記データ書き込み機能は、上記アドレス変換テーブルで空きページとされる上記不揮発性メモリの物理ページに書き込まれたデータと、それに対応する上記RAMの第2記憶エリアのデータとが一致する場合に、上記RAMの第2記憶エリアの上記確認フラグの値を変更してから、その確認フラグを、上記不揮発性メモリにおいて対応する物理ページへ上書きすることで、当該物理ページにおける確認フラグを更新する第6機能を含む。 [2] In the above [1], the page management information includes a confirmation flag indicating that data has been normally written. The data write function determines whether or not the data written in the physical page of the non-volatile memory, which is an empty page in the address conversion table, matches the data in the second area of the RAM corresponding thereto. Including a fifth function. Further, the data writing function is used when the data written in the physical page of the non-volatile memory, which is an empty page in the address conversion table, and the corresponding data in the second storage area of the RAM match. After the value of the confirmation flag in the second storage area of the RAM is changed, the confirmation flag in the physical page is updated by overwriting the confirmation flag on the corresponding physical page in the nonvolatile memory. Includes 6 functions.
第5機能により、上記不揮発性メモリの物理ページに書き込まれたデータと、それに対応する上記RAMの第2エリアのデータとが一致するか否かの判別が行われ、上記両データが一致する場合には、第6機能により、上記RAMの第2記憶エリアの上記確認フラグの値を変更してから、その確認フラグを、上記不揮発性メモリにおいて対応する物理ページへ上書きすることで、当該物理ページにおける確認フラグが更新される。確認フラグの値に基づいて、データの有効性を判別することができるので、データの信頼性の向上を図ることができる。さらには、上書き処理においては、通常のデータ書き込みと比べてデータ消去処理を実施していないため、データ書き込み機能においては、全体として短時間で処理を完了することが可能となる。このため、非接触通信が行われる場合においても、従来技術のような不揮発性メモリへの2度の書き込み動作を行う場合に比べて、より早く必要なデータ通信を完了させることが可能となり、データ書き込み中に電源遮断が発生する可能性を小さくすることが可能となる。 When the fifth function determines whether the data written in the physical page of the non-volatile memory matches the corresponding data in the second area of the RAM, and the two data match The sixth function changes the value of the confirmation flag in the second storage area of the RAM, and then overwrites the corresponding physical page in the nonvolatile memory with the physical page. The confirmation flag at is updated. Since the validity of the data can be determined based on the value of the confirmation flag, the reliability of the data can be improved. Furthermore, since the data erasing process is not performed in the overwriting process as compared with the normal data writing, the data writing function can be completed in a short time as a whole. For this reason, even when non-contact communication is performed, it is possible to complete the necessary data communication earlier than in the case of performing the write operation twice in the nonvolatile memory as in the prior art. It is possible to reduce the possibility of power interruption during writing.
〔3〕上記〔2〕において、上記ページ管理情報には、タイムスタンプを含めることができる。このとき、上記第3機能には、上記第2機能によるデータ書き込みに対応して、上記タイムスタンプの現在の値に、1を加算することで上記タイムスタンプを更新する機能を設けることができる。 [3] In the above [2], the page management information can include a time stamp. At this time, the third function can be provided with a function of updating the time stamp by adding 1 to the current value of the time stamp, corresponding to the data writing by the second function.
上記タイムスタンプにより、データの有効性を判別することができるので、データの信頼性の向上を図ることができる。 Since the validity of the data can be determined from the time stamp, the reliability of the data can be improved.
〔4〕上記〔3〕において、上記ページ管理情報には、当該ページ管理情報を含むページの論理ページナンバーと、上記ページ管理情報についてのチェックサムとを含めることができる。 [4] In the above [3], the page management information can include a logical page number of a page including the page management information and a checksum for the page management information.
論理ページナンバーと、上記ページ管理情報についてのチェックサムとに基づいて、データの有効性を判別することができるので、データの信頼性の向上を図ることができる。 Since the validity of the data can be determined based on the logical page number and the checksum for the page management information, the reliability of the data can be improved.
〔5〕上記〔4〕において、上記アドレス変換テーブル形成機能には、上記制御部のリセットにより起動され、同じ論理ページナンバーを持つ物理ページが複数存在する場合に、当該物理ページにおけるページ管理情報に基づいて上記空きページを判定する第7機能を含めることができる。 [5] In the above [4], when there are a plurality of physical pages having the same logical page number that are activated by the reset of the control unit in the address conversion table forming function, the page conversion information in the physical page is displayed. A seventh function for determining the empty page based on the above can be included.
第7機能により、空きページの判定が行われることにより、上記第4機能による書き込み先(空きページ)を決定することができる。 By determining the empty page by the seventh function, the writing destination (empty page) by the fourth function can be determined.
〔6〕上記〔5〕において、上記第7機能には、同じ論理ページナンバーを持つ複数の物理ページ間で、上記チェックサム及び上記確認フラグが共に正常であり、上記タイムスタンプが互いに異なる場合に、上記タイムスタンプの値が小さいほうを上記空きページと判定する機能を含めることができる。上記第7機能には、同じ論理ページナンバーを持つ複数の物理ページのうち、上記タイムスタンプ、上記論理ページナンバー、上記確認フラグ、及び上記チェックサムの少なくともひとつが異常であると判断された物理ページを上記空きページと判定する機能を含めることができる。上記第7機能には、同じ論理ページナンバーを持つ複数の物理ページのうち、データが正常に書き込まれたか否かの確認が済んでいないと判断された物理ページを上記空きページと判定する機能を含めることができる。上記第7機能には、同じ論理ページナンバーを持つ複数の物理ページのうち、確認フラグ以外のデータは正常と判断された物理ページは有効とし、それとは異なる物理ページを上記空きページと判定する機能を含めることができる。 [6] In the above [5], the seventh function includes a case where both the checksum and the confirmation flag are normal and the time stamps are different between a plurality of physical pages having the same logical page number. The function of determining the smaller value of the time stamp as the empty page can be included. The seventh function includes a physical page in which at least one of the time stamp, the logical page number, the confirmation flag, and the checksum among a plurality of physical pages having the same logical page number is determined to be abnormal. Can be included as a free page. The seventh function includes a function of determining, from among a plurality of physical pages having the same logical page number, a physical page for which it has been determined that data has not been normally written or not, as a free page. Can be included. The seventh function is a function that, among a plurality of physical pages having the same logical page number, a physical page for which data other than the confirmation flag is determined to be normal is valid and a different physical page is determined as the free page Can be included.
以上の空きページ判定機能によれば、電源遮断の発生タイミング、すなわち書き込みのどの段階で電源遮断が発生したかを考慮してデータの有効性を判断して空きページを決定するようにしているため、不揮発性メモリ内の旧データ及び書き込みにかかる新データの何れかが必ず有効と判断され、それによって適切な空きページ判定を行うことができる。 According to the above empty page determination function, the empty page is determined by determining the validity of the data in consideration of the occurrence timing of power interruption, that is, at which stage of writing the power interruption has occurred. Therefore, it is determined that either the old data in the nonvolatile memory or the new data to be written is always valid, thereby making it possible to perform appropriate empty page determination.
2.実施の形態の詳細
実施の形態について更に詳述する。
2. Details of Embodiments Embodiments will be further described in detail.
<実施の形態1>
図1には、本発明にかかる半導体集積回路装置の一例とされるカード用マイクロコンピュータが示される。
<
FIG. 1 shows a card microcomputer as an example of a semiconductor integrated circuit device according to the present invention.
図1に示されるカード用マイクロコンピュータ10は、特に制限されないが、公知の半導体集積回路製造技術により、単結晶シリコン基板などの一つの半導体基板に形成され、非接触式ICカードに搭載されるシングルチップマイクロコンピュータである。
The
カード用マイクロコンピュータ10は、それぞれ所定の機能を有する複数の機能モジュールを含み、それらは、アドレス信号を伝達するためのアドレスバスABUSや、データを伝達するためのデータバスDBUSを介して各種信号のやり取りが可能に結合されている。
The
カード用マイクロコンピュータ10には、CPU(中央処理装置、制御部)101、I/O(入出力)ポート102、ウォッチドッグタイマ(WDT)103、システムコントロールロジック104、セキュリティロジック105、ROM(Read Only Memory;リードオンリーメモリ)106、RAM(Random Access Memory;ランダムアクセスメモリ)107が設けられる。CPU101は、所定のプログラムを実行することで、カード用マイクロコンピュータ10全体の動作を制御する。I/Oポート102は、2チャンネルのI/O外部割り込み兼用ポート(I/O−1/IRQ,I/O−2/IRQ)を有する。ウォッチドッグタイマ(WDT)103は、CPU101で実行されるプログラムがハングアップなどの不正な状態に陥ってしまい規則的なウォッチドッグ操作が行なわれなかった場合を検出する。システムコントロールロジック104は、CPU101の制御下でカード用マイクロコンピュータシステムの動作を制御する。セキュリティロジック105は、システムの安全を維持することを目的とするファイアウォールマネージメントなどを含む。ROM106には、CPU101で実行されるプログラムが格納される。RAM107は、CPU101によってランダムアクセス可能なメモリとされ、特に制限されないが、ダイナミック型RAMやスタティック型RAMとされる。このRAM107には、後に詳述するように、CPU101の制御下で、アドレス変換テーブルが形成される。
The
またカード用マイクロコンピュータ10には、EEPROM(電気的に消去可能なプログラマブルROM、不揮発性メモリ)108、複数のタイマ(TMR1,TMR2,TMR3)109、剰余乗算コプロセッサ110、DESコプロセッサ111、AESコプロセッサ112が設けられる。EEPROM108は、不揮発性メモリの一例とされる。このEEPROM108へのデータ書き込み動作やEEPROM108からのデータ読み出し動作は、CPU101によって制御される。このような意味で、CPU101を「制御部」とも称する。複数のタイマ(TMR1,TMR2,TMR3)109は、それぞれクロックを数えることで一定時間の経過を知るのに用いられる。剰余乗算コプロセッサ110、DESコプロセッサ111、AESコプロセッサ112は、暗号演算処理等、所定の演算処理を実行する。本例では、コプロセッサでの演算処理の作業領域に使用されるRAM(CRAM)が剰余乗算コプロセッサ110に設けられている。
The
さらにカード用マイクロコンピュータ10には、乱数生成回路(RNG)113、擬似乱数発生回路(DNG)114、接触インタフェース(UART)115、非接触インタフェース116、アナログ制御回路117が設けられる。乱数生成回路(RNG)113は乱数を発生する。擬似乱数発生回路(DNG)114は擬似乱数を発生する。接触インタフェース(UART)115は、外部装置(リーダライタ)に接触された状態で各種信号のやり取りを可能にする。非接触インタフェース116は、外部装置(リーダライタ)と非接触状態で各種信号のやり取りを可能にする。本例では、データ入出力のための通信バッファ(BUF)が非接触インタフェース116内に設けられる。アナログ制御回路117は、入力切り替え機能を有し、外部装置(リーダライタ)に接触された状態では、非接触式ICカードに設けられた接触インタフェース端子を介して、リセット信号RES、クロック信号CLK、電源電圧Vcc,Vssの取り込みを可能にする。電源電圧Vcc,Vssは、カード用マイクロコンピュータ10の動作用電源とされる。リセット信号RESによって、カード用マイクロコンピュータ10をリセットすることができる。また、カード用マイクロコンピュータ10への電源投入により、アナログ制御回路117によって、パワーオンリセット信号が形成されるようになっている。カード用マイクロコンピュータ10への電源投入時には、上記パワーオンリセット信号によってカード用マイクロコンピュータ10が初期化されるようになっている。また、アナログ制御回路117は、外部装置(リーダライタ)に接触されていない状態では、電波を介して外部装置(リーダライタ)との間の通信を可能にする。この場合、カード用マイクロコンピュータ10の電源は、アンテナ118を介して受信する外部装置(非接触リーダー/ライター装置)のRFキャリア信号の整流・平滑によって生成される。この場合においても、カード用マイクロコンピュータ10への電源投入時には、上記パワーオンリセット信号によってカード用マイクロコンピュータ10が初期化される。
Further, the
データ書き込み最中の電源遮断とは、例えば、非接触通信を行っている最中に、カード用マイクロコンピュータ10が実装された非接触ICカードを外部装置の磁界から遠ざけた場合に、RFキャリア信号を十分に受信することが不可能となり、結果として、RFキャリア信号を整流・平滑化することによって生成されるはずの電源が十分に生成されなくなることで、通信最中に電源遮断が発生してしまうことである。
For example, when the non-contact IC card on which the
図2には、上記EEPROM108の初期状態が示される。
FIG. 2 shows the initial state of the
EEPROM108は、特に制限されないが、電源遮断対策領域202と、電源遮断対策対象外領域(電源遮断非対策領域)203,204を含む。電源遮断対策領域202へのデータ書き込みの最中に電源が遮断された場合でも、デバイスの信頼性低下を生じないような対策がとられている。しかし、電源遮断対策対象外領域203,204へのデータ書き込みについては、そのような対策はとられていない。電源遮断対策対象外領域203,204(その他のデータエリア)は、書き換えが不要とされるデータの格納に利用できる。
Although not particularly limited, the
CPU101は、EEPROM108における物理メモリ空間および論理メモリ空間を、基本的に一定サイズのページと呼ばれる単位に分割して管理を行う。ページは、物理ページナンバー(以降、ナンバーを「No.」と略記する場合もある)や論理ページナンバーで識別される。論理ページナンバーと物理ページナンバーとの対応付けは、論理/物理アドレス変換テーブルで実現される。EEPROM108におけるページは、複数のデータが格納されるブロック(データブロック)「Block」とページ管理情報が格納されるページ管理情報エリア201とを含む。EEPROM108へのデータ書き込みはページ単位で行われる。
The
図6には、上記EEPROM108におけるメモリフォーマットと論理/物理アドレス変換テーブルとの関係が示される。
FIG. 6 shows the relationship between the memory format in the
図6(A)に示されるように、書き込み最中の電源遮断対策のため、EEPROM108における複数のページのうちのひとつが必ず空きページとされ、新たなデータ書き込みは、この空きページに対して行われる。図6に示される例では、物理ページNo.H’70が空きページとされ、当該空きページに属するブロックは、「Vacant Block(空きブロック)」とされることで、他のページのブロックと区別されている。
As shown in FIG. 6A, as a countermeasure against power interruption during writing, one of the plurality of pages in the
ページ管理情報エリア201に記録されるページ管理情報は、図6(C)に拡大して示されるように、タイムスタンプ(TS)、論理ページNo.(H’00)、確認フラグ(H’81)、ページ管理情報に対する第1チェックサム(CS1)、データブロックに対する第2チェックサム(CS2)を含む。タイムスタンプは、後述するように空きページの判断に用いられる。論理ページNo.は、EEPROM108における論理ページNo.である。確認フラグは、データが正常に書き込まれたことを示すためのフラグである。ページ管理情報に対する第1チェックサムは、タイムスタンプと論理ページNo.とのワードの総計値とされ、データブロックに対する第2チェックサムは、当該ページにおけるデータブロックのワードの総計値とされる。第1チェックサム及び第2チェックサムは、それぞれ誤り検出に用いられる。
The page management information recorded in the page
論理/物理アドレス変換テーブルは、図6(B)に示されるように、論理ページNo.と物理ページNo.とが対応付けられており、この論理/物理アドレス変換テーブル601を参照することで、論理アドレスに対する物理アドレスが得られる。また、この論理/物理アドレス変換テーブル601を参照することで、EEPROM108における空きページの物理ページNo.が得られるようになっている。このような論理/物理アドレス変換テーブル601は、このカード用マイクロコンピュータ10のパワーオンリセット後の初期化処理により、RAM107に形成される。
As shown in FIG. 6B, the logical / physical address conversion table includes a logical page No. And physical page No. , And a physical address for the logical address is obtained by referring to the logical / physical address conversion table 601. Also, by referring to this logical / physical address conversion table 601, the physical page number of the empty page in the
図3には、カード用マイクロコンピュータ10の動作の流れが示される。
FIG. 3 shows an operation flow of the
カード用マイクロコンピュータ10に電源電圧Vcc,Vssが投入されたとき、又はアンテナ118を介して電源電圧が供給されたとき(301)、アナログ制御回路117において、パワーオンリセット信号が発生され、それによってカード用マイクロコンピュータ10が初期化される。すなわち、CPU101によって、所定のリセット処理プログラムが実行されることにより、カード用マイクロコンピュータ10におけるハードウェア(H/W)の初期化処理及びソフトウェア(S/W)の初期化処理が行われ(302,303)、論理/物理アドレス変換テーブルの作成が実行される(304)。論理/物理アドレス変換テーブルは、EEPROM108における電源遮断対策対象領域202(図2参照)の全体がCPU101によってスキャンされ、そのスキャン結果に基づいてRAM107の所定エリアに構築される。論理/物理アドレス変換テーブルには、空きページの物理ページNo.も含まれる。尚、空きページの判定基準については後に詳述する。論理/物理アドレス変換テーブルが作成された後に、カード用マイクロコンピュータ10は、命令の受信待ち状態となる(305)。この状態で、書き込み命令や読み出し命令が受信された場合には、当該命令に応じた処理がCPU101の制御下で行われる(306)。
When the power supply voltages Vcc and Vss are input to the
図4には、カード用マイクロコンピュータ10において書き込み命令が受信された場合の動作の流れが示される。
FIG. 4 shows a flow of operation when a write command is received by the
以下、図4に基づいて、カード用マイクロコンピュータ10の動作を説明する。尚、書き込み命令は、外部装置とされるリーダライタから発行され、このリーダライタから発行された書き込み命令には、データを書き換えたいブロック番号、及び書き換えにかかるデータが含まれるものとする。
Hereinafter, the operation of the
書き込み命令が受信されると(401)、当該命令がCPU101でデコードされ、そのデコード結果に基づいて、先ず、アドレス変換処理が行われる(402)。図7には、ブロック1(Block1)のデータ書き換えを目的とする書き込み命令が受信された場合の主要部の状態が示される。この例では、EEPROM108におけるH’00〜H’70までが電源遮断対策対象領域とされる。また、特に制限されないが、EEPROM108の書き換え単位(ページのサイズ)は64バイト、書き換えにかかるデータサイズ(ブロックのサイズ)は16バイトとされる。
When a write command is received (401), the command is decoded by the
ブロック1(Block1)に対応する論理ページNo.から物理ページNo.への変換は、RAM107内の論理/物理アドレス変換テーブル601を参照して行われる。
Logical page No. corresponding to block 1 (Block 1). To physical page No. Conversion to is performed with reference to the logical / physical address conversion table 601 in the
次に、ステップ402でのアドレス変換結果に基づいて、旧データがRAM107の所定エリアにコピーされる(403)。図8には、旧データがRAM107の所定エリアにコピーされた状態が示される。この例では、データ書き換えの対象とされるブロック1(Block1)が含まれるページ(物理ページNo.H’00)の記憶データがRAM107の書き込み用エリア801にコピーされる。
Next, based on the address conversion result in
次に、ステップ403でRAM107の書き込み用エリア801にコピーされたデータの更新が行われる(404)。図9には、ステップ403でRAM107の書き込み用エリア801にコピーされたデータの更新後の状態が示される。この例では、書き込み用エリア801におけるブロック1(Block1)のデータが、書き込み命令にかかるデータ(Block1’)に変更される。この変更に伴い、タイムスタンプが、「TS」から「TS+1」に更新され、確認フラグが「H’81」から「H’FF」に更新され、さらに、第1チェックサムの値が「CS1」から「CS1’」に更新され、第2チェックサムの値が「CS2」から「CS2’」に更新される。
Next, in
次に、EEPROM108における空きページへのデータ書き込みが行われる(405)。つまり、論理/物理アドレス変換テーブル601を参照してEEPROM108における空きページの物理ページNo.が求められ(この例では「H’70」)、図10に示されるように、この空きページに、RAM107の書き込み用エリア801のデータ(ステップ404で更新されたもの)が書き込まれる。
Next, data is written to an empty page in the EEPROM 108 (405). That is, referring to the logical / physical address conversion table 601, the physical page number of the empty page in the
上記ステップ405のデータ書き込みが行われた後、そのデータ書き込みが正しく行われたか否かを確認するため、図11に示されるように、EEPROM108における物理ページNo.H’70のデータ(ステップ405で書き込まれたデータ)と、RAM107の書き込み用エリア801のデータ(書き込み元のデータ)との比較が行われる(406)。
After the data is written in
上記ステップ406のデータ比較の結果、両データが一致すると判断された場合、それは上記ステップ405でのデータ書き込みが正しく行われたことを意味するから、その場合には、確認フラグのオーバーライトが行われる(407)。つまり、上記ステップ406のデータ比較の結果、両データが一致すると判断された場合には、図12に示されるように、RAM107の書き込み用エリア801における確認フラグが、それまでの「H’FF」から、確認完了を示すデータ、例えば「H’81」に変更され、この変更後の確認フラグが、EEPROM108における物理ページNo.H’70のデータにオーバーライト(上書き)される。このオーバーライトでは、確認フラグ以外のデータの書き込みは不要であるため、RAM107の書き込み用エリア801における確認フラグ以外のデータは、全て「H’FF」に変更される。ステップ407におけるオーバーライトは、上記ステップ405のデータ書き込みと比べてデータ消去処理を実施していない分、短時間で完了する。つまり、上記ステップ407では、確認フラグ以外のデータは「H‘FF」でオーバーライトするため、RAM107の書き込み用エリア801は、結果的に、確認完了を示すデータのみが更新されている。
If it is determined as a result of the data comparison in
尚、上記ステップ406のデータ比較の結果、両データが一致しないと判断された場合には、それは上記ステップ405でのデータ書き込みが正しく行われていないことを意味するから、書き込み失敗とし処理を終了する。
If it is determined as a result of the data comparison in
上記ステップ407のオーバーライト後に、論理/物理アドレス変換テーブル601の更新が行われる(408)。つまり、図13に示されるように、論理/物理アドレス変換テーブル601の内容を、EEPROM108の状態に整合させるため、論理/物理アドレス変換テーブル601において、論理ページNo.H’00の物理ページNo.が、それまでの「H’00」から「H’70」に変更され、空きページの物理ページNo.が、それまでの「H’70」から「H’00」に変更される。
After overwriting in
以上により、受信された書き込み命令に対応するデータ書き換えが終了する。 The data rewriting corresponding to the received write command is thus completed.
次に、図3におけるステップ304の論理/物理アドレス変換テーブル作成で行われる空きページの判定について詳述する。互いに等しい論理ページNo.を有する物理ページが二つ存在する場合、CPU101は以下の判定基準に従って空きページを決定する。
Next, the empty page determination performed in the logical / physical address conversion table creation in
空きページの判定基準として、以下の4ケースを挙げることができる。 The following four cases can be given as criteria for determining the free page.
《ケース1》
先ず、ケース1について説明する。
<<
First,
図14に示されるように、互いに等しい論理ページNo.H’00を有する二つの物理ページにおいて、それぞれ第1チェックサム(CS1,CS1’)および第2チェックサム(CS2,CS2’)が正しく、且つ、確認フラグ(H’81)も正常にオーバーライトされているが、タイムスタンプが互いに異なる場合がある。かかる場合は、タイムスタンプの大きいほうが有効データとされる。つまり、タイムスタンプは、RAM107の書き込み用エリア801にコピーされたデータがステップ404で更新(図9参照)された結果、それまでの「TS」から「TS+1」に変更されているはずであるから、このタイムスタンプの大きいほうが有効データである。従って、「TS+1」のタイムスタンプを有する物理ページNo.H‘70が有効ページと判定され、「TS」のタイムスタンプを有する物理ページNo.H’00が空きページと判定され、その判定結果が、論理/物理アドレス変換テーブル601に書き込まれる。
As shown in FIG. 14, logical page numbers equal to each other. In the two physical pages having H′00, the first checksum (CS1, CS1 ′) and the second checksum (CS2, CS2 ′) are correct, and the confirmation flag (H′81) is overwritten normally. However, the time stamps may be different from each other. In such a case, the data with the larger time stamp is regarded as valid data. That is, the time stamp should have been changed from “TS” to “TS + 1” as a result of the data copied to the
本ケースは、ステップ408の論理/物理アドレス変換テーブルの更新後に電源が遮断された場合であり、最も一般的なケースである(図4参照)。
This case is a case where the power is turned off after the logical / physical address conversion table is updated in
《ケース2》
ケース2について説明する。
<<
図15に示されるように、例えば物理ページNo.70のページ管理情報において、タイムスタンプ、論理ページNo.、確認フラグ、第1チェックサムおよび第2チェックサムのうち、少なくともひとつが、あり得ない値(異常値)の場合、それは無効データ(Invalid data)と判断され、当該物理ページNo.70が空きページと判定され、その判定結果が、論理/物理アドレス変換テーブル601に書き込まれる。 As shown in FIG. 15, for example, the physical page No. 70 page management information, time stamp, logical page No. If at least one of the confirmation flag, the first checksum, and the second checksum is an impossible value (abnormal value), it is determined to be invalid data (Invalid data). 70 is determined to be an empty page, and the determination result is written in the logical / physical address conversion table 601.
本ケースは、ステップ405の物理ページNo.70へのデータ書き込みの最中に電源が遮断されることにより、データが異常値となってしまった可能性があるため、当該データ書き込み以前のデータ(EEPROM108の旧データであり、本例では物理ページNo.H’00のデータ)が有効(有効データページ)とされる(図4参照)。
In this case, the physical page No. Since there is a possibility that the data has become an abnormal value due to the power being cut off during the data writing to the
《ケース3》
ケース3について説明する。
<<
図16に示されるように、互いに等しい論理ページNo.H’00を有する二つの物理ページにおいて、それぞれ第1チェックサム(CS1,CS1’)および第2チェックサム(CS2,CS2’)が正しく、物理ページNo.H’70のタイムスタンプが物理ページNo.H’00に比べて、+1(更新)されているにもかかわらず、物理ページNo.H’70の確認フラグがH’FFのままである場合が考えられる。かかる場合には、物理ページNo.H’70が空きページと判定され、その判定結果が、論理/物理アドレス変換テーブル601に書き込まれる。 As shown in FIG. 16, logical page numbers equal to each other. In the two physical pages having H'00, the first checksum (CS1, CS1 ') and the second checksum (CS2, CS2') are correct, respectively. The time stamp of H'70 is the physical page No. Compared to H'00, although it is +1 (updated), physical page No. A case where the confirmation flag of H′70 remains H′FF is considered. In such a case, the physical page No. H′70 is determined to be an empty page, and the determination result is written in the logical / physical address conversion table 601.
本ケースは、データが正常に書き込まれたにもかかわらず、電源遮断により、ステップ406でのデータ比較に基づいてデータが正常に書き込まれたか否かの確認が済んでいないことが考えられるため、当該データ書き込み以前のデータ(EEPROM108の旧データであり、本例では物理ページNo.H’00のデータ)が有効とされる(図4参照)。
In this case, it is considered that although the data has been normally written, it has not been confirmed whether the data has been normally written or not based on the data comparison in
《ケース4》
ケース4について説明する。
<<
図17に示されるように、互いに等しい論理ページNo.H’00を有する二つの物理ページにおいて、それぞれ第1チェックサム(CS1,CS1’)および第2チェックサム(CS2,CS2’)が正しく、物理ページNo.H’70のタイムスタンプが物理ページNo.H’00に比べて、+1されているにもかかわらず、物理ページNo.H’70の確認フラグが異常な値(ただし、「H’FF」を除く)である場合が考えられる。かかる場合、物理ページNo.H’00が空きページと判定され、その判定結果が、論理/物理アドレス変換テーブル601に書き込まれる。 As shown in FIG. 17, logical page numbers equal to each other. In the two physical pages having H'00, the first checksum (CS1, CS1 ') and the second checksum (CS2, CS2') are correct, respectively. The time stamp of H'70 is the physical page No. Despite being incremented by 1 compared to H′00, the physical page No. A case where the confirmation flag of H′70 is an abnormal value (except “H′FF”) is conceivable. In such a case, the physical page No. H′00 is determined as an empty page, and the determination result is written in the logical / physical address conversion table 601.
本ケースは、ステップ406でのデータ比較に基づいてデータが正常に書き込まれたことが確認されたものの、ステップ407での確認フラグのオーバーライトの最中に電源が遮断された可能性があり、確認フラグ以外は正常に書き込まれていると判断される。このため、本例では当該データ書き込み以後のデータ(EEPROM108の新データであり、本例では物理ページNo.H’70のデータ)が有効とされる(図4参照)。
In this case, although it was confirmed that the data was normally written based on the data comparison in
以上の空きページ判定基準によれば、電源遮断の発生タイミング、すなわち書き込みのどの段階で発生したかを考慮してデータの有効性を判断して空きページを決定するようにしているため、EEPROM108内の旧データ及び書き込みにかかる新データの何れかが必ず有効と判断され、それによって適切な空きページ判定を行うことができ、EEPROM108から読み出されるデータの信頼性の向上を図ることができる。
According to the above empty page determination standard, the empty page is determined by determining the validity of the data in consideration of the occurrence timing of power interruption, that is, at which stage of writing, the data validity. Thus, it is determined that either the old data or the new data to be written is always valid, whereby appropriate empty page determination can be performed, and the reliability of data read from the
ここで従来技術に従えば、論理/物理アドレス変換テーブル601がEEPROM108内に設けられている場合には、EEPROM108へのデータ書き込み毎に、EEPROM108へのデータ書き込みと、当該EEPROM108内のアドレス変換テーブル更新のために、結果的にEEPROM108への書き込み動作が2度必要とされる。
Here, according to the prior art, when the logical / physical address conversion table 601 is provided in the
これに対してこの実施の形態では、論理/物理アドレス変換テーブル601がRAM107内に設けられているため、EEPROM108内のアドレス変換テーブル更新のためのEEPROM108への書き込み動作が不要になる。RAM107内の論理/物理アドレス変換テーブル601の更新は、EEPROM108の場合に比べて高速に行うことができる。このため、EEPROM108へのデータ書き込み処理全体としてのパフォーマンスの向上を図ることができる。
On the other hand, in this embodiment, since the logical / physical address conversion table 601 is provided in the
データ書き込み処理において、上記ステップ406のデータ比較の結果、両データが一致すると判断された場合、確認フラグのオーバーライトが行われる(407)。しかしこのオーバーライトでは、確認フラグ以外のデータの書き込みは不要であるため、RAM107の書き込み用エリア801における確認フラグ以外のデータは、全て「H’FF」に変更される。上記ステップ407におけるオーバーライトは、上記ステップ405のデータ書き込みと比べてデータ消去処理を実施していない分、短時間で完了することができる。従って、確認フラグのオーバーライトは、EEPROM108へのデータ書き込み処理全体としてのパフォーマンスの向上を妨げるものではない。
In the data writing process, if it is determined that the two data match as a result of the data comparison in
また、上記ステップ407におけるオーバーライト(上書き処理)においては、通常のデータ書き込みと比べてデータ消去処理を実施していないため、データ書き込み処理においては、全体として短時間で処理を完了することが可能となる。よって、非接触通信が行われる場合においても、従来技術のような不揮発性メモリへの2度の書き込み動作を行う場合に比べて、より早く必要なデータ通信(書き込み通信等)を完了させることが可能となり、通信中に電源遮断が発生する可能性をを小さくすることが可能となる。
In addition, since the data erasure process is not performed in the overwrite (overwrite process) in
次に、読み出し命令がカード用マイクロコンピュータ10において受信された場合の動作について説明する。
Next, an operation when a read command is received by the
図5には、カード用マイクロコンピュータ10において読み出し命令が受信された場合の動作の流れが示される。
FIG. 5 shows an operation flow when the
尚、読み出し命令は、リーダライタから発行され、このリーダライタから発行された書き込み命令には、データを読み出したいブロック番号などの情報が含まれるものとする。 The read command is issued from the reader / writer, and the write command issued from the reader / writer includes information such as a block number from which data is to be read.
読み出し命令が受信されると(501)、上記書き込み命令が受信された場合と同様に、当該命令がCPU101でデコードされ、そのデコード結果に基づいて、先ず、アドレス変換処理が行われる(502)。データを読み出したいブロックの論理ページNo.から物理ページNo.への変換は、RAM107内の論理/物理アドレス変換テーブル601を参照して行われる。そして、得られた物理ページNo.の記憶データがEEPROM108からRAM107の所定エリアにコピーされ(503)、コピーされたデータの中から、上記読み出し命令に対応するデータがリーダライタへ出力される(504)。
When a read command is received (501), as in the case where the write command is received, the command is decoded by the
次に、EEPROM108の書き換え単位と、書き換えにかかるデータサイズとの関係について説明する。
Next, the relationship between the rewrite unit of the
カード用マイクロコンピュータ10は、EEPROM108の書き換え単位毎に、ページ管理情報が格納されるページ管理情報エリア201が設けられ、パワーオンリセットに起因する初期設定において、上記ページ管理情報がスキャンされ、それに基づいて論理/物理アドレス変換テーブル601が形成されるようになっている。このようなカード用マイクロコンピュータ10によれば、EEPROM108の書き換え単位と、書き換えにかかるデータサイズ(ユーザが要求するデータサイズ)との間に、以下のような関係がある。
The
例えば図18(A)に示されるように、EEPROM108の書き換え単位が32バイトであって、データサイズ(ユーザが要求するデータサイズ)が1バイトや16バイトの場合には、上記実施の形態の場合と同様に、メモリ書き換えの回数は何れも1回となる。しかし、データサイズが32バイトの場合には、メモリ書き換えの回数は2回となる。すなわち、EEPROM108の書き換え単位が32バイトであって、データサイズが32バイトの場合には、図18(B)に示されるように、先ず、書き込みデータが16バイトに分割され、それがページ管理情報(16バイト)とともに空きページに書き込まれ、RAM内の論理/物理アドレス変換テーブル601が更新される(181)。そしてこのステップ181の処理で空きページとなった物理アドレスNo.に、残りのデータ(16バイト)とページ管理情報(16バイト)とが書き込まれ、RAM内の論理/物理アドレス変換テーブル601が更新される(182)。このようにEEPROM108の書き換え単位が32バイトであって、データサイズが32バイトの場合には、書き換え回数が2回となる。尚、EEPROM108の書き換え単位が32バイトであって、データサイズが32バイトを越える場合には、書き換え回数がさらに増える可能性がある。
For example, as shown in FIG. 18A, when the rewrite unit of the
また、EEPROM108の書き換え単位が32バイトの場合には、図18(C)に示されるように、ページ管理情報(16バイト)の存在により、ユーザデータの書き込みに使用できる領域は、電源遮断対策対象領域202(図2参照)の半分となってしまうため、実用的ではない。
Further, when the rewrite unit of the
図19(A)に示されるように、EEPROM108の書き換え単位が128バイトであって、データサイズ(ユーザが要求するデータサイズ)が1バイトや112バイト以下の場合には、上記実施の形態の場合と同様に、メモリ書き換えの回数は何れも1回となる。しかし、データサイズが113バイトを越える場合には、メモリ書き換えの回数は2回となる。尚、EEPROM108の書き換え単位が128バイトであって、データサイズが113バイトを越える場合の書き込み処理は、図18(B)に示される場合と同様となる。
As shown in FIG. 19A, when the rewrite unit of the
また、EEPROM108の書き換え単位が128バイトの場合には、図19(B)に示されるように、ページ管理情報(16バイト)は、EEPROM108の書き換え単位(128バイト)の1/8と少ないため、実用的と考えられる。
When the rewrite unit of the
以上を勘案すると、EEPROM108の書き換え単位と、書き換えにかかるデータサイズとの関係は、書き換えにかかるデータサイズ(ユーザが要求するデータサイズ)が、EEPROM108の書き換え単位以下となるように設定するのが望ましい。
Considering the above, it is desirable to set the relationship between the rewrite unit of the
また、EEPROM108のメモリ使用量は、電源遮断対策対象領域202(図2参照)のうち、ページ管理情報の占める割合は、可能な限り少ないほうが良い。
Further, the memory usage of the
上記実施の形態では、EEPROM108の書き換え単位(ページのサイズ)を64バイト、書き換えにかかるデータサイズ(ブロックのサイズ)を16バイトとしているが、この設定は、上記の理由により適切と考えられる。
In the above embodiment, the rewrite unit (page size) of the
次に、上記カード用マイクロコンピュータ10が搭載された非接触式ICカードの使用例について説明する。
Next, a usage example of a non-contact type IC card on which the
図20に示されるように、カード用マイクロコンピュータ10が搭載された非接触式ICカード212は、交通チケット、金融カード、入退出カードとして用いることができる。
As shown in FIG. 20, the
非接触式ICカード212が交通チケットとして用いられる場合、非接触式ICカード212内のEEPROM108には、カードの残高、改札通過時刻、改札を通過した駅などの各種情報が、リーダライタ211によって書き込まれる。
When the
非接触式ICカード212が金融カードとして用いられる場合、非接触式ICカード212内のEEPROM108には、カードの残高、引き出し/預け入れ日時などの各種情報が、リーダライタ211によって書き込まれる。
When the non-contact
非接触式ICカード212が入退出カードとして用いられる場合、非接触式ICカード212内のEEPROM108には、入室時刻や退室時刻などの各種情報が、リーダライタ211によって書き込まれる。
When the non-contact
また、リーダライタ211から伝達された各種情報を暗号化してから非接触式ICカード212内のEEPROM108に書き込み、EEPROM108からの読み出しデータを復号化してからリーダライタ211に出力することができる。この場合の暗号化処理や復号化処理は、カード用マイクロコンピュータ10内の剰余乗算コプロセッサ110、DESコプロセッサ111、AESコプロセッサ112などを用いて高速に行うことができる。
Also, various information transmitted from the reader /
上記のように電源遮断対策が施されたカード用マイクロコンピュータ10を搭載する非接触式ICカード212に対応するリーダライタ211に結合されるホストシステム(コンピュータシステム)においては、図21に示されるような処理が行われることで、上記カード用マイクロコンピュータ10の能力が発揮される。
FIG. 21 shows a host system (computer system) coupled to the reader /
すなわち、非接触式ICカード212に対応するリーダライタ211に結合されるホストシステムでは、所定の通信プロトコルに従って、非接触式ICカード212内のカード用マイクロコンピュータ10と非接触通信接続を確立し(2101)、前回の非接触通信接続において、電源遮断に起因する処理中断が発生しているか否かの判別が行われる(2102)。この判別は、上記ホストシステムにおいて、カード用マイクロコンピュータ10におけるEEPROM108内のデータを期待値と比較することで可能となる。そして、上記ステップ2102の判別において、電源遮断に起因する処理中断は発生していない(Y)と判断された場合には、上記ホストシステムから非接触式ICカード212に対する所望のアクセスが開始される(2105)。しかし、上記ステップ2102の判別において、電源遮断に起因する処理中断が発生している(N)と判断された場合には、上記電源遮断に起因する処理中断にかかるデータが、必要に応じて、カード用マイクロコンピュータ10におけるEEPROM108に書き込まれる(2104)。
That is, the host system coupled to the reader /
以上本発明者によってなされた発明を実施形態に基づいて具体的に説明したが、本発明はそれに限定されるものではなく、その要旨を逸脱しない範囲において種々変更可能であることは言うまでもない。 Although the invention made by the present inventor has been specifically described based on the embodiments, it is needless to say that the present invention is not limited thereto and can be variously modified without departing from the gist thereof.
例えば、EEPROM108における電源遮断対策対象外領域203,204(その他のデータエリア)を省略し、EEPROM108の記憶領域の全てを電源遮断対策対象領域202としても良い。
For example, the power shutdown countermeasure
EEPROM108に代えて他の不揮発性メモリであるフラッシュメモリを適用することができる。
Instead of the
10 カード用マイクロコンピュータ
101 CPU
102 I/Oポート
103 ウォッチドッグタイマ
104 システムコントロールロジック
105 セキュリティロジック
106 ROM
107 RAM
108 EEPROM
109 複数のタイマ
110 剰余乗算コプロセッサ
111 DESコプロセッサ
112 AESコプロセッサ
113 乱数生成回路
114 擬似乱数発生回路
115 接触インタフェース
116 非接触インタフェース
117 アナログ制御回路
118 アンテナ
201 ページ管理情報エリア
202 電源遮断対策対象領域
203,204 電源遮断対策対象外領域
211 リーダライタ
212 非接触式ICカード
601 論理/物理アドレス変換テーブル
801 書き込み用エリア
10
102 I /
107 RAM
108 EEPROM
109
Claims (6)
上記不揮発性メモリへのデータ書き込み及び上記不揮発性メモリからのデータ読み出しを制御可能な制御部と、
上記制御部によってランダムアクセス可能なRAMと、を含み、
上記不揮発性メモリは、書き込み単位とされるページを含み、
上記ページは、それぞれデータを記憶可能な複数のブロックと、上記複数のブロックに書き込まれたデータを上記ページ単位で管理するためのページ管理情報と、を含み、
上記制御部は、上記不揮発性メモリについての論理アドレスを物理アドレスに変換するためのアドレス変換テーブルを、電源投入時の初期設定により上記RAMの第1記憶エリアに形成するアドレス変換テーブル形成機能と、
上記RAMの第1記憶エリアに形成された上記アドレス変換テーブルを参照して、上記不揮発性メモリにおけるブロックへのデータ書き込みを制御するデータ書き込み機能と、を含み、
上記データ書き込み機能は、データ書き込みの対象となるブロックを含むページの記憶データを上記RAMの第2記憶エリアにコピーする第1機能と、
上記RAMの第2記憶エリアに対して、上記データ書き込みの対象となるブロックへのデータ書き込みを行う第2機能と、
上記第2機能によるデータ書き込みに対応して、上記RAMの第2記憶エリアのページ管理情報を更新する第3機能と、
上記ページ管理情報が更新された後に、上記RAMの第2記憶エリアの記憶データを、上記アドレス変換テーブルで空きページとされる上記不揮発性メモリの物理ページに書き込む第4機能と、を含むことを特徴とする半導体集積回路装置。 Non-volatile memory;
A control unit capable of controlling data writing to the nonvolatile memory and data reading from the nonvolatile memory;
RAM randomly accessible by the control unit,
The non-volatile memory includes a page as a writing unit,
The page includes a plurality of blocks each capable of storing data, and page management information for managing the data written in the plurality of blocks in units of pages,
An address conversion table forming function for forming an address conversion table for converting a logical address of the nonvolatile memory into a physical address in a first storage area of the RAM by an initial setting at power-up;
A data writing function for controlling data writing to a block in the nonvolatile memory with reference to the address conversion table formed in the first storage area of the RAM,
The data writing function includes a first function for copying storage data of a page including a block to which data is to be written to the second storage area of the RAM;
A second function for writing data to the block to which the data is written in the second storage area of the RAM;
A third function for updating page management information in the second storage area of the RAM in response to data writing by the second function;
A fourth function for writing data stored in the second storage area of the RAM to a physical page of the nonvolatile memory that is set as an empty page in the address conversion table after the page management information is updated. A semiconductor integrated circuit device.
上記データ書き込み機能は、上記アドレス変換テーブルで空きページとされる上記不揮発性メモリの物理ページに書き込まれたデータと、それに対応する上記RAMの第2エリアのデータとが一致するか否かを判別する第5機能と、
上記アドレス変換テーブルで空きページとされる上記不揮発性メモリの物理ページに書き込まれたデータと、それに対応する上記RAMの第2記憶エリアのデータとが一致する場合に、上記RAMの第2記憶エリアの上記確認フラグの値を変更してから、その確認フラグを、上記不揮発性メモリにおいて対応する物理ページへ上書きすることで、当該物理ページにおける確認フラグを更新する第6機能と、を含む請求項1記載の半導体集積回路装置。 The page management information includes a confirmation flag indicating that data has been successfully written,
The data write function determines whether or not the data written in the physical page of the non-volatile memory, which is an empty page in the address conversion table, matches the data in the second area of the RAM corresponding thereto. A fifth function to
The second storage area of the RAM when the data written in the physical page of the non-volatile memory, which is an empty page in the address conversion table, matches the corresponding data in the second storage area of the RAM. And a sixth function for updating the confirmation flag in the physical page by overwriting the corresponding physical page in the nonvolatile memory after changing the value of the confirmation flag. 2. The semiconductor integrated circuit device according to 1.
上記第3機能は、上記第2機能によるデータ書き込みに対応して、上記タイムスタンプの現在の値に、1を加算することで上記タイムスタンプを更新する機能を含む請求項2記載の半導体集積回路装置。 The page management information further includes a time stamp,
3. The semiconductor integrated circuit according to claim 2, wherein the third function includes a function of updating the time stamp by adding 1 to a current value of the time stamp in response to data writing by the second function. apparatus.
同じ論理ページナンバーを持つ複数の物理ページのうち、上記タイムスタンプ、上記論理ページナンバー、上記確認フラグ、及び上記チェックサムの少なくともひとつが異常であると判断された物理ページを上記空きページと判定する機能と、
同じ論理ページナンバーを持つ複数の物理ページのうち、データが正常に書き込まれたか否かの確認が済んでいないと判断された物理ページを上記空きページと判定する機能と、
同じ論理ページナンバーを持つ複数の物理ページのうち、確認フラグ以外のデータは正常と判断された物理ページは有効とし、それとは異なる物理ページを上記空きページと判定する機能と、を含む請求項5記載の半導体集積回路装置。 In the seventh function, when both the checksum and the confirmation flag are normal between a plurality of physical pages having the same logical page number and the time stamps are different from each other, the smaller value of the time stamp is determined. A function to determine that the page is free,
Among a plurality of physical pages having the same logical page number, a physical page in which at least one of the time stamp, the logical page number, the confirmation flag, and the checksum is determined to be abnormal is determined as the free page. Function and
A function of determining, as a free page, a physical page that has been determined that the data has not been successfully written out of a plurality of physical pages having the same logical page number;
6. A function of validating a physical page for which data other than the confirmation flag is determined to be normal among a plurality of physical pages having the same logical page number, and determining a physical page different from the physical page as the empty page. The semiconductor integrated circuit device described.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010046453A JP2011180963A (en) | 2010-03-03 | 2010-03-03 | Semiconductor integrated circuit device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2010046453A JP2011180963A (en) | 2010-03-03 | 2010-03-03 | Semiconductor integrated circuit device |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2011180963A true JP2011180963A (en) | 2011-09-15 |
Family
ID=44692379
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2010046453A Withdrawn JP2011180963A (en) | 2010-03-03 | 2010-03-03 | Semiconductor integrated circuit device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2011180963A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2019049876A (en) * | 2017-09-11 | 2019-03-28 | 大日本印刷株式会社 | Electronic information storage medium, ic card, table management method with electronic information storage medium, and table management program |
CN112214162A (en) * | 2019-06-25 | 2021-01-12 | 株式会社日立制作所 | Storage device and control method |
-
2010
- 2010-03-03 JP JP2010046453A patent/JP2011180963A/en not_active Withdrawn
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2019049876A (en) * | 2017-09-11 | 2019-03-28 | 大日本印刷株式会社 | Electronic information storage medium, ic card, table management method with electronic information storage medium, and table management program |
CN112214162A (en) * | 2019-06-25 | 2021-01-12 | 株式会社日立制作所 | Storage device and control method |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US7708195B2 (en) | Memory card | |
KR102095614B1 (en) | Memory protection | |
JP6985011B2 (en) | Equipment and methods for ensuring access protection schemes | |
EP1396815B1 (en) | Memory card | |
EP2263187B1 (en) | Peripheral device locking mechanism | |
US8838950B2 (en) | Security architecture for system on chip | |
TWI436372B (en) | Flash memory storage system, and controller and method for anti-falsifying data thereof | |
TWI405211B (en) | Flash memory storage system, controller and data protecting method thereof | |
US20050259465A1 (en) | Nonvolatile memory apparatus | |
US8417902B2 (en) | One-time-programmable memory emulation | |
CN111226215B (en) | Transparent attached flash memory security | |
CN108319520A (en) | Mobile device alternate operating system based on secure storage | |
US20050209716A1 (en) | Method and system for writing nv memories in a controller architecture, corresponding computer program product and computer-readable storage medium | |
KR20060002664A (en) | Apparatus and method for controlling memory address mapping in embedded system | |
TW201525870A (en) | Updatable integrated-circuit radio | |
KR20150135753A (en) | Ic card, electronic device and portable electronic device | |
JP2011180963A (en) | Semiconductor integrated circuit device | |
US20080034150A1 (en) | Data processing circuit | |
JP2003022216A (en) | Storage device | |
US20040186947A1 (en) | Access control system for nonvolatile memory | |
JP5241065B2 (en) | Apparatus and method for checking whether data stored in external memory is changed | |
CN113557500A (en) | Multi-mode protected memory | |
JP6396119B2 (en) | IC module, IC card, and IC card manufacturing method | |
JP2009129402A (en) | Semiconductor device for ic card, ic card and terminal for ic card | |
JP2008310460A (en) | Control circuit, storage medium, processor, integrated system, and area management method |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A300 | Withdrawal of application because of no request for examination |
Free format text: JAPANESE INTERMEDIATE CODE: A300 Effective date: 20130507 |