source: firmware/FTM/Lightpulser_interface/Basic_Version/Lightpulser_Basic_tb.vhd@ 18342

Last change on this file since 18342 was 10855, checked in by vogler, 13 years ago
Lightpulser Basic version with 50MHz clock only added
File size: 5.7 KB
Line 
1--------------------------------------------------------------------------------
2-- Company: IPP
3-- Engineer: Patrick Vogler
4--
5-- Create Date: 14:13:24 05/27/2011
6-- Design Name:
7-- Module Name: /home/pavogler/ISDC_repos/firmware/FTM/Lightpulser_interface/Basic_Version//Lightpulser_Basic_tb.vhd
8-- Project Name: Lightpulser_Basic
9-- Target Device:
10-- Tool versions:
11-- Description:
12--
13-- VHDL Test Bench Created by ISE for module: Lightpulser_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
33ENTITY Lightpulser_Basic_tb IS
34END Lightpulser_Basic_tb;
35
36ARCHITECTURE behavior OF Lightpulser_Basic_tb IS
37
38 -- Component Declaration for the Unit Under Test (UUT)
39
40 COMPONENT Lightpulser_interface
41 PORT(
42 clk_50 : IN std_logic;
43 Cal_0_p : OUT std_logic;
44 Cal_0_n : OUT std_logic;
45 Cal_1_p : OUT std_logic;
46 Cal_1_n : OUT std_logic;
47 Cal_2_p : OUT std_logic;
48 Cal_2_n : OUT std_logic;
49 Cal_3_p : OUT std_logic;
50 Cal_3_n : OUT std_logic;
51 Cal_4_p : OUT std_logic;
52 Cal_4_n : OUT std_logic;
53 Cal_5_p : OUT std_logic;
54 Cal_5_n : OUT std_logic;
55 Cal_6_p : OUT std_logic;
56 Cal_6_n : OUT std_logic;
57 Cal_7_p : OUT std_logic;
58 Cal_7_n : OUT std_logic;
59 LP1_ampl : IN std_logic_vector(15 downto 0);
60 LP2_ampl : IN std_logic_vector(15 downto 0);
61 LP1_pulse : IN std_logic;
62 LP2_pulse : IN std_logic;
63 start_config : IN std_logic;
64 config_started : OUT std_logic;
65 config_done : OUT std_logic
66 );
67 END COMPONENT;
68
69
70 --Inputs
71 signal clk_50 : std_logic := '0';
72 signal LP1_ampl : std_logic_vector(15 downto 0) := (others => '0');
73 signal LP2_ampl : std_logic_vector(15 downto 0) := (others => '0');
74 signal LP1_pulse : std_logic := '0';
75 signal LP2_pulse : std_logic := '0';
76 signal start_config : std_logic := '0';
77
78 --Outputs
79 signal Cal_0_p : std_logic;
80 signal Cal_0_n : std_logic;
81 signal Cal_1_p : std_logic;
82 signal Cal_1_n : std_logic;
83 signal Cal_2_p : std_logic;
84 signal Cal_2_n : std_logic;
85 signal Cal_3_p : std_logic;
86 signal Cal_3_n : std_logic;
87 signal Cal_4_p : std_logic;
88 signal Cal_4_n : std_logic;
89 signal Cal_5_p : std_logic;
90 signal Cal_5_n : std_logic;
91 signal Cal_6_p : std_logic;
92 signal Cal_6_n : std_logic;
93 signal Cal_7_p : std_logic;
94 signal Cal_7_n : std_logic;
95 signal config_started : std_logic;
96 signal config_done : std_logic;
97
98 -- Clock period definitions
99 constant clk_50_period : time := 20 ns;
100
101BEGIN
102
103 -- Instantiate the Unit Under Test (UUT)
104 uut: Lightpulser_interface PORT MAP (
105 clk_50 => clk_50,
106 Cal_0_p => Cal_0_p,
107 Cal_0_n => Cal_0_n,
108 Cal_1_p => Cal_1_p,
109 Cal_1_n => Cal_1_n,
110 Cal_2_p => Cal_2_p,
111 Cal_2_n => Cal_2_n,
112 Cal_3_p => Cal_3_p,
113 Cal_3_n => Cal_3_n,
114 Cal_4_p => Cal_4_p,
115 Cal_4_n => Cal_4_n,
116 Cal_5_p => Cal_5_p,
117 Cal_5_n => Cal_5_n,
118 Cal_6_p => Cal_6_p,
119 Cal_6_n => Cal_6_n,
120 Cal_7_p => Cal_7_p,
121 Cal_7_n => Cal_7_n,
122 LP1_ampl => LP1_ampl,
123 LP2_ampl => LP2_ampl,
124 LP1_pulse => LP1_pulse,
125 LP2_pulse => LP2_pulse,
126 start_config => start_config,
127 config_started => config_started,
128 config_done => config_done
129 );
130
131 -- Clock process definitions
132 clk_50_process :process
133 begin
134 clk_50 <= '0';
135 wait for clk_50_period/2;
136 clk_50 <= '1';
137 wait for clk_50_period/2;
138 end process;
139
140
141 -- Stimulus process
142 stim_proc: process
143 begin
144 -- hold reset state for 100 ms.
145 -- wait for 100 ms;
146
147 wait for clk_50_period*10;
148
149 -- insert stimulus here
150
151
152
153 -- init input signals
154 start_config <= '0';
155 LP1_pulse <= '0';
156 LP2_pulse <= '0';
157
158
159
160 -- latch settings
161 LP1_ampl <= "1000000000000111";
162 LP2_ampl <= "0100000000010000";
163
164
165 wait for clk_50_period*5;
166 start_config <= '1';
167 wait for clk_50_period*1;
168 start_config <= '0';
169
170
171 wait for clk_50_period*5;
172
173
174 -- trigger lightpulses
175
176 -- LP1: mirror dish
177 LP1_pulse <= '1';
178 wait for clk_50_period*5;
179 LP1_pulse <= '0';
180
181 -- LP2: shutter
182 LP2_pulse <= '1';
183 wait for clk_50_period*5;
184 LP2_pulse <= '0';
185
186
187
188
189
190 -- next cyclus
191 wait for clk_50_period*10;
192
193
194 -- latch settings
195 LP1_ampl <= "1100000000000111";
196 LP2_ampl <= "0000000000010000";
197
198 wait for clk_50_period*5;
199 start_config <= '1';
200 wait for clk_50_period*1;
201 start_config <= '0';
202
203
204 wait for clk_50_period*5;
205
206 -- trigger lightpulses
207
208 -- LP1: mirror dish
209 LP1_pulse <= '1';
210 wait for clk_50_period*2;
211 LP1_pulse <= '0';
212
213 -- LP2: shutter
214 LP2_pulse <= '1';
215 wait for clk_50_period*2;
216 LP2_pulse <= '0';
217
218
219
220 wait;
221 end process;
222
223END;
Note: See TracBrowser for help on using the repository browser.