Project

General

Profile

Download (2.44 KB) Statistics
| Branch: | Tag: | Revision:
1 d93979b7 Arnaud Dieumegard
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_21_fg_21_01.vhd,v 1.2 2001-10-26 16:29:37 paw Exp $
23
-- $Revision: 1.2 $
24
--
25
-- ---------------------------------------------------------------------
26
27
entity D_flipflop is
28
  port ( clk, d : in bit;  q : buffer bit );
29
end entity D_flipflop;
30
31
32
architecture behavioral of D_flipflop is
33
begin
34
  q <= d when clk'event and clk = '1';
35
end architecture behavioral;
36
37
38
39
entity inverter is
40
  port ( a : in bit;  y : out bit );
41
end entity inverter;
42
43
44
architecture behavioral of inverter is
45
begin
46
  y <= not a;
47
end architecture behavioral;
48
49
50
51
-- code from book
52
53
entity count2 is
54
  port ( clk : in bit;  q0, q1 : buffer bit );
55
end entity count2;
56
57
--------------------------------------------------
58
59
architecture buffered_outputs of count2 is
60
61
  component D_flipflop is
62
                         port ( clk, d : in bit;  q : buffer bit );
63
  end component D_flipflop;
64
65
  component inverter is
66
                       port ( a : in bit;  y : out bit );
67
  end component inverter;
68
69
  signal q0_n, q1_n : bit;
70
71
begin
72
73
  bit0 : component D_flipflop
74
    port map ( clk => clk, d => q0_n, q => q0 );
75
76
  inv0 : component inverter
77
    port map ( a => q0, y => q0_n );
78
79
  bit1 : component D_flipflop
80
    port map ( clk => q0_n, d => q1_n, q => q1 );
81
82
  inv1 : component inverter
83
    port map ( a => q1, y => q1_n );
84
85
end architecture buffered_outputs;
86
87
-- end code from book
88
89
90
91
entity fg_21_01 is
92
end entity fg_21_01;
93
94
95
architecture test of fg_21_01 is
96
97
  signal clk, q0, q1 : bit;
98
99
begin
100
101
  dut : entity work.count2(buffered_outputs)
102
    port map ( clk => clk, q0 => q0, q1 => q1 );
103
104
  clk_gen : clk <= not clk after 10 ns;
105
106
end architecture test;