Note: This page has been translated by MathWorks. Click here to see

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

(Removed) Generate CRC bits according to CRC method and append to input data frames

CRC sublibrary of Error Detection and Correction

**
CRC-N Generator has been removed. Use General CRC Generator instead.**

The CRC-N Generator block generates cyclic redundancy code (CRC) bits for each input
data frame and appends them to the frame. The input must be a binary column vector. The
CRC-N Generator block is a simplified version of the General CRC Generator block. With the CRC-N Generator block, you can select
the generator polynomial for the CRC algorithm from a list of commonly used polynomials,
given in the **CRC-N method** field in the block's dialog. N is degree
of the generator polynomial. The table below lists the options for the generator
polynomial.

CRC Method | Generator Polynomial | Number of Bits |
---|---|---|

CRC-32 | x^{32}+x^{26}+x^{23}+x^{22}+x^{16}+x^{12}+x^{11}
+x^{10}+x^{8}+x^{7}+x^{5}+x^{4}+x^{2}+x+1 | 32 |

CRC-24 | x^{24}+x^{23}+x^{14}+x^{12}+x^{8}+1 | 24 |

CRC-16 | x^{16}+x^{15}+x^{2}+1 | 16 |

Reversed CRC-16 | x^{16}+x^{14}+x+1 | 16 |

CRC-8 | x^{8}+x^{7}+x^{6}+x^{4}+x^{2}+1 | 8 |

CRC-4 | x^{4}+x^{3}+x^{2}+x+1 | 4 |

You specify the initial state of the internal shift register using the
**Initial states** parameter. You specify the number of checksums
that the block calculates for each input frame using the **Checksums per
frame** parameter. For more detailed information, see the reference page
for the General CRC Generator block.

This block supports `double`

and `boolean`

data
types. The output data type is inherited from the input.

The General CRC Generator block has one input port and one output port. Both ports accept binary column vector input signals.

**CRC-N method**The generator polynomial for the CRC algorithm.

**Initial states**A binary scalar or a binary row vector of length equal to the degree of the generator polynomial, specifying the initial state of the internal shift register.

**Checksums per frame**A positive integer specifying the number of checksums the block calculates for each input frame.

For a description of the CRC algorithm as implemented by this block, see CRC Non-Direct Algorithm in *Communications
Toolbox™ User's Guide*.

The above circuit divides the polynomial $$a(x)={a}_{k-1}{x}^{k-1}+{a}_{k-2}{x}^{k-2}+\cdots +{a}_{1}x+{a}_{0}$$ by $$g(x)={g}_{r-1}{x}^{r-1}+{g}_{r-2}{x}^{r-2}+\cdots +{g}_{1}x+{g}_{0}$$, and returns the remainder $$d(x)={d}_{r-1}{x}^{r-1}+{d}_{r-2}{x}^{r-2}+\cdots +{d}_{1}x+{d}_{0}$$.

The input symbols $$\{{a}_{k-1},{a}_{k-2},\dots ,{a}_{2},{a}_{1},{a}_{0}\}$$ are fed into the shift register one at a time in order of decreasing index. When the last symbol ($${a}_{0}$$) works its way out of the register (achieved by augmenting the message with r zeros), the register contains the coefficients of the remainder polynomial $$d(x)$$.

This remainder polynomial is the checksum that is appended to the original message, which is then transmitted.

[1] Sklar, Bernard, *Digital Communications:
Fundamentals and Applications*. Englewood Cliffs, N.J.,
Prentice-Hall, 1988.

[2] Wicker, Stephen B., *Error Control Systems for
Digital Communication and Storage*, Upper Saddle River, N.J.,
Prentice Hall, 1995.