PoC.comm.crc
Computes the Cyclic Redundancy Check (CRC) for a data packet as remainder of the polynomial division of the message by the given generator polynomial (GEN).
The computation is unrolled so as to process an arbitrary number of message bits per step. The generated CRC is independent from the chosen processing width.
Entity Declaration:
1use work.utils.all;
2
3
4entity comm_crc is
5 generic (
6 GEN : bit_vector; -- Generator Polynomial
7 BITS : positive; -- Number of Bits to be processed in parallel
8 CHUNK_BITS : positive := BITS; -- Bus width for 'en' port
9
10 STARTUP_RMD : std_logic_vector := "0";
11 OUTPUT_REGS : boolean := true
12 );
13 port (
14 clk : in std_logic; -- Clock
15
16 set : in std_logic; -- Parallel Preload of Remainder
17 init : in std_logic_vector(abs(mssb_idx(GEN)-GEN'right)-1 downto 0); --
18 step : in std_logic; -- Process Input Data (MSB first)
19 cen : in std_logic_vector(CHUNK_BITS-1 downto 0) := (CHUNK_BITS-1 downto 0 => '1'); -- Chunck Enable
20 din : in std_logic_vector(BITS-1 downto 0);