/*-----------------------------------------------------------------------------------------------
HotCRC CRC32L_04C11DB7_FFFFFFFF_00000000 FPGA模块 HotPower[url=home.php?mod=space&uid=516618]@163.com[/url] 2023-09-21 12:07:42
-----------------------------------------------------------------------------------------------*/
module CRC32L_04C11DB7(clk, rst, data, outcrc32)
input clk, rst;
input [7:0] data;
output reg[31:0] outcrc32;
reg [31:0] crc32;
task CRC32L_04C11DB7;
inout[31:0] crc32;
input[7:0] indata;
crc32 = {crc32[23:0], 8'h00} ^ CRC32L_04C11DB7_Table(crc32[31:24] ^ indata);
endtask
function [31:0] CRC32L_04C11DB7_Table;
input [7:0] data;
CRC32L_04C11DB7_Table = CRC32L_04C11DB7_Table0(data[1:0]) ^ CRC32L_04C11DB7_Table1(data[3:2]) ^ CRC32L_04C11DB7_Table2(data[5:4]) ^ CRC32L_04C11DB7_Table3(data[7:6]);
endfunction
function [31:0] CRC32L_04C11DB7_Table0;
input[1:0] data;
case(data)
2'b00: CRC32L_04C11DB7_Table0 = 32'h00000000; 2'b01: CRC32L_04C11DB7_Table0 = 32'h04C11DB7; 2'b10: CRC32L_04C11DB7_Table0 = 32'h09823B6E; 2'b11: CRC32L_04C11DB7_Table0 = 32'h0D4326D9;
default: CRC32L_04C11DB7_Table0 = 32'h0000_0000;
endcase
endfunction
function [31:0] CRC32L_04C11DB7_Table1;
input[1:0] data;
case(data)
2'b00: CRC32L_04C11DB7_Table1 = 32'h00000000; 2'b01: CRC32L_04C11DB7_Table1 = 32'h130476DC; 2'b10: CRC32L_04C11DB7_Table1 = 32'h2608EDB8; 2'b11: CRC32L_04C11DB7_Table1 = 32'h350C9B64;
default: CRC32L_04C11DB7_Table1 = 32'h0000_0000;
endcase
endfunction
function [31:0] CRC32L_04C11DB7_Table2;
input[1:0] data;
case(data)
2'b00: CRC32L_04C11DB7_Table2 = 32'h00000000; 2'b01: CRC32L_04C11DB7_Table2 = 32'h4C11DB70; 2'b10: CRC32L_04C11DB7_Table2 = 32'h9823B6E0; 2'b11: CRC32L_04C11DB7_Table2 = 32'hD4326D90;
default: CRC32L_04C11DB7_Table2 = 32'h0000_0000;
endcase
endfunction
function [31:0] CRC32L_04C11DB7_Table3;
input[1:0] data;
case(data)
2'b00: CRC32L_04C11DB7_Table3 = 32'h00000000; 2'b01: CRC32L_04C11DB7_Table3 = 32'h34867077; 2'b10: CRC32L_04C11DB7_Table3 = 32'h690CE0EE; 2'b11: CRC32L_04C11DB7_Table3 = 32'h5D8A9099;
default: CRC32L_04C11DB7_Table3 = 32'h0000_0000;
endcase
endfunction
always [url=home.php?mod=space&uid=72445]@[/url] (posedge clk or negedge rst)
begin
if (!rst)
begin
crc32 <= 32'hFFFFFFFF;
end
else
begin
CRC32L_04C11DB7(crc32, data);
outcrc32 <= crc32;
crc32 <= crc32;
end
end
endmodule
|