source: firmware/FTM/Clock_cond_interface/Clock_cond_interface_tb.vhd@ 12764

Last change on this file since 12764 was 11648, checked in by vogler, 13 years ago
clock cond interface, new settings loaded only when changed
File size: 5.4 KB
Line 
1--------------------------------------------------------------------------------
2-- Company:
3-- Engineer: Patrick Vogler
4--
5-- Create Date: 16:19:23 02/21/2011
6-- Design Name:
7-- Module Name:
8-- Project Name: Clock_cond_interface
9-- Target Device:
10-- Tool versions:
11-- Description:
12--
13-- VHDL Test Bench Created by ISE for module: Clock_cond_interface
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--------------------------------------------------------------------------------
28LIBRARY ieee;
29USE ieee.std_logic_1164.ALL;
30USE ieee.std_logic_unsigned.all;
31USE ieee.numeric_std.ALL;
32
33
34library ftm_definitions;
35use ftm_definitions.ftm_array_types.all;
36use ftm_definitions.ftm_constants.all;
37
38
39ENTITY Clock_cond_interface_tb IS
40END Clock_cond_interface_tb;
41
42ARCHITECTURE behavior OF Clock_cond_interface_tb IS
43
44 -- Component Declaration for the Unit Under Test (UUT)
45
46 COMPONENT Clock_cond_interface
47 PORT(
48 clk : IN std_logic;
49 CLK_Clk_Cond : OUT std_logic;
50 LE_Clk_Cond : OUT std_logic;
51 DATA_Clk_Cond : OUT std_logic;
52 SYNC_Clk_Cond : OUT std_logic;
53 LD_Clk_Cond : IN std_logic;
54 TIM_Sel : OUT std_logic;
55 -- locked : out STD_LOGIC; -- PLL in the Clock Conditioner locked
56 cc_R0 : IN std_logic_vector(31 downto 0);
57 cc_R1 : IN std_logic_vector(31 downto 0);
58 cc_R8 : IN std_logic_vector(31 downto 0);
59 cc_R9 : IN std_logic_vector(31 downto 0);
60 cc_R11 : IN std_logic_vector(31 downto 0);
61 cc_R13 : IN std_logic_vector(31 downto 0);
62 cc_R14 : IN std_logic_vector(31 downto 0);
63 cc_R15 : IN std_logic_vector(31 downto 0);
64
65
66 start_config : IN std_logic;
67 config_started : OUT std_logic;
68 config_done : OUT std_logic;
69 timemarker_select : IN std_logic
70 );
71 END COMPONENT;
72
73
74 --Inputs
75 signal clk : std_logic := '0';
76 signal LD_Clk_Cond : std_logic := '0';
77
78
79 signal cc_R0 : std_logic_vector(31 downto 0) := x"00038000";
80 signal cc_R1 : std_logic_vector(31 downto 0) := x"00010101";
81 signal cc_R8 : std_logic_vector(31 downto 0) := x"10000908";
82 signal cc_R9 : std_logic_vector(31 downto 0) := x"A0032A09";
83 signal cc_R11 : std_logic_vector(31 downto 0) := x"0082000B";
84 signal cc_R13 : std_logic_vector(31 downto 0) := x"020A000D";
85 signal cc_R14 : std_logic_vector(31 downto 0) := x"0830280E";
86 signal cc_R15 : std_logic_vector(31 downto 0) := x"1400FA0F";
87
88
89 signal start_config : std_logic := '0';
90 signal timemarker_select : std_logic := '0';
91
92
93
94
95
96 --Outputs
97 signal CLK_Clk_Cond : std_logic;
98 signal LE_Clk_Cond : std_logic;
99 signal DATA_Clk_Cond : std_logic;
100 signal SYNC_Clk_Cond : std_logic;
101 signal TIM_Sel : std_logic;
102 signal config_started : std_logic;
103 signal config_done : std_logic;
104 -- signal locked : STD_LOGIC; -- PLL in the Clock Conditioner locked
105
106
107 -- Clock period definitions
108 constant clk_period : time := 20 ns; -- 50 MHz Clock
109 -- constant CLK_Clk_Cond_period : time := 10 ns;
110
111
112
113BEGIN
114
115 -- Instantiate the Unit Under Test (UUT)
116 uut: Clock_cond_interface PORT MAP (
117 clk => clk,
118 CLK_Clk_Cond => CLK_Clk_Cond,
119 LE_Clk_Cond => LE_Clk_Cond,
120 DATA_Clk_Cond => DATA_Clk_Cond,
121 SYNC_Clk_Cond => SYNC_Clk_Cond,
122 LD_Clk_Cond => LD_Clk_Cond,
123 TIM_Sel => TIM_Sel,
124 -- locked => locked,
125 cc_R0 => cc_R0,
126 cc_R1 => cc_R1,
127 cc_R8 => cc_R8,
128 cc_R9 => cc_R9,
129 cc_R11 => cc_R11,
130 cc_R13 => cc_R13,
131 cc_R14 => cc_R14,
132 cc_R15 => cc_R15,
133 start_config => start_config,
134 config_started => config_started,
135 config_done => config_done,
136 timemarker_select => timemarker_select
137 );
138
139
140
141
142 -- Clock process definitions
143 clk_process :process
144 begin
145 clk <= '0';
146 wait for clk_period/2;
147 clk <= '1';
148 wait for clk_period/2;
149 end process;
150
151
152
153
154
155 -- Stimulus process
156 stim_proc: process
157 begin
158 -- hold reset state for 100 ms.
159 -- wait for 100 ms;
160
161 TIM_Sel <= '0';
162
163 wait for clk_period*20;
164
165 -- insert stimulus here
166
167 start_config <= '1';
168 wait for clk_period*100;
169 start_config <= '0';
170
171 wait for 300 us;
172 LD_Clk_Cond <= '1';
173
174
175 wait for 300 us;
176 LD_Clk_Cond <= '0';
177 start_config <= '1';
178 wait for clk_period*100;
179 start_config <= '0';
180 wait for 300 us;
181 LD_Clk_Cond <= '1';
182
183
184
185
186
187 -- programm new settings
188
189 cc_R0 <= x"00038027";
190 cc_R1 <= x"00010101";
191 cc_R8 <= x"10000963";
192 cc_R9 <= x"A0032A09";
193 cc_R11 <= x"0082000B";
194 cc_R13 <= x"020A000D";
195 cc_R14 <= x"0830280E";
196 cc_R15 <= x"1400FA0F";
197
198 wait for 300 us;
199 LD_Clk_Cond <= '0';
200 start_config <= '1';
201 wait for clk_period*100;
202 start_config <= '0';
203 wait for 300 us;
204 LD_Clk_Cond <= '1';
205
206
207
208 wait;
209 end process;
210
211END;
Note: See TracBrowser for help on using the repository browser.