Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

lustrec-tests / vhdl_json / vhdl_files / 2-exportOK / ghdl / ghdl / testsuite / vests / vhdl-93 / ashenden / compliant / ap_a_fg_a_08.vhd @ 3fd18385

History | View | Annotate | Download (3.35 KB)

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: ap_a_fg_a_08.vhd,v 1.2 2001-10-26 16:29:33 paw Exp $
23
-- $Revision: 1.2 $
24
--
25
-- ---------------------------------------------------------------------
26

    
27
-- not in book
28

    
29
library ieee;  use ieee.std_logic_1164.all;
30

    
31
               entity entname is
32
               end entity entname;
33

    
34
-- end not in book
35

    
36

    
37
               architecture rtl of entname is
38

    
39
                 type state_type is (s0, s1, s2, s3);
40
                 signal state, next_state : state_type;
41
                 signal con1, con2, con3 : std_ulogic;
42
                 signal out1, out2 : std_ulogic;
43
                 signal clk, reset : std_ulogic;
44
                 -- . . .
45

    
46
               begin
47
                 state_logic : process (state, con1, con2, con3) is
48
                 begin
49
                   case state is
50
                     when s0 =>
51
                       out1 <= '0';
52
                       out2 <= '0';
53
                       next_state <= s1; 
54
                     when s1 =>
55
                       out1 <= '1';
56
                       if con1 = '1' then
57
                         next_state <= s2;
58
                       else
59
                         next_state <= s1;
60
                       end if;
61
                     when s2 =>
62
                       out2 <= '1';
63
                       next_state <= s3;
64
                     when s3 =>
65
                       if con2 = '0' then
66
                         next_state <= s3;
67
                       elsif con3 = '0' then
68
                         out1 <= '0';
69
                         next_state <= s2;
70
                       else
71
                         next_state <= s1;
72
                       end if;
73
                   end case;
74
                 end process state_logic;
75

    
76
                 state_register : process (clk, reset) is
77
                 begin
78
                   if reset = '0' then
79
                     state <= s0;
80
                   elsif rising_edge(clk) then
81
                     state <= next_state;
82
                   end if;
83
                 end process state_register;
84

    
85
                 -- . . .
86

    
87
                 -- not in book
88

    
89
                 clk_gen : process is
90
                 begin
91
                   clk <= '0', '1' after 10 ns;
92
                   wait for 20 ns;
93
                 end process clk_gen;
94

    
95
                 reset <= '0', '1' after 40 ns;
96

    
97
                 con1 <= '0', '1' after 100 ns, '0' after 120 ns;
98

    
99
                 con2 <= '0', '1' after 160 ns;
100

    
101
                 con3 <= '0', '1' after 220 ns;
102

    
103
                 -- end not in book
104

    
105
               end architecture rtl;