1
0
mirror of https://github.com/aolofsson/oh.git synced 2025-01-30 02:32:53 +08:00
oh/common/hdl/oh_crc.v

48 lines
1.2 KiB
Coq
Raw Normal View History

2015-12-17 13:50:59 -05:00
module oh_crc (/*AUTOARG*/
// Outputs
2016-02-25 14:40:38 -05:00
crc_state, crc_next,
2015-12-17 13:50:59 -05:00
// Inputs
2016-02-25 14:40:38 -05:00
data_in
2015-12-17 13:50:59 -05:00
);
2016-02-25 14:40:38 -05:00
2015-12-17 13:50:59 -05:00
//###############################################################
//# Interface
//###############################################################
2016-02-25 14:40:38 -05:00
// parameters
parameter TYPE = "ETH"; // type: "ETH", "OTHER"
parameter DW = 8; // width of data
parameter CW = 32; // width of polynomial
// signals
input [DW-1:0] data_in;
output [CW-1:0] crc_state;
output [CW-1:0] crc_next;
//###############################################################
//# BODY
//###############################################################
2016-01-17 21:15:28 -05:00
2016-02-25 14:40:38 -05:00
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
2015-12-17 13:50:59 -05:00
endmodule // oh_crc