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:

 1  generic (
 2    GEN   : bit_vector;                                 -- Generator Polynomial
 3    BITS  : positive;                                   -- Number of Bits to be processed in parallel
 4
 5    STARTUP_RMD : std_logic_vector  := "0";
 6    OUTPUT_REGS : boolean           := true
 7  );
 8  port (
 9    clk : in  std_logic;                                -- Clock
10
11    set : in  std_logic;                                -- Parallel Preload of Remainder
12    init : in std_logic_vector(abs(mssb_idx(GEN)-GEN'right)-1 downto 0);  --
13    step : in std_logic;                                -- Process Input Data (MSB first)
14    din : in  std_logic_vector(BITS-1 downto 0);        --
15
16    rmd : out std_logic_vector(abs(mssb_idx(GEN)-GEN'right)-1 downto 0);  -- Remainder
17    zero : out std_logic                                -- Remainder is Zero
18  );
19end entity comm_crc;