Clear Filters
Clear Filters

CRC-32 problem in Simulink

7 views (last 30 days)
Owen
Owen on 1 Nov 2012
Hello,
I have to use CRC-32, but the CRC-N Generator block gives a wrong result. The parameters are following:
CRC method = CRC-32 Initial Status: [0] Checksums per frame = 1
Taking the example from page 123 of this document: http://www.xilinx.com/support/documentation/ip_documentation/gfp_ug152.pdf, the GFP core generates the CRC32 value = 0x568500B2 for data from 0x00 to 0x0F (the most left column), but with “CRC-N Generator” in Simulink I get 0xFC57DD85 for the same input. Of course the generator polynomials are the same.
Could anybody explain it?
Thanks Senmeis

Answers (1)

Owen
Owen on 2 Nov 2012
I think I have found the reason. The CRC-32 which I want to use is according to the following statement:
_The payload FCS is generated using the CRC-32 generating polynomial [ISO/IEC 13239] G(x) = x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x1 + 1, where x32 corresponds to the MSB and x0 corresponds to the LSB.
The payload FCS field is generated using the following steps: 1) The N octets from the GFP payload information field, excluding the FCS are taken in network octet order, most significant bit first, to form a 8N-bit pattern representing the coefficients of a polynomial M'(x) of degree 8N – 1.
2) M'(x) is multiplied by x32, added to the product of x8N and the all-ones polynomial U(x) = 1 + x1 + x2 + ... + x31, and divided (modulo 2) by G(x), producing a remainder R(x) of degree 31 or less.
NOTE – The addition of x8N [1 + x1 + x2 + ... + x31] is equivalent to presetting the shift register to all-ones for typical shift register implementations using presets. Either method is equivalent to complementing the 32 MSBs of the GFP payload information field for the purpose of calculating the FCS.
3) The coefficients of R(x) are considered to be a 32-bit sequence, where x31 is the most significant bit.
4) The complement of this 32-bit sequence is the CRC-32.
The sink adaptation process performs steps 1-3 in the same manner as the source adaptationprocess. In the absence of errors, the remainder shall be 11000111_00000100_11011101_01111011, in the order x31 to x0._
But the action “added to the product of x8N and the all-ones polynomial U(x) = 1 + x1 + x2 + ... + x31” is not provided by the CRC-N Generator block in Simulink, so according to this statement I must “complement the 32 MSBs of the GFP payload information field for the purpose of calculating the FCS” and that works.
But the statement about sink adaptation is not still understood:
“In the absence of errors, the remainder shall be 11000111_00000100_11011101_01111011, in the order x31 to x0.”
The procedure is the same as the generator, why do I get the constant “11000111_00000100_11011101_01111011”?
Thanks Senmeis

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!