FR3051575A1 - ERASING MANAGEMENT IN A FLASH MEMORY - Google Patents

ERASING MANAGEMENT IN A FLASH MEMORY Download PDF

Info

Publication number
FR3051575A1
FR3051575A1 FR1654492A FR1654492A FR3051575A1 FR 3051575 A1 FR3051575 A1 FR 3051575A1 FR 1654492 A FR1654492 A FR 1654492A FR 1654492 A FR1654492 A FR 1654492A FR 3051575 A1 FR3051575 A1 FR 3051575A1
Authority
FR
France
Prior art keywords
page
block
data
pages
memory
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Withdrawn
Application number
FR1654492A
Other languages
French (fr)
Inventor
Michel Dawirs
Jean-Louis Modave
Michael Peeters
Guillaume Docquier
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.)
Proton World International NV
Original Assignee
Proton World International NV
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 Proton World International NV filed Critical Proton World International NV
Priority to FR1654492A priority Critical patent/FR3051575A1/en
Publication of FR3051575A1 publication Critical patent/FR3051575A1/en
Withdrawn legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0238Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory
    • G06F12/0246Memory management in non-volatile memory, e.g. resistive RAM or ferroelectric memory in block erasable memory, e.g. flash memory
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7204Capacity control, e.g. partitioning, end-of-life degradation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7205Cleaning, compaction, garbage collection, erase control
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2212/00Indexing scheme relating to accessing, addressing or allocation within memory systems or architectures
    • G06F2212/72Details relating to flash memory management
    • G06F2212/7207Details relating to flash memory management management of metadata or control data

Abstract

L'invention concerne un procédé de gestion d'une mémoire flash, dans lequel : la mémoire est organisée en pages (P1) ; et chaque page contient un mot de métadonnées (PMD1(6)) destiné à stoker un nombre d'effacements de la page.The invention relates to a method for managing a flash memory, wherein: the memory is organized in pages (P1); and each page contains a metadata word (PMD1 (6)) for storing a number of deletions of the page.

Description

GESTION DE L'EFFACEMENT DANS UNE MEMDIEE FLASHERASING MANAGEMENT IN A FLASH MEMORY

DomaineField

La présente description concerne de façon générale les circuits électroniques et, plus particulièrement, les circuits exploitant une mémoire flash. La présente description vise plus particulièrement la gestion d'une mémoire flash.The present description generally relates to electronic circuits and, more particularly, circuits using a flash memory. The present description aims more particularly at managing a flash memory.

Exposé de l'art antérieurPresentation of the prior art

Les mémoires flash sont de plus en plus utilisées dans des microcontrôleurs pour stocker de façon non volatile des informations.Flash memories are increasingly used in microcontrollers for nonvolatile storage of information.

Le stockage de données dans une mémoire flash présente diverses contraintes temporelles liées à la granularité des opérations réalisées, l'écriture s'effectuant par mot (par exemple, par mot de quatre octets) tandis que l'effacement s'effectue par page de plusieurs mots (quelques dizaines à quelques centaines de mots).The storage of data in a flash memory presents various temporal constraints related to the granularity of the operations carried out, the writing being carried out by word (for example, by word of four bytes) while the erasure is carried out by page of several words (a few tens to a few hundred words).

Dans certaines applications, on souhaite s'assurer que les transactions réalisées et stockées respectent un critère d'atomicité. L'atomicité d'une transaction correspond à s'assurer que des données stockées en mémoire présentent bien un état exploitable et intègre. Cela revient à s'assurer que des données en mémoire non volatile présentent soit l'état avant la transaction soit l'état après la transaction concernée mais qu'elles ne présentent pas un état intermédiaire.In certain applications, it is desired to ensure that the transactions carried out and stored comply with an atomicity criterion. The atomicity of a transaction is to ensure that data stored in memory has an exploitable state and integrity. This is to ensure that data in non-volatile memory have either the state before the transaction or the state after the transaction concerned but they do not have an intermediate state.

La gestion de l'atomicité des transactions est particulièrement utilisée dans des applications où une interruption de l'alimentation du circuit ou l'apparition d'une perturbation accidentelle ou volontaire peut engendrer le stockage de données dans un état les rendant soit inexploitables par la suite soit vulnérables du point de \me de la confidentialité ou de leur intégrité. Par exemple, dans le domaine des cartes à microcircuit, on souhaite s'assurer qu'en cas d'arrachement (tearing) volontaire ou accidentel d'une carte du lecteur dans laquelle elle se trouve, les informations contenues dans une mémoire flash de la carte soient fiables. Dans un circuit intégrant un module de sécurité, l'équivalent de l'arrachement correspond à une coupure de l'alimentation du circuit. RésuméTransaction Atomicity Management is particularly used in applications where an interruption of circuit power or the occurrence of accidental or deliberate disruption can result in the storage of data in a state rendering it unusable thereafter are vulnerable to the point of confidentiality or their integrity. For example, in the field of microcircuit cards, it is desired to ensure that in case of accidental or accidental tearing of a card of the reader in which it is located, the information contained in a flash memory of the map are reliable. In a circuit incorporating a security module, the equivalent of the tearing out corresponds to a power failure of the circuit. summary

Il existe un besoin d'améliorer la gestion du stockage d'informations dans une mémoire flash, en particulier pour préserver le caractère atomique de certaines transactions impliquant une mise à jour de données dans la mémoire flash.There is a need to improve the management of information storage in flash memory, particularly to preserve the atomic character of certain transactions involving a data update in the flash memory.

Un mode de réalisation pallie tout ou partie des inconvénients des techniques connues de gestion d'une mémoire flash.One embodiment overcomes all or part of the disadvantages of known techniques for managing a flash memory.

Un mode de réalisation d'un premier aspect facilite la gestion d'atomicité des transactions dans une mémoire flash.An embodiment of a first aspect facilitates atomicity management of transactions in a flash memory.

Un mode de réalisation d'un deuxième aspect équilibre l'effacement des pages d'une mémoire flash.An embodiment of a second aspect balances the deletion of the pages of a flash memory.

Ainsi, un mode de réalisation du premier aspect prévoit un procédé de gestion d'une mémoire flash, dans lequel : les données à stocker sont organisées en blocs logiques ; la mémoire est divisée en pages / chaque page est divisée en trames, chaque trame pouvant contenir au moins un bloc de données et au moins deux mots de métadonnées de trame / chaque page comporte au moins un mot de métadonnées de page qui contient, lorsqu'une page est écrite, une valeur d'un compteur de nombre de pages écrites / une écriture d'un bloc logique dans la mémoire s'accompagne d'une programmation d'un premier mot de métadonnées de trame avec un identifiant de ce bloc logique ; et la page dans laquelle procéder à l'écriture est choisie comme étant celle dont le premier mot de métadonnées contient la valeur maximum du compteur de pages écrites parmi toutes les pages.Thus, an embodiment of the first aspect provides a method for managing a flash memory, wherein: the data to be stored is organized into logical blocks; the memory is divided into pages / each page is divided into frames, each frame may contain at least one data block and at least two frame metadata words / each page has at least one page metadata word which contains, when a page is written, a value of a count of the number of pages written / a writing of a logical block in the memory is accompanied by a programming of a first frame metadata word with an identifier of this logical block ; and the page in which to write is selected as the one whose first metadata word contains the maximum value of the page counter written among all the pages.

Selon un mode de réalisation, les trames sont écrites séquentiellement dans une page.According to one embodiment, the frames are written sequentially in a page.

Selon un mode de réalisation, le premier mot de métadonnées de trame contient également une valeur représentative d'un code de contrôle d'erreur calculé au moins à partir du bloc de données de la trame.According to one embodiment, the first frame metadata word also contains a value representative of an error control code calculated at least from the data block of the frame.

Selon un mode de réalisation, lors de l'écriture d'une trame, un deuxième mot de métadonnées de trame est écrit en premier avec une valeur, indépendante du contenu de la donnée à écrire et qui est toujours la même pour une trame donnée.According to one embodiment, when writing a frame, a second frame metadata word is written first with a value, independent of the content of the data to be written and which is always the same for a given frame.

Selon un mode de réalisation, ledit deuxième mot de métadonnées a une valeur fixe pour toutes les trames de la mémoire.According to one embodiment, said second metadata word has a fixed value for all the frames of the memory.

Selon un mode de réalisation, ledit premier mot de métadonnées de page est écrit avant écriture d'une première trame dans la page.According to one embodiment, said first page metadata word is written before writing a first frame in the page.

Selon un mode de réalisation, une lecture d'un bloc de données logique comporte les étapes de : rechercher la dernière trame écrite dont l'identifiant de bloc correspond à celui du bloc logique ; vérifier que l'écriture des données dans cette dernière trame respecte un code de contrôle d'erreur et, si ce n'est pas le cas, rechercher la précédente trame écrite dont l'identifiant de bloc correspond à celui du bloc de données logique jusqu'à avoir parcouru toutes les pages.According to one embodiment, a reading of a logical data block comprises the steps of: searching for the last written frame whose block identifier corresponds to that of the logical block; check that the writing of the data in the latter frame respects an error control code and, if it is not the case, search the previous written frame whose block identifier corresponds to that of the logical data block up to 'to have gone through all the pages.

Selon un mode de réalisation, un circuit de gestion de la mémoire effectue, à chaque démarrage, une vérification d'atomicité de la dernière trame écrite.According to one embodiment, a memory management circuit performs, at each start, an atomicity check of the last written frame.

Selon un mode de réalisation, en cas de défaut d'atomicité, toutes les trames valides de la page courante sont transférées dans une page disponible et la page courante est effacée.According to one embodiment, in case of atomicity defect, all the valid frames of the current page are transferred to an available page and the current page is erased.

Selon un mode de réalisation, ladite page disponible est une page dédiée.According to one embodiment, said available page is a dedicated page.

Un mode de réalisation de ce premier aspect prévoit également une mémoire flash, programmée conformément au procédé ci-dessus.An embodiment of this first aspect also provides a flash memory, programmed according to the above method.

Un mode de réalisation de ce premier aspect prévoit également un circuit électronique comportant une mémoire flash.An embodiment of this first aspect also provides an electronic circuit comprising a flash memory.

Un mode de réalisation du deuxième aspect prévoit un procédé de gestion d'une mémoire flash, dans lequel : la mémoire est organisée en pages ; et chaque page contient un mot de métadonnées destiné à stoker un nombre d'effacements de la page.An embodiment of the second aspect provides a method of managing a flash memory, wherein: the memory is organized into pages; and each page contains a metadata word for storing a number of deletions of the page.

Selon un mode de réalisation, la sélection d'une page à effacer pour libérer de l'espace s'effectue en fonction du nombre d'effacements subis par les différentes pages afin d'uniformiser le nombre d'effacement subis par chaque page.According to one embodiment, the selection of a page to be erased to free space is effected according to the number of erasures suffered by the different pages in order to standardize the number of erasure suffered by each page.

Selon un mode de réalisation : les données à stocker sont organisées en blocs logiques ; la mémoire est divisée en pages ; chaque page est divisée en trames, chaque trame pouvant contenir au moins un bloc de données et au moins deux mots de métadonnées de trame ; chaque page comporte au moins un mot de métadonnées de page qui contient, lorsqu'une page est écrite, une valeur d'un compteur de nombre de pages écrites ; une écriture d'un bloc logique dans la mémoire s'accompagne d'une programmation d'un premier mot de métadonnées de trame avec un identifiant de ce bloc logique / et la page dans laquelle procéder à l'écriture est choisie comme étant celle dont le premier mot de métadonnées contient la valeur maximum du compteur de pages écrites parmi toutes les pages.According to one embodiment: the data to be stored are organized in logical blocks; the memory is divided into pages; each page is divided into frames, each frame may contain at least one data block and at least two frame metadata words; each page has at least one page metadata word which contains, when a page is written, a value of a counter of the number of pages written; a writing of a logic block in the memory is accompanied by a programming of a first frame metadata word with an identifier of this logical block / and the page in which to write is chosen as the one of which the first metadata word contains the maximum value of the page counter written among all the pages.

Un mode de réalisation de ce deuxième aspect prévoit également une mémoire flash, programmée conformément au procédé ci-dessus.An embodiment of this second aspect also provides a flash memory, programmed according to the above method.

Un mode de réalisation de ce deuxième aspect prévoit également un circuit électronique comportant une mémoire flash telle que ci-dessus.An embodiment of this second aspect also provides an electronic circuit comprising a flash memory as above.

Brève description des dessinsBrief description of the drawings

Ces caractéristiques et avantages, ainsi que d'autres, seront exposés en détail dans la description suivante de modes de réalisation particuliers faite à titre non limitatif en relation avec les figures jointes parmi lesquelles : la figure 1 représente, de façon très schématique et sous forme de blocs, un mode de réalisation d'un circuit électronique du type auquel d'appliquent, à titre d'exemple, les modes de réalisation qui vont être décrits ; la figure 2 illustre un mode de réalisation d'une organisation logique de données à stocker dans une mémoire flash ; la figure 3 illustre un mode de réalisation d'une organisation physique de données dans une mémoire flash ; la figure 4 illustre, de façon très schématique, un mode de réalisation d'une structure de trame de la mémoire de la figure 3 / la figure 5 est un schéma-blocs illustrant un mode de réalisation d'une écriture d'une donnée dans la mémoire / la figure 6 est un schéma-blocs illustrant un mode de réalisation d'une préparation d'une page suivante pour écriture quand une page courante est pleine / la figure 7 est un schéma-blocs illustrant un mode de réalisation d'une lecture d'une donnée dans la mémoire ; la figure 8 est un schéma-blocs illustrant un mode de réalisation d'une récupération d'atomicité au niveau d'une page ; et la figure 9 est un schéma-blocs illustrant un mode de réalisation d'une sélection d'une page à effacer selon le deuxième aspect.These and other features and advantages will be set forth in detail in the following description of particular embodiments made without implied limitation in relation to the appended figures in which: FIG. 1 is very schematically and in form blocks, an embodiment of an electronic circuit of the type to which apply, by way of example, the embodiments that will be described; FIG. 2 illustrates an embodiment of a logical organization of data to be stored in a flash memory; FIG. 3 illustrates an embodiment of a physical organization of data in a flash memory; FIG. 4 very schematically illustrates an embodiment of a frame structure of the memory of FIG. 3; FIG. 5 is a block diagram illustrating an embodiment of a writing of a piece of data in FIG. The memory / FIG. 6 is a block diagram illustrating an embodiment of a preparation of a next page for writing when a current page is full. FIG. 7 is a block diagram illustrating an embodiment of a block. reading a data in the memory; Fig. 8 is a block diagram illustrating an embodiment of page-level atomic recovery; and Fig. 9 is a block diagram illustrating an embodiment of selecting a page to be erased according to the second aspect.

Description détailléedetailed description

De mêmes éléments ont été désignés par de mêmes références aux différentes figures.The same elements have been designated with the same references in the various figures.

Par souci de clarté, seuls les étapes et éléments utiles à la compréhension des modes de réalisation qui vont être décrits ont été représentés et seront détaillés. En particulier, le fonctionnement électrique d'une mémoire flash lors des étapes d'écriture, de lecture et d'effacement n'a pas été détaillé, les modes de réalisation décrits étant compatibles avec les technologies usuelles des mémoires flash. De plus, les applications utilisant une gestion d'atomicité n'ont pas non plus été détaillées, les modes de réalisation décrits étant, là encore, compatibles avec les applications usuelles.For the sake of clarity, only the steps and elements useful for understanding the embodiments that will be described have been shown and will be detailed. In particular, the electrical operation of a flash memory during the steps of writing, reading and erasing has not been detailed, the embodiments described being compatible with the usual technologies of flash memories. In addition, the applications using atomicity management have also not been detailed, the embodiments described being, again, compatible with the usual applications.

La figure 1 représente, de façon très schématique et sous forme de blocs, un mode de réalisation d'un circuit électronique 1 du type auquel d'appliquent, à titre d'exemple, les modes de réalisation qui vont être décrits.FIG. 1 very schematically shows in the form of blocks an embodiment of an electronic circuit 1 of the type to which, by way of example, the embodiments which will be described will be applied.

Le circuit 1 comporte : une unité de traitement 11 (PU), par exemple une machine d'états, un microprocesseur, un circuit logique programmable, etc. ; une ou plusieurs zones 12 (RAM) de stockage volatil, par exemple de type mémoire RAM ou registres, pour stocker temporairement des informations (instructions, adresses, données) pendant les traitements / une ou plusieurs zones de stockage non volatil, dont au moins une mémoire 2 de type flash (FLASH) pour stocker des informations de façon durable et en particulier quand le circuit n'est pas alimenté ; un ou plusieurs bus 14 de données, d'adresses et/ou de commandes entre les différents éléments internes au circuit 1 ; et une interface d'entrée-sortie 15 (I/O) de communication, par exemple de type bus série, avec l'extérieur du circuit 1.The circuit 1 comprises: a processing unit 11 (PU), for example a state machine, a microprocessor, a programmable logic circuit, etc. ; one or more volatile storage areas 12 (RAM), for example of the RAM or registers type, for temporarily storing information (instructions, addresses, data) during the processes / one or more non-volatile storage areas, of which at least one flash memory 2 (FLASH) for storing information in a durable manner and in particular when the circuit is not powered; one or more buses 14 of data, addresses and / or commands between the various elements internal to the circuit 1; and an input-output interface (I / O) for communication, for example of the serial bus type, with the outside of the circuit 1.

Le cas échéant, le circuit 1 intègre également un circuit 16 de communication sans contact (CLF - ContactLess Front-end) , de type communication en champ proche (Near Field Communication - NFC).If necessary, the circuit 1 also integrates a contactless communication circuit 16 (CLF - ContactLess Front-end), Near Field Communication (NFC) type.

Par ailleurs, le circuit 1 peut intégrer d'autres fonctions, symbolisées par un bloc 17 (FCT), selon l'application, par exemple, un crypto-processeur, d'autres interfaces, d'autres mémoires, etc.Furthermore, the circuit 1 can integrate other functions, symbolized by a block 17 (FCT), depending on the application, for example, a crypto-processor, other interfaces, other memories, etc.

La gestion de 1 ' atomicité des transactions dans un circuit équipé d'une mémoire flash est particulière car la mémoire flash de présente pas la même granularité de traitement selon le type d'opération. En particulier, l'écriture s'effectue par mot (d'un octet ou de quelques octets) tandis que l'effacement s'effectue par page. La taille d'un mot correspond généralement à la taille d'un registre recevant les données en série pour les transférer en parallèle au plan mémoire pour écriture. Une page est définie comme la taille minimale susceptible d'être adressée simultanément pour effacement. Typiquement, une page représente, dans une mémoire flash, 64, 128, 256, 512 ou 1024 octets.The management of the atomicity of transactions in a circuit equipped with a flash memory is particular because the flash memory does not have the same processing granularity depending on the type of operation. In particular, the writing is done by word (one byte or a few bytes) while the erasure is per page. The size of a word generally corresponds to the size of a register receiving the serial data to transfer them in parallel to the write memory plane. A page is defined as the minimum size that can be addressed simultaneously for deletion. Typically, a page represents, in a flash memory, 64, 128, 256, 512 or 1024 bytes.

Une mémoire flash se programme, à partir d'un état initial, désigné arbitrairement 1, vers des états 0 (états non conducteurs des cellules). Cela signifie que les cellules de la mémoire doivent être initialisées à un état haut (effacement) et que, pour stocker une donnée (écriture), on intervient (programmation à 0) ou pas (état du bit à 1) sur les états des bits par mot de données.A flash memory is programmed, from an initial state, designated arbitrarily 1, to states 0 (non-conductive states of the cells). This means that the cells of the memory must be initialized to a high state (erasure) and that, to store data (write), one intervenes (programming with 0) or not (state of the bit with 1) on the states of the bits by data word.

Afin de garantir l'atomicité des transactions, le stockage en mémoire flash d'une donnée ne doit être considéré comme valide qu'une fois que la transaction est terminée et que les données sont dites stables. En pratique, les procédés de gestion d'atomicité activent un indicateur de traitement d'une donnée lorsque celle-ci est extraite de la mémoire non volatile, puis organisent le stockage de la donnée mise à jour, une fois le traitement terminé, l'indicateur de traitement changeant alors d'état. L'atomicité peut concerner une quantité plus ou moins importante de données selon la nature de la transaction.In order to guarantee the atomicity of the transactions, the flash storage of a piece of data must only be considered valid once the transaction is over and the data is said to be stable. In practice, the atomicity management methods activate a data processing indicator when it is extracted from the non-volatile memory, then organize the storage of the updated data, once the processing is completed, the processing indicator then changing state. Atomicity can concern a larger or smaller amount of data depending on the nature of the transaction.

Le caractère atomique des transactions est particulièrement important dans le cas de transactions de type bancaire (paiement par exemple) où il est nécessaire de s'assurer que 1'information stockée dans la mémoire flash, par exemple le solde d'un porte-monnaie électronique ou d'une autorisation d'achat, ou l'identifiant validant une transaction, est stocké de façon fiable. Généralement pour garantir l'atomicité d'une transaction, on utilise des espaces de stockage temporaire (Buffer) d'atomicité qui sont mis à jour avec les informations initiales, puis finales, pour transfert dans la mémoire non volatile principale.The atomic character of the transactions is particularly important in the case of bank-type transactions (payment for example) where it is necessary to ensure that the information stored in the flash memory, for example the balance of an electronic purse or an authorization to purchase, or the identifier validating a transaction, is stored reliably. Generally to guarantee the atomicity of a transaction, atomic temporary storage spaces (Buffer) are used which are updated with the initial information, then final, for transfer to the main non-volatile memory.

Toutefois, dans le cas d'une mémoire flash, une difficulté réside dans la procédure d'effacement en raison de sa granularité par page qui est relativement longue par rapport à l'opération d'écriture par mot. En particulier, il existe un besoin d'indiquer qu'une page effacée est stable, c'est-à-dire qu'elle a pu être effacée intégralement. Autrement, on introduit une faiblesse dans la sécurité des données. Par ailleurs, en cas de besoin d'effacement d'une page avec transfert de données dans une nouvelle page, ce transfert peut rendre instable des données stables présentes dans la page à effacer. Cela se produit plus particulièrement avec des pages de grande taille (par exemple de l'ordre d'une centaine de mots voire plus) car elles sont plus susceptibles de contenir des données anciennes considérées comme stables et qu'il faut transférer dans une nouvelle page.However, in the case of a flash memory, a difficulty lies in the erase procedure because of its page granularity which is relatively long compared to the word write operation. In particular, there is a need to indicate that an erased page is stable, i.e. it has been able to be erased completely. Otherwise, a weakness in data security is introduced. Moreover, if it is necessary to erase a page with data transfer in a new page, this transfer can make stable data present in the page to be erased unstable. This occurs especially with large pages (for example of the order of a hundred words or more) because they are more likely to contain old data considered stable and must be transferred to a new page .

Dans les applications sans contact, les transactions doivent être effectuées très rapidement en raison du caractère fugace de la communication qui est lié à la durée pendant laquelle le circuit 1 peut communiquer avec un terminal. Or, la gestion de l'atomicité des transactions en utilisant des tampons en mémoire flash prend du temps, en raison des opérations d'effacement qui sont nécessaires pour autoriser une programmation.In contactless applications, the transactions must be carried out very quickly because of the fleeting nature of the communication which is related to the duration during which the circuit 1 can communicate with a terminal. However, managing the atomicity of transactions using buffers in flash memory takes time, because of the erasure operations that are necessary to allow programming.

Selon les modes de réalisation qui vont être décrits, on prévoit d'organiser de façon particulière le stockage des données dans la mémoire.According to the embodiments which will be described, provision is made to organize in a particular manner the storage of the data in the memory.

La figure 2 illustre un mode de réalisation d'une organisation logique de données à stocker dans une mémoire flash. En d'autres termes, cette figure illustre la façon dont sont gérées les données par l'unité de traitement 11 et les différentes entités du circuit 1 de la figure 1 pour stockage dans la mémoire flash. On fait référence par la suite a un circuit de gestion de la mémoire chargé d'organiser son adressage, l'écriture, la lecture et l'effacement ainsi que la conversion d'adresses logiques en adresses physiques. Ce circuit ou unité de gestion, est un circuit programmé selon la mise en oeuvre du procédé décrit et est le cas échéant l'unité de traitement.Figure 2 illustrates an embodiment of a logical data organization to be stored in a flash memory. In other words, this figure illustrates how the data are managed by the processing unit 11 and the different entities of the circuit 1 of FIG. 1 for storage in the flash memory. Reference is made thereafter to a memory management circuit responsible for organizing its addressing, writing, reading and erasure as well as the conversion of logical addresses into physical addresses. This circuit or management unit is a circuit programmed according to the implementation of the method described and is optionally the processing unit.

Selon ce mode de réalisation, l'ensemble des données représentant la capacité de stockage de la mémoire flash est vu comme un seul réseau 2V de données en blocs Bl, B2, etc. et chaque bloc Bi contient un même nombre de mots W. Dans l'exemple représenté en figure 2, on suppose que chaque bloc de donnée Bi contient quatre mots Wl, W2, W3 et W4. La taille d'un mot correspond à la granularité d'écriture dans la mémoire flash, soit en pratique de un à quelques octets (par exemple quatre). Toutefois, il s'agit d'un exemple arbitraire et tout autre nombre d'un ou plusieurs octets peut constituer un mot et tout autre nombre d'un ou plusieurs mots peut constituer un bloc. Ainsi, le découpage logique de la mémoire flash n'est pas effectué par page mais par bloc B dont la taille est indépendante de la taille des pages.According to this embodiment, the set of data representing the storage capacity of the flash memory is seen as a single 2V network of block data B1, B2, etc. and each block Bi contains the same number of words W. In the example shown in FIG. 2, it is assumed that each block of data Bi contains four words W1, W2, W3 and W4. The size of a word corresponds to the writing granularity in the flash memory, in practice from one to a few bytes (for example four). However, this is an arbitrary example and any other number of one or more bytes may constitute a word and any other number of one or more words may constitute a block. Thus, the logical division of the flash memory is not performed per page but by block B whose size is independent of the size of the pages.

Une donnée A à stocker dans la mémoire 2 comporte un nombre d'octets arbitraire, indépendant de la taille d'un bloc. D'un point de vue logique, c'est-à-dire pour l'unité de traitement 11, une donnée est définie par une longueur L(A) , c'est-à-dire un nombre d'octets et sa position dans le réseau 2V de blocs Bi par un offset 0(A), c'est-à-dire un décalage par rapport au début du réseau 2V.A data A to be stored in the memory 2 comprises an arbitrary number of bytes, independent of the size of a block. From a logical point of view, that is to say for the processing unit 11, a datum is defined by a length L (A), that is to say a number of bytes and its position. in the 2V network of blocks Bi by an offset 0 (A), that is to say an offset from the beginning of the network 2V.

La figure 3 illustre un mode de réalisation d'une organisation physique de données dans une mémoire flash.Figure 3 illustrates an embodiment of a physical organization of data in a flash memory.

La transition entre l'organisation logique (figure 2) et l'organisation physique du stockage des données est transparente pour l'unité de traitement 11 et les autres circuits accédant à la mémoire. L'unité de gestion de la mémoire 2 convertit des adresses virtuelles fournies par les différentes entités en des adresses physiques. Par ailleurs, pour gérer l'atomicité, l'unité de gestion génère des métadonnées qui sont stockées également dans la mémoire 2.The transition between the logical organization (FIG. 2) and the physical organization of the data storage is transparent for the processing unit 11 and the other circuits accessing the memory. The memory management unit 2 converts virtual addresses provided by the different entities into physical addresses. Moreover, to manage the atomicity, the management unit generates metadata which are also stored in the memory 2.

Afin de respecter la contrainte d'effacement, la mémoire est physiquement organisée en pages P, représentant la granularité d'effacement. La mémoire est donc divisée en r pages P de tailles identiques. Chaque page comporte un même nombre de mots, constituant la granularité d'écriture (et de lecture). Les pages sont, de préférence, divisées en deux catégories.In order to respect the erasure constraint, the memory is physically organized into pages P, representing the erasure granularity. The memory is therefore divided into r pages P of identical sizes. Each page has the same number of words, constituting the writing (and reading) granularity. The pages are preferably divided into two categories.

Une première catégorie comporte des pages PI divisées en n trames Fj comportant chacune plusieurs mots de données (ensemble DBj ) et un même nombre de mots FMDj de métadonnées de trame (de un à quelques-uns, par exemple deux). Par exemple, toutes les trames comportent un même nombre de mots de données. Chaque page PI comporte en outre un nombre m (quelques-uns à quelques dizaines) de mots de métadonnées de page PMDl(k) indépendant des trames. Le nombre de mots de données de chaque trame correspond, de préférence, à un multiple entier (au moins 1) du nombre de mots de données de chaque bloc DB de l'organisation virtuelle de la mémoire. Ainsi, une trame Fj contient un bloc de donnée DBj et des métadonnées de trame EMDj . En figure 3, on a illustré, pour chaque trame, le bloc DBj suivi des métadonnées FMDj. Toutefois, de préférence et comme on le verra par la suite, une partie des métadonnées est écrite au début de la trame Fj.A first category comprises pages PI divided into n frames Fj each having several data words (set DBj) and the same number of words FMDj frame metadata (from one to a few, for example two). For example, all frames have the same number of data words. Each page PI further comprises a number m (a few to a few tens) of page metadata words PMD1 (k) independent of the frames. The number of data words of each frame preferably corresponds to an integer multiple (at least 1) of the number of data words of each DB block of the virtual organization of the memory. Thus, a frame Fj contains a DBj data block and EMDj frame metadata. In FIG. 3, for each frame, the DBj block followed by the FMDj metadata is illustrated. However, preferably and as will be seen later, part of the metadata is written at the beginning of the frame Fj.

Une deuxième catégorie de pages, en nombre nettement plus réduit que le nombre de pages PI de la première catégorie, ne contient que des mots de métadonnées de mémoire MMDh.A second category of pages, in a much smaller number than the number of pages PI of the first category, contains only memory metadata words MMDh.

De préférence, la deuxième catégorie ne comporte qu'une page Pr et la première catégorie comporte donc r-1 pages PI.Preferably, the second category has only one page Pr and the first category therefore comprises r-1 pages PI.

En variante, on ne prévoit que des pages de la première catégorie.Alternatively, only pages of the first category are provided.

Selon un mode de réalisation particulier, une page contient 1024 octets. On prévoit, r-1 pages PI de la première catégorie contenant chacune 25 trames de 10 mots chacune et 6 mots de métadonnées PMDl de page. Chaque trame Fj contient un bloc DBj, de huit mots W de données, et deux mots de métadonnées de trame FMDj. Selon ce mode de réalisation particulier, chaque trame peut donc contenir deux blocs logiques Bi. Par ailleurs, on prévoit une seule page Pr de mots MMDh de métadonnées de mémoire.According to a particular embodiment, a page contains 1024 bytes. It is expected that r-1 PI pages of the first category will each contain 25 frames of 10 words each and 6 words of page PMD1 metadata. Each frame Fj contains a DBj block, eight W words of data, and two FMDj frame metadata words. According to this particular embodiment, each frame can therefore contain two logical blocks Bi. Moreover, a single page Pr of MMDh words of memory metadata is provided.

Il s'agit d'un exemple particulier et d'autres granularités peuvent être prévues pourvu que tous les mots aient la même taille, représentant la granularité d'écriture dans la mémoire. En particulier, on peut prévoir des blocs logiques Bi de taille (nombre de mots) variable qui sont alors susceptibles d'être répartis dans plusieurs blocs DBj dans plusieurs trames.This is a particular example and other granularities may be provided as long as all the words are the same size, representing the writing granularity in the memory. In particular, it is possible to provide logical blocks Bi of variable size (number of words) which are then capable of being distributed in several DBj blocks in several frames.

Les métadonnées de trame FMDj contiennent au moins un mot FCONST (de préférence un seul mot FMDj (1) ) de valeur fixe, identique quelle que soit la valeur des données contenues dans le bloc DBj et au moins un mot (de préférence un seul mot FMDj (2) ) contenant le ou les numéros (identifiant (s) i) du ou des blocs virtuels Bi écrits dans le bloc réel DBj. Le mot EMDj(2) contient également un indicateur FW d'état (fin d'écriture) du bloc DBj et un code de contrôle d'erreur de type CRC, signature ou autre. Les métadonnées de trames servent à l'atomicité de trame, c'est-à-dire indiquent si le bloc DBj contenu dans la trame est stable ou non.The FMDj frame metadata contain at least one word FCONST (preferably a single word FMDj (1)) of fixed value, identical regardless of the value of the data contained in the DBj block and at least one word (preferably a single word FMDj (2)) containing the number or numbers (identifier (s) i) of the virtual block (s) Bi written in the real block DBj. The word EMDj (2) also contains a status indicator FW (end of writing) of the DBj block and an error control code of CRC type, signature or other. The frame metadata is used for the frame atomicity, i.e. whether the DBj block contained in the frame is stable or not.

La figure 4 illustre, de façon très schématique, un mode de réalisation d'une structure 4 de trame Fj en supposant deux mots de métadonnées EMDj.FIG. 4 very schematically illustrates one embodiment of a frame structure Fj assuming two metadata words EMDj.

Selon ce mode de réalisation, on écrit en premier le mot de métadonnées EMDj(1) de valeur fixe FCONST, puis les mots de la donnée A et enfin le mot de métadonnées FMDj (2) . Le code CRC contenu dans le mot EMDj (2) est, de préférence, un CRC du mot EMDj (1) et du bloc DBj. Grâce à l'utilisation d'une valeur fixe pour le mot EMDj(1) , on sera en mesure de s'assurer qu'il n'y a pas eu d'arrachement ou d'attaque au début de l'écriture de la trame, par exemple une tentative de modification du contenu du bloc DBj lors d'une attaque. La valeur est fixe, c'est-à-dire est la même pour une trame donnée, mais peut varier d'une trame à une autre. De préférence, par facilité, la valeur est la même pour toutes les trames de la mémoire.According to this embodiment, the metadata word EMDj (1) of fixed value FCONST is first written, then the words of the data A and finally the metadata word FMDj (2). The CRC code contained in the word EMDj (2) is preferably a CRC of the word EMDj (1) and the block DBj. Thanks to the use of a fixed value for the word EMDj (1), we will be able to ensure that there was no tearing or attack at the beginning of the writing of the frame, for example an attempt to modify the content of the DBj block during an attack. The value is fixed, that is to say the same for a given frame, but can vary from one frame to another. Preferably, for convenience, the value is the same for all the frames of the memory.

Selon le premier aspect, les métadonnées de page PMDl contiennent un mot PMDl(l) indicateur que la page a commencé à être écrite et qu'elle n'est plus vierge, de préférence mais optionnellement un mot PMDl(2) indicateur que la page est pleine, un mot PMDl(3) indicateur que la page suivante est effacée (donc vierge), un mot PMDl (4) indicateur du fait que la page est obsolète, c'est-à-dire qu'aucune des trames ne contient un bloc encore utile (en d'autres ternes, que tous les blocs de cette page ont déjà été modifiés dans d'autres pages ultérieurement) et un mot PMDl(5) contenant un numéro d'ordre de la page, c'est-à-dire la valeur d'un compteur PWN de nombre de pages écrites. Les métadonnées de page selon ce premier aspect servent à indiquer le basculement d'une page à une autre et à permettre une récupération d'atomicité au démarrage ou réinitialisation du circuit. Les mots ne sont pas nécessairement physiquement dans cet ordre dans la page.According to the first aspect, the PMD1 page metadata contains a word PMD1 (l) indicating that the page has begun to be written and that it is no longer blank, preferably but optionally a word PMD1 (2) indicating that the page is full, a word PMDl (3) indicating that the next page is erased (therefore blank), a word PMDl (4) indicating that the page is obsolete, that is to say that none of the frames contains a block still useful (in other words, that all the blocks of this page have already been modified in other pages later) and a word PMDl (5) containing a sequence number of the page, that is, ie the value of a PWN counter of the number of pages written. The page metadata according to this first aspect is used to indicate the switchover from one page to another and to allow an atomicity recovery at start or reset of the circuit. The words are not necessarily physically in this order on the page.

Selon le deuxième aspect de la description, les métadonnées de page contiennent en outre, ou à la place du mot PMDl (3) indicateur que la page a été effacée, un mot PMD(6) indicateur du nombre d'effacements qu'a subie la page.According to the second aspect of the description, the page metadata furthermore contains, or instead of the word PMD1 (3) indicating that the page has been erased, a word PMD (6) indicating the number of erasures that has occurred. the page.

Le seul lien entre les tailles logiques et l'organisation physique de la mémoire est que tous les mots ont la même taille. On rappelle que, lorsqu'un mot est vierge (effacé), tous ses bits sont dans un premier état (désigné haut ou 1) . La programmation d'un mot pour y stocker une valeur consiste à sélectionner les bits des octets du mot qui doivent changer d'état et être écrits (basculer vers l'état bas ou 0). La programmation d'un drapeau ou indicateur consiste à programmer le bit ou les bits de l'octet à l'état correspondant à l'état bas. On rappelle également qu'une fois écrit ou programmé à l'état 0, le contenu du mot ne peut pas être modifié sauf à effacer la page entière et à la reprogrammer. L'écriture des données dans la mémoire s'effectue bloc par bloc au fur et à mesure qu'ils sont reçus et successivement dans chaque page. Ainsi, en cas d'écritures successives d'un même bloc logique (par exemple, la valeur d'un compteur), ce même bloc de données Bi peut se retrouver écrit plusieurs fois dans la mémoire avec différentes valeurs au fur et à mesure des écritures. Cela participe à la résolution du problème d'atomicité dans la mesure où, à partir du moment où une donnée A aura été écrite une fois avec une première valeur, on pourra toujours, lors des écritures ultérieures, revenir à la valeur précédente représentant l'état stable en cas de problème d'écriture de la valeur courante.The only link between logical sizes and the physical organization of memory is that all words are the same size. Remember that when a word is blank (erased), all bits are in a first state (designated high or 1). The programming of a word to store a value consists in selecting the bits of the bytes of the word that must change state and be written (switch to the low state or 0). The programming of a flag or indicator consists in programming the bit or bits of the byte in the state corresponding to the low state. It is also recalled that once written or programmed in state 0, the contents of the word can not be modified except to erase the whole page and reprogram it. The writing of the data in the memory is carried out block by block as and when they are received and successively in each page. Thus, in case of successive writes of the same logical block (for example, the value of a counter), this same block of data Bi can be found written several times in the memory with different values as and when writings. This contributes to the resolution of the atomicity problem insofar as, from the moment when a datum A has been written once with a first value, it will always be possible, when writing later, to return to the previous value representing the Steady state if there is a problem writing the current value.

Par contre, coté mémoire logique 2V, une même donnée A est toujours "stockée" dans le même bloc Bi (ou les mêmes blocs). Ainsi, l'identifiant i (l'adresse) du bloc Bi dans la mémoire logique permet de retrouver le ou les blocs physique DBj de la mémoire 2 contenant la donnée A (contenant les valeurs successives de la donnée A) .On the other hand, on the 2V logical memory side, the same data A is always "stored" in the same block Bi (or the same blocks). Thus, the identifier i (the address) of the block Bi in the logical memory makes it possible to retrieve the physical block or blocks DBj of the memory 2 containing the data item A (containing the successive values of the data item A).

Pour simplifier, on expose par la suite le fonctionnement en supposant arbitrairement que la donnée A que l'on considère occupe un et un seul bloc Bi et que les blocs DBj ont la taille d'un bloc Bi. Toutefois, tout ce qui est décrit s ' applique plus généralement au cas pratique où une donnée A peut occuper plusieurs blocs ou une partie de bloc et à des tailles différentes des blocs Bi et DBj.For simplicity, the operation is subsequently explained by arbitrarily assuming that the data item A considered is one and only one block Bi and that the blocks DBj are the size of a block Bi. However, all that is described applies more generally to the practical case where a data A can occupy several blocks or a block portion and at different sizes of the blocks Bi and DBj.

La figure 5 est un schéma-blocs illustrant un mode de réalisation d'une écriture d'une donnée A dans la mémoire 2. A partir de la longueur L(A) et de l'offset 0 (A) de la donnée A dans le réseau virtuel 2V (figure 2), le circuit de gestion de la mémoire détermine (bloc 51, i = f (L (A) , 0 (A) ) ) l'identifiant i du bloc DBi contenant cette donnée.FIG. 5 is a block diagram illustrating an embodiment of a writing of a data item A in the memory 2. From the length L (A) and the offset 0 (A) of the data item A in FIG. 2V virtual network (Figure 2), the memory management circuit determines (block 51, i = f (L (A), 0 (A))) the identifier i DBi block containing this data.

Puis, on sélectionne (bloc 52, SELECT 1(MAX(PWN))) la page PI ayant le nombre de pages écrites PWN le plus élevé en parcourant (en lisant) les mots correspondants PMD1(5) des métadonnées de page.Then, the page PI with the highest number of PWNs written pages is selected (block 52, SELECT 1 (MAX (PWN)) by browsing (by reading) the corresponding words PMD1 (5) of the page metadata.

Puis, on identifie (bloc 53, SELECT j), la première trame Fj disponible séquentiellement dans la page PI. Cette sélection s'effectue, par exemple, en parcourant les trames successivement jusqu'à la première dont le mot EMDj(1) destiné à la valeur fixe FCONST n'est pas programmé. En variante, on lit le deuxième mot EMDj (2) de métadonnées et on sélectionne la première trame dont l'indicateur EW de fin d'écriture FMDj est à l'état 1 ou dont l'identifiant de bloc i n'est pas programmé. On suppose dans cet exemple qu'une nouvelle page est ouverte à la fin de l'écriture de la dernière trame d'une page. Par conséquent on trouve forcément une trame disponible à l'étape 53.Then, (block 53, SELECT j) is identified, the first frame Fj available sequentially in the page PI. This selection is made, for example, by traversing the frames successively to the first of which the word EMDj (1) for the fixed value FCONST is not programmed. As a variant, the second metadata word EMDj (2) is read and the first frame whose end writing flag EW FMDj is in the state 1 or whose block identifier i is not programmed is selected. . It is assumed in this example that a new page is opened at the end of the writing of the last frame of a page. Therefore there is inevitably a frame available in step 53.

En variante, si aucune trame n'est libre, cela signifie que la page est pleine. On exécute alors une sous-routine d'ouverture d'une nouvelle page. Cette sous-routine sera exposée plus loin en relation avec la figure 6.Alternatively, if no frame is free, it means that the page is full. We then run a subroutine to open a new page. This subroutine will be explained later in connection with FIG.

Une fois que la trame Fj est sélectionnée, on commence par écrire (bloc 54, FCONST -> EMDj (1) ) , dans la trame Fj, le premier mot FMDj (1) de métadonnées fixe (il s'agit en fait du premier mot écrit logiquement. Physiquement, les mots peuvent être dans un ordre différent dans la trame) . On écrit ensuite (bloc 55, A -> DBj) la donnée A dans le bloc DBj, puis on écrit (bloc 56, (i, FW, CRC) -> EMDj(2)) le deuxième mot EMDj(2) de métadonnées avec l'identifiant i, l'indicateur FW de fin d'écriture et le CRC des premiers mots (BMDj (1) et DBj ) de la trame.Once the frame Fj is selected, it starts by writing (block 54, FCONST -> EMDj (1)), in the frame Fj, the first word FMDj (1) fixed metadata (it is actually the first word written logically.Physically, the words can be in a different order in the frame). Then write (block 55, A -> DBj) the data A in the block DBj, then write (block 56, (i, FW, CRC) -> EMDj (2)) the second word EMDj (2) of metadata with the identifier i, the FW end of writing indicator and the CRC of the first words (BMDj (1) and DBj) of the frame.

On vérifie alors si la page est pleine, c'est-à-dire s'il existe une trame Fj disponible pour la prochaine écriture (bloc 57, EXIST NEXT j ?). Dans l'affirmative (sortie Y du bloc 57), l'écriture est terminée (bloc 58, END). Dans le cas où une donnée A peut représenter plusieurs blocs DBi, on revient à l'étape 53 pour écrire dans la trame suivante. Dans un cas plus général ou les trames sont de taille variable et où l'espace disponible en fin de page n'est pas suffisant pour stocker la trame qui suit, soit on laisse un espace vide, soit on coupe la trame en deux et on stocke une partie sur la page courante et une partie dans la page suivante.We then check if the page is full, that is to say if there is a frame Fj available for the next write (block 57, EXIST NEXT j?). In the affirmative (output Y of block 57), the writing is finished (block 58, END). In the case where a data item A can represent several DBi blocks, step 53 is returned to write in the next frame. In a more general case where the frames are of variable size and where the space available at the end of the page is not sufficient to store the following frame, either leave a blank space or cut the frame in two and stores a portion on the current page and a portion on the next page.

Dans la négative (sortie N du bloc 57), c'est-à-dire s'il n'y a plus de trame disponible, on prépare une page suivante pour la prochaine écriture (bloc 6, NEXT 1). Pour simplifier, on considère le cas où l'on prépare la page suivante (index 1 incrémenté d'une unité) mais on peut plus généralement prévoir de lier plusieurs pages ensemble afin d'accélérer la vitesse d'écriture de plusieurs blocs sans effacement intermédiaire. Dans ce cas, on prévoit de sauter une ou plusieurs pages quand une page est pleine.In the negative (output N of block 57), that is to say if there is no more frame available, prepare a next page for the next write (block 6, NEXT 1). To simplify, we consider the case where we prepare the next page (index 1 incremented by one unit) but we can more generally expect to link several pages together to speed up the writing speed of several blocks without intermediate erasure . In this case, it is planned to skip one or more pages when a page is full.

La figure 6 est un schéma-blocs illustrant un mode de réalisation d'une préparation d'une page suivante pour écriture quand une page courante est pleine.Fig. 6 is a block diagram illustrating an embodiment of a preparation of a next page for writing when a current page is full.

On commence (bloc 61, 1 -> PMD1(2)) par fermer la page courante, c'est-à-dire par programmer son mot de métadonnées PMD1(2) de fin de page ou de page pleine. Puis (bloc 62, SELECT NEXT 1), on sélectionne la prochaine page PI disponible, c'est-à-dire obsolète. La valeur du nombre de pages écrites, incrémentée de 1, est alors programmée (bloc 63, PWN+1 -> PMDl (5) ) dans le mot correspondant PMDl(5) de métadonnées de page et on programme également (bloc 64, 1 -> PMDl(l)) l'indicateur d'ouverture de page.We start (block 61, 1 -> PMD1 (2)) by closing the current page, that is to say by programming its metadata word PMD1 (2) end of page or full page. Then (block 62, SELECT NEXT 1), we select the next page PI available, that is to say, obsolete. The value of the number of pages written, incremented by 1, is then programmed (block 63, PWN + 1 -> PMD1 (5)) in the corresponding word PMD1 (5) of page metadata and is also programmed (block 64, 1 -> PMDl (l)) the page open indicator.

Avec un tel processus d'écriture dans la mémoire 2, on est en mesure, en lecture, de retrouver la dernière transaction atomique pour chaque donnée.With such a process of writing in the memory 2, one is able, in reading, to find the last atomic transaction for each data.

La figure 7 illustre, sous forme de schéma-blocs, un mode de réalisation d'une lecture d'une donnée A dans la mémoire 2. A partir de la longueur L(A) et de l'offset 0(A) de la donnée A dans le réseau virtuel 2V, le circuit de gestion de la mémoire détermine (bloc 71, i = f(L (A), 0(A) )) l'identifiant i du bloc Bi contenant cette donnée. La lecture dans la mémoire s'effectue en parcourant les trames Fj à partir de la dernière trame écrite de la dernière page écrite en recherchant dans quel bloc DBj se trouve le bloc Bi, par son identifiant i. En pratique, on parcourt (bloc 72, SEARCH i in FMDj (2) ) , en remontant la mémoire 2 depuis la page possédant le nombre de pages écrites PWN le plus élevé dans son mot de métadonnées PMD1(5) et, par page, depuis la dernière trame écrite de la page. On s'arrête à la première occurrence de l'identifiant i dans un deuxième mot FMDj(2) de métadonnées de trame.FIG. 7 illustrates, in block diagram form, an embodiment of a reading of a data item A in the memory 2. From the length L (A) and the offset 0 (A) of the data A in the virtual network 2V, the memory management circuit determines (block 71, i = f (L (A), 0 (A))) the identifier i of the block Bi containing this data item. The reading in the memory is performed by browsing the frames Fj from the last written frame of the last page written by searching in which DBj block is the block Bi, by its identifier i. In practice, one goes through (block 72, SEARCH i in FMDj (2)), by going up memory 2 from the page having the highest number of PWN written pages in its metadata word PMD1 (5) and, per page, since the last written frame of the page. We stop at the first occurrence of the identifier i in a second word FMDj (2) of frame metadata.

Une fois la trame trouvée, on vérifie alors (bloc 73, FW OK ?) l'indicateur d'état FW qui indique si l'écriture de la trame s'est teminée sans arrachement indiquant, en principe, si les données sont stables ou non.Once the frame has been found, it then checks (block 73, FW OK?) The status indicator FW which indicates whether the writing of the frame has ended without tearing indicating, in principle, whether the data are stable or not. no.

Si l'indicateur d'état n'est pas valide (sortie N du bloc 73), on remonte alors les trames (bloc 72) jusqu'à celle contenant la version précédente du bloc de données DBj.If the status indicator is not valid (output N of block 73), then the frames (block 72) are moved up to that containing the previous version of the DBj data block.

Si l'indicateur d'état est valide (sortie Y du bloc 73), on vérifie (bloc 74, CRC OK ?) le code d'erreur en recalculant un CRC sur les données présentes dans le premier mot de métadonnées FMDj(1) et dans le bloc de données (DB(j)).If the status indicator is valid (output Y of block 73), the error code is checked (block 74, CRC OK?) By recalculating a CRC on the data present in the first metadata word FMDj (1) and in the data block (DB (j)).

Si le code calculé est identique au code stocké (sortie Y du bloc 74) , le bloc de données DBj est valide et la lecture fournit (bloc 75, RETURN A=DBj) la valeur du bloc DBj comme étant la donnée A, donc comme contenu du bloc virtuel Bi.If the calculated code is identical to the stored code (output Y of the block 74), the data block DBj is valid and the reading provides (block 75, RETURN A = DBj) the value of the block DBj as the data A, so as content of the virtual block Bi.

Si le code CRC n'est pas confirmé (sortie N du bloc 74), cela signifie que les données ne sont pas fiables. On remonte alors la mémoire (bloc 72) afin de trouver la précédente écriture de la donnée, ce qui revient à rechercher la dernière transaction atomique.If the CRC code is not confirmed (output N of block 74), it means that the data is unreliable. We then go back the memory (block 72) in order to find the previous writing of the data, which amounts to looking for the last atomic transaction.

En variante, lorsque l'on identifie une trame dont le CRC est erroné (sortie N du bloc 74), on commence par écrire dans le deuxième mot de métadonnées FiynDj (2) , un indicateur que la trame est polluée. Cela gagne un peu de temps lors de la prochaine lecture de la donnée A car cela évite de recalculer le CRC avant de remonter à 1'occurrence précédente.In a variant, when a frame whose CRC is erroneous (output N of block 74) is identified, it is first written in the second metadata word FiynDj (2), an indicator that the frame is polluted. This saves a little time on the next reading of the data A because it avoids recalculating the CRC before going back to the previous occurrence.

La figure 8 est un schéma-blocs illustrant un mode de réalisation d'une récupération d'atomicité au niveau d'une page.Fig. 8 is a block diagram illustrating an embodiment of a page-level atomic recovery.

En pratique, ce processus est effectué au démarrage ou lors d'une réinitialisation du circuit, ce qui revient à vérifier l'atomicité après chaque arrachement ou extinction accidentelle ou volontaire.In practice, this process is performed at startup or during a reset of the circuit, which amounts to checking the atomicity after each accidental or voluntary tearing or extinguishing.

On commence par sélectionner (bloc 81, SELECT 1 (MAX (PWN) ) ) la page ayant la valeur maximale du compteur de nombre de pages écrites. Puis, on sélectionne (bloc 82, SELECT j) la dernière trame écrite dans cette page. On lit alors le deuxième mot de métadonnées EMDj (2) et on vérifie (bloc 83, FW OK ?) que l'indicateur d'écriture FW est correct (est programmé). Dans l'affirmative (sortie Y du bloc 83), il n'y pas de problème d'atomicité et la coupure ou réinitialisation s'est effectuée alors que les processus d'écriture dans la mémoire flash étaient terminés. On passe alors au fonctionnement nomal, c'est-à-dire que le processus de vérification d'atomicité est teminé (END). En variante, pour s'assurer qu'il n'y a pas eu d'arrachement en fin d'écriture et pour garantir la stabilité du mot EMDj (2) , on reprogramme la même valeur dans le mot EMDj (2).We first select (block 81, SELECT 1 (MAX (PWN)) the page having the maximum value of the counter of the number of pages written. Then, we select (block 82, SELECT j) the last frame written on this page. The second metadata word EMDj (2) is then read and it is verified (block 83, FW OK?) That the write flag FW is correct (is programmed). In the affirmative (output Y of block 83), there is no problem of atomicity and the cut or reset was carried out while the writing processes in the flash memory were finished. We then go to nominal operation, that is to say that the atomicity verification process is terminated (END). Alternatively, to ensure that there was no tearing at the end of writing and to ensure the stability of the word EMDj (2), reprogramming the same value in the word EMDj (2).

Dans la négative (sortie N du bloc 83) , cela signifie un arrachement (coupure d'alimentation ou réinitialisation) pendant une écriture dans la mémoire flash. Selon un mode de réalisation préféré, on utilise alors la page Pr pour transférer (bloc 84, TRANSFERT DBj(PI) -> DBj'(Pr)) toutes les trames valides de la page PI vers la page Pr. Puis, on efface la page PI (bloc 85, ERASE PI). Les différentes étapes de la copie, vers la page Pr et ensuite de la recopie depuis la page Pr, sont validées par des mots de métadonnées dans la page Pr pour s'assurer, qu'en cas d'arrachement durant la procédure de récupération, on continue bien la procédure entamée et qu'on ne recommence pas au début de la procédure d'arrachement au risque de perdre définitivement les données encore valables dans la page PI.If not (output N of block 83), this means tearing (power failure or reset) while writing to the flash memory. According to a preferred embodiment, the page Pr is then used to transfer (block 84, TRANSFER DBj (PI) -> DBj '(Pr)) all the valid frames from the page PI to the page Pr. Then, we delete the PI page (block 85, ERASE PI). The different steps of the copy, to the page Pr and then the copy from the page Pr, are validated by metadata words in the page Pr to ensure that in case of tearing during the recovery procedure, the procedure started is continued well and we do not start again at the beginning of the tearing procedure at the risk of permanently losing the still valid data in the page PI.

Selon un mode de réalisation, la page Pr est une page dédiée de la mémoire. On effectue alors un transfert inverse (bloc 86, TRANSFERT DBj'(Pr) -> DBj (PI)) des données stockées temporairement dans la page Pr vers la page PI effacée. Les métadonnées de page sont alors également réécrites. Enfin, on efface la page Pr (bloc 87, ERASE Pr) pour qu'elle soit prête pour une prochaine utilisation.According to one embodiment, the page Pr is a dedicated page of the memory. In this case, a reverse transfer (block 86, TRANSFER DBj '(Pr) -> DBj (PI)) of data stored temporarily in the page Pr to the deleted page PI is performed. The page metadata is then also rewritten. Finally, we delete the page Pr (block 87, ERASE Pr) so that it is ready for next use.

Selon un autre mode de réalisation, la page Pr est n'importe quelle page disponible. Dans ce cas, il n'est pas nécessaire de transférer les données vers la page PI après effacement.According to another embodiment, the page Pr is any available page. In this case, it is not necessary to transfer the data to the PI page after deletion.

De préférence, le traitement de la figure 8 comporte également une étape de vérification de l'atomicité des métadonnées de page. Pour cela, on vérifie, lors d'un redémarrage et sur la dernière page écrite, un code correcteur d'erreur stocké dans un des mots de métadonnées de page PMDl(k).Preferably, the processing of FIG. 8 also comprises a step of checking the atomicity of the page metadata. For this, it verifies, during a restart and on the last page written, an error correction code stored in one of the page metadata words PMDl (k).

De préférence, avant l'étape 84, on écrit les mots de métadonnées PMDl(2) de toutes les pages qui ont été écrites après la trame Fj sélectionnée au bloc 82, comme indiquant une page pleine. Ainsi, ces pages ne peuvent pas être utilisées sans être effacées.Preferably, before step 84, the PMD1 (2) metadata words of all the pages that are written after the selected frame Fj in block 82 are written as indicating a full page. Thus, these pages can not be used without being erased.

Selon la variante où l'on utilise que des pages de la première catégorie, on peut se passer de recopier les trames fiables vers une nouvelle page suite à la détection d'une trame erronée. En effet, la trame problématique ne sera de toute façon pas considérée en lecture et on lira la donnée fiable précédente.According to the variant where only the pages of the first category are used, it is impossible to copy the reliable frames to a new page following the detection of an erroneous frame. Indeed, the problematic frame will in any case not be considered in reading and we will read the previous reliable data.

Toutefois, cela réduit la capacité de la mémoire en termes de nombre d'arrachement qu'elle peut supporter dans la mesure où l'on conserve des trames perdues.However, this reduces the capacity of the memory in terms of the number of tearing it can support as long as lost frames are kept.

Le nombre de pages disponibles (effacées) est au minimum deux afin de permettre un effacement d'une page. Lorsqu'il n'y a plus de page disponible (autre que les deux minimum) , on sélectionne une des pages écrites, de préférence la page dont le nombre de trames écrites est minimum. On parcourt alors cette page à effacer en vérifiant ses trames et celles d'entre-elles qui contiennent les derniers états fiables de blocs Bi. Tous ces blocs sont transférés (écrits) de la manière décrite en relation avec la figure 4 vers une des pages disponibles. Ainsi, au maximum n blocs sont transférés (en pratique, il y a aux moins certaines trames qui contiennent des données obsolètes de sorte que ce transfert se traduit par des trames disponibles dans cette page). Une fois le transfert terminé, la page d'origine est effacée. Une fois l'effacement effectué, on programme l'indicateur de page effacée (PMD1(4)).The number of available pages (erased) is at least two in order to erase a page. When there is no more page available (other than the two minimum), one selects one of the written pages, preferably the page whose number of written frames is minimum. This page is then scanned to be erased by checking its frames and those of them which contain the last reliable states of blocks Bi. All of these blocks are transferred (written) as described in connection with Figure 4 to one of the available pages. Thus, at most n blocks are transferred (in practice, there are at least some frames that contain obsolete data so that this transfer results in frames available in this page). Once the transfer is complete, the original page is erased. After erasing, program the erased page indicator (PMD1 (4)).

En variante, on fixe un nombre minimum de pages supérieur, par exemple trois ou quatre, de façon à disposer de plus de trames disponibles afin de stocker un plus grand nombre de transactions sans requérir un effacement.As a variant, a minimum number of upper pages, for example three or four, is fixed so as to have more available frames in order to store a larger number of transactions without requiring an erasure.

Selon le deuxième aspect de la présente description, à chaque effacement d'une page de la mémoire flash 2, on incrémente un compteur de nombre d'effacements de la page concernée.According to the second aspect of the present description, each erasing of a page of the flash memory 2, increments a number of erasure counter of the page concerned.

La figure 9 est un schéma-blocs illustrant un mode de réalisation d'une sélection d'une page à effacer selon ce deuxième aspect.FIG. 9 is a block diagram illustrating an embodiment of a selection of a page to be erased according to this second aspect.

Pour effectuer l'effacement d'une page PI (ERASE Pl) , on commence, comme indiqué ci-dessus par transférer (bloc 91, TRANSFERT DBj(Pl) -> DBj'(Pl')) tous les blocs de données DBj de la page Pl dont le contenu représente la dernière valeur stable d'une donnée vers un bloc DBj'(Pl') d'une des pages mémoire disponibles. On stocke (bloc 92, TEMP NPE) le compteur NPE de nombre d'effacements de page dans un mot de métadonnées de la page précédente, puis on efface la page PI (bloc 93, ERASE PI) . Une fois l'effacement effectué, on programme (bloc 94, NPE+1 -> PMD1(6)) le mot de métadonnées PMD1(6) à la valeur du nombre d'effacements incrémenté de un.To erase a page PI (ERASE Pl), we begin, as indicated above, to transfer (block 91, TRANSFER DBj (Pl) -> DBj '(Pl')) all the data blocks DBj of the page Pl whose content represents the last stable value of a data item to a block DBj '(Pl') of one of the available memory pages. The counter NPE of number of page erasures in a metadata word of the previous page is stored (block 92, TEMP NPE), then the page PI (block 93, ERASE PI) is deleted. Once the deletion has been carried out, the metadata word PMD1 (6) is programmed (block 94, NPE + 1 -> PMD1 (6)) to the value of the number of deletions incremented by one.

Selon ce mode de réalisation, la sélection de la page à effacer ne correspond pas nécessairement à la page ayant la valeur minimale du nombre de pages écrites mais à celle ayant la valeur minimale de pages écrites parmi les pages ayant subies un moindre nombre d'effacements. L'application de ce mode de réalisation permet d'optimiser la durée de vie de la mémoire flash en optimisant l'homogénéité du nombre d'effacements parmi le nombre de pages. En effet, s'il n'y avait pas de processus de récupération d'atomicité, la page ayant la valeur maximale du nombre de pages écrite serait parmi celles ayant été effacées un moins grand nombre de fois. Toutefois, dans la mesure où l'application du processus de récupération d'atomicité au niveau d'une page se traduit par un transfert, avec la même valeur de nombre de pages écrites vers une page disponible, cela ne correspond pas forcément, notamment en cas de nombreuses mises en oeuvre de la récupération d'atomicité.According to this embodiment, the selection of the page to be erased does not necessarily correspond to the page having the minimum value of the number of pages written but to that having the minimum value of pages written among the pages having undergone a smaller number of erasures. . The application of this embodiment makes it possible to optimize the lifetime of the flash memory by optimizing the homogeneity of the number of erasures among the number of pages. Indeed, if there was no atomic recovery process, the page having the maximum value of the number of pages written would be among those having been erased a lesser number of times. However, since the application of the page-level atomic recovery process results in a transfer, with the same value of the number of pages written to an available page, this does not necessarily correspond, especially in case of many implementations of atomic recovery.

On notera que, si ce deuxième aspect peut être combiné au premier, il peut également être mis en oeuvre plus généralement dans tout procédé de gestion d'une mémoire flash.Note that, if this second aspect can be combined with the first, it can also be implemented more generally in any method of managing a flash memory.

Un autre avantage est qu'en cas de mise en oeuvre du processus de récupération d'atomicité au niveau d'une page tel que décrit en relation avec la figure 9, il y a un risque que l'erreur soit au niveau du nombre de pages écrites, auquel cas cette page risque, sans la mise en oeuvre du compteur de nombre d'effacements, de ne jamais être effacée.Another advantage is that in the case of implementation of the page-level atomic recovery process as described in connection with FIG. 9, there is a risk that the error is in the number of written pages, in which case this page risk, without the implementation of the number of erasure counter, never to be erased.

Un avantage des modes de réalisation qui ont été décrits est qu'ils améliorent la gestion d'une mémoire flash pour le traitement d'opérations devant respecter un critère d'atomicité.An advantage of the embodiments that have been described is that they improve the management of a flash memory for the processing of operations that must comply with an atomicity criterion.

Un autre avantage est qu'ils permettent aisément de remonter à la dernière valeur atomique d'une donnée.Another advantage is that they easily make it possible to go back to the last atomic value of a datum.

Divers modes de réalisation ont été décrits. Diverses variantes et modifications apparaîtront à l'homme de l'art. Par ailleurs, la mise en oeuvre pratique des modes de réalisation qui ont été décrits est à la portée de l'homme du métier à partir des indications fonctionnelles données ci-dessus et en utilisant des circuits en eux-mêmes usuels. Notamment, l'organisation de l'adressage de la mémoire et la génération des signaux adaptés à sa commande et à cet adressage fait appel à des techniques en elles-mêmes usuelles.Various embodiments have been described. Various variations and modifications will be apparent to those skilled in the art. Furthermore, the practical implementation of the embodiments that have been described is within the abilities of those skilled in the art from the functional indications given above and using circuits in themselves usual. In particular, the organization of the addressing of the memory and the generation of the signals adapted to its control and to this addressing makes use of techniques that are in themselves usual.

Claims (5)

REVENDICATIONS 1. Procédé de gestion d'une mémoire flash (2), dans lequel : la mémoire est organisée en pages (PI) ; et chaque page contient un mot de métadonnées (PMD1(6)) destiné a stoker un nombre d'effacements de la page.A method of managing a flash memory (2), wherein: the memory is organized into pages (PI); and each page contains a metadata word (PMD1 (6)) for storing a number of deletions of the page. 2. Procédé selon la revendication 1, dans lequel la sélection d'une page (PI) à effacer pour libérer de l'espace s'effectue en fonction du nombre d'effacements subis par les différentes pages afin d'unifomiser le nombre d'effacement subis par chaque page.2. The method as claimed in claim 1, in which the selection of a page (PI) to be erased in order to free up space is effected according to the number of erasures suffered by the different pages in order to unify the number of pages. erasure suffered by each page. 3. Procédé selon la revendication 1 ou 2, dans lequel : les données (A) à stocker sont organisées en blocs logiques (Bi) ; la mémoire est divisée en pages (PI) ; chaque page est divisée en trames (Fj), chaque trame pouvant contenir au moins un bloc (DBj) de données et au moins deux mots de métadonnées de trame (FMDj) ; chaque page comporte au moins un mot de métadonnées de page (PMD) qui contient, lorsqu'une page est écrite, une valeur d'un compteur (PWN) de nombre de pages écrites ; une écriture d'un bloc logique dans la mémoire s'accompagne d'une programmation d'un premier mot de métadonnées de trame (FMDj(2) ) avec un identifiant (i) de ce bloc logique ; et la page dans laquelle procéder à l'écriture est choisie comme étant celle dont le premier mot de métadonnées contient la valeur maximum du compteur de pages écrites parmi toutes les pages.3. Method according to claim 1 or 2, wherein: the data (A) to be stored are organized in logical blocks (Bi); the memory is divided into pages (PI); each page is divided into frames (Fj), each frame may contain at least one block (DBj) of data and at least two frame metadata words (FMDj); each page has at least one page metadata word (PMD) which contains, when a page is written, a value of a counter (PWN) of the number of pages written; a writing of a logic block in the memory is accompanied by a programming of a first frame metadata word (FMDj (2)) with an identifier (i) of this logical block; and the page in which to write is selected as the one whose first metadata word contains the maximum value of the page counter written among all the pages. 4. Mémoire flash (2), programmée conformément au procédé selon l'une quelconque des revendications 1 à 3.Flash memory (2), programmed according to the method according to any one of claims 1 to 3. 5. Circuit électronique (1) comportant une mémoire flash (2) conforme à la revendication 4.Electronic circuit (1) comprising a flash memory (2) according to claim 4.
FR1654492A 2016-05-20 2016-05-20 ERASING MANAGEMENT IN A FLASH MEMORY Withdrawn FR3051575A1 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
FR1654492A FR3051575A1 (en) 2016-05-20 2016-05-20 ERASING MANAGEMENT IN A FLASH MEMORY

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
FR1654492A FR3051575A1 (en) 2016-05-20 2016-05-20 ERASING MANAGEMENT IN A FLASH MEMORY

Publications (1)

Publication Number Publication Date
FR3051575A1 true FR3051575A1 (en) 2017-11-24

Family

ID=57184539

Family Applications (1)

Application Number Title Priority Date Filing Date
FR1654492A Withdrawn FR3051575A1 (en) 2016-05-20 2016-05-20 ERASING MANAGEMENT IN A FLASH MEMORY

Country Status (1)

Country Link
FR (1) FR3051575A1 (en)

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5457658A (en) * 1993-02-24 1995-10-10 International Business Machines Corporation Nonvolatile memory with cluster-erase flash capability and solid state file apparatus using the same
US6513095B1 (en) * 1999-05-31 2003-01-28 Sharp Kabushiki Kaisha File system with assured integrity incorporating semiconductor memory device

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5457658A (en) * 1993-02-24 1995-10-10 International Business Machines Corporation Nonvolatile memory with cluster-erase flash capability and solid state file apparatus using the same
US6513095B1 (en) * 1999-05-31 2003-01-28 Sharp Kabushiki Kaisha File system with assured integrity incorporating semiconductor memory device

Similar Documents

Publication Publication Date Title
EP0546048B1 (en) Method and device for updating information in a memory and use thereof in memory cards
EP3293637A1 (en) Index management in a flash memory
EP1988548B1 (en) Non-volatile memory with quick writing
EP2786317B1 (en) Writing data in a non-volatile memory of a smart card
EP2940690B1 (en) Bi-directional counter in flash memory
EP3246820A1 (en) Storage management in a flash memory
EP0769742B1 (en) Electronic component with electrically erasable non-volatile memory
EP3246819B1 (en) Flash memory counter
FR3051575A1 (en) ERASING MANAGEMENT IN A FLASH MEMORY
FR2689662A1 (en) Protection against information loss from telephone cards - uses memory zones and releases modified information from first to second zones with control bit
EP3188024B1 (en) Storage in a flash memory
WO2007090857A1 (en) Method of secure updating of a nonvolatile memory
FR3012655A1 (en) FLASH MEMORY COUNTER
EP3522020A1 (en) Management of a non-volatile memory
EP3188032B1 (en) Storage of data in a flash memory
FR2830667A1 (en) Method for determination of an area of EEPROM or OTP memory in a chip card for use in updating of EEPROM type memory and ensuring that such updates have been reliably executed
FR3067831A1 (en) ATOMICITY MANAGEMENT IN EEPROM MEMORY
FR3104285A1 (en) Checking the integrity of a memory
EP2339587A1 (en) Securing of the deletion of a flash PROM memory card
EP0938095A1 (en) Programmable non-volatile memory and programming method thereof
FR2915828A1 (en) Data writing method for e.g. flash memory in chip card, involves writing data and target page address in erased auxiliary page, invalidating target page and updating table based on writing command of data in target page
FR2799046A1 (en) Methods for random writing of sector of size blow that of erasable block in memory
EP2339586A1 (en) Method for managing cyclical data
EP1969605A1 (en) Method of managing data intended to be written to and read from a memory
FR2915829A1 (en) Data writing method for e.g. flash memory in chip card, involves writing data and target page address in erased auxiliary page, invalidating target page and updating table based on writing command of data in target page

Legal Events

Date Code Title Description
PLSC Publication of the preliminary search report

Effective date: 20171124

ST Notification of lapse

Effective date: 20180131