Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Importing Flash and NAND subsystem for NetBSD

On Sun, Feb 13, 2011 at 10:44:45AM -0800, Matt Thomas wrote:
> consider implementing nand_crc16 via a nibble lookup table.

Is it the 'standard' crc16 (x^16 + x^15 + x^2 + 1) ?
There is a trivial xor and shift sequence for it (bytewise) that
will be faster than the byte lookup on anything that can do parallel
execution and/or has a data cache (we assume the 512 byte table isn't
in the cache - so there are cache misses at startup).

For one bit-order it is:

    int x;
    x = ((crc>>8) ^ data) & 0xff;
    x ^= x>>4;
    crc = (crc << 8) ^ (x << 12) ^ (x <<5) ^ x;

I've written this in VDHL as a custom opcode - when all the shifts
and masks are completely free!


David Laight: david%l8s.co.uk@localhost

Home | Main Index | Thread Index | Old Index