1
2-- Copyright (C) 2002 Morgan Kaufmann Publishers, Inc
3
4-- This file is part of VESTs (Vhdl tESTs).
5
6-- VESTs is free software; you can redistribute it and/or modify it
7-- under the terms of the GNU General Public License as published by the
8-- Free Software Foundation; either version 2 of the License, or (at
9-- your option) any later version.
10
11-- VESTs is distributed in the hope that it will be useful, but WITHOUT
12-- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13-- FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
14-- for more details.
15
16-- You should have received a copy of the GNU General Public License
17-- along with VESTs; if not, write to the Free Software Foundation,
18-- Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
19
20entity inline_06 is
21
22end entity inline_06;
23
24
25----------------------------------------------------------------
26
27use std.textio.all;
28
29architecture test of inline_06 is
30
31  subtype encoding_type is bit_vector(1 downto 0);
32  attribute encoding : encoding_type;
33
34begin
35
36
37  process1 : process is
38
39    -- code from book:
40
41    type controller_state is (idle, active, fail_safe);
42    type load_level is (idle, busy, overloaded);
43
44    attribute encoding of idle [ return controller_state ] : literal is b"00";
45    attribute encoding of active [ return controller_state ] : literal is b"01";
46    attribute encoding of fail_safe [ return controller_state ] : literal is b"10";
47
48    -- end of code from book
49
50    variable L : line;
51
52  begin
53    write(L, string'("process1"));
54    writeline(output, L);
55    write(L, idle [ return controller_state ] ' encoding);
56    writeline(output, L);
57    write(L, active [ return controller_state ] ' encoding);
58    writeline(output, L);
59    write(L, fail_safe [ return controller_state ] ' encoding);
60    writeline(output, L);
61    wait;
62  end process process1;
63
64
65  process2 : process is
66
67    type controller_state is (idle, active, fail_safe);
68    type load_level is (idle, busy, overloaded);
69
70    attribute encoding of idle : literal is b"11";
71
72    variable L : line;
73
74  begin
75    write(L, string'("process2"));
76    writeline(output, L);
77    write(L, idle [ return controller_state ] ' encoding);
78    writeline(output, L);
79    write(L, idle [ return load_level ] ' encoding);
80    writeline(output, L);
81    wait;
82  end process process2;
83
84
85end architecture test;
86