480 likes | 649 Views
236601 - Coding and Algorithms for Memories Lecture 6. Class Overview. What have we studied so far? Background on memories Flash memories: properties, structure and constraints Rewriting codes – WOM codes What’s next? Other rewriting codes – Lecture 6 (today)
E N D
Class Overview • What have we studied so far? • Background on memories • Flash memories: properties, structure and constraints • Rewriting codes – WOM codes • What’s next? • Other rewriting codes – Lecture 6 (today) • Rank modulation codes – Lecture 7 & 8 • ECC and constrained codes – Lecture 9 • Wear leveling & memory management – Lecture 10 • Storage – Lectures 11-14 • HW 1 – Due today • HW 2 – Will be released tomorrow, due May 1st
Rewriting Codes • Array of cells, made of floating gate transistors • Each cell can store q different levels • Today, q typically ranges between 2 and 16 • The levels are represented by the number of electrons • The cell’s level is increased by pulsing electrons • To reduce a cell level, all cells in its containing block must first be reset to level 0A VERY EXPENSIVE OPERATION
Rewriting Codes • Problem: Cannot rewrite the memory without an erasure • However… It is still possible to rewrite if only cells in low level are programmed
Rewriting Codes Rewrite codes significantly reduce the number of block erasures Store 3 bits once Store 1 bit 8 times Store 4 bits once Store 1 bit 16 times
Rewriting Codes • One of the most efficient schemes to decrease the number of block erasures • Floating Codes • Buffer Codes • Trajectory Codes • Rank Modulation Codes • WOM Codes
Write-Once Memories (WOM) • Introduced by Rivest and Shamir, “How to reuse a write-once memory”, 1982 • The memory elements represent bits (2 levels) and are irreversibly programmed from ‘0’ to ‘1’ Q:How many cells are required to write 100 bits twice? P1: Is it possible to do better…? P2: How many cells to write kbits twice? P3: How many cells to write kbits ttimes? P3’: What is the total number of bits that is possible to write in n cells in t writes? 1st Write 2nd Write
Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Enables to write any t bits before resetting • After every write, the last r bits are recoverable • What is the problem? Maximize the value of t: • Find upper bound on the number of writes t • Find constructions getting close to this bound
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=?
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=?
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=?
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=?
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=?
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=?
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=?
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=?
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=? • Before writing the next bit, the memory is reset to (1,1,1,1,1,1,1,1,1,1,1) and the buffer (1,0,0,1) is written bit by bit to the memory
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=? • Before writing the next bit, the memory is reset to (1,1,1,1,1,1,1,1,1,1,1) and the buffer (1,0,0,1) is written bit by bit to the memory
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=? • Before writing the next bit, the memory is reset to (1,1,1,1,1,1,1,1,1,1,1) and the buffer (1,0,0,1) is written bit by bit to the memory
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=? • Before writing the next bit, the memory is reset to (1,1,1,1,1,1,1,1,1,1,1) and the buffer (1,0,0,1) is written bit by bit to the memory
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=? • Before writing the next bit, the memory is reset to (1,1,1,1,1,1,1,1,1,1,1) and the buffer (1,0,0,1) is written bit by bit to the memory
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=?
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=?
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=?
Construction of Buffer Codes • An (n,q,r,t) Buffer Code: • Contains nq-ary cells • Guarantees t bits writes • The last r bits are recoverable • Example: n=11, q=3, r=4, t=? t=7+4=11
Construction of Buffer Codes • What is the number of writes? • On the first layer: n-r writes • On every consecutive write: n-2r+1 • Together: n-r+(q-2)(n-2r+1) = (q-1)(n-2r+1)+r-1 • Trivial Upper bound: t ≤ (q-1)n
How to Improve? • Example: n=11, q=3, r=4, t=? • Perform the first 7 writes as before
How to Improve? • Example: n=11, q=3, r=4, t=? • Perform the first 7 writes as before • Before writing the next bit, all cells besides the last 4 are raised to level 1
How to Improve? • Example: n=11, q=3, r=4, t=? • Perform the first 7 writes as before • Before writing the next bit, all cells besides the last 4 are raised to level 1
How to Improve? • Example: n=11, q=3, r=4, t=? • Perform the first 7 writes as before • Before writing the next bit, all cells besides the last 4 are raised to level 1
How to Improve? • Example: n=11, q=3, r=4, t=? • Perform the first 7 writes as before • Before writing the next bit, all cells besides the last 4 are raised to level 1
How to Improve? • Example: n=11, q=3, r=4, t=? • Perform the first 7 writes as before • Before writing the next bit, all cells besides the last 4 are raised to level 1
How to Improve? • Example: n=11, q=3, r=4, t=? • Perform the first 7 writes as before • Before writing the next bit, all cells besides the last 4 are raised to level 1
How to Improve? • Example: n=11, q=3, r=4, t=? • Perform the first 7 writes as before • Before writing the next bit, all cells besides the last 4 are raised to level 1
How to Improve? • Example: n=11, q=3, r=4, t=? • Perform the first 7 writes as before • Before writing the next bit, all cells besides the last 4 are raised to level 1 t=7+7=14
How to Improve? • The number of writes now is t = (q-1)(n-r) (instead of (q-1)(n-2r+1)+r-1) The upper bound is (q-1)n
Flash/Floating Codes • k bits are stored using n cells • A write is a change 0→1or 1→0of one of the k bits • Definition – Flash Codes: An (n,k,t)qFlash/Floating Code is a coding scheme that accommodates any sequence of up to t writes of k bits, using nq-level cells, in such a way that a block erasure is never required • Goal: Given k, n, qmaximize the number of writes t
Flash Codes Example: Storing three bits using two 8-level cells 7,0 7,1 7,2 7,3 7,4 7,5 7,6 7,7 6,0 6,1 6,2 6,3 6,4 6,5 6,6 6,7 110 111 5,0 5,1 5,2 5,3 5,4 5,5 5,6 5,7 101 100 4,0 4,1 4,2 4,3 4,4 4,5 4,6 4,7 011 3,0 010 3,1 3,2 3,3 3,4 3,5 3,6 3,7 2,0 2,1 2,2 2,3 2,4 2,5 2,6 2,7 001 000 Bits Diagram 1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7 0,0 0,1 0,2 0,3 0,4 0,5 0,6 0,7 Cells Diagram
Write Deficiency • A trivial upper bound on the number of writes: t ≤ n(q – 1) • Write Deficiency: The difference between the trivial upper bound, n(q – 1), and the guaranteed number of writes t δ = n(q – 1) – t The write deficiency shows how close a given flash code is to the trivial upper bound • Theorem: For any (n,k,t)q flash code where n≥k t ≤ n(q – 1) – [½(q – 1)(k – 1)] For n ≥ k, δ ≥ [½(q – 1)(k – 1)] • For n large enough, the lower bound on the write deficiency does not depend on n!
Example – Two Bits Construction • Every cell is filled to the top before moving to the next one • When the cells coincide, the last cell represents two bits. The cell’s residue modulo 4 sets the bits value: 0 – (0,0) 1 – (0,1) 2 – (1,0) 3 – (1,1) • The maximum number of writes (worst case) is n(q-1) – [(q-1)/2] (optimal) before erasing is required. 4 3 18 22 20 t = 16 11 12 10 13 15 17 14 4 7 8 6 0 5 3 2 9 1 21 19 2 1 0 1 0 4 3 2 0 1 4 2 1 0 3 4 2 0 1 4 3 2 1 0 3 4 2 0 2 1 3 4
Indexed Flash Codes • Partition the k bits into groups of k’ ≤ 6 bits • Partition the cells into blocks of n’< n cells • Each group of bits is represented by one of the blocks • When a block gets full, start using the next empty block • Indexing is needed to indicate for each block which bit-group it represents • Leads to overhead due to index cells v1 v2 v3 v4 v5 vk Bits Cells c1 c2 c3 c4 cn Index Cells
Index-Less Indexed Flash Codes • Use the same idea but without the index cells • How? • Each block consists of k cells and stores one bit • The blocks are used differently in such a way that it is possible to decode which bit each block stores • The bit value is the parity of its block • Example: Storing 4 bits • The memory consists of 4-cell blocks • Assume each cell has 5 levels: 0,1,2,3,4 First Bit Second Bit Third Bit Fourth Bit 4 3 2 1 0
Index-Less Indexed Flash Codes Example: Writing 4 bits using 24 cells of 3 levels Modified Bit Bit Value 1 23 4 2 2 2 2 2 2 2 2 2 2 2 2 1 0 1 0 1 0 0 1 4 4 1 4 1 4 4 1 4 1 4 1 1 1 1 4 4 1 3 3 3 3 3 3 3 2 1 0 1 2 2 1 1 2 0 0 2 1 0 0 2 1 2 0 1 1 0 0 1 2 1 2 0 0 1 2 0 1 1 0 2 0 0 1 2 0 1 2 0 1 2 2 1 0 2 1 0 1 0 2 0 0 1 2 0 0 0 0 When writing stops, at most (k – 1)(k(q – 1) – 1) levels are not used The write deficiency order is δ = O(k2q)
Nearly Optimal Construction • How to continue when writing stops? • Every block is divided into two sub-blocks of k/2 cells • Every sub-block stores one bit • It is not possible to write the bits as before • Now… use the index cells! k/2 k/2 k/2 k/2 k/2 k/2 k cells k cells k cells Index Cells
Nearly Optimal Construction • How to continue when writing stops? • Every block is divided into two sub-blocks of k/2 cells • Every sub-block stores one bit • It is not possible to write the bits as before • Now… use the index cells! • For each sub-block, its bit index is stored in the index cells • Repeat the process recursively log2k steps • At each step, at most 2k – 2 sub-blocks need to be indexed • Theorem: The write deficiency order is δ = O(qklog2k/logq) k/2 k/2 k/2 k/2 k/2 k/2 X X 1 2 3 4 3 2 1 2 3 4 3 2 Index Cells k/4 k/4 k/4 k/4 k/4 k/4
Hot+Cold Rewrite kbits WOM WOM hot/cold kbits twrites The cold bits can be written only once The hot bits can be written multiple times
1 Hot + 1 Cold, n=1 4 5 • Hot-bit write: go UP • Cold-bit write: switch RIGHT • 1 cold write, q/2-1 hot writes (optimal) • x1.5 than 2 hot, +1 than floating codes 2 3 0 1 cold,hot= 0,0 0,1 1,0 1,1
1 Hot + 1 Cold, n=2 0: 0,0 cold=1 cold=1 c2 • Hot-bit write: alternate RIGHT-UP • Cold-bit write: +2 UP • 2q-3 total writes, up to 1 cold write (optimal) • x2 than 2 hot, x1.33 than floating codes 1: 0,1 3 2 4 3 2 4 2: 1,0 3 2 1 cold=0 3 3 2 1 cold=0 3 3: 1,1 2 3 2 1 0 2 3 2 1 0 2 2 1 0 1 0 1 1 0 1 0 0 0 1 0 0 0 1 2 3 4 0 1 2 3 4 c1