1 | --------------------------------------------------------------------------------
|
2 | -- Company:
|
3 | -- Engineer:
|
4 | --
|
5 | -- Create Date: 12:56:41 01/04/2015
|
6 | -- Design Name:
|
7 | -- Module Name: Z:/Documents/VHDL/Digitaluhr_5_Neu/DU_Testbench.vhd
|
8 | -- Project Name: Digitaluhr_5_Neu
|
9 | -- Target Device:
|
10 | -- Tool versions:
|
11 | -- Description:
|
12 | --
|
13 | -- VHDL Test Bench Created by ISE for module: DU_Code
|
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 DU_Testbench IS
|
36 | END DU_Testbench;
|
37 |
|
38 | ARCHITECTURE behavior OF DU_Testbench IS
|
39 |
|
40 | -- Component Declaration for the Unit Under Test (UUT)
|
41 |
|
42 | COMPONENT DU_Code
|
43 | PORT(
|
44 | clk : IN std_logic;
|
45 | set_time : IN std_logic;
|
46 | stunde : IN std_logic;
|
47 | mode : IN std_logic_vector(1 downto 0);
|
48 | o_std_z : OUT std_logic_vector(3 downto 0);
|
49 | o_std_e : OUT std_logic_vector(3 downto 0);
|
50 | o_min_z : OUT std_logic_vector(3 downto 0);
|
51 | o_min_e : OUT std_logic_vector(3 downto 0);
|
52 | o_sec_z : OUT std_logic_vector(3 downto 0);
|
53 | o_sec_e : OUT std_logic_vector(3 downto 0);
|
54 | i_std_z : IN std_logic_vector(3 downto 0);
|
55 | i_std_e : IN std_logic_vector(3 downto 0);
|
56 | i_min_z : IN std_logic_vector(3 downto 0);
|
57 | i_min_e : IN std_logic_vector(3 downto 0);
|
58 | i_sec_z : IN std_logic_vector(3 downto 0);
|
59 | i_sec_e : IN std_logic_vector(3 downto 0)
|
60 | );
|
61 | END COMPONENT;
|
62 |
|
63 |
|
64 | --Inputs
|
65 | signal clk : std_logic := '0';
|
66 | signal set_time : std_logic := '0';
|
67 | signal stunde : std_logic := '0';
|
68 | signal mode : std_logic_vector(1 downto 0) := (others => '0');
|
69 | signal i_std_z : std_logic_vector(3 downto 0) := (others => '0');
|
70 | signal i_std_e : std_logic_vector(3 downto 0) := (others => '0');
|
71 | signal i_min_z : std_logic_vector(3 downto 0) := (others => '0');
|
72 | signal i_min_e : std_logic_vector(3 downto 0) := (others => '0');
|
73 | signal i_sec_z : std_logic_vector(3 downto 0) := (others => '0');
|
74 | signal i_sec_e : std_logic_vector(3 downto 0) := (others => '0');
|
75 |
|
76 | --Outputs
|
77 | signal o_std_z : std_logic_vector(3 downto 0);
|
78 | signal o_std_e : std_logic_vector(3 downto 0);
|
79 | signal o_min_z : std_logic_vector(3 downto 0);
|
80 | signal o_min_e : std_logic_vector(3 downto 0);
|
81 | signal o_sec_z : std_logic_vector(3 downto 0);
|
82 | signal o_sec_e : std_logic_vector(3 downto 0);
|
83 |
|
84 | -- Clock period definitions
|
85 | constant clk_period : time := 1 ns;
|
86 |
|
87 | BEGIN
|
88 |
|
89 | -- Instantiate the Unit Under Test (UUT)
|
90 | uut: DU_Code PORT MAP (
|
91 | clk => clk,
|
92 | set_time => set_time,
|
93 | stunde => stunde,
|
94 | mode => mode,
|
95 | o_std_z => o_std_z,
|
96 | o_std_e => o_std_e,
|
97 | o_min_z => o_min_z,
|
98 | o_min_e => o_min_e,
|
99 | o_sec_z => o_sec_z,
|
100 | o_sec_e => o_sec_e,
|
101 | i_std_z => i_std_z,
|
102 | i_std_e => i_std_e,
|
103 | i_min_z => i_min_z,
|
104 | i_min_e => i_min_e,
|
105 | i_sec_z => i_sec_z,
|
106 | i_sec_e => i_sec_e
|
107 | );
|
108 |
|
109 | -- Clock process definitions
|
110 | clk_process :process
|
111 | begin
|
112 | clk <= '0';
|
113 | wait for clk_period/2;
|
114 | clk <= '1';
|
115 | wait for clk_period/2;
|
116 | end process;
|
117 |
|
118 |
|
119 | -- Stimulus process
|
120 | stim_proc: process
|
121 | begin
|
122 | -- hold reset state for 100 ns.
|
123 | -- wait for 100 ns;
|
124 |
|
125 | wait for clk_period*10;
|
126 |
|
127 | -- insert stimulus here
|
128 | set_time <= '1', '0' after 50 ns;
|
129 | if (set_time = '1') then
|
130 | i_sec_e <= "0010";
|
131 | i_sec_z <= "0001";
|
132 | i_min_e <= "0100";
|
133 | i_min_z <= "0010";
|
134 | i_std_e <= "0100";
|
135 | i_std_z <= "0000";
|
136 | end if;
|
137 |
|
138 | stunde <= '0' after 50 ns;
|
139 | mode <= "01" after 50 ns;
|
140 |
|
141 |
|
142 | wait;
|
143 | end process;
|
144 |
|
145 | END;
|