##// END OF EJS Templates
debug EQM...
pellion -
r570:0b1aedcd4196 JC
parent child
Show More
@@ -0,0 +1,73
1 LIBRARY IEEE;
2 USE IEEE.STD_LOGIC_1164.ALL;
3 USE IEEE.NUMERIC_STD.ALL;
4
5 ENTITY fine_time_max_value_gen IS
6
7 PORT (
8 clk : IN STD_LOGIC;
9 rstn : IN STD_LOGIC;
10 tick : IN STD_LOGIC;
11 fine_time_add : IN STD_LOGIC;
12 fine_time_max_value : OUT STD_LOGIC_VECTOR(8 DOWNTO 0)
13 );
14
15 END fine_time_max_value_gen;
16
17 ARCHITECTURE beh OF fine_time_max_value_gen IS
18
19 SIGNAL count_even : STD_LOGIC;
20 SIGNAL count_first : STD_LOGIC;
21 SIGNAL count_modulo_33 : STD_LOGIC;
22
23
24 SIGNAL count_33 : INTEGER range 0 TO 32;
25
26 BEGIN -- beh
27
28 fine_time_max_value <= STD_LOGIC_VECTOR(to_unsigned(381,9)) WHEN count_first = '1' ELSE
29 STD_LOGIC_VECTOR(to_unsigned(380,9)) WHEN count_even = count_modulo_33 ELSE
30 STD_LOGIC_VECTOR(to_unsigned(381,9)) WHEN count_even = '1' ELSE
31 STD_LOGIC_VECTOR(to_unsigned(379,9)) WHEN count_modulo_33 = '1' ELSE
32 STD_LOGIC_VECTOR(to_unsigned(380,9));
33
34
35
36 PROCESS (clk, rstn)
37 BEGIN -- PROCESS
38 IF rstn = '0' THEN -- asynchronous reset (active low)
39 count_first <= '1';
40 count_even <= '0';
41 count_modulo_33 <= '0';
42 count_33 <= 0;
43 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
44 IF tick = '1' THEN
45 count_even <= '0';
46 count_first <= '1';
47 count_modulo_33 <= '0';
48 count_33 <= 0;
49 ELSE
50 IF fine_time_add = '1' THEN
51 count_first <= '0';
52 IF count_even = '1' THEN
53 count_even <= '0';
54 ELSE
55 count_even <= '1';
56 END IF;
57 IF count_33 = 31 THEN
58 count_modulo_33 <= '1';
59 ELSE
60 count_modulo_33 <= '0';
61 END IF;
62
63 IF count_33 = 32 THEN
64 count_33 <= 0;
65 ELSE
66 count_33 <= count_33 + 1;
67 END IF;
68 END IF;
69 END IF;
70 END IF;
71 END PROCESS;
72
73 END beh;
@@ -35,4 +35,7 fftDp.vhd
35 fft_components.vhd
35 fft_components.vhd
36 CoreFFT.vhd
36 CoreFFT.vhd
37 actram.vhd
37 actram.vhd
38 actar.vhd No newline at end of file
38 actar.vhd
39 *.bak
40 *.pdc.ce
41 *.zip
@@ -80,8 +80,8 set_io TAG2 -pinname K12 -fixed yes -D
80 set_io TAG3 -pinname K13 -fixed yes -DIRECTION Inout
80 set_io TAG3 -pinname K13 -fixed yes -DIRECTION Inout
81 set_io TAG4 -pinname L16 -fixed yes -DIRECTION Inout
81 set_io TAG4 -pinname L16 -fixed yes -DIRECTION Inout
82 #set_io TAG5 -pinname L15 -fixed yes -DIRECTION Inout
82 #set_io TAG5 -pinname L15 -fixed yes -DIRECTION Inout
83 #set_io TAG6 -pinname M16 -fixed yes -DIRECTION Inout
83 set_io TAG6 -pinname M16 -fixed yes -DIRECTION Inout
84 #set_io TAG7 -pinname J14 -fixed yes -DIRECTION Inout
84 set_io TAG7 -pinname J14 -fixed yes -DIRECTION Inout
85 set_io TAG8 -pinname K15 -fixed yes -DIRECTION Inout
85 set_io TAG8 -pinname K15 -fixed yes -DIRECTION Inout
86 #set_io TAG9 -pinname J17 -fixed yes -DIRECTION Inout
86 #set_io TAG9 -pinname J17 -fixed yes -DIRECTION Inout
87
87
@@ -3,11 +3,12
3 # Clocks
3 # Clocks
4
4
5 create_clock -period 20.000000 -waveform {0.000000 10.000000} clk50MHz
5 create_clock -period 20.000000 -waveform {0.000000 10.000000} clk50MHz
6 create_clock -period 40.000000 -waveform {0.000000 20.000000} clk_25
6 create_clock -period 20.344999 -waveform {0.000000 10.172500} clk49_152MHz
7
7
8
9
10 #create_clock -period 40.000000 -waveform {0.000000 20.000000} clk_25
8 #create_generated_clock -name{clk_domain_25} -divide_by 2 -source{clk_25_int:CLK}{clk_25_int:Q}
11 #create_generated_clock -name{clk_domain_25} -divide_by 2 -source{clk_25_int:CLK}{clk_25_int:Q}
9
10 #create_clock -period 20.344999 -waveform {0.000000 10.172500} clk49_152MHz
11 #create_clock -period 40.690000 -waveform {0.000000 20.345100} clk_24:Q
12 #create_clock -period 40.690000 -waveform {0.000000 20.345100} clk_24:Q
12 #create_clock -name SPW_CLOCK -period 100.000000 -waveform {0.000000 50.000000} {spw1_din spw1_sin spw2_din spw2_sin}
13 #create_clock -name SPW_CLOCK -period 100.000000 -waveform {0.000000 50.000000} {spw1_din spw1_sin spw2_din spw2_sin}
13
14
@@ -49,6 +49,8 library proasic3l;
49 use proasic3l.all;
49 use proasic3l.all;
50
50
51 ENTITY LFR_EQM IS
51 ENTITY LFR_EQM IS
52 GENERIC (
53 Mem_use : INTEGER := use_RAM);
52
54
53 PORT (
55 PORT (
54 clk50MHz : IN STD_ULOGIC;
56 clk50MHz : IN STD_ULOGIC;
@@ -216,7 +218,8 BEGIN -- beh
216 NB_AHB_SLAVE => NB_AHB_SLAVE,
218 NB_AHB_SLAVE => NB_AHB_SLAVE,
217 NB_APB_SLAVE => NB_APB_SLAVE,
219 NB_APB_SLAVE => NB_APB_SLAVE,
218 ADDRESS_SIZE => 19,
220 ADDRESS_SIZE => 19,
219 USES_IAP_MEMCTRLR => 1)
221 USES_IAP_MEMCTRLR => 1,
222 BYPASS_EDAC_MEMCTRLR => '1')
220 PORT MAP (
223 PORT MAP (
221 clk => clk_25,
224 clk => clk_25,
222 reset => rstn_25,
225 reset => rstn_25,
@@ -259,13 +262,13 BEGIN -- beh
259 pindex => 6,
262 pindex => 6,
260 paddr => 6,
263 paddr => 6,
261 pmask => 16#fff#,
264 pmask => 16#fff#,
262 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
265 --FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
263 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
266 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
264 PORT MAP (
267 PORT MAP (
265 clk25MHz => clk_25,
268 clk25MHz => clk_25,
266 resetn_25MHz => rstn_25, -- TODO
269 resetn_25MHz => rstn_25, -- TODO
267 clk24_576MHz => clk_24, -- 49.152MHz/2
270 --clk24_576MHz => clk_24, -- 49.152MHz/2
268 resetn_24_576MHz => rstn_24, -- TODO
271 --resetn_24_576MHz => rstn_24, -- TODO
269
272
270 grspw_tick => swno.tickout,
273 grspw_tick => swno.tickout,
271 apbi => apbi_ext,
274 apbi => apbi_ext,
@@ -388,7 +391,7 BEGIN -- beh
388
391
389 lpp_lfr_1 : lpp_lfr
392 lpp_lfr_1 : lpp_lfr
390 GENERIC MAP (
393 GENERIC MAP (
391 Mem_use => use_RAM,
394 Mem_use => Mem_use,
392 nb_data_by_buffer_size => 32,
395 nb_data_by_buffer_size => 32,
393 --nb_word_by_buffer_size => 30,
396 --nb_word_by_buffer_size => 30,
394 nb_snapshot_param_size => 32,
397 nb_snapshot_param_size => 32,
@@ -23,7 +23,7 SDC=$(VHDLIB)/boards/$(BOARD)/LFR_EQM_pl
23 BITGEN=$(VHDLIB)/boards/$(BOARD)/default.ut
23 BITGEN=$(VHDLIB)/boards/$(BOARD)/default.ut
24 CLEAN=soft-clean
24 CLEAN=soft-clean
25
25
26 TECHLIBS = proasic3e
26 TECHLIBS = proasic3l
27
27
28 LIBSKIP = core1553bbc core1553brm core1553brt gr1553 corePCIF \
28 LIBSKIP = core1553bbc core1553brm core1553brt gr1553 corePCIF \
29 tmtc openchip hynix ihp gleichmann micron usbhc
29 tmtc openchip hynix ihp gleichmann micron usbhc
@@ -113,6 +113,16 END MINI_LFR_top;
113
113
114
114
115 ARCHITECTURE beh OF MINI_LFR_top IS
115 ARCHITECTURE beh OF MINI_LFR_top IS
116
117 --==========================================================================
118 -- USE_IAP_MEMCTRL allow to use the srctrle-0ws on MINILFR board
119 -- when enabled, chip enable polarity should be reversed and bank size also
120 -- MINILFR -> 1 bank of 4MBytes -> SRBANKSZ=9
121 -- LFR EQM & FM -> 2 banks of 2MBytes -> SRBANKSZ=8
122 --==========================================================================
123 CONSTANT USE_IAP_MEMCTRL : integer := 1;
124 --==========================================================================
125
116 SIGNAL clk_50_s : STD_LOGIC := '0';
126 SIGNAL clk_50_s : STD_LOGIC := '0';
117 SIGNAL clk_25 : STD_LOGIC := '0';
127 SIGNAL clk_25 : STD_LOGIC := '0';
118 SIGNAL clk_24 : STD_LOGIC := '0';
128 SIGNAL clk_24 : STD_LOGIC := '0';
@@ -357,7 +367,8 BEGIN -- beh
357 NB_AHB_SLAVE => NB_AHB_SLAVE,
367 NB_AHB_SLAVE => NB_AHB_SLAVE,
358 NB_APB_SLAVE => NB_APB_SLAVE,
368 NB_APB_SLAVE => NB_APB_SLAVE,
359 ADDRESS_SIZE => 20,
369 ADDRESS_SIZE => 20,
360 USES_IAP_MEMCTRLR => 0)
370 USES_IAP_MEMCTRLR => USE_IAP_MEMCTRL,
371 SRBANKSZ => 9)
361 PORT MAP (
372 PORT MAP (
362 clk => clk_25,
373 clk => clk_25,
363 reset => rstn_25,
374 reset => rstn_25,
@@ -375,7 +386,7 BEGIN -- beh
375 nSRAM_WE => SRAM_nWE,
386 nSRAM_WE => SRAM_nWE,
376 nSRAM_CE => SRAM_CE_s,
387 nSRAM_CE => SRAM_CE_s,
377 nSRAM_OE => SRAM_nOE,
388 nSRAM_OE => SRAM_nOE,
378 nSRAM_READY => '0',
389 nSRAM_READY => '1',
379 SRAM_MBE => OPEN,
390 SRAM_MBE => OPEN,
380 apbi_ext => apbi_ext,
391 apbi_ext => apbi_ext,
381 apbo_ext => apbo_ext,
392 apbo_ext => apbo_ext,
@@ -384,7 +395,13 BEGIN -- beh
384 ahbi_m_ext => ahbi_m_ext,
395 ahbi_m_ext => ahbi_m_ext,
385 ahbo_m_ext => ahbo_m_ext);
396 ahbo_m_ext => ahbo_m_ext);
386
397
387 SRAM_CE <= SRAM_CE_s(0);
398 IAP:if USE_IAP_MEMCTRL = 1 GENERATE
399 SRAM_CE <= not SRAM_CE_s(0);
400 END GENERATE;
401
402 NOIAP:if USE_IAP_MEMCTRL = 0 GENERATE
403 SRAM_CE <= SRAM_CE_s(0);
404 END GENERATE;
388 -------------------------------------------------------------------------------
405 -------------------------------------------------------------------------------
389 -- APB_LFR_MANAGEMENT ---------------------------------------------------------
406 -- APB_LFR_MANAGEMENT ---------------------------------------------------------
390 -------------------------------------------------------------------------------
407 -------------------------------------------------------------------------------
@@ -41,15 +41,15 ENTITY apb_lfr_management IS
41 pindex : INTEGER := 0; --! APB slave index
41 pindex : INTEGER := 0; --! APB slave index
42 paddr : INTEGER := 0; --! ADDR field of the APB BAR
42 paddr : INTEGER := 0; --! ADDR field of the APB BAR
43 pmask : INTEGER := 16#fff#; --! MASK field of the APB BAR
43 pmask : INTEGER := 16#fff#; --! MASK field of the APB BAR
44 FIRST_DIVISION : INTEGER := 374;
44 -- FIRST_DIVISION : INTEGER := 374;
45 NB_SECOND_DESYNC : INTEGER := 60
45 NB_SECOND_DESYNC : INTEGER := 60
46 );
46 );
47
47
48 PORT (
48 PORT (
49 clk25MHz : IN STD_LOGIC; --! Clock
49 clk25MHz : IN STD_LOGIC; --! Clock
50 resetn_25MHz : IN STD_LOGIC; --! Reset
50 resetn_25MHz : IN STD_LOGIC; --! Reset
51 clk24_576MHz : IN STD_LOGIC; --! secondary clock
51 -- clk24_576MHz : IN STD_LOGIC; --! secondary clock
52 resetn_24_576MHz : IN STD_LOGIC; --! Reset
52 -- resetn_24_576MHz : IN STD_LOGIC; --! Reset
53
53
54 grspw_tick : IN STD_LOGIC; --! grspw signal asserted when a valid time-code is received
54 grspw_tick : IN STD_LOGIC; --! grspw signal asserted when a valid time-code is received
55
55
@@ -304,6 +304,19 BEGIN
304 apbo.pconfig <= pconfig;
304 apbo.pconfig <= pconfig;
305 apbo.pindex <= pindex;
305 apbo.pindex <= pindex;
306
306
307
308
309
310
311
312
313
314
315
316
317
318
319
307 -----------------------------------------------------------------------------
320 -----------------------------------------------------------------------------
308 -- IN
321 -- IN
309 coarse_time <= r.coarse_time;
322 coarse_time <= r.coarse_time;
@@ -320,109 +333,87 BEGIN
320 -----------------------------------------------------------------------------
333 -----------------------------------------------------------------------------
321 tick <= grspw_tick OR soft_tick;
334 tick <= grspw_tick OR soft_tick;
322
335
323 SYNC_VALID_BIT_1 : SYNC_VALID_BIT
336 --SYNC_VALID_BIT_1 : SYNC_VALID_BIT
324 GENERIC MAP (
337 -- GENERIC MAP (
325 NB_FF_OF_SYNC => 2)
338 -- NB_FF_OF_SYNC => 2)
326 PORT MAP (
339 -- PORT MAP (
327 clk_in => clk25MHz,
340 -- clk_in => clk25MHz,
328 rstn_in => resetn_25MHz,
341 -- rstn_in => resetn_25MHz,
329 clk_out => clk24_576MHz,
342 -- clk_out => clk24_576MHz,
330 rstn_out => resetn_24_576MHz,
343 -- rstn_out => resetn_24_576MHz,
331 sin => tick,
344 -- sin => tick,
332 sout => new_timecode);
345 -- sout => new_timecode);
346 new_timecode <= tick;
333
347
334 SYNC_VALID_BIT_2 : SYNC_VALID_BIT
348 --SYNC_VALID_BIT_2 : SYNC_VALID_BIT
335 GENERIC MAP (
336 NB_FF_OF_SYNC => 2)
337 PORT MAP (
338 clk_in => clk25MHz,
339 rstn_in => resetn_25MHz,
340 clk_out => clk24_576MHz,
341 rstn_out => resetn_24_576MHz,
342 sin => coarsetime_reg_updated,
343 sout => new_coarsetime);
344
345 SYNC_VALID_BIT_3 : SYNC_VALID_BIT
346 GENERIC MAP (
347 NB_FF_OF_SYNC => 2)
348 PORT MAP (
349 clk_in => clk25MHz,
350 rstn_in => resetn_25MHz,
351 clk_out => clk24_576MHz,
352 rstn_out => resetn_24_576MHz,
353 sin => soft_reset,
354 sout => soft_reset_sync);
355
356 -----------------------------------------------------------------------------
357 --SYNC_FF_1 : SYNC_FF
358 -- GENERIC MAP (
349 -- GENERIC MAP (
359 -- NB_FF_OF_SYNC => 2)
350 -- NB_FF_OF_SYNC => 2)
360 -- PORT MAP (
351 -- PORT MAP (
361 -- clk => clk25MHz,
352 -- clk_in => clk25MHz,
362 -- rstn => resetn,
353 -- rstn_in => resetn_25MHz,
363 -- A => fine_time_new_49,
354 -- clk_out => clk24_576MHz,
364 -- A_sync => fine_time_new_temp);
355 -- rstn_out => resetn_24_576MHz,
356 -- sin => coarsetime_reg_updated,
357 -- sout => new_coarsetime);
358
359 new_coarsetime <= coarsetime_reg_updated;
360
361 --SYNC_VALID_BIT_3 : SYNC_VALID_BIT
362 -- GENERIC MAP (
363 -- NB_FF_OF_SYNC => 2)
364 -- PORT MAP (
365 -- clk_in => clk25MHz,
366 -- rstn_in => resetn_25MHz,
367 -- clk_out => clk24_576MHz,
368 -- rstn_out => resetn_24_576MHz,
369 -- sin => soft_reset,
370 -- sout => soft_reset_sync);
371
365
372
366 --lpp_front_detection_1 : lpp_front_detection
373 -----------------------------------------------------------------------------
367 -- PORT MAP (
374 time_new_49 <= coarse_time_new_49 OR fine_time_new_49;
368 -- clk => clk25MHz,
369 -- rstn => resetn,
370 -- sin => fine_time_new_temp,
371 -- sout => fine_time_new);
372
375
373 --SYNC_VALID_BIT_4 : SYNC_VALID_BIT
376 --SYNC_VALID_BIT_4 : SYNC_VALID_BIT
374 -- GENERIC MAP (
377 -- GENERIC MAP (
375 -- NB_FF_OF_SYNC => 2)
378 -- NB_FF_OF_SYNC => 2)
376 -- PORT MAP (
379 -- PORT MAP (
377 -- clk_in => clk24_576MHz,
380 -- clk_in => clk24_576MHz,
381 -- rstn_in => resetn_24_576MHz,
378 -- clk_out => clk25MHz,
382 -- clk_out => clk25MHz,
379 -- rstn => resetn,
383 -- rstn_out => resetn_25MHz,
380 -- sin => coarse_time_new_49,
384 -- sin => time_new_49,
381 -- sout => coarse_time_new);
385 -- sout => time_new);
382
383 time_new_49 <= coarse_time_new_49 OR fine_time_new_49;
384
386
385 SYNC_VALID_BIT_4 : SYNC_VALID_BIT
387 time_new <= time_new_49;
386 GENERIC MAP (
387 NB_FF_OF_SYNC => 2)
388 PORT MAP (
389 clk_in => clk24_576MHz,
390 rstn_in => resetn_24_576MHz,
391 clk_out => clk25MHz,
392 rstn_out => resetn_25MHz,
393 sin => time_new_49,
394 sout => time_new);
395
396
397
388
398 PROCESS (clk25MHz, resetn_25MHz)
389 --PROCESS (clk25MHz, resetn_25MHz)
399 BEGIN -- PROCESS
390 --BEGIN -- PROCESS
400 IF resetn_25MHz = '0' THEN -- asynchronous reset (active low)
391 -- IF resetn_25MHz = '0' THEN -- asynchronous reset (active low)
401 fine_time_s <= (OTHERS => '0');
392 -- fine_time_s <= (OTHERS => '0');
402 coarse_time_s <= (OTHERS => '0');
393 -- coarse_time_s <= (OTHERS => '0');
403 ELSIF clk25MHz'EVENT AND clk25MHz = '1' THEN -- rising clock edge
394 -- ELSIF clk25MHz'EVENT AND clk25MHz = '1' THEN -- rising clock edge
404 IF time_new = '1' THEN
395 -- IF time_new = '1' THEN
405 fine_time_s <= fine_time_49;
396 -- END IF;
406 coarse_time_s <= coarse_time_49;
397 -- END IF;
407 END IF;
398 --END PROCESS;
408 END IF;
399
409 END PROCESS;
400 fine_time_s <= fine_time_49;
401 coarse_time_s <= coarse_time_49;
402
410
403
411
404 rstn_LFR_TM <= '0' WHEN resetn_25MHz = '0' ELSE
412 rstn_LFR_TM <= '0' WHEN resetn_24_576MHz = '0' ELSE
405 '0' WHEN soft_reset = '1' ELSE
413 '0' WHEN soft_reset_sync = '1' ELSE
414 '1';
406 '1';
415
407
416
417 -----------------------------------------------------------------------------
408 -----------------------------------------------------------------------------
418 -- LFR_TIME_MANAGMENT
409 -- LFR_TIME_MANAGMENT
419 -----------------------------------------------------------------------------
410 -----------------------------------------------------------------------------
420 lfr_time_management_1 : lfr_time_management
411 lfr_time_management_1 : lfr_time_management
421 GENERIC MAP (
412 GENERIC MAP (
422 FIRST_DIVISION => FIRST_DIVISION,
413 --FIRST_DIVISION => FIRST_DIVISION,
423 NB_SECOND_DESYNC => NB_SECOND_DESYNC)
414 NB_SECOND_DESYNC => NB_SECOND_DESYNC)
424 PORT MAP (
415 PORT MAP (
425 clk => clk24_576MHz,
416 clk => clk25MHz,
426 rstn => rstn_LFR_TM,
417 rstn => rstn_LFR_TM,
427
418
428 tick => new_timecode,
419 tick => new_timecode,
@@ -434,6 +425,8 BEGIN
434 coarse_time => coarse_time_49,
425 coarse_time => coarse_time_49,
435 coarse_time_new => coarse_time_new_49);
426 coarse_time_new => coarse_time_new_49);
436
427
428
429
437 -----------------------------------------------------------------------------
430 -----------------------------------------------------------------------------
438 -- HK
431 -- HK
439 -----------------------------------------------------------------------------
432 -----------------------------------------------------------------------------
@@ -481,6 +474,19 BEGIN
481
474
482 HK_sel <= HK_sel_s;
475 HK_sel <= HK_sel_s;
483
476
477
478
479
480
481
482
483
484
485
486
487
488
489
484 -----------------------------------------------------------------------------
490 -----------------------------------------------------------------------------
485 -- DAC
491 -- DAC
486 -----------------------------------------------------------------------------
492 -----------------------------------------------------------------------------
@@ -514,4 +520,4 BEGIN
514 );
520 );
515
521
516 DAC_CAL_EN <= DAC_CAL_EN_s;
522 DAC_CAL_EN <= DAC_CAL_EN_s;
517 END Behavioral; No newline at end of file
523 END Behavioral;
@@ -110,14 +110,15 BEGIN -- beh
110
110
111 -----------------------------------------------------------------------------
111 -----------------------------------------------------------------------------
112 -- Just to try to limit the constraint
112 -- Just to try to limit the constraint
113 PROCESS (clk, rstn)
113 --PROCESS (clk, rstn)
114 BEGIN -- PROCESS
114 --BEGIN -- PROCESS
115 IF rstn = '0' THEN -- asynchronous reset (active low)
115 -- IF rstn = '0' THEN -- asynchronous reset (active low)
116 set_TCU_reg <= '0';
116 -- set_TCU_reg <= '0';
117 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
117 -- ELSIF clk'event AND clk = '1' THEN -- rising clock edge
118 set_TCU_reg <= set_TCU;
118 -- set_TCU_reg <= set_TCU;
119 END IF;
119 -- END IF;
120 END PROCESS;
120 --END PROCESS;
121 -----------------------------------------------------------------------------
121 -----------------------------------------------------------------------------
122
122 set_TCU_reg <= set_TCU;
123 END beh; No newline at end of file
123
124 END beh;
@@ -4,12 +4,12 USE IEEE.NUMERIC_STD.ALL;
4
4
5 LIBRARY lpp;
5 LIBRARY lpp;
6 USE lpp.general_purpose.ALL;
6 USE lpp.general_purpose.ALL;
7 USE lpp.lpp_lfr_management.ALL;
7
8
8 ENTITY fine_time_counter IS
9 ENTITY fine_time_counter IS
9
10
10 GENERIC (
11 GENERIC (
11 WAITING_TIME : STD_LOGIC_VECTOR(15 DOWNTO 0) := X"0040";
12 WAITING_TIME : STD_LOGIC_VECTOR(15 DOWNTO 0) := X"0040"
12 FIRST_DIVISION : INTEGER := 374
13 );
13 );
14
14
15 PORT (
15 PORT (
@@ -33,12 +33,22 ARCHITECTURE beh OF fine_time_counter IS
33 SIGNAL new_ft_counter : STD_LOGIC_VECTOR(8 DOWNTO 0);
33 SIGNAL new_ft_counter : STD_LOGIC_VECTOR(8 DOWNTO 0);
34 SIGNAL new_ft : STD_LOGIC;
34 SIGNAL new_ft : STD_LOGIC;
35 SIGNAL fine_time_counter : STD_LOGIC_VECTOR(15 DOWNTO 0);
35 SIGNAL fine_time_counter : STD_LOGIC_VECTOR(15 DOWNTO 0);
36
37 SIGNAL fine_time_max_value : STD_LOGIC_VECTOR(8 DOWNTO 0);
38 SIGNAL tick_value_gen : STD_LOGIC;
39 SIGNAL FT_max_s : STD_LOGIC;
36
40
37 -- CONSTANT FIRST_DIVISION : INTEGER := 20; -- TODO : 374
38
39 BEGIN -- beh
41 BEGIN -- beh
40
42
43 tick_value_gen <= tick OR FT_max_s;
41
44
45 fine_time_max_value_gen_1: fine_time_max_value_gen
46 PORT MAP (
47 clk => clk,
48 rstn => rstn,
49 tick => tick_value_gen,
50 fine_time_add => new_ft,
51 fine_time_max_value => fine_time_max_value);
42
52
43 counter_1 : general_counter
53 counter_1 : general_counter
44 GENERIC MAP (
54 GENERIC MAP (
@@ -49,13 +59,13 BEGIN -- beh
49 PORT MAP (
59 PORT MAP (
50 clk => clk,
60 clk => clk,
51 rstn => rstn,
61 rstn => rstn,
52 MAX_VALUE => STD_LOGIC_VECTOR(to_unsigned(FIRST_DIVISION, 9)),
62 MAX_VALUE => fine_time_max_value,
53 set => tick,
63 set => tick,
54 set_value => (OTHERS => '0'),
64 set_value => (OTHERS => '0'),
55 add1 => '1',
65 add1 => '1',
56 counter => new_ft_counter);
66 counter => new_ft_counter);
57
67
58 new_ft <= '1' WHEN new_ft_counter = STD_LOGIC_VECTOR(to_unsigned(FIRST_DIVISION, 9)) ELSE '0';
68 new_ft <= '1' WHEN new_ft_counter = fine_time_max_value ELSE '0';
59
69
60 counter_2 : general_counter
70 counter_2 : general_counter
61 GENERIC MAP (
71 GENERIC MAP (
@@ -72,7 +82,9 BEGIN -- beh
72 add1 => new_ft,
82 add1 => new_ft,
73 counter => fine_time_counter);
83 counter => fine_time_counter);
74
84
75 FT_max <= '1' WHEN new_ft = '1' AND fine_time_counter = X"FFFF" ELSE '0';
85 FT_max_s <= '1' WHEN new_ft = '1' AND fine_time_counter = X"FFFF" ELSE '0';
86
87 FT_max <= FT_max_s;
76 FT_half <= '1' WHEN fine_time_counter > X"7FFF" ELSE '0';
88 FT_half <= '1' WHEN fine_time_counter > X"7FFF" ELSE '0';
77 FT_wait <= '1' WHEN fine_time_counter > WAITING_TIME ELSE '0';
89 FT_wait <= '1' WHEN fine_time_counter > WAITING_TIME ELSE '0';
78
90
@@ -25,7 +25,6 USE lpp.lpp_lfr_management.ALL;
25
25
26 ENTITY lfr_time_management IS
26 ENTITY lfr_time_management IS
27 GENERIC (
27 GENERIC (
28 FIRST_DIVISION : INTEGER := 374;
29 NB_SECOND_DESYNC : INTEGER := 60);
28 NB_SECOND_DESYNC : INTEGER := 60);
30 PORT (
29 PORT (
31 clk : IN STD_LOGIC;
30 clk : IN STD_LOGIC;
@@ -83,8 +82,7 BEGIN
83 -----------------------------------------------------------------------------
82 -----------------------------------------------------------------------------
84 fine_time_counter_1: fine_time_counter
83 fine_time_counter_1: fine_time_counter
85 GENERIC MAP (
84 GENERIC MAP (
86 WAITING_TIME => X"0040",
85 WAITING_TIME => X"0040")
87 FIRST_DIVISION => FIRST_DIVISION)
88 PORT MAP (
86 PORT MAP (
89 clk => clk,
87 clk => clk,
90 rstn => rstn,
88 rstn => rstn,
@@ -1,111 +1,119
1 ----------------------------------------------------------------------------------
1 ----------------------------------------------------------------------------------
2 -- Company:
2 -- Company:
3 -- Engineer:
3 -- Engineer:
4 --
4 --
5 -- Create Date: 13:04:01 07/02/2012
5 -- Create Date: 13:04:01 07/02/2012
6 -- Design Name:
6 -- Design Name:
7 -- Module Name: lpp_lfr_time_management - Behavioral
7 -- Module Name: lpp_lfr_time_management - Behavioral
8 -- Project Name:
8 -- Project Name:
9 -- Target Devices:
9 -- Target Devices:
10 -- Tool versions:
10 -- Tool versions:
11 -- Description:
11 -- Description:
12 --
12 --
13 -- Dependencies:
13 -- Dependencies:
14 --
14 --
15 -- Revision:
15 -- Revision:
16 -- Revision 0.01 - File Created
16 -- Revision 0.01 - File Created
17 -- Additional Comments:
17 -- Additional Comments:
18 --
18 --
19 ----------------------------------------------------------------------------------
19 ----------------------------------------------------------------------------------
20 LIBRARY IEEE;
20 LIBRARY IEEE;
21 USE IEEE.STD_LOGIC_1164.ALL;
21 USE IEEE.STD_LOGIC_1164.ALL;
22 LIBRARY grlib;
22 LIBRARY grlib;
23 USE grlib.amba.ALL;
23 USE grlib.amba.ALL;
24 USE grlib.stdlib.ALL;
24 USE grlib.stdlib.ALL;
25 USE grlib.devices.ALL;
25 USE grlib.devices.ALL;
26
26
27 PACKAGE lpp_lfr_management IS
27 PACKAGE lpp_lfr_management IS
28
28
29 --***************************
29 --***************************
30 -- APB_LFR_MANAGEMENT
30 -- APB_LFR_MANAGEMENT
31
31
32 COMPONENT apb_lfr_management
32 COMPONENT apb_lfr_management
33 GENERIC (
33 GENERIC (
34 tech : INTEGER;
34 tech : INTEGER;
35 pindex : INTEGER;
35 pindex : INTEGER;
36 paddr : INTEGER;
36 paddr : INTEGER;
37 pmask : INTEGER;
37 pmask : INTEGER;
38 FIRST_DIVISION : INTEGER;
38 -- FIRST_DIVISION : INTEGER;
39 NB_SECOND_DESYNC : INTEGER);
39 NB_SECOND_DESYNC : INTEGER);
40 PORT (
40 PORT (
41 clk25MHz : IN STD_LOGIC;
41 clk25MHz : IN STD_LOGIC;
42 resetn_25MHz : IN STD_LOGIC;
42 resetn_25MHz : IN STD_LOGIC;
43 clk24_576MHz : IN STD_LOGIC;
43 -- clk24_576MHz : IN STD_LOGIC;
44 resetn_24_576MHz : IN STD_LOGIC;
44 -- resetn_24_576MHz : IN STD_LOGIC;
45 grspw_tick : IN STD_LOGIC;
45 grspw_tick : IN STD_LOGIC;
46 apbi : IN apb_slv_in_type;
46 apbi : IN apb_slv_in_type;
47 apbo : OUT apb_slv_out_type;
47 apbo : OUT apb_slv_out_type;
48 HK_sample : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
48 HK_sample : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
49 HK_val : IN STD_LOGIC;
49 HK_val : IN STD_LOGIC;
50 HK_sel : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
50 HK_sel : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
51 DAC_SDO : OUT STD_LOGIC;
51 DAC_SDO : OUT STD_LOGIC;
52 DAC_SCK : OUT STD_LOGIC;
52 DAC_SCK : OUT STD_LOGIC;
53 DAC_SYNC : OUT STD_LOGIC;
53 DAC_SYNC : OUT STD_LOGIC;
54 DAC_CAL_EN : OUT STD_LOGIC;
54 DAC_CAL_EN : OUT STD_LOGIC;
55 coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
55 coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
56 fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
56 fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
57 LFR_soft_rstn : OUT STD_LOGIC);
57 LFR_soft_rstn : OUT STD_LOGIC);
58 END COMPONENT;
58 END COMPONENT;
59
59
60 COMPONENT lfr_time_management
60 COMPONENT lfr_time_management
61 GENERIC (
61 GENERIC (
62 FIRST_DIVISION : INTEGER;
62 --FIRST_DIVISION : INTEGER;
63 NB_SECOND_DESYNC : INTEGER);
63 NB_SECOND_DESYNC : INTEGER);
64 PORT (
64 PORT (
65 clk : IN STD_LOGIC;
65 clk : IN STD_LOGIC;
66 rstn : IN STD_LOGIC;
66 rstn : IN STD_LOGIC;
67 tick : IN STD_LOGIC;
67 tick : IN STD_LOGIC;
68 new_coarsetime : IN STD_LOGIC;
68 new_coarsetime : IN STD_LOGIC;
69 coarsetime_reg : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
69 coarsetime_reg : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
70 fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
70 fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
71 fine_time_new : OUT STD_LOGIC;
71 fine_time_new : OUT STD_LOGIC;
72 coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
72 coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
73 coarse_time_new : OUT STD_LOGIC);
73 coarse_time_new : OUT STD_LOGIC);
74 END COMPONENT;
74 END COMPONENT;
75
75
76 COMPONENT coarse_time_counter
76 COMPONENT coarse_time_counter
77 GENERIC (
77 GENERIC (
78 NB_SECOND_DESYNC : INTEGER);
78 NB_SECOND_DESYNC : INTEGER);
79 PORT (
79 PORT (
80 clk : IN STD_LOGIC;
80 clk : IN STD_LOGIC;
81 rstn : IN STD_LOGIC;
81 rstn : IN STD_LOGIC;
82 tick : IN STD_LOGIC;
82 tick : IN STD_LOGIC;
83 set_TCU : IN STD_LOGIC;
83 set_TCU : IN STD_LOGIC;
84 new_TCU : IN STD_LOGIC;
84 new_TCU : IN STD_LOGIC;
85 set_TCU_value : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
85 set_TCU_value : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
86 CT_add1 : IN STD_LOGIC;
86 CT_add1 : IN STD_LOGIC;
87 fsm_desync : IN STD_LOGIC;
87 fsm_desync : IN STD_LOGIC;
88 FT_max : IN STD_LOGIC;
88 FT_max : IN STD_LOGIC;
89 coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
89 coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
90 coarse_time_new : OUT STD_LOGIC);
90 coarse_time_new : OUT STD_LOGIC);
91 END COMPONENT;
91 END COMPONENT;
92
92
93 COMPONENT fine_time_counter
93 COMPONENT fine_time_counter
94 GENERIC (
94 GENERIC (
95 WAITING_TIME : STD_LOGIC_VECTOR(15 DOWNTO 0);
95 WAITING_TIME : STD_LOGIC_VECTOR(15 DOWNTO 0));--;
96 FIRST_DIVISION : INTEGER);
96 -- FIRST_DIVISION : INTEGER);
97 PORT (
97 PORT (
98 clk : IN STD_LOGIC;
98 clk : IN STD_LOGIC;
99 rstn : IN STD_LOGIC;
99 rstn : IN STD_LOGIC;
100 tick : IN STD_LOGIC;
100 tick : IN STD_LOGIC;
101 fsm_transition : IN STD_LOGIC;
101 fsm_transition : IN STD_LOGIC;
102 FT_max : OUT STD_LOGIC;
102 FT_max : OUT STD_LOGIC;
103 FT_half : OUT STD_LOGIC;
103 FT_half : OUT STD_LOGIC;
104 FT_wait : OUT STD_LOGIC;
104 FT_wait : OUT STD_LOGIC;
105 fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
105 fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
106 fine_time_new : OUT STD_LOGIC);
106 fine_time_new : OUT STD_LOGIC);
107 END COMPONENT;
107 END COMPONENT;
108
108
109
109 COMPONENT fine_time_max_value_gen
110 END lpp_lfr_management;
110 PORT (
111
111 clk : IN STD_LOGIC;
112 rstn : IN STD_LOGIC;
113 tick : IN STD_LOGIC;
114 fine_time_add : IN STD_LOGIC;
115 fine_time_max_value : OUT STD_LOGIC_VECTOR(8 DOWNTO 0));
116 END COMPONENT;
117
118 END lpp_lfr_management;
119
@@ -4,3 +4,4 apb_lfr_management.vhd
4 lfr_time_management.vhd
4 lfr_time_management.vhd
5 fine_time_counter.vhd
5 fine_time_counter.vhd
6 coarse_time_counter.vhd
6 coarse_time_counter.vhd
7 fine_time_max_value_gen.vhd
@@ -54,7 +54,7 ENTITY lpp_dma_send_16word IS
54 --
54 --
55 send_ok : OUT STD_LOGIC;
55 send_ok : OUT STD_LOGIC;
56 send_ko : OUT STD_LOGIC
56 send_ko : OUT STD_LOGIC
57
57
58 );
58 );
59 END lpp_dma_send_16word;
59 END lpp_dma_send_16word;
60
60
@@ -88,8 +88,8 BEGIN -- beh
88 grant_counter <= 0;
88 grant_counter <= 0;
89 ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge
89 ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge
90
90
91 DMAIn.Reset <= '0';
91 DMAIn.Reset <= '0';
92
92
93 CASE state IS
93 CASE state IS
94 WHEN IDLE =>
94 WHEN IDLE =>
95 DMAIn.Store <= '1';
95 DMAIn.Store <= '1';
@@ -98,11 +98,11 BEGIN -- beh
98 send_ko <= '0';
98 send_ko <= '0';
99 DMAIn.Address <= address;
99 DMAIn.Address <= address;
100 data_counter <= 0;
100 data_counter <= 0;
101 DMAIn.Lock <= '0'; -- FIX test
101 DMAIn.Lock <= '0';
102 IF send = '1' THEN
102 IF send = '1' THEN
103 state <= REQUEST_BUS;
103 state <= REQUEST_BUS;
104 DMAIn.Request <= '1';
104 DMAIn.Request <= '1';
105 DMAIn.Lock <= '1'; -- FIX test
105 DMAIn.Lock <= '1';
106 DMAIn.Store <= '1';
106 DMAIn.Store <= '1';
107 END IF;
107 END IF;
108 WHEN REQUEST_BUS =>
108 WHEN REQUEST_BUS =>
@@ -124,10 +124,10 BEGIN -- beh
124
124
125 IF DMAOut.Grant = '1' THEN
125 IF DMAOut.Grant = '1' THEN
126 IF grant_counter = 15 THEN
126 IF grant_counter = 15 THEN
127 DMAIn.Reset <= '0';
127 DMAIn.Reset <= '0';
128 DMAIn.Request <= '0';
128 DMAIn.Request <= '0';
129 DMAIn.Store <= '0';
129 DMAIn.Store <= '0';
130 DMAIn.Burst <= '0';
130 DMAIn.Burst <= '0';
131 ELSE
131 ELSE
132 grant_counter <= grant_counter+1;
132 grant_counter <= grant_counter+1;
133 END IF;
133 END IF;
@@ -135,6 +135,7 BEGIN -- beh
135
135
136 IF DMAOut.OKAY = '1' THEN
136 IF DMAOut.OKAY = '1' THEN
137 IF data_counter = 15 THEN
137 IF data_counter = 15 THEN
138 --DMAIn.Request <= '0'; -- FIX Test 31/03/2014 to handle burst interruption
138 DMAIn.Address <= (OTHERS => '0');
139 DMAIn.Address <= (OTHERS => '0');
139 state <= WAIT_LAST_READY;
140 state <= WAIT_LAST_READY;
140 ELSE
141 ELSE
@@ -167,7 +168,7 BEGIN -- beh
167 END PROCESS;
168 END PROCESS;
168
169
169 DMAIn.Data <= data;
170 DMAIn.Data <= data;
170
171
171 ren <= NOT (DMAOut.OKAY OR DMAOut.GRANT) WHEN state = SEND_DATA ELSE
172 ren <= NOT (DMAOut.OKAY OR DMAOut.GRANT) WHEN state = SEND_DATA ELSE
172 '1';
173 '1';
173
174
@@ -175,7 +176,7 BEGIN -- beh
175 --ren <= '0' WHEN DMAOut.OKAY = '1' ELSE --AND (state = SEND_DATA OR state = WAIT_LAST_READY) ELSE
176 --ren <= '0' WHEN DMAOut.OKAY = '1' ELSE --AND (state = SEND_DATA OR state = WAIT_LAST_READY) ELSE
176 -- '1';
177 -- '1';
177 -- /\ JC - 20/01/2014 /\
178 -- /\ JC - 20/01/2014 /\
178
179
179 -- \/ JC - 11/12/2013 \/
180 -- \/ JC - 11/12/2013 \/
180 --ren <= '0' WHEN DMAOut.OKAY = '1' AND state = SEND_DATA ELSE
181 --ren <= '0' WHEN DMAOut.OKAY = '1' AND state = SEND_DATA ELSE
181 -- '1';
182 -- '1';
@@ -191,5 +192,5 BEGIN -- beh
191 --ren <= '0' WHEN state = SEND_DATA ELSE
192 --ren <= '0' WHEN state = SEND_DATA ELSE
192 -- '1';
193 -- '1';
193 -- /\ JC - 09/12/2013 /\
194 -- /\ JC - 09/12/2013 /\
194
195
195 END beh;
196 END beh;
@@ -72,7 +72,9 ENTITY leon3_soc IS
72 NB_APB_SLAVE : INTEGER := 1;
72 NB_APB_SLAVE : INTEGER := 1;
73 --
73 --
74 ADDRESS_SIZE : INTEGER := 20;
74 ADDRESS_SIZE : INTEGER := 20;
75 USES_IAP_MEMCTRLR : INTEGER := 0
75 USES_IAP_MEMCTRLR : INTEGER := 0;
76 BYPASS_EDAC_MEMCTRLR : STD_LOGIC := '0';
77 SRBANKSZ : INTEGER := 8
76
78
77 );
79 );
78 PORT (
80 PORT (
@@ -412,9 +414,10 BEGIN
412 pindex => 0,
414 pindex => 0,
413 paddr => 0,
415 paddr => 0,
414 srbanks => 2,
416 srbanks => 2,
415 banksz => 8, --512k * 32
417 banksz => SRBANKSZ, --512k * 32
416 rmw => 1,
418 rmw => 1,
417 --Aeroflex memory generics:
419 --Aeroflex memory generics:
420 mbpbusy => BYPASS_EDAC_MEMCTRLR,
418 mprog => 1, -- program memory by default values after reset
421 mprog => 1, -- program memory by default values after reset
419 mpsrate => 15, -- default scrub rate period
422 mpsrate => 15, -- default scrub rate period
420 mpb2s => 14, -- default busy to scrub delay
423 mpb2s => 14, -- default busy to scrub delay
@@ -440,7 +443,7 BEGIN
440 memi.brdyn <= nSRAM_READY;
443 memi.brdyn <= nSRAM_READY;
441
444
442 mbe_pad : iopad
445 mbe_pad : iopad
443 GENERIC MAP(tech => padtech)
446 GENERIC MAP(tech => padtech, oepol => USES_IAP_MEMCTRLR)
444 PORT MAP(pad => SRAM_MBE,
447 PORT MAP(pad => SRAM_MBE,
445 i => mbe,
448 i => mbe,
446 en => mbe_drive,
449 en => mbe_drive,
@@ -54,7 +54,9 PACKAGE lpp_leon3_soc_pkg IS
54 NB_AHB_SLAVE : INTEGER;
54 NB_AHB_SLAVE : INTEGER;
55 NB_APB_SLAVE : INTEGER;
55 NB_APB_SLAVE : INTEGER;
56 ADDRESS_SIZE : INTEGER;
56 ADDRESS_SIZE : INTEGER;
57 USES_IAP_MEMCTRLR : INTEGER
57 USES_IAP_MEMCTRLR : INTEGER;
58 BYPASS_EDAC_MEMCTRLR : STD_LOGIC;
59 SRBANKSZ : INTEGER := 8
58 );
60 );
59 PORT (
61 PORT (
60 clk : IN STD_ULOGIC;
62 clk : IN STD_ULOGIC;
General Comments 0
You need to be logged in to leave comments. Login now