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