source: firmware/FTM/Lightpulser_interface/Lightpulser_interface.vhd@ 13722

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