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

Subversion Repositories w11

[/] [w11/] [tags/] [w11a_V0.61/] [rtl/] [vlib/] [comlib/] [misc/] [gen_crc8_tbl_check.vhd] - Blame information for rev 36

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

Line No. Rev Author Line
1 13 wfjm
-- $Id: gen_crc8_tbl_check.vhd 410 2011-09-18 11:23:09Z mueller $
2 2 wfjm
--
3 13 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:    gen_crc8_tbl - sim
16
-- Description:    stand-alone program to test crc8 transition table
17
--
18
-- Dependencies:   -
19
--
20
-- Revision History: 
21
-- Date         Rev Version  Comment
22 13 wfjm
-- 2011-09-17   410   1.1    use now 'A6' polynomial of Koopman et al.
23 2 wfjm
-- 2007-10-12    88   1.0.1  avoid ieee.std_logic_unsigned, use cast to unsigned
24
-- 2007-07-08    65   1.0    Initial version 
25
------------------------------------------------------------------------------
26
 
27
library ieee;
28
use ieee.std_logic_1164.all;
29
use std.textio.all;
30
 
31
entity gen_crc8_tbl_check is
32
end gen_crc8_tbl_check;
33
 
34
architecture sim of gen_crc8_tbl_check is
35
begin
36
 
37
  process
38
    type crc8_tbl_type is array (0 to 255) of integer;
39
 
40
    variable crc8_tbl : crc8_tbl_type :=        -- generated with gen_crc8_tbl
41 13 wfjm
      (  0,  77, 154, 215, 121,  52, 227, 174,
42
       242, 191, 104,  37, 139, 198,  17,  92,
43
       169, 228,  51, 126, 208, 157,  74,   7,
44
        91,  22, 193, 140,  34, 111, 184, 245,
45
        31,  82, 133, 200, 102,  43, 252, 177,
46
       237, 160, 119,  58, 148, 217,  14,  67,
47
       182, 251,  44,  97, 207, 130,  85,  24,
48
        68,   9, 222, 147,  61, 112, 167, 234,
49
        62, 115, 164, 233,  71,  10, 221, 144,
50
       204, 129,  86,  27, 181, 248,  47,  98,
51
       151, 218,  13,  64, 238, 163, 116,  57,
52
       101,  40, 255, 178,  28,  81, 134, 203,
53
        33, 108, 187, 246,  88,  21, 194, 143,
54
       211, 158,  73,   4, 170, 231,  48, 125,
55
       136, 197,  18,  95, 241, 188, 107,  38,
56
       122,  55, 224, 173,   3,  78, 153, 212,
57
       124,  49, 230, 171,   5,  72, 159, 210,
58
       142, 195,  20,  89, 247, 186, 109,  32,
59
       213, 152,  79,   2, 172, 225,  54, 123,
60
        39, 106, 189, 240,  94,  19, 196, 137,
61
        99,  46, 249, 180,  26,  87, 128, 205,
62
       145, 220,  11,  70, 232, 165, 114,  63,
63
       202, 135,  80,  29, 179, 254,  41, 100,
64
        56, 117, 162, 239,  65,  12, 219, 150,
65
        66,  15, 216, 149,  59, 118, 161, 236,
66
       176, 253,  42, 103, 201, 132,  83,  30,
67
       235, 166, 113,  60, 146, 223,   8,  69,
68
        25,  84, 131, 206,  96,  45, 250, 183,
69
        93,  16, 199, 138,  36, 105, 190, 243,
70
       175, 226,  53, 120, 214, 155,  76,   1,
71
       244, 185, 110,  35, 141, 192,  23,  90,
72
         6,  75, 156, 209, 127,  50, 229, 168
73
      );
74
 
75 2 wfjm
    variable crc : integer := 0;
76
    variable oline : line;
77
 
78
  begin
79
 
80
    loop_i: for i in 0 to 255 loop
81
      write(oline, i, right, 4);
82
      write(oline, string'(": cycle length = "));
83
      crc := i;
84
      loop_n: for n in 1 to 256 loop
85
        crc := crc8_tbl(crc);
86
        if crc = i then
87
          write(oline, n, right, 4);
88
          writeline(output, oline);
89
          exit loop_n;
90
        end if;
91
      end loop;  -- n
92
    end loop;  -- i
93
    wait;
94
  end process;
95
 
96
end sim;

powered by: WebSVN 2.1.0

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