source: firmware/FTM/Lightpulser_interface/Basic_Version/Lightpulser_interface_Basic.vhd@ 15495

Last change on this file since 15495 was 11513, checked in by vogler, 13 years ago
lightpulser interface modified to reduce LED current and light output
File size: 9.0 KB
Line 
1----------------------------------------------------------------------------------
2-- Company: ETH Zurich, Institute for Particle Physics
3-- Engineer: Patrick Vogler
4--
5-- Create Date: 24 February 2010
6-- Design Name:
7-- Module Name: FTM Lightpulser interface Basic
8-- Project Name:
9-- Target Devices:
10-- Tool versions:
11-- Description: Interface to the lightpulsers LP1 (in the mirror dish)
12-- and LP2 (inside the shutter)
13--
14-- Dependencies:
15--
16-- Revision:
17-- Revision 0.01 - File Created
18-- Additional Comments:
19--
20--
21-- modifications: May 13 2011
22--
23-- Version 2
24--
25--
26-- modified: May 26 2011
27-- by Patrick Vogler
28-- "Lightpulser Basic Version"
29--
30-- modified: May 27 2011
31-- by Patrick Vogler, Quirin Weitzel
32-- -> clean up
33--
34-- modified: July 20 2011
35-- by Patrick Vogler
36-- reduce minimal LED light output and increase dynamic range
37--
38----------------------------------------------------------------------------------
39
40library IEEE;
41use IEEE.STD_LOGIC_1164.ALL;
42use IEEE.STD_LOGIC_ARITH.ALL;
43use IEEE.STD_LOGIC_UNSIGNED.ALL;
44
45---- Uncomment the following library declaration if instantiating
46---- any Xilinx primitives in this code.
47library UNISIM;
48use UNISIM.VComponents.all;
49
50library ftm_definitions;
51USE ftm_definitions.ftm_array_types.all;
52USE ftm_definitions.ftm_constants.all;
53
54
55entity Lightpulser_interface_Basic is
56 port(
57
58-- Clock
59-------------------------------------------------------------------------------
60 clk_50 : IN STD_LOGIC; -- 50 MHz system clock
61-- clk_250 : IN STD_LOGIC; -- 250 MHz system clock
62
63-- Lightpulser
64-- RJ-45 connectors J13 or J12 on the FTM board
65-- LVDS calibration outputs
66-- on IO-Bank 0
67-------------------------------------------------------------------------------
68-- connector J13 => Light Pulser 1 in the mirror dish
69 Cal_0_p : out STD_LOGIC := '0'; -- Feedback / pulse width modulation
70 Cal_0_n : out STD_LOGIC := '1';
71 Cal_1_p : out STD_LOGIC := '0'; -- Pulse
72 Cal_1_n : out STD_LOGIC := '1';
73 Cal_2_p : out STD_LOGIC := '0'; -- Gate_1_4_7
74 Cal_2_n : out STD_LOGIC := '1';
75 Cal_3_p : out STD_LOGIC := '0'; -- Gate_3_5_8
76 Cal_3_n : out STD_LOGIC := '1';
77
78-- connector J12 => Light Pulser 2 in the shutter
79 Cal_4_p : out STD_LOGIC := '0'; -- Feedback / pulse width modulation
80 Cal_4_n : out STD_LOGIC := '1';
81 Cal_5_p : out STD_LOGIC := '0'; -- Pulse
82 Cal_5_n : out STD_LOGIC := '1';
83 Cal_6_p : out STD_LOGIC := '0'; -- Gate_1_4_7
84 Cal_6_n : out STD_LOGIC := '1';
85 Cal_7_p : out STD_LOGIC := '0'; -- Gate_3_5_8
86 Cal_7_n : out STD_LOGIC := '1';
87
88
89-- FPGA intern signals: Lightpulser brightness
90-------------------------------------------------------------------------------
91
92 LP1_ampl : in std_logic_vector (15 downto 0);
93 LP2_ampl : in std_logic_vector (15 downto 0);
94
95-- LP1_delay : in std_logic_vector (15 downto 0);
96-- LP2_delay : in std_logic_vector (15 downto 0);
97
98
99 LP1_pulse : in std_logic; -- trigger lightpulse in the mirror dish
100 LP2_pulse : in std_logic; -- trigger lightpulse in the shutter
101
102
103 start_config : in std_logic; -- handshaking
104 config_started : out std_logic := '0';
105 config_done : out std_logic := '0'
106
107 );
108end Lightpulser_interface_Basic;
109
110
111architecture Behavioral of Lightpulser_interface_Basic is
112
113
114component FM_pulse_generator_Basic is
115 port(
116 clk : in std_logic; -- 50 MHz
117 pulse_freq : in std_logic_vector (6 downto 0);
118 FM_out : out std_logic := '0'
119 );
120end component;
121
122
123component single_LP_Basic is
124 port(
125 clk_50 : in STD_LOGIC;
126 LP_Pulse_out : out STD_LOGIC;
127 LP_pulse_in : in std_logic
128 );
129end component;
130
131
132-- LP1: mirror dish
133signal Cal_0_1 : STD_LOGIC := '0';
134-- signal Cal_1_1 : STD_LOGIC;
135
136-- LP2: shutter
137signal Cal_0_2 : STD_LOGIC := '0';
138-- signal Cal_1_2 : STD_LOGIC;
139
140-- PWM for amplitude stabilization
141signal PWM_sig_1 : std_logic := '0'; -- LP1: mirror dish
142signal PWM_sig_2 : std_logic := '0'; -- LP2: shutter
143
144-- control data latch
145signal LP1_ampl_sig : std_logic_vector (15 downto 0) := (others => '0');
146signal LP2_ampl_sig : std_logic_vector (15 downto 0) := (others => '0');
147
148
149type type_latch_state is (IDLE, COPY, CONFIGURED);
150signal latch_state : type_latch_state := IDLE;
151
152
153begin
154
155
156 -- input latch
157 input_latch : process (clk_50)
158 begin
159 if rising_edge(clk_50) then
160 case latch_state is
161
162 when IDLE =>
163 if start_config = '1' then
164 config_done <= '0';
165 config_started <= '1';
166 latch_state <= COPY;
167 end if;
168
169 when COPY =>
170 LP1_ampl_sig <= LP1_ampl;
171 LP2_ampl_sig <= LP2_ampl;
172 -- LP1_delay_sig <= LP1_delay;
173 -- LP2_delay_sig <= LP2_delay;
174 latch_state <= CONFIGURED;
175
176 when CONFIGURED =>
177 config_started <= '0';
178 config_done <= '1';
179 latch_state <= IDLE;
180
181 end case;
182 end if;
183 end process input_latch;
184
185
186 Inst_LP1_mirror_dish:single_LP_Basic
187 port map (
188 clk_50 => clk_50,
189 LP_Pulse_out => Cal_0_1,
190 LP_pulse_in => LP1_pulse
191 );
192
193
194 Inst_LP2_shutter:single_LP_Basic
195 port map (
196 clk_50 => clk_50,
197 LP_Pulse_out => Cal_0_2,
198 LP_pulse_in => LP2_pulse
199 );
200
201 Inst_LP1_FM_pulse_generator:FM_pulse_generator_Basic -- LP1: mirror dish
202 port map(
203 clk => clk_50,
204 pulse_freq => LP1_ampl_sig(6 downto 0),
205 FM_out => PWM_sig_1
206 );
207
208
209 Inst_LP2_FM_pulse_generator:FM_pulse_generator_Basic -- LP2: shutter
210 port map(
211 clk => clk_50,
212 pulse_freq => LP2_ampl_sig(6 downto 0),
213 FM_out => PWM_sig_2
214 );
215
216
217 -- Light Pulser 1 (in the mirror dish): differential output buffers
218
219 OBUFDS_inst_Cal_0 : OBUFDS
220 generic map (
221 IOSTANDARD => "DEFAULT")
222 port map ( O => Cal_0_p , -- Diff_p output (connect directly to top-level port)
223 OB => Cal_0_n , -- Diff_n output (connect directly to top-level port)
224 I => Cal_0_1 -- Buffer input
225 );
226
227 OBUFDS_inst_Cal_1 : OBUFDS
228 generic map (
229 IOSTANDARD => "DEFAULT")
230 port map ( O => Cal_1_p , -- Diff_p output (connect directly to top-level port)
231 OB => Cal_1_n , -- Diff_n output (connect directly to top-level port)
232 I => PWM_sig_1 -- Buffer input
233 );
234
235 OBUFDS_inst_Cal_2 : OBUFDS
236 generic map (
237 IOSTANDARD => "DEFAULT")
238 port map ( O => Cal_2_p , -- Diff_p output (connect directly to top-level port)
239 OB => Cal_2_n , -- Diff_n output (connect directly to top-level port)
240 I => LP1_ampl_sig(14) -- Buffer input
241 );
242
243 OBUFDS_inst_Cal_3 : OBUFDS
244 generic map (
245 IOSTANDARD => "DEFAULT")
246 port map ( O => Cal_3_p , -- Diff_p output (connect directly to top-level port)
247 OB => Cal_3_n , -- Diff_n output (connect directly to top-level port)
248 I => LP1_ampl_sig(15) -- Buffer input
249 );
250
251
252
253 -- Light Pulser 2 (in the shutter): differential output buffers
254
255 OBUFDS_inst_Cal_4 : OBUFDS
256 generic map (
257 IOSTANDARD => "DEFAULT")
258 port map ( O => Cal_4_p , -- Diff_p output (connect directly to top-level port)
259 OB => Cal_4_n , -- Diff_n output (connect directly to top-level port)
260 I => Cal_0_2 -- Buffer input
261 );
262
263 OBUFDS_inst_Cal_5 : OBUFDS
264 generic map (
265 IOSTANDARD => "DEFAULT")
266 port map ( O => Cal_5_p , -- Diff_p output (connect directly to top-level port)
267 OB => Cal_5_n , -- Diff_n output (connect directly to top-level port)
268 I => PWM_sig_2 -- Buffer input
269 );
270
271 OBUFDS_inst_Cal_6 : OBUFDS
272 generic map (
273 IOSTANDARD => "DEFAULT")
274 port map ( O => Cal_6_p , -- Diff_p output (connect directly to top-level port)
275 OB => Cal_6_n , -- Diff_n output (connect directly to top-level port)
276 I => LP2_ampl_sig(14)
277 );
278
279 OBUFDS_inst_Cal_7 : OBUFDS
280 generic map (
281 IOSTANDARD => "DEFAULT")
282 port map ( O => Cal_7_p , -- Diff_p output (connect directly to top-level port)
283 OB => Cal_7_n , -- Diff_n output (connect directly to top-level port)
284 I => LP2_ampl_sig(15) -- Buffer input
285 );
286
287
288end Behavioral;
Note: See TracBrowser for help on using the repository browser.