##// END OF EJS Templates
LFR-em 1.1.83 ...
pellion -
r603:c380a9e98a1c simu_with_Leon3
parent child
Show More
@@ -92,7 +92,7 ENTITY LFR_em IS
92 ADC_OEB_bar_HK : OUT STD_LOGIC;
92 ADC_OEB_bar_HK : OUT STD_LOGIC;
93 HK_SEL : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
93 HK_SEL : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
94 ---------------------------------------------------------------------------
94 ---------------------------------------------------------------------------
95 TAG8 : OUT STD_LOGIC;
95 TAG8 : IN STD_LOGIC;
96 led : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
96 led : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
97 );
97 );
98
98
@@ -100,6 +100,16 END LFR_em;
100
100
101
101
102 ARCHITECTURE beh OF LFR_em IS
102 ARCHITECTURE beh OF LFR_em IS
103
104 --==========================================================================
105 -- USE_IAP_MEMCTRL allow to use the srctrle-0ws on MINILFR board
106 -- when enabled, chip enable polarity should be reversed and bank size also
107 -- MINILFR -> 1 bank of 4MBytes -> SRBANKSZ=9
108 -- LFR EQM & FM -> 2 banks of 2MBytes -> SRBANKSZ=8
109 --==========================================================================
110 CONSTANT USE_IAP_MEMCTRL : integer := 1;
111 --==========================================================================
112
103 SIGNAL clk_50_s : STD_LOGIC := '0';
113 SIGNAL clk_50_s : STD_LOGIC := '0';
104 SIGNAL clk_25 : STD_LOGIC := '0';
114 SIGNAL clk_25 : STD_LOGIC := '0';
105 SIGNAL clk_24 : STD_LOGIC := '0';
115 SIGNAL clk_24 : STD_LOGIC := '0';
@@ -153,6 +163,7 ARCHITECTURE beh OF LFR_em IS
153 SIGNAL ADC_smpclk_s : STD_LOGIC;
163 SIGNAL ADC_smpclk_s : STD_LOGIC;
154 ----------------------------------------------------------------------------
164 ----------------------------------------------------------------------------
155 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
165 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
166 SIGNAL nSRAM_READY : STD_LOGIC;
156
167
157 BEGIN -- beh
168 BEGIN -- beh
158
169
@@ -222,7 +233,9 BEGIN -- beh
222 NB_AHB_SLAVE => NB_AHB_SLAVE,
233 NB_AHB_SLAVE => NB_AHB_SLAVE,
223 NB_APB_SLAVE => NB_APB_SLAVE,
234 NB_APB_SLAVE => NB_APB_SLAVE,
224 ADDRESS_SIZE => 20,
235 ADDRESS_SIZE => 20,
225 USES_IAP_MEMCTRLR => 0)
236 USES_IAP_MEMCTRLR => USE_IAP_MEMCTRL,
237 BYPASS_EDAC_MEMCTRLR => '0',
238 SRBANKSZ => 8)
226 PORT MAP (
239 PORT MAP (
227 clk => clk_25,
240 clk => clk_25,
228 reset => rstn_25,
241 reset => rstn_25,
@@ -242,7 +255,7 BEGIN -- beh
242 nSRAM_WE => nSRAM_WE,
255 nSRAM_WE => nSRAM_WE,
243 nSRAM_CE => nSRAM_CE_s,
256 nSRAM_CE => nSRAM_CE_s,
244 nSRAM_OE => nSRAM_OE,
257 nSRAM_OE => nSRAM_OE,
245 nSRAM_READY => '0',
258 nSRAM_READY => nSRAM_READY,
246 SRAM_MBE => OPEN,
259 SRAM_MBE => OPEN,
247
260
248 apbi_ext => apbi_ext,
261 apbi_ext => apbi_ext,
@@ -252,8 +265,25 BEGIN -- beh
252 ahbi_m_ext => ahbi_m_ext,
265 ahbi_m_ext => ahbi_m_ext,
253 ahbo_m_ext => ahbo_m_ext);
266 ahbo_m_ext => ahbo_m_ext);
254
267
268 PROCESS (clk_25, rstn_25)
269 BEGIN -- PROCESS
270 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
271 nSRAM_READY <= '1';
272 ELSIF clk_25'event AND clk_25 = '1' THEN -- rising clock edge
273 nSRAM_READY <= '1';
274 IF TAG8 = '1' THEN
275 nSRAM_READY <= '0';
276 END IF;
277 END IF;
278 END PROCESS;
255
279
256 nSRAM_CE <= nSRAM_CE_s(0);
280 IAP:if USE_IAP_MEMCTRL = 1 GENERATE
281 nSRAM_CE <= not nSRAM_CE_s(0);
282 END GENERATE;
283
284 NOIAP:if USE_IAP_MEMCTRL = 0 GENERATE
285 nSRAM_CE <= nSRAM_CE_s(0);
286 END GENERATE;
257
287
258 -------------------------------------------------------------------------------
288 -------------------------------------------------------------------------------
259 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
289 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
@@ -264,13 +294,13 BEGIN -- beh
264 pindex => 6,
294 pindex => 6,
265 paddr => 6,
295 paddr => 6,
266 pmask => 16#fff#,
296 pmask => 16#fff#,
267 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
297 -- FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
268 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
298 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
269 PORT MAP (
299 PORT MAP (
270 clk25MHz => clk_25,
300 clk25MHz => clk_25,
271 resetn_25MHz => rstn_25, -- TODO
301 resetn_25MHz => rstn_25, -- TODO
272 clk24_576MHz => clk_24, -- 49.152MHz/2
302 -- clk24_576MHz => clk_24, -- 49.152MHz/2
273 resetn_24_576MHz => rstn_24, -- TODO
303 -- resetn_24_576MHz => rstn_24, -- TODO
274
304
275 grspw_tick => swno.tickout,
305 grspw_tick => swno.tickout,
276 apbi => apbi_ext,
306 apbi => apbi_ext,
@@ -384,6 +414,7 BEGIN -- beh
384 lpp_lfr_1 : lpp_lfr
414 lpp_lfr_1 : lpp_lfr
385 GENERIC MAP (
415 GENERIC MAP (
386 Mem_use => use_RAM,
416 Mem_use => use_RAM,
417 tech => inferred,
387 nb_data_by_buffer_size => 32,
418 nb_data_by_buffer_size => 32,
388 --nb_word_by_buffer_size => 30,
419 --nb_word_by_buffer_size => 30,
389 nb_snapshot_param_size => 32,
420 nb_snapshot_param_size => 32,
@@ -395,7 +426,7 BEGIN -- beh
395 pirq_ms => 6,
426 pirq_ms => 6,
396 pirq_wfp => 14,
427 pirq_wfp => 14,
397 hindex => 2,
428 hindex => 2,
398 top_lfr_version => X"010144") -- aa.bb.cc version
429 top_lfr_version => X"010153") -- aa.bb.cc version
399 -- AA : BOARD NUMBER
430 -- AA : BOARD NUMBER
400 -- 0 => MINI_LFR
431 -- 0 => MINI_LFR
401 -- 1 => EM
432 -- 1 => EM
@@ -430,7 +461,7 BEGIN -- beh
430 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
461 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
431 GENERIC MAP (
462 GENERIC MAP (
432 ChanelCount => 9,
463 ChanelCount => 9,
433 ncycle_cnv_high => 13,
464 ncycle_cnv_high => 12,
434 ncycle_cnv => 25,
465 ncycle_cnv => 25,
435 FILTER_ENABLED => 16#FF#)
466 FILTER_ENABLED => 16#FF#)
436 PORT MAP (
467 PORT MAP (
@@ -449,11 +480,11 BEGIN -- beh
449 ADC_smpclk <= ADC_smpclk_s;
480 ADC_smpclk <= ADC_smpclk_s;
450 HK_smpclk <= ADC_smpclk_s;
481 HK_smpclk <= ADC_smpclk_s;
451
482
452 TAG8 <= ADC_smpclk_s;
483 -- TAG8 <= ADC_smpclk_s;
453
484
454 -----------------------------------------------------------------------------
485 -----------------------------------------------------------------------------
455 -- HK
486 -- HK
456 -----------------------------------------------------------------------------
487 -----------------------------------------------------------------------------
457 ADC_OEB_bar_HK <= ADC_OEB_bar_CH_s(8);
488 ADC_OEB_bar_HK <= ADC_OEB_bar_CH_s(8);
458
489
459 END beh;
490 END beh; No newline at end of file
@@ -28,11 +28,13 USE ieee.numeric_std.ALL;
28 LIBRARY lpp;
28 LIBRARY lpp;
29 USE lpp.general_purpose.ALL;
29 USE lpp.general_purpose.ALL;
30 USE lpp.window_function_pkg.ALL;
30 USE lpp.window_function_pkg.ALL;
31 USE lpp.data_type_pkg.ALL;
31
32
32 ENTITY window_function IS
33 ENTITY window_function IS
33 GENERIC (
34 GENERIC (
34 DATA_SIZE : INTEGER := 16;
35 DATA_SIZE : INTEGER := 16;
35 PARAM_SIZE : INTEGER := 10
36 PARAM_SIZE : INTEGER := 10;
37 WINDOWS_PARAM : array_std_logic_vector_16b(0 TO 255)
36 );
38 );
37
39
38 PORT (
40 PORT (
@@ -51,35 +53,8 ENTITY window_function IS
51 END window_function;
53 END window_function;
52
54
53 ARCHITECTURE beh OF window_function IS
55 ARCHITECTURE beh OF window_function IS
54
55 SUBTYPE RANGE_NB_BIT_BY_WINDOW_PARAM IS INTEGER RANGE 1 TO DATA_SIZE;
56 CONSTANT NB_BIT_BY_WINDOW_PARAM : RANGE_NB_BIT_BY_WINDOW_PARAM := 16;
57 CONSTANT NB_POINT_BY_WINDOW : INTEGER := 256;
56 CONSTANT NB_POINT_BY_WINDOW : INTEGER := 256;
58
57
59 TYPE WINDOWS_PARAM_TYPE IS ARRAY (INTEGER RANGE <>) OF STD_LOGIC_VECTOR(15 DOWNTO 0);
60 CONSTANT windows_param_lfr_sigmoide : WINDOWS_PARAM_TYPE(0 TO 32) :=
61 ( X"0000",X"0012",X"002E",X"005B", X"00A2",X"0113",X"01C7",X"02E0", --0 - 7
62 X"0498",X"073A",X"0B37",X"110D", X"193C",X"240F",X"3147",X"3FF7", --8 - 15
63 X"4EA7",X"5BDF",X"66B2",X"6EE1", X"74B7",X"78B4",X"7B56",X"7D0E", --16 - 23
64 X"7E27",X"7EDB",X"7F4C",X"7F93", X"7FC0",X"7FDC",X"7FEE",X"7FF9", --24 - 31
65 X"7FFF" ); --32
66 CONSTANT windows_param_lfr_rampe : WINDOWS_PARAM_TYPE(0 TO 32) :=
67 ( X"0000",X"03E1",X"07C2",X"0BA3", X"0F84",X"1365",X"1746",X"1B27",
68 X"1F08",X"22E8",X"26C9",X"2AAA", X"2E8B",X"326C",X"364D",X"3A2E",
69 X"3E0F",X"41F0",X"45D1",X"49B2", X"4D93",X"5174",X"5555",X"5936",
70 X"5D17",X"60F7",X"64D8",X"68B9", X"6C9A",X"707B",X"745C",X"783D",
71 X"7FFF" );
72 CONSTANT windows_param_lfr_echelon : WINDOWS_PARAM_TYPE(0 TO 32) :=
73 ( X"0000",X"0000",X"0000",X"0000", X"0000",X"0000",X"0000",X"0000",
74 X"0000",X"0000",X"0000",X"0000", X"0000",X"0000",X"0000",X"0000",
75 X"FFFF",X"FFFF",X"FFFF",X"FFFF", X"FFFF",X"FFFF",X"FFFF",X"FFFF",
76 X"FFFF",X"FFFF",X"FFFF",X"FFFF", X"FFFF",X"FFFF",X"FFFF",X"FFFF",
77 X"FFFF");
78
79 CONSTANT windows_param_lfr : WINDOWS_PARAM_TYPE(0 TO 32) := windows_param_lfr_sigmoide;
80
81 SIGNAL windows_param : WINDOWS_PARAM_TYPE(0 TO NB_POINT_BY_WINDOW-1);
82
83 SIGNAL param_counter : INTEGER RANGE 0 TO NB_POINT_BY_WINDOW-1;
58 SIGNAL param_counter : INTEGER RANGE 0 TO NB_POINT_BY_WINDOW-1;
84
59
85 SIGNAL data_x_param : STD_LOGIC_VECTOR(DATA_SIZE + PARAM_SIZE - 1 DOWNTO 0);
60 SIGNAL data_x_param : STD_LOGIC_VECTOR(DATA_SIZE + PARAM_SIZE - 1 DOWNTO 0);
@@ -90,16 +65,6 ARCHITECTURE beh OF window_function IS
90 SIGNAL data_in_s : STD_LOGIC_VECTOR(DATA_SIZE-1 DOWNTO 0);
65 SIGNAL data_in_s : STD_LOGIC_VECTOR(DATA_SIZE-1 DOWNTO 0);
91
66
92 BEGIN
67 BEGIN
93
94 all_windows_param_0: FOR I IN 0 TO 31 GENERATE
95 windows_param(I) <= windows_param_lfr(I);
96 END GENERATE all_windows_param_0;
97 all_windows_param_1: FOR I IN 32 TO 223 GENERATE
98 windows_param(I) <= windows_param_lfr(32);
99 END GENERATE all_windows_param_1;
100 all_windows_param_2: FOR I IN 224 TO 255 GENERATE
101 windows_param(I) <= windows_param_lfr(255-I);
102 END GENERATE all_windows_param_2;
103
68
104 PROCESS (clk, rstn)
69 PROCESS (clk, rstn)
105 BEGIN -- PROCESS
70 BEGIN -- PROCESS
@@ -122,7 +87,7 BEGIN
122
87
123 data_in_valid_s <= data_in_valid;
88 data_in_valid_s <= data_in_valid;
124 data_in_s <= data_in;
89 data_in_s <= data_in;
125 windows_param_selected_s <= windows_param(param_counter);
90 windows_param_selected_s <= WINDOWS_PARAM(param_counter);
126 windows_param_selected <= windows_param_selected_s(15 DOWNTO 16 - PARAM_SIZE);
91 windows_param_selected <= windows_param_selected_s(15 DOWNTO 16 - PARAM_SIZE);
127
92
128 WINDOWS_Multiplier : Multiplier
93 WINDOWS_Multiplier : Multiplier
@@ -150,4 +115,4 BEGIN
150 END IF;
115 END IF;
151 END PROCESS;
116 END PROCESS;
152
117
153 END beh; No newline at end of file
118 END beh;
@@ -24,12 +24,17 LIBRARY ieee;
24 USE ieee.std_logic_1164.ALL;
24 USE ieee.std_logic_1164.ALL;
25 USE IEEE.NUMERIC_STD.ALL;
25 USE IEEE.NUMERIC_STD.ALL;
26
26
27 LIBRARY lpp;
28 USE lpp.data_type_pkg.ALL;
29
27 PACKAGE window_function_pkg IS
30 PACKAGE window_function_pkg IS
28
31
29 COMPONENT window_function
32 COMPONENT window_function
30 GENERIC (
33 GENERIC (
31 DATA_SIZE : INTEGER;
34 DATA_SIZE : INTEGER;
32 PARAM_SIZE : INTEGER);
35 PARAM_SIZE : INTEGER;
36 WINDOWS_PARAM : array_std_logic_vector_16b(0 TO 255)
37 );
33 PORT (
38 PORT (
34 clk : IN STD_LOGIC;
39 clk : IN STD_LOGIC;
35 rstn : IN STD_LOGIC;
40 rstn : IN STD_LOGIC;
@@ -23,6 +23,7
23
23
24 LIBRARY ieee;
24 LIBRARY ieee;
25 USE ieee.std_logic_1164.ALL;
25 USE ieee.std_logic_1164.ALL;
26 USE ieee.numeric_std.ALL;
26
27
27 PACKAGE data_type_pkg IS
28 PACKAGE data_type_pkg IS
28
29
@@ -31,5 +32,24 PACKAGE data_type_pkg IS
31 TYPE array_std_logic_vector_16b IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(15 DOWNTO 0);
32 TYPE array_std_logic_vector_16b IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(15 DOWNTO 0);
32
33
33 TYPE sample_vector IS ARRAY(NATURAL RANGE <>, NATURAL RANGE <>) OF STD_LOGIC;
34 TYPE sample_vector IS ARRAY(NATURAL RANGE <>, NATURAL RANGE <>) OF STD_LOGIC;
35
36 FUNCTION to_array_std_logic_vector_16b (
37 array_in : array_real)
38 RETURN array_std_logic_vector_16b;
34
39
35 END data_type_pkg;
40 END data_type_pkg;
41
42 PACKAGE BODY data_type_pkg IS
43
44 FUNCTION to_array_std_logic_vector_16b (
45 array_in : array_real)
46 RETURN array_std_logic_vector_16b IS
47 VARIABLE array_out : array_std_logic_vector_16b(array_in'RANGE);
48 BEGIN
49 all_value: FOR I IN array_in'RANGE LOOP
50 array_out(I) := STD_LOGIC_VECTOR(to_signed(INTEGER(array_in(I) * 2.0**15),16));
51 END LOOP all_value;
52 RETURN array_out;
53 END to_array_std_logic_vector_16b;
54
55 END data_type_pkg;
@@ -35,14 +35,14 PACKAGE reader_pkg IS
35
35
36 CONSTANT CHARACTER_COMMENT : CHARACTER := '#';
36 CONSTANT CHARACTER_COMMENT : CHARACTER := '#';
37
37
38 FUNCTION get_array_real (
38 IMPURE FUNCTION get_array_real (
39 file_in : TEXT;
39 file_name : STRING;
40 nb_data_read : INTEGER)
40 nb_data_to_read : INTEGER)
41 RETURN array_real;
41 RETURN array_real;
42
42
43 FUNCTION get_array_integer (
43 IMPURE FUNCTION get_array_integer (
44 file_in : TEXT;
44 file_name : STRING;
45 nb_data_read : INTEGER)
45 nb_data_to_read : INTEGER)
46 RETURN array_integer;
46 RETURN array_integer;
47
47
48
48
@@ -50,12 +50,13 END reader_pkg;
50
50
51 PACKAGE BODY reader_pkg IS
51 PACKAGE BODY reader_pkg IS
52
52
53 FUNCTION get_array_real (
53 IMPURE FUNCTION get_array_real (
54 file_name : STRING;
54 file_name : STRING;
55 nb_data_to_read : INTEGER)
55 nb_data_to_read : INTEGER)
56 RETURN array_real
56 RETURN array_real
57 IS
57 IS
58 VARIABLE GOOD : BOOLEAN;
58
59 VARIABLE GOOD : BOOLEAN;
59 VARIABLE array_real_v : array_real(0 TO nb_data_to_read-1);
60 VARIABLE array_real_v : array_real(0 TO nb_data_to_read-1);
60 VARIABLE real_p : REAL;
61 VARIABLE real_p : REAL;
61 VARIABLE nb_data_read : INTEGER := 0;
62 VARIABLE nb_data_read : INTEGER := 0;
@@ -80,7 +81,7 PACKAGE BODY reader_pkg IS
80 RETURN array_real_v;
81 RETURN array_real_v;
81 END get_array_real;
82 END get_array_real;
82
83
83 FUNCTION get_array_integer (
84 IMPURE FUNCTION get_array_integer (
84 file_name : STRING;
85 file_name : STRING;
85 nb_data_to_read : INTEGER)
86 nb_data_to_read : INTEGER)
86 RETURN array_integer
87 RETURN array_integer
@@ -112,4 +113,4 PACKAGE BODY reader_pkg IS
112
113
113
114
114
115
115 END reader_pkg; No newline at end of file
116 END reader_pkg;
General Comments 0
You need to be logged in to leave comments. Login now