In: Computer Science
This gives the following CRC polynomial (press RETURN to update):
P(x) = x11+ x8+ x7+ x4+ x3+ x1
module CRC_Unit(BITVAL, BITSTRB, CLEAR, CRC);
input BITVAL; // Next input bit
input BITSTRB; // Current bit valid (Clock)
input CLEAR; // Init CRC value
output [10:0] CRC; // Current output CRC value
reg [10:0] CRC; // We need output registers
wire inv;
assign inv = BITVAL ^ CRC[10]; // XOR required?
always @(posedge BITSTRB or posedge CLEAR) begin
if (CLEAR) begin
CRC = 0; // Init before calculation
end
else begin
CRC[10] = CRC[9];
CRC[9] = CRC[8];
CRC[8] = CRC[7] ^ inv;
CRC[7] = CRC[6] ^ inv;
CRC[6] = CRC[5];
CRC[5] = CRC[4];
CRC[4] = CRC[3] ^ inv;
CRC[3] = CRC[2] ^ inv;
CRC[2] = CRC[1];
CRC[1] = CRC[0] ^ inv;
CRC[0] = inv;
end
end
endmodule