1 | --------------------------------------------------------------------------------
|
2 | -- Company:
|
3 | -- Engineer:
|
4 | --
|
5 | -- Create Date: 06:45:42 01/08/2020
|
6 | -- Design Name:
|
7 | -- Module Name: C:/Projekte/FPGA/debounce_fsm/tb_debounce_fsm.vhd
|
8 | -- Project Name: debounce_fsm
|
9 | -- Target Device:
|
10 | -- Tool versions:
|
11 | -- Description:
|
12 | --
|
13 | -- VHDL Test Bench Created by ISE for module: debounce_fsm
|
14 | --
|
15 | -- Dependencies:
|
16 | --
|
17 | -- Revision:
|
18 | -- Revision 0.01 - File Created
|
19 | -- Additional Comments:
|
20 | --
|
21 | -- Notes:
|
22 | -- This testbench has been automatically generated using types std_logic and
|
23 | -- std_logic_vector for the ports of the unit under test. Xilinx recommends
|
24 | -- that these types always be used for the top-level I/O of a design in order
|
25 | -- to guarantee that the testbench will bind correctly to the post-implementation
|
26 | -- simulation model.
|
27 | --------------------------------------------------------------------------------
|
28 | LIBRARY ieee;
|
29 | USE ieee.std_logic_1164.ALL;
|
30 |
|
31 | -- Uncomment the following library declaration if using
|
32 | -- arithmetic functions with Signed or Unsigned values
|
33 | --USE ieee.numeric_std.ALL;
|
34 |
|
35 | ENTITY tb_debounce_fsm IS
|
36 | END tb_debounce_fsm;
|
37 |
|
38 | ARCHITECTURE behavior OF tb_debounce_fsm IS
|
39 |
|
40 | -- Component Declaration for the Unit Under Test (UUT)
|
41 |
|
42 | COMPONENT debounce_fsm
|
43 | PORT(
|
44 | clk : IN std_logic;
|
45 | rst : IN std_logic;
|
46 | taster : IN std_logic;
|
47 | debounced : OUT std_logic
|
48 | );
|
49 | END COMPONENT;
|
50 |
|
51 |
|
52 | --Inputs
|
53 | signal clk : std_logic := '0';
|
54 | signal rst : std_logic := '1';
|
55 | signal taster : std_logic := '0';
|
56 |
|
57 | --Outputs
|
58 | signal debounced : std_logic;
|
59 |
|
60 | -- Clock period definitions
|
61 | constant clk_period : time := 10 ns;
|
62 |
|
63 | BEGIN
|
64 |
|
65 | -- Instantiate the Unit Under Test (UUT)
|
66 | uut: debounce_fsm PORT MAP (
|
67 | clk => clk,
|
68 | rst => rst,
|
69 | taster => taster,
|
70 | debounced => debounced
|
71 | );
|
72 |
|
73 | clk <= not clk after clk_period/2;
|
74 |
|
75 | stim_proc: process
|
76 | begin
|
77 | -- hold reset state for 100 ns.
|
78 | wait for 100 ns;
|
79 | rst <= '0';
|
80 | wait for clk_period*25;
|
81 |
|
82 | taster <= '1';
|
83 | wait for clk_period*80;
|
84 | taster <= '0';
|
85 | wait for clk_period*105;
|
86 |
|
87 | taster <= '1';
|
88 | wait for clk_period*15;
|
89 | taster <= '0';
|
90 | wait for clk_period*50;
|
91 |
|
92 | taster <= '1';
|
93 | wait for clk_period*3;
|
94 | taster <= '0';
|
95 | wait for clk_period*105;
|
96 |
|
97 | taster <= '1';
|
98 | wait for clk_period*80;
|
99 | taster <= '0';
|
100 | wait for clk_period*105;
|
101 |
|
102 | wait for clk_period*105;
|
103 |
|
104 | taster <= '1';
|
105 | wait for clk_period*3;
|
106 | taster <= '0';
|
107 | wait for clk_period*10;
|
108 | taster <= '1';
|
109 | wait for clk_period*30;
|
110 | taster <= '0';
|
111 | wait for clk_period*105;
|
112 |
|
113 | taster <= '1';
|
114 | wait for clk_period*3;
|
115 | taster <= '0';
|
116 | wait for clk_period*10;
|
117 | taster <= '1';
|
118 | wait for clk_period*30;
|
119 | taster <= '0';
|
120 | wait for clk_period*122;
|
121 |
|
122 | taster <= '1';
|
123 | wait for clk_period*3;
|
124 | taster <= '0';
|
125 | wait for clk_period*10;
|
126 | taster <= '1';
|
127 | wait for clk_period*35;
|
128 | taster <= '0';
|
129 | wait for clk_period*105;
|
130 |
|
131 | wait for clk_period*105;
|
132 |
|
133 | taster <= '1';
|
134 | wait for clk_period*3;
|
135 | taster <= '0';
|
136 | wait for clk_period*5;
|
137 | taster <= '1';
|
138 | wait for clk_period*5;
|
139 | taster <= '0';
|
140 | wait for clk_period*5;
|
141 | taster <= '1';
|
142 | wait for clk_period*105;
|
143 | taster <= '0';
|
144 | wait for clk_period*150;
|
145 |
|
146 |
|
147 | taster <= '1';
|
148 | wait for clk_period*5;
|
149 | taster <= '0';
|
150 | wait for clk_period*38;
|
151 | taster <= '1';
|
152 | wait for clk_period*5;
|
153 | taster <= '0';
|
154 | wait for clk_period*39;
|
155 | taster <= '1';
|
156 | wait for clk_period*5;
|
157 | taster <= '0';
|
158 | wait for clk_period*40;
|
159 | taster <= '1';
|
160 | wait for clk_period*5;
|
161 | taster <= '0';
|
162 | wait for clk_period*41;
|
163 | taster <= '1';
|
164 | wait for clk_period*5;
|
165 | taster <= '0';
|
166 | wait for clk_period*42;
|
167 | taster <= '1';
|
168 | wait for clk_period*5;
|
169 | taster <= '0';
|
170 | wait for clk_period*43;
|
171 | taster <= '1';
|
172 | wait for clk_period*5;
|
173 | taster <= '0';
|
174 | wait for clk_period*5;
|
175 | taster <= '1';
|
176 | wait for clk_period*105;
|
177 | taster <= '0';
|
178 | wait for clk_period*15;
|
179 | -- insert stimulus here
|
180 |
|
181 | wait;
|
182 | end process;
|
183 |
|
184 | END;
|