On Thu, 22 Aug 2002, Scott Dattalo wrote: > On Wed, 21 Aug 2002, Tony K|bek wrote: > > > Ok, here we go again. > > This poly (and table that goes with it) was a tad harder to optimize :) > > However there are some small thing that can be done, however there are > > some > > Tony, > > Hint: > > The MSB of the bytes in the high table is the same as the LSB of the bytes > of the low table. > > Challenge: > > This algorithm can be implemented in 24 cycles. > > > The hint and challenge aren't necessarily correlated. Give up, Tony? Okay, it's a few more than 24 cycles. ( Doing it my head I saw 16 plus a little overhead...) CRC_Update: xorwf CRC16_Low,w movwf Temp movf CRC16_High,W movwf CRC16_Low clrw btfsc Temp,0 movlw 0xcc btfsc Temp,1 xorlw 0x8d btfsc Temp,2 xorlw 0x0f btfsc Temp,3 xorlw 0x0a movwf CRC16_High andlw 0xf0 xorwf CRC16_High,f xorwf CRC16_Low,f clrw btfsc CRC16_High,3 movlw 0xcc btfsc Temp,4 xorlw 0xcc btfsc Temp,5 xorlw 0xd8 btfsc Temp,6 xorlw 0xf0 btfsc Temp,7 xorlw 0xa0 xorwf CRC16_High,f movlw 0x01 btfsc CRC16_High,7 xorwf CRC16_Low,f return It's probably clear from the comments how it works. :) Scott -- http://www.piclist.com#nomail Going offline? Don't AutoReply us! email listserv@mitvma.mit.edu with SET PICList DIGEST in the body