JP2008071490A - Semiconductor integrated circuit device, ic card, and inspection device - Google Patents

Semiconductor integrated circuit device, ic card, and inspection device Download PDF

Info

Publication number
JP2008071490A
JP2008071490A JP2007312881A JP2007312881A JP2008071490A JP 2008071490 A JP2008071490 A JP 2008071490A JP 2007312881 A JP2007312881 A JP 2007312881A JP 2007312881 A JP2007312881 A JP 2007312881A JP 2008071490 A JP2008071490 A JP 2008071490A
Authority
JP
Japan
Prior art keywords
data
address
read
error
nonvolatile semiconductor
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
Application number
JP2007312881A
Other languages
Japanese (ja)
Other versions
JP4359327B2 (en
Inventor
Tetsuro Yoshimoto
哲朗 吉本
Takayuki Tanaka
崇之 田中
Yoshinori Mizushima
美紀 水嶋
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.)
Panasonic Holdings Corp
Original Assignee
Matsushita Electric Industrial Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Matsushita Electric Industrial Co Ltd filed Critical Matsushita Electric Industrial Co Ltd
Priority to JP2007312881A priority Critical patent/JP4359327B2/en
Publication of JP2008071490A publication Critical patent/JP2008071490A/en
Application granted granted Critical
Publication of JP4359327B2 publication Critical patent/JP4359327B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a semiconductor integrated circuit device capable of using a nonvolatile semiconductor memory in a normal state. <P>SOLUTION: Data of one reading unit is read from the lines X1 to X16 of a memory cell array 61 to investigate the presence of an error (A). For the line X16 corresponding to the error-detected data, data of all reading units are read (B). Thus, time for diagnosing a nonvolatile semiconductor memory 60 is shortened. <P>COPYRIGHT: (C)2008,JPO&INPIT

Description

この発明は半導体集積回路装置、ICカードおよび検査装置に関する。さらに詳しくは、不揮発性半導体メモリと当該不揮発性半導体メモリを診断する検査回路とを有する半導体集積回路装置、不揮発性半導体メモリとキャッシュメモリとを有する半導体集積回路装置、当該半導体集積回路装置を備えたICカードおよび不揮発性半導体メモリを診断する検査装置に関する。   The present invention relates to a semiconductor integrated circuit device, an IC card, and an inspection device. More specifically, a semiconductor integrated circuit device having a nonvolatile semiconductor memory and a test circuit for diagnosing the nonvolatile semiconductor memory, a semiconductor integrated circuit device having a nonvolatile semiconductor memory and a cache memory, and the semiconductor integrated circuit device are provided. The present invention relates to an inspection device for diagnosing an IC card and a nonvolatile semiconductor memory.

近年、不揮発性半導体メモリを内蔵したICカードが金融分野・交通分野などで普及しつつある。このような分野で利用されるICカードは正常な状態で長期間使用できることが望ましい。ところが、不揮発性半導体メモリへの書き込み動作時にリーダライタからICカードが引き抜かれたり、不揮発性半導体メモリへの書き込み回数が多くなること等の原因でICカードが故障することがある。   In recent years, IC cards with a built-in nonvolatile semiconductor memory have become widespread in the financial field and transportation field. It is desirable that an IC card used in such a field can be used for a long time in a normal state. However, the IC card may break down due to the IC card being pulled out from the reader / writer during the writing operation to the nonvolatile semiconductor memory or the number of times of writing to the nonvolatile semiconductor memory being increased.

この発明の目的は、不揮発性半導体メモリを正常な状態で長期間使用することができる半導体集積回路装置を提供することである。   An object of the present invention is to provide a semiconductor integrated circuit device that can use a nonvolatile semiconductor memory in a normal state for a long period of time.

課題を解決するための手段および発明の効果Means for Solving the Problems and Effects of the Invention

この発明の1つの局面に従うと、半導体集積回路装置は、不揮発性半導体メモリと、検査回路とを備える。不揮発性半導体メモリは、メモリセルアレイと、エラー訂正回路とを含む。メモリセルアレイは、行および列に複数の読み出し単位に分割される。エラー訂正回路は、複数の読み出し単位の各々に書き込むべきデータのエラー訂正符号化を行い、複数の読み出し単位の各々から読み出されたデータのエラー検出およびエラー訂正を行う。検査回路は、不揮発性半導体メモリを診断する。検査回路は、メモリセルアレイの各行から一の読み出し単位のデータを読み出すように指示する第1の指示を不揮発性半導体メモリに与える。第1の指示に従って読み出されたデータのエラーがエラー訂正回路によって検出されると検査回路は、当該エラーが検出されたデータに対応する行のすべての読み出し単位のデータを読み出すように指示する第2の指示を不揮発性半導体メモリに与える。   According to one aspect of the present invention, a semiconductor integrated circuit device includes a nonvolatile semiconductor memory and an inspection circuit. The nonvolatile semiconductor memory includes a memory cell array and an error correction circuit. The memory cell array is divided into a plurality of read units in rows and columns. The error correction circuit performs error correction encoding of data to be written in each of the plurality of read units, and performs error detection and error correction of data read from each of the plurality of read units. The inspection circuit diagnoses the nonvolatile semiconductor memory. The inspection circuit gives a first instruction to the nonvolatile semiconductor memory to instruct to read one read unit of data from each row of the memory cell array. When an error in the data read in accordance with the first instruction is detected by the error correction circuit, the inspection circuit instructs to read out data in all read units in the row corresponding to the data in which the error is detected. 2 is given to the nonvolatile semiconductor memory.

上記半導体集積回路装置では、検査回路によって不揮発性半導体メモリの診断が行われる。不揮発性半導体メモリの診断では、まず第1の指示が検査回路から不揮発性半導体メモリに与えられる。第1の指示に応答して不揮発性半導体メモリは、メモリセルアレイのある行から1つの読み出し単位のデータを読み出す。そしてメモリセルアレイから読み出されたデータのエラー検出およびエラー訂正処理がエラー訂正回路によって行われる。エラーが検出されなかったときは別の行から1つの読み出し単位のデータが読み出される。通常、不揮発性半導体メモリへの書き込みは行単位で行われる。したがって、書き込み時にエラーが発生した場合には同一の行にあるすべてのメモリセルにエラーが発生している可能性が高い。ゆえに上記半導体集積回路装置では、エラーが検出されなかったときは当該行にあるメモリセルには正しくデータが書き込まれていると判断し、続いて別の行から1つの読み出し単位のデータを読み出すようにしている。一方、エラーが検出されたときは第2の指示が検査回路から不揮発性半導体メモリに与えられる。第2の指示に応答して不揮発性半導体メモリは、当該エラーが検出されたデータに対応する行のすべての読み出し単位のデータを読み出す。このような処理を不揮発性半導体メモリのメモリセルアレイのすべての行に対して行う。   In the semiconductor integrated circuit device, diagnosis of the nonvolatile semiconductor memory is performed by the inspection circuit. In the diagnosis of the nonvolatile semiconductor memory, first, a first instruction is given from the inspection circuit to the nonvolatile semiconductor memory. In response to the first instruction, the nonvolatile semiconductor memory reads data of one read unit from a certain row of the memory cell array. Then, error detection and error correction processing of data read from the memory cell array is performed by the error correction circuit. When no error is detected, one read unit of data is read from another row. Normally, writing to the nonvolatile semiconductor memory is performed in units of rows. Therefore, when an error occurs during writing, there is a high possibility that an error has occurred in all the memory cells in the same row. Therefore, in the semiconductor integrated circuit device, when no error is detected, it is determined that the data is correctly written in the memory cell in the row, and then the data of one read unit is read from another row. I have to. On the other hand, when an error is detected, a second instruction is given from the inspection circuit to the nonvolatile semiconductor memory. In response to the second instruction, the non-volatile semiconductor memory reads data of all read units in the row corresponding to the data in which the error is detected. Such processing is performed for all the rows of the memory cell array of the nonvolatile semiconductor memory.

以上のように上記半導体集積回路装置では検査回路を設けているため、不揮発性半導体メモリが正常な状態であるか否かを判定することができる。これにより、不揮発性半導体メモリが故障した状態のままで使用され続けるような状況を防ぐことができる。この結果、不揮発性半導体メモリが正常な状態で長期間使用されることになる。   As described above, since the semiconductor integrated circuit device is provided with the inspection circuit, it can be determined whether or not the nonvolatile semiconductor memory is in a normal state. As a result, it is possible to prevent a situation in which the nonvolatile semiconductor memory continues to be used in a failed state. As a result, the nonvolatile semiconductor memory is used for a long time in a normal state.

また、メモリセルアレイの行ごとに1つの読み出し単位のデータを読み出し、エラーが検出されたデータに対応する行についてはすべての読み出し単位のデータを読み出すため、不揮発性半導体メモリの診断に要する時間を短くすることができる。   In addition, data for one read unit is read for each row of the memory cell array, and all read unit data is read for the row corresponding to the data in which the error is detected, so the time required for diagnosis of the nonvolatile semiconductor memory is shortened. can do.

好ましくは、上記検査回路は、第2の指示に従って読み出されたデータのうちエラー訂正回路によってエラーが検出されなかったデータがあるとき、第2の指示に従って読み出されたデータのうちエラー訂正回路によってエラーが検出されたデータを再書き込みするように指示する第3の指示を不揮発性半導体メモリに与える。   Preferably, when there is data in which no error is detected by the error correction circuit among the data read according to the second instruction, the inspection circuit includes the error correction circuit among the data read according to the second instruction. A third instruction for giving an instruction to rewrite the data in which the error is detected is given to the nonvolatile semiconductor memory.

上記エラー訂正回路によって検出されるエラーには以下に示す(a),(b)のような種類がある。
(a)同一の行にあるメモリセルのうちの一部のメモリセルについてだけ発生するようなエラー
このようなエラーの原因としては、
・メモリセルのデータ保持特性不良により記録データが変化してしまった
・以前のデータがメモリセルに残留していたため正しく書き込めなかった
などが考えられる。このようなエラーは、再度同じデータを書き込むことによって修復することができる。
(b)同一の行にあるすべてのメモリセルについて発生するエラー
このようなエラーの原因としては、
・書き込み時の電源ダウンにより所望のデータが記録できていなかった
などが考えられる。
The errors detected by the error correction circuit include the following types (a) and (b).
(A) An error that occurs only for some of the memory cells in the same row.
・ Recording data has changed due to defective data retention characteristics of the memory cell. ・ It is possible that previous data remained in the memory cell and could not be written correctly. Such an error can be repaired by writing the same data again.
(B) An error that occurs for all memory cells in the same row.
-The desired data could not be recorded due to power-down during writing.

上記半導体集積回路装置では、第2の指示に従って読み出されたデータのうちエラー訂正回路によってエラーが検出されなかったデータがあるとき、すなわち第2の指示に従って読み出されたデータのうちの一部についてだけエラーが検出されたときは、当該エラーは上述の(a)のようなエラーであると判断される。また、当該エラーが検出されたデータについては、データを正しくは読み出せなかったけれどもエラー訂正処理によって正しいデータに訂正されたと判断される。そして第3の指示が検査回路から不揮発性半導体メモリに与えられる。第3の指示に応答して不揮発性半導体メモリは、当該エラーが検出されたデータを再書き込みする。これによりエラーが修復される。   In the semiconductor integrated circuit device, when there is data in which no error is detected by the error correction circuit among the data read according to the second instruction, that is, a part of the data read according to the second instruction When only an error is detected, it is determined that the error is an error as described in (a) above. Further, regarding the data in which the error is detected, it is determined that the data has not been correctly read but has been corrected to the correct data by the error correction process. Then, a third instruction is given from the inspection circuit to the nonvolatile semiconductor memory. In response to the third instruction, the nonvolatile semiconductor memory rewrites the data in which the error is detected. This repairs the error.

好ましくは、上記検査回路は、第2の指示に従って読み出されたデータのすべてにおいてエラー訂正回路によってエラーが検出されたとき、異常を示す信号を出力する。   Preferably, the inspection circuit outputs a signal indicating an abnormality when an error is detected by the error correction circuit in all of the data read in accordance with the second instruction.

上記半導体集積回路装置では、第2の指示に従って読み出されたデータのすべてにおいてエラー訂正回路によってエラーが検出されたとき、当該エラーは上述の(b)のようなエラーであると判断される。また、当該エラーが検出されたデータに対応する行にあるメモリセルのデータは破壊されている、すなわち修復不能であると判断される。そして異常を示す信号が出力される。これにより、メモリセルのデータが破壊された状態のままで不揮発性半導体メモリが使用され続けるような状況を防ぐことができる。   In the semiconductor integrated circuit device, when an error is detected by the error correction circuit in all the data read in accordance with the second instruction, the error is determined to be an error as described in (b) above. Further, it is determined that the data of the memory cell in the row corresponding to the data in which the error is detected is destroyed, that is, cannot be repaired. Then, a signal indicating abnormality is output. As a result, it is possible to prevent a situation in which the nonvolatile semiconductor memory continues to be used while the data in the memory cell is destroyed.

好ましくは、上記検査回路は、メモリセルアレイの領域のうち不良発生頻度が高いと予想される領域の読み出し単位のデータを読み出すように第1の指示を与える。   Preferably, the inspection circuit gives a first instruction to read out data in a reading unit in an area where a defect occurrence frequency is expected to be high in the area of the memory cell array.

上述の(b)のようなエラーに対しては、メモリセルアレイの各行から1つの読み出し単位のデータを読み出すことによって十分な診断を行うことができる。しかし上述の(a)のようなエラーの場合、当該エラーが存在する読み出し単位以外の読み出し単位のデータが第1の指示に従って読み出されることがあるため十分な診断を行うことができない。   With respect to the error as described above (b), a sufficient diagnosis can be performed by reading data of one read unit from each row of the memory cell array. However, in the case of an error as described above (a), data in a read unit other than the read unit in which the error exists may be read according to the first instruction, so that sufficient diagnosis cannot be performed.

不揮発性半導体メモリのメモリセルの特性不良にはプロセス的な要因が少なからず影響していると考えられるため、メモリセルアレイの領域のうち特性不良の発生頻度が高い領域を統計的に予想できる場合がある。上記半導体集積回路装置では、検査回路からの第1の指示に応答して不揮発性半導体メモリのメモリセルアレイの各行から不良発生頻度が高いと予想される領域にある一の読み出し単位のデータが読み出される。したがって、上述の(a)のようなエラーに対して効率的な診断を行うことができる。   Since it is considered that there are a number of process factors that influence the characteristic failure of the memory cell of the non-volatile semiconductor memory, there are cases where it is possible to statistically predict the region where the occurrence of characteristic failure is high in the memory cell array region. is there. In the semiconductor integrated circuit device, in response to the first instruction from the inspection circuit, data of one read unit in an area where the defect occurrence frequency is expected to be high is read from each row of the memory cell array of the nonvolatile semiconductor memory. . Therefore, an efficient diagnosis can be performed for the error (a) described above.

好ましくは、上記検査回路は、行ごとに異なる列に対応する読み出し単位のデータを読み出すように第1の指示を与える。   Preferably, the inspection circuit gives a first instruction to read out data in a reading unit corresponding to a different column for each row.

偶発的な要因によって生じる特性不良については、それがメモリセルアレイのどの領域で発生するかを予測するのは困難である。上記半導体集積回路装置によれば、第1の指示に従って読み出される読み出し単位がメモリセルアレイの特定の領域に偏らないようにすることができる。これにより、上述の(a)のようなエラーに対して効率的な診断を行うことができる。   It is difficult to predict in which area of the memory cell array a characteristic failure caused by an accidental factor will occur. According to the semiconductor integrated circuit device, it is possible to prevent the read unit read according to the first instruction from being biased to a specific region of the memory cell array. Thereby, an efficient diagnosis can be performed for the error as described in (a) above.

好ましくは、上記検査回路は、メモリセルアレイの一の列に対応する読み出し単位のデータを読み出すように第1の指示を与える。上記一の列は、第1の指示が与えられるたびに異なる。   Preferably, the inspection circuit gives a first instruction to read data of a read unit corresponding to one column of the memory cell array. The one column is different each time the first instruction is given.

上記半導体集積回路装置では、ある診断動作においてはメモリセルアレイの第1の列に対応する一の読み出し単位のデータが第1の指示に応答して各行から読み出される。そして次の診断動作においてはメモリセルアレイの第2の列に対応する一の読み出し単位のデータが第1の指示に応答して各行から読み出される。このように、診断動作のたびに異なる列に対応する一の読み出し単位のデータが第1の指示に応答して各行から読み出される。これにより、特性不良のメモリセルがランダムに存在したとしても、診断動作を所定の回数行う間にすべての特性不良を検知することができる。   In the semiconductor integrated circuit device, in a certain diagnostic operation, data of one read unit corresponding to the first column of the memory cell array is read from each row in response to the first instruction. In the next diagnostic operation, data of one read unit corresponding to the second column of the memory cell array is read from each row in response to the first instruction. In this way, data for one read unit corresponding to a different column is read from each row in response to the first instruction for each diagnosis operation. As a result, even if memory cells having defective characteristics are present at random, all characteristic defects can be detected during the predetermined number of diagnostic operations.

好ましくは、上記半導体集積回路装置はさらにCPUを備える。上記検査回路は、不揮発性半導体メモリの診断が終了した後に、CPUを起動させるための信号をCPUに与える。   Preferably, the semiconductor integrated circuit device further includes a CPU. The inspection circuit gives a signal for starting the CPU to the CPU after the diagnosis of the nonvolatile semiconductor memory is completed.

診断プログラムがROMに格納されており、CPUが起動した後に当該診断プログラムをROMから読み出して不揮発性半導体メモリの診断を行うような場合、CPUの動作を解析することによって不揮発性半導体メモリへのアクセス手順が解析される可能性がある。しかし上記半導体集積回路装置では、CPUが動作を停止している間に検査回路によって不揮発性半導体メモリの診断が行われる。したがって不揮発性半導体メモリへのアクセス手順が解析されにくい。また、診断に要する時間が短いため、不揮発性半導体メモリの診断を行っているということ自体も解析されにくい。   When a diagnostic program is stored in the ROM and the diagnostic program is read from the ROM and the nonvolatile semiconductor memory is diagnosed after the CPU is started, the access to the nonvolatile semiconductor memory is performed by analyzing the operation of the CPU. The procedure may be analyzed. However, in the semiconductor integrated circuit device, the nonvolatile semiconductor memory is diagnosed by the inspection circuit while the CPU stops operating. Therefore, it is difficult to analyze the access procedure to the nonvolatile semiconductor memory. Moreover, since the time required for diagnosis is short, it is difficult to analyze that the nonvolatile semiconductor memory is being diagnosed.

好ましくは、上記検査回路は、第2の指示に従って読み出されたデータのすべてにおいてエラー訂正回路によってエラーが検出されたとき、異常を示す信号をCPUに与える。   Preferably, the inspection circuit gives a signal indicating abnormality to the CPU when an error is detected by the error correction circuit in all of the data read in accordance with the second instruction.

上記半導体集積回路装置では、第2の指示に従って読み出されたデータのすべてにおいてエラー訂正回路によってエラーが検出されたとき、当該エラーは上述の(b)のようなエラーであると判断される。また、当該エラーが検出されたデータに対応する行にあるメモリセルのデータは破壊されている、すなわち修復不能であると判断される。そして異常を示す信号が検査回路からCPUに与えられる。これによりCPUは、不揮発性半導体メモリが故障しているということを、起動して処理を始める前の段階で認識することができる。   In the semiconductor integrated circuit device, when an error is detected by the error correction circuit in all the data read in accordance with the second instruction, the error is determined to be an error as described in (b) above. Further, it is determined that the data of the memory cell in the row corresponding to the data in which the error is detected is destroyed, that is, cannot be repaired. Then, a signal indicating abnormality is given from the inspection circuit to the CPU. As a result, the CPU can recognize that the nonvolatile semiconductor memory has failed at the stage before starting and starting the processing.

好ましくは、上記CPUは、検査回路からの異常を示す信号に応答して起動を停止する。   Preferably, the CPU stops activation in response to a signal indicating an abnormality from the inspection circuit.

上記半導体集積回路装置によれば、不揮発性半導体メモリが故障した状態のままでCPUが処理を進めるという状況を防ぐことができる。   According to the semiconductor integrated circuit device, it is possible to prevent a situation in which the CPU proceeds with processing while the nonvolatile semiconductor memory is in a failed state.

この発明のもう1つの局面に従うと、ICカードは上記半導体集積回路装置を備える。   According to another aspect of the present invention, an IC card includes the semiconductor integrated circuit device.

この発明のさらにもう1つの局面に従うと、検査装置は、不揮発性半導体メモリを診断する装置である。上記不揮発性半導体メモリは、メモリセルアレイと、エラー訂正回路とを含む。メモリセルアレイは、行および列に複数の読み出し単位に分割される。エラー訂正回路は、複数の読み出し単位の各々に書き込むべきデータのエラー訂正符号化を行い、複数の読み出し単位の各々から読み出されたデータのエラー検出およびエラー訂正を行う。上記検査装置は、メモリセルアレイの各行から一の読み出し単位のデータを読み出すように指示する第1の指示を不揮発性半導体メモリに与える。第1の指示に従って読み出されたデータのエラーがエラー訂正回路によって検出されると上記検査装置は、当該エラーが検出されたデータに対応する行のすべての読み出し単位のデータを読み出すように指示する第2の指示を不揮発性半導体メモリに与える。   According to yet another aspect of the present invention, the inspection device is a device for diagnosing a nonvolatile semiconductor memory. The nonvolatile semiconductor memory includes a memory cell array and an error correction circuit. The memory cell array is divided into a plurality of read units in rows and columns. The error correction circuit performs error correction encoding of data to be written in each of the plurality of read units, and performs error detection and error correction of data read from each of the plurality of read units. The inspection apparatus gives a first instruction to the nonvolatile semiconductor memory to instruct to read one read unit of data from each row of the memory cell array. When an error in the data read in accordance with the first instruction is detected by the error correction circuit, the inspection apparatus instructs to read out data in all read units in the row corresponding to the data in which the error is detected. A second instruction is given to the nonvolatile semiconductor memory.

この発明のさらにもう1つの局面に従うと、半導体集積回路装置は、不揮発性半導体メモリと、キャッシュメモリと、アドレス記憶部と、アクセス制御部とを備える。アドレス記憶部は、不揮発性半導体メモリのアドレスを少なくとも1つ記憶する。アクセス制御部は、不揮発性半導体メモリへの書き込みアドレスとアドレス記憶部に記憶されたアドレスのいずれか1つとが一致するとき、当該書き込みアドレスに対応する書き込みデータをキャッシュメモリに書き込む。   According to still another aspect of the present invention, a semiconductor integrated circuit device includes a nonvolatile semiconductor memory, a cache memory, an address storage unit, and an access control unit. The address storage unit stores at least one address of the nonvolatile semiconductor memory. The access control unit writes the write data corresponding to the write address to the cache memory when the write address to the nonvolatile semiconductor memory matches any one of the addresses stored in the address storage unit.

通常、不揮発性半導体メモリには書き込み回数に上限がある。書き込み回数がこの上限に近づくと書き込みエラーなどの故障が生じる可能性が高くなる。上記半導体集積回路装置では、不揮発性半導体メモリの所定のアドレスがアドレス記憶部にあらかじめ格納される。そして不揮発性半導体メモリへの書き込みアクセスがあると、書き込みアドレスとアドレス記憶部に記憶されたアドレスとが比較される。アドレス記憶部に記憶されたアドレスのうちいずれか1つと書き込みアドレスとが一致するとき、当該書き込みアドレスに対応する書き込みデータはキャッシュメモリに書き込まれる。これにより、不揮発性半導体メモリへの書き込み回数を少なくすることができる。この結果、不揮発性半導体メモリが正常な状態で長期間使用されることになる。   Usually, the nonvolatile semiconductor memory has an upper limit on the number of times of writing. When the number of times of writing approaches this upper limit, there is a high possibility that a failure such as a writing error will occur. In the semiconductor integrated circuit device, a predetermined address of the nonvolatile semiconductor memory is stored in advance in the address storage unit. When there is a write access to the nonvolatile semiconductor memory, the write address is compared with the address stored in the address storage unit. When any one of the addresses stored in the address storage unit matches the write address, the write data corresponding to the write address is written into the cache memory. Thereby, the number of times of writing to the nonvolatile semiconductor memory can be reduced. As a result, the nonvolatile semiconductor memory is used for a long time in a normal state.

また一般に、キャッシュにヒットしやすいアドレス(たとえば最新のアドレスや何回もアクセスがあったアドレスなど)をプログラム実行中に精度よく抽出する(アドレス置換メカニズム)ためにはキャッシュメモリの資源を大量に必要とする。上記半導体集積回路装置ではアドレス記憶部を設けたため、キャッシュにヒットしやすいアドレスをあらかじめアドレス記憶部に記憶させておくことができる。これにより、アドレス記憶部を設けない場合に比べて少ない資源で不揮発性半導体メモリへの書き込み回数を少なくすることができる。   In general, a large amount of cache memory resources are required to accurately extract addresses that are likely to hit the cache (for example, the latest addresses or addresses that have been accessed many times) during program execution (address replacement mechanism). And Since the semiconductor integrated circuit device is provided with the address storage unit, an address that is likely to hit the cache can be stored in the address storage unit in advance. As a result, the number of times of writing to the nonvolatile semiconductor memory can be reduced with fewer resources than when no address storage unit is provided.

好ましくは、上記アクセス制御部は、アドレス記憶部に記憶されるアドレスを不揮発性半導体メモリへの書き込みアクセスの状況に応じて変更する。   Preferably, the access control unit changes the address stored in the address storage unit according to the status of write access to the nonvolatile semiconductor memory.

好ましくは、上記アドレス記憶部は、上記不揮発性半導体メモリのアドレスを記憶する第1および第2の領域を含む。上記アクセス制御部は、アドレス記憶部の第2の領域に記憶されるアドレスを不揮発性半導体メモリへの書き込みアクセスの状況に応じて変更する。   Preferably, the address storage unit includes first and second areas for storing addresses of the nonvolatile semiconductor memory. The access control unit changes the address stored in the second area of the address storage unit according to the status of write access to the nonvolatile semiconductor memory.

好ましくは、上記アクセス制御部は、アドレス記憶部に記憶されたアドレスをキャッシュメモリへ書き込む。そして上記アクセス制御部は、不揮発性半導体メモリへの書き込みアドレスとキャッシュメモリに記憶されたアドレスのいずれか1つとが一致するとき、当該書き込みアドレスに対応する書き込みデータをキャッシュメモリに書き込む。   Preferably, the access control unit writes the address stored in the address storage unit to the cache memory. The access control unit writes the write data corresponding to the write address to the cache memory when the write address to the nonvolatile semiconductor memory matches one of the addresses stored in the cache memory.

好ましくは、上記アクセス制御部は、キャッシュメモリに記憶されるアドレスを不揮発性半導体メモリへの書き込みアクセスの状況に応じて変更し、変更後のアドレスをアドレス記憶部に書き込む。   Preferably, the access control unit changes the address stored in the cache memory according to the status of write access to the nonvolatile semiconductor memory, and writes the changed address in the address storage unit.

好ましくは、上記アドレス記憶部は、上記不揮発性半導体メモリのアドレスを記憶する第1および第2の領域を含む。上記キャッシュメモリは、第3の領域と第4の領域とを含む。上記アクセス制御部は、アドレス記憶部の第1の領域に記憶されたアドレスをキャッシュメモリの第3の領域へ書き込み、アドレス記憶部の第2の領域に記憶されたアドレスをキャッシュメモリの第4の領域へ書き込む。そして上記アクセス制御部は、キャッシュメモリの第4の領域に記憶されるアドレスを不揮発性半導体メモリへの書き込みアクセスの状況に応じて変更し、変更後のアドレスをアドレス記憶部の第2の領域に書き込む。   Preferably, the address storage unit includes first and second areas for storing addresses of the nonvolatile semiconductor memory. The cache memory includes a third area and a fourth area. The access control unit writes the address stored in the first area of the address storage unit to the third area of the cache memory, and writes the address stored in the second area of the address storage unit to the fourth area of the cache memory. Write to the area. The access control unit changes the address stored in the fourth area of the cache memory according to the status of the write access to the nonvolatile semiconductor memory, and the changed address is stored in the second area of the address storage unit. Write.

この発明のさらにもう1つの局面に従うと、ICカードは上記半導体集積回路装置を備える。   According to yet another aspect of the present invention, an IC card includes the semiconductor integrated circuit device.

以下、この発明の実施の形態を図面を参照して詳しく説明する。なお、図中同一または相当部分には同一の符号を付しその説明は繰り返さない。   Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. In the drawings, the same or corresponding parts are denoted by the same reference numerals, and description thereof will not be repeated.

(第1の実施形態)
<ICカードの構成>
図1は、この発明の第1の実施形態によるICカードの構成を示すブロック図である。図1に示すICカードは非接触型のICカードであって、アンテナコイル10と、LSIチップ1とを備える。
(First embodiment)
<Configuration of IC card>
FIG. 1 is a block diagram showing the configuration of an IC card according to the first embodiment of the present invention. The IC card shown in FIG. 1 is a non-contact type IC card, and includes an antenna coil 10 and an LSI chip 1.

アンテナコイル10は、リーダライタ(図示せず)との間でデータの送受信を非接触で行いかつリーダライタから非接触で電力の供給を受ける。   The antenna coil 10 transmits / receives data to / from a reader / writer (not shown) in a contactless manner and receives power from the reader / writer in a contactless manner.

LSIチップ1は、インターフェース回路20と、検査回路30と、CPU40と、セレクタ50と、不揮発性半導体メモリ60とを含む。   The LSI chip 1 includes an interface circuit 20, an inspection circuit 30, a CPU 40, a selector 50, and a nonvolatile semiconductor memory 60.

インターフェース回路20は、アンテナコイル10によって受信された電力を各部に供給する。またインターフェース回路20は、動作の基準となるクロックを各部に供給する。またインターフェース回路20は、リーダライタへ送信すべきデータをアンテナコイル10に伝送し、アンテナコイル10によって受信されたデータを所定の回路に伝送する。またインターフェース回路20は、アンテナコイル10によって受信された電力に応じたリセット信号RST1を検査回路30に与える。アンテナコイル10によって受信された電力が所定のレベルよりも少ないときインターフェース回路20はLレベル(論理ローレベル)のリセット信号RST1を検査回路30に与える。アンテナコイル10によって受信された電力が所定のレベル以上のときインターフェース回路20はHレベル(論理ハイレベル)のリセット信号RST1を検査回路30に与える。   The interface circuit 20 supplies the power received by the antenna coil 10 to each unit. Further, the interface circuit 20 supplies a clock serving as an operation reference to each unit. The interface circuit 20 transmits data to be transmitted to the reader / writer to the antenna coil 10 and transmits data received by the antenna coil 10 to a predetermined circuit. Further, the interface circuit 20 gives a reset signal RST1 corresponding to the power received by the antenna coil 10 to the inspection circuit 30. When the power received by the antenna coil 10 is less than a predetermined level, the interface circuit 20 supplies the L level (logic low level) reset signal RST1 to the test circuit 30. When the electric power received by the antenna coil 10 is equal to or higher than a predetermined level, the interface circuit 20 supplies an H level (logic high level) reset signal RST1 to the inspection circuit 30.

検査回路30は不揮発性半導体メモリ60を診断する。検査回路30は、制御部31と、データ処理部32と、アドレス発生部33とを含む。制御部31は、インターフェース回路20からのリセット信号RST1がLレベルからHレベルへ切り替わるのに応答してデータ処理部32およびアドレス発生部33に不揮発性半導体メモリ60の診断の開始を指示する。不揮発性半導体メモリ60の診断動作において制御部31はデータ処理部32およびアドレス発生部33を制御する。制御部31は、不揮発性半導体メモリ60からのエラー訂正情報に応じた指示をデータ処理部32およびアドレス発生部33に与える。また制御部31は、データの読み出し/書き込みを指示する制御信号をセレクタ50を介して不揮発性半導体メモリ60に与える。不揮発性半導体メモリ60の診断が終了すると制御部31はHレベルのリセット信号RST2をCPU40およびセレクタ50に与え、不揮発性半導体メモリ60の診断結果をCPU40に与える。データ処理部32は、セレクタ50を介して不揮発性半導体メモリ60との間でデータのやりとりをする。アドレス発生部33は、読み出し/書き込みアドレスをセレクタ50を介して不揮発性半導体メモリ60に与える。   The inspection circuit 30 diagnoses the nonvolatile semiconductor memory 60. The inspection circuit 30 includes a control unit 31, a data processing unit 32, and an address generation unit 33. The control unit 31 instructs the data processing unit 32 and the address generation unit 33 to start diagnosis of the nonvolatile semiconductor memory 60 in response to the reset signal RST1 from the interface circuit 20 being switched from the L level to the H level. In the diagnostic operation of the nonvolatile semiconductor memory 60, the control unit 31 controls the data processing unit 32 and the address generation unit 33. The control unit 31 gives an instruction corresponding to the error correction information from the nonvolatile semiconductor memory 60 to the data processing unit 32 and the address generation unit 33. Further, the control unit 31 gives a control signal for instructing reading / writing of data to the nonvolatile semiconductor memory 60 via the selector 50. When the diagnosis of the nonvolatile semiconductor memory 60 is completed, the control unit 31 gives an H level reset signal RST2 to the CPU 40 and the selector 50, and gives the diagnosis result of the nonvolatile semiconductor memory 60 to the CPU 40. The data processing unit 32 exchanges data with the nonvolatile semiconductor memory 60 via the selector 50. The address generator 33 gives the read / write address to the nonvolatile semiconductor memory 60 via the selector 50.

CPU40は、検査回路30の制御部31からのリセット信号RST2がLレベルからHレベルに切り替わるのに応答して起動する。CPU40は、制御部31からの診断結果に応じた処理を行う。CPU40は、制御信号およびアドレスをセレクタ50を介して不揮発性半導体メモリ60に与え、セレクタ50を介して不揮発性半導体メモリ60との間でデータをやりとりする。   The CPU 40 is activated in response to the reset signal RST2 from the control unit 31 of the inspection circuit 30 being switched from the L level to the H level. The CPU 40 performs processing according to the diagnosis result from the control unit 31. The CPU 40 gives a control signal and an address to the nonvolatile semiconductor memory 60 via the selector 50, and exchanges data with the nonvolatile semiconductor memory 60 via the selector 50.

セレクタ50は、検査回路30の制御部31からのリセット信号RST2に応じて検査回路30と不揮発性半導体メモリ60との間またはCPU40と不揮発性半導体メモリ60との間で制御信号・アドレス・データのやりとりができるようにパスを切り替える。リセット信号RST2がLレベルのときセレクタ50は検査回路30と不揮発性半導体メモリ60との間で制御信号・アドレス・データのやりとりができるようにパスを形成する。リセット信号RST2がHレベルのときセレクタ50はCPU40と不揮発性半導体メモリ60との間で制御信号・アドレス・データのやりとりができるようにパスを形成する。   The selector 50 receives control signals, addresses, and data between the inspection circuit 30 and the nonvolatile semiconductor memory 60 or between the CPU 40 and the nonvolatile semiconductor memory 60 in accordance with the reset signal RST2 from the control unit 31 of the inspection circuit 30. Switch paths so that you can communicate. When the reset signal RST2 is at the L level, the selector 50 forms a path so that control signals, addresses, and data can be exchanged between the inspection circuit 30 and the nonvolatile semiconductor memory 60. When the reset signal RST2 is at the H level, the selector 50 forms a path so that control signals, addresses, and data can be exchanged between the CPU 40 and the nonvolatile semiconductor memory 60.

不揮発性半導体メモリ60はエラー訂正機能を有し、読み出し単位ごとのエラーの有無を示すエラー訂正情報を検査回路30の制御部31に与える。不揮発性半導体メモリ60としては、EEPROM・フラッシュメモリ・FeRAMなどを用いることができる。   The nonvolatile semiconductor memory 60 has an error correction function, and provides error correction information indicating the presence or absence of an error for each reading unit to the control unit 31 of the inspection circuit 30. As the nonvolatile semiconductor memory 60, EEPROM, flash memory, FeRAM, or the like can be used.

<不揮発性半導体メモリ60の構成>
図2は、図1に示した不揮発性半導体メモリ60の内部構成を示すブロック図である。図2を参照して、不揮発性半導体メモリ60は、メモリセルアレイ61と、アドレスデコーダ62と、行デコーダ63と、列デコーダ64と、エラー訂正回路65と、入出力バッファ66とを含む。
<Configuration of Nonvolatile Semiconductor Memory 60>
FIG. 2 is a block diagram showing an internal configuration of the nonvolatile semiconductor memory 60 shown in FIG. Referring to FIG. 2, nonvolatile semiconductor memory 60 includes a memory cell array 61, an address decoder 62, a row decoder 63, a column decoder 64, an error correction circuit 65, and an input / output buffer 66.

メモリセルアレイ61は、行(X1−X16)および列(Y1−Y16)に複数(16×16個)の読み出し単位に分割される。各読み出し単位にはデータ(32ビット)およびエラー訂正用データ(6ビット)が格納される。なお、図2のメモリセルアレイ61において各読み出し単位を表すブロックの中の数字(16進表示)は、当該読み出し単位を指定するためにアドレスデコーダ62に与えられるアドレスを示している。   The memory cell array 61 is divided into a plurality of (16 × 16) read units in rows (X1-X16) and columns (Y1-Y16). Data (32 bits) and error correction data (6 bits) are stored in each reading unit. In the memory cell array 61 of FIG. 2, the numbers (hexadecimal display) in the blocks representing the respective read units indicate addresses given to the address decoder 62 for designating the read units.

アドレスデコーダ62は、セレクタ50からの制御信号およびアドレスに従った読み出し単位を指定するための行アドレスおよび列アドレスを行デコーダ63および列デコーダ64に与える。行デコーダ63は、アドレスデコーダ62からの行アドレスに応答して対応する行を選択する。列デコーダ64は、アドレスデコーダ62からの列アドレスに応答して対応する列を選択する。   The address decoder 62 gives a row address and a column address for designating a read unit according to the control signal from the selector 50 and the address to the row decoder 63 and the column decoder 64. The row decoder 63 selects a corresponding row in response to the row address from the address decoder 62. The column decoder 64 selects a corresponding column in response to the column address from the address decoder 62.

入出力バッファ66は、書き込みデータおよび読み出しデータを一時的に蓄積する。   The input / output buffer 66 temporarily stores write data and read data.

エラー訂正回路65は、行デコーダ63および列デコーダ64によって指定された読み出し単位の各々への書き込みデータ(32ビット)にエラー訂正用ビット(6ビット)を付加する。エラー訂正用ビットが付加された書き込みデータが各読み出し単位に書き込まれる。1つの行に対応するすべての読み出し単位(16個)に同時に書き込みが行われる(1ライン同時書き込み)。読み出し動作時には、行デコーダ63および列デコーダ64によって指定された読み出し単位からデータ(32ビット)およびエラー訂正用ビット(6ビット)が読み出される。エラー訂正回路65は、図3に示すように、読み出されたデータ(32ビット)に対してエラー訂正用ビットを用いてエラー訂正処理を行う。ただし通常、エラーを訂正することができるビット数には限度があり、この限度を越えてエラーが発生した場合には訂正処理後のデータの正しさは保証されない。エラー訂正回路65は、エラー訂正処理後のデータ(32ビット)とエラー訂正処理前のデータ(32ビット)とが一致するときはLレベルのエラー訂正情報を出力し、一致しないときはHレベルのエラー訂正情報を出力する。Hレベルのエラー訂正情報は、読み出されたデータにエラーが検出されたことを示す。Lレベルのエラー訂正情報は、読み出されたデータにエラーが検出されなかったことを示す。   The error correction circuit 65 adds an error correction bit (6 bits) to write data (32 bits) to each read unit designated by the row decoder 63 and the column decoder 64. Write data to which an error correction bit is added is written in each read unit. Writing is performed simultaneously on all the reading units (16) corresponding to one row (one line simultaneous writing). During the read operation, data (32 bits) and error correction bits (6 bits) are read from the read unit designated by the row decoder 63 and the column decoder 64. As shown in FIG. 3, the error correction circuit 65 performs error correction processing on the read data (32 bits) using error correction bits. However, normally, there is a limit to the number of bits that can correct an error, and if an error occurs exceeding this limit, the correctness of the data after correction processing is not guaranteed. The error correction circuit 65 outputs L level error correction information when the data after error correction processing (32 bits) and the data before error correction processing (32 bits) match, and when they do not match, the error correction circuit 65 outputs an H level error correction information. Output error correction information. The H level error correction information indicates that an error has been detected in the read data. The L level error correction information indicates that no error has been detected in the read data.

<不揮発性半導体メモリ60の診断>
次に、図1に示したICカードの動作について図4を参照しつつ説明する。
<Diagnosis of nonvolatile semiconductor memory 60>
Next, the operation of the IC card shown in FIG. 1 will be described with reference to FIG.

時刻t1以前においてはICカードとリーダライタとの距離が離れているためリーダライタからICカードに十分な電力が供給されない。このときインターフェース回路20から検査回路30に与えられるリセット信号RST1はLレベルのままである。リセット信号RST1がLレベルのとき検査回路30は動作停止状態(リセット状態)となる。またCPU40およびセレクタ50に与えられるリセット信号RST2もLレベルのままである。リセット信号RST2がLレベルのときCPU40は動作停止状態(リセット状態)となる。   Before time t1, the IC card and the reader / writer are separated from each other, so that sufficient power is not supplied from the reader / writer to the IC card. At this time, the reset signal RST1 provided from the interface circuit 20 to the inspection circuit 30 remains at the L level. When the reset signal RST1 is at the L level, the inspection circuit 30 enters an operation stop state (reset state). Further, the reset signal RST2 applied to the CPU 40 and the selector 50 remains at the L level. When the reset signal RST2 is at L level, the CPU 40 enters an operation stop state (reset state).

リーダライタにICカードが近づけられ、リーダライタからICカードに供給される電力が時刻t1において所定のレベルに達する。これに応答してインターフェース回路20はリセット信号RST1をLレベルからHレベルに切り替える。リセット信号RST1がLレベルからHレベルに切り替わると検査回路30は不揮発性半導体メモリ60の診断を開始する。一方、リセット信号RST2はLレベルのままでありCPU40は動作停止状態(リセット状態)のままである。以下、検査回路30による不揮発性半導体メモリ60の診断動作について図5を参照しつつ説明する。   The IC card is brought close to the reader / writer, and the power supplied from the reader / writer to the IC card reaches a predetermined level at time t1. In response to this, the interface circuit 20 switches the reset signal RST1 from L level to H level. When the reset signal RST1 switches from the L level to the H level, the inspection circuit 30 starts diagnosis of the nonvolatile semiconductor memory 60. On the other hand, the reset signal RST2 remains at the L level, and the CPU 40 remains in the operation stop state (reset state). Hereinafter, the diagnostic operation of the nonvolatile semiconductor memory 60 by the inspection circuit 30 will be described with reference to FIG.

[ステップST501]
まず、検査回路30の制御部31は、メモリセルアレイ61の列Y1−Y16のうちいずれか1つを選択する。図6(a)に示すように、ここでは列Y2が選択されるものとする。次に制御部31は、メモリセルアレイ61の各行X1−X16の列Y2に対応する読み出し単位を指定するアドレスを与えるようにアドレス発生部33に指示する。そしてステップST502にすすむ。
[Step ST501]
First, the control unit 31 of the inspection circuit 30 selects any one of the columns Y1 to Y16 of the memory cell array 61. As shown in FIG. 6A, column Y2 is selected here. Next, the control unit 31 instructs the address generation unit 33 to give an address designating a read unit corresponding to the column Y2 of each row X1-X16 of the memory cell array 61. Then, the process proceeds to step ST502.

[ステップST502]
図6(b)に示すように、制御部31からの指示に応答してアドレス発生部33は、メモリセルアレイ61の行X1および列Y2に対応する読み出し単位を指定するアドレス4(16進数)を出力する。制御部31は、読み出しを指示する制御信号を出力する。制御部31からの制御信号およびアドレス発生部33からのアドレス4は、セレクタ50を介して不揮発性半導体メモリ60のアドレスデコーダ62に与えられる。これに応答してアドレスデコーダ61は、行X1に対応する行アドレスを行デコーダ63に与え、列Y2に対応する列アドレスを列デコーダ64に与える。アドレスデコーダ61からの行アドレスに応答して行デコーダ63はメモリセル61の行X1を選択する。アドレスデコーダ61からの列アドレスに応答して列デコーダ64は列Y2を選択する。そして図6(b)に示すように、行X1および列Y2に対応する読み出し単位のデータD(4)が読み出される。そしてステップST503にすすむ。
[Step ST502]
As shown in FIG. 6B, in response to an instruction from the control unit 31, the address generation unit 33 sets an address 4 (hexadecimal number) that specifies a read unit corresponding to the row X1 and the column Y2 of the memory cell array 61. Output. The control unit 31 outputs a control signal that instructs reading. The control signal from the control unit 31 and the address 4 from the address generation unit 33 are given to the address decoder 62 of the nonvolatile semiconductor memory 60 via the selector 50. In response to this, the address decoder 61 gives a row address corresponding to the row X1 to the row decoder 63, and gives a column address corresponding to the column Y2 to the column decoder 64. In response to the row address from the address decoder 61, the row decoder 63 selects the row X1 of the memory cell 61. In response to the column address from the address decoder 61, the column decoder 64 selects the column Y2. Then, as shown in FIG. 6B, the data D (4) of the read unit corresponding to the row X1 and the column Y2 is read. Then, the process proceeds to step ST503.

[ステップST503]
エラー訂正回路65は、ステップST502において読み出されたデータD(4)のエラー検出およびエラー訂正処理を行う。読み出しデータD(4)にエラーが検出されなかったときエラー訂正回路65はLレベルのエラー訂正情報を出力する。読み出しデータD(4)にエラーが検出されたときエラー訂正回路65はHレベルのエラー訂正情報を出力する。制御部31は、エラー訂正回路65からのエラー訂正情報がHレベルであるかLレベルであるかを判断する。Hレベルであると判断されたときはステップST507にすすみ、Lレベルであると判断されたときはステップST504にすすむ。ここでは読み出しデータD(4)にエラーが検出されなかったものとする。エラー訂正回路65は、図6(b)に示すようにLレベルのエラー訂正情報を検査回路30の制御部31に出力する。そしてステップST504にすすむ。
[Step ST503]
The error correction circuit 65 performs error detection and error correction processing on the data D (4) read in step ST502. When no error is detected in the read data D (4), the error correction circuit 65 outputs L level error correction information. When an error is detected in the read data D (4), the error correction circuit 65 outputs H level error correction information. The control unit 31 determines whether the error correction information from the error correction circuit 65 is at the H level or the L level. When it is determined that the level is H, the process proceeds to step ST507, and when it is determined that the level is L, the process proceeds to step ST504. Here, it is assumed that no error is detected in the read data D (4). The error correction circuit 65 outputs L level error correction information to the control unit 31 of the inspection circuit 30 as shown in FIG. Then, the process proceeds to step ST504.

[ステップST504]
アドレス発生部33は、前回のアドレス4に40(16進数)を加算する。加算の結果得られるアドレス44は、図6(a)に示すように、メモリセルアレイ61の前回の行X1の次の行X2の列Y2に対応する読み出し単位を指定するアドレスである。そしてステップST505にすすむ。
[Step ST504]
The address generation unit 33 adds 40 (hexadecimal number) to the previous address 4. The address 44 obtained as a result of the addition is an address that designates a read unit corresponding to the column Y2 of the next row X2 of the previous row X1 of the memory cell array 61, as shown in FIG. Then, the process proceeds to step ST505.

[ステップST505]
制御部31は、ステップST504において得られたアドレスが最終アドレス(ここでは3FC)を超えているか否かを判断する。超えていると判断されたときはステップST506にすすみ、超えていないと判断されたときはステップST502にもどる。ここでは、ステップST504において得られたアドレス44は最終アドレス3FCを超えていないためステップST502にもどる。そしてステップST502においてアドレス発生部33は、メモリセル61の行X2および列Y2に対応する読み出し単位を指定するアドレス44を出力する。制御部31は、読み出しを指示する制御信号を出力する。
[Step ST505]
The control unit 31 determines whether or not the address obtained in step ST504 exceeds the final address (3FC in this case). When it is determined that it has exceeded, the process proceeds to step ST506, and when it is determined that it does not exceed, the process returns to step ST502. Here, since the address 44 obtained in step ST504 does not exceed the final address 3FC, the process returns to step ST502. In step ST502, the address generation unit 33 outputs an address 44 that specifies a read unit corresponding to the row X2 and the column Y2 of the memory cell 61. The control unit 31 outputs a control signal that instructs reading.

通常、不揮発性半導体メモリ60への書き込みは行単位で行われる。したがって、書き込み時にエラーが発生した場合には行X1にあるすべてのメモリセルにエラーが発生している可能性が高い。ゆえに、エラー訂正回路65によってエラーが検出されなかったとき、すなわちエラー訂正情報がLレベルのときは、読み出しデータD(4)に対応する行X1のすべてのメモリセルに正しくデータが書き込まれていると判断し、次の行X2から1つの読み出し単位のデータを読み出すようにしている。そして、行X2および列Y2に対応する読み出し単位からの読み出しデータD(44)に対して同様にエラー検出およびエラー訂正処理が行われる。   Normally, writing to the nonvolatile semiconductor memory 60 is performed in units of rows. Therefore, if an error occurs during writing, there is a high possibility that an error has occurred in all the memory cells in row X1. Therefore, when no error is detected by the error correction circuit 65, that is, when the error correction information is at the L level, data is correctly written in all the memory cells in the row X1 corresponding to the read data D (4). Therefore, one read unit of data is read from the next row X2. Then, error detection and error correction processing is similarly performed on the read data D (44) from the read unit corresponding to the row X2 and the column Y2.

これ以降、エラー訂正情報がHレベルであると判断されるまでステップST502−ST505における処理が繰り返される(図5および図6の符号A)。すなわち、メモリセルアレイ61の各行X2−X16から列Y2に対応する読み出し単位のデータが読み出され、エラー検出およびエラー訂正処理が行われる。   Thereafter, the processes in steps ST502 to ST505 are repeated until it is determined that the error correction information is at the H level (reference A in FIGS. 5 and 6). That is, data in a read unit corresponding to the column Y2 is read from each row X2-X16 of the memory cell array 61, and error detection and error correction processing are performed.

ここでは図6(b)に示すように、行X16および列Y2に対応する読み出し単位からの読み出しデータD(3C4)においてエラーが検出され、Hレベルのエラー訂正情報が出力される。そしてステップST507にすすむ。   Here, as shown in FIG. 6B, an error is detected in the read data D (3C4) from the read unit corresponding to the row X16 and the column Y2, and error correction information of H level is output. Then, the process proceeds to step ST507.

[ステップST507]
検査回路30の制御部31は、行X16および列Y2に対応する読み出し単位からのエラー訂正処理後の読み出しデータD(3C4)、当該読み出し単位に対応する列Y2を示すアドレス4、および当該読み出し単位に対応するエラー訂正情報Hを記憶するようにデータ処理部32に指示を与える。制御部31からの指示に応答してデータ処理部32はこれらを記憶する。
[Step ST507]
The control unit 31 of the inspection circuit 30 includes the read data D (3C4) after the error correction processing from the read unit corresponding to the row X16 and the column Y2, the address 4 indicating the column Y2 corresponding to the read unit, and the read unit The data processing unit 32 is instructed to store the error correction information H corresponding to. In response to an instruction from the control unit 31, the data processing unit 32 stores them.

アドレス発生部33は、前回のアドレス3C4に4を加算する。加算の結果得られるアドレス3C8は、図6(a)に示すように、エラーが検出された読み出し単位に対応する行X16上の当該読み出し単位に対応する列Y2の次の列Y3に対応する読み出し単位を指定するアドレスである。そしてステップST508にすすむ。   The address generation unit 33 adds 4 to the previous address 3C4. As shown in FIG. 6A, the address 3C8 obtained as a result of the addition is read corresponding to the column Y3 next to the column Y2 corresponding to the read unit on the row X16 corresponding to the read unit where the error is detected. This is an address that specifies the unit. Then, the process proceeds to step ST508.

[ステップST508]
アドレス発生部33は、メモリセルアレイ61の行X16および列Y3に対応する読み出し単位を指定するアドレス3C8を出力する。制御部31は、読み出しを指示する制御信号を出力する。制御部31からの制御信号およびアドレス発生部33からのアドレス3C8は、セレクタ50を介して不揮発性半導体メモリ60のアドレスデコーダ62に与えられる。これに応答してアドレスデコーダ61は、行X16に対応する行アドレスを行デコーダ63に与え、列Y3に対応する列アドレスを列デコーダ64に与える。アドレスデコーダ61からの行アドレスに応答して行デコーダ63はメモリセル61の行X16を選択する。アドレスデコーダ61からの列アドレスに応答して列デコーダ64は列Y3を選択する。そして図6(b)に示すように、行X16および列Y3に対応する読み出し単位のデータD(3C8)が読み出される。エラー訂正回路65は、読み出されたデータD(3C8)のエラー検出およびエラー訂正処理を行う。そしてステップST509にすすむ。
[Step ST508]
The address generator 33 outputs an address 3C8 that designates a read unit corresponding to the row X16 and the column Y3 of the memory cell array 61. The control unit 31 outputs a control signal that instructs reading. The control signal from the control unit 31 and the address 3C8 from the address generation unit 33 are given to the address decoder 62 of the nonvolatile semiconductor memory 60 via the selector 50. In response to this, the address decoder 61 gives a row address corresponding to the row X16 to the row decoder 63, and gives a column address corresponding to the column Y3 to the column decoder 64. In response to the row address from the address decoder 61, the row decoder 63 selects the row X16 of the memory cell 61. In response to the column address from the address decoder 61, the column decoder 64 selects the column Y3. Then, as shown in FIG. 6B, data D (3C8) of the read unit corresponding to the row X16 and the column Y3 is read. The error correction circuit 65 performs error detection and error correction processing on the read data D (3C8). Then, the process proceeds to step ST509.

[ステップST509]
検査回路30の制御部31は、行X16および列Y3に対応する読み出し単位からのエラー訂正処理後の読み出しデータD(3C8)、当該読み出し単位に対応する列Y3を示すアドレス8、および当該読み出し単位に対応するエラー訂正情報を記憶するようにデータ処理部32に指示を与える。制御部31からの指示に応答してデータ処理部32はこれらを記憶する。そしてステップST507にもどる。これ以降、ステップST507−ST509における処理が15回繰り返される(図5および図6の符号B)。この結果、ステップST503においてエラーが検出された行X16にあるすべての読み出し単位のデータD(3C0)−D(3FC)が読み出される。読み出されたデータD(3C0)−D(3FC)は、図7に示すように、対応する列Y1−Y16を示すアドレス0−3Cおよび対応するエラー訂正情報と関連づけられてデータ処理部32に記憶される。
[Step ST509]
The control unit 31 of the inspection circuit 30 includes the read data D (3C8) after error correction processing from the read unit corresponding to the row X16 and the column Y3, the address 8 indicating the column Y3 corresponding to the read unit, and the read unit The data processing unit 32 is instructed to store the error correction information corresponding to. In response to an instruction from the control unit 31, the data processing unit 32 stores them. Then, the process returns to step ST507. Thereafter, the processes in steps ST507 to ST509 are repeated 15 times (reference B in FIGS. 5 and 6). As a result, data D (3C0) -D (3FC) of all read units in the row X16 where the error is detected in step ST503 is read. As shown in FIG. 7, the read data D (3C0) -D (3FC) is associated with the addresses 0-3C indicating the corresponding columns Y1-Y16 and the corresponding error correction information to the data processing unit 32. Remembered.

[ステップST510]
検査回路30の制御部31は、データ処理部32に記憶されたエラー訂正情報のすべてがHレベルであるか否かを判断する。エラー訂正情報のすべてがHレベルであるときはステップST517にすすむ。それ以外のとき、すなわち一部のエラー訂正情報がLレベルであるときはステップST511にすすむ。
[Step ST510]
The control unit 31 of the inspection circuit 30 determines whether all of the error correction information stored in the data processing unit 32 is at the H level. When all the error correction information is at the H level, the process proceeds to step ST517. In other cases, that is, when some error correction information is at the L level, the process proceeds to step ST511.

上述のとおり不揮発性半導体メモリ60への書き込みは行単位で行われるため、エラー訂正回路65によって検出されるエラーには以下の(a)および(b)に示すような種類がある。
(a)同一の行にあるメモリセルのうちの一部のメモリセルについてだけ発生するようなエラー
このようなエラーの原因としては、
・メモリセルのデータ保持特性不良により記録データが変化してしまった
・以前のデータがメモリセルに残留していたため正しく書き込めなかった
などが考えられる。このようなエラーは、再度同じデータを書き込むことによって修復することができる。データ処理部32に記憶されたエラー訂正情報のうちの一部がLレベルであるときは、ステップST503において検出されたエラーは(a)のようなエラーであると判断される。また、当該エラーが検出されたデータについては、データを正しくは読み出せなかったけれどもエラー訂正処理によって正しいデータに訂正されたと判断される。そして修復処理を行うためにステップST511にすすむ。
(b)同一の行にあるすべてのメモリセルについて発生するエラー
このようなエラーの原因としては、
・書き込み時の電源ダウンにより所望のデータが記録できていなかった
などが考えられる。ICカードでは、不揮発性半導体メモリへの書き込み動作中にリーダライタからICカードが引き離されることが起こりうる。このため、(b)のようなエラーが起こりうる。データ処理部32に記憶されたエラー訂正情報のすべてがHレベルであるときは、ステップST503において検出されたエラーは(b)のようなエラーであると判断される。また、当該エラーが検出されたデータに対応する行にあるメモリセルのデータは破壊されている、すなわち修復不能であると判断される。そしてステップST517にすすみ、検査回路30による不揮発性半導体メモリ60の診断が終了する。制御部31は、図4の時刻t2に示すように、リセット信号RST2をLレベルからHレベルに切り替え、診断結果「異常有り」をCPU40に通知する。
As described above, since writing to the nonvolatile semiconductor memory 60 is performed in units of rows, the errors detected by the error correction circuit 65 include the following types (a) and (b).
(A) An error that occurs only for some of the memory cells in the same row.
・ Recording data has changed due to defective data retention characteristics of the memory cell. ・ It is possible that previous data remained in the memory cell and could not be written correctly. Such an error can be repaired by writing the same data again. When a part of the error correction information stored in the data processing unit 32 is at the L level, it is determined that the error detected in step ST503 is an error as shown in (a). Further, regarding the data in which the error is detected, it is determined that the data has not been correctly read but has been corrected to the correct data by the error correction process. Then, the process proceeds to step ST511 to perform the repair process.
(B) An error that occurs for all memory cells in the same row.
-The desired data could not be recorded due to power-down during writing. In the IC card, it is possible that the IC card is pulled away from the reader / writer during the writing operation to the nonvolatile semiconductor memory. For this reason, an error like (b) may occur. When all of the error correction information stored in the data processing unit 32 is at the H level, it is determined that the error detected in step ST503 is an error as shown in (b). Further, it is determined that the data of the memory cell in the row corresponding to the data in which the error is detected is destroyed, that is, cannot be repaired. Then, the process proceeds to step ST517, and the diagnosis of the nonvolatile semiconductor memory 60 by the inspection circuit 30 is completed. As shown at time t2 in FIG. 4, the control unit 31 switches the reset signal RST2 from the L level to the H level and notifies the CPU 40 of the diagnosis result “abnormal”.

ここでは図7に示すように一部のエラー訂正情報がLレベルであるためステップST511にすすむ。   Here, as shown in FIG. 7, since some error correction information is at L level, the process proceeds to step ST511.

[ステップST511]
検査回路30の制御部31は、データ処理部32に記憶されたデータの再書き込みをデータ処理部32およびアドレス発生部33に指示する。図8に示すように、アドレス発生部33は、データ処理部32に記憶されたアドレス0を出力する。データ処理部32は、アドレス0に対応づけられたデータD(3C0)を出力する。制御部31は、データのラッチを指示する制御信号を出力する。不揮発性半導体メモリ60の入出力バッファ66は、アドレス発生部32からのアドレス0が示す列Y1に対応づけてデータ処理部32からのデータD(3C0)を一時的に蓄積(ラッチ)する。以下同様にして、アドレス発生部32からのアドレス4−3Cが示す列Y2−Y16に対応づけてデータ処理部32からのデータD(3C4)−D(3FC)が入出力バッファ66にラッチされる。
[Step ST511]
The control unit 31 of the inspection circuit 30 instructs the data processing unit 32 and the address generation unit 33 to rewrite the data stored in the data processing unit 32. As shown in FIG. 8, the address generation unit 33 outputs the address 0 stored in the data processing unit 32. The data processing unit 32 outputs data D (3C0) associated with address 0. The control unit 31 outputs a control signal instructing data latching. The input / output buffer 66 of the nonvolatile semiconductor memory 60 temporarily stores (latches) the data D (3C0) from the data processing unit 32 in association with the column Y1 indicated by the address 0 from the address generating unit 32. Similarly, data D (3C4) -D (3FC) from the data processing unit 32 is latched in the input / output buffer 66 in association with the column Y2-Y16 indicated by the address 4-3C from the address generation unit 32. .

[ステップST512]
図8に示すように、アドレス発生部33は、メモリセルアレイ61の行X16を示すアドレスを出力する。行X16は、ステップST503においてエラーが検出されたデータD(3C4)に対応する行である。
[Step ST512]
As shown in FIG. 8, the address generator 33 outputs an address indicating the row X16 of the memory cell array 61. Row X16 is a row corresponding to data D (3C4) in which an error is detected in step ST503.

[ステップST513]
制御部31は、書き込みを指示する制御信号を出力する。そして、入出力バッファ66にラッチされたデータD(3C0)−D(3FC)が、行X16および列Y1−Y16に対応する読み出し単位に書き込まれる(1ライン同時書き込み)。
[Step ST513]
The control unit 31 outputs a control signal instructing writing. Then, the data D (3C0) -D (3FC) latched in the input / output buffer 66 is written in the read unit corresponding to the row X16 and the columns Y1-Y16 (one line simultaneous writing).

[ステップST514]
再書き込みが終了すると検査回路30のアドレス発生部33は、図8に示すように、ステップST503においてエラーが検出された読み出し単位を指定するアドレス3C4(行X16,列Y2)を出力する。
[Step ST514]
When the rewriting is completed, the address generation unit 33 of the inspection circuit 30 outputs the address 3C4 (row X16, column Y2) that specifies the read unit in which the error is detected in step ST503, as shown in FIG.

[ステップST515]
制御部31は、読み出しを指示する制御信号を出力する。これに応答して、メモリセルアレイ61の行X16および列Y2に対応する読み出し単位からデータD(3C4)が読み出される。エラー訂正回路65は、読み出されたデータD(3C4)に対してエラー検出およびエラー訂正処理を行う。
[Step ST515]
The control unit 31 outputs a control signal that instructs reading. In response to this, data D (3C4) is read from the read unit corresponding to row X16 and column Y2 of memory cell array 61. The error correction circuit 65 performs error detection and error correction processing on the read data D (3C4).

[ステップST516]
検査回路30の制御部31は、ステップST515において読み出されたデータについてのエラー訂正情報がHレベルであるかLレベルであるかを判断する。Hレベルであるときは、再書き込みによってはエラーが修復されなかったと判断されてステップST517にすすむ。Lレベルであるときは、再書き込みによってエラーが修復されたと判断されてステップST504にもどる。ここでは図8に示すようにエラー訂正情報がLレベルであるのでステップST504にもどる。そしてステップST505において最終アドレスを越えたと判断されてステップST506にすすみ、検査回路30による不揮発性半導体メモリ60の診断が終了する。制御部31は、図4の時刻t2に示すように、リセット信号RST2をLレベルからHレベルに切り替え、診断結果「修復済み」をCPU40に通知する。なお、ステップST503においてエラーが全く検出されなかったときは診断結果「異常なし」をCPU40に通知する。
[Step ST516]
The control unit 31 of the inspection circuit 30 determines whether the error correction information regarding the data read in step ST515 is at the H level or the L level. When it is at the H level, it is determined that the error has not been repaired by rewriting, and the process proceeds to step ST517. When it is at the L level, it is determined that the error has been repaired by rewriting, and the process returns to step ST504. Here, since the error correction information is at the L level as shown in FIG. 8, the process returns to step ST504. Then, in step ST505, it is determined that the final address has been exceeded, the process proceeds to step ST506, and the diagnosis of the nonvolatile semiconductor memory 60 by the inspection circuit 30 is completed. As shown at time t2 in FIG. 4, the control unit 31 switches the reset signal RST2 from the L level to the H level and notifies the CPU 40 of the diagnosis result “repaired”. If no error is detected in step ST503, the CPU 40 is notified of the diagnosis result “no abnormality”.

以上のようにして検査回路30は不揮発性半導体メモリ60を診断する。診断が終了すると検査回路30の制御部31はリセット信号RST2をLレベルからHレベルに切り替え、診断結果をCPU40に通知する。CPU40に通知される診断結果には、
・「異常なし」(ステップST503においてエラーが全く検出されなかった場合)
・「修復済み」(ステップST503においてエラーが検出されたけれども再書き込みによって修復することができた場合)
・「異常あり」(ステップST503において検出されたエラーを修復することができなかった場合、ステップST503においてエラーが検出された行のすべての読み出し単位のデータにエラーが検出された場合)
の3種類がある。
The inspection circuit 30 diagnoses the nonvolatile semiconductor memory 60 as described above. When the diagnosis is completed, the control unit 31 of the inspection circuit 30 switches the reset signal RST2 from the L level to the H level and notifies the CPU 40 of the diagnosis result. The diagnostic result notified to the CPU 40 includes
"No abnormality" (when no error is detected in step ST503)
・ "Repaired" (when an error is detected in step ST503 but can be repaired by rewriting)
“There is an abnormality” (when the error detected in step ST503 cannot be repaired, if an error is detected in the data of all read units in the row in which the error is detected in step ST503)
There are three types.

図4に示すように、リセット信号RST2のLレベルからHレベルへの切り替わりに応答して検査回路30は動作停止状態になりCPU40は動作状態になる。すなわちCPU40が起動する。CPU40は、動作開始(起動)と同時に診断結果の内容を判断し、その内容によって起動方法を変更する。たとえば診断結果が「異常なし」または「修復済み」であるときは通常起動する。一方、診断結果が「異常あり」であるときは起動を停止し、システム異常のステータスをインターフェース回路20およびアンテナコイル10を介して外部に送信するなどの処理を行う。   As shown in FIG. 4, in response to the switching of the reset signal RST2 from the L level to the H level, the test circuit 30 enters an operation stop state and the CPU 40 enters an operation state. That is, the CPU 40 is activated. The CPU 40 determines the contents of the diagnosis result simultaneously with the operation start (activation), and changes the activation method according to the contents. For example, when the diagnosis result is “no abnormality” or “repaired”, it is normally activated. On the other hand, when the diagnosis result is “abnormal”, the activation is stopped, and the system abnormality status is transmitted to the outside via the interface circuit 20 and the antenna coil 10.

<効果>
以上のように、第1の実施形態によるICカードでは検査回路30を設けているため、不揮発性半導体メモリ60が正常な状態であるか否かをICカードが使用されるたびに判定することができる。これにより、不揮発性半導体メモリ60が故障した状態のままでICカードが使用され続けるような状況を防ぐことができる。この結果、正常な状態で長期間ICカードが使用されることになる。
<Effect>
As described above, since the inspection circuit 30 is provided in the IC card according to the first embodiment, it is determined every time the IC card is used whether or not the nonvolatile semiconductor memory 60 is in a normal state. it can. As a result, it is possible to prevent a situation in which the IC card continues to be used while the nonvolatile semiconductor memory 60 is in a failed state. As a result, the IC card is used for a long time in a normal state.

また、検査回路30による不揮発性半導体メモリ60の診断においては、メモリセルアレイ61の行X1−X16ごとに1つの読み出し単位のデータを読み出し、エラーが検出されたデータに対応する行についてはすべての読み出し単位のデータを読み出す。これにより、不揮発性半導体メモリ60の診断に要する時間を短くすることができる。   Further, in the diagnosis of the nonvolatile semiconductor memory 60 by the test circuit 30, one read unit data is read for each row X1-X16 of the memory cell array 61, and all read operations are performed on the row corresponding to the data in which the error is detected. Read unit data. Thereby, the time required for diagnosis of the nonvolatile semiconductor memory 60 can be shortened.

診断プログラムがROMに格納されており、CPUが起動した後に当該診断プログラムをROMから読み出して不揮発性半導体メモリの診断を行うようなICカードの場合、CPUの動作を解析することによって不揮発性半導体メモリへのアクセス手順が解析される可能性がある。しかし第1の実施形態によるICカードでは、CPU40が動作を停止している間に検査回路30によって不揮発性半導体メモリ60の診断が行われる。したがって不揮発性半導体メモリ60へのアクセス手順が解析されにくい。また、診断に要する時間が短いため、不揮発性半導体メモリ60の診断を行っているということ自体も解析されにくい。   In the case of an IC card in which a diagnostic program is stored in the ROM and the diagnostic program is read from the ROM and the nonvolatile semiconductor memory is diagnosed after the CPU is started, the nonvolatile semiconductor memory is analyzed by analyzing the operation of the CPU. Access procedures may be analyzed. However, in the IC card according to the first embodiment, the non-volatile semiconductor memory 60 is diagnosed by the inspection circuit 30 while the CPU 40 stops operating. Therefore, the access procedure to the nonvolatile semiconductor memory 60 is difficult to analyze. In addition, since the time required for diagnosis is short, it is difficult to analyze that the nonvolatile semiconductor memory 60 is being diagnosed.

また、検査回路30は不揮発性半導体メモリ60の診断結果をCPU40に通知する。これによりCPU40は、不揮発性半導体メモリ60が故障しているということを起動直後に認識することができる。したがって、異常が検知された場合にはCPU40が適切な処理を行うことによってシステムのハングアップ等のトラブルを未然に防ぐことができる。   In addition, the inspection circuit 30 notifies the CPU 40 of the diagnosis result of the nonvolatile semiconductor memory 60. Thereby, CPU40 can recognize immediately after starting that the non-volatile semiconductor memory 60 is out of order. Therefore, when an abnormality is detected, troubles such as a system hang-up can be prevented by the CPU 40 performing appropriate processing.

なお、ここでは非接触型のICカードについて説明したがこれを接触型のICカードとしてもよい。   Although a non-contact type IC card has been described here, it may be a contact type IC card.

<変形例1>
上述の(b)のようなエラーに対しては、メモリセルアレイ61の行X1−X16の各々から1つの読み出し単位のデータを読み出すことによって十分な診断を行うことができる。しかし上述の(a)のようなエラーの場合、当該エラーが存在する読み出し単位以外の読み出し単位のデータが読み出されることがあるため十分な診断を行うことができない。
<Modification 1>
With respect to the error as described above (b), sufficient diagnosis can be performed by reading data of one read unit from each of the rows X1 to X16 of the memory cell array 61. However, in the case of an error as described above (a), data in a read unit other than the read unit in which the error exists may be read, so that sufficient diagnosis cannot be performed.

不揮発性半導体メモリ60のメモリセルの特性不良にはプロセス的な要因が少なからず影響していると考えられるため、メモリセルアレイ61の領域のうち特性不良の発生頻度が高い領域を統計的に予想できる場合がある。このような場合にはステップST501において検査回路30の制御部31は、図9(a)に示すように、メモリセルアレイ61の列Y1−Y16のうち不良発生頻度が高いと予想される領域にある列Y16を選択する。これにより、上述の(a)のようなエラーに対して効率的な診断を行うことができる。   Since it is considered that there are a number of process factors affecting the characteristic defects of the memory cells of the nonvolatile semiconductor memory 60, it is possible to statistically predict areas where the frequency of characteristic defects is high among the areas of the memory cell array 61. There is a case. In such a case, in step ST501, the control unit 31 of the inspection circuit 30 is in an area where the defect occurrence frequency is expected to be high in the columns Y1-Y16 of the memory cell array 61, as shown in FIG. Column Y16 is selected. Thereby, an efficient diagnosis can be performed for the error as described in (a) above.

<変形例2>
偶発的な要因によって生じる特性不良については、それがメモリセルアレイ61のどの領域で発生するかを予測するのは困難である。そこでステップST501およびST504において、図9(b)に示すように、行X1−X16ごとに異なる列Y1−Y16に対応する読み出し単位を指定するアドレス(0,44,88,・・・,3B8,3FC)が出力されるように検査回路30のアドレス発生部33を制御する。これにより、行X1−X16の各々から読み出される読み出し単位がメモリセルアレイ61の特定の領域に偏らないようにすることができる。この結果、上述の(a)のようなエラーに対して効率的な診断を行うことができる。
<Modification 2>
It is difficult to predict in which region of the memory cell array 61 a characteristic failure caused by an accidental factor will occur. Therefore, in steps ST501 and ST504, as shown in FIG. 9B, addresses (0, 44, 88,..., 3B8, etc.) that specify read units corresponding to columns Y1-Y16 that differ for each row X1-X16. 3FC) is controlled so that the address generator 33 of the inspection circuit 30 is controlled. Thereby, it is possible to prevent the read unit read from each of the rows X1 to X16 from being biased to a specific region of the memory cell array 61. As a result, an efficient diagnosis can be performed for the error as described in (a) above.

<変形例3>
診断動作のたびにステップST501において異なる列Y1−Y16が検査回路30の制御部31によって選択されるようにしてもよい。たとえば図9(c)に示すように、1回目の診断動作の際は列Y1、2回目の診断動作の際は列Y2、・・・、16回目の診断動作の際は列Y16がステップST501において選択されるようにする。これにより、特性不良のメモリセルがランダムに存在したとしても、診断動作を一定の回数(ここでは16回)行う間にすべての特性不良を検知することができる。
<Modification 3>
Different columns Y1-Y16 may be selected by the control unit 31 of the inspection circuit 30 in step ST501 for each diagnosis operation. For example, as shown in FIG. 9C, the column Y1 in the first diagnostic operation, the column Y2,... In the first diagnostic operation, the column Y16 in step ST501 in the 16th diagnostic operation. To be selected. As a result, even if memory cells having defective characteristics are present at random, all of the defective characteristics can be detected during a certain number of diagnostic operations (here, 16 times).

(第2の実施形態)
<ICカードの構成>
図10は、この発明の第2の実施形態によるICカードの構成を示すブロック図である。図10に示すICカードは非接触型のICカードであって、アンテナコイル10と、LSIチップ100とを備える。LSIチップ100は、インターフェース回路20と、CPU40と、不揮発性半導体メモリ60と、キャッシュメモリ110と、アクセス制御部120とを含む。
(Second Embodiment)
<Configuration of IC card>
FIG. 10 is a block diagram showing the configuration of an IC card according to the second embodiment of the present invention. The IC card shown in FIG. 10 is a non-contact type IC card, and includes an antenna coil 10 and an LSI chip 100. The LSI chip 100 includes an interface circuit 20, a CPU 40, a nonvolatile semiconductor memory 60, a cache memory 110, and an access control unit 120.

このICカードでは不揮発性半導体メモリ60のメモリセルアレイ61内にアドレス記憶部が設けられている。ここでは図11に示すように、メモリセルアレイ61の行X16に対応する領域をアドレス記憶部としている。不揮発性半導体メモリ60への書き込みアクセス頻度の高いアドレスがあらかじめ想定できる場合(たとえばICカードに搭載されるプログラムがあらかじめ分かっている場合など)には、不揮発性半導体メモリ60の検査工程においてメモリテスタ等によって当該アドレスがアドレス記憶部に書き込まれる。ここでは図11に示すようにアドレス00,80,2C0がアドレス記憶部に記憶されている。アドレス00,80,2C0はメモリセルアレイ61の行X1,X3,X12を示すアドレスである。このようにアドレス記憶部には不揮発性半導体メモリ60への書き込みアクセス頻度の高いアドレスがあらかじめ記憶されている。   In this IC card, an address storage unit is provided in the memory cell array 61 of the nonvolatile semiconductor memory 60. Here, as shown in FIG. 11, an area corresponding to the row X16 of the memory cell array 61 is used as an address storage unit. When an address with a high frequency of write access to the nonvolatile semiconductor memory 60 can be assumed in advance (for example, when a program mounted on the IC card is known in advance), a memory tester or the like in the inspection process of the nonvolatile semiconductor memory 60 The address is written into the address storage unit. Here, as shown in FIG. 11, addresses 00, 80, and 2C0 are stored in the address storage unit. Addresses 00, 80, and 2C0 are addresses indicating the rows X1, X3, and X12 of the memory cell array 61. As described above, the address storage unit stores in advance addresses that are frequently accessed for writing to the nonvolatile semiconductor memory 60.

アクセス制御部120は、不揮発性半導体メモリ60への書き込みアドレスとアドレス記憶部に記憶されたアドレスのいずれか1つとが一致するとき、当該書き込みアドレスに対応する書き込みデータをキャッシュメモリ110に書き込む。   When the write address to the nonvolatile semiconductor memory 60 matches any one of the addresses stored in the address storage unit, the access control unit 120 writes the write data corresponding to the write address to the cache memory 110.

<ICカードの動作>
次に、以上のように構成されたICカードの動作について図12を参照しつつ説明する。
<Operation of IC card>
Next, the operation of the IC card configured as described above will be described with reference to FIG.

[ステップST1201]
リーダライタにICカードが近づけられ、リーダライタからICカードに供給される電力が所定のレベルに達すると、インターフェース回路20はリセット信号RST1をLレベルからHレベルに切り替える。
[Step ST1201]
When the IC card is brought close to the reader / writer and the power supplied from the reader / writer to the IC card reaches a predetermined level, the interface circuit 20 switches the reset signal RST1 from the L level to the H level.

[ステップST1202]
リセット信号RST1がLレベルからHレベルに切り替わるとアクセス制御部120は、不揮発性半導体メモリ60のメモリセルアレイ61内のアドレス記憶部に記憶されたアドレス00,80,2C0を読み出しこれをキャッシュメモリ110に書き込む。図13(a)に示すように、キャッシュメモリ110内部にはスロット番号ごとにアドレス記憶領域およびデータ記憶領域が設けられており、アドレス00,80,2C0はスロット番号1,2,3のアドレス記憶領域に記憶される。このようにキャッシュメモリ110内部ではスロット番号1−3に対応づけてアドレス00,80,2C0が記憶される。
[Step ST1202]
When the reset signal RST1 is switched from the L level to the H level, the access control unit 120 reads the addresses 00, 80, 2C0 stored in the address storage unit in the memory cell array 61 of the nonvolatile semiconductor memory 60 and stores them in the cache memory 110. Write. As shown in FIG. 13A, an address storage area and a data storage area are provided for each slot number in the cache memory 110, and addresses 00, 80, and 2C0 are stored in the address numbers of slot numbers 1, 2, and 3, respectively. Stored in the area. As described above, the addresses 00, 80, and 2C0 are stored in the cache memory 110 in association with the slot numbers 1-3.

[ステップST1203]
次にアクセス制御部120は、キャッシュメモリ110に書き込まれたアドレス00,80,2C0に対応するデータすなわちメモリセルアレイ61の行X1,X3,X12に対応するデータを不揮発性半導体メモリ60から読み出しキャッシュメモリ110に書き込む。図13(b)に示すように、アドレス00,80,2C0に対応するデータすなわちメモリセルアレイ61の行X1,X3,X12に対応するデータD(0)−D(3C),D(80)−D(BC),D(2C0)−D(2FC)はスロット番号1,2,3のデータ記憶領域に記憶される。このようにキャッシュメモリ110内部では、アドレス00,80,2C0に対応するデータD(0)−D(3C),D(80)−D(BC),D(2C0)−D(2FC)はスロット番号1,2,3に対応づけて記憶される。
[Step ST1203]
Next, the access control unit 120 reads the data corresponding to the addresses 00, 80, and 2C0 written to the cache memory 110, that is, the data corresponding to the rows X1, X3, and X12 of the memory cell array 61 from the nonvolatile semiconductor memory 60. 110 is written. As shown in FIG. 13B, data corresponding to the addresses 00, 80, 2C0, that is, data D (0) -D (3C), D (80)-corresponding to the rows X1, X3, X12 of the memory cell array 61. D (BC), D (2C0) -D (2FC) are stored in the data storage areas of slot numbers 1, 2, and 3. Thus, in the cache memory 110, data D (0) -D (3C), D (80) -D (BC), D (2C0) -D (2FC) corresponding to addresses 00, 80, 2C0 are slots. Stored in association with numbers 1, 2, and 3.

[ステップST1204]
次にアクセス制御部120は、CPU40に与えるリセット信号RST2をLレベルからHレベルに切り替える。リセット信号RST2のLレベルからHレベルへの切り替わりに応答してCPU40が起動し、ICカードに搭載されたアプリケーションプログラムが実行される。
[Step ST1204]
Next, the access control unit 120 switches the reset signal RST2 given to the CPU 40 from the L level to the H level. In response to the switching of the reset signal RST2 from the L level to the H level, the CPU 40 is activated and the application program mounted on the IC card is executed.

[ステップST1205]
アクセス制御部120は、CPU40からのシステム終了信号の有無を判断する。システム終了信号は、アプリケーションプログラムの一連の処理が終了するとCPU40からアクセス制御部120に与えられる制御信号である。CPU40からアクセス制御部120にシステム終了信号が与えられるとステップST1211にすすむ。そうでないときはステップST1206にすすむ。
[Step ST1205]
The access control unit 120 determines whether there is a system end signal from the CPU 40. The system end signal is a control signal given from the CPU 40 to the access control unit 120 when a series of processing of the application program ends. When a system end signal is given from the CPU 40 to the access control unit 120, the process proceeds to step ST1211. Otherwise, the process proceeds to step ST1206.

[ステップST1206]
アクセス制御部120は、CPU40から不揮発性半導体メモリ60への書き込みアクセスの有無を判断する。書き込みアクセスがあるとステップST1207にすすむ。そうでないときはステップST1205にもどる。
[Step ST1206]
The access control unit 120 determines whether or not there is a write access from the CPU 40 to the nonvolatile semiconductor memory 60. If there is a write access, the process proceeds to step ST1207. Otherwise, the process returns to step ST1205.

[ステップST1207]
不揮発性半導体メモリ60への書き込みを指示する制御信号・書き込みアドレス・書き込みデータがCPU40からアクセス制御部120に与えられるとアクセス制御部120は、CPU40からの書き込みアドレスとキャッシュメモリ110に記憶されているアドレスとを比較する。アクセス制御部120は、CPU40からの書き込みアドレスとキャッシュメモリ110に記憶されているアドレスとを下位4ビットを無視して比較する。たとえばメモリセルアレイ61のアドレス84(行X3および列Y2)に32ビットのデータD(84w)を書き込むように指示する書き込みアクセスがあった場合には、図14に示すようにアクセス制御部120は書き込みアドレス84の下位4ビットを無視した値8とキャッシュメモリ110に記憶されたアドレス00,80,2C0の下位4ビットを無視した値0,8,2Cとを比較する。
[Step ST1207]
When a control signal / write address / write data for instructing writing to the nonvolatile semiconductor memory 60 is supplied from the CPU 40 to the access control unit 120, the access control unit 120 stores the write address from the CPU 40 and the cache memory 110. Compare the address. The access control unit 120 compares the write address from the CPU 40 and the address stored in the cache memory 110 ignoring the lower 4 bits. For example, when there is a write access instructing to write 32-bit data D (84w) to address 84 (row X3 and column Y2) of memory cell array 61, access controller 120 writes as shown in FIG. The value 8 in which the lower 4 bits of the address 84 are ignored is compared with the values 0, 8, and 2C in which the lower 4 bits of the addresses 00, 80, and 2C0 stored in the cache memory 110 are ignored.

[ステップST1208]
ステップST1207における比較の結果、CPU40からの書き込みアドレスとキャッシュメモリ110に記憶されているアドレスのいずれか1つとが一致するときはステップST1209にすすむ。CPU40からの書き込みアドレスがキャッシュメモリ110に記憶されているアドレスのいずれとも一致しないときはステップST1210にすすむ。たとえばメモリセルアレイ61のアドレス84(行X3および列Y2)にデータD(84w)を書き込むように指示する書き込みアクセスがあった場合には、書き込みアドレス84の下位4ビットを無視した値8とキャッシュメモリ110に記憶されたアドレス80の下位4ビットを無視した値8とが一致するためステップST1209にすすむ。
[Step ST1208]
As a result of the comparison in step ST1207, when the write address from the CPU 40 matches any one of the addresses stored in the cache memory 110, the process proceeds to step ST1209. If the write address from the CPU 40 does not match any of the addresses stored in the cache memory 110, the process proceeds to step ST1210. For example, when there is a write access instructing to write data D (84w) to address 84 (row X3 and column Y2) of memory cell array 61, the value 8 which ignores the lower 4 bits of write address 84 and the cache memory Since the value 4 ignoring the lower 4 bits of the address 80 stored in 110 matches, the process proceeds to step ST1209.

[ステップST1209]
CPU40からの書き込みアドレスとキャッシュメモリ110に記憶されているアドレスのいずれか1つとが一致するとき、アクセス制御部120は書き込みデータをキャッシュメモリ110に書き込む。アクセス制御部120は、キャッシュメモリ110に記憶されているデータのうち当該書き込みアドレスに対応するデータに当該書き込みデータを上書きする。たとえばメモリセルアレイ61のアドレス84(行X3および列Y2)にデータD(84w)を書き込むように指示する書き込みアクセスがあった場合には、図13(c)に示すように、キャッシュメモリ110に記憶されているデータのうち書き込みアドレス84に対応するデータすなわち行X3および列Y2に対応するデータD(84)に書き込みデータD(84w)が上書きされる。キャッシュメモリ110への書き込みが終了するとステップST1205にもどる。
[Step ST1209]
When the write address from the CPU 40 matches any one of the addresses stored in the cache memory 110, the access control unit 120 writes the write data into the cache memory 110. The access control unit 120 overwrites the data corresponding to the write address among the data stored in the cache memory 110 with the write data. For example, when there is a write access for instructing to write data D (84w) to address 84 (row X3 and column Y2) of memory cell array 61, it is stored in cache memory 110 as shown in FIG. The write data D (84w) is overwritten on the data corresponding to the write address 84, that is, the data D (84) corresponding to the row X3 and the column Y2 among the stored data. When the writing to the cache memory 110 is completed, the process returns to step ST1205.

[ステップST1210]
CPU40からの書き込みアドレスがキャッシュメモリ110に記憶されているアドレスのいずれとも一致しないとき、アクセス制御部120は書き込みデータを不揮発性半導体メモリ60に書き込む。そしてステップST1205にもどる。
[Step ST1210]
When the write address from the CPU 40 does not match any of the addresses stored in the cache memory 110, the access control unit 120 writes the write data into the nonvolatile semiconductor memory 60. Then, the process returns to step ST1205.

[ステップST1211]
アプリケーションプログラムの一連の処理が終了するとCPU40からアクセス制御部120にシステム終了信号が与えられる(ST1205)。システム終了信号を受けるとアクセス制御部120は、キャッシュメモリ110に記憶されているデータをすべて読み出し、メモリセルアレイ61の対応するアドレスに書き込む。
[Step ST1211]
When a series of processing of the application program ends, a system end signal is given from the CPU 40 to the access control unit 120 (ST1205). Upon receiving the system end signal, the access control unit 120 reads all the data stored in the cache memory 110 and writes it to the corresponding address of the memory cell array 61.

<効果>
通常、不揮発性半導体メモリには書き込み回数に上限がある。書き込み回数がこの上限に近づくと書き込みエラーなどの故障が生じる可能性が高くなる。第2の実施形態によるICカードでは、不揮発性半導体メモリ60のメモリセルアレイ61内にアドレス記憶部を設け、書き込みアクセス頻度の高いアドレスをあらかじめアドレス記憶部に記憶する。そして不揮発性半導体メモリ60への書き込みアドレスとアドレス記憶部に記憶されたアドレスのうちいずれか1つとが一致するときは当該書き込みアドレスに対応する書き込みデータをキャッシュメモリ110に書き込む。これにより、不揮発性半導体メモリ60への書き込み回数を少なくすることができる。この結果、不揮発性半導体メモリ60が正常な状態で長期間使用されることになる。
<Effect>
Usually, the nonvolatile semiconductor memory has an upper limit on the number of times of writing. When the number of times of writing approaches this upper limit, there is a high possibility that a failure such as a writing error will occur. In the IC card according to the second embodiment, an address storage unit is provided in the memory cell array 61 of the nonvolatile semiconductor memory 60, and an address having a high write access frequency is stored in the address storage unit in advance. When the write address to the nonvolatile semiconductor memory 60 matches one of the addresses stored in the address storage unit, the write data corresponding to the write address is written to the cache memory 110. Thereby, the number of times of writing to the nonvolatile semiconductor memory 60 can be reduced. As a result, the nonvolatile semiconductor memory 60 is used for a long time in a normal state.

また一般に、キャッシュにヒットしやすいアドレス(たとえば最近にアクセスがあったアドレスや何回もアクセスがあったアドレスなど)をプログラム実行中に精度よく抽出する(アドレス置換メカニズム)ためにはキャッシュメモリの資源を大量に必要とする。第2の実施形態によるICカードではアドレス記憶部を設け、キャッシュにヒットしやすいアドレスをあらかじめアドレス記憶部に記憶させている。したがって、アドレス記憶部を設けない場合に比べて少ない資源で不揮発性半導体メモリ60への書き込み回数を少なくすることができる。   In general, cache memory resources are used to accurately extract addresses that are likely to hit the cache (for example, addresses that have been accessed recently or addresses that have been accessed many times) during program execution (address replacement mechanism). Is required in large quantities. In the IC card according to the second embodiment, an address storage unit is provided, and an address that is likely to hit the cache is stored in the address storage unit in advance. Therefore, the number of times of writing to the nonvolatile semiconductor memory 60 can be reduced with fewer resources than in the case where no address storage unit is provided.

また、不揮発性半導体メモリのメモリセルアレイの行ごとに書き込み回数を管理する技術に比べて管理に必要な容量を少なくすることができる。たとえば容量32Kバイトの不揮発性半導体メモリ(512ビット/1ワード線×512本)の場合、各行について約6万回までの書き込み回数を管理するためには1ワード線ごとに16ビット、すなわち32Kバイトの不揮発性半導体メモリのうち1Kバイトを書き込み回数を管理するために消費することになる。一方、ワード線512本分を示すためには9ビットのアドレスが必要であり、10個のアドレスを記憶したとしてもアドレス記憶部に必要な容量は90ビットにすぎない。   In addition, the capacity required for management can be reduced as compared with a technique for managing the number of writes for each row of the memory cell array of the nonvolatile semiconductor memory. For example, in the case of a non-volatile semiconductor memory having a capacity of 32 Kbytes (512 bits / 1 word line × 512 lines), in order to manage the number of times of writing up to about 60,000 times for each row, 16 bits for each word line, that is, 32 Kbytes Of this nonvolatile semiconductor memory, 1 Kbyte is consumed to manage the number of writes. On the other hand, in order to show 512 word lines, a 9-bit address is required, and even if 10 addresses are stored, the capacity required for the address storage unit is only 90 bits.

<変形例>
なお、ここでは不揮発性半導体メモリ60のメモリセルアレイ61内にアドレス記憶部を設けた。これに代えて、LSIチップ100の製造工程においてROM(図示せず)の内部に直接アドレスを記憶させたり、キャッシュメモリ110の内部にアドレス記憶部を回路的に作りこんだりしてもよい。
<Modification>
Here, an address storage unit is provided in the memory cell array 61 of the nonvolatile semiconductor memory 60. Instead of this, an address may be directly stored in a ROM (not shown) in the manufacturing process of the LSI chip 100, or an address storage unit may be built in the cache memory 110 in a circuit form.

また、ここではキャッシュメモリ110に記憶されたデータを不揮発性半導体メモリ60へ書き込むタイミングを、アプリケーションプログラムの一連の処理が終了した後とした。これに代えて、不揮発性半導体メモリ60への書き込みアクセスが所定の回数(たとえば10回)行われるごとにしてもよい。   Here, the timing for writing the data stored in the cache memory 110 to the nonvolatile semiconductor memory 60 is after the end of the series of processing of the application program. Instead of this, the write access to the nonvolatile semiconductor memory 60 may be performed a predetermined number of times (for example, 10 times).

また、ここでは非接触型のICカードについて説明したがこれを接触型のICカードとしてもよい。   Although the non-contact type IC card has been described here, it may be a contact type IC card.

(第3の実施形態)
<ICカードの構成および動作>
不揮発性半導体メモリを内蔵したICカードには、所望のアプリケーションを不揮発性半導体メモリにダウンロードできるものや複数のアプリケーションを不揮発性半導体メモリに搭載できるものがある。このようなICカードでは、利用する人・利用するアプリケーションによって不揮発性半導体メモリへの書き込みアクセスの状況が異なる。第3の実施形態によるICカードは、図10に示したICカードにおいてアドレス記憶部に記憶されるアドレスを不揮発性半導体メモリ60への書き込みアクセスの状況に応じて動的に変えるようにした点を特徴とする。以下、第3の実施形態によるICカードの動作について図15を参照しつつ説明する。ここでは、図12に示したフローチャートと異なるステップST1509−ST1513について説明する。
(Third embodiment)
<Configuration and operation of IC card>
Some IC cards with a built-in nonvolatile semiconductor memory can download a desired application to the nonvolatile semiconductor memory, and some can mount a plurality of applications on the nonvolatile semiconductor memory. In such an IC card, the status of write access to the non-volatile semiconductor memory differs depending on the user and application used. The IC card according to the third embodiment is such that the address stored in the address storage unit in the IC card shown in FIG. 10 is dynamically changed according to the status of write access to the nonvolatile semiconductor memory 60. Features. The operation of the IC card according to the third embodiment will be described below with reference to FIG. Here, steps ST1509 to ST1513 different from the flowchart shown in FIG. 12 will be described.

[ステップST1509]
CPU40からの書き込みアドレスとキャッシュメモリ110に記憶されているアドレスのいずれか1つとが一致するとき、アクセス制御部120は書き込みデータをキャッシュメモリ110に書き込む。具体的には、キャッシュメモリ110に記憶されているデータのうち当該書き込みアドレスに対応するデータに当該書き込みデータが上書きされる。たとえばアドレス00,80,2C0に対応するデータD(0)−D(3C),D(80)−D(BC),D(2C0)−D(2FC)がスロット番号1,2,3に対応づけて記憶されている場合においてメモリセルアレイ61のアドレス84(行X3および列Y2)にデータD(84w)を書き込むように指示する書き込みアクセスがあったときには、図16(a)に示すように、キャッシュメモリ110に記憶されているデータのうち書き込みアドレス84に対応するデータすなわち行X3および列Y2に対応するデータD(84)に書き込みデータD(84w)が上書きされる。
[Step ST1509]
When the write address from the CPU 40 matches any one of the addresses stored in the cache memory 110, the access control unit 120 writes the write data to the cache memory 110. Specifically, the write data is overwritten on the data corresponding to the write address among the data stored in the cache memory 110. For example, data D (0) -D (3C), D (80) -D (BC), and D (2C0) -D (2FC) corresponding to addresses 00, 80, and 2C0 correspond to slot numbers 1, 2, and 3, respectively. When there is a write access instructing to write the data D (84w) to the address 84 (row X3 and column Y2) of the memory cell array 61, as shown in FIG. Of the data stored in the cache memory 110, the data corresponding to the write address 84, that is, the data D (84) corresponding to the row X3 and the column Y2 is overwritten with the write data D (84w).

次にアクセス制御部120は、キャッシュメモリ110内のスロット番号を付け替える。具体的には、書き込みデータが書き込まれたスロットのスロット番号を1とし、残りのスロットについてはスロット番号の小さい順に2,3,・・・に付け替える。たとえば図16(a)に示したような書き込みが行われた場合には、図16(b)に示すように、アドレス80およびデータD(80)−D(BC)に対応するスロット番号を1、アドレス00およびデータD(0)−D(3C)に対応するスロット番号を2、アドレス2C0およびデータD(2C0)−D(2FC)に対応するスロット番号を3に付け替える。このようにスロット番号を付け替えることにより、最近に書き込みアクセスがあったアドレスほど小さいスロット番号が対応づけられることになる。スロット番号の付け替えが終了するとステップST1205にもどる。   Next, the access control unit 120 changes the slot number in the cache memory 110. Specifically, the slot number of the slot in which the write data is written is set to 1, and the remaining slots are changed to 2, 3,. For example, when writing as shown in FIG. 16A is performed, the slot number corresponding to the address 80 and data D (80) -D (BC) is set to 1 as shown in FIG. 16B. The slot number corresponding to address 00 and data D (0) -D (3C) is changed to 2, and the slot number corresponding to address 2C0 and data D (2C0) -D (2FC) is changed to 3. By changing the slot number in this way, the smaller slot number is associated with the address that has been recently accessed for writing. When the slot number replacement is completed, the process returns to step ST1205.

[ステップST1510]
CPU40からの書き込みアドレスがキャッシュメモリ110に記憶されているアドレスのいずれとも一致しないとき、アクセス制御部120は、キャッシュメモリ110内に空スロットが有るか否かを判断する。ここで空スロットとは、アドレスおよびデータが対応づけられていないスロット番号のことをいう。キャッシュメモリ110内に空スロットがあるときはステップST1511にすすみ、空スロットがないときはステップST1512にすすむ。たとえば図17(a)に示すように、アドレス00,80に対応するデータD(0)−D(3C),D(80)−D(BC)がスロット番号1,2に対応づけて記憶されておりかつスロット番号3が空スロットである場合において、メモリセルアレイ61のアドレス44(行X2および列Y2)にデータD(44w)を書き込むように指示する書き込みアクセスがあったときには、アクセス制御部120はキャッシュメモリ110内に空スロットが有ると判断しステップST1511にすすむ。
[Step ST1510]
When the write address from the CPU 40 does not match any of the addresses stored in the cache memory 110, the access control unit 120 determines whether there is an empty slot in the cache memory 110. Here, an empty slot refers to a slot number that does not correspond to an address and data. If there is an empty slot in the cache memory 110, the process proceeds to step ST1511. If there is no empty slot, the process proceeds to step ST1512. For example, as shown in FIG. 17A, data D (0) -D (3C) and D (80) -D (BC) corresponding to addresses 00 and 80 are stored in association with slot numbers 1 and 2, respectively. If the slot number 3 is an empty slot and there is a write access instructing to write the data D (44w) to the address 44 (row X2 and column Y2) of the memory cell array 61, the access control unit 120 Determines that there is an empty slot in the cache memory 110 and proceeds to step ST1511.

[ステップST1511]
キャッシュメモリ110内に空スロットがあるとき、アクセス制御部120は、書き込みアドレスに対応する行のすべてのデータ(512ビット=32ビット×16データ)を不揮発性半導体メモリ60から読み出し、空スロットのデータ記憶領域に書き込む。またアクセス制御部120は、書き込みアドレスに対応する行を示すアドレスを空スロットのアドレス記憶領域に書き込む。たとえば図17(a)に示した状況においてメモリセルアレイ61のアドレス44(行X2および列Y2)にデータD(44w)を書き込むように指示する書き込みアクセスがあったときには、図17(b)に示すように、書き込みアドレス44に対応する行X2のすべてのデータD(40)−D(7C)が不揮発性半導体メモリ60から読み出され、スロット番号3(空スロット)のデータ記憶領域に書き込まれる。また、書き込みアドレス44に対応する行X2を示すアドレス40がスロット番号3(空スロット)のアドレス記憶領域に書き込まれる。
[Step ST1511]
When there is an empty slot in the cache memory 110, the access control unit 120 reads all data (512 bits = 32 bits × 16 data) of the row corresponding to the write address from the nonvolatile semiconductor memory 60, and data in the empty slot Write to storage area. The access control unit 120 writes an address indicating a row corresponding to the write address in the address storage area of the empty slot. For example, when there is a write access instructing to write data D (44w) to address 44 (row X2 and column Y2) of memory cell array 61 in the situation shown in FIG. 17A, it is shown in FIG. 17B. As described above, all the data D (40) -D (7C) in the row X2 corresponding to the write address 44 is read from the nonvolatile semiconductor memory 60 and written in the data storage area of the slot number 3 (empty slot). Further, the address 40 indicating the row X2 corresponding to the write address 44 is written into the address storage area of the slot number 3 (empty slot).

次に、アクセス制御部120は書き込みデータをキャッシュメモリ110に書き込む。具体的には、空スロットに書き込んだデータのうち書き込みアドレスに対応するデータに書き込みデータを上書きする。たとえば図17(b)に示した状況においては、図17(c)に示すようにスロット番号3のデータ記憶領域に書き込まれたデータD(40)−D(7C)のうち書き込みアドレス44に対応するデータすなわち行X2および列Y2に対応するデータD(44)に書き込みデータD(44w)が上書きされる。   Next, the access control unit 120 writes the write data into the cache memory 110. Specifically, the write data is overwritten on the data corresponding to the write address among the data written in the empty slot. For example, in the situation shown in FIG. 17B, it corresponds to the write address 44 among the data D (40) -D (7C) written in the data storage area of slot number 3 as shown in FIG. 17C. The data to be written, that is, the data D (44) corresponding to the row X2 and the column Y2 is overwritten with the write data D (44w).

次にアクセス制御部120は、キャッシュメモリ110内のスロット番号を付け替える。上述と同様に、最近に書き込みアクセスがあったアドレスほど小さいスロット番号が対応づけられるようにスロット番号を付け替える。たとえば図17(c)に示したような書き込みが行われた場合には、図17(d)に示すように、アドレス40およびデータD(40)−D(7C)に対応するスロット番号を1、アドレス00およびデータD(0)−D(3C)に対応するスロット番号を2、アドレス80およびデータD(80)−D(BC)に対応するスロット番号を3に付け替える。スロット番号の付け替えが終了するとステップST1205にもどる。   Next, the access control unit 120 changes the slot number in the cache memory 110. As described above, the slot number is changed so that the smaller the slot number is associated with the address that has been recently accessed for writing. For example, when writing as shown in FIG. 17C is performed, the slot number corresponding to the address 40 and the data D (40) -D (7C) is set to 1 as shown in FIG. The slot number corresponding to address 00 and data D (0) -D (3C) is changed to 2, and the slot number corresponding to address 80 and data D (80) -D (BC) is changed to 3. When the slot number replacement is completed, the process returns to step ST1205.

[ステップST1512]
キャッシュメモリ110内に空スロットがないとき、アクセス制御部120は、キャッシュメモリ110内の最も大きいスロット番号のデータ記憶領域に記憶されているすべてのデータを読み出し、不揮発性半導体メモリ60の対応する行に書き込む。たとえば図18(a)に示すようにアドレス00,80,2C0に対応するデータD(0)−D(3C),D(80)−D(BC),D(2C0)−D(2FC)がスロット番号1,2,3に対応づけて記憶されている場合においてメモリセルアレイ61のアドレス44(行X2および列Y2)にデータD(44w)を書き込むように指示する書き込みアクセスがあったときを考える。このときアクセス制御部120は、最も大きいスロット番号3のデータ記憶領域に記憶されているデータD(2C0)−D(2FC)を読み出し、不揮発性半導体メモリ60の対応する行X12に書き込む。
[Step ST1512]
When there is no empty slot in the cache memory 110, the access control unit 120 reads all the data stored in the data storage area of the largest slot number in the cache memory 110, and reads the corresponding row of the nonvolatile semiconductor memory 60. Write to. For example, as shown in FIG. 18A, data D (0) -D (3C), D (80) -D (BC), D (2C0) -D (2FC) corresponding to addresses 00, 80, 2C0 are obtained. Consider a case where there is a write access instructing to write data D (44w) to address 44 (row X2 and column Y2) of memory cell array 61 in the case of being stored in association with slot numbers 1, 2, and 3. . At this time, the access control unit 120 reads the data D (2C0) -D (2FC) stored in the data storage area of the largest slot number 3 and writes it in the corresponding row X12 of the nonvolatile semiconductor memory 60.

次にアクセス制御部120は、書き込みアドレスに対応する行のすべてのデータ(512ビット=32ビット×16データ)を不揮発性半導体メモリ60から読み出し、最も大きいスロット番号のデータ記憶領域に書き込む。またアクセス制御部120は、書き込みアドレスに対応する行を示すアドレスを最も大きいスロット番号のアドレス記憶領域に書き込む。たとえば図18(a)に示した状況においては、図18(b)に示すように書き込みアドレス44に対応する行X2のすべてのデータD(40)−D(7C)が不揮発性半導体メモリ60から読み出され、スロット番号3(最も大きいスロット番号)のデータ記憶領域に書き込まれる。また、書き込みアドレス44に対応する行X2を示すアドレス40がスロット番号3(最も大きいスロット番号)のアドレス記憶領域に書き込まれる。   Next, the access control unit 120 reads all the data (512 bits = 32 bits × 16 data) in the row corresponding to the write address from the nonvolatile semiconductor memory 60 and writes it in the data storage area of the largest slot number. Further, the access control unit 120 writes the address indicating the row corresponding to the write address in the address storage area of the largest slot number. For example, in the situation shown in FIG. 18A, all the data D (40) -D (7C) in the row X2 corresponding to the write address 44 are transferred from the nonvolatile semiconductor memory 60 as shown in FIG. It is read and written to the data storage area of slot number 3 (the largest slot number). Further, the address 40 indicating the row X2 corresponding to the write address 44 is written into the address storage area of the slot number 3 (the largest slot number).

次に、アクセス制御部120は書き込みデータをキャッシュメモリ110に書き込む。具体的には、最も大きいスロット番号のデータ記憶領域に書き込んだデータのうち書き込みアドレスに対応するデータに書き込みデータを上書きする。たとえば図18(b)に示した状況においては、図18(c)に示すようにスロット番号3のデータ記憶領域に書き込まれたデータD(40)−D(7C)のうち書き込みアドレス44に対応するデータすなわち行X2および列Y2に対応するデータD(44)に書き込みデータD(44w)が上書きされる。   Next, the access control unit 120 writes the write data into the cache memory 110. Specifically, the write data is overwritten on the data corresponding to the write address among the data written in the data storage area of the largest slot number. For example, in the situation shown in FIG. 18B, it corresponds to the write address 44 among the data D (40) -D (7C) written in the data storage area of slot number 3 as shown in FIG. 18C. The data to be written, that is, the data D (44) corresponding to the row X2 and the column Y2 is overwritten with the write data D (44w).

次にアクセス制御部120は、キャッシュメモリ110内のスロット番号を付け替える。上述と同様に、最近に書き込みアクセスがあったアドレスほど小さいスロット番号が対応づけられるようにスロット番号を付け替える。たとえば図18(c)に示したような書き込みが行われた場合には、図18(d)に示すように、アドレス40およびデータD(40)−D(7C)に対応するスロット番号を1、アドレス00およびデータD(0)−D(3C)に対応するスロット番号を2、アドレス80およびデータD(80)−D(BC)に対応するスロット番号を3に付け替える。スロット番号の付け替えが終了するとステップST1205にもどる。   Next, the access control unit 120 changes the slot number in the cache memory 110. As described above, the slot number is changed so that the smaller the slot number is associated with the address that has been recently accessed for writing. For example, when writing as shown in FIG. 18C is performed, the slot number corresponding to the address 40 and the data D (40) -D (7C) is set to 1 as shown in FIG. 18D. The slot number corresponding to address 00 and data D (0) -D (3C) is changed to 2, and the slot number corresponding to address 80 and data D (80) -D (BC) is changed to 3. When the slot number replacement is completed, the process returns to step ST1205.

[ステップST1513]
アプリケーションプログラムの一連の処理が終了するとCPU40からアクセス制御部120にシステム終了信号が与えられる(ST1205)。システム終了信号を受けるとアクセス制御部120は、キャッシュメモリ110に記憶されているデータをすべて読み出し、メモリセルアレイ61の対応するアドレスに書き込む(ST1211)。またアクセス制御部120は、キャッシュメモリ110に記憶されているアドレスをすべて読み出し、不揮発性半導体メモリ60のアドレス記憶部に書き込む(書き替える)。これにより、最近に書き込みアクセスがあったアドレスにアドレス記憶部の内容が更新される。すなわち、最近に書き込みアクセスがあったアドレスが常にアドレス記憶部に記憶される。更新後のアドレス記憶部のアドレスは次回の処理において利用される。
[Step ST1513]
When a series of processing of the application program ends, a system end signal is given from the CPU 40 to the access control unit 120 (ST1205). Upon receiving the system end signal, the access control unit 120 reads all the data stored in the cache memory 110 and writes it to the corresponding address of the memory cell array 61 (ST1211). The access control unit 120 reads all addresses stored in the cache memory 110 and writes (rewrites) them to the address storage unit of the nonvolatile semiconductor memory 60. As a result, the contents of the address storage unit are updated to the address where the write access has been recently made. That is, the address that has been recently accessed for writing is always stored in the address storage unit. The updated address storage unit address is used in the next processing.

<効果>
以上のように第3の実施形態によるICカードによれば、アドレス記憶部に記憶されるアドレス(キャッシュにヒットしやすいアドレス)を動的に変えることができる。したがって、利用する人・利用するアプリケーションによって不揮発性半導体メモリ60への書き込みアクセスの状況が異なる場合にも不揮発性半導体メモリ60への書き込み回数を少なくすることができる。
<Effect>
As described above, the IC card according to the third embodiment can dynamically change the address stored in the address storage unit (the address that is likely to hit the cache). Therefore, the number of times of writing to the nonvolatile semiconductor memory 60 can be reduced even when the status of write access to the nonvolatile semiconductor memory 60 differs depending on the user and the application to be used.

また、キャッシュメモリ110のアドレス置換メカニズムによって抽出されたアドレスをアドレス記憶部に記憶させ次回の処理に利用するため、ICカードのような小さな資源の場合であっても、よくヒットするアドレスを精度よく抽出することができる。   In addition, since the address extracted by the address replacement mechanism of the cache memory 110 is stored in the address storage unit and used for the next processing, even in the case of a small resource such as an IC card, an address that hits frequently is accurately detected. Can be extracted.

なお、ここでは最近に書き込みアクセスがあったアドレスがアドレス記憶部に動的に記憶される場合について説明した。これに代えて書き込みアクセス頻度が高いアドレスがアドレス記憶部に動的に記憶されるようにしてもよい。   Here, a case has been described in which an address that has been recently accessed for writing is dynamically stored in the address storage unit. Instead of this, an address having a high write access frequency may be dynamically stored in the address storage unit.

また、アドレス記憶部は不揮発性半導体メモリ60に内蔵されているため、アドレスの書き換えが頻繁に起こると不揮発性半導体メモリ60の信頼性が低下する可能性がある。したがって、書き込みアクセス頻度の高いアドレスが比較的決まっているシステムで使用されることが望ましい。   In addition, since the address storage unit is built in the nonvolatile semiconductor memory 60, if the address is rewritten frequently, the reliability of the nonvolatile semiconductor memory 60 may be reduced. Therefore, it is desirable to use it in a system in which an address with high write access frequency is relatively determined.

(第4の実施形態)
<ICカードの構成>
この発明の第4の実施形態によるICカードの全体構成は図10に示したICカードと同様である。しかし第4の実施形態によるICカードでは、図19(a)に示すように、不揮発性半導体メモリ60のメモリセルアレイ61内のアドレス記憶部は固定アドレス記憶領域と動的アドレス記憶領域とを含む。ここではメモリセルアレイ61の行X15に対応する領域を固定アドレス記憶領域、行X16に対応する領域を動的アドレス記憶領域としている。
(Fourth embodiment)
<Configuration of IC card>
The overall configuration of the IC card according to the fourth embodiment of the present invention is the same as that of the IC card shown in FIG. However, in the IC card according to the fourth embodiment, as shown in FIG. 19A, the address storage unit in the memory cell array 61 of the nonvolatile semiconductor memory 60 includes a fixed address storage area and a dynamic address storage area. Here, an area corresponding to the row X15 of the memory cell array 61 is a fixed address storage area, and an area corresponding to the row X16 is a dynamic address storage area.

ICカードに搭載される各アプリケーションプログラムには、すべてのアプリケーションにおいて共通するプログラムの部分とアプリケーションごとに異なるプログラムの部分とが存在する。すべてのアプリケーションにおいて共通するプログラムの部分については、不揮発性半導体メモリ60への書き込みアクセス頻度の高いアドレスをあらかじめ想定することができる。このようなアドレスは、アドレス記憶部の固定アドレス記憶領域にあらかじめ書き込まれる。一方、アプリケーションごとに異なるプログラムの部分については、利用する人・利用するアプリケーションによって不揮発性半導体メモリ60への書き込みアクセスの状況が異なる。このような部分については、アドレス記憶部の動的アドレス記憶領域に記憶されるアドレス(キャッシュにヒットしやすいアドレス)を不揮発性半導体メモリ60への書き込みアクセスの状況に応じて動的に変える。   Each application program mounted on the IC card includes a program part common to all applications and a program part different for each application. As for a program portion common to all applications, an address with a high write access frequency to the nonvolatile semiconductor memory 60 can be assumed in advance. Such an address is written in advance in a fixed address storage area of the address storage unit. On the other hand, with respect to program portions that differ for each application, the status of write access to the nonvolatile semiconductor memory 60 differs depending on the person who uses it and the application used. For such a part, the address (address that is likely to hit the cache) stored in the dynamic address storage area of the address storage unit is dynamically changed according to the status of write access to the nonvolatile semiconductor memory 60.

また、第4の実施形態によるICカードでは、図19(b)に示すように、キャッシュメモリ110内部に固定アドレス領域と動的アドレス領域とが設けられている。ここではスロット番号1−3のアドレス記憶領域およびデータ記憶領域を固定アドレス領域、スロット番号4−5のアドレス記憶領域およびデータ記憶領域を動的アドレス領域としている。   Further, in the IC card according to the fourth embodiment, a fixed address area and a dynamic address area are provided in the cache memory 110 as shown in FIG. Here, the address storage area and data storage area of slot numbers 1-3 are fixed address areas, and the address storage area and data storage areas of slot numbers 4-5 are dynamic address areas.

<ICカードの動作>
次に、第4の実施形態によるICカードの動作について図20を参照しつつ説明する。ここでは、図12に示したフローチャートと異なるステップST2002,ST2009−ST2015について説明する。
<Operation of IC card>
Next, the operation of the IC card according to the fourth embodiment will be described with reference to FIG. Here, steps ST2002 and ST2009-ST2015 different from the flowchart shown in FIG. 12 will be described.

[ステップST2002]
アクセス制御部120は、不揮発性半導体メモリ60のアドレス記憶部の固定アドレス記憶領域に記憶されたアドレスを読み出しこれをキャッシュメモリ110の固定アドレス領域に書き込み、アドレス記憶部の動的アドレス記憶領域に記憶されたアドレスを読み出しこれをキャッシュメモリ110の動的アドレス領域に書き込む。
[Step ST2002]
The access control unit 120 reads the address stored in the fixed address storage area of the address storage unit of the nonvolatile semiconductor memory 60, writes the address in the fixed address area of the cache memory 110, and stores it in the dynamic address storage area of the address storage unit. The read address is read and written in the dynamic address area of the cache memory 110.

[ステップST2009]
CPU40からの書き込みアドレスとキャッシュメモリ110に記憶されているアドレスのいずれか1つとが一致するとき、アクセス制御部120は当該アドレスがキャッシュメモリ110の固定アドレス領域に記憶されているアドレスか否かを判断する。固定アドレス領域に記憶されているアドレスであるときはステップST2010にすすみ、そうでないとき、すなわちキャッシュメモリ110の動的アドレス領域に記憶されているアドレスであるときはステップST2011にすすむ。
[Step ST2009]
When the write address from the CPU 40 matches one of the addresses stored in the cache memory 110, the access control unit 120 determines whether the address is an address stored in the fixed address area of the cache memory 110. to decide. If the address is stored in the fixed address area, the process proceeds to step ST2010. If not, that is, if the address is stored in the dynamic address area of the cache memory 110, the process proceeds to step ST2011.

[ステップST2010]
アクセス制御部120は書き込みデータをキャッシュメモリ110の固定アドレス領域に書き込む。具体的には、キャッシュメモリ110の固定アドレス領域に記憶されているデータのうち当該書き込みアドレスに対応するデータに当該書き込みデータを上書きする。書き込みが終了するとステップST1205にもどる。
[Step ST2010]
The access control unit 120 writes the write data to the fixed address area of the cache memory 110. Specifically, the write data is overwritten on the data corresponding to the write address among the data stored in the fixed address area of the cache memory 110. When the writing is completed, the process returns to step ST1205.

[ステップST2011]
アクセス制御部120は書き込みデータをキャッシュメモリ110の動的アドレス領域に書き込む。具体的には、キャッシュメモリ110の動的アドレス領域に記憶されているデータのうち当該書き込みアドレスに対応するデータに当該書き込みデータが上書きされる。
[Step ST2011]
The access control unit 120 writes the write data to the dynamic address area of the cache memory 110. Specifically, the write data is overwritten on the data corresponding to the write address among the data stored in the dynamic address area of the cache memory 110.

次にアクセス制御部120は、キャッシュメモリ110の動的アドレス領域内のスロット番号を付け替える。具体的には、書き込みデータが書き込まれたスロットのスロット番号を動的アドレス領域内で最も小さいスロット番号に付け替え、残りのスロットについてはスロット番号の小さい順に、動的アドレス領域内で2番目に小さいスロット番号,3番目に小さいスロット番号,・・・に付け替える。このようにスロット番号を付け替えることにより動的アドレス領域内では、最近に書き込みアクセスがあったアドレスほど小さいスロット番号が対応づけられることになる。スロット番号の付け替えが終了するとステップST1205にもどる。   Next, the access control unit 120 changes the slot number in the dynamic address area of the cache memory 110. Specifically, the slot number of the slot in which the write data is written is changed to the smallest slot number in the dynamic address area, and the remaining slots are the second smallest in the dynamic address area in ascending order of the slot numbers. Change the slot number to the third smallest slot number. By changing the slot number in this way, in the dynamic address area, the slot number which is smaller as the address has recently been accessed for writing is associated. When the slot number replacement is completed, the process returns to step ST1205.

[ステップST2012]
CPU40からの書き込みアドレスがキャッシュメモリ110に記憶されているアドレスのいずれとも一致しないとき、アクセス制御部120はキャッシュメモリ110の動的アドレス領域に空スロットが有るか否かを判断する。キャッシュメモリ110の動的アドレス領域に空スロットがあるときはステップST2013にすすみ、空スロットがないときはステップST2014にすすむ。
[Step ST2012]
When the write address from the CPU 40 does not match any of the addresses stored in the cache memory 110, the access control unit 120 determines whether there is an empty slot in the dynamic address area of the cache memory 110. When there is an empty slot in the dynamic address area of the cache memory 110, the process proceeds to step ST2013, and when there is no empty slot, the process proceeds to step ST2014.

[ステップST2013]
キャッシュメモリ110の動的アドレス領域に空スロットがあるとき、アクセス制御部120は、書き込みアドレスに対応する行のすべてのデータ(512ビット=32ビット×16データ)を不揮発性半導体メモリ60から読み出し、空スロットのデータ記憶領域に書き込む。またアクセス制御部120は、書き込みアドレスに対応する行を示すアドレスを空スロットのアドレス記憶領域に書き込む。
[Step ST2013]
When there is an empty slot in the dynamic address area of the cache memory 110, the access control unit 120 reads all data (512 bits = 32 bits × 16 data) of the row corresponding to the write address from the nonvolatile semiconductor memory 60, Write to empty slot data storage area. The access control unit 120 writes an address indicating a row corresponding to the write address in the address storage area of the empty slot.

次に、アクセス制御部120は書き込みデータをキャッシュメモリ110に書き込む。具体的には、空スロットに書き込んだデータのうち書き込みアドレスに対応するデータに書き込みデータを上書きする。   Next, the access control unit 120 writes the write data into the cache memory 110. Specifically, the write data is overwritten on the data corresponding to the write address among the data written in the empty slot.

次にアクセス制御部120は、キャッシュメモリ110の動的アドレス領域内のスロット番号を付け替える。上述と同様に、最近に書き込みアクセスがあったアドレスほど小さいスロット番号が対応づけられるようにスロット番号を付け替える。スロット番号の付け替えが終了するとステップST1205にもどる。   Next, the access control unit 120 changes the slot number in the dynamic address area of the cache memory 110. As described above, the slot number is changed so that the smaller the slot number is associated with the address that has been recently accessed for writing. When the slot number replacement is completed, the process returns to step ST1205.

[ステップST2014]
キャッシュメモリ110の動的アドレス領域に空スロットがないとき、アクセス制御部120は、キャッシュメモリ110の動的アドレス領域内の最も大きいスロット番号のデータ記憶領域に記憶されているすべてのデータを読み出し、不揮発性半導体メモリ60の対応する行に書き込む。
[Step ST2014]
When there is no empty slot in the dynamic address area of the cache memory 110, the access control unit 120 reads all the data stored in the data storage area of the largest slot number in the dynamic address area of the cache memory 110, Write to the corresponding row of the nonvolatile semiconductor memory 60.

次にアクセス制御部120は、書き込みアドレスに対応する行のすべてのデータ(512ビット=32ビット×16データ)を不揮発性半導体メモリ60から読み出し、キャッシュメモリ110の動的アドレス領域内の最も大きいスロット番号のデータ記憶領域に書き込む。またアクセス制御部120は、書き込みアドレスに対応する行を示すアドレスを、キャッシュメモリ110の動的アドレス領域内の最も大きいスロット番号のアドレス記憶領域に書き込む。   Next, the access control unit 120 reads all data (512 bits = 32 bits × 16 data) of the row corresponding to the write address from the nonvolatile semiconductor memory 60, and the largest slot in the dynamic address area of the cache memory 110 Write to the number data storage area. Further, the access control unit 120 writes an address indicating a line corresponding to the write address in the address storage area of the largest slot number in the dynamic address area of the cache memory 110.

次に、アクセス制御部120は書き込みデータをキャッシュメモリ110に書き込む。具体的には、動的アドレス領域内の最も大きいスロット番号のデータ記憶領域に書き込んだデータのうち書き込みアドレスに対応するデータに書き込みデータを上書きする。   Next, the access control unit 120 writes the write data into the cache memory 110. Specifically, the write data is overwritten on the data corresponding to the write address among the data written in the data storage area having the largest slot number in the dynamic address area.

次にアクセス制御部120は、キャッシュメモリ110の動的アドレス領域内のスロット番号を付け替える。上述と同様に、最近に書き込みアクセスがあったアドレスほど小さいスロット番号が対応づけられるようにスロット番号を付け替える。スロット番号の付け替えが終了するとステップST1205にもどる。   Next, the access control unit 120 changes the slot number in the dynamic address area of the cache memory 110. As described above, the slot number is changed so that the smaller the slot number is associated with the address that has been recently accessed for writing. When the slot number replacement is completed, the process returns to step ST1205.

[ステップST2015]
アプリケーションプログラムの一連の処理が終了するとCPU40からアクセス制御部120にシステム終了信号が与えられる(ST1205)。システム終了信号を受けるとアクセス制御部120は、キャッシュメモリ110に記憶されているデータをすべて読み出し、メモリセルアレイ61の対応するアドレスに書き込む(ST1211)。またアクセス制御部120は、キャッシュメモリ110の動的アドレス領域に記憶されているアドレスをすべて読み出し、不揮発性半導体メモリ60のアドレス記憶部の動的アドレス記憶領域に書き込む(書き替える)。これにより、アドレス記憶部の動的アドレス記憶領域の内容が最近に書き込みアクセスがあったアドレスに更新される。すなわち、最近に書き込みアクセスがあったアドレスが常にアドレス記憶部の動的アドレス記憶領域に記憶される。更新後の動的アドレス記憶領域のアドレスは次回の処理において利用される。
[Step ST2015]
When a series of processing of the application program ends, a system end signal is given from the CPU 40 to the access control unit 120 (ST1205). Upon receiving the system end signal, the access control unit 120 reads all the data stored in the cache memory 110 and writes it to the corresponding address of the memory cell array 61 (ST1211). Further, the access control unit 120 reads all addresses stored in the dynamic address area of the cache memory 110 and writes (rewrites) them in the dynamic address storage area of the address storage unit of the nonvolatile semiconductor memory 60. As a result, the contents of the dynamic address storage area of the address storage unit are updated to the address where the write access has been recently made. That is, the address that has recently been accessed for writing is always stored in the dynamic address storage area of the address storage unit. The updated address of the dynamic address storage area is used in the next processing.

<処理の流れの例>
図21に示す太線のルートを通った場合の処理の流れを図22−図24に示す。なお、図21に示すフローチャートは図20に示したフローチャートと同じである。ここではあらかじめアドレス記憶部の固定アドレス記憶領域にアドレス00,80,2C0が記憶され、動的アドレス記憶領域に100,40が記憶されているものとする。
<Example of processing flow>
The flow of processing when the route indicated by the thick line shown in FIG. 21 is passed is shown in FIGS. The flowchart shown in FIG. 21 is the same as the flowchart shown in FIG. Here, it is assumed that addresses 00, 80, and 2C0 are stored in advance in the fixed address storage area of the address storage unit, and 100 and 40 are stored in the dynamic address storage area.

(1)(ST2002)
アドレス記憶部に記憶されているアドレスが読み出され、キャッシュメモリ110に書き込まれる。このとき、固定アドレス記憶領域に記憶されているアドレス00,80,2C0はキャッシュメモリ110の固定アドレス領域に書き込まれ、動的アドレス記憶領域に記憶されているアドレス100,40はキャッシュメモリ110の動的アドレス領域に書き込まれる。
(1) (ST2002)
The address stored in the address storage unit is read and written to the cache memory 110. At this time, addresses 00, 80, and 2C0 stored in the fixed address storage area are written into the fixed address area of the cache memory 110, and addresses 100 and 40 stored in the dynamic address storage area are stored in the cache memory 110. Written to the target address area.

(2)(ST1203)
キャッシュメモリ110に書き込まれたアドレス00,80,2C0,100,40に対応する行のデータが不揮発性半導体メモリ60から読み出され、キャッシュメモリ110に書き込まれる。
(2) (ST1203)
Data in the row corresponding to the addresses 00, 80, 2C0, 100, and 40 written in the cache memory 110 is read from the nonvolatile semiconductor memory 60 and written into the cache memory 110.

(3)(ST1207)
「アドレス44にデータ12345678を書け!」という書き込みアクセスが発生する。アクセス制御部120は、書き込みアドレス44とキャッシュメモリ110に記憶されているアドレスとを比較する。ここでは下位4ビットを無視して比較する。したがってキャッシュメモリ110の動的アドレス領域に記憶されているアドレス40と書き込みアドレス44とが一致する。
(3) (ST1207)
A write access “write data 12345678 at address 44!” Occurs. The access control unit 120 compares the write address 44 with the address stored in the cache memory 110. Here, the lower 4 bits are ignored for comparison. Therefore, the address 40 stored in the dynamic address area of the cache memory 110 matches the write address 44.

(4)(ST2011)
書き込みデータ12345678がキャッシュメモリ110に書き込まれる。
(4) (ST2011)
Write data 12345678 is written into the cache memory 110.

(5)(ST2011)
動的アドレス領域のスロット番号が付け替えられる。データが書き込まれたスロットのスロット番号が4(動的アドレス領域内でもっとも小さいスロット番号)に、アドレス100に対応するスロットのスロット番号が5に付け替えられる。
(5) (ST2011)
The slot number of the dynamic address area is changed. The slot number of the slot in which data is written is changed to 4 (the smallest slot number in the dynamic address area), and the slot number of the slot corresponding to the address 100 is changed to 5.

(6)(ST1211)
キャッシュメモリ110に記憶されているデータが読み出され、不揮発性半導体メモリ60に書き込まれる。
(6) (ST1211)
Data stored in the cache memory 110 is read and written into the nonvolatile semiconductor memory 60.

(7)(ST2015)
キャッシュメモリ110に記憶されているアドレスがアドレス記憶部に書き込まれる。固定アドレス領域に記憶されているアドレス00,80,2C0はアドレス記憶部の固定アドレス記憶領域に書き込まれ、動的アドレス領域に記憶されているアドレス40,100はアドレス記憶部の動的アドレス記憶領域に記憶される。
(7) (ST2015)
The address stored in the cache memory 110 is written into the address storage unit. Addresses 00, 80, and 2C0 stored in the fixed address area are written to the fixed address storage area of the address storage unit, and addresses 40 and 100 stored in the dynamic address area are dynamic address storage areas of the address storage unit. Is remembered.

この発明の第1の実施形態によるICカードの構成を示すブロック図である。It is a block diagram which shows the structure of the IC card by 1st Embodiment of this invention. 図1に示した不揮発性半導体メモリの内部構成を示すブロック図である。FIG. 2 is a block diagram showing an internal configuration of the nonvolatile semiconductor memory shown in FIG. 1. 図2に示したエラー訂正回路によるエラー検出およびエラー訂正処理を説明するための図である。FIG. 3 is a diagram for explaining error detection and error correction processing by the error correction circuit shown in FIG. 2. 図1に示したICカードの動作を説明するためのタイミングチャートである。4 is a timing chart for explaining the operation of the IC card shown in FIG. 1. 不揮発性半導体メモリの診断手順を示すフローチャートである。It is a flowchart which shows the diagnostic procedure of a non-volatile semiconductor memory. (a)は、不揮発性メモリの診断におけるデータの読み出し順序を示す図である。(b)は、不揮発性メモリの診断動作を説明するためのタイミングチャートである。(A) is a figure which shows the reading order of the data in the diagnosis of a non-volatile memory. (B) is a timing chart for explaining the diagnostic operation of the nonvolatile memory. 検査回路のデータ処理部に記憶されるアドレス・データ・エラー訂正情報の一例を示す図である。It is a figure which shows an example of the address data error correction information memorize | stored in the data processing part of a test | inspection circuit. 修復動作を説明するためのタイミングチャートである。It is a timing chart for explaining restoration operation. (a)−(c)は、この発明の第1の実施形態の変形例におけるデータの読み出し順序を示す図である。(A)-(c) is a figure which shows the reading order of the data in the modification of the 1st Embodiment of this invention. この発明の第2の実施形態によるICカードの構成を示すブロック図である。It is a block diagram which shows the structure of the IC card by 2nd Embodiment of this invention. 図10に示した不揮発性半導体メモリのメモリセルアレイを示す図である。It is a figure which shows the memory cell array of the non-volatile semiconductor memory shown in FIG. 図10に示したICカードの動作を説明するためのフローチャートである。It is a flowchart for demonstrating operation | movement of the IC card shown in FIG. (a)−(c)は、キャッシュメモリに記憶されるアドレスおよびデータの対応関係を示す図である。(A)-(c) is a figure which shows the correspondence of the address and data which are stored in a cache memory. 書き込みアドレスとキャッシュメモリに記憶されたアドレスとの比較の一例を示す図である。It is a figure which shows an example of a comparison with a write address and the address memorize | stored in the cache memory. この発明の第3の実施形態によるICカードの動作を説明するためのフローチャートである。It is a flowchart for demonstrating operation | movement of the IC card by 3rd Embodiment of this invention. (a)−(b)は、キャッシュメモリに記憶されるアドレスおよびデータの対応関係を示す図である。(A)-(b) is a figure which shows the correspondence of the address and data which are stored in a cache memory. (a)−(d)は、キャッシュメモリに記憶されるアドレスおよびデータの対応関係を示す図である。(A)-(d) is a figure which shows the correspondence of the address and data which are stored in a cache memory. (a)−(d)は、キャッシュメモリに記憶されるアドレスおよびデータの対応関係を示す図である。(A)-(d) is a figure which shows the correspondence of the address and data which are stored in a cache memory. (a)は、アドレス記憶部の固定アドレス記憶領域および動的アドレス記憶領域を示す図である。(b)は、キャッシュメモリ内の固定アドレス領域および動的アドレス領域を示す図である。(A) is a figure which shows the fixed address storage area and dynamic address storage area of an address storage part. (B) is a diagram showing a fixed address area and a dynamic address area in the cache memory. この発明の第4の実施形態によるICカードの動作を説明するためのフローチャートである。It is a flowchart for demonstrating operation | movement of the IC card by 4th Embodiment of this invention. 処理の流れの一例を説明するための図である。It is a figure for demonstrating an example of the flow of a process. 処理の流れの一例を説明するための図である。It is a figure for demonstrating an example of the flow of a process. 処理の流れの一例を説明するための図である。It is a figure for demonstrating an example of the flow of a process. 処理の流れの一例を説明するための図である。It is a figure for demonstrating an example of the flow of a process.

符号の説明Explanation of symbols

1,100 LSIチップ(半導体集積回路装置)
30 検査回路
40 CPU
60 不揮発性半導体メモリ
110 キャッシュメモリ
120 アクセス制御部。
1,100 LSI chip (semiconductor integrated circuit device)
30 inspection circuit 40 CPU
60 Nonvolatile semiconductor memory 110 Cache memory 120 Access control unit.

Claims (11)

不揮発性半導体メモリと、
前記不揮発性半導体メモリを診断する検査回路とを備え、
前記不揮発性半導体メモリは、
行および列に複数の読み出し単位に分割されたメモリセルアレイと、
前記複数の読み出し単位の各々に書き込むべきデータのエラー訂正符号化を行い、前記複数の読み出し単位の各々から読み出されたデータのエラー検出およびエラー訂正を行うエラー訂正回路とを含み、
前記検査回路は、
前記メモリセルアレイの各行から一の読み出し単位のデータを読み出すように指示する第1の指示を前記不揮発性半導体メモリに与え、
前記第1の指示に従って読み出されたデータのエラーが前記エラー訂正回路によって検出されると、当該エラーが検出されたデータに対応する行のすべての読み出し単位のデータを読み出すように指示する第2の指示を前記不揮発性半導体メモリに与える
ことを特徴とする半導体集積回路装置。
Non-volatile semiconductor memory;
An inspection circuit for diagnosing the nonvolatile semiconductor memory,
The nonvolatile semiconductor memory is
A memory cell array divided into a plurality of read units in rows and columns;
An error correction circuit that performs error correction encoding of data to be written to each of the plurality of read units, and performs error detection and error correction of data read from each of the plurality of read units,
The inspection circuit includes:
Providing the nonvolatile semiconductor memory with a first instruction for instructing to read data in one read unit from each row of the memory cell array;
When an error in data read in accordance with the first instruction is detected by the error correction circuit, a second instruction is issued to read out data in all read units in a row corresponding to the data in which the error is detected. Is given to the nonvolatile semiconductor memory.
請求項1に記載の半導体集積回路装置において、
前記検査回路は、
前記第2の指示に従って読み出されたデータのうち前記エラー訂正回路によってエラーが検出されなかったデータがあるとき、前記第2の指示に従って読み出されたデータのうち前記エラー訂正回路によってエラーが検出されたデータを再書き込みするように指示する第3の指示を前記不揮発性半導体メモリに与える
ことを特徴とする半導体集積回路装置。
The semiconductor integrated circuit device according to claim 1,
The inspection circuit includes:
When there is data in which no error is detected by the error correction circuit among the data read according to the second instruction, an error is detected by the error correction circuit among data read according to the second instruction. 3. A semiconductor integrated circuit device, wherein a third instruction for instructing to rewrite the written data is given to the nonvolatile semiconductor memory.
請求項1に記載の半導体集積回路装置において、
前記検査回路は、
前記第2の指示に従って読み出されたデータのすべてにおいて前記エラー訂正回路によってエラーが検出されたとき、異常を示す信号を出力する
ことを特徴とする半導体集積回路装置。
The semiconductor integrated circuit device according to claim 1,
The inspection circuit includes:
A semiconductor integrated circuit device, wherein an error signal is output when an error is detected by the error correction circuit in all of the data read in accordance with the second instruction.
請求項1に記載の半導体集積回路装置において、
前記検査回路は、
前記メモリセルアレイの領域のうち不良発生頻度が高いと予想される領域の読み出し単位のデータを読み出すように前記第1の指示を与える
ことを特徴とする半導体集積回路装置。
The semiconductor integrated circuit device according to claim 1,
The inspection circuit includes:
2. The semiconductor integrated circuit device according to claim 1, wherein the first instruction is given so as to read out data in a reading unit in an area of the memory cell array which is expected to have a high defect occurrence frequency.
請求項1に記載の半導体集積回路装置において、
前記検査回路は、
行ごとに異なる列に対応する読み出し単位のデータを読み出すように前記第1の指示を与える
ことを特徴とする半導体集積回路装置。
The semiconductor integrated circuit device according to claim 1,
The inspection circuit includes:
The semiconductor integrated circuit device according to claim 1, wherein the first instruction is given so as to read data in a reading unit corresponding to a different column for each row.
請求項1に記載の半導体集積回路装置において、
前記検査回路は、
前記メモリセルアレイの一の列に対応する読み出し単位のデータを読み出すように前記第1の指示を与え、
前記一の列は、前記第1の指示が与えられるたびに異なる
ことを特徴とする半導体集積回路装置。
The semiconductor integrated circuit device according to claim 1,
The inspection circuit includes:
Giving the first instruction to read data in a reading unit corresponding to one column of the memory cell array;
The semiconductor integrated circuit device according to claim 1, wherein the one column is different every time the first instruction is given.
請求項1に記載の半導体集積回路装置において、
CPUをさらに備え、
前記検査回路は、
前記不揮発性半導体メモリの診断が終了した後に、前記CPUを起動させるための信号を前記CPUに与える
ことを特徴とする半導体集積回路装置。
The semiconductor integrated circuit device according to claim 1,
A CPU,
The inspection circuit includes:
A semiconductor integrated circuit device, wherein after the diagnosis of the nonvolatile semiconductor memory is completed, a signal for starting the CPU is given to the CPU.
請求項7に記載の半導体集積回路装置において、
前記検査回路は、
前記第2の指示に従って読み出されたデータのすべてにおいて前記エラー訂正回路によってエラーが検出されたとき、異常を示す信号を前記CPUに与える
ことを特徴とする半導体集積回路装置。
The semiconductor integrated circuit device according to claim 7,
The inspection circuit includes:
A semiconductor integrated circuit device, wherein an error signal is given to the CPU when an error is detected by the error correction circuit in all of the data read in accordance with the second instruction.
請求項8に記載の半導体集積回路装置において、
前記CPUは、
前記検査回路からの異常を示す信号に応答して起動を停止する
ことを特徴とする半導体集積回路。
The semiconductor integrated circuit device according to claim 8.
The CPU
A semiconductor integrated circuit characterized in that the activation is stopped in response to a signal indicating an abnormality from the inspection circuit.
請求項1から請求項9のいずれか1つに記載の半導体集積回路装置を備える
ことを特徴とするICカード。
An IC card comprising the semiconductor integrated circuit device according to any one of claims 1 to 9.
不揮発性半導体メモリを診断する検査装置であって、
前記不揮発性半導体メモリは、
行および列に複数の読み出し単位に分割されたメモリセルアレイと、
前記複数の読み出し単位の各々に書き込むべきデータのエラー訂正符号化を行い、前記複数の読み出し単位の各々から読み出されたデータのエラー検出およびエラー訂正を行うエラー訂正回路とを含み、
前記検査装置は、
前記メモリセルアレイの各行から一の読み出し単位のデータを読み出すように指示する第1の指示を前記不揮発性半導体メモリに与え、
前記第1の指示に従って読み出されたデータのエラーが前記エラー訂正回路によって検出されると、当該エラーが検出されたデータに対応する行のすべての読み出し単位のデータを読み出すように指示する第2の指示を前記不揮発性半導体メモリに与える
ことを特徴とする検査装置。
An inspection device for diagnosing nonvolatile semiconductor memory,
The nonvolatile semiconductor memory is
A memory cell array divided into a plurality of read units in rows and columns;
An error correction circuit that performs error correction encoding of data to be written to each of the plurality of read units, and performs error detection and error correction of data read from each of the plurality of read units,
The inspection device includes:
Providing the nonvolatile semiconductor memory with a first instruction for instructing to read data in one read unit from each row of the memory cell array;
When an error in data read in accordance with the first instruction is detected by the error correction circuit, a second instruction is issued to read out data in all read units in a row corresponding to the data in which the error is detected. Is given to the nonvolatile semiconductor memory.
JP2007312881A 2007-12-03 2007-12-03 Semiconductor integrated circuit device, IC card and inspection device Expired - Fee Related JP4359327B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2007312881A JP4359327B2 (en) 2007-12-03 2007-12-03 Semiconductor integrated circuit device, IC card and inspection device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2007312881A JP4359327B2 (en) 2007-12-03 2007-12-03 Semiconductor integrated circuit device, IC card and inspection device

Related Parent Applications (1)

Application Number Title Priority Date Filing Date
JP2002031620A Division JP2003234000A (en) 2002-02-08 2002-02-08 Semiconductor integrated circuit device, ic card, and test device

Publications (2)

Publication Number Publication Date
JP2008071490A true JP2008071490A (en) 2008-03-27
JP4359327B2 JP4359327B2 (en) 2009-11-04

Family

ID=39292922

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2007312881A Expired - Fee Related JP4359327B2 (en) 2007-12-03 2007-12-03 Semiconductor integrated circuit device, IC card and inspection device

Country Status (1)

Country Link
JP (1) JP4359327B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105575437A (en) * 2014-10-10 2016-05-11 上海华虹集成电路有限责任公司 Smart card EEPROM test method
CN108369818A (en) * 2016-03-09 2018-08-03 华为技术有限公司 A kind of method for refreshing and device of flash memory device
EP3379541A1 (en) * 2017-03-21 2018-09-26 Renesas Electronics Corporation Semiconductor device and diagnostic method therefor

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN105575437A (en) * 2014-10-10 2016-05-11 上海华虹集成电路有限责任公司 Smart card EEPROM test method
CN108369818A (en) * 2016-03-09 2018-08-03 华为技术有限公司 A kind of method for refreshing and device of flash memory device
JP2019512116A (en) * 2016-03-09 2019-05-09 ホアウェイ・テクノロジーズ・カンパニー・リミテッド Method and apparatus for refreshing flash memory devices
US10796774B2 (en) 2016-03-09 2020-10-06 Huawei Technologies Co., Ltd. Method and apparatus for refreshing flash memory device
CN108369818B (en) * 2016-03-09 2024-01-30 华为技术有限公司 Flash memory device refreshing method and device
EP3379541A1 (en) * 2017-03-21 2018-09-26 Renesas Electronics Corporation Semiconductor device and diagnostic method therefor
US10580513B2 (en) 2017-03-21 2020-03-03 Renesas Electronics Corporation Semiconductor device and diagnostic method therefor

Also Published As

Publication number Publication date
JP4359327B2 (en) 2009-11-04

Similar Documents

Publication Publication Date Title
CN101369453B (en) Flash memory device and method of controlling flash memory device
CN112331253B (en) Chip testing method, terminal and storage medium
US8208325B2 (en) Semiconductor device, semiconductor package and memory repair method
US7565579B2 (en) Post (power on self test) debug system and method
US8201037B2 (en) Semiconductor integrated circuit and method for controlling semiconductor integrated circuit
KR100319733B1 (en) Non-volatile semiconductor memory ic and method of burn-in test of the same
US6922649B2 (en) Multiple on-chip test runs and repairs for memories
US20060253723A1 (en) Semiconductor memory and method of correcting errors for the same
US8977912B2 (en) Method and apparatus for repairing memory
US8667348B2 (en) Data writing method for non-volatile memory module and memory controller and memory storage apparatus using the same
US20060253764A1 (en) Computer system and method for redundancy repair of memories installed in computer system
JP2007004955A (en) Nonvolatile semiconductor memory device
JP2009181425A (en) Memory module
JP4359327B2 (en) Semiconductor integrated circuit device, IC card and inspection device
KR100825068B1 (en) Built in self test and built in self repair system
US9818494B2 (en) Operation recording circuit and operation method thereof
JP2003234000A (en) Semiconductor integrated circuit device, ic card, and test device
CN115691632A (en) Test control system and method
JP2005050393A (en) Semiconductor device and its failure detection method
JP2007058450A (en) Semiconductor integrated circuit
CN109215724A (en) The method and device of memory automatic detection and rehabilitation
CN112908401A (en) Memory repair circuit, memory module and memory repair method
JP2005050442A (en) Redundant memory circuit
JP2004145964A (en) Semiconductor memory, semiconductor memory manufacturing method, memory card, and method of controlling semiconductor memory
US8527820B2 (en) Semiconductor device and test method thereof

Legal Events

Date Code Title Description
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: 20090714

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20090807

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120814

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Free format text: JAPANESE INTERMEDIATE CODE: R150

LAPS Cancellation because of no payment of annual fees