> -----Original Message----- > From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On Behalf > Of Scott Dattalo > Sent: 24 February 2010 18:36 > To: Microcontroller discussion list - Public. > Subject: Re: [PIC] Reduce CRC size > > > Not technically a PIC but an ARM Cortex part with a neat built in 32 bit > > CRC calculator. > > Here's a 5 instruction ARM implementation of the CRC-CCITT polynomial x^16 > + x^15 + x^5 + 1: > > ; R0[7:0] = input data, R1[15:0] = input and output crc. > eor R0,R0,R1 LSR 8 ; R0 = t = (crc0 >> 8) ^ data > eor R0,R0,R0 LSR 4 ; R0 = t ^ (t >> 4) > eor R1,R0,R1 LSL 8 ; R1 = (crc0 << 8) ^ t > eor R1,R1,R0 LSL 5 ; R1 = (crc0 << 8) ^ t ^ (t << 5) > eor R1,R1,R0 LSL 12 ; R1 = (crc0 << 8) ^ t ^ (t << 5) ^ (t << 12) > > It's an implementation of > > http://www.dattalo.com/technical/software/pic/crc_1021.asm > > I must admit though, I never did test the ARM implementation. Thanks Scott, that's a very nice implementation. I'll give it a go in the simulator. Mike ======================================================================= This e-mail is intended for the person it is addressed to only. The information contained in it may be confidential and/or protected by law. If you are not the intended recipient of this message, you must not make any use of this information, or copy or show it to any person. Please contact us immediately to tell us that you have received this e-mail, and return the original to us. Any use, forwarding, printing or copying of this message is strictly prohibited. No part of this message can be considered a request for goods or services. ======================================================================= -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist