Project

General

Profile

Download (3.29 KB) Statistics
| Branch: | Tag: | Revision:
1

    
2
-- Copyright (C) 1996 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

    
20
-- ---------------------------------------------------------------------
21
--
22
-- $Id: ch_04_fg_04_03.vhd,v 1.2 2001-10-26 16:29:33 paw Exp $
23
-- $Revision: 1.2 $
24
--
25
-- ---------------------------------------------------------------------
26

    
27
entity fg_04_03 is
28

    
29
end entity fg_04_03;
30

    
31

    
32
----------------------------------------------------------------
33

    
34

    
35
architecture test of fg_04_03 is
36
begin
37

    
38
  -- code from book:
39

    
40
  modem_controller : process is
41

    
42
                               type symbol is ('a', 't', 'd', 'h', digit, cr, other);
43
                             type symbol_string is array (1 to 20) of symbol;
44
                             type state is range 0 to 6;
45
                             type transition_matrix is array (state, symbol) of state;
46

    
47
                             constant next_state : transition_matrix :=
48
                               ( 0 => ('a' => 1, others => 6),
49
                                 1 => ('t' => 2, others => 6),
50
                                 2 => ('d' => 3, 'h' => 5, others => 6),
51
                                 3 => (digit => 4, others => 6),
52
                                 4 => (digit => 4, cr => 0, others => 6),
53
                                 5 => (cr => 0, others => 6),
54
                                 6 => (cr => 0, others => 6) );
55

    
56
                             variable command : symbol_string;
57
                             variable current_state : state := 0;
58

    
59
                             -- not in book:
60
                             type sample_array is array (positive range <>) of symbol_string;
61
                             constant sample_command : sample_array :=
62
                               ( 1 => ( 'a', 't', 'd', digit, digit, cr, others => other ),
63
                                 2 => ( 'a', 't', 'h', cr, others => other ),
64
                                 3 => ( 'a', 't', other, other, cr, others => other ) );
65
                             -- end not in book
66

    
67
  begin
68
    -- . . .
69
    -- not in book:
70
    for command_index in sample_command'range loop
71
      command := sample_command(command_index);
72
      -- end not in book
73
      for index in 1 to 20 loop
74
        current_state := next_state( current_state, command(index) );
75
        case current_state is
76
          -- . . .
77
          -- not in book:
78
          when 0 => exit;
79
          when others => null;
80
                         -- end not in book
81
        end case;
82
      end loop;
83
      -- . . .
84
      -- not in book:
85
    end loop;
86
    wait;
87
    -- end not in book
88
  end process modem_controller;
89

    
90
  -- end of code from book
91

    
92
end architecture test;
(19-19/171)