FPGARelated.com
Forums

crc32 vhdl implementation (4 bit data)

Started by Moti Cohen July 4, 2004
ALuPin wrote:
>>Yes, all CRC's produce a residual - it is a function of the following items: >> >>* The CRC polynomial being used (CRC-16 vs. CRC-CCITT vs. CRC-32, etc) >>* The initial value (sometimes all 1's, but not always) >>* Bit and byte ordering (application dependant) >>* Bit inversion (application dependant: sometimes XOR with all 1's) >> >> > > thank you for your answer. > > I want to use a CRC16 with the polynomial 0XBAAD (paper "Cyclic > Redendany Code > Poynomial Selection for Embedded Networks" Philip Koopman). > > But when I simulate it (VHDL code generated by CRC TOOL) and > initialize it with '1's than I do not get a residual when trying > different data to calculate. > So maybe there has to be used a different initial value. But how do I > get to know which one to use as initial value?
We're pretty far off topic here, but I'll give it one last stab while presenting some links that might be useful for the FPGA crowd... I found a neat tool on the web: http://rcswww.urz.tu-dresden.de/~sr21/crc.html which lets you play with various things. You might be able to feed your simulated data into this tool and see if things match up. Using this tool, I was able to get the residual (MAGIC NUMBER) by clicking "nondirect" then clicking "Convert"... The initial value field will turn into the residual (or bit flipped residue, depending on the CRC implementation). IE, for CRC-32, clicking nondirect and convert results in C704DD7B and CRC-CCITT results in 1D0F. Using the same procedure for Koopman's new polynomial 0xBAAD results in a possible residue of 3BE9 when calculated in the same way a CRC-CCITT (initial value of FFFF with no bit flipping or reversing). Various links to HDL code: http://www-ee.eng.hawaii.edu/~msmith/XCoNET/Demonstation_code.htm http://www.bydzw.com/cpldpage/download/crc32.txt http://www.elecdesign.com/Articles/ArticleID/3961/3961.html Lastly, make sure you are feeding the whole received data block into the CRC checker (including the received CRC). If you can't use the tool above to verify your values, you could use a C program. Good luck, Marc