source: firmware/FTM/FTM_top_tb.vhd@ 10227

Last change on this file since 10227 was 10227, checked in by weitzel, 14 years ago
first version of FTM firmware including ethernet and FTU interface; still some debugging needed
File size: 17.0 KB
Line 
1--------------------------------------------------------------------------------
2-- Company: ETH Zurich, Institute for Particle Physics
3-- Engineer: Q. Weitzel, P. Vogler
4--
5-- Create Date: 08.12.2010
6-- Design Name:
7-- Module Name: FTM_top_tb.vhd
8-- Project Name:
9-- Target Device:
10-- Tool versions:
11-- Description: Testbench for FTM firmware
12--
13-- VHDL Test Bench Created by ISE for module: FTM_top
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
33library UNISIM;
34use UNISIM.VComponents.all;
35
36entity FTM_top_tb is
37end FTM_top_tb;
38
39architecture behavior of FTM_top_tb is
40
41 -- Component Declaration for the Unit Under Test (UUT)
42
43 component FTM_top
44 port(
45
46 -- Clock
47 clk : IN STD_LOGIC; -- external clock from oscillator U47
48
49 -- connection to the WIZnet W5300 ethernet controller
50 -------------------------------------------------------------------------------
51 -- W5300 data bus
52 W_D : inout STD_LOGIC_VECTOR(15 downto 0); -- 16-bit data bus to W5300
53
54 -- W5300 address bus
55 W_A : out STD_LOGIC_VECTOR(9 downto 0); -- there is no real net W_A0 because
56 -- the W5300 is operated in the
57 -- 16-bit mode
58 -- -> W_A<0> assigned to unconnected pin
59
60 -- W5300 control signals
61 -- the signals W_INT, W_RD, W_WR and W_RES also go to testpoints T17
62 -- W_CS is also routed to testpoint JP7
63 W_CS : out STD_LOGIC; -- W5300 chip select
64 W_INT : IN STD_LOGIC; -- interrupt
65 W_RD : out STD_LOGIC; -- read
66 W_WR : out STD_LOGIC; -- write
67 W_RES : out STD_LOGIC; -- reset W5300 chip
68
69 -- W5300 buffer ready indicator
70 -- W_BRDY : in STD_LOGIC_VECTOR(3 downto 0);
71
72 -- testpoints (T18) associated with the W5300
73 -- W_T : inout STD_LOGIC_VECTOR(3 downto 0);
74
75
76 -- SPI Interface
77 -- connection to the EEPROM U36 (AL25L016M) and
78 -- temperature sensors U45, U46, U48 and U49 (all MAX6662)
79 -------------------------------------------------------------------------------
80 -- S_CLK : out STD_LOGIC; -- SPI clock
81
82 -- EEPROM
83 -- MOSI : out STD_LOGIC; -- master out slave in
84 -- MISO : in STD_LOGIC; -- master in slave out
85 -- EE_CS : out STD_LOGIC; -- EEPROM chip select
86
87 -- temperature sensors U45, U46, U48 and U49
88 -- SIO : inout STD_LOGIC; -- serial IO
89 -- TS_CS : out STD_LOGIC_VECTOR(3 downto 0); -- temperature sensors chip select
90
91
92 -- Trigger primitives inputs
93 -------------------------------------------------------------------------------
94 -- Trig_Prim_A : in STD_LOGIC_VECTOR(9 downto 0); -- crate 0
95 -- Trig_Prim_B : in STD_LOGIC_VECTOR(9 downto 0); -- crate 1
96 -- Trig_Prim_C : in STD_LOGIC_VECTOR(9 downto 0); -- crate 2
97 -- Trig_Prim_D : in STD_LOGIC_VECTOR(9 downto 0); -- crate 3
98
99
100 -- NIM inputs
101 ------------------------------------------------------------------------------
102 -- ext_Trig : in STD_LOGIC_VECTOR(2 downto 1); -- external trigger input
103 -- Veto : in STD_LOGIC; -- trigger veto input
104 -- NIM_In : in STD_LOGIC_VECTOR(2 downto 0); -- auxiliary inputs
105
106 -- alternative external clock input for FPGA
107 -- NIM_In3_GCLK : in STD_LOGIC; -- input with global clock buffer available
108
109
110 -- LEDs
111 -------------------------------------------------------------------------------
112 LED_red : out STD_LOGIC_VECTOR(3 downto 0); -- red
113 LED_ye : out STD_LOGIC_VECTOR(1 downto 0); -- yellow
114 LED_gn : out STD_LOGIC_VECTOR(1 downto 0); -- green
115
116
117 -- Clock conditioner LMK03000
118 -------------------------------------------------------------------------------
119 -- CLK_Clk_Cond : out STD_LOGIC; -- MICROWIRE interface serial clock
120 -- LE_Clk_Cond : out STD_LOGIC; -- MICROWIRE interface latch enable
121 -- DATA_Clk_Cond : out STD_LOGIC; -- MICROWIRE interface data
122
123 -- SYNC_Clk_Cond : out STD_LOGIC; -- global clock synchronization
124 -- LD_Clk_Cond : in STD_LOGIC; -- lock detect, should be checked for
125
126
127 -- various RS-485 Interfaces
128 -------------------------------------------------------------------------------
129 -- Bus 1: FTU slow control
130 Bus1_Tx_En : out STD_LOGIC; -- bus 1: transmitter enable
131 Bus1_Rx_En : out STD_LOGIC; -- bus 1: receiver enable
132
133 Bus1_RxD_0 : in STD_LOGIC; -- crate 0
134 Bus1_TxD_0 : out STD_LOGIC;
135
136 Bus1_RxD_1 : in STD_LOGIC; -- crate 1
137 Bus1_TxD_1 : out STD_LOGIC;
138
139 Bus1_RxD_2 : in STD_LOGIC; -- crate 2
140 Bus1_TxD_2 : out STD_LOGIC;
141
142 Bus1_RxD_3 : in STD_LOGIC; -- crate 3
143 Bus1_TxD_3 : out STD_LOGIC
144
145
146 -- Bus 2: Trigger-ID to FAD boards
147 -- Bus2_Tx_En : out STD_LOGIC; -- bus 2: transmitter enable
148 -- Bus2_Rx_En : out STD_LOGIC; -- bus 2: receiver enable
149
150 -- Bus2_RxD_0 : in STD_LOGIC; -- crate 0
151 -- Bus2_TxD_0 : out STD_LOGIC;
152
153 -- Bus2_RxD_1 : in STD_LOGIC; -- crate 1
154 -- Bus2_TxD_1 : out STD_LOGIC;
155
156 -- Bus2_RxD_2 : in STD_LOGIC; -- crate 2
157 -- Bus2_TxD_2 : out STD_LOGIC;
158
159 -- Bus2_RxD_3 : in STD_LOGIC; -- crate 3
160 -- Bus2_TxD_3 : out STD_LOGIC;
161
162
163 -- auxiliary access
164 -- Aux_Rx_D : in STD_LOGIC;
165 -- Aux_Tx_D : out STD_LOGIC;
166 -- Aux_Rx_En : out STD_LOGIC; -- Rx- and Tx enable
167 -- Aux_Tx_En : out STD_LOGIC; -- also for auxiliary Trigger-ID
168
169
170 -- auxiliary Trigger-ID (i.e. to send the Trigger-ID to the counting hut/house/container)
171 -- TrID_Rx_D : in STD_LOGIC;
172 -- TrID_Tx_D : out STD_LOGIC;
173
174
175 -- Crate-Resets
176 -------------------------------------------------------------------------------
177 -- Crate_Res0 : out STD_LOGIC;
178 -- Crate_Res1 : out STD_LOGIC;
179 -- Crate_Res2 : out STD_LOGIC;
180 -- Crate_Res3 : out STD_LOGIC;
181
182
183 -- Busy signals from the FAD boards
184 -------------------------------------------------------------------------------
185-- Busy0 : in STD_LOGIC;
186-- Busy1 : in STD_LOGIC;
187-- Busy2 : in STD_LOGIC;
188-- Busy3 : in STD_LOGIC;
189
190
191 -- NIM outputs
192 -- LVDS output at the FPGA followed by LVDS to NIM conversion stage
193 -------------------------------------------------------------------------------
194 -- calibration
195 -- Cal_NIM1_p : out STD_LOGIC; -- Cal_NIM1+
196 -- Cal_NIM1_n : out STD_LOGIC; -- Cal_NIM1-
197 -- Cal_NIM2_p : out STD_LOGIC; -- Cal_NIM2+
198 -- Cal_NIM2_n : out STD_LOGIC; -- Cal_NIM2-
199
200 -- auxiliarry / spare NIM outputs
201 -- NIM_Out0_p : out STD_LOGIC; -- NIM_Out0+
202 -- NIM_Out0_n : out STD_LOGIC; -- NIM_Out0-
203 -- NIM_Out1_p : out STD_LOGIC; -- NIM_Out1+
204 -- NIM_Out1_n : out STD_LOGIC; -- NIM_Out1-
205
206
207 -- fast control signal outputs
208 -- LVDS output at the FPGA followed by LVDS to NIM conversion stage
209 -------------------------------------------------------------------------------
210-- RES_p : out STD_LOGIC; -- RES+ Reset
211-- RES_n : out STD_LOGIC; -- RES-
212
213-- TRG_p : out STD_LOGIC; -- TRG+ Trigger
214-- TRG_n : out STD_LOGIC; -- TRG-
215
216-- TIM_Run_p : out STD_LOGIC; -- TIM_Run+ Time Marker
217-- TIM_Run_n : out STD_LOGIC; -- TIM_Run-
218-- TIM_Sel : out STD_LOGIC; -- Time Marker selector
219
220 -- CLD_FPGA : in STD_LOGIC; -- DRS-Clock feedback into FPGA
221
222
223 -- LVDS calibration outputs
224 -------------------------------------------------------------------------------
225 -- to connector J13
226 -- for light pulsar in the mirror dish
227-- Cal_0_p : out STD_LOGIC;
228-- Cal_0_n : out STD_LOGIC;
229-- Cal_1_p : out STD_LOGIC;
230-- Cal_1_n : out STD_LOGIC;
231-- Cal_2_p : out STD_LOGIC;
232-- Cal_2_n : out STD_LOGIC;
233-- Cal_3_p : out STD_LOGIC;
234-- Cal_3_n : out STD_LOGIC;
235
236 -- to connector J12
237 -- for light pulsar inside shutter
238-- Cal_4_p : out STD_LOGIC;
239-- Cal_4_n : out STD_LOGIC;
240-- Cal_5_p : out STD_LOGIC;
241-- Cal_5_n : out STD_LOGIC;
242-- Cal_6_p : out STD_LOGIC;
243-- Cal_6_n : out STD_LOGIC;
244-- Cal_7_p : out STD_LOGIC;
245-- Cal_7_n : out STD_LOGIC
246
247
248 -- Testpoints
249 -------------------------------------------------------------------------------
250 -- TP : inout STD_LOGIC_VECTOR(32 downto 0);
251 -- TP_in : in STD_LOGIC_VECTOR(34 downto 33); -- input only
252
253 -- Board ID - inputs
254 -- local board-ID "solder programmable"
255 -- all on 'input only' pins
256 -------------------------------------------------------------------------------
257 -- brd_id : in STD_LOGIC_VECTOR(7 downto 0) -- input only
258
259 );
260 end component;
261
262 --Inputs
263 signal clk_sig : STD_LOGIC := '0';
264 signal W_INT_sig : STD_LOGIC := '0';
265 signal W_BRDY_sig : STD_LOGIC_VECTOR(3 downto 0) := (others => '0');
266 signal Trig_Prim_A_sig : STD_LOGIC_VECTOR(9 downto 0) := (others => '0');
267 signal Trig_Prim_B_sig : STD_LOGIC_VECTOR(9 downto 0) := (others => '0');
268 signal Trig_Prim_C_sig : STD_LOGIC_VECTOR(9 downto 0) := (others => '0');
269 signal Trig_Prim_D_sig : STD_LOGIC_VECTOR(9 downto 0) := (others => '0');
270 signal ext_Trig_sig : STD_LOGIC_VECTOR(2 downto 1) := (others => '0');
271 signal Veto_sig : STD_LOGIC := '0';
272 signal NIM_In_sig : STD_LOGIC_VECTOR(2 downto 0) := (others => '0');
273 signal NIM_In3_GCLK_sig : STD_LOGIC := '0';
274 signal LD_Clk_Cond_sig : STD_LOGIC := '1';
275 signal Bus1_RxD_0_sig : STD_LOGIC := '1';
276 signal Bus1_RxD_1_sig : STD_LOGIC := '1';
277 signal Bus1_RxD_2_sig : STD_LOGIC := '1';
278 signal Bus1_RxD_3_sig : STD_LOGIC := '1';
279 signal Bus2_RxD_0_sig : STD_LOGIC := '1';
280 signal Bus2_RxD_1_sig : STD_LOGIC := '1';
281 signal Bus2_RxD_2_sig : STD_LOGIC := '1';
282 signal Bus2_RxD_3_sig : STD_LOGIC := '1';
283 signal Busy0_sig : STD_LOGIC := '0';
284 signal Busy1_sig : STD_LOGIC := '0';
285 signal Busy2_sig : STD_LOGIC := '0';
286 signal Busy3_sig : STD_LOGIC := '0';
287
288 --Input/Output Pins
289 signal W_D_sig : STD_LOGIC_VECTOR(15 downto 0) := (others => '0');
290 signal W_T_sig : STD_LOGIC_VECTOR(3 downto 0) := (others => '0');
291 signal SIO_sig : STD_LOGIC := '0';
292
293 --Outputs
294 signal W_A_sig : STD_LOGIC_VECTOR(9 downto 0);
295 signal W_CS_sig : STD_LOGIC;
296 signal W_RD_sig : STD_LOGIC;
297 signal W_WR_sig : STD_LOGIC;
298 signal W_RES_sig : STD_LOGIC;
299 signal S_CLK_sig : STD_LOGIC;
300 signal TS_CS_sig : STD_LOGIC_VECTOR(3 downto 0);
301 signal LED_red_sig : STD_LOGIC_VECTOR(3 downto 0);
302 signal LED_ye_sig : STD_LOGIC_VECTOR(1 downto 0);
303 signal LED_gn_sig : STD_LOGIC_VECTOR(1 downto 0);
304 signal CLK_Clk_Cond_sig : STD_LOGIC;
305 signal LE_Clk_Cond_sig : STD_LOGIC;
306 signal DATA_Clk_Cond_sig : STD_LOGIC;
307 signal SYNC_Clk_Cond_sig : STD_LOGIC;
308 signal Bus1_Tx_En_sig : STD_LOGIC;
309 signal Bus1_Rx_En_sig : STD_LOGIC;
310 signal Bus1_TxD_0_sig : STD_LOGIC;
311 signal Bus1_TxD_1_sig : STD_LOGIC;
312 signal Bus1_TxD_2_sig : STD_LOGIC;
313 signal Bus1_TxD_3_sig : STD_LOGIC;
314 signal Bus2_Tx_En_sig : STD_LOGIC;
315 signal Bus2_Rx_En_sig : STD_LOGIC;
316 signal Bus2_TxD_0_sig : STD_LOGIC;
317 signal Bus2_TxD_1_sig : STD_LOGIC;
318 signal Bus2_TxD_2_sig : STD_LOGIC;
319 signal Bus2_TxD_3_sig : STD_LOGIC;
320 signal Crate_Res0_sig : STD_LOGIC;
321 signal Crate_Res1_sig : STD_LOGIC;
322 signal Crate_Res2_sig : STD_LOGIC;
323 signal Crate_Res3_sig : STD_LOGIC;
324 signal RES_p_sig : STD_LOGIC;
325 signal RES_n_sig : STD_LOGIC;
326 signal TRG_p_sig : STD_LOGIC;
327 signal TRG_n_sig : STD_LOGIC;
328 signal TIM_Run_p_sig : STD_LOGIC;
329 signal TIM_Run_n_sig : STD_LOGIC;
330 signal TIM_Sel_sig : STD_LOGIC;
331 signal Cal_0_p_sig : STD_LOGIC;
332 signal Cal_0_n_sig : STD_LOGIC;
333 signal Cal_1_p_sig : STD_LOGIC;
334 signal Cal_1_n_sig : STD_LOGIC;
335 signal Cal_2_p_sig : STD_LOGIC;
336 signal Cal_2_n_sig : STD_LOGIC;
337 signal Cal_3_p_sig : STD_LOGIC;
338 signal Cal_3_n_sig : STD_LOGIC;
339 signal Cal_4_p_sig : STD_LOGIC;
340 signal Cal_4_n_sig : STD_LOGIC;
341 signal Cal_5_p_sig : STD_LOGIC;
342 signal Cal_5_n_sig : STD_LOGIC;
343 signal Cal_6_p_sig : STD_LOGIC;
344 signal Cal_6_n_sig : STD_LOGIC;
345 signal Cal_7_p_sig : STD_LOGIC;
346 signal Cal_7_n_sig : STD_LOGIC;
347
348 -- Clock period definitions
349 constant clk_period : TIME := 25 ns; -- 40 MHZ oscillator U47
350
351begin
352
353 -- Instantiate the Unit Under Test (UUT)
354 uut: FTM_top
355 port map(
356 clk => clk_sig,
357 W_D => W_D_sig,
358 W_A => W_A_sig,
359 W_CS => W_CS_sig,
360 W_INT => W_INT_sig,
361 W_RD => W_RD_sig,
362 W_WR => W_WR_sig,
363 W_RES => W_RES_sig,
364-- W_BRDY => W_BRDY_sig,
365-- W_T => W_T_sig,
366-- S_CLK => S_CLK_sig,
367-- SIO => SIO_sig,
368-- TS_CS => TS_CS_sig,
369-- Trig_Prim_A => Trig_Prim_A_sig,
370-- Trig_Prim_B => Trig_Prim_B_sig,
371-- Trig_Prim_C => Trig_Prim_C_sig,
372-- Trig_Prim_D => Trig_Prim_D_sig,
373-- ext_Trig => ext_Trig_sig,
374-- Veto => Veto_sig,
375-- NIM_In => NIM_In_sig,
376-- NIM_In3_GCLK => NIM_In3_GCLK_sig,
377 LED_red => LED_red_sig,
378 LED_ye => LED_ye_sig,
379 LED_gn => LED_gn_sig,
380-- CLK_Clk_Cond => CLK_Clk_Cond_sig,
381-- LE_Clk_Cond => LE_Clk_Cond_sig,
382-- DATA_Clk_Cond => DATA_Clk_Cond_sig,
383-- SYNC_Clk_Cond => SYNC_Clk_Cond_sig,
384-- LD_Clk_Cond => LD_Clk_Cond_sig,
385 Bus1_Tx_En => Bus1_Tx_En_sig,
386 Bus1_Rx_En => Bus1_Rx_En_sig,
387 Bus1_RxD_0 => Bus1_RxD_0_sig,
388 Bus1_TxD_0 => Bus1_TxD_0_sig,
389 Bus1_RxD_1 => Bus1_RxD_1_sig,
390 Bus1_TxD_1 => Bus1_TxD_1_sig,
391 Bus1_RxD_2 => Bus1_RxD_2_sig,
392 Bus1_TxD_2 => Bus1_TxD_2_sig,
393 Bus1_RxD_3 => Bus1_RxD_3_sig,
394 Bus1_TxD_3 => Bus1_TxD_3_sig
395-- Bus2_Tx_En => Bus2_Tx_En_sig,
396-- Bus2_Rx_En => Bus2_Rx_En_sig,
397-- Bus2_RxD_0 => Bus2_RxD_0_sig,
398-- Bus2_TxD_0 => Bus2_TxD_0_sig,
399-- Bus2_RxD_1 => Bus2_RxD_1_sig,
400-- Bus2_TxD_1 => Bus2_TxD_1_sig,
401-- Bus2_RxD_2 => Bus2_RxD_2_sig,
402-- Bus2_TxD_2 => Bus2_TxD_2_sig,
403-- Bus2_RxD_3 => Bus2_RxD_3_sig,
404-- Bus2_TxD_3 => Bus2_TxD_3_sig,
405-- Crate_Res0 => Crate_Res0_sig,
406-- Crate_Res1 => Crate_Res1_sig,
407-- Crate_Res2 => Crate_Res2_sig,
408-- Crate_Res3 => Crate_Res3_sig,
409-- Busy0 => Busy0_sig,
410-- Busy1 => Busy1_sig,
411-- Busy2 => Busy2_sig,
412-- Busy3 => Busy3_sig,
413-- RES_p => RES_p_sig,
414-- RES_n => RES_n_sig,
415-- TRG_p => TRG_p_sig,
416-- TRG_n => TRG_n_sig,
417-- TIM_Run_p => TIM_Run_p_sig,
418-- TIM_Run_n => TIM_Run_n_sig,
419-- TIM_Sel => TIM_Sel_sig,
420-- Cal_0_p => Cal_0_p_sig,
421-- Cal_0_n => Cal_0_n_sig,
422-- Cal_1_p => Cal_1_p_sig,
423-- Cal_1_n => Cal_1_n_sig,
424-- Cal_2_p => Cal_2_p_sig,
425-- Cal_2_n => Cal_2_n_sig,
426-- Cal_3_p => Cal_3_p_sig,
427-- Cal_3_n => Cal_3_n_sig,
428-- Cal_4_p => Cal_4_p_sig,
429-- Cal_4_n => Cal_4_n_sig,
430-- Cal_5_p => Cal_5_p_sig,
431-- Cal_5_n => Cal_5_n_sig,
432-- Cal_6_p => Cal_6_p_sig,
433-- Cal_6_n => Cal_6_n_sig,
434-- Cal_7_p => Cal_7_p_sig,
435-- Cal_7_n => Cal_7_n_sig
436 );
437
438 -- Stimulus process for clock
439 clk_proc: process
440 begin
441 clk_sig <= '0';
442 wait for clk_period/2;
443 clk_sig <= '1';
444 wait for clk_period/2;
445 end process clk_proc;
446
447end;
Note: See TracBrowser for help on using the repository browser.