cyclic codes help

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Sep 2008
Posts: 62
Reputation: AutoC is an unknown quantity at this point 
Solved Threads: 0
AutoC AutoC is offline Offline
Junior Poster in Training

cyclic codes help

 
0
  #1
Nov 15th, 2008
Hi,

I need help with implementing cyclic codes.Its much like crc.I've found a lot of software implementations for crc but havent understood them.I've looked at a crc guide which gave,
  1. So to implement CRC division, we have to feed the message through a
  2. division register. At this point, we have to be absolutely precise
  3. about the message data. In all the following examples the message will
  4. be considered to be a stream of bytes (each of 8 bits) with bit 7 of
  5. each byte being considered to be the most significant bit (MSB). The
  6. bit stream formed from these bytes will be the bit stream with the MSB
  7. (bit 7) of the first byte first, going down to bit 0 of the first
  8. byte, and then the MSB of the second byte and so on.
  9.  
  10. With this in mind, we can sketch an implementation of the CRC
  11. division. For the purposes of example, consider a poly with W=4 and
  12. the poly=10111. Then, the perform the division, we need to use a 4-bit
  13. register:
  14.  
  15. 3 2 1 0 Bits
  16. +---+---+---+---+
  17. Pop! <-- | | | | | <----- Augmented message
  18. +---+---+---+---+
  19.  
  20. 1 0 1 1 1 = The Poly
  21.  
  22. (Reminder: The augmented message is the message followed by W zero bits.)
  23.  
  24. To perform the division perform the following:
  25.  
  26. Load the register with zero bits.
  27. Augment the message by appending W zero bits to the end of it.
  28. While (more message bits)
  29. Begin
  30. Shift the register left by one bit, reading the next bit of the
  31. augmented message into register bit position 0.
  32. If (a 1 bit popped out of the register during step 3)
  33. Register = Register XOR Poly.
  34. End
  35. The register now contains the remainder.

I havent understood how this works.

I've also looked at this algorithm...
  1. unsigned int wombat(unsigned char *data, int len)
  2. {
  3. unsigned int result;
  4. int i,j;
  5. unsigned char octet;
  6.  
  7. result = -1;
  8.  
  9. for (i=0; i<len; i++)
  10. {
  11. octet = *(data++);
  12. for (j=0; j<8; j++)
  13. {
  14. if ((octet >> 7) ^ (result >> 31))
  15. {
  16. result = (result << 1) ^ QUOTIENT;
  17. }
  18. else
  19. {
  20. result = (result << 1);
  21. }
  22. octet <<= 1;
  23. }
  24. }
  25.  
  26. return ~result; /* The complement of the remainder */
  27. }

if someone could give me a basic idea of how this works I'd really appreciate it
Reply With Quote Quick reply to this message  
Join Date: Dec 2006
Posts: 1,089
Reputation: vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all vijayan121 is a name known to all 
Solved Threads: 164
vijayan121 vijayan121 is offline Offline
Veteran Poster
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC