Project

General

Profile

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

    
27
entity fg_05_04 is
28
end entity fg_05_04;
29

    
30
architecture test of fg_05_04 is
31

    
32
  constant prop_delay : time := 5 ns;
33

    
34
  signal a, b, sel, z : bit;
35

    
36
begin
37

    
38
  -- code from book
39

    
40
  mux : process (a, b, sel) is
41
  begin
42
    case sel is
43
      when '0' =>
44
	z <= a after prop_delay;
45
      when '1' =>
46
	z <= b after prop_delay;
47
    end case;
48
  end process mux;
49

    
50
  -- end code from book
51

    
52

    
53
  stimulus : process is
54
                       subtype stim_vector_type is bit_vector(0 to 3);
55
                     type stim_vector_array is array ( natural range <> ) of stim_vector_type;
56
                     constant stim_vector : stim_vector_array
57
                       := ( "0000",
58
                            "0010",
59
                            "0100",
60
                            "0111",
61
                            "1001",
62
                            "1010",
63
                            "1101",
64
                            "1111" );
65
  begin
66
    for i in stim_vector'range loop
67
      (a, b, sel) <= stim_vector(i)(0 to 2);
68
      wait for 10 ns;
69
      assert z = stim_vector(i)(3);
70
    end loop;
71
    wait;
72
  end process stimulus;
73

    
74

    
75
end architecture test;
(85-85/510)