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_13_fg_13_20.vhd,v 1.2 2001-10-26 16:29:35 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 control_section is
|
32
|
end entity control_section;
|
33
|
|
34
|
-- end not in book
|
35
|
|
36
|
|
37
|
architecture structural of control_section is
|
38
|
|
39
|
component reg is
|
40
|
generic ( width : positive );
|
41
|
port ( clk : in std_logic;
|
42
|
d : in std_logic_vector(0 to width - 1);
|
43
|
q : out std_logic_vector(0 to width - 1) );
|
44
|
end component reg;
|
45
|
|
46
|
for flag_reg : reg
|
47
|
use entity work.reg(gate_level)
|
48
|
-- workaround for MTI bug mt023
|
49
|
-- reverted for ghdl
|
50
|
port map ( clock => clk, data_in => d, data_out => q );
|
51
|
-- port map ( clock => clk, data_in => d, data_out => q, reset_n => '1' );
|
52
|
-- end workaround
|
53
|
|
54
|
-- . . .
|
55
|
|
56
|
-- not in book
|
57
|
signal clock_phase1, zero_result, neg_result, overflow_result,
|
58
|
zero_flag, neg_flag, overflow_flag : std_logic;
|
59
|
-- end not in book
|
60
|
|
61
|
begin
|
62
|
|
63
|
flag_reg : component reg
|
64
|
generic map ( width => 3 )
|
65
|
port map ( clk => clock_phase1,
|
66
|
d(0) => zero_result, d(1) => neg_result,
|
67
|
d(2) => overflow_result,
|
68
|
q(0) => zero_flag, q(1) => neg_flag,
|
69
|
q(2) => overflow_flag );
|
70
|
|
71
|
-- . . .
|
72
|
|
73
|
-- not in book
|
74
|
|
75
|
stimulus : process is
|
76
|
begin
|
77
|
clock_phase1 <= '0';
|
78
|
zero_result <= '0'; neg_result <= '0'; overflow_result <= '0'; wait for 10 ns;
|
79
|
clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns;
|
80
|
zero_result <= '0'; neg_result <= '0'; overflow_result <= '1'; wait for 10 ns;
|
81
|
clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns;
|
82
|
zero_result <= '0'; neg_result <= '1'; overflow_result <= '0'; wait for 10 ns;
|
83
|
clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns;
|
84
|
zero_result <= '0'; neg_result <= '1'; overflow_result <= '1'; wait for 10 ns;
|
85
|
clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns;
|
86
|
zero_result <= '1'; neg_result <= '0'; overflow_result <= '0'; wait for 10 ns;
|
87
|
clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns;
|
88
|
zero_result <= '1'; neg_result <= '0'; overflow_result <= '1'; wait for 10 ns;
|
89
|
clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns;
|
90
|
zero_result <= '1'; neg_result <= '1'; overflow_result <= '0'; wait for 10 ns;
|
91
|
clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns;
|
92
|
zero_result <= '1'; neg_result <= '1'; overflow_result <= '1'; wait for 10 ns;
|
93
|
clock_phase1 <= '1', '0' after 5 ns; wait for 10 ns;
|
94
|
|
95
|
wait;
|
96
|
end process stimulus;
|
97
|
|
98
|
-- end not in book
|
99
|
|
100
|
end architecture structural;
|