ctzof
Full Member level 3

Hallo,
I want to implement a verilog code for SENT protocol CRC checksum. Is a simple CRC-4 with 1101 as polynom and 0101 as initial seed value. My input is 24- bit and the final crc value is determined by the polynom bit-count as 4 bits. I have tried many configurations but until now none works. I have found the following c-code from infineon which is used as recommendation to one of their datasheet for SENT protocol crc calculations. Can anyone help me into transform this code to verilog code.
I want to implement a verilog code for SENT protocol CRC checksum. Is a simple CRC-4 with 1101 as polynom and 0101 as initial seed value. My input is 24- bit and the final crc value is determined by the polynom bit-count as 4 bits. I have tried many configurations but until now none works. I have found the following c-code from infineon which is used as recommendation to one of their datasheet for SENT protocol crc calculations. Can anyone help me into transform this code to verilog code.
// Fast way for any µC with low memory and compute capabilities
char Data[8] = {…}; // contains the input data (status nibble , 6 data nibble , CRC)
// required variables and LUT
char CheckSum, i;
char CrcLookup[16] = {0, 13, 7, 10, 14, 3, 9, 4, 1, 12, 6, 11, 15, 2, 8, 5};
CheckSum= 5; // initialize checksum with seed "0101"
for (i=0; i<7; i++) {
CheckSum = CheckSum ^ Data;
CheckSum = CrcLookup[CheckSum];
}
; // finally check if Data [7] is equal to CheckSum