48
236601 - Coding and Algorithms for Memories Lecture 6 1

236601 - Coding and Algorithms for Memories Lecture 6

  • Upload
    flynn

  • View
    43

  • Download
    0

Embed Size (px)

DESCRIPTION

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) - PowerPoint PPT Presentation

Citation preview

Page 1: 236601 - Coding and Algorithms  for  Memories Lecture 6

1

236601 - Coding and Algorithms for

MemoriesLecture 6

Page 2: 236601 - Coding and Algorithms  for  Memories Lecture 6

2

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

Page 3: 236601 - Coding and Algorithms  for  Memories Lecture 6

3

• 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

Page 4: 236601 - Coding and Algorithms  for  Memories Lecture 6

4

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

Page 5: 236601 - Coding and Algorithms  for  Memories Lecture 6

5

Rewriting Codes

Store 3 bits once

Store 1 bit 8 timesStore 4

bits onceStore 1 bit 16 times

Rewrite codes significantly reduce the number of block

erasures

Page 6: 236601 - Coding and Algorithms  for  Memories Lecture 6

6

• One of the most efficient schemes to decrease the number of block erasures

• Floating Codes • Buffer Codes• Trajectory Codes• Rank Modulation Codes• WOM Codes

Rewriting Codes

Page 7: 236601 - Coding and Algorithms  for  Memories Lecture 6

7

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 k bits twice?P3: How many cells to write k bits t times?P3’: What is the total number of bits that is possible to write in n cells in t writes?

1st Write

2nd Write

Page 8: 236601 - Coding and Algorithms  for  Memories Lecture 6

8

Buffer Codes• An (n,q,r,t) Buffer Code:– Contains n q-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

Page 9: 236601 - Coding and Algorithms  for  Memories Lecture 6

9

Construction of Buffer Codes

• An (n,q,r,t) Buffer Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?

Next Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)

Page 10: 236601 - Coding and Algorithms  for  Memories Lecture 6

10

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)

• An (n,q,r,t) Buffer Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?

Page 11: 236601 - Coding and Algorithms  for  Memories Lecture 6

11

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)1 (0,0,1,1) (0,0,0,0,1,1,0,0,0,0,0)

• An (n,q,r,t) Buffer Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?

Page 12: 236601 - Coding and Algorithms  for  Memories Lecture 6

12

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)1 (0,0,1,1) (0,0,0,0,1,1,0,0,0,0,0)0 (0,1,1,0) (1,0,0,0,1,1,0,0,0,0,0)

• An (n,q,r,t) Buffer Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?

Page 13: 236601 - Coding and Algorithms  for  Memories Lecture 6

13

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)1 (0,0,1,1) (0,0,0,0,1,1,0,0,0,0,0)0 (0,1,1,0) (1,0,0,0,1,1,0,0,0,0,0)0 (1,1,0,0) (1,1,0,0,1,1,0,0,0,0,0)

• An (n,q,r,t) Buffer Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?

Page 14: 236601 - Coding and Algorithms  for  Memories Lecture 6

14

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)1 (0,0,1,1) (0,0,0,0,1,1,0,0,0,0,0)0 (0,1,1,0) (1,0,0,0,1,1,0,0,0,0,0)0 (1,1,0,0) (1,1,0,0,1,1,0,0,0,0,0)1 (1,0,0,1) (1,1,0,0,1,1,0,0,1,0,0)

• An (n,q,r,t) Buffer Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?

Page 15: 236601 - Coding and Algorithms  for  Memories Lecture 6

15

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)1 (0,0,1,1) (0,0,0,0,1,1,0,0,0,0,0)0 (0,1,1,0) (1,0,0,0,1,1,0,0,0,0,0)0 (1,1,0,0) (1,1,0,0,1,1,0,0,0,0,0)1 (1,0,0,1) (1,1,0,0,1,1,0,0,1,0,0)0 (0,0,1,0) (1,1,1,0,1,1,0,0,1,0,0)

• An (n,q,r,t) Buffer Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?

Page 16: 236601 - Coding and Algorithms  for  Memories Lecture 6

16

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)1 (0,0,1,1) (0,0,0,0,1,1,0,0,0,0,0)0 (0,1,1,0) (1,0,0,0,1,1,0,0,0,0,0)0 (1,1,0,0) (1,1,0,0,1,1,0,0,0,0,0)1 (1,0,0,1) (1,1,0,0,1,1,0,0,1,0,0)0 (0,0,1,0) (1,1,1,0,1,1,0,0,1,0,0)0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)

• An (n,q,r,t) Buffer Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?

Page 17: 236601 - Coding and Algorithms  for  Memories Lecture 6

17

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)1 (0,0,1,1) (0,0,0,0,1,1,0,0,0,0,0)0 (0,1,1,0) (1,0,0,0,1,1,0,0,0,0,0)0 (1,1,0,0) (1,1,0,0,1,1,0,0,0,0,0)1 (1,0,0,1) (1,1,0,0,1,1,0,0,1,0,0)0 (0,0,1,0) (1,1,1,0,1,1,0,0,1,0,0)0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)1 (1,0,0,1) (1,1,1,1,1,1,1,1,1,1,1)

• An (n,q,r,t) Buffer Code:– Contains n q-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

Page 18: 236601 - Coding and Algorithms  for  Memories Lecture 6

18

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)1 (0,0,1,1) (0,0,0,0,1,1,0,0,0,0,0)0 (0,1,1,0) (1,0,0,0,1,1,0,0,0,0,0)0 (1,1,0,0) (1,1,0,0,1,1,0,0,0,0,0)1 (1,0,0,1) (1,1,0,0,1,1,0,0,1,0,0)0 (0,0,1,0) (1,1,1,0,1,1,0,0,1,0,0)0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)1 (1,0,0,1) (1,1,1,1,1,1,1,1,1,1,1)

(1,1,1,1,2,1,1,1,1,1,1)

• An (n,q,r,t) Buffer Code:– Contains n q-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

Page 19: 236601 - Coding and Algorithms  for  Memories Lecture 6

19

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)1 (0,0,1,1) (0,0,0,0,1,1,0,0,0,0,0)0 (0,1,1,0) (1,0,0,0,1,1,0,0,0,0,0)0 (1,1,0,0) (1,1,0,0,1,1,0,0,0,0,0)1 (1,0,0,1) (1,1,0,0,1,1,0,0,1,0,0)0 (0,0,1,0) (1,1,1,0,1,1,0,0,1,0,0)0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)1 (1,0,0,1) (1,1,1,1,1,1,1,1,1,1,1)

(1,1,1,1,2,1,1,1,1,1,1)

(2,1,1,1,2,1,1,1,1,1,1)

• An (n,q,r,t) Buffer Code:– Contains n q-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

Page 20: 236601 - Coding and Algorithms  for  Memories Lecture 6

20

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)1 (0,0,1,1) (0,0,0,0,1,1,0,0,0,0,0)0 (0,1,1,0) (1,0,0,0,1,1,0,0,0,0,0)0 (1,1,0,0) (1,1,0,0,1,1,0,0,0,0,0)1 (1,0,0,1) (1,1,0,0,1,1,0,0,1,0,0)0 (0,0,1,0) (1,1,1,0,1,1,0,0,1,0,0)0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)1 (1,0,0,1) (1,1,1,1,1,1,1,1,1,1,1)

(1,1,1,1,2,1,1,1,1,1,1)

(2,1,1,1,2,1,1,1,1,1,1)

(2,2,1,1,2,1,1,1,1,1,1)

• An (n,q,r,t) Buffer Code:– Contains n q-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

Page 21: 236601 - Coding and Algorithms  for  Memories Lecture 6

21

Construction of Buffer CodesNext Bit Buffer State Memory State

(0,0,0,0) (0,0,0,0,0,0,0,0,0,0,0)1 (0,0,0,1) (0,0,0,0,1,0,0,0,0,0,0)1 (0,0,1,1) (0,0,0,0,1,1,0,0,0,0,0)0 (0,1,1,0) (1,0,0,0,1,1,0,0,0,0,0)0 (1,1,0,0) (1,1,0,0,1,1,0,0,0,0,0)1 (1,0,0,1) (1,1,0,0,1,1,0,0,1,0,0)0 (0,0,1,0) (1,1,1,0,1,1,0,0,1,0,0)0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)1 (1,0,0,1) (1,1,1,1,1,1,1,1,1,1,1)

(1,1,1,1,2,1,1,1,1,1,1)

(2,1,1,1,2,1,1,1,1,1,1)

(2,2,1,1,2,1,1,1,1,1,1)

(2,2,1,1,2,1,1,2,1,1,1)

• An (n,q,r,t) Buffer Code:– Contains n q-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

Page 22: 236601 - Coding and Algorithms  for  Memories Lecture 6

22

Construction of Buffer CodesNext Bit Buffer State Memory State

(1,0,0,1) (2,2,1,1,2,1,1,2,1,1,1)• An (n,q,r,t) Buffer

Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?

Page 23: 236601 - Coding and Algorithms  for  Memories Lecture 6

23

Construction of Buffer CodesNext Bit Buffer State Memory State

(1,0,0,1) (2,2,1,1,2,1,1,2,1,1,1)1 (0,0,1,1) (2,2,1,1,2,1,1,2,2,1,1)

• An (n,q,r,t) Buffer Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?

Page 24: 236601 - Coding and Algorithms  for  Memories Lecture 6

24

Construction of Buffer CodesNext Bit Buffer State Memory State

(1,0,0,1) (2,2,1,1,2,1,1,2,1,1,1)1 (0,0,1,1) (2,2,1,1,2,1,1,2,2,1,1)1 (0,1,1,1) (2,2,1,1,2,1,1,2,2,2,1)

• An (n,q,r,t) Buffer Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?

Page 25: 236601 - Coding and Algorithms  for  Memories Lecture 6

25

Construction of Buffer CodesNext Bit Buffer State Memory State

(1,0,0,1) (2,2,1,1,2,1,1,2,1,1,1)1 (0,0,1,1) (2,2,1,1,2,1,1,2,2,1,1)1 (0,1,1,1) (2,2,1,1,2,1,1,2,2,2,1)0 (1,1,1,0) (2,2,2,1,2,1,1,2,2,2,1)

• An (n,q,r,t) Buffer Code:– Contains n q-ary cells– Guarantees t bits writes– The last r bits are

recoverable• Example: n=11, q=3, r=4,

t=?t=7+4=11

Page 26: 236601 - Coding and Algorithms  for  Memories Lecture 6

26

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

Page 27: 236601 - Coding and Algorithms  for  Memories Lecture 6

27

How to Improve?• Example: n=11, q=3, r=4,

t=?• Perform the first 7 writes as

before

Next Bit Buffer State Memory State

0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)

Page 28: 236601 - Coding and Algorithms  for  Memories Lecture 6

28

How to Improve?Next Bit Buffer State Memory State

0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)(1,1,1,1,1,1,1,0,1,0,0)

• 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

Page 29: 236601 - Coding and Algorithms  for  Memories Lecture 6

29

How to Improve?Next Bit Buffer State Memory State

0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)(1,1,1,1,1,1,1,0,1,0,0)

1 (1,0,0,1) (1,1,1,1,2,1,1,1,1,0,0)

• 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

Page 30: 236601 - Coding and Algorithms  for  Memories Lecture 6

30

How to Improve?Next Bit Buffer State Memory State

0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)(1,1,1,1,1,1,1,0,1,0,0)

1 (1,0,0,1) (1,1,1,1,2,1,1,1,1,0,0)1 (0,0,1,1) (1,1,1,1,2,2,1,1,1,0,0)

• 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

Page 31: 236601 - Coding and Algorithms  for  Memories Lecture 6

31

How to Improve?Next Bit Buffer State Memory State

0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)(1,1,1,1,1,1,1,0,1,0,0)

1 (1,0,0,1) (1,1,1,1,2,1,1,1,1,0,0)1 (0,0,1,1) (1,1,1,1,2,2,1,1,1,0,0)1 (0,1,1,1) (1,1,1,1,2,2,2,1,1,1,0)

• 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

Page 32: 236601 - Coding and Algorithms  for  Memories Lecture 6

32

How to Improve?Next Bit Buffer State Memory State

0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)(1,1,1,1,1,1,1,0,1,0,0)

1 (1,0,0,1) (1,1,1,1,2,1,1,1,1,0,0)1 (0,0,1,1) (1,1,1,1,2,2,1,1,1,0,0)1 (0,1,1,1) (1,1,1,1,2,2,2,1,1,1,0)0 (1,1,1,0) (2,1,1,1,2,2,2,1,1,1,1)

• 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

Page 33: 236601 - Coding and Algorithms  for  Memories Lecture 6

33

How to Improve?Next Bit Buffer State Memory State

0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)(1,1,1,1,1,1,1,0,1,0,0)

1 (1,0,0,1) (1,1,1,1,2,1,1,1,1,0,0)1 (0,0,1,1) (1,1,1,1,2,2,1,1,1,0,0)1 (0,1,1,1) (1,1,1,1,2,2,2,1,1,1,0)0 (1,1,1,0) (2,1,1,1,2,2,2,1,1,1,1)1 (1,1,0,1) (2,1,1,1,2,2,2,1,2,1,1)

• 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

Page 34: 236601 - Coding and Algorithms  for  Memories Lecture 6

34

How to Improve?Next Bit Buffer State Memory State

0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)(1,1,1,1,1,1,1,0,1,0,0)

1 (1,0,0,1) (1,1,1,1,2,1,1,1,1,0,0)1 (0,0,1,1) (1,1,1,1,2,2,1,1,1,0,0)1 (0,1,1,1) (1,1,1,1,2,2,2,1,1,1,0)0 (1,1,1,0) (2,1,1,1,2,2,2,1,1,1,1)1 (1,1,0,1) (2,1,1,1,2,2,2,1,2,1,1)1 (1,0,1,1) (2,1,1,1,2,2,2,1,2,2,1)

• 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

Page 35: 236601 - Coding and Algorithms  for  Memories Lecture 6

35

How to Improve?Next Bit Buffer State Memory State

0 (0,1,0,0) (1,1,1,1,1,1,0,0,1,0,0)(1,1,1,1,1,1,1,0,1,0,0)

1 (1,0,0,1) (1,1,1,1,2,1,1,1,1,0,0)1 (0,0,1,1) (1,1,1,1,2,2,1,1,1,0,0)1 (0,1,1,1) (1,1,1,1,2,2,2,1,1,1,0)0 (1,1,1,0) (2,1,1,1,2,2,2,1,1,1,1)1 (1,1,0,1) (2,1,1,1,2,2,2,1,2,1,1)1 (1,0,1,1) (2,1,1,1,2,2,2,1,2,2,1)0 (0,1,1,0) (2,2,1,1,2,2,2,1,2,2,1)

• 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

Page 36: 236601 - Coding and Algorithms  for  Memories Lecture 6

36

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

Page 37: 236601 - Coding and Algorithms  for  Memories Lecture 6

37

Flash/Floating Codes

• k bits are stored using n cells• A write is a change 0→1 or 1→0 of one of the k bits• Definition – Flash Codes: An (n,k,t)q

Flash/Floating Code is a coding scheme that accommodates any sequence of up to t writes of k bits, using n q-level cells, in such a way that a block erasure is never required

• Goal: Given k, n, q maximize the number of writes t

Page 38: 236601 - Coding and Algorithms  for  Memories Lecture 6

38

000

100

001

101

010

110

011

111

0,0 0,1 0,2 0,3 0,4 0,5 0,6 0,7

1,0 1,1 1,2 1,3 1,4 1,5 1,6 1,7

2,0 2,1 2,2 2,3 2,4 2,5 2,6 2,7

3,0 3,1 3,2 3,3 3,4 3,5 3,6 3,7

4,0 4,1 4,2 4,3 4,4 4,5 4,6 4,7

5,0 5,1 5,2 5,3 5,4 5,5 5,6 5,7

6,0 6,1 6,2 6,3 6,4 6,5 6,6 6,7

7,0 7,1 7,2 7,3 7,4 7,5 7,6 7,7

Flash CodesExample: Storing three bits using two 8-level cells

Bits Diagram

Cells Diagram

Page 39: 236601 - Coding and Algorithms  for  Memories Lecture 6

39

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≥kt ≤ 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!

Page 40: 236601 - Coding and Algorithms  for  Memories Lecture 6

40

Example – Two Bits Construction

0 1 0 1 0 1 0 1 0 1 0 1 00 1 0 1 0 1 0 1 0 1 0 1 0

4031234

120

t = 03129786451011121413151716

30214 30214 024 301 30214 302141 42

1819202122

40312 4012 40312 40312 40312

• 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.

Page 41: 236601 - Coding and Algorithms  for  Memories Lecture 6

41

Indexed Flash Codes

v3v2 v4v1

c1 c2 c3 c4

Bits

Cells

Index Cells

vkv5

cn

• 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

Page 42: 236601 - Coding and Algorithms  for  Memories Lecture 6

42

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 Bit43210

Page 43: 236601 - Coding and Algorithms  for  Memories Lecture 6

43

Index-Less Indexed Flash Codes

Example: Writing 4 bits using 24 cells of 3 levels

0101

0

1 00

0 0 0 0 0 00 0 0 0 0 0 0 0 0 0 0 01 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 12 2 2 2 2 2 22 2 2 2 2 2 2 2 2 2

1 1324

Bit Value1 2 3 4

Modified Bit

113322244111133222244441324213224

00000

210

When writing stops, at most (k – 1)(k(q – 1) – 1) levels are not usedThe write deficiency order is δ = O(k2q)

Page 44: 236601 - Coding and Algorithms  for  Memories Lecture 6

44

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!

Index Cells

k cells k cells k cells

k/2 k/2 k/2 k/2 k/2 k/2

Page 45: 236601 - Coding and Algorithms  for  Memories Lecture 6

45

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)

Index Cells1 2 3 4 1 2 3 43 X 3X 22

k/2 k/2 k/2 k/2 k/2 k/2

k/4 k/4 k/4 k/4 k/4 k/4

Page 46: 236601 - Coding and Algorithms  for  Memories Lecture 6

46

Hot+Cold Rewrite

WOM hot/coldWOM k bits

t writes

k bits

The cold bits can be written only once The hot bits can be written multiple times

Page 47: 236601 - Coding and Algorithms  for  Memories Lecture 6

47

1 Hot + 1 Cold, n=1

• 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

0

2

4

0,0 0,1

1

3

5

1,0

1,1

cold,hot =

Page 48: 236601 - Coding and Algorithms  for  Memories Lecture 6

48

1 Hot + 1 Cold, n=2

• 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

3 23 2 1

2 3 2 1 01 0

0 1 00 1 2 3 4 c1

01234

3: 1,12: 1,01: 0,10: 0,0

cold=0

cold=13 2

3 2 12 3 2 1 0

1 00 1 00 1 2 3 4

c2

01234

cold=0

cold=1