Embodiments relate to a controller, a storage device, and a control method.
In the storage device using a magnetic disk, a semiconductor memory, and the like, data is encoded such that destroy of the data may be detected or corrected. The storage device includes a plurality of data paths such as a path from a host to a primary storage medium and a path from the primary storage medium to a non-volatile storage medium such as the magnetic disk. A plurality of storage media such as a static random access memory (SRAM) and a dynamic random access memory (DRAM) might be used as the primary storage medium. In this case, there also is a data path between the primary storage media.
A trend and a property of frequent errors differ depending on the data path, so that a unit of coding and a generator polynomial differ from one data path to another in general. Therefore, when the data is moved between the media, a protection system (unit of coding and generator polynomial) of the data might be changed. For example, suppose that a hard disk controller is provided with the DRAM and SRAM, stores the data received from the host in the SRAM, and stores the data read from the SRAM in the DRAM. In this case, the protection system to the data is changed from a first protection system to the data stored in the SRAM to a second protection system to the data stored in the DRAM during a process to store the data read from the SRAM in the DRAM.
A controller of the embodiments includes a receiving unit which receives data and a first redundant bit generated by coding (first coding) of the data by using a first generator polynomial, a first error check unit which compares a redundant bit generated by coding of the data by the first generator polynomial and the first redundant bit which is transmitted, a coding unit which codes (second coding) the data by a second generator polynomial having a common factor with the first generator polynomial to generate a second redundant bit. The controller further includes an error check unit which determines whether there is difference between the data input to the first coding and the data input to the second coding by dividing an XOR operation result of the first redundant bit which is received and a result of a bit shift of the second redundant bit by the common factor.
The controller, a storage device, and a control method according to the embodiments are hereinafter described in detail with reference to the attached drawings. Meanwhile, the present invention is not limited by the embodiments.
Meanwhile, although the example in which the magnetic disk 3 is used as a storage medium is herein described, a semiconductor memory such as a NAND memory may also be used as the storage medium; the storage medium provided on the storage device 1 is not limited to the magnetic disk 3. An SRAM 26 and a DRAM 27 may also be externally connected to the controller 2.
The controller 2 controls writing to the magnetic disk 3 according to a write command from the host 4. The controller 2 also controls reading from the magnetic disk 3 according to a read command from the host 4. The controller 2 includes a host I/F 21, a control unit 22, a protection unit 23, an I/F 24, an I/F 25, the SRAM 26 (first storage unit), the DRAM 27 (second storage unit), and a disk I/F 28.
The controller 2 stores data received from the host 4 in the SRAM 26 through the I/F 24. This also stores the data read from the SRAM 26 through the I/F 24 in the DRAM 27 through the I/F 25. This also stores the data read from the DRAM 27 through the I/F 25 in the magnetic disk 3 through the disk I/F 28.
The data transmitted from the host 4, the data stored in the SRAM 26, the data stored in the DRAM 27, and the data stored in the magnetic disk 3 are coded for data protection. In general, trends and properties of errors occurring in a communication path from the host 4, the SRAM 26, the DRAM 27, and the magnetic disk 3 are different from one another. Therefore, when the data is moved, a data protection system (unit of coding and generator polynomial) might be changed along the way.
For example, suppose that the data stored in the DRAM 27 is coded by a first protection system and the data stored in the magnetic disk 3 is coded by a second protection system. In this case, when the controller 2 reads the data from the DRAM 27 and stores the same in the magnetic disk 3, the protection system is changed from the first protection system to the second protection system along the way. When the protection system is changed along the way in this manner, it is desirable that a section protected by the first protection system and a section protected by the second protection system are overlapped with each other such that there is no section (area) which is not protected.
In order to overlap the first protection system with the second protection system, there might be a method of making a data path of the first protection system and the data path of the second protection system independent from each other. For example, the data path is branched into a first path in which decoding and an error check by the first protection system are performed and a second path in which coding by the second protection system is performed at a branching point. The data passing through the second path is coded by the second protection system to be stored in the magnetic disk 3. When the data includes an error at the branching point, the error is detected by the decoding and the error check by the first protection system of the data passing through the first path.
However, the error check by the first protection system is performed independently from the coding by the above-described second protection system. Therefore, the error of the data passing through the second path is not detected until the data is read from the magnetic disk 3 to be decoded. When the error is detected early, it is possible to reduce the error included in the data stored in the magnetic disk 3 by providing a transmission of the data and the like again; however, the error cannot be detected until the data is read from the magnetic disk 3 to be decoded by this system.
When circuit synthesis is performed, the first path and the second path might be unified.
In this embodiment, as described hereinafter, when the protection system is changed in the middle of the data path, the generator polynomial is set such that the generator polynomial used in the protection system before the change and the generator polynomial used in the protection system after the change have a common factor. Therefore, it is possible to eliminate the section which is not protected which might be generated as a result of the circuit synthesis and to rapidly detect the error included in the data input to the circuit which codes after the change.
A protection method of this embodiment is hereinafter described.
The path protection unit 234 protects the data from the error occurring from reading from the magnetic disk 3 to the storage in the DRAM 27 and during the storage in the DRAM 27. The path protection unit 235 protects the data from the error occurring from the reading from the DRAM 27 to the storage in the SRAM 26 and during the storage in the SRAM 26. The path protection unit 236 protects the data from the error occurring from the reading from the SRAM 26 to reception by the host 4.
Meanwhile, as described above, the path protection units 231 to 236 are provided for data paths among which the protection system might be changed. The path protection units 231 to 236 are exemplary only and the path protection unit may be provided depending on an actually set data path. For example, when the data read from the magnetic disk 3 is transmitted to the host 4 not through the SRAM 26 and the DRAM 27, the path protection unit for protecting the data from the error occurring from the reading from the magnetic disk 3 to the reception by the host 4 is provided in place of the above-described path protection units 234 to 236.
The generator polynomial of this embodiment is herein described. In this embodiment, an error detection coding or error correction coding process is performed in order to protect the data. In this embodiment, the coding (error detection coding or error correction coding process) is the coding to perform remainder operation by using the generator polynomial. A code to perform the remainder operation by using the generator polynomial in the coding in this manner includes a cyclic redundancy check (CRC) code, a Bose, Chandhuri, Hocquenghem (BCH) code, a Reed-Solomon (RS) code and the like, for example. It is possible to apply the protection method of this embodiment when these codes are used.
The generator polynomial used in the coding of the protection A is represented as GA(x) and the generator polynomial used in the coding of the protection B is represented as GB(x). Polynomial expressions of code words generated by coding the same data (information bit) by the coding of the protection A and the coding of the protection B are CA(x) and CB(x), respectively. The polynomial equations corresponding to the information bits in CA(x) and CB(x) are set to PA(x) and PB(x), respectively, and the polynomial equations corresponding to the redundant bits in CA(x) and CB(x) are set to RA(x) and RB(x), respectively. Herein, CA(x) and CB(x) may be represented by following equations (1) and (2), respectively.
C
A(x)=PA(x)+RA(x) (1)
C
B(x)=PB(x)+RB(x) (2)
In this embodiment, the generator polynomial GB(x) of the protection B is generated to have the common factor with the generator polynomial GA(x) of the protection A. If the common factor is set to G0(x), GA(x) and GB(x) may be represented by following equations (3) and (4), respectively. Meanwhile, gA(x) is a product obtained by dividing GA(x) by G0(x) and gA(x) is a product obtained by dividing GB(x) by G0(x).
G
A(x)=gA(x)G0(x) (3)
G
B(x)=gB(x)G0(x) (4)
Therefore, following equations (5) and (6) are true.
C
A(x)=PA(x)+RA(x)=gA(x)G0(x)QA(x) (5)
C
B(x)=PB(x)+RB(x)=gB(x)G0(x)QB(x) (6)
Meanwhile, QA(x) and QB(x) are products obtained by dividing PA(x) and PB(x) by GA(x) and GB(x), respectively.
GA(x) is of higher degree than GB(x) and difference between the degree of GA(x) and that of GB(x) is set to m. Since the information bit of CA(x) is the same as that of CB(x), PA(x) is obtained by shifting PB(x) by m-th degree and following equation (7) is true.
P
A(x)=xmPB(x) (7)
Following equation (8) is obtained from equations (5), (6), and (7) described above.
R
A(x)+xmRB(x)=(gA(x)QA(x)+xmgB(x)QB(x))G0(x) (8)
From equation (8) described above, a sum (XOR) of a result of shifting RB(x) by m bits and RA(x) is divisible by G0(x).
If an information bit length in one code word of the protection A is identical to that of the protection B, it is possible to determine whether there is the error only by dividing the sum (XOR) of the result of shifting RB(x) by m bits and RA(x) by G0(x). On the other hand, when the information bit length in one code word of the protection A is different from that of the protection B, a unit conversion process to be described later is performed for making the data being targets from which the error is detected conform to each other.
Next, an example of a specific process of the path protection units 231 to 236 is described. In the path protection unit 231, the coding applied to the data transmitted from the host 4 is the protection A and the coding performed when this is stored in the SRAM 26 is the protection B. In this case, the coding of the protection A is performed by the host 4. Therefore, the generator polynomial used by the host 4 in the coding is grasped and the generator polynomial of the coding performed when the data is stored in the SRAM 26 is such that this has the common factor with the generator polynomial.
In the path protection unit 232, the coding applied to the data stored in the SRAM 26 is the protection A and the coding performed when this is stored in the DRAM 27 is the protection B. In the path protection unit 233, the coding applied to the data stored in the DRAM 27 is the protection A and the coding performed when this is stored in the magnetic disk 3 is the protection B.
In the path protection unit 234, the coding applied to the data stored in the magnetic disk 3 is the protection A and the coding performed when this is stored in the DRAM 27 is the protection B. In the path protection unit 235, the coding applied to the data stored in the DRAM 27 is the protection A and the coding performed when this is stored in the SRAM 26 is the protection B. In the path protection unit 236, the coding applied to the data stored in the SRAM 26 is the protection A and the coding performed when this is transmitted to the host 4 is the protection B.
First, the path protection unit 231 receives the data (information bit) and the first redundant bit generated by using the first generator polynomial from the host I/F 21 (block B1). The protection A decoding unit 41 decodes by using the data and the first redundant bit and inputs the first redundant bit to the unit conversion unit 44 and the protection A check unit 42. Herein, decoding is calculating to obtain a remainder of the data and the redundant bit by using the first generator polynomial; in a state in which only the data is input, the same result as that when the coding of the data is performed by using the first generator polynomial is obtained when the data includes no error. The protection B coding unit 43 codes the data by using the second generator polynomial to generate the second redundant bit (block B2).
The unit conversion unit 44 performs the unit conversion process to be described later by using the second redundant bit and the first redundant bit (block B3). The change check unit 45 calculates an XOR of a result of shifting the first redundant bit after unit conversion and the second redundant bit after the unit conversion (block B4). The change check unit 45 determines whether an XOR calculation result is divisible by the common factor (block B5) and finishes the process when this is divisible (Yes at block B5). When this is not divisible (No at block B5), the change error notification unit 46 which is notified of a result notifies the control unit 22 of the error (block B6) and finishes the process.
Next, the unit conversion process of this embodiment is described. For example, suppose that a bus width is eight bits and eight information bits are transferred by one transfer. Suppose that one redundant bit RA(x) is generated for eight information bits in the protection A, and 32 redundant bits RB(x) are generated for 512 information bits in the protection B. In this case, the information bit length of the protection target per one code word of the protection A is different from that of the protection B and it is not possible to directly detect the error by using equation (8) described above. Therefore, as described hereinafter, the unit conversion to make the information bit length of the protection B conform to that of the protection target per one code word of the protection A is performed. Herein, suppose that the information bit length of the protection target per one code word of the protection A conforms to the bus width. Therefore, the redundant bit after the unit conversion is generated in one transfer unit. Di is the data (eight-bit) of an i-th bus transfer and Di(x) is polynomial expression of Di. At that time, when RB,1(x) is the redundant bit generated at the time of the coding of D1(x) by the second generator polynomial GB(x), following equation (9) is true.
D
1(x)+RB,1(x)=GB(x)QB,1(x) (9)
Meanwhile, QB,i(x) is a product obtained when Di(x) is divided by GB(x).
As represented by equation (9), the redundant bit RB,1(x) calculated by dividing D1(x) by GB(x) is calculated in a first transfer. Therefore, the protection target of the protection B conforms to the protection target of the protection A, so that it is possible to use RB,1(x) as RB(x) in equation (8) described above.
Next, D2(x) is made the data (eight-bit) of a second bus transfer and RB,2(x) is made the redundant bit generated by using GB(x) for D1(x) and D2(x). The code word generated at that time is divisible by GB(x). Therefore, equation (10) is true.
x
8
D
1(x)+D2(x)+RB,2(x)=GB(x)QB,2(x) (10)
Following equation (11) is obtained by deleting Di(x) from equations (9) and (10).
D
2(x)+x8RB,1(x)+RB,2(x)=(x8QB,1(x)+QB,2(x))GB(x) (11)
Therefore, a left side of equation (11) is divisible by GB(x). A first term of the left side is the information bit of the second transfer and conforms to the protection target of the protection A. Although a second term of the left side is 40 (=32+8) bits since 32 redundant bits are shifted by eight bits, a result the same as that obtained by dividing this term by GB(x) is obtained by properties of the Galois field and the generator polynomial. Therefore, the second term of the left side is a remainder obtained by dividing a result of shifting the redundant bit RB,1(x) generated in a previous transfer by eight bits by GB(x). That is to say, this is a result of coding the result of shifting RB,1(x) by eight bits by using GB(x). Therefore, a redundant bit R′B,2(x) of the protection B corresponding to D2(x) of the second transfer is an XOR of the result of coding the result of shifting the redundant bit RB,1(x) generated at the time of the previous transfer by eight bits by using GB(x) and the redundant bit RB,2(x) generated in the second transfer.
In third and subsequent transfers, if the number of transfers is set to i, following equations (12) and (13) are true for an (i−1)-th transfer and an i-th transfer, respectively.
x
8(i-2)
D
1(x)=x8Di-2(x)+Di-1(x)+RB,i-1(x)=GB(x)QB,i-1(x) (12)
x
8(i-1)
D
1(x)+x8Di-1(x)+Di(x)+RB,i(x)=GB(x)QB,i(x) (13)
Following equation (14) is true from equations (12) and (13).
D
i(x)+x8RB,i-1(x)+RB,i(x)=(x8QB,i-1(x)+QB,i(x))GB(x) (14)
Therefore, a redundant bit R′B,i(x) of the protection B corresponding to Di(x) input at the time of the i-th transfer is an XOR of a result of coding a result of shifting a redundant bit RB,i-1(x) generated at the time of the previous transfer by eight bits by using GB(x) and a redundant bit RB,i(x) generated in the i-th transfer.
A configuration example of the unit conversion unit 44 for realizing the above-described unit conversion is described.
As illustrated in
Regarding the protection B, the protection B coding unit 43 outputs an intermediate operation result of CRC being the redundant bit for each input of the eight information bits. That is to say, the protection B coding unit 43 outputs the redundant bit obtained by coding eight-bit D1(x) by using GB(x) to the unit conversion unit 44 in the first transfer. The protection B coding unit 43 outputs the redundant bit obtained by coding eight-bit D1(x) and D2(x) by using GB(x) to the unit conversion unit 44 in the second transfer. The protection B coding unit 43 outputs the redundant bit (CRC in this example) obtained by coding eight-bit D1(x), D2(x), . . . , and Di(x) by using GB(x) to the unit conversion unit 44 in the third and subsequent transfers. Then, in a 64-th transfer, the protection B coding unit 43 outputs the redundant bit obtained by coding eight-bit D1(x), D2(x), . . . , and D64(x) by using GB(x) to the unit conversion unit 44 and outputs the redundant bit to the output destination (for example, the I/F 24) as a final redundant bit for 512 bits.
The XOR operation unit 441 outputs a result of calculating an XOR of CRC input from the protection B coding unit 43 and CRC″ to be described later input from the shift and CRC operation unit 442 to the change check unit 45 as CRC′ and outputs CRC to the shift and CRC operation unit 442. Meanwhile, although an example in which the XOR operation unit 441 outputs CRC′ to the change check unit 45 through the shift and CRC operation unit 442 is illustrated in
The shift and CRC operation unit 442 shifts RB,i, codes a shifted result by using the second generator polynomial GB(x) to generate R″B,i, and inputs the same to the XOR operation unit 441 (block B15). This R″B,j, is used as R″B,i-1 generated at the time of the previous transfer at block B14 in a next transfer.
Then, the unit conversion unit 44 inputs a redundant bit RA,i corresponding to Di generated by using the first generator polynomial GA(x) and R′B,i generated at block B14 to the change check unit 45 (block B16). The protection B coding unit 43 determines whether i=N (block B17). N is a numeral value obtained by dividing a redundant bit length of the unit of coding of the protection B by the bus width. If i=N is not satisfied (No at block B17), it is set that i=i+1 (block B18) and the procedure returns to Block B12. If i=N is satisfied (Yes at block B17), the protection B coding unit 43 outputs RB,N to the receiving unit 102 being the output destination and finishes the process. According to this, the unit conversion of one code word of the protection B is finished.
The change check unit 45 calculates a left side of equation (8) described above by using RA,i and R′B,i as RA and RB, respectively, and determines whether there is the error based on whether a calculation result is divisible by G0(x).
Meanwhile, when the information bit length in the unit of coding is the same in the protection A and protection B, the path protection units 231 to 236 are not required to be provided with the unit conversion unit 44. When the information bit length in the unit of coding of the protection B is shorter than that of the protection A, the XOR operation unit 441 and the shift and CRC operation unit 442 may be provided not on the protection B side but on the protection A side.
As described above, in this embodiment, when the protection system to the data is changed from the protection A to the protection B, the generator polynomial is set such that the generator polynomial used in the protection A and the generator polynomial used in the protection B have the common factor. Therefore, it is possible to eliminate the section which is not protected and rapidly detect the error included in the data input to the circuit which codes after the change. It is configured such that the unit conversion process to generate the redundant bit in the unit conforming to the information bit of the protection target of the protection A is performed when the information bit length in the unit of coding of the protection A is different from that of the protection B. Therefore, the above-described effect may be obtained even when the information bit length in the unit of coding of the protection A is different from that of the protection B.
Unit conversion in a case in which a bus width is identical to an information bit length of a unit of coding of protection A is described in the first embodiment. An example in which the information bit lengths of the units of coding of both protection A and protection B are different from the bus width is described in this embodiment.
As illustrated in
Although an example in which a redundant bit is already generated for the protection A is described in the first embodiment, not a final redundant bit but an intermediate calculation result of the redundant bit for each transfer by the bus width is used in this embodiment. A protection A coding unit 103 (input side coding unit) and a protection B coding unit 104 in
Next, a unit conversion process of this embodiment is described. The XOR operation unit 443 and the shift and CRC operation unit 444 perform processes similar to those of the XOR operation unit 441 and the shift and CRC operation unit 442 on the redundant bit of the protection A. D1 is data (64-bit) received by an i-th transfer. Regarding the protection B, following equation (15) is true when generalizing the bus width to w bits in equation (14) described in the first embodiment.
D
i(x)+xwRB,i-1(x)+RB,i(x)=(xwQB,i-1(x)+QB,i(x))GB(x) (15)
Following equation (16) is similarly true also regarding the protection A. RA,i(x) is an intermediate result of the redundant bit generated by the protection A coding unit 103 at the time of the i-th transfer.
D
i(x)+xwRA,i-1(x)+RA,i(x)=(xwQA,i-1(x)+QA,i(x))GA(x) (16)
Therefore, regarding the protection A also, a redundant bit R′A,i(x) of the protection A corresponding to Di(x) input at the time of the i-th transfer may be obtained as an XOR of a result of coding a result of shifting a redundant bit RA,i-1(x) generated at the time of a previous transfer by w bits by using GA(x) and the redundant bit RA,i(x) generated in the i-th transfer. Therefore, as illustrated in
Although an example in which the bus width is the same in the protection A and the protection B is herein described, a check by the change check unit 45 may be applied also when the bus width of the protection A is different from that of the protection B. In this case, the configuration of the unit conversion unit is similar to that of the unit conversion unit 44a in
On the other hand, eight-bit data DFi is transferred to the protection B coding unit 104 (block B28). Herein, the data obtained by dividing 16-bit Di into two are DFi and DLi. The protection B coding unit 104 generates a redundant bit RBF,i corresponding to the data (information bit) from D1 to Di-1 and DFi by using a second generator polynomial GB(x) (block B29). Then, next eight-bit data DLi is transferred to the protection B coding unit 104 (block B30). The protection B coding unit 104 generates a redundant bit RB,i corresponding to the data (information bit) from D1 to Di by using the second generator polynomial GB(x) to output to the unit conversion unit 44a (block B31). The XOR operation unit 441 of the unit conversion unit 44a obtains an XOR of RB,i and R″B,i-1 generated at the time of a second previous transfer to generate a redundant bit R′B,i corresponding to Di (block B32). The shift and CRC operation unit 442 shifts RB,i, codes a shifted result by using the second generator polynomial GB(x) to generate R″B,i, and inputs the same to the XOR operation unit 441 (block B33).
After block B25, the protection A coding unit 103 and the protection B coding unit 104 determines whether i=N is satisfied (block B26). Meanwhile, N is a value obtained by dividing a least common multiple of code word lengths of the protection A and the protection B by the bus width, for example. If i=N is not satisfied (No at block B26), it is set that i=i+1 (block B27) and the procedure returns to blocks B21 and B28. When i=N is satisfied (Yes at block B26), the procedure is finished.
The unit conversion process when the unit of coding of the protection A is different from the bus width and when the bus width of the protection A is different from that of the protection B is described above in this embodiment. According to this, the effect similar to that of the first embodiment may be obtained also when the unit of coding of the protection A is different from the bus width and when the bus width of the protection A is different from that of the protection B.
While certain embodiments have been described, these embodiments have been presented by way of example only, and are not intended to limit the scope of the inventions. Indeed, the novel embodiments described herein may be embodied in a variety of other forms; furthermore, various omissions, substitutions and changes in the form of the embodiments described herein may be made without departing from the spirit of the inventions. The accompanying claims and their equivalents are intended to cover such forms or modifications as would fall within the scope and spirit of the inventions.
This application is based upon and claims the benefit of priority from U.S. Provisional Application No. 62/001,341, filed on May 21, 2014; the entire contents of which are incorporated herein by reference.
Number | Date | Country | |
---|---|---|---|
62001341 | May 2014 | US |