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

Subversion Repositories esoc

[/] [esoc/] [trunk/] [Sources/] [logixa/] [package_hash10_24b.vhd] - Blame information for rev 42

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 42 lmaarsen
--------------------------------------------------------------------------------
2
-- Object        : Package work.package_hash10_24b
3
-- Last modified : Thu Oct 10 12:37:21 2013.
4
--------------------------------------------------------------------------------
5
 
6
 
7
 
8
library ieee, std;
9
use ieee.std_logic_1164.all;
10
use std.textio.all;
11
use ieee.numeric_std.all;
12
---------------------------------------------------------------------------------------------------------------
13
-- Package declaration
14
---------------------------------------------------------------------------------------------------------------
15
package package_hash10_24b is
16
 
17
  -------------------------------------------------------------------------
18
  -- functions to calculate CRC on the fly
19
  -------------------------------------------------------------------------
20
  function CALC_HASH10_24b
21
    (data : std_logic_vector(23 downto 0))
22
    return std_logic_vector;
23
 
24
end package_hash10_24b;
25
 
26
package body package_hash10_24b is
27
 
28
  --=============================================================================================================
29
  -- Process              : 
30
  -- Description        : 
31
  --=============================================================================================================     
32
  function CALC_HASH10_24b
33
  (data: std_logic_vector(23 downto 0))
34
  return std_logic_vector is
35
 
36
  variable d:      std_logic_vector(23 downto 0);
37
  variable hash: std_logic_vector(9 downto 0);
38
 
39
  begin
40
    d := data;
41
 
42
    hash(0) := d(23) xor d(19) xor d(17) xor d(16) xor d(15) xor d(9)  xor d(4)  xor d(3)  xor d(2)  xor d(1) xor d(0);
43
    hash(1) := d(23) xor d(20) xor d(19) xor d(18) xor d(15) xor d(10) xor d(9)  xor d(5)  xor d(0);
44
    hash(2) := d(21) xor d(20) xor d(19) xor d(16) xor d(11) xor d(10) xor d(6)  xor d(1);
45
    hash(3) := d(22) xor d(21) xor d(20) xor d(17) xor d(12) xor d(11) xor d(7)  xor d(2);
46
    hash(4) := d(22) xor d(21) xor d(19) xor d(18) xor d(17) xor d(16) xor d(15) xor d(13) xor d(12) xor d(9) xor d(8) xor d(4) xor d(2) xor d(1) xor d(0);
47
    hash(5) := d(22) xor d(20) xor d(18) xor d(15) xor d(14) xor d(13) xor d(10) xor d(5)  xor d(4)  xor d(0);
48
    hash(6) := d(23) xor d(21) xor d(19) xor d(16) xor d(15) xor d(14) xor d(11) xor d(6)  xor d(5)  xor d(1);
49
    hash(7) := d(22) xor d(20) xor d(17) xor d(16) xor d(15) xor d(12) xor d(7)  xor d(6)  xor d(2);
50
    hash(8) := d(23) xor d(21) xor d(18) xor d(17) xor d(16) xor d(13) xor d(8)  xor d(7)  xor d(3);
51
    hash(9) := d(23) xor d(22) xor d(18) xor d(16) xor d(15) xor d(14) xor d(8)  xor d(3)  xor d(2)  xor d(1) xor d(0);
52
 
53
    return hash;
54
  end CALC_HASH10_24b;
55
 
56
end package_hash10_24b;

powered by: WebSVN 2.1.0

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