1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00
oh/src/common/hdl/oh_crc.v
Andreas Olofsson 2688bc5aa4 Refactoring common library
- Updating interfaces to 2005 style
- Adding license pointers to all files
2016-04-11 12:01:59 -04:00

41 lines
1.3 KiB
Verilog

//#############################################################################
//# Function: CRC combinatorial encoder wrapper #
//#############################################################################
//# Author: Andreas Olofsson #
//# License: MIT (see LICENSE file in OH! repository) #
//#############################################################################
module oh_crc #( parameter TYPE = "ETH", // type: "ETH", "OTHER"
parameter DW = 8) // width of data
(
input [DW-1:0] data_in, // input data
input [CW-1:0] crc_state, // input crc state
output [CW-1:0] crc_next // next crc state
);
localparam CW = 32; // width of polynomial
generate
if(TYPE=="ETH")
begin
if(DW==8)
oh_crc32_8b crc(/*AUTOINST*/
// Outputs
.crc_next (crc_next[31:0]),
// Inputs
.data_in (data_in[7:0]),
.crc_state (crc_state[31:0]));
else if(DW==64)
oh_crc32_64b crc(/*AUTOINST*/
// Outputs
.crc_next (crc_next[31:0]),
// Inputs
.data_in (data_in[63:0]),
.crc_state (crc_state[31:0]));
end // if (TYPE=="ETH")
endgenerate
endmodule // oh_crc