//https://stackoverflow.com/questions/17647819/looking-for-a-crc-implementation-in-systemverilog module top; function byte calc_crc(byte unsigned cmd[]); bit [7:0] crc, d, c; int i; crc = 0; for (i=0; i> 1) ^ CRC32POL; end else begin crc32_val >>= 1; end data >>= 1; end end crc32_val ^= 32'hffffffff; //invert results return crc32_val; endfunction : genCRC32 endmodule