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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.6/] [rtl/] [vlib/] [comlib/] [crc8.vhd] - Blame information for rev 27

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

Line No. Rev Author Line
1 13 wfjm
-- $Id: crc8.vhd 410 2011-09-18 11:23:09Z mueller $
2 2 wfjm
--
3 12 wfjm
-- Copyright 2007-2011 by Walter F.J. Mueller <W.F.J.Mueller@gsi.de>
4 2 wfjm
--
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:    crc8 - syn
16 13 wfjm
-- Description:    8bit CRC generator, use 'A6' polynomial of Koopman and
17
--                 Chakravarty. Has HD=3 for up to 247 bits and optimal HD=2
18
--                 error detection for longer messages:
19 2 wfjm
--
20 13 wfjm
--                      x^8 + x^6 + x^3 + x^2 + 1   (0xa6)
21 2 wfjm
--
22 13 wfjm
--                 It is irreducible, and can be implemented with <= 37 xor's
23
--                 This polynomial is described in
24
--                   http://dx.doi.org/10.1109%2FDSN.2004.1311885
25
--
26 2 wfjm
-- Dependencies:   -
27
-- Test bench:     -
28
-- Target Devices: generic
29 13 wfjm
-- Tool versions:  xst 8.2, 9.1, 9.2,.., 13.1; ghdl 0.18-0.29
30
--
31
-- Synthesized (xst):
32
-- Date         Rev  ise         Target      flop lutl lutm slic t peri
33
-- 2011-09-17   410 13.1    O40d xc3s1200e-4    8   25    -   13   (A6 polynom)
34
-- 2011-09-17   409 13.1    O40d xc3s1200e-4    8   18    -   10   (SAE J1850)
35
--
36 2 wfjm
-- Revision History: 
37
-- Date         Rev Version  Comment
38 13 wfjm
-- 2011-09-17   409   1.1    use now 'A6' polynomial of Koopman et al.
39 12 wfjm
-- 2011-08-14   406   1.0.1  remove superfluous variable r
40 2 wfjm
-- 2007-07-08    65   1.0    Initial version 
41
------------------------------------------------------------------------------
42
 
43
library ieee;
44
use ieee.std_logic_1164.all;
45
 
46
use work.slvtypes.all;
47
use work.comlib.all;
48
 
49
entity crc8 is                          -- crc-8 generator, checker
50
  generic (
51
    INIT: slv8 :=  "00000000");         -- initial state of crc register
52
  port (
53
    CLK : in slbit;                     -- clock
54
    RESET : in slbit;                   -- reset
55
    ENA : in slbit;                     -- update enable
56
    DI : in slv8;                       -- input data
57
    CRC : out slv8                      -- crc code
58
  );
59
end crc8;
60
 
61
 
62
architecture syn of crc8 is
63
  signal R_CRC : slv8 := INIT;         -- state registers
64
begin
65
 
66
  proc_regs: process (CLK)
67
  begin
68
 
69 13 wfjm
    if rising_edge(CLK) then
70 2 wfjm
      if RESET = '1' then
71
        R_CRC <= INIT;
72
      else
73 13 wfjm
        if ENA = '1' then
74
          R_CRC <= crc8_update(R_CRC, DI);
75
        end if;
76 2 wfjm
      end if;
77
    end if;
78
 
79
  end process proc_regs;
80
 
81 13 wfjm
  CRC <= R_CRC;
82
 
83 2 wfjm
end syn;

powered by: WebSVN 2.1.0

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