root/ResearchApps/PHY/MIMO_OFDM/CRC_table_gen.m

Revision 611, 453 bytes (checked in by murphpo, 15 months ago)

test commit

Line 
1function CRC_Table = CRC_table_gen(CRCPolynomial)
2%Calculates table of polynomial remainders for CRC computation
3%Based on the C code example at: http://www.packet.cc/files/CRC32-code.html
4
5crc_accum = 0;
6
7for n=0:255
8        crc_accum = bitshift(n,24,32); %(unsigned long)(i<<24)
9       
10        for m=0:7
11                x = bitshift(crc_accum,1,32);
12                if(crc_accum >= 2^31)
13                        crc_accum = bitxor(x,CRCPolynomial);
14                else
15                        crc_accum = x;
16                end
17        end
18
19        CRC_Table(n+1) = crc_accum;
20end
Note: See TracBrowser for help on using the browser.