# Patent

## Title
Soft input, soft ouput mappers and demappers for block codes

## Abstract

A log-likelihood ratio (LLR) for a bit bi in a message is determined by generating a first term, including by summing LLRs corresponding to bits in a first codeword having a specified value. The first codeword has a corresponding first message and bit bi of the first message corresponds to a 0. A second term is generated, including by summing LLRs corresponding to bits in a second codeword having the specified value. The second codeword has a corresponding second message and bit bi of the second message corresponds to a 1. The LLR for bit bi in the message is generated based at least in part on the first term and the second term.

## Background
CROSS REFERENCE TO OTHER APPLICATIONS
This application claims priority to U.S. Provisional Patent Application No. 61/443,633 entitled COMPUTING LOG-LIKELIHOOD RATIOS FOR BLOCK CODES filed Feb. 16, 2011 which is incorporated herein by reference for all purposes.


BACKGROUND OF THE INVENTION
In coding, information can be divided into two categories: soft information and hard information. Soft information includes some probability, likelihood or certainty that a decision (e.g., whether a bit is a 1 or a 0) is correct. For example, a decoder or other processor configured to output hard information (e.g., about a bit received over a wireless channel or read back from storage media) outputs either a 1 or a 0 without any indication how certain the decoder is in that particular decision. In contrast, a decoder or other processor configured to output soft information includes some certainty or probability along with the decision (e.g., the decoder thinks the bit is a 1 with 75% certainty). It would be desirable if new techniques could be developed for generating soft information using other soft information as input where the techniques are capable of being performed by hardware such as a field-programmable gate array (FPGA), application-specific integrated circuit (ASIC) or a microprocessor such as an ARM core.



BRIEF DESCRIPTION OF THE DRAWINGS
Various embodiments of the invention are disclosed in the following detailed description and the accompanying drawings.
FIG. 1 is a diagram showing an embodiment of a soft input, soft output mapper and a soft input, soft output demapper.
FIG. 2 is a flowchart illustrating an embodiment of a process to generate LLR values for bits of a message (LLRbi) using one or more LLR values corresponding to bits in a codeword (LLRci).
FIG. 3 is a flowchart illustrating an embodiment of a process to generate LLR values for bits in a codeword (LLRci) using LLR values associated with bits of a message (LLRbi).
FIG. 4 is a flowchart illustrating an embodiment of a process to generate LLRbi as a function of LLRci by iteratively performing a max* function.
FIG. 5 is a flowchart illustrating an embodiment of a process to generate a term used to calculate an LLR value by iteratively performing a max* function.
FIG. 6 is a flowchart illustrating an embodiment of a process to approximate LLRs for bits in a message (LLRbi) using a maximum function.
FIG. 7 is a diagram showing an embodiment of a systematic code and a write processor portion of a storage system.
FIG. 8 is a diagram showing an embodiment of a read processor portion of a storage system.
FIG. 9 is a flowchart illustrating an embodiment of a process to perform iterative decoding in the event error correction processing fails.



DETAILED DESCRIPTION
The invention can be implemented in numerous ways, including as a process; an apparatus; a system; a composition of matter; a computer program product embodied on a computer readable storage medium; and/or a processor, such as a processor configured to execute instructions stored on and/or provided by a memory coupled to the processor. In this specification, these implementations, or any other form that the invention may take, may be referred to as techniques. In general, the order of the steps of disclosed processes may be altered within the scope of the invention. Unless stated otherwise, a component such as a processor or a memory described as being configured to perform a task may be implemented as a general component that is temporarily configured to perform the task at a given time or a specific component that is manufactured to perform the task. As used herein, the term ‘processor’ refers to one or more devices, circuits, and/or processing cores configured to process data, such as computer program instructions.
A detailed description of one or more embodiments of the invention is provided below along with accompanying figures that illustrate the principles of the invention. The invention is described in connection with such embodiments, but the invention is not limited to any embodiment. The scope of the invention is limited only by the claims and the invention encompasses numerous alternatives, modifications and equivalents. Numerous specific details are set forth in the following description in order to provide a thorough understanding of the invention. These details are provided for the purpose of example and the invention may be practiced according to the claims without some or all of these specific details. For the purpose of clarity, technical material that is known in the technical fields related to the invention has not been described in detail so that the invention is not unnecessarily obscured.
What is described herein is a technique for generating log-likelihood ratios (LLRs) for block codes using other LLRs. FIG. 1 is a diagram showing an embodiment of a soft input, soft output mapper and a soft input, soft output demapper. Mapper 100 generates LLRs for bits c0 thru cn-1 of a codeword using LLRs corresponding to bits b0 thru bm-1 of a message, where the number of LLRs generated is greater than the number of LLRs input. In other words, n>m and mapper 100 is analogous to a modulator or encoder where the number of LLRs (bits) output is greater than the number of LLRs (bits) input. Soft input, soft output demapper 150 performs the inverse function of mapper 100, mapping LLRb0 thru LLRbm-1 (associated with a message) to LLRc0 thru LLRcn-1 (associated with a codeword) where the number of LLRs input is greater than the number of LLRs output (e.g., 3 LLRs are input and 2 LLRs are output).
To illustrate the operation of mapper 100 and demapper 150, consider the example codebook shown in the Table 1. In this example, messages have 2 bits and codewords have 3 bits. For example, message 0 (comprising of 00) corresponds to codeword 0 (comprising of 000). Mapper 100 receives 2 LLR values corresponding to message bits b0 and b1 and generates 3 LLR values corresponding to codeword bits c0, c1 and c2 using some or all of the entries in the codebook below. Naturally, changing either the codebook used or the LLR values input will result in different LLR values generated. Similarly, demapper 150 when configured to use the example codebook below will input 3 LLR values (corresponding to bits c0, c1 and c2) and output 2 LLR values (corresponding to bits b0 and b1).







TABLE 1







Codebook with 2-bit messages and 


3-bit codewords










Messages (m = 2)
Codewords (n = 3)
















b0
b1

c0
c1
c2







Message 0
0
0
Codeword 0
0
0
0



Message 1
0
1
Codeword 1
0
0
1



Message 2
1
0
Codeword 2
1
0
0



Message 3
1
1
Codeword 3
1
1
1










There are some 3-bit sequences not covered by the codewords in the example codebook above (e.g., the sequence 101 is not included). Such sequences are not codewords and when the term codeword is used, those bit sequences are excluded. In various embodiments, messages and codewords of any length may be used.
In various embodiments, mapper 100 and/or demapper 150 are associated with various block codes, such as a maximum transition run (MTR) code. A maximum transition run code limits the number of consecutive transitions (e.g., 0→1 or 1→0) in a bit stream by inserting additional bits into the bit stream to break up consecutive transitions as needed. Another related block code is a run length limited (RLL) code, which in contrast to a MTR code, forces a transition to occur whenever the number of consecutive 0s or 1s in a bit stream exceeds a limit. Some other block codes which may be employed include cyclic codes and polynomial codes. Some specific examples include Hamming codes, Bose Ray Chaudhuri (BCH) codes and Reed-Solomon codes. In some embodiments, the particular code selected to be employed by mapper 100 and demapper 150 depends upon properties or characteristics of a channel (e.g., distortions or noise introduced by a storage channel or a wireless communications channel, etc.) and/or the error correction capabilities or properties of an error correction code employed by a system (e.g., different error correcting codes can tolerate different types of distortions or noise better than other codes).
Next, various embodiments of techniques to generate LLR values performed by demapper 150 are described. First, a general process for generating LLRbi as a function of LLRci is described.
FIG. 2 is a flowchart illustrating an embodiment of a process to generate LLR values for bits of a message (LLRbi) using one or more LLR values corresponding to bits in a codeword (LLRci). For example, demapper 150 in FIG. 1 performs this process.
At 200, LLRs for codeword bits are obtained (i.e., LLRc0 thru LLRcn-1). For the example codebook shown in Table 1, LLRc0, LLRc1 and LLRc2 are obtained (e.g., the set (15, 15, −15)). An index i is set to 0 at 202. The index is used to track which bit in a message an LLR is being generated for, so at least in this example LLRb0 is generated first.
At 204, a first term is generated, including by summing LLRs corresponding to bits in a first codeword having a specified value (e.g., 0), where the first codeword has a corresponding first message and bit bi of the first message corresponds to a 0. Consider the case when an LLR is generated for bit b0 using the codebook in Table 1. The codewords which are eligible at step 204 are codewords 0 and 1 (because those codewords correspond to messages which have bit b0=0). As an example of step 204, suppose codeword 1 is used and the specified value is 0. LLR values for those bits in codeword 1 which are 0 (i.e., c0 and c1) are summed so that in this example LLRc0 and LLRc1 are summed. Another way to think of step 204 is that the codeword in step 204 acts as a bitmap or control switch for terms in a summation. Only LLR terms corresponding to bits in the codeword that are the specified value (e.g., 0) are summed.
At 206, a second term is generated, including by summing LLRs corresponding to bits in a second codeword having a specified value (e.g., 0), where the second codeword has a corresponding second message and bit bi of the second message corresponds to a 1. Going back to Table 1, the eligible codewords at 206 are now codewords 2 and 3 because the corresponding messages have bit b0=1. If codeword 3 is used at 206 and the specified value is again 0, then the second term is 0 because no LLRs are selected for the summation (because all of the bits in codeword 3 are 1's). In some embodiments, the specified value at 204 and 206 are the same value.
An LLR for bit bi in a message is generated based at least in part on the first term and the second term at 208. In some embodiments, generating the first term and the second term at 204 and/or 206 include performing a max* function iteratively (e.g., max*(x1, x2) is performed first and the result is incorporated into another max* function). In some embodiments, steps 204 and/or 206 include a maximum function. In some embodiments, generating LLRbi at step 208 includes subtracting the second term from the first term. Some embodiments described in further detail below are exact calculations whereas other embodiments include some simplifications at the expense of relatively small inaccuracies.
It is determined at 210 if there are more bits in a message. For example, once the value of LLRb0 is determined, the process may proceed with determining a value for LLRb1. If so, the index i is incremented at 212 and a new first term is generated at 204.
FIG. 3 is a flowchart illustrating an embodiment of a process to generate LLR values for bits in a codeword (LLRci) using LLR values associated with bits of a message (LLRbi). In some embodiments, mapper 100 in FIG. 1 performs this process.
LLRs for message bits (LLRb0 thru LLRbm-1) are obtained at 300. For the code shown in Table 1, two values, LLRb0 and LLRb1, are obtained. At 302, an index i is set to 0. Similar to FIG. 2, the index i is used to track which codeword bit an LLR is being generated for. At 304, a first term is generated, including by summing LLRs corresponding to bits in a first message having a specified value (e.g., 0), where the first message has a corresponding first codeword and bit ci of the first codeword corresponds to a 0. Using Table 1 as an example, an LLR for bit c0 is to be generated. Messages 0 and 1 are the only messages for which c0 in the corresponding codeword is 0, so one of those messages may be used at step 304. Suppose message 0 is used and the specified value is 0. Since both b0 and b1 in message 0 are equal to the specified value (in this example, 0), the LLRs for those bits are summed (i.e., LLRb0+LLRb1).
At 306, a second term is generated, including by summing LLRs corresponding to bits in a second message having a specified value (e.g., 0), where the second message has a corresponding second codeword and bit ci of the second codeword corresponds to a 1. In the example of Table 1, the eligible messages at 306 are messages 2 and 3; if message 2 is used and the specified value is 0, summing the LLRs which meet the criteria produces LLRb1 (because b0≠specified value and b1=specified value in message 2).
An LLR is generated for bit ci in the codeword based at least in part on the first term and the second term at 308. In some embodiments, the LLR for bit ci is set to the first term minus the second term. Some examples of step 308 are described in further detail below. It is determined at 310 if there are more bits in a codeword (e.g., which require but have not yet had an LLR generated for them). If so, the index i is incremented at 312 and a new first term is generated at 304.
Next, a precise expression for LLRb, as a function of LLR (i.e., the processing performed by demapper 150 in FIG. 1) is obtained without making any assumptions or simplifications.
Let C be a block code that accepts m message bits b0, b1, . . . , bm−1, and outputs n coded bits, c0, c1, . . . , cn−1. The codebook of C thus contains 2m codewords, and the code rate of C is m/n. Define the LLR of bi, i=0, 1, . . . , m−1, as




  
    
      
        
          
            LLR
            
              b
              i
            
          
          =
          
            K
            ⁢
            
              
            
            ⁢
            
              ln
              ⁡
              
                (
                
                  
                    Pr
                    ⁡
                    
                      (
                      
                        
                          b
                          i
                        
                        =
                        0
                      
                      )
                    
                  
                  
                    Pr
                    ⁡
                    
                      (
                      
                        
                          b
                          i
                        
                        =
                        1
                      
                      )
                    
                  
                
                )
              
            
          
        
        ,
      
    
    
      
        (
        1
        )
      
    
  




where K is a constant for scaling the LLR to an appropriate range for hardware implementation. Similarly, define the LLR of ci, i=0, 1, . . . , n−1, as





  
    
      
        
          LLR
          
            c
            i
          
        
        =
        
          K
          ⁢
          
            
          
          ⁢
          
            
              ln
              ⁡
              
                (
                
                  
                    Pr
                    ⁢
                    
                      
                    
                    ⁢
                    
                      (
                      
                        
                          c
                          i
                        
                        =
                        0
                      
                      )
                    
                  
                  
                    Pr
                    ⁢
                    
                      
                    
                    ⁢
                    
                      (
                      
                        
                          c
                          i
                        
                        =
                        1
                      
                      )
                    
                  
                
                )
              
            
            .
          
        
      
    
    
      
        (
        2
        )
      
    
  




An LLR (for either a bit in a codeword or a bit in a message) is a soft value where the sign indicates a corresponding hard decision and the magnitude indicates a certainty, probability or likelihood in that particular decision. In the examples described herein (which are based upon LLR Equations 1 and 2), a positive LLR value corresponds to a hard decision of 0 (with varying certainty), and a negative LLR value corresponds to a hard decision of 1 (with varying certainty). In some other embodiments, the LLR is defined differently (e.g., a positive LLR value corresponds to a 1 decision and a negative LLR value corresponds to a 0 decision) and the techniques described herein are not limited to LLR Equations 1 and 2.
Equation (2) is rearranged to isolate Pr(ci=0) and Pr(ci=1) (i.e., the probabilities, ranging from 0 to 1, that a codeword bit ci is a 0 or a 1, respectively)




  
    
      
        
          Pr
          ⁢
          
            
          
          ⁢
          
            (
            
              
                c
                i
              
              =
              0
            
            )
          
        
        =
        
          
            
              e
              
                
                  LLR
                  
                    c
                    i
                  
                
                K
              
            
            
              1
              +
              
                e
                
                  
                    LLR
                    
                      c
                      i
                    
                  
                  K
                
              
            
          
          ⁢
          
            
          
          ⁢
          and
        
      
    
    
      
        (
        3
        )
      
    
  
  
    
      
        
          Pr
          ⁡
          
            (
            
              
                c
                i
              
              =
              1
            
            )
          
        
        =
        
          
            1
            
              1
              +
              
                e
                
                  
                    LLR
                    
                      c
                      i
                    
                  
                  K
                
              
            
          
          .
        
      
    
    
      
        (
        4
        )
      
    
  




Then, using the codebook of interest (which describes the permitted codewords) and Equations (3) and (4)(4) and assuming that the LLRs of the coded bits are statistically independent, the probability of receiving a particular codeword j, j=0, 1, . . . , 2m−1, can be written as




  
    
      
        
          
            
              
                Pr
                ⁡
                
                  (
                  
                    cw
                    j
                  
                  )
                
              
              =
              
              ⁢
              
                
                  (
                  
                    
                      ∏
                      
                        
                          c
                          
                            j
                            ,
                            i
                          
                        
                        =
                        0
                      
                    
                    ⁢
                    
                      Pr
                      ⁡
                      
                        (
                        
                          
                            c
                            i
                          
                          =
                          0
                        
                        )
                      
                    
                  
                  )
                
                ⁢
                
                  (
                  
                    
                      ∏
                      
                        
                          c
                          
                            j
                            ,
                            i
                          
                        
                        =
                        1
                      
                    
                    ⁢
                    
                      Pr
                      ⁡
                      
                        (
                        
                          
                            c
                            i
                          
                          =
                          1
                        
                        )
                      
                    
                  
                  )
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  (
                  
                    
                      ∏
                      
                        
                          c
                          
                            j
                            ,
                            i
                          
                        
                        =
                        0
                      
                    
                    ⁢
                    
                      
                        e
                        
                          
                            LLR
                            
                              c
                              i
                            
                          
                          K
                        
                      
                      
                        1
                        +
                        
                          e
                          
                            
                              LLR
                              
                                c
                                i
                              
                            
                            K
                          
                        
                      
                    
                  
                  )
                
                ⁢
                
                  (
                  
                    
                      ∏
                      
                        
                          c
                          
                            j
                            ,
                            i
                          
                        
                        =
                        1
                      
                    
                    ⁢
                    
                      1
                      
                        1
                        +
                        
                          e
                          
                            
                              LLR
                              
                                c
                                i
                              
                            
                            K
                          
                        
                      
                    
                  
                  )
                
              
            
          
        
        
          
            
              =
              
              ⁢
              
                
                  (
                  
                    
                      ∏
                      
                        
                          c
                          
                            j
                            ,
                            i
                          
                        
                        =
                        0
                      
                    
                    ⁢
                    
                      e
                      
                        
                          LLR
                          
                            c
                            i
                          
                        
                        K
                      
                    
                  
                  )
                
                ⁢
                
                  (
                  
                    
                      ∏
                      
                        i
                        =
                        0
                      
                      
                        n
                        -
                        1
                      
                    
                    ⁢
                    
                      1
                      
                        1
                        +
                        
                          e
                          
                            
                              LLR
                              
                                c
                                i
                              
                            
                            K
                          
                        
                      
                    
                  
                  )
                
              
            
          
        
        
          
            
              
                =
                
                ⁢
                
                  
                    (
                    
                      e
                      
                        
                          1
                          K
                        
                        ⁢
                        
                          
                            ∑
                            
                              
                                c
                                
                                  j
                                  ,
                                  i
                                
                              
                              =
                              0
                            
                          
                          ⁢
                          
                            LLR
                            
                              c
                              i
                            
                          
                        
                      
                    
                    )
                  
                  ⁢
                  
                    (
                    
                      
                        ∏
                        
                          i
                          =
                          0
                        
                        
                          n
                          -
                          1
                        
                      
                      ⁢
                      
                        1
                        
                          1
                          +
                          
                            e
                            
                              
                                LLR
                                
                                  c
                                  i
                                
                              
                              K
                            
                          
                        
                      
                    
                    )
                  
                
              
              ,
            
          
        
      
    
    
      
        (
        5
        )
      
    
  




where cj,i denotes bit i of codeword j. For example, the probability that codeword 0 in Table 1 is received is the probability that bit c0 is 0, multiplied by the probability that bit c1 is 0, multiplied by the probability that bit c2 is 0.

Next, it can be noted that the probability that a bit bi in the message will be a 0 is the sum of the probabilities that codewords which result in bit bi in a message being 0 occur. This can be expressed as:




  
    
      
        
          
            Pr
            ⁡
            
              (
              
                
                  b
                  i
                
                =
                0
              
              )
            
          
          =
          
            
              ∑
              
                
                  
                    cw
                    j
                  
                  :
                  
                    b
                    i
                  
                
                =
                0
              
            
            ⁢
            
              Pr
              ⁡
              
                (
                
                  cw
                  j
                
                )
              
            
          
        
        ,
      
    
    
      
        (
        6
        )
      
    
  




where the summation is over the probabilities of all codewords, which, when hard-decision decoded, would result in bi=0. Similarly,





  
    
      
        
          
            Pr
            ⁡
            
              (
              
                
                  b
                  i
                
                =
                1
              
              )
            
          
          =
          
            
              ∑
              
                
                  
                    cw
                    j
                  
                  :
                  
                    b
                    i
                  
                
                =
                1
              
            
            ⁢
            
              Pr
              ⁡
              
                (
                
                  cw
                  j
                
                )
              
            
          
        
        ,
      
    
    
      
        (
        7
        )
      
    
  




where the summation is over the probabilities of all codewords, which, when hard-decision decoded, would result in bi=1.

Returning back to the example of Table 1, consider the example of the second bit in the message, b1. The probability that b1 is 0 is the same thing as the probability that either codeword 0 or codeword 2 occurs, because those are the codewords that would result in b1 being mapped to 0. Similarly, the probability that b1 is a 1 is the same as the probability that either codeword 1 or codeword 3 occurs.
Substituting Equations (6) and (7) into Equation (1) with the help of Equation (5) leads to the expression




   
  
    
      
        
          
            
              
                
                  LLR
                  
                    b
                    i
                  
                
                =
                
                ⁢
                
                  K
                  ⁢
                  
                    
                  
                  ⁢
                  
                    ln
                    ⁡
                    
                      (
                      
                        
                          
                            ∑
                            
                              
                                
                                  cw
                                  j
                                
                                :
                                
                                  b
                                  i
                                
                              
                              =
                              0
                            
                          
                          ⁢
                          
                            Pr
                            ⁡
                            
                              (
                              
                                cw
                                j
                              
                              )
                            
                          
                        
                        
                          
                            ∑
                            
                              
                                
                                  cw
                                  j
                                
                                :
                                
                                  b
                                  i
                                
                              
                              =
                              1
                            
                          
                          ⁢
                          
                            Pr
                            ⁡
                            
                              (
                              
                                cw
                                j
                              
                              )
                            
                          
                        
                      
                      )
                    
                  
                
              
            
          
          
            
              
                =
                
                ⁢
                
                  K
                  ⁢
                  
                    
                  
                  ⁢
                  
                    ln
                    ⁡
                    
                      (
                      
                        
                          
                            (
                            
                              
                                ∑
                                
                                  
                                    
                                      cw
                                      j
                                    
                                    :
                                    
                                      b
                                      i
                                    
                                  
                                  =
                                  0
                                
                              
                              ⁢
                              
                                e
                                
                                  
                                    1
                                    K
                                  
                                  ⁢
                                  
                                    
                                      ∑
                                      
                                        
                                          c
                                          
                                            j
                                            ,
                                            i
                                          
                                        
                                        =
                                        0
                                      
                                    
                                    ⁢
                                    
                                      LLR
                                      
                                        c
                                        i
                                      
                                    
                                  
                                
                              
                            
                            )
                          
                          ⁢
                          
                            (
                            
                              
                                ∏
                                
                                  i
                                  =
                                  0
                                
                                
                                  n
                                  -
                                  1
                                
                              
                              ⁢
                              
                                1
                                
                                  1
                                  +
                                  
                                    e
                                    
                                      
                                        LLR
                                        
                                          c
                                          i
                                        
                                      
                                      K
                                    
                                  
                                
                              
                            
                            )
                          
                        
                        
                          
                            (
                            
                              
                                ∑
                                
                                  
                                    
                                      cw
                                      j
                                    
                                    :
                                    
                                      b
                                      i
                                    
                                  
                                  =
                                  1
                                
                              
                              ⁢
                              
                                e
                                
                                  
                                    1
                                    K
                                  
                                  ⁢
                                  
                                    
                                      ∑
                                      
                                        
                                          c
                                          
                                            j
                                            ,
                                            i
                                          
                                        
                                        =
                                        0
                                      
                                    
                                    ⁢
                                    
                                      LLR
                                      
                                        c
                                        i
                                      
                                    
                                  
                                
                              
                            
                            )
                          
                          ⁢
                          
                            (
                            
                              
                                ∏
                                
                                  i
                                  =
                                  0
                                
                                
                                  n
                                  -
                                  1
                                
                              
                              ⁢
                              
                                1
                                
                                  1
                                  +
                                  
                                    e
                                    
                                      
                                        LLR
                                        
                                          c
                                          i
                                        
                                      
                                      K
                                    
                                  
                                
                              
                            
                            )
                          
                        
                      
                      )
                    
                  
                
              
            
          
          
            
              
                =
                
                ⁢
                
                  K
                  ⁢
                  
                    
                  
                  ⁢
                  
                    ln
                    ⁡
                    
                      (
                      
                        
                          
                            ∑
                            
                              
                                
                                  cw
                                  j
                                
                                :
                                
                                  b
                                  i
                                
                              
                              =
                              0
                            
                          
                          ⁢
                          
                            e
                            
                              
                                1
                                K
                              
                              ⁢
                              
                                
                                  ∑
                                  
                                    
                                      c
                                      
                                        j
                                        ,
                                        i
                                      
                                    
                                    =
                                    0
                                  
                                
                                ⁢
                                
                                  LLR
                                  
                                    c
                                    i
                                  
                                
                              
                            
                          
                        
                        
                          
                            ∑
                            
                              
                                
                                  cw
                                  j
                                
                                :
                                
                                  b
                                  i
                                
                              
                              =
                              0
                            
                          
                          ⁢
                          
                            e
                            
                              
                                1
                                K
                              
                              ⁢
                              
                                
                                  ∑
                                  
                                    
                                      c
                                      
                                        j
                                        ,
                                        i
                                      
                                    
                                    =
                                    0
                                  
                                
                                ⁢
                                
                                  LLR
                                  
                                    c
                                    i
                                  
                                
                              
                            
                          
                        
                      
                      )
                    
                  
                
              
            
          
          
            
              
                =
                
                ⁢
                
                  
                    K
                    ⁢
                    
                      
                    
                    ⁢
                    
                      ln
                      (
                      
                        
                          ∑
                          
                            
                              
                                cw
                                j
                              
                              :
                              
                                b
                                i
                              
                            
                            =
                            0
                          
                        
                        ⁢
                        
                          e
                          
                            
                              1
                              K
                            
                            ⁢
                            
                              
                                ∑
                                
                                  
                                    c
                                    
                                      j
                                      ,
                                      i
                                    
                                  
                                  =
                                  0
                                
                              
                              ⁢
                              
                                LLR
                                
                                  c
                                  i
                                
                              
                            
                          
                        
                      
                      )
                    
                  
                  -
                
              
            
          
          
            
              
                
                ⁢
                
                  K
                  ⁢
                  
                    
                  
                  ⁢
                  
                    
                      ln
                      (
                      
                        
                          ∑
                          
                            
                              
                                cw
                                j
                              
                              :
                              
                                b
                                i
                              
                            
                            =
                            1
                          
                        
                        ⁢
                        
                          e
                          
                            
                              1
                              K
                            
                            ⁢
                            
                              
                                ∑
                                
                                  
                                    c
                                    
                                      j
                                      ,
                                      i
                                    
                                  
                                  =
                                  0
                                
                              
                              ⁢
                              
                                LLR
                                
                                  c
                                  i
                                
                              
                            
                          
                        
                      
                      )
                    
                    .
                  
                
              
            
          
        
      
      
        
          (
          8
          )
        
      
    
  




To evaluate Equation (8), the max* function is applied to the first term and the second term where




  
    
      
        
          
            ln
            ⁡
            
              (
              
                
                  ∑
                  
                    i
                    =
                    0
                  
                  
                    d
                    -
                    1
                  
                
                ⁢
                
                  e
                  
                    x
                    i
                  
                
              
              )
            
          
          =
          
            
              max
              *
            
            ⁢
            
              (
              
                
                  x
                  
                    d
                    -
                    1
                  
                
                ,
                
                  
                    max
                    *
                  
                  ⁢
                  
                    (
                    
                      
                        x
                        
                          d
                          -
                          2
                        
                      
                      ,
                      
                        ...
                        ⁢
                        
                          
                        
                        ⁢
                        
                          
                            max
                            *
                          
                          ⁢
                          
                            (
                            
                              
                                x
                                3
                              
                              ,
                              
                                
                                  max
                                  *
                                
                                ⁢
                                
                                  (
                                  
                                    
                                      x
                                      2
                                    
                                    ,
                                    
                                      x
                                      1
                                    
                                  
                                  )
                                
                              
                            
                            )
                          
                        
                      
                    
                    )
                  
                
              
              )
            
          
        
        ,
      
    
    
      
        (
        9
        )
      
    
  




and

max*(x,y)ln(ex+ey)=max(x,y)+ln(1+e−|x−y|).  (10)

In some embodiments, the natural log function in Equation (10) is implemented using a lookup table. In some applications this is desirable since it is faster and/or less computationally expensive than computing a logarithm on-the-fly. Since the LLR values have known minimum and maximum values (e.g., ranging from −15 to +15) the full range of input values to the natural log function can be calculated ahead of time and the lookup table can be populated accordingly.
The following figure expresses Equation (8) (when computed with the aid of Equation (9)) as a flowchart.
FIG. 4 is a flowchart illustrating an embodiment of a process to generate LLRbi as a function of LLRci by iteratively performing a max* function. In some embodiments, steps 204-208 of FIG. 2 are performed as shown; in some other embodiments some other technique is used to perform those steps.
At 400, codewords are separated into two groups, one where bit bi of corresponding messages is a 0 and the other where bit bi of corresponding messages is a 1. Suppose an LLR for bit b1 is being generated using the codebook in Table 1. Codewords 0 and 2 would form one group (b1 in messages=0) and codewords 1 and 3 would form the other group (b1 in messages=1).
At 402 and 404, respectively, a first term is generated for the first group by iteratively performing a max* function and a second term is generated for the second group by iteratively performing a max* function. For example, the term K ln




  (
  
    
      ∑
      
        
          
            cw
            j
          
          :
          
            b
            i
          
        
        =
        1
      
    
    ⁢
    
      e
      
        
          1
          K
        
        ⁢
        
          
            ∑
            
              
                c
                
                  j
                  ,
                  i
                
              
              =
              0
            
          
          ⁢
          
            LLR
            
              c
              i
            
          
        
      
    
  
  )




from Equation (8) is generated at 402 and the term K ln





  (
  
    
      ∑
      
        
          
            cw
            j
          
          :
          
            b
            i
          
        
        =
        0
      
    
    ⁢
    
      e
      
        
          1
          K
        
        ⁢
        
          
            ∑
            
              
                c
                
                  j
                  ,
                  i
                
              
              =
              0
            
          
          ⁢
          
            LLR
            
              c
              i
            
          
        
      
    
  
  )




from Equation (8) is generated at 404. Various embodiments for performing steps 402 and 404 are described in further detail below. At 406, LLRbi is set to the first term (e.g., generated at 402) minus the second term (e.g., generated at 404).

As an example, consider Tables 2 and 3 corresponding to the codebook shown in Table 1 where the value of LLRb1 is determined. Table 2 shows an example of a first group (e.g., associated with step 402 in FIG. 4) and Table 3 shows an example of a second group (e.g., associated with step 404 in FIG. 4). For clarity, bit b0 in messages 0-4 is not shown.







TABLE 2







Example of a first group to generate LLRb1








Messages in first group (b1 = 0)
Codewords in first group (b1 = 0)













b1

c0
c1
c2





Message 0
0
Codeword 0
0
0
0


Message 2
0
Codeword 2
1
0
0
















TABLE 3







Example of a second group to generate LLRb1










Messages in second 
Codewords in second 



group (b1 = 1)
group (b1 = 1)















b1

c0
c1
c2







Message 1
1
Codeword 1
0
0
1



Message 3
1
Codeword 3
1
1
1










The following figure describes an embodiment of steps 402 and/or 404 in FIG. 4.
FIG. 5 is a flowchart illustrating an embodiment of a process to generate a term used to calculate an LLR value by iteratively performing a max* function. In some embodiments, steps 402 and/or 404 in FIG. 4 are performed as shown.
For a first codeword in a group, LLRs for those bits in a first codeword corresponding to a specified value (e.g., 0) are summed and the sum is divided by K to obtain a first max* input at 500. See, for example Table 4 where the specified value is 0, K=1, LLRc0=15, LLRc1=15 and LLRc2=−15. For each bit in codeword 0 that is a 0, the corresponding LLRs are summed. Since all three bits are zero for codeword 0 the sum is LLRc0+LLRc1+LLRc2=15+15+−15=15. K=1 so the sum divided by K is also 15.







TABLE 4







Example of a max* function applied to a first group, where K = 1, LLRc0 = 15,


LLRc1 = 15, LLRc2 = −15, and the max* result is used to generate LLRb1 








Messages in first 
Codewords in first group (b1 = 0)














group (b1 = 0)




Sum of

Numeric
















b1

c0
c1
c2
LLRs/K
max*
value





Message 0
0
Codeword
0
0
0
15 + 15 +
max*(15, 0)
~15.00000031




0



−15 = 15




Message 2
0
Codeword
1
0
0
15 + −15 + = 0






2









At 502, for a second codeword in a group, LLRs for those bits in the second codeword corresponding to a specified value (e.g., 0) are summed and the sum is divided by K to obtain a second max* input. To continue the example of Table 4, the second codeword is codeword 2. Bits c1 and c2 are equal to zero so the sum is LLRc1+LLRc2=15+−15=0. When the sum is divided by K this results in 0.
A max* function is performed on two inputs at 504. For example, the input from step 500 (15 in the example above) and the input from step 502 (0 in the example above) are input so at 504 the function max*(15, 0) is performed. Numerically, max*(15, 0) is approximately 15.00000031.
It is determined at 506 whether to end an iterative max* process. If so, a multiply by K is performed and the product is output at 510. If it is determined at 506 to continue, then for a next codeword in a group, LLRs for those bits in the codeword corresponding to a specified value (e.g., 0) are summed and the sum is divided by K to obtain a next max* input at 508. A max* function is performed on two inputs at 504. For example, the value obtained at 508 and the result from the previous iteration of step 504 are input to a max* function.
To complete the example of how FIG. 5 may be used to perform steps 402 and/or 404 of FIG. 4, Table 5 shows some example values for step 404 when implemented using the process of FIG. 5. Step 404 in this example would result in a numeric value of 30+9.34808×10−14, which is rounded to 30. Step 406 in FIG. 4 is to subtract the second term (30 in this example) from the first term (15.00000031 in this example) which results in LLRb1=−14.99999969.







TABLE 5







Example of a max* function applied to a second group, where K = 1, LLRc0 = 15,


LLRc1 = 15, LLRc2 = −15, and the max* result is used to generate LLRb1








Messages in second
Codewords in second group (b1 = 1)














group (b1 = 1)




Sum of

Numeric
















b1

c0
c1
c2
LLRs/K
max*
value





Message 1
1
Codeword 1
0
0
1
15 + 15 = 30
max*(30, 0)
~30


Message 3
1
Codeword 3
1
1
1
0









In some embodiments, the decision at 506 is to perform the iterative max* function until there are no more codewords in a group. Put another way, the max* function is performed in an exhaustive manner so that the resulting LLRbi is an exact value and not an approximation.
Alternatively, in some embodiments a simplification is made which results in an approximate LLR. Some mathematical functions are expensive and/or difficult to perform when implemented in hardware (such as a field-programmable gate array (FPGA) or an application-specific integrated circuit (ASIC)) and the additional accuracy may not be worth the additional computational complexity or difficulty.
For example, Table 6 shows sums of LLRs values divided by K in sorted order: 15, 7, 0, −11 and −14. As is shown, most of the contribution comes from the first iteration of the max* function (i.e., max*(15,7)), with the second, third and fourth iterations changing the value relatively little.







TABLE 6







Sorted sums-divided-by-K and numeric values 


of iterated max* functions











Sum of

Numeric


Iteration
LLRs/K
max*
value














15
N/A
N/A


1st
7
max*(15, 7)
~15.00033541


2nd
0
max*(0, max*(15, 7))
~15.00033571


3rd
−11
max*(−11, max*(0, max*(15, 7)))
~15.00033571


4th
−14
max*(−14, max*(−11, max*(0, 
~15.00033571




max*(15, 7))))









In some embodiments, only the p largest summands in Equation (9) are performed and the rest are ignored, where, for the case of Equation (8), p can range from 2 to 2m−1 and does not have to be equal for both the first and second terms. Equation (10) in such embodiments is applied recursively (p−1) times for each term. In decision 506 in FIG. 5, this corresponds to stopping after (p−1) iterations of the max* function. In some embodiments, the sum of LLR values divided by K are all first calculated and then sorted in descending order where the iterative max* function operates on the largest values first. This may result in later iterations of the max* function changing the produced value relatively little compared to earlier iterations.
In some embodiments, it is decided at 506 to end the process if a next sum of LLRs divided by K is negligible. For example, performing the second iteration of the max* function in Table 6 would only change the result by 3×10−7 (i.e., 15.00033571-15.00033541). In some embodiments, a next sum of LLRs divided by K is determined to be negligible if the difference is relatively large between a current max* function output and a next sum of LLRs divided by K (see, e.g., Table 6). Otherwise, it may be desirable to do more and/or all of max* functions. See Table 7 for such an example. In the example of Table 7, it may not be desirable to only perform on iteration of the max* function since one iteration produces a numeric value of  ̃1.69 whereas performing all four max* iterations produces a numeric value of  ̃2.61.







TABLE 7







Equal sums-divided-by-K and numeric values of 


iterated max* functions











Sum of 

Numeric 


Iteration
LLRs/K
max*
value






1
N/A
N/A


1st
1
max*(1, 1)
~1.693147181


2nd
1
max*(1, max*(1, 1))
~2.098612289


3rd
1
max*(1, max*(1, max*(1, 1)))
~2.386294361


4th
1
max*(1, max*(1, max*(1, max*
~2.609437912




(1, 1))))









Another approximation can be performed by observing the contributions to the max* function from the underlying maximum function and natural log function (see Equation (10)). Table 8 shows the same sum of LLRs divided by K shown in Table 6 with the contributions from the maximum function and natural log functions broken down. As can be seen in the example of Table 8, the maximum function dominates the natural log function, at least in this example.







TABLE 8







Contributions to numeric values of iterated max* functions from maximum


function and natural log function











Iteration
Sum of LLRs/K
Max
ln
Numeric value















15
N/A
N/A
N/A


1st
7
15
0.000335406
~15.00033541


2nd
0
15.00033541
 3.058 × 10−7
~15.00033571


3rd
−11
15.00033571
5.10747 × 10−12
~15.00033571


4th
−14
15.00033571
2.54241 × 10−13
~15.00033571









Returning to Equation (10), this corresponds to eliminating the second term (i.e., the contribution from the natural log function) in Equation (10) which is equivalent to approximating each term in Equation (8) with the largest summand. Equation (8) then reduces to




  
    
      
        
          LLR
          
            b
            i
          
        
        =
        
          
            
              max
              
                
                  
                    cw
                    j
                  
                  :
                  
                    b
                    i
                  
                
                =
                0
              
            
            ⁢
            
              (
              
                
                  ∑
                  
                    
                      c
                      
                        j
                        ,
                        i
                      
                    
                    =
                    0
                  
                
                ⁢
                
                  LLR
                  
                    c
                    i
                  
                
              
              )
            
          
          -
          
            
              max
              
                
                  
                    cw
                    j
                  
                  :
                  
                    b
                    i
                  
                
                =
                1
              
            
            ⁢
            
              
                (
                
                  
                    ∑
                    
                      
                        c
                        
                          j
                          ,
                          i
                        
                      
                      =
                      0
                    
                  
                  ⁢
                  
                    LLR
                    
                      c
                      i
                    
                  
                
                )
              
              .
            
          
        
      
    
    
      
        (
        11
        )
      
    
  




In some applications, the embodiment of Equation (11) is desirable because the scaling factor K is cancelled out in Equation (11) and/or the maximum function is computationally a relatively easy operation to perform. Equation (11) in flowchart form is described in the next figure.
FIG. 6 is a flowchart illustrating an embodiment of a process to approximate LLRs for bits in a message (LLRbi) using a maximum function. In some embodiments, steps 204-208 of FIG. 2 are performed as shown. In some embodiments, before the process of FIG. 6 is performed, it is first determined that the approximation is appropriate or otherwise acceptable (e.g., a contribution from a maximum function dominates that from a natural log function).
At 600, codewords are separated into two groups, one where bit bi of corresponding messages is a 0 and the other where bit bi of corresponding messages is a 1. For those where bi=0, for each codeword in the group, LLRs for those bits in a codeword corresponding to a specified value (e.g., 0) are summed to obtain a first set of sums at 602. At 604, the largest sum in the first set of sums is selected. In Equation (11), this corresponds to maxcwj:bi=0 (Σcj,i=0 LLRci). See Table 9 where an LLR is determined for bit b1, the specified value in step 602 is 0, LLRc0=15, LLRc1=15 and LLRc2=−15. The sum of LLRs for codeword 0 is 15 and the sum of LLRs for codeword 2 is 0 (step 602). Since 15 is greater than 0, 15 is selected at step 604.







TABLE 9







Example of sums of LLRs for a first group of codewords, the 


largest sum of which is selected and used to generate LLRb1








Messages



in first



group 
Codewords in first group (b1 = 0)













(b1 = 0)





Max of















bl

c0
c1
c2
Sum of LLRs
sums





Message 0
0
Codeword 0
0
0
0
15 + 15 + 
15








−15 = 15



Message 2
0
Codeword 2 
1
0
0
15 + −15 = 0









For those where bi=1, for each codeword in the group, LLRs for those bits in a codeword corresponding to a specified value (e.g., 0) are summed to obtain a second set of sums at 606. At 608, the largest sum in the second set of sums is selected. In Equation (11), this is the second term, maxcwj:bi=1 (Σcj,i=0 LLRci). See Table 10 for an example of steps 706 and 708.







TABLE 10







Example of sums of LLRs for a second group of codewords, 


the largest sum of which is selected and used to generate LLRb1








Messages 



in second 



group 
Codewords in second group (b1 = 1)













(b1 = 1)





Max of 















b1

c0
c1 
c2 
Sum of LLRs
sums





Message 1
1
Codeword 1
0
0
1
15 + 15 = 30
30


Message 3
1
Codeword 3
1
1
1
0









At 610, LLRbi is set to the largest sum in the first set of sums minus the largest sum in the second set of sums. In the example of Tables 9 and 10, LLRb1=15−30=−15. As described above, LLR is defined herein so that a positive LLR value corresponds to a 0 and a negative LLR value corresponds to a 1. Since the LLRs of the input codeword are 15, 15 and −15, the most likely codeword is 001 (i.e., codeword 1). Message 1 corresponds to codeword 1 and bit b1 of message 1 is a 1, so LLRbi=−15 (where a negative value corresponds to a 1) is consistent with the LLRci values that were input.
The same techniques described above can be applied to soft input, soft output mapper 100 in FIG. 1. LLRci as a function of LLRbi can be obtained using the same techniques to obtain Equation (8) and is given by




  
    
      
        
          
            LLR
            
              c
              i
            
          
          =
          
            
              K
              ⁢
              
                
              
              ⁢
              
                ln
                (
                
                  
                    ∑
                    
                      
                        
                          msg
                          j
                        
                        :
                        
                          c
                          i
                        
                      
                      =
                      0
                    
                  
                  ⁢
                  
                    e
                    
                      
                        1
                        K
                      
                      ⁢
                      
                        
                          ∑
                          
                            
                              b
                              
                                j
                                ,
                                i
                              
                            
                            =
                            0
                          
                        
                        ⁢
                        
                          LLR
                          
                            b
                            i
                          
                        
                      
                    
                  
                
                )
              
            
            -
            
              K
              ⁢
              
                
              
              ⁢
              
                ln
                (
                
                  
                    ∑
                    
                      
                        
                          msg
                          j
                        
                        :
                        
                          c
                          i
                        
                      
                      =
                      0
                    
                  
                  ⁢
                  
                    e
                    
                      
                        1
                        K
                      
                      ⁢
                      
                        
                          ∑
                          
                            
                              b
                              
                                j
                                ,
                                i
                              
                            
                            =
                            0
                          
                        
                        ⁢
                        
                          LLR
                          
                            b
                            i
                          
                        
                      
                    
                  
                
                )
              
            
          
        
        ,
      
    
    
      
        (
        12
        )
      
    
  




where the summation in the first term is over all messages which have a corresponding codeword where ci=0, and, similarly, the summation in the second term is over all messages which have a corresponding codeword where ci=1. Unlike Equation (8), the number of summands in the two terms are not necessarily equal, although the total number of summands from both terms add up to 2m. Since the derivation of Equation (12) is similar to that of Equation (8) it is not repeated herein.

Similar to how Equations (9) and (10) permit Equation (8) to be calculated, Equations (9) and (10) also permit Equation (12) to be calculated. If the max* function is performed exhaustively then the LLRci value is exact; alternatively, the inputs to the max* function can be sorted in descending order and the max* function is performed only on the largest inputs and the LLRci value produced is an approximation.
Tables 11 and 12 give an example of using Equations (9), (10) and (12) to determine LLRc0 for the codebook shown in Table 1 when K=1, LLRb0=15 and LLRb1=0.







TABLE 11







Example of a max* function applied to a first group, where K = 1, LLRb0 = 15,


and LLRb1 = 0, and the max* result is used to generate LLRc0








Codewords in first
Messages in first group (c0 = 0)













group (c0 = 0)



Sum of

Numeric















c0

b0
b1
LLRs/K
max*
value





Codeword 0
0
Message 0
0
0
15 + 0 = 15
max*(15, 15)
~15.69314718


Codeword 1
0
Message 1
0
1
15
















TABLE 12







Example of a max* function applied to a second group, 


where K = 1, LLRb0 = 15, and LLRb1 = 0, and 


the max* result is used to generate LLRc0








Codewords 
Messages in second group (c0 = 1)













in second



Sum




group



of




(c0 = 1)



LLRs/

Numeric















c0

b0
b1
K
max*
value





Codeword
1
Message 
1
0
0
max*
~0.693147181


2

2



(0, 0)



Codeword 
1
Message
1
1
0




3

3









In the example above, LLRc0=15.69314718−0.693147181=15. Since the first bit (b0) of the input message is likely a 0 (LLRb0=15) and the second bit of the input message is indeterminate (LLRb1=0), the input message is likely either message 0 (i.e., 00) or message 1 (i.e., 01) and for both messages, bit c0 of the corresponding codewords is 0, which is consistent with the generated value of LLRc0=15.
Simplifying the max* function to a maximum function resulted in Equation (11) and the same technique can be used to obtain the following.




  
    
      
        
          LLR
          
            c
            i
          
        
        =
        
          
            
              max
              
                
                  
                    msg
                    j
                  
                  :
                  
                    c
                    i
                  
                
                =
                0
              
            
            ⁢
            
              (
              
                
                  ∑
                  
                    
                      b
                      
                        j
                        ,
                        i
                      
                    
                    =
                    0
                  
                
                ⁢
                LLR
              
              )
            
          
          -
          
            
              max
              
                
                  
                    msg
                    j
                  
                  :
                  
                    c
                    i
                  
                
                =
                1
              
            
            ⁢
            
              
                (
                
                  
                    ∑
                    
                      
                        b
                        
                          j
                          ,
                          i
                        
                      
                      =
                      0
                    
                  
                  ⁢
                  
                    LLR
                    
                      b
                      i
                    
                  
                
                )
              
              .
            
          
        
      
    
    
      
        (
        13
        )
      
    
  




Tables 13 and 14 give an example of using Equation (13) to determine LLRc0 for the codebook shown in Table 1 when K=1, LLRb0=15 and LLRb1=0.







TABLE 13







Example of a maximum function applied to a first group, 


where K = 1, LLRb0 = 15, and LLRb1 = 0, and


the maximum is used to generate LLRc0








Codewords 



in first 



group 
Messages in first group (c0 = 0)












(c0 = 0)



Sum of
Max of 














c0

b0
b1
LLRs
sums





Codeword 
0
Message
0
0
15 + 0 = 15
15


0

0






Codeword 
0
Message 
0
1
15



1

1
















TABLE 14







Example of a maximum function applied to a second group, 


where K = 1, LLRb0 = 15, and LLRb1 = 0, and the maximum


is used to generate LLRc0








Codewords in second 



group (c0 = 1)
Messages in second group (c0 = 1)














c0

b0
b1
Sum of LLRs
Max of sums





Codeword 2
1
Message 2
1
0
0
0


Codeword 3
1
Message 3
1
1
0









Using the results from Tables 13 and 14, LLRc0=15−0=15. For the same reasons described above with respect to Tables 11 and 12, the LLRc0 value generated is consistent with the input LLRbi values.
Returning back to FIG. 1, mapper 100 and demapper 150 may be used in a variety of applications. The following figures show a magnetic disk storage system which uses mapper 100 and demapper 150 (e.g., configured to perform any of the LLR generation techniques described above). In some other embodiments, mapper 100 and demapper 150 are used in some other application, such as a wireless or wire-line communication system.
FIG. 7 is a diagram showing an embodiment of a systematic code and a write processor portion of a storage system. In diagram 700, data 702 is input to a systematic encoder (704). A systematic encoder is one in which the input data is included in its original form in the encoded output. In this particular example, the output includes the data (702) followed by the parity information (706), but the data may be in any portion or position of the encoded output.
Diagram 750 shows an example of a write processor configured to process write data prior to storage in a magnetic disk (758). In the example shown, data is first processed by a first MTR modulator 752. As described above, an MTR modulator attempts to prevent too many transitions (e.g., 0→1 or 1→0) from occurring over some period of time by inserting bits into the bit stream (e.g., for every 51 bits input, 54 bits are output).
The MTR modulated data is passed from the first MTR modulator (752) to a systematic, low-density parity-check (LDPC) encoder (754). As described above, a systematic encoder outputs encoded data which includes the original input data. This systematic data (i.e., the MTR1 data output by LDPC encoder 754) is passed from LDPC encoder 754 to magnetic disk 758.
Although the MTR 1 data output by LDPC encoder 754 to magnetic disk 758 has the desired properties prior to entering the channel (i.e., magnetic disk 758), the LDPC parity information generated by LDPC encoder 754 does not necessarily have those properties. To ensure that it does, the LDPC parity information is processed by a second MTR modulator 756 which outputs MTR2 LDPC parity information and stores it in magnetic disk 758. In some embodiments, the first and second MTR modulators (752 and 756) perform the same modulation function. In some embodiments, the same (e.g., physical) modulator is used at 752 and 756 (e.g., a single modulator is instantiated).
In some applications, a modulator is selected based on the properties of an error correction code (e.g., LDPC encoder 754) and/or distortions or noise introduced by a channel (e.g., magnetic disk 758). For example, if a particular error correction code is vulnerable to certain types of errors, a signal may be modulated to prevent or mitigate such errors from being introduced by the channel.
This particular example shows an LDPC encoder and an MTR modulator but the techniques are not necessarily limited to this example. In various embodiments, any code and/or modulation technique may be used, for example if different properties or characteristics are desired (e.g., because other applications may have different performance requirements and/or a different channel).
FIG. 8 is a diagram showing an embodiment of a read processor portion of a storage system. The example read processor shown is a counterpart to the write processor shown in FIG. 7.
Information is accessed from magnetic disk 800 and is processed by soft output Viterbi 802. Soft output Viterbi 802 outputs LLRs of MTR1 data and LLRs of MTR2, LDPC parity information. The two outputs of soft output Viterbi 802 correspond to the MTR1 data and the MTR2, LDPC parity information, respectively, passed to magnetic disk 758 in FIG. 7.
Soft input, soft output demapper 804 inputs the LLRs of the MTR modulated LDPC parity information and outputs LLRs of the LDPC parity information. To use the terminology from the equations above, demapper 804 generates LLRbi values using LLRci as an input and any of the techniques described herein may be used by demapper 804. Demapper 804 corresponds to the second MTR modulator (756) in the write processor of FIG. 7.
LDPC decoder 806 uses the LLRs of MTR1 data from soft output Viterbi 802 and the LLRs of the LDPC parity information from demapper 804 to generate a hard decision (e.g., a decision that a bit is a 0 or a 1 without any probability or certainty associated with that decision). In some embodiments an LDPC decoder can be configured to output either hard decisions or soft decisions. In some embodiments when configured to output hard decisions, hard decisions are generated by the LDPC decoder by taking the signs of the soft decisions. The hard decisions are then passed to MTR demodulator 808, which corresponds to the first MTR modulator (752) in FIG. 7. For example, the 0's and 1's inserted by the MTR modulator 752 in FIG. 7 may be removed by MTR demodulator 808.
If processing is successful, then the bottom path which includes soft input, soft output mapper 812 and systematic, LDPC encoder 810 is not used. In one example of how a system knows when read processing fails, the data output by MTR demodulator 808 may have an error correction or error detection code embedded in it. Using this code, the system is able to detect (e.g., using processors or modules downstream from MTR demodulator 808 not shown in this figure) when the capabilities of one or more codes have been exceeded and the result is incorrect.
If processing is unsuccessful and another iteration of decoding is required, then the bottom path is used. In iterative decoding, another iteration of the decoding process is performed using a different set of inputs. In this particular example, processing returns to soft output Viterbi 802 and processing is retried with inputs from LDPC encoder 810 and soft input, soft output mapper 812 in addition to information from magnetic disk 800, where the inputs from 810 and 812 are used as a priori values. To generate an additional set of inputs, the soft decision from LDPC decoder 806 is passed to systematic, LDPC encoder 810 which generates LLRs of the MTR modulated data and LLRs of LDPC parity information (in other words, LDPC encoder 810 generates soft information using soft information from decoder 806 as input). The systematic information (i.e., LLRs of MTR1 data) is passed to soft output Viterbi 802 and the LLRs of the LDPC parity information are passed to soft input, soft output mapper 812. To use the terminology from the equations above, mapper 812 generates LLRci values using LLRbi values as input and any of the techniques described above to generate LLRci (e.g., an exact value or approximation) may be used.
The LLR values from LDPC encoder 810 and mapper 812 are passed to soft output Viterbi 802 for another iteration. This technique of going through the top path and then the bottom path if needed may be repeated as many times as desired, or until read processing is successful. In some embodiments, a system is configured to stop after a certain number of iterations is reached without success.
In some embodiments, an MTR code (e.g., associated with demapper 804 and mapper 812) is selected to minimize error propagation in both the encoding and decoding directions. For example, for a set of codewords that satisfy the MTR constraint, the message-to-codeword mapping that results in the lowest error propagation effect in both directions is chosen. Error propagation occurs when an input sequence with k bit errors encodes or decodes to an output sequence with more than k bit errors, thus degrading the performance of subsequent processing blocks. If one mapping (worst case) outputs 2 errors for every 1 error input in the encoding direction and 3 errors for every 1 error input in the decoding direction whereas another mapping (worst case) outputs 1 error for every 1 error input in the encoding direction and 2 errors for every 1 error input in the decoding direction, the latter mapping is selected.
FIG. 9 is a flowchart illustrating an embodiment of a process to perform iterative decoding in the event error correction processing fails. In some embodiments, the read processor shown in FIG. 8 performs the example process shown.
At 900, a first iteration of error correction processing is performed, including by determining a log-likelihood ratio (LLR) for a bit bi in a message. In FIG. 8, for example, this includes using soft output Viterbi 802, demapper 804 and LDPC decoder 806. In some embodiments, the determination of an LLR for a bit bi in a message is performed by demapper 804 and includes the process shown in FIG. 2.
At 902, it is determined whether to perform another iteration of error correction processing. For example, if error correction processing is successful then there is no need to perform another iteration. Alternatively, the processor may have failed for the nth consecutive time and the system is configured to stop once a certain number of failures has been reached.
If it is determined to perform another iteration of error correction processing at 902, an additional set of inputs for error correction processing is generated, including by determining a log-likelihood ratio (LLR) for a bit ci in a codeword. In FIG. 8, for example, the additional set of inputs is generated by systematic, LDPC encoder 810 and soft input, soft output mapper 812. In some embodiments, a LLR for a bit ci in a codeword is generated by mapper 812 in FIG. 8 using the process shown in FIG. 3.
At 906, another iteration of error correction processing is performed with the additional set of inputs, including by determining a log-likelihood ratio (LLR) for a bit bi in a message. In FIG. 8 for example, soft output Viterbi is activated again using the additional inputs from LDPC encoder 810 and mapper 812 in addition to information from magnetic disk 800.
Although the foregoing embodiments have been described in some detail for purposes of clarity of understanding, the invention is not limited to the details provided. There are many alternative ways of implementing the invention. The disclosed embodiments are illustrative and not restrictive.

## Claims

1. A method for determining a log-likelihood ratio (LLR) for a bit bi in a message being generated, comprising:
obtaining: (1) a codebook which includes a plurality of messages and a plurality of codewords and (2) a specified bit value, wherein the LLR for bit bi is based at least in part on the codebook and the specified bit value;
for bit bi in the message being generated, generating a first term, including by:
accessing the codebook in order to determine those messages which have a bit bi with a value of 0;
selecting, from those messages determined to have a bit bi with a value of 0, a first selected message, wherein the first selected message corresponds to a first selected codeword in the codebook; and
summing one or more LLRs corresponding to bits in the first selected codeword having the specified bit value;

for bit bi in the message being generated, generating a second term, including by:
accessing the codebook in order to determine those messages which have a bit bi with a value of 1;
selecting, from those messages determined to have a bit bi with a value of 1, a second selected message, wherein the second selected message corresponds to a second selected codeword in the codebook; and
summing one or more LLRs corresponding to bits in the second selected codeword having the specified bit value; and

for bit bi in the message being generated, using a processor to generate the LLR based at least in part on the first term and the second term.

2. The method of claim 1, wherein the specified bit value is a 0.

3. The method of claim 1, wherein the method is performed by one or more of the following: a storage system, a communications system, a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC) or a microprocessor.

4. The method of claim 1 further comprising separating a plurality of codewords into a first group and a second group, wherein for the first group, bit bi of one or more corresponding messages is a 0 and for the second group, bit bi of one or more corresponding messages is a 1.

5. The method of claim 4 further comprising:
generating the first term further includes iteratively performing a max* function on the first group;
generating the second term further includes iteratively performing a max* function on the second group; and
generating the LLR further includes subtracting the second term from the first term.

6. The method of claim 5, wherein generating the first term includes:
for a first codeword in the first group, summing zero or more LLRs for those bits in the first codeword corresponding to the specified bit value and dividing the sum of LLRs by K to obtain a first max* input;
for a second codeword in the first group, summing zero or more LLRs for those bits in the second codeword corresponding to the specified bit value and dividing the sum of LLRs by K to obtain a second max* input; and
performing a max* function on the first max* input and the second max* input.

7. The method of claim 6, wherein summing, dividing and a max* function are performed on all codewords in the first group.

8. The method of claim 6, wherein generating the first term further includes sorting the first max* input and the second max* input, wherein a max* function is performed on the first max* input and the second max* input in sorted order.

9. The method of claim 8, wherein:
there is a third max* input which is sorted with the first max* input and the second max* input; and
a max* function is not performed on the smallest sorted max* input.

10. The method of claim 4, wherein:
generating the first term further includes:
for each of the codewords in the first group, summing zero or more LLRs for those bits in that codeword corresponding to the specified bit value to obtain a first set of sums; and
selecting the largest sum in the first set of sums;

generating the second term further includes:
for each of the codewords in the second group, summing zero or more LLRs for those bits in that codeword corresponding to the specified bit value to obtain a second set of sums; and
selecting the largest sum in the second set of sums; and

generating the LLR further includes subtracting the largest sum in the second set of sums from the largest sum in the first set of sums.

11. A system for determining a log-likelihood ratio (LLR) for a bit bi in a message being generated, comprising:
a processor; and
a memory coupled with the processor, wherein the memory is configured to provide the processor with instructions which when executed cause the processor to:
obtain: (1) a codebook which includes a plurality of messages and a plurality of codewords and (2) a specified bit value, wherein the LLR for bit bi is based at least in part on the codebook and the specified bit value;
for bit bi in the message being generated, generate a first term, including by:
accessing the codebook in order to determine those messages which have a bit bi with a value of 0;
selecting, from those messages determined to have a bit bi with a value of 0, a first selected message, wherein the first selected message corresponds to a first selected codeword in the codebook; and
summing one or more LLRs corresponding to bits in the first selected codeword having the specified bit value;

for bit bi in the message being generated, generate a second term, including by:
accessing the codebook in order to determine those messages which have a bit bi with a value of 1;
selecting, from those messages determined to have a bit bi with a value of 1, a second selected message, wherein the second selected message corresponds to a second selected codeword in the codebook; and
summing one or more LLRs corresponding to bits in the second selected codeword having the specified bit value; and

for bit bi in the message being generated, generate the LLR based at least upon the first term and the second term.

12. The system of claim 11, wherein the system is included in one or more of the following: a storage system or a communications system.

13. The system of claim 11, wherein the system includes one or more of the following: a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC) or a microprocessor.

14. A method for determining a log-likelihood ratio (LLR) for a bit ci in a codeword being generated, comprising:
obtaining: (1) a codebook which includes a plurality of messages and a plurality of codewords and (2) a specified bit value, wherein the LLR for bit ci is based at least in part on the codebook and the specified bit value;
for bit ci in the codeword being generated, generating a first term, including by:
accessing the codebook in order to determine those codewords which have a bit ci with a value of 0;
selecting, from those codewords determined to have a bit ci with a value of 0, a first selected codeword, wherein the first selected codeword corresponds to a first selected message in the codebook; and
summing one or more LLRs corresponding to bits in the first selected message having the specified bit value;

for bit ci in the codeword being generated, generating a second term, including by:
accessing the codebook in order to determine those codewords which have a bit ci with a value of 1;
selecting, from those codewords determined to have a bit ci with a value of 1, a second selected codeword, wherein the second selected codeword corresponds to a second selected message in the codebook; and
summing one or more LLRs corresponding to bits in the second selected message having the specified bit value; and

for bit ci in the codeword being generated, using a processor to generate the LLR based at least in part on the first term and the second term.

15. The method of claim 14, wherein the specified bit value is a 0.

16. The method of claim 14, wherein the method is performed by one or more of the following: a storage system, a communications system, a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC) or a microprocessor.

17. The method of claim 14 further comprising separating a plurality of messages into a first group and a second group, wherein for the first group, bit ci of one or more corresponding codewords is a 0 and for the second group, bit ci of one or more corresponding codewords is a 1.

18. The method of claim 17 further comprising:
generating the first term further includes iteratively performing a max* function on the first group;
generating the second term further includes iteratively performing a max* function on the second group; and
generating the LLR further includes subtracting the second term from the first term.

19. The method of claim 18, wherein generating the first term includes:
for a first message in the first group, summing zero or more LLRs for those bits in the first message corresponding to the specified bit value and dividing the sum of LLRs by K to obtain a first max* input;
for a second message in the first group, summing zero or more LLRs for those bits in the second message corresponding to the specified bit value and dividing the sum of LLRs by K to obtain a second max* input; and
performing a max* function on the first max* input and the second max* input.

20. The method of claim 19, wherein summing, dividing and a max* function are performed on all messages in the first group.

21. The method of claim 19, wherein generating the first term further includes sorting the first max* input and the second max* input, wherein a max* function is performed on the first max* input and the second max* input in sorted order.

22. The method of claim 21, wherein:
there is a third max* input which is sorted with the first max* input and the second max* input; and
a max* function is not performed on the smallest sorted max* input.

23. The method of claim 17, wherein:
generating the first term further includes:
for each of the messages in the first group, summing zero or more LLRs for those bits in that message corresponding to the specified bit value to obtain a first set of sums; and
selecting the largest sum in the first set of sums;

generating the second term further includes:
for each of the messages in the second group, summing zero or more LLRs for those bits in that message corresponding to the specified bit value to obtain a second set of sums; and
selecting the largest sum in the second set of sums; and

generating the LLR further includes subtracting the largest sum in the second set of sums from the largest sum in the first set of sums.

24. A method for performing error correction processing, comprising:
obtaining: (1) a codebook which includes a plurality of messages and a plurality of codewords and (2) a specified bit value;
performing an iteration of error correction processing, including by determining a log-likelihood ratio (LLR) for a bit bi in a message being generated, including by:
for bit bi in the message being generated, generating a first term, including by:
accessing the codebook in order to determine those messages which have a bit bi with a value of 0;
selecting, from those messages determined to have a bit bi with a value of 0, a first selected message, wherein the first selected message corresponds to a first selected codeword in the codebook; and
summing one or more LLRs corresponding to bits in the first selected codeword having the specified bit value;

for bit bi in the message being generated, generating a second term, including by:
accessing the codebook in order to determine those messages which have a bit bi with a value of 1;
selecting, from those messages determined to have a bit bi with a value of 1, a second selected message, wherein the second selected message corresponds to a second selected codeword in the codebook; and
summing one or more LLRs corresponding to bits in the second selected codeword having the specified bit value; and

for bit bi in the message being generated, generating the LLR based at least in part on the first term and the second term;

using a processor to determine whether to perform another iteration of error correction processing; and
in the event it is determined to perform another iteration of error correction processing, generating an additional set of inputs for error correction processing, including by determining a log-likelihood ratio (LLR) for a bit ci in a codeword being generated, including by:
for bit ci in the codeword being generated, generating a third term, including by:
accessing the codebook in order to determine those codewords which have a bit ci with a value of 0;
selecting, from those codewords determined to have a bit ci with a value of 0, a third selected codeword, wherein the third selected codeword corresponds to a third selected message in the codebook; and
summing one or more LLRs corresponding to bits in third selected message having the specified bit value;

for bit ci in the codeword being generated, generating a fourth term, including by:
accessing the codebook in order to determine those codewords which have a bit ci with a value of 1;
selecting, from those codewords determined to have a bit ci with a value of 1, a fourth selected codeword, wherein the fourth selected codeword corresponds to a fourth selected message in the codebook; and
summing one or more LLRs corresponding to bits in the fourth selected message having the specified bit value; and

for bit ci in the codeword being generated, generating the LLR based at least in part on the third term and the fourth term.

25. The method of claim 24, wherein the method is performed by one or more of the following: a storage system, a communications system, a field-programmable gate array (FPGA), an application-specific integrated circuit (ASIC) or a microprocessor.