1 |
3fd18385
|
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_05_ch_05_17.vhd,v 1.1.1.1 2001-08-22 18:20:47 paw Exp $
|
23 |
|
|
-- $Revision: 1.1.1.1 $
|
24 |
|
|
--
|
25 |
|
|
-- ---------------------------------------------------------------------
|
26 |
|
|
|
27 |
|
|
entity ch_05_17 is
|
28 |
|
|
|
29 |
|
|
end entity ch_05_17;
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
----------------------------------------------------------------
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
architecture test of ch_05_17 is
|
36 |
|
|
|
37 |
|
|
signal s, r, q, q_n : bit := '0';
|
38 |
|
|
|
39 |
|
|
begin
|
40 |
|
|
|
41 |
|
|
q <= '1' when s = '1' else
|
42 |
|
|
'0' when r = '1';
|
43 |
|
|
|
44 |
|
|
q_n <= '0' when s = '1' else
|
45 |
|
|
'1' when r = '1';
|
46 |
|
|
|
47 |
|
|
|
48 |
|
|
-- code from book:
|
49 |
|
|
|
50 |
|
|
check : process is
|
51 |
|
|
begin
|
52 |
|
|
assert not (s = '1' and r = '1')
|
53 |
|
|
report "Incorrect use of S_R_flip_flop: s and r both '1'";
|
54 |
|
|
wait on s, r;
|
55 |
|
|
end process check;
|
56 |
|
|
|
57 |
|
|
-- end of code from book
|
58 |
|
|
|
59 |
|
|
|
60 |
|
|
stimulus : process is
|
61 |
|
|
begin
|
62 |
|
|
wait for 10 ns;
|
63 |
|
|
s <= '1'; wait for 10 ns;
|
64 |
|
|
s <= '0'; wait for 10 ns;
|
65 |
|
|
r <= '1'; wait for 10 ns;
|
66 |
|
|
r <= '0'; wait for 10 ns;
|
67 |
|
|
s <= '1'; wait for 10 ns;
|
68 |
|
|
r <= '1'; wait for 10 ns;
|
69 |
|
|
s <= '0'; wait for 10 ns;
|
70 |
|
|
r <= '0'; wait for 10 ns;
|
71 |
|
|
|
72 |
|
|
wait;
|
73 |
|
|
end process stimulus;
|
74 |
|
|
|
75 |
|
|
|
76 |
|
|
end architecture test;
|