GB2408608A - Cyclic Redundancy Checks - Google Patents

Cyclic Redundancy Checks Download PDF

Info

Publication number
GB2408608A
GB2408608A GB0504442A GB0504442A GB2408608A GB 2408608 A GB2408608 A GB 2408608A GB 0504442 A GB0504442 A GB 0504442A GB 0504442 A GB0504442 A GB 0504442A GB 2408608 A GB2408608 A GB 2408608A
Authority
GB
United Kingdom
Prior art keywords
crc
message
sub
bit
polynomial
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
GB0504442A
Other versions
GB2408608B (en
GB0504442D0 (en
Inventor
Vicente V Cavanna
Patricia A Thaler
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Agilent Technologies Inc
Original Assignee
Agilent Technologies Inc
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Priority claimed from US10/080,886 external-priority patent/US6904558B2/en
Application filed by Agilent Technologies Inc filed Critical Agilent Technologies Inc
Publication of GB0504442D0 publication Critical patent/GB0504442D0/en
Publication of GB2408608A publication Critical patent/GB2408608A/en
Application granted granted Critical
Publication of GB2408608B publication Critical patent/GB2408608B/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Classifications

    • HELECTRICITY
    • H03ELECTRONIC CIRCUITRY
    • H03MCODING; DECODING; CODE CONVERSION IN GENERAL
    • H03M13/00Coding, decoding or code conversion, for error detection or error correction; Coding theory basic assumptions; Coding bounds; Error probability evaluation methods; Channel models; Simulation or testing of codes
    • H03M13/03Error detection or forward error correction by redundancy in data representation, i.e. code words containing more digits than the source words
    • H03M13/05Error detection or forward error correction by redundancy in data representation, i.e. code words containing more digits than the source words using block codes, i.e. a predetermined number of check bits joined to a predetermined number of information bits
    • H03M13/09Error detection only, e.g. using cyclic redundancy check [CRC] codes or single parity bit
    • H03M13/091Parallel or block-wise CRC computation

Landscapes

  • Engineering & Computer Science (AREA)
  • Computing Systems (AREA)
  • Physics & Mathematics (AREA)
  • Probability & Statistics with Applications (AREA)
  • Theoretical Computer Science (AREA)
  • Error Detection And Correction (AREA)
  • Detection And Correction Of Errors (AREA)

Abstract

Methods for adjusting an m-bit CRC of sub-messages enable the computation of the CRC of a message by XORing the partial or incremental CRCs of composite sub-messages corresponding to the sub-messages. The partial m-bit CRC of a sub-message is calculated according to CRC generating polynomial, P(x). A variable Y is calculated using a lookup table, where Y = x<n> modulo P(x). The partial rn-bit CRC and Y are multiplied together and divided by P(x). The remainder of the division forms the adjusted m-bit CRC.

Description

Cyclic Redundancy Checks This invention pertains generally to error
detection and mor particularly to a method of accumulating cyclic reduida icy clocks of sub- messages regardless of arrival carder. In particular it relates to method i:'r coinputing the CRC of a message I1Om the inctcmental CRCs cuff composite I O st.b-riessages.
Coding systems using cyclic redundancy check (CRC) techniques ale readily implemented yet provide powerful error detection capabilities. Accordingly, CRC techniques are widely used in, for example, disk controllers, bltemet protocols such as such as IF and iSCSI, and other networking protocols including ethernet. the CRC technique, a block of d data bits denoted as a flame is joined with an extra block of m bits called the frame check sequence (FCS). Just like a checksum such as a parity bit, the FCS introduces redundancy into the transmitted (d + m) bit codeword that permits the receiver to detect errors. All the bits are treated as binary coefficients of polynomials. A receiver will detect errors in the received (d + m) bit codeword by dividing (using polynomial arithmetic) the codeword with a generator polynomial. If the remainder from this division is zero, a CRC-enabled receiver will assume that the transmitted codeword contains no errors.
As discussed above, certain Internet protocols require CRC coding to provide error detection. In these protocols, data may be packetized or divided into sub- messages for transmission. For example, an iSCSI data word may be protected with its CRC FCS and transmitted via multiple IP packets (which may be denoted as sub messages) that may arrive in any order. The CRC coding of the PCS, however, is based on the original data word and not the UP packets/sub-messages. Conventionally, a receiver may perform a CRC calculation on the resulting sub-messages in one of two approaches. In a first approach to perform the CRC division/calculation, a conventional receiver could accumulate the sub-messages to reconstruct the message and divide the message by the generator polynomial. If the remainder from this division is zero, the message is assunred to be error free. Because the CRC division is perfonned after all the sub-messages have been received, there is extra latency I O causing undesirable delay. In addition, the receiver must have read access to the memory storing the accumulated sub-messages. Even if such memory access is practical, the extra loading on the memory bus further Impacts system performance.
Altemativcly, in a second approach to perform the CRC calculation, a receiver could compute the CRC remainder by performing a ARC division on each sub message as it anives ilk order using a CRC computation engine. In sequence processing of the sub-messages is required to ensure that the CRC computation engine has the proper initial state. The processed submessages could then be delivered to a remote memory not accessible to the CRC computation engine, eliminating the loading on the memory bus suffered by the previous approach. However, because the second approach requires in sequence delivery of the sub-messages, it cannot be applied where support of out of order sub-message delivery is required or desired.
Accordingly, there is a need in the art for a CRC computation technique that calculates the CRC of sub-messages regardless of arrival order.
In accordance with one aspect of the invention, a method for adjusting a partial m-bit CRC is presented. IN this method, a message is divided into a plurality of sub-messages. Each sub-illessage forms a composite submessage which has S zeroes in place of the data contained in the remaining sub-messages. The message thus equals the modulo-2 summation of the composite sub-messages. The partial m- bit CRC is formed by processing a sub-message in a CRC computation engine. The CRC computation engine uses either a primitive polynomial or an irreducible polynomial as the CRC generating polynomial. The resulting partial m-bit CRC is stored in a m-bit memory location.
With respect to the sub-message, the composite sub-message will have n trailing zeroes, wherein n is Heater than or equal to zero and less than the number of bits in the original message 'Ihe partial m-bit CRC may be adjusted with respect to the n trailing zeroes. These n trailing zeroes may be represented by:N, where N = n IS module (2m _ 1). In Marty protocols, the maximum message size is less than 2n'-- I, in which case N = n.
A mclllod is used to accelerate the computation of the adjusted CRC for the composite sub-message. 1 he method can be used for any CRC. The CRC for the message is obtained by taking tile modulo-2 summation of the 2(. C'RCs for the composite sub-messages. _ r s
A message is divided into a plurality of sub-messages, wherein each submessage corresponds to a composite sub-nessage having n trailing zeroes as discussed above. The partial m-bit CRC o f a sub-message is calculated according to a CRC generating polynomial - P(x), wherein the generating polynomial P(x) does not have to be primitive or irreducible. 'I'o calculate the adjusted m-bit CRC o.;the sub-message, the method includes an act of computing a value Y = x' module P(x) using a lookup table. The partial m-bit CRC and Y are field multiplied together and the result field divided by P(x). lThe remainder of the division forms the adjusted partial m-bit CRC.
Lyle following description and figures disclose other aspects and advantages o the present invention.
The various aspects and features of the present invention may be beKer understood by examining the following figures, in which: Figure l is a graphical representation of a message divided into sub-messages r and the composite sub-message corresponding to one of the sub-messages.
Figure 2 is a logical representation of a circuit for performing the field squaring of a 4-tuple binary number according to a generating polynomial.
Figure 3 illustrates a feedback shift register for performing the field squaring shown in Figure 2.
Figure 4 illustrates a feedback shift register used as a CRC computation engine.
Figure 5 illustrates the feedback shift register of Figure 4 during the stage when it processes the n trailing zeroes.
I O Figure 6 is a flow chart for a method or adjusting a CRC'.
Figure 7 illustrates a feedback shift register for simultaneously field squaring and stepping a state.
Figure 8 illustrates a state machine having four modes of operation TV adjusting a partial CRC.
Figure pa is a flow chart for a method of adjusting a CRC according to one embodiment of the invention.
Figure 9b is a flow chart for a table tookup technique for the method of Figure 9a.
DETAILED DESCRIPTION
Figure I illustrates a (d + m) bit binary message 10. Message 10 may be arbitrarily divided into chunks of bits denoted as sub-messages 12, 14, and 16.
Message I O can be expressed as the modulo-2 summation of the submessages.
However, each sub-message must be modified with zeroes in place of the data from e the remaining sub-messages. For example, consider sub-message 14. To be used in a modulo-2 summation to fonn message l O. sub-message 14 must be modeled as composite sub-message 18. As can be seen, composite sub-message 18 has zeroes 20 in place of the data from sub-messages 12 and 16. When modeled in this fashion, each composite sub-message will have the same length (number of bits) as the original message l O. Because the CRC calculation is a linear transformation, the CRC of message l O is a sum of the CRC of the composite sub-messages. If a conventional serial CRC computation engine is used to calculate the CRC of a composite sub-message, the I O leading zeroes may be ignored if the initial state of the CRC computation engine is zero. In such a case, to beam calculation of the CKC for a composite sub-message, the computation engine may bean by calculating the CRC of the corresponding sub- message. However, the resulting CRC of the sub-message must be adjusted to tome the CRC of the composite sub-message. As used herein, the CRC of a composite sub 1S message will be denoted as a partial or incremental CRC. The required adjustment Play be made by continuing to cycle the computation engine with no further input for as many clock cycles n as there are trailing zeroes.
P lie CRC of a sub-message corresponding to a composite sub-message having n trailing zeroes may be adjusted in log n clock cycles to form the partial or incremental CRC. 1 hese incremental CRCs can then be modulo-2 summed (equivalent to exclusive ORing) in any order to form the CRC for the original message.
To understand the method, certain coding concepts that are well known to one of ordinary skill in the art must be appreciated. For example, a field is a set of elements upon which two binary operations are defined. These binary operations may be referred to as "addition" and "multiplication." However, to prevent confusion with the usual binary operations of addition and multiplication, these field binary operations may be referred to as "field addition" and "field multiplication" using the symbols "+" and "*," respectively. In addition to other requirements, the result of either binary operation between two field elements must be equal to another element within the field. A field with a finite number of elements is of particular interest and is referred to as a "Galois field." The simplest Galois field is the set of binary numbers { 1, 0}, which is denoted as GF(2). In this case, the field addition and field multiplication binary operations are the familiar modulo-2 addition and modulo-2 multiplication. Using GF(2), coding theorists may construct extension Galois fields having 2n' elements denoted as GF(2). To begin such a construction, consider a polynomial with a single variable x whose coefficicuts are from GP(2). As used herein, "polynomial" will refer only to polyr,omials having coefficients from C'F(2). A polynomial with one variable K whose largest power of x with a nonzero coefficient is m is said to be of degree m.
For example the polynomial P(x) = X4 X I iS of degree 4. As will be explained farther herein, two types of polynomials are of particular importance for the optimal method: irreducible and primitive. An irreducible polynomial P(x) of degree m is not divisible by any polynomial of degree smaller than m but greater than zero. A primitive polynomial P(x) is an irreducible polynomial wherein the smallest possible integer n in which P(x) divides the polynomial xn + l is n = 2m _ 1.
A primitive polynomial of degree m can be used to generate the elements of a Galois field GF(2m). For example, consider the primitive polynomial P(x) = 1 + x + X4. The degree of this polynomial is 4 so it may be represented by a 4 bit binary number (4-tuple representation). In general, a primitive polynomial of degree m can be used to generate 2m 1 unique states (ignoring the trivial all-zero state). Each state may have either a polynomial or m-hple representation. It is customary to use the element instead of x in the following discussion. Each polynomial may also be represented by a power of a (power representation) as will be explained further herein. The four simplest polynomials would simply be l, a, a 2, and a3, respectively.
These polynomials would correspond to a 4-toyle form (most significant bit first) as 0001, 0010, 0100, and 1000, respectively. The power representation corresponds directly to an, at, a 2, and a3, respectively. Further powers of a may be developed by equaling the generating polynomial P(a) = ] + a 4 to zero. This leads to the recursive formula a 4 = 1 By continuing to multiply by a and apply the recursive formula, the powers of a may be derived as given by the following table.
['able 1.
Power Representation Polynomial Representation Binary (4-tuple Representation) O 0 0000 To ad 0001 a I. Cl 0010 a2 a2 0 1 00 a3 a3 1000 a4 a+a 0011 aS a2+a 0110 Ad a31.a2 1100 a7 a3+a+a 1011 B a2+a0 010] ! , a 9 U3 + a 1010 lo a2-t a+ 0111 a3+a2 +a 1110 at2 a3+at;Z +tI+a till al3 a3+a2 +a (114 rl3+a 1001 Examination of Table 1 shows that the various elements of this Galois field may be considered as states in a finite state machine. For example, if the stat machine is in state O I 10 (a 5), the next state would be 1 100 (a 6), For a given state, the next state is achieved by multiplying by a.
Another concept is that of finite field squaring an element within the Galois field GF(2n') generated by a polynomial P(x). As an example, consider again the generating (and primitive) polynomial:P(cr) = I + a 4.
If one of the polynomial elements in the resulting Galois field GF(2n') (represented as b3a3 + b2a 2 + bra + be) is finite field squared, it can be shown that the result is by 6 + b2a 4 bra 2 bo. By using the recursion relationship a 4 = a l, the result becomes b3a3 (bit + b3)a2 + b2ct + (be + b2). Thus, given an. arbitrary 4-tuple element [b3, b2, be, boJ from Table l, it will be finite field squared by the circuit 24 shown in Figure 2 to produce the sextuple element tc3, c2, cat, cO]. Because addition modulo-2 is equivalent to exclusive Opting, the modulo-2 addition of coefficients be, b3, be, and b2 is perfonned by XOR gates 26. Note that, in general, for a generating polynomial P(x) of degree m, finite field squaring an m-tuple binary number is equivalent to multiplying module P(x) the m-tuple binary number by itself.
Turning now to Figure 3, a shift register 30 is shown for implementing the field squaring of a 4-tuple binary number, wherein the field is generated by the polynomial P(x) = X4 + X 1. Each stage 31 is a D-type flip-flop. Stages 31 store the 4 bits of the resulting 4-tuple binary number. Because this 4-tuple number may be construed as a polynomial, stages 31 are labelled accordingly Dom the term x to the term X3. The contents of each stage 31 may then be construed as the coefficient of the corresponding polynomial factor. These coefficients may be denoted as a 4-bit vector Y(n) - [ye, ye, y2, y33, where y3 through Yu correspond to the contents of stages 31 X3 through x , respectively. Vector Y(n) may also be considered as the state of shiPr register 30. Each time stages 31 are clocked, the 4-tuple binary number is field squared. XOR gates 26 provide the same function as in Figure 2. Comparing shift register 30 of Figure 3 to the squaring transformation illustrated in Figure 2 illustrates the identity. For example, yO(n 1) = yO(n) A y2(n), where A represents the XOR operation. The next state Y(n i- 1) of register 30 is derived Dom Y(n). This next state 1.S is given by the expression Y(n + 1) = S Y(n), where S is the squaring matrix given by -1 0] O O 0 1' 0 5= 0 1 0 1 O O 0 1 Each row of the squaring matrix may be derived from examination of shin register 30. For example, from shift register 30 it can be seen that y'(n + 1) = y2(n).
Thus, y'(n + 1) = [O010] [ye (n) ye (n) Y2 (n) y3 (n) ]T, where T stands for the transpose operation.
With these concepts in mind, the method may be discussed further. This method uses a conventional CRC computation engine to calculate the partial CRC of a composite sub-message. As is well known, such CRC computation engines may be implemented in either hardware or software, in either a serial or parallel configuration. Turning now to Figure 4, a hardware implementation is illustrated using a feedback shin register 32 to calculate the CRC using the generating polynomial P(x) = X4 X 1. Each stage 31 is a D-type Qip-flop. As discussed with respect to Figure 3, the contents of each stage (or equivalently, the state of register 32) corresponds to a vector Y(n). Because this is the same generating polynomial as discussed above, the bits stored in the stages 31 of shift register 32 will correspond to the 4-tuple representation discussed with respect to the table 1. The bitstream carrying the sub-message is clocked in one bit at a time into the shift register 32 at the input, din. An XOR gate 36 receives this input and the Q output of stage 31 for bit y3(n) to form the D input for stage 31 holding bit yO(n). Sirulally, another NOR gate 36 receives the Q output of stage 3 I for bit yO(n) as well as the Q output of stage 31 for bit y3(n) to form the D input for stage 31 for bit y(n).
During the CRC calculation stage, a switch 33 couples to feedback path 34 to maintain the required feedback. At each clock cycle, the 4-tuple binary number represented by the contents of the stages 31 advances to the next state of the Galois field defined by the generating polynomial P(x), as discussed with respect to Table 1.
Note that with respect to the received sub-message, the composite submessage has n trailing zeroes as discussed with respect to Figure 1. Should the ship register 32 be used without implementing the CRC computation technique of the present invention, switch 33 would be maintained in this position for these n additional clock cycles ]2 although no further data would enter at input din. After these n clock cycles, switch 33 couples to output dour so that the CRC may be read out.
Because switch 33 remains coupled to feedback path 34 and no data enters input din during this time, feedback shift register 32 may be represented by the feedback shift register 40 of Figure 5 during these n clock cycles. Here, stages 31 store the 4 bits y3(n) through yO(n) defining vector Y(n) as discussed for shift register of Figure 4. Because the input din of Figure 4 is always zero as the n trailing zeroes are processed, the XOR gate 36 at the input to stage 31 holding bit yO(n) is absent The bits y3(n) through yO(n) stored in stages 31 represent one of the elements of the Galois field generated by P(x) as set forth in Table 1. By defining y3(n) through yO(n), shift register 40 forms a finite state machine whose present state (corresponding to the current clock cycle and denoted as the 4-bit vector Y(n)) is given by the current value of these bits The next state Y(n +1) of shift register 40 (corresponding to the next clock cycle) is computed from the present state Y(n) by the linear relationship Y(n 1) = A Y(n), where A is the state transition matrix and arithmetic is done modulo-2 (i.e. addition is an XOR operation). The columns of state transition matrix A are the binary representation of the states (in their power representation): a, a2, a3, and a4. Thus, the state transition matrix A for this particular generating polynomial is as follows: O O 0 1 A= 1 0 0 1 0 1 0 0 l O 0 1 0 Note that once the sub-message has been processed in shift register 32 of Figure 4 (i.e., all the bits of the sub-message have been clocked into this register) shift register 32 must advance n states to adjust the CRC so that a partial CRC for the corresponding composite sub-message may be determined. Before this adjustment, stages 31 of shift register 32 store the unadjusted CRC for the sub-message. Rather than wait through n clock cycles, the following steps of the optimal method will adjust the CRC' of the sub-message in as little as log(n) clock cycles.
Because shift register 32 has only 15 states, even if the number n of trailing zeroes exceeds 15, the actual number of states N that shift register 32 must be advanced is n Nodule 15 Thus, n may be expressed as a 4-tuple number N. where N = module (2m-1) of n (or n mod (2'n-1)). As a hrst step, each bit of N is examined, starting with the most significant bit. For each examined bit of N. whether O or 1, the contents of the shift register 32 are field squared using the shift register 30 discussed with respect to Figure 3. In addition; far each examined bit that equals 1, the contents of the shift register 32 are advanced one state. When all bits of N have been examined, the CRC of the sub-message will have been adjusted to form the partial CRC of the corresponding composite sub-message.
A flowchart for the method is illustrated in Figure 6. As a first step in the method, the sub-message m-bit CRC is calculated and stored in an mbit memory location at step 41. The corresponding composite sub-message will have n trailing zeroes. At step 42, each bit of N - n mod (2m-1) is examined in order from the most significant bit to the least significant bit. For each examined bit of N at step 43, the contents of the m-bit memory location are field squared. Finally, if the examined bit of N equals one at step 44, the contents of the m-bit memory location are advanced to the next state as determined by the Galois field defined by the CRC generating polynomial. Should bits of N remain unexamined, steps 43 and 44 repeat until all bits are examined. it
Note that the preceding method may take up to two clock cycles for each bit of N (one clock cycle for the field squaring and potentially one more clock cycle for the advancing step should the examined bit of N equal one) . By pre-combining the squaring and stepping matrices S and A, it is possible to perform both transformations (squaring and stepping) in a single clock cycle. The one state advance must be performed after the squaring such that a new matrix B - A S is required.. Given an m- tuple CRC at clock cycle n represented by the vector Y(n), the m-tuple CRC at clock cycle n + 1 represented by Y(n 1) would be given by the linear relationship Y(n + 1) = E3 Y(n). With the matrices A and S being as described above, the B matrix for the generating polynomial:P(x) - X4 + X + 1 iS as follows: - ooo l-1 B= I O I 1 O 0 1 0 l 0 1 0 16 Tuming now to Figure 7, a shift register 45 for performing the combined field squaring and stepping in one clock cycle is illustrated. Stages 31 store the CRC bits, which will be adjusted in one clock cycle. PLS discussed with respect to Figure 5, the stored bits may be considered to form a vector Y(n) = [yO(n) y'(n) y'(n) y(n)]. A comparison of shift register 45 with matrix B illustrates how shift register 45 performs the combined field squaring and stepping. For example, matrix B indicates that bit y(n. +1) equals the modulo-2 addition of bits yO(n), y2(n), and y3(n). Thus, shift register 45 has an XOR gate 47 at the input to stage 31 labelled x', where XOR gate 47 receives the outputs from stages 31 storing bits yO(n), y:(n), and y(n) .
Turning now to Figure 8, a state machine 100 for performing an m-bit CRC adjustment will thus have four modes of operation determined by bits M' and Me. r I,
The CRC generating polynomial for state machine 100 is as discussed with respect to Figures 2 through 5. Although this generating polynomial is used as an example, it will be appreciated that state machine lOO may be generalized to correspond to whatever generating polynomial is desired. Dtype flip-flops 31 store the CHIC bits corresponding to the polynomial representation X3 through A. These bits are defined with respect to clock cycles controlling each register 31. Thus, the Q output of a register 31 will correspond to the nth clock cycle whereas the D input of a register 31 will correspond to the Q output at the (n 1)th clock cycle. Bits ME and Mo control 4:1 multiplexers 110. Each 4:1 multiplexer provides the I:) input for its register 31.
Each multiplexer 1 lO has four inputs, numbered from 0 to 3. If ME = 0 and Mo = 0, multiplexers l l (l will select bar the zeroth input. . If ME = 0 and Mo = l, multiplexers 110 will select for the first input. If M' = 1 and Mo = 0, multiplexers 110 will select for the second input. Finally, if ME = 1 and Me = 1, multiplexers 1 10 will select for the third input. Accordingly, the modes are as follows: l5 IN a first mode of state machine 100, it will initialize by receiving the CRC of a sub-message, represented by bits Is, I2, It, and In in order from most significant bit to the least significant bit. By setting bits ME and Mo to zero and zero, respectively, this first mode is selected for by multiplexers 110. In a second mode, it will field-square the m bits stored by the state machine that represent the current state. By setting bits ME and Mo to zero and one, respectively, this second mode is selected for by multiplexers 110. In a third mode, the state machine will advance its stored bits representing the current state to the next state. By setting bits M' and Mo to one and zero, respectively, this third mode is selected for by multiplexers 110. Finally, in a fourth mode, the state machine will both f eld square and advance to the next state its stored bits representing the current state. By setting bits M' and Mo to one and one, respectively, this fourth mode is selected for by multiplexers 110. Advantageously, the complexity of the field squaring operation (which is basically a field multiplier with both operands the same) is equivalent to the stepping transformation. This equivalent complexity is a result of the module P(x) and module 2 arithmetic. : contrast, a general binary multiplier is much more complex.
Note that the optimal method for adjusting a partial CRC is similar to a prior art algorithm of performing exponentiation of integers using a single accumulator.
This algorithm is as follows Suppose we want to compute n The accumulator is initialized with 1 and the binary representation of the exponent n is inspected, in order from most significant bit (msb) first. For every bit of n, the current contents of the accumulator are squared. For every bit of n that equals I, the accumulator is multiplied by after the squaring. After inspecting all bits of n, the accumulator will hold,B n, For example, suppose we want to raise,B to the power n =5. Table 2 below shows how the accumulator is initialized to I and how its contents are transformed at each step as the bits of n are inspected. After the last step, the accumulator contains p5(16$ p4* I)as expected. Me reason the algorirn works is that, if we decompose the exponent into its powers of two, we can write the desired result, ,B i, as,B + 13' and, by introducing as a new factor whenever n has a I, that,B factor (and all others) will undergo the correct number of squarings.
Table 2.
__
Contents of the After Accumulator in terms of clock # factors -1 z - . O (msb) 1 1 (Isb) _ | 4 Note that this algorithm works only if the initial accumulator state is 1. As such, it is not directly applicable to the problem of adjusting a CRC, which will start from an arbitrary state.
As described above, a primitive polynomial of degree m has 2m 1 unique states (excluding the trivial case of all zeroes). Given a current state of a CRC computation engine programmed with a primitive polynomial, the next state is uniquely defined. Accordingly, such a CRC engine may be advanced to the next state during implementation ot the method. However, CRC computation engines programmed with an irreducible polynomial may also implement the optimal method of the present invention. For example, consider the irreducible polynomial given by P(X) = X4 -it X3 X2 "t X t 1. Ibis polynomial will have the recursion relationship: X4 = X3 t X2 it X + ], which may be used to derive all of its states as given by the following
Table 3.
Table 3
Power Representation Polynomial Representation Binary ( one of several possible 4-tuple representations) a o x 0001 a X 0010 a2 x2 0100 a 3 X3 1000 U4 x3+X2+Xl+.xo 1111 Ct 5 XO 0001 a6 X 0010 a 7 x2 0100 a 8 X3 1000 x3+X2 X7.-xo 1111 a lo x 0001 u " x' 0010 a'2 x2 0100 Ct 13 X3 1000 X3 + X2 A- X} -- XO 1 1 1 1 Note that instead of 15 unique states (compared to a primitive polynomial of degree 4), there are only 5 unique states. However, because the number of unique states is a factor of 15, a CRC computation engine programmed with such an irreducible polynomial may be advanced to the next state as required by the optimal method. For example, consider the state given by the 4-tuple representation L l 000].
Regardless of whether we designate this state as as, a 8, or a 13, the next state is uniquely given by [11112.
In the more general case, where the CRC generating polynomial is neither primitive nor irreducible, the optimal nnethod will not work because for certain states, the following state will not be uniquely determined. Because a CRC computation engine could not be advanced to the next state for these states, the method would break down. However, the method willwork even in this general case if the initial starting state of the CRC computation engine is equal or congruent to one.
One embodiment of the invention provides a method for CRC adjustment that will always work regardless of the forth of the generating polynomial (i.e., regardless of whether the generating polynomial is primitive or irreducible). As used herein, this method refill be referred to as the "general method." Compared to the above-described method, the general ethocl is slower. I-lowever, the general netlod is much foster at ad jousting a C1tC than present known methods and shares most ol the advantages of the above-described method.
The general method uses a well-known relationship from modular arithmetic that (any) mod m = (x mod m * y mod m) mod m where x, y and m are integers. 'This relationship also holds when x, y and m are polynomials. Computing the CRC of a nessage polynomial can be described mathematically as computing the residue of the message polynomial modulo the (:E(C polynomial. For simplicity we will ignore the fact that normally the message is pre-mu]tiplied by xnn to make room for the m-bit
CRC
A composite sub-message polynomial can be expressed as the product of the sub-message polynomial and x" (the polynomial representing the bit stream of I followed by n zeroes) where n is the number of trailing zeroes. The above-mentioned mathematical relationship am module arithmetic may be used to compute Ale adjusted partial CRC or xn A(x)Jmod P(x) where n is the number of trailing zeroes, P(x) is the generating polynomial, and A(x) is the sub-message polynomial. Using the above relationship we can say that the above is equa] to [x" mod P(x) A(x)mod P(X)]mod P(X).
Turning now to Figure 9a, a flowchart summarizing the general method is illustrated. At step 50, the general method computes A(x) mod P(x), the CRC of a sub-message without trailing zeroes (i.e. without regard to position). At step 51, compute xn mod P(x) using a single lookup table. This step could be done in parallel with step I. Finally, at step 52, combine the results from steps I and 2 by field multiplying together and field dividing by P(x). The remainderproduces the adjusted CRC.
The table lookup performed in step 51 may be performed by factoring x" into powers of two and then multiplying. For example, X27 = X 6 X8 X2 X i, resulting in an initial table lookup for xi6mod P(x3, Mood P(x), Mood P(x), and x mod P(x) and then multiplying together the looked up results. Turning now to Figure 9b, this specific table lookup method is illustrated. In step 51 a, n is factored into powers of 2.
hi step 51b, each factor is table-looked up d then multiplied together. This factoring of n ninimizes the size of the required lookup table. Note that when n is smaller than the degree of P(x) there is no need for the table lockup and, because the polynomial has a single term, multiplication consists of simply shifting left.
The general method may use a circuit that still field multiply two shor, (same iS size as the CRC) polynomials together end will simultaneously field divide byP(x) since we just want the remainder. The field division by P(x) may be performed by a standard CRC computation engine. However, the nultiplication requires mor computation power than the abovelescribed method lor large CRCs. Also, the general method requires a lookup table. Should the exponent n be factored into powers of 2, then processing message sizes of 2n bits with the general method requires a look-up table with n entries. Each entry is the same size as the CRC. For instance, a message size of 16 K bytes with a 32 bit CRC would require a table of at most 17 32-bit entries.
'I'hc present invention provides faster CRC computation than that provided by the prior art. Moreover, present CRC computation techniques implemented in software use a hardware offload computation engine that receives the entire message. Using the present invention, the message could be divided into several sub-messages, where each sub-message is processed by its own CRC computation engine working in parallel with the other engines. The adjusted CRCs of the sub-messages could then be put together using either hardware or software to compute the message CRC. In this fashion, the CRC computation could be parallelised.
In addition, pre-computation of fixed fields or the invariant parts of a message could be implemented to speed CRC computation time with the present invention, For example, a large binary word may be hashed into a smaller word of fixed size that can be used to index a table directly. In a hash table lookup, a large binary word is related to an entry in a table but the size of the binary word is too large for the binary word to be used directly as an index to the table. The present invention permits pre computing part of the hash if some portion of the large binary word is known beforehand.
The invention may also be applied in routing or switching application, when changing address or other fields in a message and recomputing a CRC. When a router or switch changes values of some field in a packet, adjusting the CRC using the present invention takes significantly less time than computing a new CRC for the whole message. Furthermore, by computing an adjustment to the CRC rather than computing a new CRC, the packet continues to be protected against errors while in the router or switch. If a new CRC was computed and an error occurred in the switch/router between checking the original CRC and computing the new CRC, the packet would have a good CRC despite having been corrupted by an error. If the i invention is used with respect to changes to fields in a packet, the CRC adjustment is calculated based on the bits that have been changed. In other words, the CRC adjustment is based on the XOR of the new and old field values. Alternatively, a CRC adjustment is subtracted from the old treld values and a CRC adjustment is
added for the new field values.
Other applications of the invention include signature analysis for hardware Cult detection, computation of syndromes in error correction techniques, and quickly skipping over n states of a circuit that generates some sequence of all elements from a Galois field. In addition, the invention may be used to determine if a polynomial is primitive. Conventional techniques for determining whether a polynomial is primitive involve initializing a CRC register to a value and then cycling through all states to determine if the polynomial is maximal length. The number of operations o f such a technique is proportional to the cycle length, which grows quickly with polynomial order. In contrast, should the calculation be performed according to the present invention, the number of operations would be proportional to the cycle length Thus, while specific examples of the present invention have been shown by way of example in the drawings and are herein described in detail, it is to be understood, however, that the invention is not to be limited to the particular forms or methods disclosed, but to the contrary, the invention is to broadly cover all modifications, equivalents, and alternatives encompassed by the scope of the appended claims.

Claims (2)

1 A method for adjusting an m-bit CRC of a sub-message, the sub-message corresponding to a composite sub-message having n trailing zeroes, wherein the CRC generating polynomial is P(x), comprising: (a) computing Y = xn mod P(x) using a lookup table; (b) field multiplying the partial m-bit CRC and Y together; and (c) field dividing the result from act (b) by P(x), wherein the remainder forms the adjusted partial m-bit CRC..
2. The method of claim 1, wherein act (a) comprises: (d) factoring x" into powers of two; (e) computing the modulus P(x) of each factor from act (d) using a lookup
table, and
If) computing Y by field multiplying together the results from act (e).
3 The method of claim 2, wherein P(x) represents a 32 bit number and the lookup table is no larger than 17 32-bit entries. 1,
4 A method for adjusting an m-bit CRC of a sub-message, the sub-message corresponding to a composite sub-message having n trailing zeroes, wherein the CRC generating polynomial is P(x) and n is less than m, comprising: (a) computing Y --- an mod P(x) by setting Y - xn; (b) field multiplying the partial m-bit CRC and Y together by shining the partial bit CRC to the left by n bits; and (c) field dividing the result from act (b) by P(x), wherein the remainder forms the adjusted partial m-bit CRC.
GB0504442A 2002-02-22 2003-02-18 Cyclic redundancy checks Expired - Fee Related GB2408608B (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
US10/080,886 US6904558B2 (en) 2002-02-22 2002-02-22 Methods for computing the CRC of a message from the incremental CRCs of composite sub-messages
GB0303743A GB2388683B (en) 2002-02-22 2003-02-18 Cyclic redundancy checks

Publications (3)

Publication Number Publication Date
GB0504442D0 GB0504442D0 (en) 2005-04-06
GB2408608A true GB2408608A (en) 2005-06-01
GB2408608B GB2408608B (en) 2005-08-10

Family

ID=34575738

Family Applications (1)

Application Number Title Priority Date Filing Date
GB0504442A Expired - Fee Related GB2408608B (en) 2002-02-22 2003-02-18 Cyclic redundancy checks

Country Status (1)

Country Link
GB (1) GB2408608B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999037030A1 (en) * 1998-01-20 1999-07-22 3Com Corporation High-speed calculation of cyclical redundancy check sums

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO1999037030A1 (en) * 1998-01-20 1999-07-22 3Com Corporation High-speed calculation of cyclical redundancy check sums

Also Published As

Publication number Publication date
GB2408608B (en) 2005-08-10
GB0504442D0 (en) 2005-04-06

Similar Documents

Publication Publication Date Title
US6904558B2 (en) Methods for computing the CRC of a message from the incremental CRCs of composite sub-messages
US7458006B2 (en) Methods for computing the CRC of a message from the incremental CRCs of composite sub-messages
US4873688A (en) High-speed real-time Reed-Solomon decoder
JP3970337B2 (en) Hardware-optimized Reed-Solomon decoder for large data blocks
US20030192007A1 (en) Code-programmable field-programmable architecturally-systolic Reed-Solomon BCH error correction decoder integrated circuit and error correction decoding method
US20050010630A1 (en) Method and apparatus for determining a remainder in a polynomial ring
EP0838905B1 (en) Reed-Solomon Decoder
JP5384492B2 (en) Determining message remainder
JP2010507290A (en) Message remainder determination using a set of polynomials.
KR20020047134A (en) Method and apparatus for coding and decoding data
EP0840461A2 (en) Galois field multiplier for Reed-Solomon decoder
US7886214B2 (en) Determining a message residue
US7089276B2 (en) Modular Galois-field subfield-power integrated inverter-multiplier circuit for Galois-field division over GF(256)
US20090158132A1 (en) Determining a message residue
US20020144208A1 (en) Systems and methods for enabling computation of CRC&#39; s N-bit at a time
Ji et al. Fast parallel CRC algorithm and implementation on a configurable processor
US4592054A (en) Decoder with code error correcting function
Kounavis et al. A systematic approach to building high performance software-based CRC generators
US20040078747A1 (en) Generalized forney algorithm circuit
WO1999004332A1 (en) Composite field multiplicative inverse calculation for elliptic curve cryptography
EP1175015B1 (en) Decoding circuit and decoding method thereof
GB2389678A (en) Finite field processor reconfigurable for varying sizes of field.
GB2408608A (en) Cyclic Redundancy Checks
Drescher et al. VLSI architecture for non-sequential inversion over GF (2m) using the euclidean algorithm
Chi et al. Fast software-based table-less algorithm for CRC generation

Legal Events

Date Code Title Description
732E Amendments to the register in respect of changes of name or changes affecting rights (sect. 32/1977)
PCNP Patent ceased through non-payment of renewal fee

Effective date: 20080218