Patent ID: 7714749

Claim:
A method for encoding data, the method comprising: receiving a word comprising N bits of data into a memory; pre-pending an additional bit to the word to form a codeword, wherein each bit has a corresponding bit address, and wherein the bit addresses of the N bits of data descend from a highest bit address starting with the first data bit of the N bits of data; setting an address table pointer to the bit address of the first data bit of the N bits of data; scanning the codeword for a violating sequence, wherein the violating sequence is a contiguous sequence of bits that violate a run-length limited coding constraint k, wherein N≦2 k−2 +k−1; inserting, responsive to locating the violating sequence, an indicator into the codeword, wherein the indicator comprises k bits; wherein inserting the indicator comprises: if a starting bit address of the violating sequence is equal to the bit address of the address table pointer, constructing the indicator to include the starting bit address of the violating sequence; replacing k bits of the violating sequence with k bits of the indicator starting from the bit address of the address table pointer; and advancing the address table pointer by k to point to a new bit address of the codeword; if a starting bit address of the violating sequence is less than the bit address of the address table pointer less k, then constructing the indicator to include the starting bit address of the violating sequence; replacing k bits of the violating sequence with k bits of the codeword starting from the bit address of the address table pointer; inserting the indicator into the codeword starting at the bit address of the address table pointer; and advancing the address table pointer by k to point to a new bit address of the codeword; and if a starting bit address of the violating sequence is greater than the bit address of the address table pointer less k, then moving contiguous bits of the code word starting at the address table pointer up to the starting bit address of the violating sequence to the address table pointer minus k, constructing the indicator to include the starting bit address of the violating sequence; inserting the indicator into the codeword starting at the bit address of the address table pointer; and advancing the address table pointer by k to point to a new bit address of the codeword; and repeating the scanning and inserting operations until all violating sequences are removed from the codeword.