Project

General

Profile

Statistics
| Branch: | Tag: | Revision:

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

History | View | Annotate | Download (2.15 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: ch_07_fg_07_06.vhd,v 1.2 2001-10-26 16:29:34 paw Exp $
23
-- $Revision: 1.2 $
24
--
25
-- ---------------------------------------------------------------------
26

    
27
entity fg_07_06 is
28
end entity fg_07_06;
29

    
30

    
31
architecture test of fg_07_06 is
32

    
33
  type func_code is (add, subtract);
34

    
35
  signal op1 : integer := 10;
36
  signal op2 : integer := 3;
37
  signal dest : integer := 0;
38
  signal func : func_code := add;
39

    
40
  signal Z_flag : boolean := false;
41

    
42
  constant Tpd : delay_length := 3 ns;
43

    
44
begin
45

    
46
  stimulus : process is
47

    
48
                       -- code from book
49

    
50
                       procedure do_arith_op ( op : in func_code ) is
51
    variable result : integer;
52
  begin
53
    case op is
54
      when add =>
55
        result := op1 + op2;
56
      when subtract =>
57
        result := op1 - op2;
58
    end case;
59
    dest  <=  result after Tpd;
60
    Z_flag  <=  result = 0 after Tpd;
61
  end procedure do_arith_op;
62

    
63
  -- end code from book
64

    
65
  begin
66
    wait for 10 ns;
67

    
68
    -- code from book (in text)
69

    
70
    do_arith_op ( add );
71

    
72
    -- end code from book
73

    
74
    wait for 10 ns;
75

    
76
    -- code from book (in text)
77

    
78
    do_arith_op ( func );
79

    
80
    -- end code from book
81

    
82
    wait for 10 ns;
83
    do_arith_op ( subtract );
84
    wait for 10 ns;
85
    op2 <= 10;
86
    wait for 10 ns;
87
    do_arith_op ( subtract );
88

    
89
    wait;
90
  end process stimulus;
91

    
92
end architecture test;