source: firmware/FTM/FTM_top_tb.vhd@ 10703

Last change on this file since 10703 was 10418, checked in by weitzel, 14 years ago
New FTM firmare: dna, fad_broadcast, FTU error messages, rates readout
File size: 21.7 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 --constant baud_rate_period : TIME := 4 us; -- 250 kHz baud rate
351 constant baud_rate_period : TIME := 100 ns; -- 10 MHz baud rate
352
353begin
354
355 -- Instantiate the Unit Under Test (UUT)
356 uut: FTM_top
357 port map(
358 clk => clk_sig,
359 W_D => W_D_sig,
360 W_A => W_A_sig,
361 W_CS => W_CS_sig,
362 W_INT => W_INT_sig,
363 W_RD => W_RD_sig,
364 W_WR => W_WR_sig,
365 W_RES => W_RES_sig,
366-- W_BRDY => W_BRDY_sig,
367-- W_T => W_T_sig,
368-- S_CLK => S_CLK_sig,
369-- SIO => SIO_sig,
370-- TS_CS => TS_CS_sig,
371 Trig_Prim_A => Trig_Prim_A_sig,
372 Trig_Prim_B => Trig_Prim_B_sig,
373 Trig_Prim_C => Trig_Prim_C_sig,
374 Trig_Prim_D => Trig_Prim_D_sig,
375 ext_Trig => ext_Trig_sig,
376 Veto => Veto_sig,
377-- NIM_In => NIM_In_sig,
378-- NIM_In3_GCLK => NIM_In3_GCLK_sig,
379 LED_red => LED_red_sig,
380 LED_ye => LED_ye_sig,
381 LED_gn => LED_gn_sig,
382 CLK_Clk_Cond => CLK_Clk_Cond_sig,
383 LE_Clk_Cond => LE_Clk_Cond_sig,
384 DATA_Clk_Cond => DATA_Clk_Cond_sig,
385 SYNC_Clk_Cond => SYNC_Clk_Cond_sig,
386 LD_Clk_Cond => LD_Clk_Cond_sig,
387 Bus1_Tx_En => Bus1_Tx_En_sig,
388 Bus1_Rx_En => Bus1_Rx_En_sig,
389 Bus1_RxD_0 => Bus1_RxD_0_sig,
390 Bus1_TxD_0 => Bus1_TxD_0_sig,
391 Bus1_RxD_1 => Bus1_RxD_1_sig,
392 Bus1_TxD_1 => Bus1_TxD_1_sig,
393 Bus1_RxD_2 => Bus1_RxD_2_sig,
394 Bus1_TxD_2 => Bus1_TxD_2_sig,
395 Bus1_RxD_3 => Bus1_RxD_3_sig,
396 Bus1_TxD_3 => Bus1_TxD_3_sig,
397 Bus2_Tx_En => Bus2_Tx_En_sig,
398 Bus2_Rx_En => Bus2_Rx_En_sig,
399 Bus2_RxD_0 => Bus2_RxD_0_sig,
400 Bus2_TxD_0 => Bus2_TxD_0_sig,
401 Bus2_RxD_1 => Bus2_RxD_1_sig,
402 Bus2_TxD_1 => Bus2_TxD_1_sig,
403 Bus2_RxD_2 => Bus2_RxD_2_sig,
404 Bus2_TxD_2 => Bus2_TxD_2_sig,
405 Bus2_RxD_3 => Bus2_RxD_3_sig,
406 Bus2_TxD_3 => Bus2_TxD_3_sig,
407-- Crate_Res0 => Crate_Res0_sig,
408-- Crate_Res1 => Crate_Res1_sig,
409-- Crate_Res2 => Crate_Res2_sig,
410-- Crate_Res3 => Crate_Res3_sig,
411 Busy0 => Busy0_sig,
412 Busy1 => Busy1_sig,
413 Busy2 => Busy2_sig,
414 Busy3 => Busy3_sig,
415-- RES_p => RES_p_sig,
416-- RES_n => RES_n_sig,
417 TRG_p => TRG_p_sig,
418 TRG_n => TRG_n_sig,
419 TIM_Run_p => TIM_Run_p_sig,
420 TIM_Run_n => TIM_Run_n_sig
421-- TIM_Sel => TIM_Sel_sig,
422-- Cal_0_p => Cal_0_p_sig,
423-- Cal_0_n => Cal_0_n_sig,
424-- Cal_1_p => Cal_1_p_sig,
425-- Cal_1_n => Cal_1_n_sig,
426-- Cal_2_p => Cal_2_p_sig,
427-- Cal_2_n => Cal_2_n_sig,
428-- Cal_3_p => Cal_3_p_sig,
429-- Cal_3_n => Cal_3_n_sig,
430-- Cal_4_p => Cal_4_p_sig,
431-- Cal_4_n => Cal_4_n_sig,
432-- Cal_5_p => Cal_5_p_sig,
433-- Cal_5_n => Cal_5_n_sig,
434-- Cal_6_p => Cal_6_p_sig,
435-- Cal_6_n => Cal_6_n_sig,
436-- Cal_7_p => Cal_7_p_sig,
437-- Cal_7_n => Cal_7_n_sig
438 );
439
440 -- Stimulus process for clock
441 clk_proc: process
442 begin
443 clk_sig <= '0';
444 wait for clk_period/2;
445 clk_sig <= '1';
446 wait for clk_period/2;
447 end process clk_proc;
448
449 -- Stimulus process for busy signals
450 busy_proc: process
451 begin
452 wait for 500us;
453 Busy0_sig <= '1';
454 wait for 100us;
455 Busy0_sig <= '0';
456-- wait for 1ms;
457-- Busy0_sig <= '1';
458-- wait for 500us;
459-- Busy0_sig <= '0';
460 wait;
461 end process busy_proc;
462
463 -- Stimulus process for trigger
464 trigger_proc: process
465 begin
466 ---------------------------------------------------------------------------
467 -- FTUs not yet initialized
468 ---------------------------------------------------------------------------
469 wait for 10us;
470 Trig_Prim_A_sig(0) <= '1';
471 wait for 100ns;
472 Trig_Prim_A_sig(0) <= '0';
473 wait for 99us;
474 Trig_Prim_B_sig(0) <= '1';
475 wait for 100ns;
476 Trig_Prim_B_sig(0) <= '0';
477 wait for 1us;
478 Trig_Prim_B_sig(0) <= '1';
479 wait for 100ns;
480 Trig_Prim_B_sig(0) <= '0';
481 ---------------------------------------------------------------------------
482 -- now FTUs are initialized
483 ---------------------------------------------------------------------------
484 wait for 2200us;
485 Trig_Prim_A_sig(0) <= '1';
486 Trig_Prim_B_sig(0) <= '1';
487 wait for 100ns;
488 Trig_Prim_A_sig(0) <= '0';
489 Trig_Prim_B_sig(0) <= '0';
490 wait for 4us;
491 Trig_Prim_A_sig(0) <= '1';
492 wait for 100ns;
493 Trig_Prim_A_sig(0) <= '0';
494 wait for 22us;
495 Trig_Prim_B_sig(0) <= '1';
496 wait for 100ns;
497 Trig_Prim_B_sig(0) <= '0';
498 wait;
499 end process trigger_proc;
500
501 -- Stimulus process for RS485 of crate 0
502 rs485_0_proc: process
503
504 procedure assign_rs485_0 (data: std_logic_vector(7 downto 0)) is
505 begin
506 Bus1_RxD_0_sig <= '0'; --start bit
507 wait for baud_rate_period;
508 Bus1_RxD_0_sig <= data(0); --bit 0
509 wait for baud_rate_period;
510 Bus1_RxD_0_sig <= data(1); --bit 1
511 wait for baud_rate_period;
512 Bus1_RxD_0_sig <= data(2); --bit 2
513 wait for baud_rate_period;
514 Bus1_RxD_0_sig <= data(3); --bit 3
515 wait for baud_rate_period;
516 Bus1_RxD_0_sig <= data(4); --bit 4
517 wait for baud_rate_period;
518 Bus1_RxD_0_sig <= data(5); --bit 5
519 wait for baud_rate_period;
520 Bus1_RxD_0_sig <= data(6); --bit 6
521 wait for baud_rate_period;
522 Bus1_RxD_0_sig <= data(7); --bit 7
523 wait for baud_rate_period;
524 Bus1_RxD_0_sig <= '1'; --stop bit
525 wait for baud_rate_period;
526 Bus1_RxD_0_sig <= '1'; --stop bit
527 wait for baud_rate_period;
528 end assign_rs485_0;
529
530 begin
531 ---------------------------------------------------------------------------
532 -- time of FTU answer
533 ---------------------------------------------------------------------------
534 wait for 1.24ms;
535 ---------------------------------------------------------------------------
536 -- data package of FTU answer (28 byte)
537 ---------------------------------------------------------------------------
538 assign_rs485_0(X"40"); --start delimiter
539 wait for 0us;
540 assign_rs485_0(X"C0"); --FTM address
541 wait for 0ns;
542 assign_rs485_0(X"00"); --FTU address
543 wait for 0ns;
544 assign_rs485_0(X"01"); --FTM firmware ID
545 wait for 0ns;
546 assign_rs485_0(X"02"); --instruction
547 wait for 0us;
548 assign_rs485_0(X"00"); --data byte 01
549 wait for 0ns;
550 assign_rs485_0(X"F0"); --data byte 02
551 wait for 0ns;
552 assign_rs485_0(X"00"); --data byte 03
553 wait for 0ns;
554 assign_rs485_0(X"00"); --data byte 04
555 wait for 0ns;
556 assign_rs485_0(X"00"); --data byte 05
557 wait for 0ns;
558 assign_rs485_0(X"00"); --data byte 06
559 wait for 0ns;
560 assign_rs485_0(X"00"); --data byte 07
561 wait for 0ns;
562 assign_rs485_0(X"00"); --data byte 08
563 wait for 0ns;
564 assign_rs485_0(X"00"); --data byte 09
565 wait for 0ns;
566 assign_rs485_0(X"00"); --data byte 10
567 wait for 0ns;
568 assign_rs485_0(X"00"); --data byte 11
569 wait for 0ns;
570 assign_rs485_0(X"00"); --data byte 12
571 wait for 0ns;
572 assign_rs485_0(X"00"); --data byte 13
573 wait for 0ns;
574 assign_rs485_0(X"00"); --data byte 14
575 wait for 0ns;
576 assign_rs485_0(X"00"); --data byte 15
577 wait for 0ns;
578 assign_rs485_0(X"00"); --data byte 16
579 wait for 0ns;
580 assign_rs485_0(X"00"); --data byte 17
581 wait for 0ns;
582 assign_rs485_0(X"00"); --data byte 18
583 wait for 0ns;
584 assign_rs485_0(X"00"); --data byte 19
585 wait for 0ns;
586 assign_rs485_0(X"00"); --data byte 20
587 wait for 0ns;
588 assign_rs485_0(X"00"); --data byte 21
589 wait for 0ns;
590 assign_rs485_0(X"00"); --CRC error counter (not used)
591 wait for 0ns;
592 assign_rs485_0(X"98"); --check sum for rates
593 --assign_rs485_0(X"A5"); --check sum for ping
594 ---------------------------------------------------------------------------
595 -- don't forget final wait!
596 ---------------------------------------------------------------------------
597 wait;
598
599 end process rs485_0_proc;
600
601end;
Note: See TracBrowser for help on using the repository browser.