Non-volatile memory counter
Granted 29 May 2012 · no office action yet
Current assignee: Microsemi Corporation · originally Microchip Technology
Law firm: Law firm · Log in to unlock
Attorney: Attorney · Log in to unlock
Inventors: Kerry David Maletsky, Randall Wayne Melton, Brad Phillip Garner · Examiner: Tuan T Lam · AU 2816 · TC 2800
Life of the application
21 dated eventsAbstract
A counter is efficiently implemented in non-volatile memory by using two binary counters and selectively using one or the other as a current counter. Writes to the binary counters are minimized by using two linear counters and using the state of the binary counters to determine which binary counter contains the current count. Write operations can be performed to the “not current†binary counter with the final write operation being to the linear counters. The linear counter write operations can be in program-only mode so that a power failure will not result in a loss of counts.
Description
7 parts›TECHNICAL FIELD
This subject matter is generally related to electronics, and more particularly to counters implemented in non-volatile memory.
›BACKGROUND
Non-volatile memories (e.g., EEPROM) have two limitations that make simple counter storage difficult. A first limitation is that non-volatile memories have write endurance limits and can only be written a limited number of times before that location becomes unreliable. Typically, this limit is around one hundred thousand cycles. If a counter is incrementally written to non-volatile memory without any wear leveling the counter has an upper limit of 100K cycles.
A second limitation relates to power loss during the write operation. A typical EEPROM is written in two steps. The first step is an erase cycle (e.g., memory to all 1's) and the second step writes the data (e.g., 0's get written over by 1's). If power is lost during the erase/write cycle the memory location might be in an erased state or in a partially programmed state. This problem can be compounded when the memory locations span multiple bytes or pages.
›SUMMARY
A counter is efficiently implemented in non-volatile memory by using two binary counters and selectively using one or the other as a current counter. Writes to the binary counters are minimized by using two linear counters and using the state of the linear counters to determine which binary counter contains the current count. Write operations can be performed to the “not current” binary counter with the final write operation being to the linear counters. The linear counter write operations can be in program-only mode so that a power failure will not result in a loss of counts.
Various implementations of the subject matter described herein may provide one or more of the following advantages: (1) the counter is space efficient; (2) the counter reduces the number of write operations to non-volatile memory; (3) the counter avoids time consuming check/repair operations; and (4) the counter will reliably increase the count or hold the current count value in the event of a power failure.
›DESCRIPTION OF DRAWINGS
FIG. 1 is a schematic diagram of an exemplary memory system including a counter.
FIG. 2 illustrates an exemplary data structure for the counter of FIG. 1 .
FIGS. 3A and 3B are flow diagrams of exemplary process for counting in memory using the counter data structure of FIG. 2 .
FIGS. 4-6 are tables illustrating operations performed during a count sequence according to three different example implementations.
›DETAILED DESCRIPTION · 1 of 3
Exemplary Memory System
FIG. 1 is a schematic diagram of an exemplary memory system 100 including a counter. Memory system 100 can be an integrated circuit device that uses non-volatile memory to implement a counter. In some implementations, system 100 can include controller 102 , non-volatile memory 104 , interface 106 and power supply 108 , each of which can communicate over bus 112 . Non-volatile memory 104 can include counter 110 .
In response to an increment counter command input at interface 106 , counter 110 is incremented. The command can be received on one or more pins of an integrated circuit device. The command can be provided by an application or other system. Controller 102 can be, for example, a general purpose microprocessor or a memory controller. Interface 106 can include circuitry for receiving commands based on a protocol or instruction set. Power 108 can be any power source (e.g., a battery, power input pin). Non-volatile memory can be, for example, Electrically Erasable Programmable Read-Only Memory (EEPROM). Counter 110 is stored in non-volatile memory 104 and, in some implementations, can have the structure described in reference to FIG. 2 .
Exemplary Data Structure for Counter
FIG. 2 illustrates an exemplary data structure for the counter of FIG. 1 . In some implementations, counter 110 can include subcounter A and subcounter B. Subcounter A includes binary counter 202 a and linear counter 202 b and subcounter B includes binary counter 204 a and linear counter 204 b . Binary counters 202 a , 204 a are count limited to the nth power of 2, where n is an integer value representing a number of bits. Linear counters 202 b , 204 b are count limited to the number of bits m (e.g., 8, 16, 32 bits), where m is an integer value and can be a power of 2. In some implementations, n can be equal to m. In some implementations, linear counter writes can be made in program-only mode so that power failure will not result in information loss. In program-only mode if an erase step of non-volatile memory is omitted then modification can cause bits to transition from erased to programmed but not programmed to erase.
The example of FIG. 2 , illustrates one cycle of toggling between subcounters A and B. In a practical implementation, the toggling between subcounters A and B would continue as illustrated in FIG. 2 until the count limits of the binary counters (2 n ) is reached or counter 110 is otherwise reset. After reset, the toggling between subcounters A and B can resume. Counter 110 can be implemented in a combination of hardware and microcode. In the example shown, subcounter A is the current working counter and binary counter 204 a and linear counter 204 b holds the current count. In this example, it is assumed that linear counter 202 b is initially reset (e.g., set to all “1”s).
Each time a request or command to increment counter 110 is received, linear counter 202 b is incremented by one until linear counter 202 b is in an almost full state. When linear counter 202 b is almost full, binary counter 204 a of subcounter B is loaded with the value of binary counter 202 a , binary subcounter A now holds the current count of counter 110 , linear counter 204 b of subcounter B is reset (e.g., set to all “1”s), and linear counter 202 b of subcounter A is incremented by one (e.g., last “1” bit is written to a “0”) to indicate that linear counter 202 b is now full.
When subcounter B is the working counter, linear counter 204 b of subcounter B is currently counting. Each time a request or command to increment counter 110 is received, linear counter 204 b is incremented by one until linear counter 204 b is almost full. When linear counter 204 b is almost full, binary counter 202 a of subcounter A is loaded with the value of binary counter 204 a incremented by one, linear counter 202 b of subcounter A is reset (e.g., set to all “1”s), and linear counter 204 b of subcounter B is incremented by one, binary subcounter 204 a once again becomes the current count of counter 110 .
In some implementations, an almost full state can be determined by monitoring the contents of the linear counters. For example, for a 16-bit linear counter, an EMPTY or reset state can be represented by FFFFh, a FULL state can be represented by 0000h and an ALMOST FULL state can be represented by 8000h, as described in more detail with respect to the example “C” code below. Incrementing linear counters 202 b , 204 b includes writing over a “1” with a “0” in the next most significant bit position of the linear counter. Thus, each increment of linear counter 202 b or 204 b requires a single write operation.
The structure of counter 110 described above is space efficient, limits the number of write operations to non-volatile memory, avoids time consuming check/repair operations, and provides a reliable, never decreased count in the event of a power failure.
Exemplary Process
FIGS. 3A and 3B are flow diagrams of an exemplary process 300 for counting in memory using the counter 110 data structure of FIG. 2 . The counter is stored in non-volatile memory, which has a limited write endurance (e.g., 100K cycles). In some implementations, counter 110 includes subcounter A and subcounter B. Subcounter A and subcounter B each include a binary counter and a linear counter. The binary and linear counters can be physically stored near each other in memory (e.g., contiguous memory) or in different memory locations. The linear counter can have a count limit of m, where m is an integer (e.g., m=16) equal to the number of bits. The binary counter can have a count limit of 2 n , where n is an integer value equal to a number of bits.
Process 300 can be begin by designating a first subcounter (e.g., subcounter B) as storing a current count for counter ( 302 ). The current count is the count that is returned in response to a request. A request can be received from an application or system. Each time a request to increment the counter is received ( 303 ), a first linear counter of the first subcounter is incremented ( 304 ). The first linear counter increments by one until the first linear counter is in an almost full state ( 306 ). For example, the first linear counter can be almost full when a “0” is written to the m−1 bit position in an m-bit linear counter. An empty first linear counter indicates that subcounter A is the current counter.
›DETAILED DESCRIPTION · 2 of 3
If the first linear counter is almost full ( 306 ), the count of the first binary counter is loaded into a second binary counter of the second subcounter ( 310 ), the second linear counter is reset ( 312 ) and the first linear counter is incremented to a FULL state (e.g., incremented by 1) ( 314 ). The second binary counter is designated as storing the current count of the counter ( 313 ).
Each time a request to increment the counter is received ( 315 ), a second linear counter of the second subcounter is incremented ( 316 ). The second linear counter increments by one until the second linear counter is almost full ( 318 ). For example, the first linear counter can be almost full when a “0” is written to the m−1 bit position in an m-bit linear counter. An empty second linear counter indicates that subcounter B is the current counter.
If the second linear counter is almost full ( 318 ), the first binary counter of the first subcounter is incremented by one ( 320 ), the count of the second binary counter+1 is loaded into the first binary counter ( 322 ), the first linear counter is reset ( 324 ) and the second linear counter is optionally incremented to a FULL state (e.g., incremented by 1) ( 325 ). The first binary counter is designated as storing the current count of the counter ( 302 ).
The process 300 continues until both the first and second binary counters become full. If n is selected to be sufficiently large for the desired application, the binary counters will likely not become full during the lifetime of the application. Example implementation of process 300 can be implemented in “C” code as follows:
In the example code above the states of linear counts are defined as FULL=0000h, EMPTY=FFFFh and ALMOST FULL=8000h. Each time a request or command to increment the counter is received a write operation is performed on a linear counter, where a “1” is overwritten with a “0.” For example, for a 4-bit linear counter, the contents of the linear counter after each increment request is fulfilled would be: 1110, 1100, 1000, where an ALMOST FULL state would occur when the count was 1000 or 8h. Some implementations may automatically initialize a counter to a logical 0 state from a default manufacturing value for the memory.
The above example code implements the counter data structure and process described in reference to FIGS. 2 and 3 . The example code also includes various methods for handling potential errors, such as when counters reach their count limit.
Process 300 and the example code described above provides an efficient non-volatile memory counter that is space efficient, limits the number of write operations to non-volatile memory, avoids time consuming check/repair operations, and provides a reliable count in the event of a power failure.
FIGS. 4-6 are tables 400 , 500 , 600 illustrating operations performed during a count sequence according to three different example implementations. In these example count sequences, two binary counters and two linear counters are used. Lin A and Bin A are linear and binary counters, respectively, of subcounter A, and Lin B and Bin B are linear and binary counters, respectively, of subcounter B. Read Value is the value read from the counter by an application reading the counter from the counter. A text description for each operation is shown next to the operation and both sides of the table. Operations that relate to the transition between subcounters A and B are shown on the right side of each table. In some implementations, the result of a read counter value operation that is shown in column sixth of FIGS. 4-6 has the following format:
The Flag byte indicates which byte of the linear counters is returned. For some implementations, 1 byte of a linear counter out of a possible 4 bytes is returned (e.g., 2 bytes for the first linear counter, 2 bytes for the second linear counter). The Flag byte is used to determine which byte has been returned.
Referring to Table 400 , at step 0 Lin A is reset to all “1”s and then incremented for steps 1 and 2 until almost full at step 3. During this time, Bin B stores the current count of the counter, which is 0 for this example. At step 4, the contents of Bin A is copied into Bin B, Lin B is reset to all “1”s and Lin A is incremented by one so that it becomes full. At this point, Bin A stores the current count of the counter.
Lin B is incremented for steps 5 and 6 until almost full at count 7. At count 7, the count of Bin A is incremented by one, Lin A is reset to all “1”s and Lin B is incremented by one so that it becomes full. Bin B once again stores the current count of the counter. This process repeats for steps 8-17.
Referring to Table 500 , at step 0 Lin A is reset to all “1”s and then incremented for steps 1 and 2 until almost full at step 3. During this time, Bin B stores the current count of the counter, which is 0 for this example. At step 4, the contents of Bin A is copied into Bin B, Lin B is reset to all “1”s and Lin A is incremented by one so that it becomes full. At this point, Bin A stores the current count of the counter.
Lin B is incremented for steps 5 and 6 until almost full at count 7. At step 7, the contents of Bin B is moved into Bin A and incremented by one, Lin A is reset to all “1”s and Lin B is incremented by one so that it becomes full. Bin B once again stores the current count of the counter. This process repeats for steps 8-17.
Referring to Table 600 , at step 0 Lin A is reset to all “1”s and then incremented for counts 1 and 2 until almost full at count 3. During this time, Bin B stores the current count of the counter, which is 0 for this example. At step 4, the contents of Bin A is copied into Bin B, Lin B is reset to all “1”s and Lin A is incremented by one so that it becomes full. At this point, Bin A stores the current count of the counter.
Lin B is incremented for steps 5 and 6 until almost full at count 7. At count 7, Lin B is incremented by one so that it becomes full. Bin A stores the count from Bin B incremented by one. Lin A is reset to all “1”s. This process repeats for steps 8-17.
›DETAILED DESCRIPTION · 3 of 3
While this document contains many specific implementation details, these should not be construed as limitations on the scope what may be claimed, but rather as descriptions of features that may be specific to particular embodiments. Certain features that are described in this specification in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable sub combination. Moreover, although features may be described above as acting in certain combinations and even initially claimed as such, one or more features from a claimed combination can in some cases be excised from the combination, and the claimed combination may be directed to a sub combination or variation of a sub combination.
›Tables in the description — 1
| 0 | 1 | 2 | 3 | |
| Value | Lin CNT byte | Flag byte | Binary CNT(LSB) | Binary CNT(MSB) |
Claims as granted
20 claimsLog in to read the claims of this application.
Log in to unlockClassifications
5 codes- G06M3/00
- H03K23/00
Claim changes
SoonSee which claims were amended, added or cancelled during examination, with every added and removed word marked.
The published claims of this application are not paired with the granted ones in what we hold.
File wrapper
See the full prosecution history — every USPTO and applicant action on this file, in order.
Log in to unlockDocuments
Log in to open the documents of this file: the application as filed, every office action and response, the notice of allowance.
Log in to unlockChain of title
See the full assignment history — every owner this patent has passed through, with recordation dates and reel/frame numbers.
Log in to unlock