1 |
5 |
ktt1 |
--------------------------------------------------------------------------------
|
2 |
|
|
-- _ _ __ ____ --
|
3 |
|
|
-- / / | | / _| | __| --
|
4 |
|
|
-- | |_| | _ _ / / | |_ --
|
5 |
|
|
-- | _ | | | | | | | | _| --
|
6 |
|
|
-- | | | | | |_| | \ \_ | |__ --
|
7 |
|
|
-- |_| |_| \_____| \__| |____| microLab --
|
8 |
|
|
-- --
|
9 |
|
|
-- Bern University of Applied Sciences (BFH) --
|
10 |
|
|
-- Quellgasse 21 --
|
11 |
|
|
-- Room HG 4.33 --
|
12 |
|
|
-- 2501 Biel/Bienne --
|
13 |
|
|
-- Switzerland --
|
14 |
|
|
-- --
|
15 |
|
|
-- http://www.microlab.ch --
|
16 |
|
|
--------------------------------------------------------------------------------
|
17 |
|
|
-- GECKO4com
|
18 |
|
|
--
|
19 |
|
|
-- 2010/2011 Dr. Theo Kluter
|
20 |
|
|
--
|
21 |
|
|
-- This VHDL code is free code: you can redistribute it and/or modify
|
22 |
|
|
-- it under the terms of the GNU General Public License as published by
|
23 |
|
|
-- the Free Software Foundation, either version 3 of the License, or
|
24 |
|
|
-- (at your option) any later version.
|
25 |
|
|
--
|
26 |
|
|
-- This VHDL code is distributed in the hope that it will be useful,
|
27 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
28 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
29 |
|
|
-- GNU General Public License for more details.
|
30 |
|
|
-- You should have received a copy of the GNU General Public License
|
31 |
|
|
-- along with these sources. If not, see <http://www.gnu.org/licenses/>.
|
32 |
|
|
--
|
33 |
|
|
|
34 |
|
|
ARCHITECTURE no_target_specific OF reset_if IS
|
35 |
|
|
|
36 |
|
|
SIGNAL s_reset_count_reg : std_logic_vector( 4 DOWNTO 0 );
|
37 |
|
|
SIGNAL s_user_count_reg : std_logic_vector( 4 DOWNTO 0 );
|
38 |
|
|
SIGNAL s_done_pending_reg: std_logic;
|
39 |
|
|
|
40 |
|
|
BEGIN
|
41 |
|
|
n_reset_system <= '0' WHEN s_reset_count_reg(4) = '0' ELSE 'Z';
|
42 |
|
|
user_n_reset <= '0' WHEN s_user_count_reg(4) = '0' ELSE '1';
|
43 |
|
|
command_done <= '1' WHEN (s_done_pending_reg = '1' AND
|
44 |
|
|
s_reset_count_reg(4) = '1' AND
|
45 |
|
|
s_user_count_reg(4) = '1') OR
|
46 |
|
|
(start_command = '1' AND
|
47 |
|
|
(command_id = "0001111" OR
|
48 |
|
|
command_id = "0111010") AND
|
49 |
|
|
fpga_configured = '0') ELSE '0';
|
50 |
|
|
|
51 |
|
|
--------------------------------------------------------------------------------
|
52 |
|
|
--- Here the reset counter is defined ---
|
53 |
|
|
--------------------------------------------------------------------------------
|
54 |
|
|
make_reset_count_reg : PROCESS( clock , reset , start_command , command_id ,
|
55 |
|
|
fpga_configured )
|
56 |
|
|
BEGIN
|
57 |
|
|
IF (clock'event AND (clock = '1')) THEN
|
58 |
|
|
IF ((start_command = '1' AND
|
59 |
|
|
command_id = "0001111") OR
|
60 |
|
|
fpga_configured = '0' OR
|
61 |
|
|
reset = '1') THEN s_reset_count_reg <= "0"&X"A";
|
62 |
|
|
ELSIF (msec_tick = '1' AND
|
63 |
|
|
s_reset_count_reg(4) = '0') THEN
|
64 |
|
|
s_reset_count_reg <= unsigned(s_reset_count_reg) - 1;
|
65 |
|
|
END IF;
|
66 |
|
|
END IF;
|
67 |
|
|
END PROCESS make_reset_count_reg;
|
68 |
|
|
|
69 |
|
|
make_user_count_reg : PROCESS( clock , reset , start_command , command_id ,
|
70 |
|
|
fpga_configured )
|
71 |
|
|
BEGIN
|
72 |
|
|
IF (clock'event AND (clock = '1')) THEN
|
73 |
|
|
IF ((start_command = '1' AND
|
74 |
|
|
command_id = "0111010") OR
|
75 |
|
|
fpga_configured = '0' OR
|
76 |
|
|
reset = '1') THEN s_user_count_reg <= "0"&X"A";
|
77 |
|
|
ELSIF (msec_tick = '1' AND
|
78 |
|
|
s_user_count_reg(4) = '0') THEN
|
79 |
|
|
s_user_count_reg <= unsigned(s_user_count_reg) - 1;
|
80 |
|
|
END IF;
|
81 |
|
|
END IF;
|
82 |
|
|
END PROCESS make_user_count_reg;
|
83 |
|
|
|
84 |
|
|
make_done_pending_reg : PROCESS( clock , reset , start_command , command_id ,
|
85 |
|
|
s_reset_count_reg )
|
86 |
|
|
BEGIN
|
87 |
|
|
IF (clock'event AND (clock = '1')) THEN
|
88 |
|
|
IF (start_command = '1' AND
|
89 |
|
|
(command_id = "0001111" OR
|
90 |
|
|
command_id = "0111010") AND
|
91 |
|
|
fpga_configured = '1') THEN s_done_pending_reg <= '1';
|
92 |
|
|
ELSIF (reset = '1' OR
|
93 |
|
|
(s_reset_count_reg(4) = '1' AND
|
94 |
|
|
s_user_count_reg(4) = '1')) THEN s_done_pending_reg <= '0';
|
95 |
|
|
END IF;
|
96 |
|
|
END IF;
|
97 |
|
|
END PROCESS make_done_pending_reg;
|
98 |
|
|
|
99 |
|
|
END no_target_specific;
|