OpenCores
URL https://opencores.org/ocsvn/w11/w11/trunk

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.7/] [rtl/] [vlib/] [comlib/] [crc16.vhd] - Blame information for rev 40

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 29 wfjm
-- $Id: crc16.vhd 641 2015-02-01 22:12:15Z mueller $
2 27 wfjm
--
3
-- Copyright 2014- by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4
--
5
-- This program is free software; you may redistribute and/or modify it under
6
-- the terms of the GNU General Public License as published by the Free
7
-- Software Foundation, either version 2, or at your option any later version.
8
--
9
-- This program is distributed in the hope that it will be useful, but
10
-- WITHOUT ANY WARRANTY, without even the implied warranty of MERCHANTABILITY
11
-- or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12
-- for complete details.
13
--
14
------------------------------------------------------------------------------
15
-- Module Name:    crc16 - syn
16
-- Description:    16bit CRC generator, use CCITT polynomial
17
--                      x^16 + x^12 + x^5 + 1   (0x1021)
18
--
19
--
20
-- Dependencies:   -
21
-- Test bench:     -
22
-- Target Devices: generic
23 29 wfjm
-- Tool versions:  ise 14.7; viv 2014.4; ghdl 0.31
24 27 wfjm
--
25
-- Synthesized (xst):
26
-- Date         Rev  ise         Target      flop lutl lutm slic t peri
27
-- 2014-09-27   595 14.7  131013 xc6slx16-2    16   16    -    4
28
--
29
-- Revision History: 
30
-- Date         Rev Version  Comment
31
-- 2014-09-27   595   1.0    Initial version 
32
------------------------------------------------------------------------------
33
 
34
library ieee;
35
use ieee.std_logic_1164.all;
36
 
37
use work.slvtypes.all;
38
use work.comlib.all;
39
 
40
entity crc16 is                         -- crc-16 generator, checker
41
  generic (
42
    INIT: slv16 := (others=>'0'));      -- initial state of crc register
43
  port (
44
    CLK : in slbit;                     -- clock
45
    RESET : in slbit;                   -- reset
46
    ENA : in slbit;                     -- update enable
47
    DI : in slv8;                       -- input data
48
    CRC : out slv16                     -- crc code
49
  );
50
end crc16;
51
 
52
 
53
architecture syn of crc16 is
54
  signal R_CRC : slv16 := INIT;         -- state registers
55
begin
56
 
57
  proc_regs: process (CLK)
58
  begin
59
 
60
    if rising_edge(CLK) then
61
      if RESET = '1' then
62
        R_CRC <= INIT;
63
      else
64
        if ENA = '1' then
65
          R_CRC <= crc16_update(R_CRC, DI);
66
        end if;
67
      end if;
68
    end if;
69
 
70
  end process proc_regs;
71
 
72
  CRC <= R_CRC;
73
 
74
end syn;

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.