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

Subversion Repositories bluetooth

[/] [bluetooth/] [tags/] [INIT/] [code/] [cores/] [HEC/] [generator/] [tb/] [PCK_CRC8_D8.vhd] - Blame information for rev 4

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 khatib
-----------------------------------------------------------------------
2
-- File:  PCK_CRC8_D8.vhd                              
3
-- Date:  Sun Dec 31 07:41:19 2000                                                      
4
--                                                                     
5
-- Copyright (C) 1999 Easics NV.                 
6
-- This source file may be used and distributed without restriction    
7
-- provided that this copyright statement is not removed from the file 
8
-- and that any derivative work contains the original copyright notice
9
-- and the associated disclaimer.
10
--
11
-- THIS SOURCE FILE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS
12
-- OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
13
-- WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
14
--
15
-- Purpose: VHDL package containing a synthesizable CRC function
16
--   * polynomial: (0 1 2 5 7 8)
17
--   * data width: 8
18
--                                                                     
19
-- Info: jand@easics.be (Jan Decaluwe)                           
20
--       http://www.easics.com                                  
21
-----------------------------------------------------------------------
22
 
23
 
24
library IEEE;
25
use IEEE.std_logic_1164.all;
26
 
27
package PCK_CRC8_D8 is
28
 
29
  -- polynomial: (0 1 2 5 7 8)
30
  -- data width: 8
31
  -- convention: the first serial data bit is D(7)
32
  function nextCRC8_D8
33
    ( Data:  std_logic_vector(7 downto 0);
34
      CRC:   std_logic_vector(7 downto 0) )
35
    return std_logic_vector;
36
 
37
end PCK_CRC8_D8;
38
 
39
library IEEE;
40
use IEEE.std_logic_1164.all;
41
 
42
package body PCK_CRC8_D8 is
43
 
44
  -- polynomial: (0 1 2 5 7 8)
45
  -- data width: 8
46
  -- convention: the first serial data bit is D(7)
47
  function nextCRC8_D8
48
    ( Data:  std_logic_vector(7 downto 0);
49
      CRC:   std_logic_vector(7 downto 0) )
50
    return std_logic_vector is
51
 
52
    variable D: std_logic_vector(7 downto 0);
53
    variable C: std_logic_vector(7 downto 0);
54
    variable NewCRC: std_logic_vector(7 downto 0);
55
 
56
  begin
57
 
58
    D := Data;
59
    C := CRC;
60
 
61
    NewCRC(0) := D(6) xor D(4) xor D(2) xor D(1) xor D(0) xor C(0) xor
62
                 C(1) xor C(2) xor C(4) xor C(6);
63
    NewCRC(1) := D(7) xor D(6) xor D(5) xor D(4) xor D(3) xor D(0) xor
64
                 C(0) xor C(3) xor C(4) xor C(5) xor C(6) xor C(7);
65
    NewCRC(2) := D(7) xor D(5) xor D(2) xor D(0) xor C(0) xor C(2) xor
66
                 C(5) xor C(7);
67
    NewCRC(3) := D(6) xor D(3) xor D(1) xor C(1) xor C(3) xor C(6);
68
    NewCRC(4) := D(7) xor D(4) xor D(2) xor C(2) xor C(4) xor C(7);
69
    NewCRC(5) := D(6) xor D(5) xor D(4) xor D(3) xor D(2) xor D(1) xor
70
                 D(0) xor C(0) xor C(1) xor C(2) xor C(3) xor C(4) xor
71
                 C(5) xor C(6);
72
    NewCRC(6) := D(7) xor D(6) xor D(5) xor D(4) xor D(3) xor D(2) xor
73
                 D(1) xor C(1) xor C(2) xor C(3) xor C(4) xor C(5) xor
74
                 C(6) xor C(7);
75
    NewCRC(7) := D(7) xor D(5) xor D(3) xor D(1) xor D(0) xor C(0) xor
76
                 C(1) xor C(3) xor C(5) xor C(7);
77
 
78
    return NewCRC;
79
 
80
  end nextCRC8_D8;
81
 
82
end PCK_CRC8_D8;
83
 

powered by: WebSVN 2.1.0

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