In accordance with an aspect of the invention, a memory system includes an address scrambler that converts sequential logical addresses to non-sequential physical addresses for a memory array. Thus, record and playback operations use sequential input addresses for a data sequence but access storage locations that are not sequential in a row or column. Accordingly, use of memory with defects such as column and row defects do not cause loss of lengthy runs of consecutive data values. Instead, row defects and column defects cause scattered errors. Such scattered errors are tolerable in error tolerant memory applications such as voice, sound, and digital imaging. Accordingly, the cost of a record-and-playback system can be reduced by eliminating redundant rows, columns, and decode circuits and eliminating the processing and testing steps that activate redundant circuits.
FIG. 1 shows a semiconductor memory 100 in accordance with an embodiment of the invention. Memory 100 is an analog flash memory which includes an array 110 of memory cells, where each memory cell in the array is an independently addressable storage location capable of storing an analog value. Flash memory such as flash EPROM or flash E2 PROM is non-volatile and has independently erasable sectors 112 of memory cells. Alternative embodiments of the invention employ different memory architectures as in non-volatile memories such as EPROM and E2 PROM and volatile memories such as DRAM and SRAM, and each memory cell can store an analog value or one or more bits of a digital value.
Array 110 contains rows and columns of memory cells such as floating gate or split gate transistors having control gates coupled to row lines 114 and drains coupled to column lines 118. Each row line 114 connects to an associated row of memory cells in array 110. Each column line 118 connects to an associated column of memory cells in array 110. Array 110 is also divided into independently erasable sectors 112, where each sector contains one or more rows of memory cells. FIG. 3 shows an alternative flash memory architecture employing sectors that contain columns rather than rows of memory cells. Each sector 112 in array 110 has a source line 116 that connects to the sources of the memory cells in the sector. Row and source decoders and drivers 120 connect to row lines 114 and source lines 116 and apply voltages to selected row and source lines as required for erase, write, and read operations. Column decoders and drivers 130 connect to column lines 118 and apply voltages to selected column lines as required for erase, write, and read operations. U.S. patent application Ser. No. 08/781,741, entitled "Source Biasing in Non-Volatile Memory having Row-Base Sectors", describe decoders and drivers 120 and 130 for specific embodiments of the invention and is incorporated by reference herein in its entirety.
During a read or write to memory array 110, row decoder 120 and column decoder 130 respectively require a row address and a column address that respectively identify a row line and a column line coupled to the memory cell (i.e., storage location) being read or written. In accordance with an aspect of the invention, memory 100 includes an address scrambler 140 that generates a physical address from an input logical address i. The physical address contains a physical row address Y and a physical column address X that respectively represent row and column numbers for a memory cell in array 110. Input address i may be an address signal input to memory 100 for random access to memory cells in array 110 or may be from an on-chip counter that generates a sequential address signal for recording or playing back a data sequence. Input address i logically identifies a storage location being accessed but is not required to contain the physical row and column number identifying a location in array 110. Instead, scrambler 140 converts the input address i to the physical address for the storage location being accessed.
Scrambler 140 can employ a variety of scrambling or encryption techniques when converting an input (or logical) address to a physical address. Generally, when input address i is restricted to the address space of array 110, scrambler 140 implements a one-to-one mapping of the address space of array 110 back onto itself. With a one-to-one mapping, a user uses input address i for memory accesses, and the actions of scrambler 140 are transparent to the user. Scrambler circuits implementing such mappings can take a variety of forms particularly because of the large number of possible mappings for a typical size memory array.
For flash memory embodiments of the invention such as memory 100, scrambler 140 preferably maps all input addresses logically associated with a sector to physical addresses within a single sector, either the same sector or another sector. This keeps data targeted for a sector together so that erasing a sector erases the data targeted to be together. For example, in an audio recording and playback system, an audio signal is represented as a continuous sequence of samples. It is often desirable to erase only a specific duration of the audio signal by erasing a portion of the sequence. If consecutive samples of an audio signal are stored in the same sector, erasing a sector erases only a piece of the audio signal but leaves the remainder of the audio signal intact. The duration of the portion erased depends on the size of each sector in the memory. Accordingly, a mapping that maps a sector onto a sector preserves the ability to erase selected portions or periods of a recorded signal.
FIG. 2 shows an embodiment of an address scrambler 200. Scrambler 200 splits input logical address signal i into (m+1) least significant bits CA0 to CAm and (n+1) most significant bits RA0 to RAn. Bits CA0 to CAm represent an input logical column address CA, and bits RA0 to RAn represent an input logical row address RA. For scrambler 200, the physical column address X for memory array 110 is the same as input column address CA, but the physical row address Y is a combination of input column address CA and input row address RA such that row address Y changes when input row address RA is constant and input column address CA changes. Thus, scrambler 200 maps sequential input addresses having a single value for input row address RA to several different rows in array 110.
Scrambler 200 uses an adder 240 to generate physical row address Y for array 110 from input row and column addresses RA and CA. The most significant bits of row address Y identify a sector in array 110 and are the same as bits RA(k+1) to RAn of input row address RA. Accordingly, scrambler 200 does not change the sector that input address i identifies for access but maps sequential input logical addresses corresponding to memory cells located along diagonals in the sector. Alternatively, scrambler 200 could map the sector identified by input bits RA(k+1) to RAn to a different sector using one-to-one mapping of sectors onto themselves. Adder 240 adds input column address CA to the (k+1) least significant bits RA0 to RAk of input row address RA to generate (k+1) least significant bits Y0 to Yk of row address Y, where each sector 112 contains (k+1) rows of memory cells. Any carry bits are ignored. The least significant bits Ylow of row address Y identify a row within a sector. Since adder 240 adds input row address RA and input column address CA together when generating physical row address Y, both column address X and row address Y change when input address i increments, and two consecutive values of input address do not map to the same physical row.
A potential concern for scrambler 200 arises when a sequence of input addresses increments input row address RA and keeps input column address CA constant. A sequence of input addresses with constant input column address CA is a logical column. Scrambler 200 maps such a sequence of input addresses to the same physical column so that the data sequence is written or read from a single physical column. In such cases, a column defect can cause errors in a long run of sequential data. However, with the input column address CA being defined as the least significant bits of the input address i, the natural ordering of input address corresponds to a row and not a column. An address counter, for example, which could supply the input address i when writing or reading a data sequence most conventionally sequentially adds to the least significant bits of input address i which form column address CA. Sequential input addresses from such a counter correspond to storage locations scattered across the physical rows in a sector.
FIG. 3 shows a semiconductor memory 300 including a memory array 310 having sectors 312, where each sector 312 contains one or more columns of analog memory cells. Each sector 312 in array 310 has a source line 316 that connects to the sources of the memory cells in the sector. Source and column decoders and drivers 330 connect to source lines 316 for sectors 312 and to column lines 318 for columns of memory cells in array 310. Row decoder and drivers 320 connect to row lines 314 for rows of memory cells in array 310. Using circuits and processes known in the art, decoders and drivers 320 and 330 apply voltages to selected row, column, and source lines as required for erase, read, and write operations. Since each sector of array contains several columns, writing sequential data to column-by-column may be more convenient than writing the data row-by-row. An address scrambler 340 provides row and column address signals Y and X to identify a memory cell selected for a read or write operation. Address scrambler 340 preferably maps logical columns as identified by a constant input logical column address CA to randomly distributed columns in a sector 312.
FIG. 4 shows an embodiment of an address scrambler 400 for memory 300. Scrambler 400 is the same as scrambler 200 of FIG. 2, except that the roles of input row address RA and input column address CA are reversed from those described above in regard to FIG. 2. In FIG. 4, k is the number of columns in a sector 312. Scrambler 400 prevents a data sequence with constant input column address CA from being mapped to a single physical column. Instead such a data sequence is scattered across the columns of a sector.
An advantage of scattering write addresses across row or columns of a flash memory array is reduction in the accumulated disturbance of data in the first rows of the array. In particular, writing short data sequences conventionally only writes to the first rows, and programming voltages applied to row lines disturb data values stored in memory cells in the first rows. Address scrambling spreads the disturbance across the array even for short data sequences. Scramblers 200 and 400 respectively scramble the row and column addresses. Scrambling only the row address or only the column address may have a speed advantage in a memory where column or row decoding is relatively slow. For example, time delay cause by scrambling row addresses may be partially or totally hidden in read or write times that are delayed by slower column decoding circuits. As discussed above, scrambling only rows or only columns is useful for eliminating long runs of lost data caused respectively by row defects or column defects. A disadvantage of using scrambler 200 with an array having a row defect or using scrambler 400 with an array having a column defect is the creation of a periodic error. The periodic error may be noticeable in an analog signal such as an audio signal. The periodic nature of the error can be eliminated using a scrambler that is more random than scrambler 200 or 400.
FIG. 5 illustrates an alternative address scrambler 500 in accordance with an embodiment of the invention. Address scrambler 500 includes a mixer 510 having input terminals coupled to some or all of the bits of input address i. The bits of input address i that are not coupled to mixer 510 form a signal SEC13 SEL that identifies a sector in a flash memory. Signal SEC13 SEL may be, for example, the most significant bits of the logical row or column address depending on the sector configuration. Mixer 510 performs a one-to-one mapping of values of input address i to the values of an output address signal having parts X and Y. For example, mixer 50 can permute or reorder bits from input address i so that long runs of consecutive input address are not in the same row or column. Preferably, mixer 510 swaps some (but not all) of the bits of logical row address RA and with some (but not all) of the bits of logical column address CA so that neither a logical column nor a logical row is mapped to a physical column or row.
Table 1 shows example permutations of four bits of an input address.
Example permutation 1, which swaps all of the address bits of input row address RA with all of the bits of input column address CA, maps a logical row to a physical column. Accordingly, if a data sequence is written to a logical row and example permutation 1 is used, the data sequence is stored in a physical column. This is undesirable because a column defect would cause loss of a lengthy sequence of consecutive data. Example permutation 2 and 3, which swap some of the bits of input row address RA with some of the bits of input column address CA, provide better mixing of a logical row into multiple physical columns and rows.
As a further aspect of the invention, scrambler 500 includes a storage element or register 520 for a key or access code. Register 520 can be user-accessible volatile memory to permit a user to change the key for writing or reading data in a memory. Based on the value of key in register 520, mixer 510 selects from among the set of suitable permutations input bits. A typical memory containing, for example, 512 physical row addresses and 512 column address has 18-bit addresses and about 6.4×1015 possible permutations of address bits. If the memory has a flash architecture with 16 rows or columns per sector, 13-bits are available for permutations which keep data values within a sector, and there are about 6.2×109 possible permutations. Suitable permutations can be selected based on the effectiveness of the permutation at mixing sequential logical addresses in physical rows and columns and/or the similarity or dissimilarity to other suitable permutations. While not all of the possible permutation are suitable, a large number of suitable permutations should be available for a typical memory. This permits a large number of possible access codes to select a specific one of the suitable permutations.
As an alternative to permuting bits of the input signal, mixer 510 can be any logic that implements a one-to-one, "random" mapping of input signal values to output signal values. The output signal values can correspond to only a portion of the available memory storage and are not required to contain the same number of bits as are in the input signals. Techniques known for data encryption, which often uses keys, can also be employed for scrambling individual addresses or series of addresses. Circuits implementing one-to-one mappings are well known in the art. Mixers that implement simple permutations of bit values are only one example. Alternatively, a mapping circuit can include inverters on selected bits, parity check circuits that enable one permutation and set of inversions for even parity values and another permutation and set of inversions for odd parity values, or any random logic that provides a one-to-one mapping. Whether, a one-to-one mapping is sufficiently random depends on how well the mapping scatter sequential input values across and array or sector. In such embodiments, memory location 520 can either select a mapping circuit from among a group of circuits implementing "random" mappings and/or provide parameters for the mapping circuit.
FIG. 6 shows a memory 600 permitting random access and writing and reading of data sequences, for example, for recording and playing of audio signals. Memory 600 includes row and source decoders and drivers 120, column decoders and drivers 130, and an array 110 having row-based sectors 112 as described above in regard to FIG. 1. For audio recording, an analog signal from a microphone or other device is sampled to generate sequential samples Si, and decoders and drivers 120 and 130 select and apply voltages to a memory cell in array 110 to set the threshold voltage of the memory cell at a level indicating one of samples Si. Memory 600 is placed in sequential mode where a multiplexer 655 provides an address signal from an address counter 650 to address scrambler 640. In this mode an external address initializes address counter 650 to a starting point of a sequential access, and counter 650 increments the logic address when each sample Si is written to memory array 110. Address scrambler 640 generates the physical addresses for selection of storage for samples Si. In particular, scrambler 640 converts the logical address from counter 650 to a physical address including physical column address X and physical row address Y. Sequential samples Si are written to memory array 110 at storage locations that the physical addresses identify.
Scrambler 640 includes mixer 510 that mixes all of the bits of the logical addresses using a one-to-one mapping selected according to a user-programmable key value from register 520. The key value is user-provided and selects one of a set suitable mappings. Output from mixer 510 includes a group of bits selected as the physical column address X, a group of bits Yhigh selected for the most significant bits of row address Y, and a group of bits that adder 240 adds to the physical column address X to generate the least significant bits Ylow of physical row address Y. Bits Yhigh select the sector to which the current sample is written. Accordingly, to keep consecutive samples having the same logical sector in the same physical sector, bits in Yhigh must only depend on the most significant bits of logical address (i.e., of the logical row address Y). The number of rows in a sector 112 determines the maximum number of bits in Ylow. Typically, although not necessarily, the maximum value of bits Ylow is equal to the number of rows in a sector. In an alternative embodiment, the key in register 520 selects the partition of row address Y between bits Ylow and bits Yhigh.
As noted above, suitable permutations or mappings of the logical address are selected according to the efficiency of scattering sequential address across the physical rows and columns. However, scrambler 640 includes adder 240 which further mixes sequential addresses. Accordingly, the net effect of adder 240 and mixer 510 must be considered. When security is a greater concern than reducing the effects of row or column defects, a set of suitable permutations or mappings includes permutations or mappings that provide incomprehensible playback when the key for playback differs from the key for recording.
For a playback operation, address counter 650 generates sequential logical addresses that scrambler 640 converts to physical addresses for reading memory array 110. Filters, a converter, and an amplifier (not shown) convert the samples read to an output analog audio signal which a speaker (not shown) coverts to sound. In order for the output audio signal to mimic the recorded signal, scrambler 640 must implement the same mapping during the playback operation as was used during the recording operation, that is, the user must provide the correct key.
For random access of memory array 110, memory 600 operates in a mode where multiplexer 655 provides the external address to scrambler 640. Scrambler 640 converts the external address to a physical address in array 110. Random access can be for any type of data and is not limited to sequential data or data representing an analog or continuous signal. The location of each datum in array depends on the key used when the datum was written and cannot be easily identified for reading without the appropriate key in register 520.
For scrambled random access to a memory, scrambler 640 maps logical addresses to physical address. However, when only sequential access is required, a scrambler can generate a random series without the need of an input address except to select a starting point of a sequential access. FIG. 7 illustrates a pseudo-random series generator 700 which includes a shift register 710, an XOR gate 720, and a programmable switch 730 and generates a pseudo-random series. Generator 700 has an 8-bit output signal RND that represents the content of shift register 710 and changes according to the pseudo-random series. Output signal RND and the content of shift register 710 are initialized accordingly to a non-zero input signal SEEDIN and change each time a control signal SHIFTCNTRL causes shift register 710 to perform a left shift. During a shift, a most significant bit shifts out of shift register 710 as an ignored carry bit Cout, and a bit from XOR gate 720 shifts into the least significant bit. XOR gate 720 generates an output bit that is 1 only when an odd number of the input bits are 1. Programmable switch 730 selects which bits from shift register 710 are input to XOR gate 720. Not all possible combinations of input bits generate a random series of suitable length. However, with bits 7, 3, 2, and 1 of shift register 710 connected to the input terminals of XOR gate 720, the content of shift register 710 takes on every value in a range from 1 to 255 before repeating any of the values. For a full 8-bit range of values (i.e., 0 to 255), a zero-valued signal (representing eight 0 bits) can be inserted at any point in the series in place of the output from shift register 710. While the zero-valued signal is asserted, the contents of shift register 710 is preserved so that the series can resume as normal when required.
Generator 700 is only one example of circuit that generates a pseudo-random series and can be varied in a variety of ways. For example, a right shift could be used. A larger or smaller shift register and an XOR gate coupled to the shift register can provide a different range for the pseudo-random series. W. H. Press, S. A. Teukolsky, W. T. Vetterling, and B. P. Flannery, "Numerical Recipes in C," 2nd edition, Cambridge University Press, 1992 describes pseudo-random number generators of this type using shifted values up to 100 bits in size.
Pseudo-random series generators like generator 700 are applicable in variety of ways to the circuits described herein. For example, for sequential memory access, the combination of adder 240, mixer 510, and address counter 650 as shown in FIG. 6 can be replaced with a pseudo-random series generator like generator 700 where the range of the random series is equal to the sector size. Storage location 520 provides seed signal SEEDIN to generator 700 at the start of the series for writing to or reading from a sector. Seed value SEEDIN may depend of the sector being accessed. The random series of addresses from the generator effectively eliminates long lapses and periodic errors caused by a row or column defect. In audio, for example, a row or column defect shows up as random noise rather than a periodic artifact or an interval of static. However, a seed value only selects a starting point for the random series, and an incorrect seed value may leave portions of a recording audible. Thus, security protection is minimal.
FIG. 8 shows a memory 800 having an alternative use of a random series generator 855 which is of the type shown in FIG. 7 but has a range matching the size of a sector 112 in memory array 110. Memory 800 is similar to memory 600 of FIG. 6 but has an address scrambler 840 that differs from address scrambler 640 of memory 600. In address scrambler 840, a sector counter 850 and series generator 855 provide the input address signal to mixer 510. For each memory location accessed, series generator 855 changes the output signal. Mixer 510 maps the bits of the signal from series generator 855 to a physical column address X and the low bits Ylow of row address Y. Sector counter 850 generates a sector count identifying the sector being accessed and increments or changes the sector count at the start of an access of a sector. To keep sequential samples Si together in a sector, mixer 510 has an output signal Yhigh that selects a sector 112 and is independent of the value from series generator 855. However, mapping of the series from generator 855 to signals X and Ylow can depend on the sector as identified by sector counter 850. Mixer 510 and key 520 provide additional user selectable scrambling for improved security over use of generator 855 without a mixer. A disadvantage of memory 800 is the difficulty of providing random access for data that was sequentially stored or is to be sequentially read. For example, finding a particular address may require several shifts in generator 855.
Although the invention has been described with reference to particular embodiments, the description is only an example of the invention's application and should not be taken as a limitation. In particular, even though much of preceding discussion was aimed at mappings implemented using permutations and additions, alternative embodiments of the invention can include any circuit that is capable of performing a mapping from a logical address space to a physical address space. Further, although use of a key value was discussed primarily in the context of selecting a permutation of bits of a logical address, such keys can be used generally as a parameter to select from among a family of mappings. Further, although embodiments of the invention were described in the context of data associated with sequential audio samples, embodiments of the invention are applicable to any organized or ordered data structure not limited to time ordered samples. For example, financial, medical, or other personal data can be stored in an access card containing a memory with address scrambling in accordance with the invention. In the event that the access card is lost or stolen, unauthorized retrieval of the stored information in meaningful form is difficult since logical addresses of data and therefore the meaning of the data stored depends on the access code. Further, data can be encrypted before storage using data encryption and stored using address scrambling or encryption as described herein. Various other adaptations and combinations of features of the embodiments disclosed are within the scope of the invention as defined by the following claims.