##// END OF EJS Templates
Update methodology of data dating into LFR
pellion -
r527:32bdf5e8de1b (MINI-LFR) WFP_MS-0-1-59 (LFR-EM) WFP_MS_1-1-59 JC
parent child
Show More
@@ -1,444 +1,444
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -------------------------------------------------------------------------------
21 -------------------------------------------------------------------------------
22 LIBRARY IEEE;
22 LIBRARY IEEE;
23 USE IEEE.numeric_std.ALL;
23 USE IEEE.numeric_std.ALL;
24 USE IEEE.std_logic_1164.ALL;
24 USE IEEE.std_logic_1164.ALL;
25 LIBRARY grlib;
25 LIBRARY grlib;
26 USE grlib.amba.ALL;
26 USE grlib.amba.ALL;
27 USE grlib.stdlib.ALL;
27 USE grlib.stdlib.ALL;
28 LIBRARY techmap;
28 LIBRARY techmap;
29 USE techmap.gencomp.ALL;
29 USE techmap.gencomp.ALL;
30 LIBRARY gaisler;
30 LIBRARY gaisler;
31 USE gaisler.memctrl.ALL;
31 USE gaisler.memctrl.ALL;
32 USE gaisler.leon3.ALL;
32 USE gaisler.leon3.ALL;
33 USE gaisler.uart.ALL;
33 USE gaisler.uart.ALL;
34 USE gaisler.misc.ALL;
34 USE gaisler.misc.ALL;
35 USE gaisler.spacewire.ALL;
35 USE gaisler.spacewire.ALL;
36 LIBRARY esa;
36 LIBRARY esa;
37 USE esa.memoryctrl.ALL;
37 USE esa.memoryctrl.ALL;
38 LIBRARY lpp;
38 LIBRARY lpp;
39 USE lpp.lpp_memory.ALL;
39 USE lpp.lpp_memory.ALL;
40 USE lpp.lpp_ad_conv.ALL;
40 USE lpp.lpp_ad_conv.ALL;
41 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
41 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
42 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
42 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
43 USE lpp.iir_filter.ALL;
43 USE lpp.iir_filter.ALL;
44 USE lpp.general_purpose.ALL;
44 USE lpp.general_purpose.ALL;
45 USE lpp.lpp_lfr_management.ALL;
45 USE lpp.lpp_lfr_management.ALL;
46 USE lpp.lpp_leon3_soc_pkg.ALL;
46 USE lpp.lpp_leon3_soc_pkg.ALL;
47
47
48 ENTITY LFR_em IS
48 ENTITY LFR_em IS
49
49
50 PORT (
50 PORT (
51 clk100MHz : IN STD_ULOGIC;
51 clk100MHz : IN STD_ULOGIC;
52 clk49_152MHz : IN STD_ULOGIC;
52 clk49_152MHz : IN STD_ULOGIC;
53 reset : IN STD_ULOGIC;
53 reset : IN STD_ULOGIC;
54
54
55 -- TAG --------------------------------------------------------------------
55 -- TAG --------------------------------------------------------------------
56 TAG1 : IN STD_ULOGIC; -- DSU rx data
56 TAG1 : IN STD_ULOGIC; -- DSU rx data
57 TAG3 : OUT STD_ULOGIC; -- DSU tx data
57 TAG3 : OUT STD_ULOGIC; -- DSU tx data
58 -- UART APB ---------------------------------------------------------------
58 -- UART APB ---------------------------------------------------------------
59 TAG2 : IN STD_ULOGIC; -- UART1 rx data
59 TAG2 : IN STD_ULOGIC; -- UART1 rx data
60 TAG4 : OUT STD_ULOGIC; -- UART1 tx data
60 TAG4 : OUT STD_ULOGIC; -- UART1 tx data
61 -- RAM --------------------------------------------------------------------
61 -- RAM --------------------------------------------------------------------
62 address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
62 address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
63 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
63 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
64 nSRAM_BE0 : OUT STD_LOGIC;
64 nSRAM_BE0 : OUT STD_LOGIC;
65 nSRAM_BE1 : OUT STD_LOGIC;
65 nSRAM_BE1 : OUT STD_LOGIC;
66 nSRAM_BE2 : OUT STD_LOGIC;
66 nSRAM_BE2 : OUT STD_LOGIC;
67 nSRAM_BE3 : OUT STD_LOGIC;
67 nSRAM_BE3 : OUT STD_LOGIC;
68 nSRAM_WE : OUT STD_LOGIC;
68 nSRAM_WE : OUT STD_LOGIC;
69 nSRAM_CE : OUT STD_LOGIC;
69 nSRAM_CE : OUT STD_LOGIC;
70 nSRAM_OE : OUT STD_LOGIC;
70 nSRAM_OE : OUT STD_LOGIC;
71 -- SPW --------------------------------------------------------------------
71 -- SPW --------------------------------------------------------------------
72 spw1_din : IN STD_LOGIC;
72 spw1_din : IN STD_LOGIC;
73 spw1_sin : IN STD_LOGIC;
73 spw1_sin : IN STD_LOGIC;
74 spw1_dout : OUT STD_LOGIC;
74 spw1_dout : OUT STD_LOGIC;
75 spw1_sout : OUT STD_LOGIC;
75 spw1_sout : OUT STD_LOGIC;
76 spw2_din : IN STD_LOGIC;
76 spw2_din : IN STD_LOGIC;
77 spw2_sin : IN STD_LOGIC;
77 spw2_sin : IN STD_LOGIC;
78 spw2_dout : OUT STD_LOGIC;
78 spw2_dout : OUT STD_LOGIC;
79 spw2_sout : OUT STD_LOGIC;
79 spw2_sout : OUT STD_LOGIC;
80 -- ADC --------------------------------------------------------------------
80 -- ADC --------------------------------------------------------------------
81 bias_fail_sw : OUT STD_LOGIC;
81 bias_fail_sw : OUT STD_LOGIC;
82 ADC_OEB_bar_CH : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
82 ADC_OEB_bar_CH : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
83 ADC_smpclk : OUT STD_LOGIC;
83 ADC_smpclk : OUT STD_LOGIC;
84 ADC_data : IN STD_LOGIC_VECTOR(13 DOWNTO 0);
84 ADC_data : IN STD_LOGIC_VECTOR(13 DOWNTO 0);
85 -- HK ---------------------------------------------------------------------
85 -- HK ---------------------------------------------------------------------
86 HK_smpclk : OUT STD_LOGIC;
86 HK_smpclk : OUT STD_LOGIC;
87 ADC_OEB_bar_HK : OUT STD_LOGIC;
87 ADC_OEB_bar_HK : OUT STD_LOGIC;
88 HK_SEL : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
88 HK_SEL : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
89 ---------------------------------------------------------------------------
89 ---------------------------------------------------------------------------
90 TAG8 : OUT STD_LOGIC;
90 TAG8 : OUT STD_LOGIC;
91 led : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
91 led : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
92 );
92 );
93
93
94 END LFR_em;
94 END LFR_em;
95
95
96
96
97 ARCHITECTURE beh OF LFR_em IS
97 ARCHITECTURE beh OF LFR_em IS
98 SIGNAL clk_50_s : STD_LOGIC := '0';
98 SIGNAL clk_50_s : STD_LOGIC := '0';
99 SIGNAL clk_25 : STD_LOGIC := '0';
99 SIGNAL clk_25 : STD_LOGIC := '0';
100 SIGNAL clk_24 : STD_LOGIC := '0';
100 SIGNAL clk_24 : STD_LOGIC := '0';
101 -----------------------------------------------------------------------------
101 -----------------------------------------------------------------------------
102 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
102 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
103 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
103 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
104
104
105 -- CONSTANTS
105 -- CONSTANTS
106 CONSTANT CFG_PADTECH : INTEGER := inferred;
106 CONSTANT CFG_PADTECH : INTEGER := inferred;
107 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
107 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
108 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
108 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
109 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
109 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
110
110
111 SIGNAL apbi_ext : apb_slv_in_type;
111 SIGNAL apbi_ext : apb_slv_in_type;
112 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5) := (OTHERS => apb_none);
112 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5) := (OTHERS => apb_none);
113 SIGNAL ahbi_s_ext : ahb_slv_in_type;
113 SIGNAL ahbi_s_ext : ahb_slv_in_type;
114 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3) := (OTHERS => ahbs_none);
114 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3) := (OTHERS => ahbs_none);
115 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
115 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
116 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1) := (OTHERS => ahbm_none);
116 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1) := (OTHERS => ahbm_none);
117
117
118 -- Spacewire signals
118 -- Spacewire signals
119 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
119 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
120 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
120 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
121 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
121 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
122 SIGNAL spw_rxtxclk : STD_ULOGIC;
122 SIGNAL spw_rxtxclk : STD_ULOGIC;
123 SIGNAL spw_rxclkn : STD_ULOGIC;
123 SIGNAL spw_rxclkn : STD_ULOGIC;
124 SIGNAL spw_clk : STD_LOGIC;
124 SIGNAL spw_clk : STD_LOGIC;
125 SIGNAL swni : grspw_in_type;
125 SIGNAL swni : grspw_in_type;
126 SIGNAL swno : grspw_out_type;
126 SIGNAL swno : grspw_out_type;
127
127
128 --GPIO
128 --GPIO
129 SIGNAL gpioi : gpio_in_type;
129 SIGNAL gpioi : gpio_in_type;
130 SIGNAL gpioo : gpio_out_type;
130 SIGNAL gpioo : gpio_out_type;
131
131
132 -- AD Converter ADS7886
132 -- AD Converter ADS7886
133 SIGNAL sample : Samples14v(8 DOWNTO 0);
133 SIGNAL sample : Samples14v(8 DOWNTO 0);
134 SIGNAL sample_s : Samples(8 DOWNTO 0);
134 SIGNAL sample_s : Samples(8 DOWNTO 0);
135 SIGNAL sample_val : STD_LOGIC;
135 SIGNAL sample_val : STD_LOGIC;
136 SIGNAL ADC_OEB_bar_CH_s : STD_LOGIC_VECTOR(8 DOWNTO 0);
136 SIGNAL ADC_OEB_bar_CH_s : STD_LOGIC_VECTOR(8 DOWNTO 0);
137
137
138 -----------------------------------------------------------------------------
138 -----------------------------------------------------------------------------
139 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
139 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
140
140
141 -----------------------------------------------------------------------------
141 -----------------------------------------------------------------------------
142 SIGNAL rstn : STD_LOGIC;
142 SIGNAL rstn : STD_LOGIC;
143
143
144 SIGNAL LFR_soft_rstn : STD_LOGIC;
144 SIGNAL LFR_soft_rstn : STD_LOGIC;
145 SIGNAL LFR_rstn : STD_LOGIC;
145 SIGNAL LFR_rstn : STD_LOGIC;
146
146
147 SIGNAL ADC_smpclk_s : STD_LOGIC;
147 SIGNAL ADC_smpclk_s : STD_LOGIC;
148 -----------------------------------------------------------------------------
148 -----------------------------------------------------------------------------
149 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
149 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
150
150
151 BEGIN -- beh
151 BEGIN -- beh
152
152
153 -----------------------------------------------------------------------------
153 -----------------------------------------------------------------------------
154 -- CLK
154 -- CLK
155 -----------------------------------------------------------------------------
155 -----------------------------------------------------------------------------
156 rst0 : rstgen PORT MAP (reset, clk_25, '1', rstn, OPEN);
156 rst0 : rstgen PORT MAP (reset, clk_25, '1', rstn, OPEN);
157
157
158 PROCESS(clk100MHz)
158 PROCESS(clk100MHz)
159 BEGIN
159 BEGIN
160 IF clk100MHz'EVENT AND clk100MHz = '1' THEN
160 IF clk100MHz'EVENT AND clk100MHz = '1' THEN
161 clk_50_s <= NOT clk_50_s;
161 clk_50_s <= NOT clk_50_s;
162 END IF;
162 END IF;
163 END PROCESS;
163 END PROCESS;
164
164
165 PROCESS(clk_50_s)
165 PROCESS(clk_50_s)
166 BEGIN
166 BEGIN
167 IF clk_50_s'EVENT AND clk_50_s = '1' THEN
167 IF clk_50_s'EVENT AND clk_50_s = '1' THEN
168 clk_25 <= NOT clk_25;
168 clk_25 <= NOT clk_25;
169 END IF;
169 END IF;
170 END PROCESS;
170 END PROCESS;
171
171
172 PROCESS(clk49_152MHz)
172 PROCESS(clk49_152MHz)
173 BEGIN
173 BEGIN
174 IF clk49_152MHz'EVENT AND clk49_152MHz = '1' THEN
174 IF clk49_152MHz'EVENT AND clk49_152MHz = '1' THEN
175 clk_24 <= NOT clk_24;
175 clk_24 <= NOT clk_24;
176 END IF;
176 END IF;
177 END PROCESS;
177 END PROCESS;
178
178
179 -----------------------------------------------------------------------------
179 -----------------------------------------------------------------------------
180
180
181 PROCESS (clk_25, rstn)
181 PROCESS (clk_25, rstn)
182 BEGIN -- PROCESS
182 BEGIN -- PROCESS
183 IF rstn = '0' THEN -- asynchronous reset (active low)
183 IF rstn = '0' THEN -- asynchronous reset (active low)
184 led(0) <= '0';
184 led(0) <= '0';
185 led(1) <= '0';
185 led(1) <= '0';
186 led(2) <= '0';
186 led(2) <= '0';
187 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
187 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
188 led(0) <= '0';
188 led(0) <= '0';
189 led(1) <= '1';
189 led(1) <= '1';
190 led(2) <= '1';
190 led(2) <= '1';
191 END IF;
191 END IF;
192 END PROCESS;
192 END PROCESS;
193
193
194 --
194 --
195 leon3_soc_1 : leon3_soc
195 leon3_soc_1 : leon3_soc
196 GENERIC MAP (
196 GENERIC MAP (
197 fabtech => apa3e,
197 fabtech => apa3e,
198 memtech => apa3e,
198 memtech => apa3e,
199 padtech => inferred,
199 padtech => inferred,
200 clktech => inferred,
200 clktech => inferred,
201 disas => 0,
201 disas => 0,
202 dbguart => 0,
202 dbguart => 0,
203 pclow => 2,
203 pclow => 2,
204 clk_freq => 25000,
204 clk_freq => 25000,
205 IS_RADHARD => 0,
205 IS_RADHARD => 0,
206 NB_CPU => 1,
206 NB_CPU => 1,
207 ENABLE_FPU => 1,
207 ENABLE_FPU => 1,
208 FPU_NETLIST => 0,
208 FPU_NETLIST => 0,
209 ENABLE_DSU => 1,
209 ENABLE_DSU => 1,
210 ENABLE_AHB_UART => 1,
210 ENABLE_AHB_UART => 1,
211 ENABLE_APB_UART => 1,
211 ENABLE_APB_UART => 1,
212 ENABLE_IRQMP => 1,
212 ENABLE_IRQMP => 1,
213 ENABLE_GPT => 1,
213 ENABLE_GPT => 1,
214 NB_AHB_MASTER => NB_AHB_MASTER,
214 NB_AHB_MASTER => NB_AHB_MASTER,
215 NB_AHB_SLAVE => NB_AHB_SLAVE,
215 NB_AHB_SLAVE => NB_AHB_SLAVE,
216 NB_APB_SLAVE => NB_APB_SLAVE,
216 NB_APB_SLAVE => NB_APB_SLAVE,
217 ADDRESS_SIZE => 20,
217 ADDRESS_SIZE => 20,
218 USES_IAP_MEMCTRLR => 0)
218 USES_IAP_MEMCTRLR => 0)
219 PORT MAP (
219 PORT MAP (
220 clk => clk_25,
220 clk => clk_25,
221 reset => rstn,
221 reset => rstn,
222 errorn => OPEN,
222 errorn => OPEN,
223
223
224 ahbrxd => TAG1,
224 ahbrxd => TAG1,
225 ahbtxd => TAG3,
225 ahbtxd => TAG3,
226 urxd1 => TAG2,
226 urxd1 => TAG2,
227 utxd1 => TAG4,
227 utxd1 => TAG4,
228
228
229 address => address,
229 address => address,
230 data => data,
230 data => data,
231 nSRAM_BE0 => nSRAM_BE0,
231 nSRAM_BE0 => nSRAM_BE0,
232 nSRAM_BE1 => nSRAM_BE1,
232 nSRAM_BE1 => nSRAM_BE1,
233 nSRAM_BE2 => nSRAM_BE2,
233 nSRAM_BE2 => nSRAM_BE2,
234 nSRAM_BE3 => nSRAM_BE3,
234 nSRAM_BE3 => nSRAM_BE3,
235 nSRAM_WE => nSRAM_WE,
235 nSRAM_WE => nSRAM_WE,
236 nSRAM_CE => nSRAM_CE_s,
236 nSRAM_CE => nSRAM_CE_s,
237 nSRAM_OE => nSRAM_OE,
237 nSRAM_OE => nSRAM_OE,
238 nSRAM_READY => '0',
238 nSRAM_READY => '0',
239 SRAM_MBE => OPEN,
239 SRAM_MBE => OPEN,
240
240
241 apbi_ext => apbi_ext,
241 apbi_ext => apbi_ext,
242 apbo_ext => apbo_ext,
242 apbo_ext => apbo_ext,
243 ahbi_s_ext => ahbi_s_ext,
243 ahbi_s_ext => ahbi_s_ext,
244 ahbo_s_ext => ahbo_s_ext,
244 ahbo_s_ext => ahbo_s_ext,
245 ahbi_m_ext => ahbi_m_ext,
245 ahbi_m_ext => ahbi_m_ext,
246 ahbo_m_ext => ahbo_m_ext);
246 ahbo_m_ext => ahbo_m_ext);
247
247
248
248
249 nSRAM_CE <= nSRAM_CE_s(0);
249 nSRAM_CE <= nSRAM_CE_s(0);
250
250
251 -------------------------------------------------------------------------------
251 -------------------------------------------------------------------------------
252 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
252 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
253 -------------------------------------------------------------------------------
253 -------------------------------------------------------------------------------
254 apb_lfr_management_1 : apb_lfr_management
254 apb_lfr_management_1 : apb_lfr_management
255 GENERIC MAP (
255 GENERIC MAP (
256 pindex => 6,
256 pindex => 6,
257 paddr => 6,
257 paddr => 6,
258 pmask => 16#fff#,
258 pmask => 16#fff#,
259 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
259 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
260 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
260 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
261 PORT MAP (
261 PORT MAP (
262 clk25MHz => clk_25,
262 clk25MHz => clk_25,
263 clk24_576MHz => clk_24, -- 49.152MHz/2
263 clk24_576MHz => clk_24, -- 49.152MHz/2
264 resetn => rstn,
264 resetn => rstn,
265 grspw_tick => swno.tickout,
265 grspw_tick => swno.tickout,
266 apbi => apbi_ext,
266 apbi => apbi_ext,
267 apbo => apbo_ext(6),
267 apbo => apbo_ext(6),
268
268
269 HK_sample => sample_s(8),
269 HK_sample => sample_s(8),
270 HK_val => sample_val,
270 HK_val => sample_val,
271 HK_sel => HK_SEL,
271 HK_sel => HK_SEL,
272
272
273 coarse_time => coarse_time,
273 coarse_time => coarse_time,
274 fine_time => fine_time,
274 fine_time => fine_time,
275 LFR_soft_rstn => LFR_soft_rstn
275 LFR_soft_rstn => LFR_soft_rstn
276 );
276 );
277
277
278 -----------------------------------------------------------------------
278 -----------------------------------------------------------------------
279 --- SpaceWire --------------------------------------------------------
279 --- SpaceWire --------------------------------------------------------
280 -----------------------------------------------------------------------
280 -----------------------------------------------------------------------
281
281
282 -- SPW_EN <= '1';
282 -- SPW_EN <= '1';
283
283
284 spw_clk <= clk_50_s;
284 spw_clk <= clk_50_s;
285 spw_rxtxclk <= spw_clk;
285 spw_rxtxclk <= spw_clk;
286 spw_rxclkn <= NOT spw_rxtxclk;
286 spw_rxclkn <= NOT spw_rxtxclk;
287
287
288 -- PADS for SPW1
288 -- PADS for SPW1
289 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
289 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
290 PORT MAP (spw1_din, dtmp(0));
290 PORT MAP (spw1_din, dtmp(0));
291 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
291 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
292 PORT MAP (spw1_sin, stmp(0));
292 PORT MAP (spw1_sin, stmp(0));
293 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
293 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
294 PORT MAP (spw1_dout, swno.d(0));
294 PORT MAP (spw1_dout, swno.d(0));
295 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
295 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
296 PORT MAP (spw1_sout, swno.s(0));
296 PORT MAP (spw1_sout, swno.s(0));
297 -- PADS FOR SPW2
297 -- PADS FOR SPW2
298 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
298 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
299 PORT MAP (spw2_din, dtmp(1));
299 PORT MAP (spw2_din, dtmp(1));
300 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
300 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
301 PORT MAP (spw2_sin, stmp(1));
301 PORT MAP (spw2_sin, stmp(1));
302 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
302 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
303 PORT MAP (spw2_dout, swno.d(1));
303 PORT MAP (spw2_dout, swno.d(1));
304 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
304 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
305 PORT MAP (spw2_sout, swno.s(1));
305 PORT MAP (spw2_sout, swno.s(1));
306
306
307 -- GRSPW PHY
307 -- GRSPW PHY
308 --spw1_input: if CFG_SPW_GRSPW = 1 generate
308 --spw1_input: if CFG_SPW_GRSPW = 1 generate
309 spw_inputloop : FOR j IN 0 TO 1 GENERATE
309 spw_inputloop : FOR j IN 0 TO 1 GENERATE
310 spw_phy0 : grspw_phy
310 spw_phy0 : grspw_phy
311 GENERIC MAP(
311 GENERIC MAP(
312 tech => apa3e,
312 tech => apa3e,
313 rxclkbuftype => 1,
313 rxclkbuftype => 1,
314 scantest => 0)
314 scantest => 0)
315 PORT MAP(
315 PORT MAP(
316 rxrst => swno.rxrst,
316 rxrst => swno.rxrst,
317 di => dtmp(j),
317 di => dtmp(j),
318 si => stmp(j),
318 si => stmp(j),
319 rxclko => spw_rxclk(j),
319 rxclko => spw_rxclk(j),
320 do => swni.d(j),
320 do => swni.d(j),
321 ndo => swni.nd(j*5+4 DOWNTO j*5),
321 ndo => swni.nd(j*5+4 DOWNTO j*5),
322 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
322 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
323 END GENERATE spw_inputloop;
323 END GENERATE spw_inputloop;
324
324
325 -- SPW core
325 -- SPW core
326 sw0 : grspwm GENERIC MAP(
326 sw0 : grspwm GENERIC MAP(
327 tech => apa3e,
327 tech => apa3e,
328 hindex => 1,
328 hindex => 1,
329 pindex => 5,
329 pindex => 5,
330 paddr => 5,
330 paddr => 5,
331 pirq => 11,
331 pirq => 11,
332 sysfreq => 25000, -- CPU_FREQ
332 sysfreq => 25000, -- CPU_FREQ
333 rmap => 1,
333 rmap => 1,
334 rmapcrc => 1,
334 rmapcrc => 1,
335 fifosize1 => 16,
335 fifosize1 => 16,
336 fifosize2 => 16,
336 fifosize2 => 16,
337 rxclkbuftype => 1,
337 rxclkbuftype => 1,
338 rxunaligned => 0,
338 rxunaligned => 0,
339 rmapbufs => 4,
339 rmapbufs => 4,
340 ft => 0,
340 ft => 0,
341 netlist => 0,
341 netlist => 0,
342 ports => 2,
342 ports => 2,
343 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
343 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
344 memtech => apa3e,
344 memtech => apa3e,
345 destkey => 2,
345 destkey => 2,
346 spwcore => 1
346 spwcore => 1
347 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
347 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
348 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
348 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
349 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
349 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
350 )
350 )
351 PORT MAP(rstn, clk_25, spw_rxclk(0),
351 PORT MAP(rstn, clk_25, spw_rxclk(0),
352 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
352 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
353 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
353 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
354 swni, swno);
354 swni, swno);
355
355
356 swni.tickin <= '0';
356 swni.tickin <= '0';
357 swni.rmapen <= '1';
357 swni.rmapen <= '1';
358 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
358 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
359 swni.tickinraw <= '0';
359 swni.tickinraw <= '0';
360 swni.timein <= (OTHERS => '0');
360 swni.timein <= (OTHERS => '0');
361 swni.dcrstval <= (OTHERS => '0');
361 swni.dcrstval <= (OTHERS => '0');
362 swni.timerrstval <= (OTHERS => '0');
362 swni.timerrstval <= (OTHERS => '0');
363
363
364 -------------------------------------------------------------------------------
364 -------------------------------------------------------------------------------
365 -- LFR ------------------------------------------------------------------------
365 -- LFR ------------------------------------------------------------------------
366 -------------------------------------------------------------------------------
366 -------------------------------------------------------------------------------
367 LFR_rstn <= LFR_soft_rstn AND rstn;
367 LFR_rstn <= LFR_soft_rstn AND rstn;
368
368
369 lpp_lfr_1 : lpp_lfr
369 lpp_lfr_1 : lpp_lfr
370 GENERIC MAP (
370 GENERIC MAP (
371 Mem_use => use_RAM,
371 Mem_use => use_RAM,
372 nb_data_by_buffer_size => 32,
372 nb_data_by_buffer_size => 32,
373 --nb_word_by_buffer_size => 30,
373 --nb_word_by_buffer_size => 30,
374 nb_snapshot_param_size => 32,
374 nb_snapshot_param_size => 32,
375 delta_vector_size => 32,
375 delta_vector_size => 32,
376 delta_vector_size_f0_2 => 7, -- log2(96)
376 delta_vector_size_f0_2 => 7, -- log2(96)
377 pindex => 15,
377 pindex => 15,
378 paddr => 15,
378 paddr => 15,
379 pmask => 16#fff#,
379 pmask => 16#fff#,
380 pirq_ms => 6,
380 pirq_ms => 6,
381 pirq_wfp => 14,
381 pirq_wfp => 14,
382 hindex => 2,
382 hindex => 2,
383 top_lfr_version => X"010139") -- aa.bb.cc version
383 top_lfr_version => X"01013A") -- aa.bb.cc version
384 -- AA : BOARD NUMBER
384 -- AA : BOARD NUMBER
385 -- 0 => MINI_LFR
385 -- 0 => MINI_LFR
386 -- 1 => EM
386 -- 1 => EM
387 PORT MAP (
387 PORT MAP (
388 clk => clk_25,
388 clk => clk_25,
389 rstn => LFR_rstn,
389 rstn => LFR_rstn,
390 sample_B => sample_s(2 DOWNTO 0),
390 sample_B => sample_s(2 DOWNTO 0),
391 sample_E => sample_s(7 DOWNTO 3),
391 sample_E => sample_s(7 DOWNTO 3),
392 sample_val => sample_val,
392 sample_val => sample_val,
393 apbi => apbi_ext,
393 apbi => apbi_ext,
394 apbo => apbo_ext(15),
394 apbo => apbo_ext(15),
395 ahbi => ahbi_m_ext,
395 ahbi => ahbi_m_ext,
396 ahbo => ahbo_m_ext(2),
396 ahbo => ahbo_m_ext(2),
397 coarse_time => coarse_time,
397 coarse_time => coarse_time,
398 fine_time => fine_time,
398 fine_time => fine_time,
399 data_shaping_BW => bias_fail_sw,
399 data_shaping_BW => bias_fail_sw,
400 debug_vector => OPEN,
400 debug_vector => OPEN,
401 debug_vector_ms => OPEN); --,
401 debug_vector_ms => OPEN); --,
402 --observation_vector_0 => OPEN,
402 --observation_vector_0 => OPEN,
403 --observation_vector_1 => OPEN,
403 --observation_vector_1 => OPEN,
404 --observation_reg => observation_reg);
404 --observation_reg => observation_reg);
405
405
406
406
407 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
407 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
408 sample_s(I) <= sample(I) & '0' & '0';
408 sample_s(I) <= sample(I) & '0' & '0';
409 END GENERATE all_sample;
409 END GENERATE all_sample;
410 sample_s(8) <= sample(8)(13) & sample(8)(13) & sample(8);
410 sample_s(8) <= sample(8)(13) & sample(8)(13) & sample(8);
411
411
412 -----------------------------------------------------------------------------
412 -----------------------------------------------------------------------------
413 --
413 --
414 -----------------------------------------------------------------------------
414 -----------------------------------------------------------------------------
415 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
415 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
416 GENERIC MAP (
416 GENERIC MAP (
417 ChanelCount => 9,
417 ChanelCount => 9,
418 ncycle_cnv_high => 13,
418 ncycle_cnv_high => 13,
419 ncycle_cnv => 25,
419 ncycle_cnv => 25,
420 FILTER_ENABLED => 16#FF#)
420 FILTER_ENABLED => 16#FF#)
421 PORT MAP (
421 PORT MAP (
422 cnv_clk => clk_24,
422 cnv_clk => clk_24,
423 cnv_rstn => rstn,
423 cnv_rstn => rstn,
424 cnv => ADC_smpclk_s,
424 cnv => ADC_smpclk_s,
425 clk => clk_25,
425 clk => clk_25,
426 rstn => rstn,
426 rstn => rstn,
427 ADC_data => ADC_data,
427 ADC_data => ADC_data,
428 ADC_nOE => ADC_OEB_bar_CH_s,
428 ADC_nOE => ADC_OEB_bar_CH_s,
429 sample => sample,
429 sample => sample,
430 sample_val => sample_val);
430 sample_val => sample_val);
431
431
432 ADC_OEB_bar_CH <= ADC_OEB_bar_CH_s(7 DOWNTO 0);
432 ADC_OEB_bar_CH <= ADC_OEB_bar_CH_s(7 DOWNTO 0);
433
433
434 ADC_smpclk <= ADC_smpclk_s;
434 ADC_smpclk <= ADC_smpclk_s;
435 HK_smpclk <= ADC_smpclk_s;
435 HK_smpclk <= ADC_smpclk_s;
436
436
437 TAG8 <= ADC_smpclk_s;
437 TAG8 <= ADC_smpclk_s;
438
438
439 -----------------------------------------------------------------------------
439 -----------------------------------------------------------------------------
440 -- HK
440 -- HK
441 -----------------------------------------------------------------------------
441 -----------------------------------------------------------------------------
442 ADC_OEB_bar_HK <= ADC_OEB_bar_CH_s(8);
442 ADC_OEB_bar_HK <= ADC_OEB_bar_CH_s(8);
443
443
444 END beh;
444 END beh;
@@ -1,732 +1,732
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -------------------------------------------------------------------------------
21 -------------------------------------------------------------------------------
22 LIBRARY IEEE;
22 LIBRARY IEEE;
23 USE IEEE.numeric_std.ALL;
23 USE IEEE.numeric_std.ALL;
24 USE IEEE.std_logic_1164.ALL;
24 USE IEEE.std_logic_1164.ALL;
25 LIBRARY grlib;
25 LIBRARY grlib;
26 USE grlib.amba.ALL;
26 USE grlib.amba.ALL;
27 USE grlib.stdlib.ALL;
27 USE grlib.stdlib.ALL;
28 LIBRARY techmap;
28 LIBRARY techmap;
29 USE techmap.gencomp.ALL;
29 USE techmap.gencomp.ALL;
30 LIBRARY gaisler;
30 LIBRARY gaisler;
31 USE gaisler.memctrl.ALL;
31 USE gaisler.memctrl.ALL;
32 USE gaisler.leon3.ALL;
32 USE gaisler.leon3.ALL;
33 USE gaisler.uart.ALL;
33 USE gaisler.uart.ALL;
34 USE gaisler.misc.ALL;
34 USE gaisler.misc.ALL;
35 USE gaisler.spacewire.ALL;
35 USE gaisler.spacewire.ALL;
36 LIBRARY esa;
36 LIBRARY esa;
37 USE esa.memoryctrl.ALL;
37 USE esa.memoryctrl.ALL;
38 LIBRARY lpp;
38 LIBRARY lpp;
39 USE lpp.lpp_memory.ALL;
39 USE lpp.lpp_memory.ALL;
40 USE lpp.lpp_ad_conv.ALL;
40 USE lpp.lpp_ad_conv.ALL;
41 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
41 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
42 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
42 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
43 USE lpp.iir_filter.ALL;
43 USE lpp.iir_filter.ALL;
44 USE lpp.general_purpose.ALL;
44 USE lpp.general_purpose.ALL;
45 USE lpp.lpp_lfr_management.ALL;
45 USE lpp.lpp_lfr_management.ALL;
46 USE lpp.lpp_leon3_soc_pkg.ALL;
46 USE lpp.lpp_leon3_soc_pkg.ALL;
47
47
48 ENTITY MINI_LFR_top IS
48 ENTITY MINI_LFR_top IS
49
49
50 PORT (
50 PORT (
51 clk_50 : IN STD_LOGIC;
51 clk_50 : IN STD_LOGIC;
52 clk_49 : IN STD_LOGIC;
52 clk_49 : IN STD_LOGIC;
53 reset : IN STD_LOGIC;
53 reset : IN STD_LOGIC;
54 --BPs
54 --BPs
55 BP0 : IN STD_LOGIC;
55 BP0 : IN STD_LOGIC;
56 BP1 : IN STD_LOGIC;
56 BP1 : IN STD_LOGIC;
57 --LEDs
57 --LEDs
58 LED0 : OUT STD_LOGIC;
58 LED0 : OUT STD_LOGIC;
59 LED1 : OUT STD_LOGIC;
59 LED1 : OUT STD_LOGIC;
60 LED2 : OUT STD_LOGIC;
60 LED2 : OUT STD_LOGIC;
61 --UARTs
61 --UARTs
62 TXD1 : IN STD_LOGIC;
62 TXD1 : IN STD_LOGIC;
63 RXD1 : OUT STD_LOGIC;
63 RXD1 : OUT STD_LOGIC;
64 nCTS1 : OUT STD_LOGIC;
64 nCTS1 : OUT STD_LOGIC;
65 nRTS1 : IN STD_LOGIC;
65 nRTS1 : IN STD_LOGIC;
66
66
67 TXD2 : IN STD_LOGIC;
67 TXD2 : IN STD_LOGIC;
68 RXD2 : OUT STD_LOGIC;
68 RXD2 : OUT STD_LOGIC;
69 nCTS2 : OUT STD_LOGIC;
69 nCTS2 : OUT STD_LOGIC;
70 nDTR2 : IN STD_LOGIC;
70 nDTR2 : IN STD_LOGIC;
71 nRTS2 : IN STD_LOGIC;
71 nRTS2 : IN STD_LOGIC;
72 nDCD2 : OUT STD_LOGIC;
72 nDCD2 : OUT STD_LOGIC;
73
73
74 --EXT CONNECTOR
74 --EXT CONNECTOR
75 IO0 : INOUT STD_LOGIC;
75 IO0 : INOUT STD_LOGIC;
76 IO1 : INOUT STD_LOGIC;
76 IO1 : INOUT STD_LOGIC;
77 IO2 : INOUT STD_LOGIC;
77 IO2 : INOUT STD_LOGIC;
78 IO3 : INOUT STD_LOGIC;
78 IO3 : INOUT STD_LOGIC;
79 IO4 : INOUT STD_LOGIC;
79 IO4 : INOUT STD_LOGIC;
80 IO5 : INOUT STD_LOGIC;
80 IO5 : INOUT STD_LOGIC;
81 IO6 : INOUT STD_LOGIC;
81 IO6 : INOUT STD_LOGIC;
82 IO7 : INOUT STD_LOGIC;
82 IO7 : INOUT STD_LOGIC;
83 IO8 : INOUT STD_LOGIC;
83 IO8 : INOUT STD_LOGIC;
84 IO9 : INOUT STD_LOGIC;
84 IO9 : INOUT STD_LOGIC;
85 IO10 : INOUT STD_LOGIC;
85 IO10 : INOUT STD_LOGIC;
86 IO11 : INOUT STD_LOGIC;
86 IO11 : INOUT STD_LOGIC;
87
87
88 --SPACE WIRE
88 --SPACE WIRE
89 SPW_EN : OUT STD_LOGIC; -- 0 => off
89 SPW_EN : OUT STD_LOGIC; -- 0 => off
90 SPW_NOM_DIN : IN STD_LOGIC; -- NOMINAL LINK
90 SPW_NOM_DIN : IN STD_LOGIC; -- NOMINAL LINK
91 SPW_NOM_SIN : IN STD_LOGIC;
91 SPW_NOM_SIN : IN STD_LOGIC;
92 SPW_NOM_DOUT : OUT STD_LOGIC;
92 SPW_NOM_DOUT : OUT STD_LOGIC;
93 SPW_NOM_SOUT : OUT STD_LOGIC;
93 SPW_NOM_SOUT : OUT STD_LOGIC;
94 SPW_RED_DIN : IN STD_LOGIC; -- REDUNDANT LINK
94 SPW_RED_DIN : IN STD_LOGIC; -- REDUNDANT LINK
95 SPW_RED_SIN : IN STD_LOGIC;
95 SPW_RED_SIN : IN STD_LOGIC;
96 SPW_RED_DOUT : OUT STD_LOGIC;
96 SPW_RED_DOUT : OUT STD_LOGIC;
97 SPW_RED_SOUT : OUT STD_LOGIC;
97 SPW_RED_SOUT : OUT STD_LOGIC;
98 -- MINI LFR ADC INPUTS
98 -- MINI LFR ADC INPUTS
99 ADC_nCS : OUT STD_LOGIC;
99 ADC_nCS : OUT STD_LOGIC;
100 ADC_CLK : OUT STD_LOGIC;
100 ADC_CLK : OUT STD_LOGIC;
101 ADC_SDO : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
101 ADC_SDO : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
102
102
103 -- SRAM
103 -- SRAM
104 SRAM_nWE : OUT STD_LOGIC;
104 SRAM_nWE : OUT STD_LOGIC;
105 SRAM_CE : OUT STD_LOGIC;
105 SRAM_CE : OUT STD_LOGIC;
106 SRAM_nOE : OUT STD_LOGIC;
106 SRAM_nOE : OUT STD_LOGIC;
107 SRAM_nBE : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
107 SRAM_nBE : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
108 SRAM_A : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
108 SRAM_A : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
109 SRAM_DQ : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0)
109 SRAM_DQ : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0)
110 );
110 );
111
111
112 END MINI_LFR_top;
112 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 SIGNAL clk_50_s : STD_LOGIC := '0';
116 SIGNAL clk_50_s : STD_LOGIC := '0';
117 SIGNAL clk_25 : STD_LOGIC := '0';
117 SIGNAL clk_25 : STD_LOGIC := '0';
118 SIGNAL clk_24 : STD_LOGIC := '0';
118 SIGNAL clk_24 : STD_LOGIC := '0';
119 -----------------------------------------------------------------------------
119 -----------------------------------------------------------------------------
120 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
120 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
121 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
121 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
122 --
122 --
123 SIGNAL errorn : STD_LOGIC;
123 SIGNAL errorn : STD_LOGIC;
124 -- UART AHB ---------------------------------------------------------------
124 -- UART AHB ---------------------------------------------------------------
125 -- SIGNAL ahbrxd : STD_ULOGIC; -- DSU rx data
125 -- SIGNAL ahbrxd : STD_ULOGIC; -- DSU rx data
126 -- SIGNAL ahbtxd : STD_ULOGIC; -- DSU tx data
126 -- SIGNAL ahbtxd : STD_ULOGIC; -- DSU tx data
127
127
128 -- UART APB ---------------------------------------------------------------
128 -- UART APB ---------------------------------------------------------------
129 -- SIGNAL urxd1 : STD_ULOGIC; -- UART1 rx data
129 -- SIGNAL urxd1 : STD_ULOGIC; -- UART1 rx data
130 -- SIGNAL utxd1 : STD_ULOGIC; -- UART1 tx data
130 -- SIGNAL utxd1 : STD_ULOGIC; -- UART1 tx data
131 --
131 --
132 SIGNAL I00_s : STD_LOGIC;
132 SIGNAL I00_s : STD_LOGIC;
133
133
134 -- CONSTANTS
134 -- CONSTANTS
135 CONSTANT CFG_PADTECH : INTEGER := inferred;
135 CONSTANT CFG_PADTECH : INTEGER := inferred;
136 --
136 --
137 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
137 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
138 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
138 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
139 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
139 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
140
140
141 SIGNAL apbi_ext : apb_slv_in_type;
141 SIGNAL apbi_ext : apb_slv_in_type;
142 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5); -- := (OTHERS => apb_none);
142 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5); -- := (OTHERS => apb_none);
143 SIGNAL ahbi_s_ext : ahb_slv_in_type;
143 SIGNAL ahbi_s_ext : ahb_slv_in_type;
144 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3); -- := (OTHERS => ahbs_none);
144 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3); -- := (OTHERS => ahbs_none);
145 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
145 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
146 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1); -- := (OTHERS => ahbm_none);
146 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1); -- := (OTHERS => ahbm_none);
147
147
148 -- Spacewire signals
148 -- Spacewire signals
149 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
149 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
150 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
150 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
151 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
151 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
152 SIGNAL spw_rxtxclk : STD_ULOGIC;
152 SIGNAL spw_rxtxclk : STD_ULOGIC;
153 SIGNAL spw_rxclkn : STD_ULOGIC;
153 SIGNAL spw_rxclkn : STD_ULOGIC;
154 SIGNAL spw_clk : STD_LOGIC;
154 SIGNAL spw_clk : STD_LOGIC;
155 SIGNAL swni : grspw_in_type;
155 SIGNAL swni : grspw_in_type;
156 SIGNAL swno : grspw_out_type;
156 SIGNAL swno : grspw_out_type;
157 -- SIGNAL clkmn : STD_ULOGIC;
157 -- SIGNAL clkmn : STD_ULOGIC;
158 -- SIGNAL txclk : STD_ULOGIC;
158 -- SIGNAL txclk : STD_ULOGIC;
159
159
160 --GPIO
160 --GPIO
161 SIGNAL gpioi : gpio_in_type;
161 SIGNAL gpioi : gpio_in_type;
162 SIGNAL gpioo : gpio_out_type;
162 SIGNAL gpioo : gpio_out_type;
163
163
164 -- AD Converter ADS7886
164 -- AD Converter ADS7886
165 SIGNAL sample : Samples14v(7 DOWNTO 0);
165 SIGNAL sample : Samples14v(7 DOWNTO 0);
166 SIGNAL sample_s : Samples(7 DOWNTO 0);
166 SIGNAL sample_s : Samples(7 DOWNTO 0);
167 SIGNAL sample_val : STD_LOGIC;
167 SIGNAL sample_val : STD_LOGIC;
168 SIGNAL ADC_nCS_sig : STD_LOGIC;
168 SIGNAL ADC_nCS_sig : STD_LOGIC;
169 SIGNAL ADC_CLK_sig : STD_LOGIC;
169 SIGNAL ADC_CLK_sig : STD_LOGIC;
170 SIGNAL ADC_SDO_sig : STD_LOGIC_VECTOR(7 DOWNTO 0);
170 SIGNAL ADC_SDO_sig : STD_LOGIC_VECTOR(7 DOWNTO 0);
171
171
172 SIGNAL bias_fail_sw_sig : STD_LOGIC;
172 SIGNAL bias_fail_sw_sig : STD_LOGIC;
173
173
174 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
174 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
175 SIGNAL observation_vector_0 : STD_LOGIC_VECTOR(11 DOWNTO 0);
175 SIGNAL observation_vector_0 : STD_LOGIC_VECTOR(11 DOWNTO 0);
176 SIGNAL observation_vector_1 : STD_LOGIC_VECTOR(11 DOWNTO 0);
176 SIGNAL observation_vector_1 : STD_LOGIC_VECTOR(11 DOWNTO 0);
177 -----------------------------------------------------------------------------
177 -----------------------------------------------------------------------------
178
178
179 SIGNAL LFR_soft_rstn : STD_LOGIC;
179 SIGNAL LFR_soft_rstn : STD_LOGIC;
180 SIGNAL LFR_rstn : STD_LOGIC;
180 SIGNAL LFR_rstn : STD_LOGIC;
181
181
182
182
183 SIGNAL rstn_25 : STD_LOGIC;
183 SIGNAL rstn_25 : STD_LOGIC;
184 SIGNAL rstn_25_d1 : STD_LOGIC;
184 SIGNAL rstn_25_d1 : STD_LOGIC;
185 SIGNAL rstn_25_d2 : STD_LOGIC;
185 SIGNAL rstn_25_d2 : STD_LOGIC;
186 SIGNAL rstn_25_d3 : STD_LOGIC;
186 SIGNAL rstn_25_d3 : STD_LOGIC;
187
187
188 SIGNAL rstn_50 : STD_LOGIC;
188 SIGNAL rstn_50 : STD_LOGIC;
189 SIGNAL rstn_50_d1 : STD_LOGIC;
189 SIGNAL rstn_50_d1 : STD_LOGIC;
190 SIGNAL rstn_50_d2 : STD_LOGIC;
190 SIGNAL rstn_50_d2 : STD_LOGIC;
191 SIGNAL rstn_50_d3 : STD_LOGIC;
191 SIGNAL rstn_50_d3 : STD_LOGIC;
192
192
193 SIGNAL lfr_debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0);
193 SIGNAL lfr_debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0);
194 SIGNAL lfr_debug_vector_ms : STD_LOGIC_VECTOR(11 DOWNTO 0);
194 SIGNAL lfr_debug_vector_ms : STD_LOGIC_VECTOR(11 DOWNTO 0);
195
195
196 --
196 --
197 SIGNAL SRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
197 SIGNAL SRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
198
198
199 --
199 --
200 SIGNAL sample_hk : STD_LOGIC_VECTOR(15 DOWNTO 0);
200 SIGNAL sample_hk : STD_LOGIC_VECTOR(15 DOWNTO 0);
201 SIGNAL HK_SEL : STD_LOGIC_VECTOR( 1 DOWNTO 0);
201 SIGNAL HK_SEL : STD_LOGIC_VECTOR( 1 DOWNTO 0);
202
202
203 BEGIN -- beh
203 BEGIN -- beh
204
204
205 -----------------------------------------------------------------------------
205 -----------------------------------------------------------------------------
206 -- CLK
206 -- CLK
207 -----------------------------------------------------------------------------
207 -----------------------------------------------------------------------------
208
208
209 --PROCESS(clk_50)
209 --PROCESS(clk_50)
210 --BEGIN
210 --BEGIN
211 -- IF clk_50'EVENT AND clk_50 = '1' THEN
211 -- IF clk_50'EVENT AND clk_50 = '1' THEN
212 -- clk_50_s <= NOT clk_50_s;
212 -- clk_50_s <= NOT clk_50_s;
213 -- END IF;
213 -- END IF;
214 --END PROCESS;
214 --END PROCESS;
215
215
216 --PROCESS(clk_50_s)
216 --PROCESS(clk_50_s)
217 --BEGIN
217 --BEGIN
218 -- IF clk_50_s'EVENT AND clk_50_s = '1' THEN
218 -- IF clk_50_s'EVENT AND clk_50_s = '1' THEN
219 -- clk_25 <= NOT clk_25;
219 -- clk_25 <= NOT clk_25;
220 -- END IF;
220 -- END IF;
221 --END PROCESS;
221 --END PROCESS;
222
222
223 --PROCESS(clk_49)
223 --PROCESS(clk_49)
224 --BEGIN
224 --BEGIN
225 -- IF clk_49'EVENT AND clk_49 = '1' THEN
225 -- IF clk_49'EVENT AND clk_49 = '1' THEN
226 -- clk_24 <= NOT clk_24;
226 -- clk_24 <= NOT clk_24;
227 -- END IF;
227 -- END IF;
228 --END PROCESS;
228 --END PROCESS;
229
229
230 --PROCESS(clk_25)
230 --PROCESS(clk_25)
231 --BEGIN
231 --BEGIN
232 -- IF clk_25'EVENT AND clk_25 = '1' THEN
232 -- IF clk_25'EVENT AND clk_25 = '1' THEN
233 -- rstn_25 <= reset;
233 -- rstn_25 <= reset;
234 -- END IF;
234 -- END IF;
235 --END PROCESS;
235 --END PROCESS;
236
236
237 PROCESS (clk_50, reset)
237 PROCESS (clk_50, reset)
238 BEGIN -- PROCESS
238 BEGIN -- PROCESS
239 IF reset = '0' THEN -- asynchronous reset (active low)
239 IF reset = '0' THEN -- asynchronous reset (active low)
240 clk_50_s <= '0';
240 clk_50_s <= '0';
241 rstn_50 <= '0';
241 rstn_50 <= '0';
242 rstn_50_d1 <= '0';
242 rstn_50_d1 <= '0';
243 rstn_50_d2 <= '0';
243 rstn_50_d2 <= '0';
244 rstn_50_d3 <= '0';
244 rstn_50_d3 <= '0';
245
245
246 ELSIF clk_50'EVENT AND clk_50 = '1' THEN -- rising clock edge
246 ELSIF clk_50'EVENT AND clk_50 = '1' THEN -- rising clock edge
247 clk_50_s <= NOT clk_50_s;
247 clk_50_s <= NOT clk_50_s;
248 rstn_50_d1 <= '1';
248 rstn_50_d1 <= '1';
249 rstn_50_d2 <= rstn_50_d1;
249 rstn_50_d2 <= rstn_50_d1;
250 rstn_50_d3 <= rstn_50_d2;
250 rstn_50_d3 <= rstn_50_d2;
251 rstn_50 <= rstn_50_d3;
251 rstn_50 <= rstn_50_d3;
252 END IF;
252 END IF;
253 END PROCESS;
253 END PROCESS;
254
254
255 PROCESS (clk_50_s, rstn_50)
255 PROCESS (clk_50_s, rstn_50)
256 BEGIN -- PROCESS
256 BEGIN -- PROCESS
257 IF rstn_50 = '0' THEN -- asynchronous reset (active low)
257 IF rstn_50 = '0' THEN -- asynchronous reset (active low)
258 clk_25 <= '0';
258 clk_25 <= '0';
259 rstn_25 <= '0';
259 rstn_25 <= '0';
260 rstn_25_d1 <= '0';
260 rstn_25_d1 <= '0';
261 rstn_25_d2 <= '0';
261 rstn_25_d2 <= '0';
262 rstn_25_d3 <= '0';
262 rstn_25_d3 <= '0';
263 ELSIF clk_50_s'EVENT AND clk_50_s = '1' THEN -- rising clock edge
263 ELSIF clk_50_s'EVENT AND clk_50_s = '1' THEN -- rising clock edge
264 clk_25 <= NOT clk_25;
264 clk_25 <= NOT clk_25;
265 rstn_25_d1 <= '1';
265 rstn_25_d1 <= '1';
266 rstn_25_d2 <= rstn_25_d1;
266 rstn_25_d2 <= rstn_25_d1;
267 rstn_25_d3 <= rstn_25_d2;
267 rstn_25_d3 <= rstn_25_d2;
268 rstn_25 <= rstn_25_d3;
268 rstn_25 <= rstn_25_d3;
269 END IF;
269 END IF;
270 END PROCESS;
270 END PROCESS;
271
271
272 PROCESS (clk_49, reset)
272 PROCESS (clk_49, reset)
273 BEGIN -- PROCESS
273 BEGIN -- PROCESS
274 IF reset = '0' THEN -- asynchronous reset (active low)
274 IF reset = '0' THEN -- asynchronous reset (active low)
275 clk_24 <= '0';
275 clk_24 <= '0';
276 ELSIF clk_49'EVENT AND clk_49 = '1' THEN -- rising clock edge
276 ELSIF clk_49'EVENT AND clk_49 = '1' THEN -- rising clock edge
277 clk_24 <= NOT clk_24;
277 clk_24 <= NOT clk_24;
278 END IF;
278 END IF;
279 END PROCESS;
279 END PROCESS;
280
280
281 -----------------------------------------------------------------------------
281 -----------------------------------------------------------------------------
282
282
283 PROCESS (clk_25, rstn_25)
283 PROCESS (clk_25, rstn_25)
284 BEGIN -- PROCESS
284 BEGIN -- PROCESS
285 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
285 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
286 LED0 <= '0';
286 LED0 <= '0';
287 LED1 <= '0';
287 LED1 <= '0';
288 LED2 <= '0';
288 LED2 <= '0';
289 --IO1 <= '0';
289 --IO1 <= '0';
290 --IO2 <= '1';
290 --IO2 <= '1';
291 --IO3 <= '0';
291 --IO3 <= '0';
292 --IO4 <= '0';
292 --IO4 <= '0';
293 --IO5 <= '0';
293 --IO5 <= '0';
294 --IO6 <= '0';
294 --IO6 <= '0';
295 --IO7 <= '0';
295 --IO7 <= '0';
296 --IO8 <= '0';
296 --IO8 <= '0';
297 --IO9 <= '0';
297 --IO9 <= '0';
298 --IO10 <= '0';
298 --IO10 <= '0';
299 --IO11 <= '0';
299 --IO11 <= '0';
300 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
300 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
301 LED0 <= '0';
301 LED0 <= '0';
302 LED1 <= '1';
302 LED1 <= '1';
303 LED2 <= BP0 OR BP1 OR nDTR2 OR nRTS2 OR nRTS1;
303 LED2 <= BP0 OR BP1 OR nDTR2 OR nRTS2 OR nRTS1;
304 --IO1 <= '1';
304 --IO1 <= '1';
305 --IO2 <= SPW_NOM_DIN OR SPW_NOM_SIN OR SPW_RED_DIN OR SPW_RED_SIN;
305 --IO2 <= SPW_NOM_DIN OR SPW_NOM_SIN OR SPW_RED_DIN OR SPW_RED_SIN;
306 --IO3 <= ADC_SDO(0);
306 --IO3 <= ADC_SDO(0);
307 --IO4 <= ADC_SDO(1);
307 --IO4 <= ADC_SDO(1);
308 --IO5 <= ADC_SDO(2);
308 --IO5 <= ADC_SDO(2);
309 --IO6 <= ADC_SDO(3);
309 --IO6 <= ADC_SDO(3);
310 --IO7 <= ADC_SDO(4);
310 --IO7 <= ADC_SDO(4);
311 --IO8 <= ADC_SDO(5);
311 --IO8 <= ADC_SDO(5);
312 --IO9 <= ADC_SDO(6);
312 --IO9 <= ADC_SDO(6);
313 --IO10 <= ADC_SDO(7);
313 --IO10 <= ADC_SDO(7);
314 --IO11 <= BP1 OR nDTR2 OR nRTS2 OR nRTS1;
314 --IO11 <= BP1 OR nDTR2 OR nRTS2 OR nRTS1;
315 END IF;
315 END IF;
316 END PROCESS;
316 END PROCESS;
317
317
318 PROCESS (clk_24, rstn_25)
318 PROCESS (clk_24, rstn_25)
319 BEGIN -- PROCESS
319 BEGIN -- PROCESS
320 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
320 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
321 I00_s <= '0';
321 I00_s <= '0';
322 ELSIF clk_24'EVENT AND clk_24 = '1' THEN -- rising clock edge
322 ELSIF clk_24'EVENT AND clk_24 = '1' THEN -- rising clock edge
323 I00_s <= NOT I00_s;
323 I00_s <= NOT I00_s;
324 END IF;
324 END IF;
325 END PROCESS;
325 END PROCESS;
326 -- IO0 <= I00_s;
326 -- IO0 <= I00_s;
327
327
328 --UARTs
328 --UARTs
329 nCTS1 <= '1';
329 nCTS1 <= '1';
330 nCTS2 <= '1';
330 nCTS2 <= '1';
331 nDCD2 <= '1';
331 nDCD2 <= '1';
332
332
333 --
333 --
334
334
335 leon3_soc_1 : leon3_soc
335 leon3_soc_1 : leon3_soc
336 GENERIC MAP (
336 GENERIC MAP (
337 fabtech => apa3e,
337 fabtech => apa3e,
338 memtech => apa3e,
338 memtech => apa3e,
339 padtech => inferred,
339 padtech => inferred,
340 clktech => inferred,
340 clktech => inferred,
341 disas => 0,
341 disas => 0,
342 dbguart => 0,
342 dbguart => 0,
343 pclow => 2,
343 pclow => 2,
344 clk_freq => 25000,
344 clk_freq => 25000,
345 IS_RADHARD => 1,
345 IS_RADHARD => 0,
346 NB_CPU => 1,
346 NB_CPU => 1,
347 ENABLE_FPU => 1,
347 ENABLE_FPU => 1,
348 FPU_NETLIST => 0,
348 FPU_NETLIST => 0,
349 ENABLE_DSU => 1,
349 ENABLE_DSU => 1,
350 ENABLE_AHB_UART => 1,
350 ENABLE_AHB_UART => 1,
351 ENABLE_APB_UART => 1,
351 ENABLE_APB_UART => 1,
352 ENABLE_IRQMP => 1,
352 ENABLE_IRQMP => 1,
353 ENABLE_GPT => 1,
353 ENABLE_GPT => 1,
354 NB_AHB_MASTER => NB_AHB_MASTER,
354 NB_AHB_MASTER => NB_AHB_MASTER,
355 NB_AHB_SLAVE => NB_AHB_SLAVE,
355 NB_AHB_SLAVE => NB_AHB_SLAVE,
356 NB_APB_SLAVE => NB_APB_SLAVE,
356 NB_APB_SLAVE => NB_APB_SLAVE,
357 ADDRESS_SIZE => 20,
357 ADDRESS_SIZE => 20,
358 USES_IAP_MEMCTRLR => 0)
358 USES_IAP_MEMCTRLR => 0)
359 PORT MAP (
359 PORT MAP (
360 clk => clk_25,
360 clk => clk_25,
361 reset => rstn_25,
361 reset => rstn_25,
362 errorn => errorn,
362 errorn => errorn,
363 ahbrxd => TXD1,
363 ahbrxd => TXD1,
364 ahbtxd => RXD1,
364 ahbtxd => RXD1,
365 urxd1 => TXD2,
365 urxd1 => TXD2,
366 utxd1 => RXD2,
366 utxd1 => RXD2,
367 address => SRAM_A,
367 address => SRAM_A,
368 data => SRAM_DQ,
368 data => SRAM_DQ,
369 nSRAM_BE0 => SRAM_nBE(0),
369 nSRAM_BE0 => SRAM_nBE(0),
370 nSRAM_BE1 => SRAM_nBE(1),
370 nSRAM_BE1 => SRAM_nBE(1),
371 nSRAM_BE2 => SRAM_nBE(2),
371 nSRAM_BE2 => SRAM_nBE(2),
372 nSRAM_BE3 => SRAM_nBE(3),
372 nSRAM_BE3 => SRAM_nBE(3),
373 nSRAM_WE => SRAM_nWE,
373 nSRAM_WE => SRAM_nWE,
374 nSRAM_CE => SRAM_CE_s,
374 nSRAM_CE => SRAM_CE_s,
375 nSRAM_OE => SRAM_nOE,
375 nSRAM_OE => SRAM_nOE,
376 nSRAM_READY => '0',
376 nSRAM_READY => '0',
377 SRAM_MBE => OPEN,
377 SRAM_MBE => OPEN,
378 apbi_ext => apbi_ext,
378 apbi_ext => apbi_ext,
379 apbo_ext => apbo_ext,
379 apbo_ext => apbo_ext,
380 ahbi_s_ext => ahbi_s_ext,
380 ahbi_s_ext => ahbi_s_ext,
381 ahbo_s_ext => ahbo_s_ext,
381 ahbo_s_ext => ahbo_s_ext,
382 ahbi_m_ext => ahbi_m_ext,
382 ahbi_m_ext => ahbi_m_ext,
383 ahbo_m_ext => ahbo_m_ext);
383 ahbo_m_ext => ahbo_m_ext);
384
384
385 SRAM_CE <= SRAM_CE_s(0);
385 SRAM_CE <= SRAM_CE_s(0);
386 -------------------------------------------------------------------------------
386 -------------------------------------------------------------------------------
387 -- APB_LFR_MANAGEMENT ---------------------------------------------------------
387 -- APB_LFR_MANAGEMENT ---------------------------------------------------------
388 -------------------------------------------------------------------------------
388 -------------------------------------------------------------------------------
389 apb_lfr_management_1 : apb_lfr_management
389 apb_lfr_management_1 : apb_lfr_management
390 GENERIC MAP (
390 GENERIC MAP (
391 pindex => 6,
391 pindex => 6,
392 paddr => 6,
392 paddr => 6,
393 pmask => 16#fff#,
393 pmask => 16#fff#,
394 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
394 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
395 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
395 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
396 PORT MAP (
396 PORT MAP (
397 clk25MHz => clk_25,
397 clk25MHz => clk_25,
398 clk24_576MHz => clk_24, -- 49.152MHz/2
398 clk24_576MHz => clk_24, -- 49.152MHz/2
399 resetn => rstn_25,
399 resetn => rstn_25,
400 grspw_tick => swno.tickout,
400 grspw_tick => swno.tickout,
401 apbi => apbi_ext,
401 apbi => apbi_ext,
402 apbo => apbo_ext(6),
402 apbo => apbo_ext(6),
403 HK_sample => sample_hk,
403 HK_sample => sample_hk,
404 HK_val => sample_val,
404 HK_val => sample_val,
405 HK_sel => HK_SEL,
405 HK_sel => HK_SEL,
406 coarse_time => coarse_time,
406 coarse_time => coarse_time,
407 fine_time => fine_time,
407 fine_time => fine_time,
408 LFR_soft_rstn => LFR_soft_rstn
408 LFR_soft_rstn => LFR_soft_rstn
409 );
409 );
410
410
411 -----------------------------------------------------------------------
411 -----------------------------------------------------------------------
412 --- SpaceWire --------------------------------------------------------
412 --- SpaceWire --------------------------------------------------------
413 -----------------------------------------------------------------------
413 -----------------------------------------------------------------------
414
414
415 SPW_EN <= '1';
415 SPW_EN <= '1';
416
416
417 spw_clk <= clk_50_s;
417 spw_clk <= clk_50_s;
418 spw_rxtxclk <= spw_clk;
418 spw_rxtxclk <= spw_clk;
419 spw_rxclkn <= NOT spw_rxtxclk;
419 spw_rxclkn <= NOT spw_rxtxclk;
420
420
421 -- PADS for SPW1
421 -- PADS for SPW1
422 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
422 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
423 PORT MAP (SPW_NOM_DIN, dtmp(0));
423 PORT MAP (SPW_NOM_DIN, dtmp(0));
424 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
424 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
425 PORT MAP (SPW_NOM_SIN, stmp(0));
425 PORT MAP (SPW_NOM_SIN, stmp(0));
426 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
426 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
427 PORT MAP (SPW_NOM_DOUT, swno.d(0));
427 PORT MAP (SPW_NOM_DOUT, swno.d(0));
428 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
428 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
429 PORT MAP (SPW_NOM_SOUT, swno.s(0));
429 PORT MAP (SPW_NOM_SOUT, swno.s(0));
430 -- PADS FOR SPW2
430 -- PADS FOR SPW2
431 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
431 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
432 PORT MAP (SPW_RED_SIN, dtmp(1));
432 PORT MAP (SPW_RED_SIN, dtmp(1));
433 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
433 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
434 PORT MAP (SPW_RED_DIN, stmp(1));
434 PORT MAP (SPW_RED_DIN, stmp(1));
435 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
435 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
436 PORT MAP (SPW_RED_DOUT, swno.d(1));
436 PORT MAP (SPW_RED_DOUT, swno.d(1));
437 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
437 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
438 PORT MAP (SPW_RED_SOUT, swno.s(1));
438 PORT MAP (SPW_RED_SOUT, swno.s(1));
439
439
440 -- GRSPW PHY
440 -- GRSPW PHY
441 --spw1_input: if CFG_SPW_GRSPW = 1 generate
441 --spw1_input: if CFG_SPW_GRSPW = 1 generate
442 spw_inputloop : FOR j IN 0 TO 1 GENERATE
442 spw_inputloop : FOR j IN 0 TO 1 GENERATE
443 spw_phy0 : grspw_phy
443 spw_phy0 : grspw_phy
444 GENERIC MAP(
444 GENERIC MAP(
445 tech => apa3e,
445 tech => apa3e,
446 rxclkbuftype => 1,
446 rxclkbuftype => 1,
447 scantest => 0)
447 scantest => 0)
448 PORT MAP(
448 PORT MAP(
449 rxrst => swno.rxrst,
449 rxrst => swno.rxrst,
450 di => dtmp(j),
450 di => dtmp(j),
451 si => stmp(j),
451 si => stmp(j),
452 rxclko => spw_rxclk(j),
452 rxclko => spw_rxclk(j),
453 do => swni.d(j),
453 do => swni.d(j),
454 ndo => swni.nd(j*5+4 DOWNTO j*5),
454 ndo => swni.nd(j*5+4 DOWNTO j*5),
455 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
455 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
456 END GENERATE spw_inputloop;
456 END GENERATE spw_inputloop;
457
457
458 swni.rmapnodeaddr <= (OTHERS => '0');
458 swni.rmapnodeaddr <= (OTHERS => '0');
459
459
460 -- SPW core
460 -- SPW core
461 sw0 : grspwm GENERIC MAP(
461 sw0 : grspwm GENERIC MAP(
462 tech => apa3e,
462 tech => apa3e,
463 hindex => 1,
463 hindex => 1,
464 pindex => 5,
464 pindex => 5,
465 paddr => 5,
465 paddr => 5,
466 pirq => 11,
466 pirq => 11,
467 sysfreq => 25000, -- CPU_FREQ
467 sysfreq => 25000, -- CPU_FREQ
468 rmap => 1,
468 rmap => 1,
469 rmapcrc => 1,
469 rmapcrc => 1,
470 fifosize1 => 16,
470 fifosize1 => 16,
471 fifosize2 => 16,
471 fifosize2 => 16,
472 rxclkbuftype => 1,
472 rxclkbuftype => 1,
473 rxunaligned => 0,
473 rxunaligned => 0,
474 rmapbufs => 4,
474 rmapbufs => 4,
475 ft => 0,
475 ft => 0,
476 netlist => 0,
476 netlist => 0,
477 ports => 2,
477 ports => 2,
478 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
478 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
479 memtech => apa3e,
479 memtech => apa3e,
480 destkey => 2,
480 destkey => 2,
481 spwcore => 1
481 spwcore => 1
482 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
482 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
483 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
483 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
484 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
484 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
485 )
485 )
486 PORT MAP(rstn_25, clk_25, spw_rxclk(0),
486 PORT MAP(rstn_25, clk_25, spw_rxclk(0),
487 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
487 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
488 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
488 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
489 swni, swno);
489 swni, swno);
490
490
491 swni.tickin <= '0';
491 swni.tickin <= '0';
492 swni.rmapen <= '1';
492 swni.rmapen <= '1';
493 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
493 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
494 swni.tickinraw <= '0';
494 swni.tickinraw <= '0';
495 swni.timein <= (OTHERS => '0');
495 swni.timein <= (OTHERS => '0');
496 swni.dcrstval <= (OTHERS => '0');
496 swni.dcrstval <= (OTHERS => '0');
497 swni.timerrstval <= (OTHERS => '0');
497 swni.timerrstval <= (OTHERS => '0');
498
498
499 -------------------------------------------------------------------------------
499 -------------------------------------------------------------------------------
500 -- LFR ------------------------------------------------------------------------
500 -- LFR ------------------------------------------------------------------------
501 -------------------------------------------------------------------------------
501 -------------------------------------------------------------------------------
502
502
503
503
504 LFR_rstn <= LFR_soft_rstn AND rstn_25;
504 LFR_rstn <= LFR_soft_rstn AND rstn_25;
505 --LFR_rstn <= rstn_25;
505 --LFR_rstn <= rstn_25;
506
506
507 lpp_lfr_1 : lpp_lfr
507 lpp_lfr_1 : lpp_lfr
508 GENERIC MAP (
508 GENERIC MAP (
509 Mem_use => use_RAM,
509 Mem_use => use_RAM,
510 nb_data_by_buffer_size => 32,
510 nb_data_by_buffer_size => 32,
511 nb_snapshot_param_size => 32,
511 nb_snapshot_param_size => 32,
512 delta_vector_size => 32,
512 delta_vector_size => 32,
513 delta_vector_size_f0_2 => 7, -- log2(96)
513 delta_vector_size_f0_2 => 7, -- log2(96)
514 pindex => 15,
514 pindex => 15,
515 paddr => 15,
515 paddr => 15,
516 pmask => 16#fff#,
516 pmask => 16#fff#,
517 pirq_ms => 6,
517 pirq_ms => 6,
518 pirq_wfp => 14,
518 pirq_wfp => 14,
519 hindex => 2,
519 hindex => 2,
520 top_lfr_version => X"000138") -- aa.bb.cc version
520 top_lfr_version => X"00013A") -- aa.bb.cc version
521 PORT MAP (
521 PORT MAP (
522 clk => clk_25,
522 clk => clk_25,
523 rstn => LFR_rstn,
523 rstn => LFR_rstn,
524 sample_B => sample_s(2 DOWNTO 0),
524 sample_B => sample_s(2 DOWNTO 0),
525 sample_E => sample_s(7 DOWNTO 3),
525 sample_E => sample_s(7 DOWNTO 3),
526 sample_val => sample_val,
526 sample_val => sample_val,
527 apbi => apbi_ext,
527 apbi => apbi_ext,
528 apbo => apbo_ext(15),
528 apbo => apbo_ext(15),
529 ahbi => ahbi_m_ext,
529 ahbi => ahbi_m_ext,
530 ahbo => ahbo_m_ext(2),
530 ahbo => ahbo_m_ext(2),
531 coarse_time => coarse_time,
531 coarse_time => coarse_time,
532 fine_time => fine_time,
532 fine_time => fine_time,
533 data_shaping_BW => bias_fail_sw_sig,
533 data_shaping_BW => bias_fail_sw_sig,
534 debug_vector => lfr_debug_vector,
534 debug_vector => lfr_debug_vector,
535 debug_vector_ms => lfr_debug_vector_ms
535 debug_vector_ms => lfr_debug_vector_ms
536 );
536 );
537
537
538 observation_reg(11 DOWNTO 0) <= lfr_debug_vector;
538 observation_reg(11 DOWNTO 0) <= lfr_debug_vector;
539 observation_reg(31 DOWNTO 12) <= (OTHERS => '0');
539 observation_reg(31 DOWNTO 12) <= (OTHERS => '0');
540 observation_vector_0(11 DOWNTO 0) <= lfr_debug_vector;
540 observation_vector_0(11 DOWNTO 0) <= lfr_debug_vector;
541 observation_vector_1(11 DOWNTO 0) <= lfr_debug_vector;
541 observation_vector_1(11 DOWNTO 0) <= lfr_debug_vector;
542 IO0 <= rstn_25;
542 IO0 <= rstn_25;
543 IO1 <= lfr_debug_vector_ms(0); -- LFR MS FFT data_valid
543 IO1 <= lfr_debug_vector_ms(0); -- LFR MS FFT data_valid
544 IO2 <= lfr_debug_vector_ms(0); -- LFR MS FFT ready
544 IO2 <= lfr_debug_vector_ms(0); -- LFR MS FFT ready
545 IO3 <= lfr_debug_vector(0); -- LFR APBREG error_buffer_full
545 IO3 <= lfr_debug_vector(0); -- LFR APBREG error_buffer_full
546 IO4 <= lfr_debug_vector(1); -- LFR APBREG reg_sp.status_error_buffer_full
546 IO4 <= lfr_debug_vector(1); -- LFR APBREG reg_sp.status_error_buffer_full
547 IO5 <= lfr_debug_vector(8); -- LFR APBREG ready_matrix_f2
547 IO5 <= lfr_debug_vector(8); -- LFR APBREG ready_matrix_f2
548 IO6 <= lfr_debug_vector(9); -- LFR APBREG reg0_ready_matrix_f2
548 IO6 <= lfr_debug_vector(9); -- LFR APBREG reg0_ready_matrix_f2
549 IO7 <= lfr_debug_vector(10); -- LFR APBREG reg0_ready_matrix_f2
549 IO7 <= lfr_debug_vector(10); -- LFR APBREG reg0_ready_matrix_f2
550
550
551 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
551 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
552 sample_s(I) <= sample(I)(11 DOWNTO 0) & '0' & '0' & '0' & '0';
552 sample_s(I) <= sample(I)(11 DOWNTO 0) & '0' & '0' & '0' & '0';
553 END GENERATE all_sample;
553 END GENERATE all_sample;
554
554
555 top_ad_conv_ADS7886_v2_1 : top_ad_conv_ADS7886_v2
555 top_ad_conv_ADS7886_v2_1 : top_ad_conv_ADS7886_v2
556 GENERIC MAP(
556 GENERIC MAP(
557 ChannelCount => 8,
557 ChannelCount => 8,
558 SampleNbBits => 14,
558 SampleNbBits => 14,
559 ncycle_cnv_high => 40, -- at least 32 cycles at 25 MHz, 32 * 49.152 / 25 /2 = 31.5
559 ncycle_cnv_high => 40, -- at least 32 cycles at 25 MHz, 32 * 49.152 / 25 /2 = 31.5
560 ncycle_cnv => 249) -- 49 152 000 / 98304 /2
560 ncycle_cnv => 249) -- 49 152 000 / 98304 /2
561 PORT MAP (
561 PORT MAP (
562 -- CONV
562 -- CONV
563 cnv_clk => clk_24,
563 cnv_clk => clk_24,
564 cnv_rstn => rstn_25,
564 cnv_rstn => rstn_25,
565 cnv => ADC_nCS_sig,
565 cnv => ADC_nCS_sig,
566 -- DATA
566 -- DATA
567 clk => clk_25,
567 clk => clk_25,
568 rstn => rstn_25,
568 rstn => rstn_25,
569 sck => ADC_CLK_sig,
569 sck => ADC_CLK_sig,
570 sdo => ADC_SDO_sig,
570 sdo => ADC_SDO_sig,
571 -- SAMPLE
571 -- SAMPLE
572 sample => sample,
572 sample => sample,
573 sample_val => sample_val);
573 sample_val => sample_val);
574
574
575 --IO10 <= ADC_SDO_sig(5);
575 --IO10 <= ADC_SDO_sig(5);
576 --IO9 <= ADC_SDO_sig(4);
576 --IO9 <= ADC_SDO_sig(4);
577 --IO8 <= ADC_SDO_sig(3);
577 --IO8 <= ADC_SDO_sig(3);
578
578
579 ADC_nCS <= ADC_nCS_sig;
579 ADC_nCS <= ADC_nCS_sig;
580 ADC_CLK <= ADC_CLK_sig;
580 ADC_CLK <= ADC_CLK_sig;
581 ADC_SDO_sig <= ADC_SDO;
581 ADC_SDO_sig <= ADC_SDO;
582
582
583 sample_hk <= "0001000100010001" WHEN HK_SEL = "00" ELSE
583 sample_hk <= "0001000100010001" WHEN HK_SEL = "00" ELSE
584 "0010001000100010" WHEN HK_SEL = "01" ELSE
584 "0010001000100010" WHEN HK_SEL = "01" ELSE
585 "0100010001000100" WHEN HK_SEL = "10" ELSE
585 "0100010001000100" WHEN HK_SEL = "10" ELSE
586 (OTHERS => '0');
586 (OTHERS => '0');
587
587
588
588
589 ----------------------------------------------------------------------
589 ----------------------------------------------------------------------
590 --- GPIO -----------------------------------------------------------
590 --- GPIO -----------------------------------------------------------
591 ----------------------------------------------------------------------
591 ----------------------------------------------------------------------
592
592
593 grgpio0 : grgpio
593 grgpio0 : grgpio
594 GENERIC MAP(pindex => 11, paddr => 11, imask => 16#0000#, nbits => 8)
594 GENERIC MAP(pindex => 11, paddr => 11, imask => 16#0000#, nbits => 8)
595 PORT MAP(rstn_25, clk_25, apbi_ext, apbo_ext(11), gpioi, gpioo);
595 PORT MAP(rstn_25, clk_25, apbi_ext, apbo_ext(11), gpioi, gpioo);
596
596
597 gpioi.sig_en <= (OTHERS => '0');
597 gpioi.sig_en <= (OTHERS => '0');
598 gpioi.sig_in <= (OTHERS => '0');
598 gpioi.sig_in <= (OTHERS => '0');
599 gpioi.din <= (OTHERS => '0');
599 gpioi.din <= (OTHERS => '0');
600 --pio_pad_0 : iopad
600 --pio_pad_0 : iopad
601 -- GENERIC MAP (tech => CFG_PADTECH)
601 -- GENERIC MAP (tech => CFG_PADTECH)
602 -- PORT MAP (IO0, gpioo.dout(0), gpioo.oen(0), gpioi.din(0));
602 -- PORT MAP (IO0, gpioo.dout(0), gpioo.oen(0), gpioi.din(0));
603 --pio_pad_1 : iopad
603 --pio_pad_1 : iopad
604 -- GENERIC MAP (tech => CFG_PADTECH)
604 -- GENERIC MAP (tech => CFG_PADTECH)
605 -- PORT MAP (IO1, gpioo.dout(1), gpioo.oen(1), gpioi.din(1));
605 -- PORT MAP (IO1, gpioo.dout(1), gpioo.oen(1), gpioi.din(1));
606 --pio_pad_2 : iopad
606 --pio_pad_2 : iopad
607 -- GENERIC MAP (tech => CFG_PADTECH)
607 -- GENERIC MAP (tech => CFG_PADTECH)
608 -- PORT MAP (IO2, gpioo.dout(2), gpioo.oen(2), gpioi.din(2));
608 -- PORT MAP (IO2, gpioo.dout(2), gpioo.oen(2), gpioi.din(2));
609 --pio_pad_3 : iopad
609 --pio_pad_3 : iopad
610 -- GENERIC MAP (tech => CFG_PADTECH)
610 -- GENERIC MAP (tech => CFG_PADTECH)
611 -- PORT MAP (IO3, gpioo.dout(3), gpioo.oen(3), gpioi.din(3));
611 -- PORT MAP (IO3, gpioo.dout(3), gpioo.oen(3), gpioi.din(3));
612 --pio_pad_4 : iopad
612 --pio_pad_4 : iopad
613 -- GENERIC MAP (tech => CFG_PADTECH)
613 -- GENERIC MAP (tech => CFG_PADTECH)
614 -- PORT MAP (IO4, gpioo.dout(4), gpioo.oen(4), gpioi.din(4));
614 -- PORT MAP (IO4, gpioo.dout(4), gpioo.oen(4), gpioi.din(4));
615 --pio_pad_5 : iopad
615 --pio_pad_5 : iopad
616 -- GENERIC MAP (tech => CFG_PADTECH)
616 -- GENERIC MAP (tech => CFG_PADTECH)
617 -- PORT MAP (IO5, gpioo.dout(5), gpioo.oen(5), gpioi.din(5));
617 -- PORT MAP (IO5, gpioo.dout(5), gpioo.oen(5), gpioi.din(5));
618 --pio_pad_6 : iopad
618 --pio_pad_6 : iopad
619 -- GENERIC MAP (tech => CFG_PADTECH)
619 -- GENERIC MAP (tech => CFG_PADTECH)
620 -- PORT MAP (IO6, gpioo.dout(6), gpioo.oen(6), gpioi.din(6));
620 -- PORT MAP (IO6, gpioo.dout(6), gpioo.oen(6), gpioi.din(6));
621 --pio_pad_7 : iopad
621 --pio_pad_7 : iopad
622 -- GENERIC MAP (tech => CFG_PADTECH)
622 -- GENERIC MAP (tech => CFG_PADTECH)
623 -- PORT MAP (IO7, gpioo.dout(7), gpioo.oen(7), gpioi.din(7));
623 -- PORT MAP (IO7, gpioo.dout(7), gpioo.oen(7), gpioi.din(7));
624
624
625 PROCESS (clk_25, rstn_25)
625 PROCESS (clk_25, rstn_25)
626 BEGIN -- PROCESS
626 BEGIN -- PROCESS
627 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
627 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
628 -- --IO0 <= '0';
628 -- --IO0 <= '0';
629 -- IO1 <= '0';
629 -- IO1 <= '0';
630 -- IO2 <= '0';
630 -- IO2 <= '0';
631 -- IO3 <= '0';
631 -- IO3 <= '0';
632 -- IO4 <= '0';
632 -- IO4 <= '0';
633 -- IO5 <= '0';
633 -- IO5 <= '0';
634 -- IO6 <= '0';
634 -- IO6 <= '0';
635 -- IO7 <= '0';
635 -- IO7 <= '0';
636 IO8 <= '0';
636 IO8 <= '0';
637 IO9 <= '0';
637 IO9 <= '0';
638 IO10 <= '0';
638 IO10 <= '0';
639 IO11 <= '0';
639 IO11 <= '0';
640 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
640 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
641 CASE gpioo.dout(2 DOWNTO 0) IS
641 CASE gpioo.dout(2 DOWNTO 0) IS
642 WHEN "011" =>
642 WHEN "011" =>
643 -- --IO0 <= observation_reg(0 );
643 -- --IO0 <= observation_reg(0 );
644 -- IO1 <= observation_reg(1 );
644 -- IO1 <= observation_reg(1 );
645 -- IO2 <= observation_reg(2 );
645 -- IO2 <= observation_reg(2 );
646 -- IO3 <= observation_reg(3 );
646 -- IO3 <= observation_reg(3 );
647 -- IO4 <= observation_reg(4 );
647 -- IO4 <= observation_reg(4 );
648 -- IO5 <= observation_reg(5 );
648 -- IO5 <= observation_reg(5 );
649 -- IO6 <= observation_reg(6 );
649 -- IO6 <= observation_reg(6 );
650 -- IO7 <= observation_reg(7 );
650 -- IO7 <= observation_reg(7 );
651 IO8 <= observation_reg(8);
651 IO8 <= observation_reg(8);
652 IO9 <= observation_reg(9);
652 IO9 <= observation_reg(9);
653 IO10 <= observation_reg(10);
653 IO10 <= observation_reg(10);
654 IO11 <= observation_reg(11);
654 IO11 <= observation_reg(11);
655 WHEN "001" =>
655 WHEN "001" =>
656 -- --IO0 <= observation_reg(0 + 12);
656 -- --IO0 <= observation_reg(0 + 12);
657 -- IO1 <= observation_reg(1 + 12);
657 -- IO1 <= observation_reg(1 + 12);
658 -- IO2 <= observation_reg(2 + 12);
658 -- IO2 <= observation_reg(2 + 12);
659 -- IO3 <= observation_reg(3 + 12);
659 -- IO3 <= observation_reg(3 + 12);
660 -- IO4 <= observation_reg(4 + 12);
660 -- IO4 <= observation_reg(4 + 12);
661 -- IO5 <= observation_reg(5 + 12);
661 -- IO5 <= observation_reg(5 + 12);
662 -- IO6 <= observation_reg(6 + 12);
662 -- IO6 <= observation_reg(6 + 12);
663 -- IO7 <= observation_reg(7 + 12);
663 -- IO7 <= observation_reg(7 + 12);
664 IO8 <= observation_reg(8 + 12);
664 IO8 <= observation_reg(8 + 12);
665 IO9 <= observation_reg(9 + 12);
665 IO9 <= observation_reg(9 + 12);
666 IO10 <= observation_reg(10 + 12);
666 IO10 <= observation_reg(10 + 12);
667 IO11 <= observation_reg(11 + 12);
667 IO11 <= observation_reg(11 + 12);
668 WHEN "010" =>
668 WHEN "010" =>
669 -- --IO0 <= observation_reg(0 + 12 + 12);
669 -- --IO0 <= observation_reg(0 + 12 + 12);
670 -- IO1 <= observation_reg(1 + 12 + 12);
670 -- IO1 <= observation_reg(1 + 12 + 12);
671 -- IO2 <= observation_reg(2 + 12 + 12);
671 -- IO2 <= observation_reg(2 + 12 + 12);
672 -- IO3 <= observation_reg(3 + 12 + 12);
672 -- IO3 <= observation_reg(3 + 12 + 12);
673 -- IO4 <= observation_reg(4 + 12 + 12);
673 -- IO4 <= observation_reg(4 + 12 + 12);
674 -- IO5 <= observation_reg(5 + 12 + 12);
674 -- IO5 <= observation_reg(5 + 12 + 12);
675 -- IO6 <= observation_reg(6 + 12 + 12);
675 -- IO6 <= observation_reg(6 + 12 + 12);
676 -- IO7 <= observation_reg(7 + 12 + 12);
676 -- IO7 <= observation_reg(7 + 12 + 12);
677 IO8 <= '0';
677 IO8 <= '0';
678 IO9 <= '0';
678 IO9 <= '0';
679 IO10 <= '0';
679 IO10 <= '0';
680 IO11 <= '0';
680 IO11 <= '0';
681 WHEN "000" =>
681 WHEN "000" =>
682 -- --IO0 <= observation_vector_0(0 );
682 -- --IO0 <= observation_vector_0(0 );
683 -- IO1 <= observation_vector_0(1 );
683 -- IO1 <= observation_vector_0(1 );
684 -- IO2 <= observation_vector_0(2 );
684 -- IO2 <= observation_vector_0(2 );
685 -- IO3 <= observation_vector_0(3 );
685 -- IO3 <= observation_vector_0(3 );
686 -- IO4 <= observation_vector_0(4 );
686 -- IO4 <= observation_vector_0(4 );
687 -- IO5 <= observation_vector_0(5 );
687 -- IO5 <= observation_vector_0(5 );
688 -- IO6 <= observation_vector_0(6 );
688 -- IO6 <= observation_vector_0(6 );
689 -- IO7 <= observation_vector_0(7 );
689 -- IO7 <= observation_vector_0(7 );
690 IO8 <= observation_vector_0(8);
690 IO8 <= observation_vector_0(8);
691 IO9 <= observation_vector_0(9);
691 IO9 <= observation_vector_0(9);
692 IO10 <= observation_vector_0(10);
692 IO10 <= observation_vector_0(10);
693 IO11 <= observation_vector_0(11);
693 IO11 <= observation_vector_0(11);
694 WHEN "100" =>
694 WHEN "100" =>
695 -- --IO0 <= observation_vector_1(0 );
695 -- --IO0 <= observation_vector_1(0 );
696 -- IO1 <= observation_vector_1(1 );
696 -- IO1 <= observation_vector_1(1 );
697 -- IO2 <= observation_vector_1(2 );
697 -- IO2 <= observation_vector_1(2 );
698 -- IO3 <= observation_vector_1(3 );
698 -- IO3 <= observation_vector_1(3 );
699 -- IO4 <= observation_vector_1(4 );
699 -- IO4 <= observation_vector_1(4 );
700 -- IO5 <= observation_vector_1(5 );
700 -- IO5 <= observation_vector_1(5 );
701 -- IO6 <= observation_vector_1(6 );
701 -- IO6 <= observation_vector_1(6 );
702 -- IO7 <= observation_vector_1(7 );
702 -- IO7 <= observation_vector_1(7 );
703 IO8 <= observation_vector_1(8);
703 IO8 <= observation_vector_1(8);
704 IO9 <= observation_vector_1(9);
704 IO9 <= observation_vector_1(9);
705 IO10 <= observation_vector_1(10);
705 IO10 <= observation_vector_1(10);
706 IO11 <= observation_vector_1(11);
706 IO11 <= observation_vector_1(11);
707 WHEN OTHERS => NULL;
707 WHEN OTHERS => NULL;
708 END CASE;
708 END CASE;
709
709
710 END IF;
710 END IF;
711 END PROCESS;
711 END PROCESS;
712 -----------------------------------------------------------------------------
712 -----------------------------------------------------------------------------
713 --
713 --
714 -----------------------------------------------------------------------------
714 -----------------------------------------------------------------------------
715 all_apbo_ext : FOR I IN NB_APB_SLAVE-1+5 DOWNTO 5 GENERATE
715 all_apbo_ext : FOR I IN NB_APB_SLAVE-1+5 DOWNTO 5 GENERATE
716 apbo_ext_not_used : IF I /= 5 AND I /= 6 AND I /= 11 AND I /= 15 GENERATE
716 apbo_ext_not_used : IF I /= 5 AND I /= 6 AND I /= 11 AND I /= 15 GENERATE
717 apbo_ext(I) <= apb_none;
717 apbo_ext(I) <= apb_none;
718 END GENERATE apbo_ext_not_used;
718 END GENERATE apbo_ext_not_used;
719 END GENERATE all_apbo_ext;
719 END GENERATE all_apbo_ext;
720
720
721
721
722 all_ahbo_ext : FOR I IN NB_AHB_SLAVE-1+3 DOWNTO 3 GENERATE
722 all_ahbo_ext : FOR I IN NB_AHB_SLAVE-1+3 DOWNTO 3 GENERATE
723 ahbo_s_ext(I) <= ahbs_none;
723 ahbo_s_ext(I) <= ahbs_none;
724 END GENERATE all_ahbo_ext;
724 END GENERATE all_ahbo_ext;
725
725
726 all_ahbo_m_ext : FOR I IN NB_AHB_MASTER-1+1 DOWNTO 1 GENERATE
726 all_ahbo_m_ext : FOR I IN NB_AHB_MASTER-1+1 DOWNTO 1 GENERATE
727 ahbo_m_ext_not_used : IF I /= 1 AND I /= 2 GENERATE
727 ahbo_m_ext_not_used : IF I /= 1 AND I /= 2 GENERATE
728 ahbo_m_ext(I) <= ahbm_none;
728 ahbo_m_ext(I) <= ahbm_none;
729 END GENERATE ahbo_m_ext_not_used;
729 END GENERATE ahbo_m_ext_not_used;
730 END GENERATE all_ahbo_m_ext;
730 END GENERATE all_ahbo_m_ext;
731
731
732 END beh;
732 END beh;
@@ -1,400 +1,397
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -- jean-christophe.pellion@easii-ic.com
21 -- jean-christophe.pellion@easii-ic.com
22 ----------------------------------------------------------------------------
22 ----------------------------------------------------------------------------
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 USE ieee.numeric_std.all;
27
27
28 LIBRARY lpp;
28 LIBRARY lpp;
29 USE lpp.cic_pkg.ALL;
29 USE lpp.cic_pkg.ALL;
30 USE lpp.data_type_pkg.ALL;
30 USE lpp.data_type_pkg.ALL;
31 USE lpp.iir_filter.ALL;
31 USE lpp.iir_filter.ALL;
32
32
33 LIBRARY techmap;
33 LIBRARY techmap;
34 USE techmap.gencomp.ALL;
34 USE techmap.gencomp.ALL;
35
35
36 ENTITY cic_lfr_r2 IS
36 ENTITY cic_lfr_r2 IS
37 GENERIC(
37 GENERIC(
38 tech : INTEGER := 0;
38 tech : INTEGER := 0;
39 use_RAM_nCEL : INTEGER := 0 -- 1 => RAM(tech) , 0 => RAM_CEL
39 use_RAM_nCEL : INTEGER := 0 -- 1 => RAM(tech) , 0 => RAM_CEL
40 );
40 );
41 PORT (
41 PORT (
42 clk : IN STD_LOGIC;
42 clk : IN STD_LOGIC;
43 rstn : IN STD_LOGIC;
43 rstn : IN STD_LOGIC;
44 run : IN STD_LOGIC;
44 run : IN STD_LOGIC;
45
45
46 param_r2 : IN STD_LOGIC;
46 param_r2 : IN STD_LOGIC;
47
47
48 data_in : IN sample_vector(7 DOWNTO 0,15 DOWNTO 0);
48 data_in : IN sample_vector(7 DOWNTO 0,15 DOWNTO 0);
49 data_in_valid : IN STD_LOGIC;
49 data_in_valid : IN STD_LOGIC;
50
50
51 data_out_16 : OUT sample_vector(5 DOWNTO 0,15 DOWNTO 0);
51 data_out_16 : OUT sample_vector(5 DOWNTO 0,15 DOWNTO 0);
52 data_out_16_valid : OUT STD_LOGIC;
52 data_out_16_valid : OUT STD_LOGIC;
53 data_out_256 : OUT sample_vector(5 DOWNTO 0,15 DOWNTO 0);
53 data_out_256 : OUT sample_vector(5 DOWNTO 0,15 DOWNTO 0);
54 data_out_256_valid : OUT STD_LOGIC
54 data_out_256_valid : OUT STD_LOGIC
55 );
55 );
56
56
57 END cic_lfr_r2;
57 END cic_lfr_r2;
58
58
59 ARCHITECTURE beh OF cic_lfr_r2 IS
59 ARCHITECTURE beh OF cic_lfr_r2 IS
60 --
60 --
61 SIGNAL sel_sample : STD_LOGIC_VECTOR(2 DOWNTO 0);
61 SIGNAL sel_sample : STD_LOGIC_VECTOR(2 DOWNTO 0);
62 SIGNAL sample_temp : sample_vector(5 DOWNTO 0,15 DOWNTO 0);
62 SIGNAL sample_temp : sample_vector(5 DOWNTO 0,15 DOWNTO 0);
63 SIGNAL sample : STD_LOGIC_VECTOR(15 DOWNTO 0);
63 SIGNAL sample : STD_LOGIC_VECTOR(15 DOWNTO 0);
64 --
64 --
65 SIGNAL sel_A : STD_LOGIC_VECTOR(1 DOWNTO 0);
65 SIGNAL sel_A : STD_LOGIC_VECTOR(1 DOWNTO 0);
66 SIGNAL data_A_temp : sample_vector(2 DOWNTO 0,15 DOWNTO 0);
66 SIGNAL data_A_temp : sample_vector(2 DOWNTO 0,15 DOWNTO 0);
67 SIGNAL data_A : STD_LOGIC_VECTOR(15 DOWNTO 0);
67 SIGNAL data_A : STD_LOGIC_VECTOR(15 DOWNTO 0);
68 --
68 --
69 SIGNAL ALU_OP : STD_LOGIC_VECTOR(1 DOWNTO 0);
69 SIGNAL ALU_OP : STD_LOGIC_VECTOR(1 DOWNTO 0);
70 SIGNAL data_B : STD_LOGIC_VECTOR(15 DOWNTO 0);
70 SIGNAL data_B : STD_LOGIC_VECTOR(15 DOWNTO 0);
71 SIGNAL data_B_reg : STD_LOGIC_VECTOR(15 DOWNTO 0);
71 SIGNAL data_B_reg : STD_LOGIC_VECTOR(15 DOWNTO 0);
72 SIGNAL data_out : STD_LOGIC_VECTOR(15 DOWNTO 0);
72 SIGNAL data_out : STD_LOGIC_VECTOR(15 DOWNTO 0);
73 SIGNAL data_in_Carry : STD_LOGIC;
73 SIGNAL data_in_Carry : STD_LOGIC;
74 SIGNAL data_out_Carry : STD_LOGIC;
74 SIGNAL data_out_Carry : STD_LOGIC;
75 --
75 --
76 CONSTANT S_parameter : INTEGER := 3;
76 CONSTANT S_parameter : INTEGER := 3;
77 SIGNAL carry_reg : STD_LOGIC_VECTOR(S_parameter-1 DOWNTO 0);
77 SIGNAL carry_reg : STD_LOGIC_VECTOR(S_parameter-1 DOWNTO 0);
78 SIGNAL CARRY_PUSH : STD_LOGIC;
79 SIGNAL CARRY_POP : STD_LOGIC;
80 --
78 --
81
79
82 SIGNAL OPERATION : STD_LOGIC_VECTOR(15 DOWNTO 0);
80 SIGNAL OPERATION : STD_LOGIC_VECTOR(15 DOWNTO 0);
83 SIGNAL OPERATION_reg: STD_LOGIC_VECTOR(15 DOWNTO 0);
81 SIGNAL OPERATION_reg: STD_LOGIC_VECTOR(15 DOWNTO 0);
84 SIGNAL OPERATION_reg2: STD_LOGIC_VECTOR(15 DOWNTO 0);
82 SIGNAL OPERATION_reg2: STD_LOGIC_VECTOR(15 DOWNTO 0);
85
83
86 -----------------------------------------------------------------------------
84 -----------------------------------------------------------------------------
87 TYPE ARRAY_OF_ADDR IS ARRAY (7 DOWNTO 0) OF STD_LOGIC_VECTOR(8 DOWNTO 0);
85 TYPE ARRAY_OF_ADDR IS ARRAY (7 DOWNTO 0) OF STD_LOGIC_VECTOR(8 DOWNTO 0);
88 SIGNAL base_addr_INT : ARRAY_OF_ADDR;
86 SIGNAL base_addr_INT : ARRAY_OF_ADDR;
89 CONSTANT base_addr_delta : INTEGER := 40;
87 CONSTANT base_addr_delta : INTEGER := 40;
90 SIGNAL addr_base_sel : STD_LOGIC_VECTOR(8 DOWNTO 0);
88 SIGNAL addr_base_sel : STD_LOGIC_VECTOR(8 DOWNTO 0);
91 SIGNAL addr_gen: STD_LOGIC_VECTOR(8 DOWNTO 0);
89 SIGNAL addr_gen: STD_LOGIC_VECTOR(8 DOWNTO 0);
92 SIGNAL addr_read: STD_LOGIC_VECTOR(8 DOWNTO 0);
90 SIGNAL addr_read: STD_LOGIC_VECTOR(8 DOWNTO 0);
93 SIGNAL addr_write: STD_LOGIC_VECTOR(8 DOWNTO 0);
91 SIGNAL addr_write: STD_LOGIC_VECTOR(8 DOWNTO 0);
94 SIGNAL addr_write_mux: STD_LOGIC_VECTOR(8 DOWNTO 0);
92 SIGNAL addr_write_mux: STD_LOGIC_VECTOR(8 DOWNTO 0);
95 SIGNAL addr_write_s: STD_LOGIC_VECTOR(8 DOWNTO 0);
93 SIGNAL addr_write_s: STD_LOGIC_VECTOR(8 DOWNTO 0);
96 SIGNAL data_we: STD_LOGIC;
94 SIGNAL data_we: STD_LOGIC;
97 SIGNAL data_we_s: STD_LOGIC;
95 SIGNAL data_we_s: STD_LOGIC;
98 SIGNAL data_wen : STD_LOGIC;
96 SIGNAL data_wen : STD_LOGIC;
99 -- SIGNAL data_write : STD_LOGIC_VECTOR(15 DOWNTO 0);
97 -- SIGNAL data_write : STD_LOGIC_VECTOR(15 DOWNTO 0);
100 -- SIGNAL data_read : STD_LOGIC_VECTOR(15 DOWNTO 0);
98 -- SIGNAL data_read : STD_LOGIC_VECTOR(15 DOWNTO 0);
101 -- SIGNAL data_read_pre : STD_LOGIC_VECTOR(15 DOWNTO 0);
99 -- SIGNAL data_read_pre : STD_LOGIC_VECTOR(15 DOWNTO 0);
102 -----------------------------------------------------------------------------
100 -----------------------------------------------------------------------------
103 SIGNAL sample_out_reg16 : sample_vector(8*2-1 DOWNTO 0, 15 DOWNTO 0);
101 SIGNAL sample_out_reg16 : sample_vector(8*2-1 DOWNTO 0, 15 DOWNTO 0);
104 SIGNAL sample_out_reg256 : sample_vector(6*3-1 DOWNTO 0, 15 DOWNTO 0);
102 SIGNAL sample_out_reg256 : sample_vector(6*3-1 DOWNTO 0, 15 DOWNTO 0);
105 SIGNAL sample_valid_reg16 : STD_LOGIC_VECTOR(8*2 DOWNTO 0);
103 SIGNAL sample_valid_reg16 : STD_LOGIC_VECTOR(8*2 DOWNTO 0);
106 SIGNAL sample_valid_reg256: STD_LOGIC_VECTOR(6*3 DOWNTO 0);
104 SIGNAL sample_valid_reg256: STD_LOGIC_VECTOR(6*3 DOWNTO 0);
107 SIGNAL data_out_16_valid_s : STD_LOGIC;
105 SIGNAL data_out_16_valid_s : STD_LOGIC;
108 SIGNAL data_out_256_valid_s : STD_LOGIC;
106 SIGNAL data_out_256_valid_s : STD_LOGIC;
109 SIGNAL data_out_16_valid_s1 : STD_LOGIC;
107 SIGNAL data_out_16_valid_s1 : STD_LOGIC;
110 SIGNAL data_out_256_valid_s1 : STD_LOGIC;
108 SIGNAL data_out_256_valid_s1 : STD_LOGIC;
111 SIGNAL data_out_16_valid_s2 : STD_LOGIC;
109 SIGNAL data_out_16_valid_s2 : STD_LOGIC;
112 SIGNAL data_out_256_valid_s2 : STD_LOGIC;
110 SIGNAL data_out_256_valid_s2 : STD_LOGIC;
113 -----------------------------------------------------------------------------
111 -----------------------------------------------------------------------------
114 SIGNAL sample_out_reg16_s : sample_vector(5 DOWNTO 0, 16*2-1 DOWNTO 0);
112 SIGNAL sample_out_reg16_s : sample_vector(5 DOWNTO 0, 16*2-1 DOWNTO 0);
115 SIGNAL sample_out_reg256_s : sample_vector(5 DOWNTO 0, 16*3-1 DOWNTO 0);
113 SIGNAL sample_out_reg256_s : sample_vector(5 DOWNTO 0, 16*3-1 DOWNTO 0);
116 -----------------------------------------------------------------------------
114 -----------------------------------------------------------------------------
117
115
118
116
119 BEGIN
117 BEGIN
120
118
121
119
122 PROCESS (clk, rstn)
120 PROCESS (clk, rstn)
123 BEGIN -- PROCESS
121 BEGIN -- PROCESS
124 IF rstn = '0' THEN -- asynchronous reset (active low)
122 IF rstn = '0' THEN -- asynchronous reset (active low)
125 data_B_reg <= (OTHERS => '0');
123 data_B_reg <= (OTHERS => '0');
126 OPERATION_reg <= (OTHERS => '0');
124 OPERATION_reg <= (OTHERS => '0');
127 OPERATION_reg2 <= (OTHERS => '0');
125 OPERATION_reg2 <= (OTHERS => '0');
128 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
126 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
129 OPERATION_reg <= OPERATION;
127 OPERATION_reg <= OPERATION;
130 OPERATION_reg2 <= OPERATION_reg;
128 OPERATION_reg2 <= OPERATION_reg;
131 data_B_reg <= data_B;
129 data_B_reg <= data_B;
132 END IF;
130 END IF;
133 END PROCESS;
131 END PROCESS;
134
132
135
133
136 -----------------------------------------------------------------------------
134 -----------------------------------------------------------------------------
137 -- SEL_SAMPLE
135 -- SEL_SAMPLE
138 -----------------------------------------------------------------------------
136 -----------------------------------------------------------------------------
139 sel_sample <= OPERATION_reg(2 DOWNTO 0);
137 sel_sample <= OPERATION_reg(2 DOWNTO 0);
140
138
141 all_bit: FOR I IN 15 DOWNTO 0 GENERATE
139 all_bit: FOR I IN 15 DOWNTO 0 GENERATE
142 sample_temp(0,I) <= data_in(0,I) WHEN sel_sample(0) = '0' ELSE data_in(1,I);
140 sample_temp(0,I) <= data_in(0,I) WHEN sel_sample(0) = '0' ELSE data_in(1,I);
143 sample_temp(1,I) <= data_in(2,I) WHEN sel_sample(0) = '0' ELSE data_in(3,I);
141 sample_temp(1,I) <= data_in(2,I) WHEN sel_sample(0) = '0' ELSE data_in(3,I);
144 sample_temp(2,I) <= data_in(4,I) WHEN sel_sample(0) = '0' ELSE data_in(5,I);
142 sample_temp(2,I) <= data_in(4,I) WHEN sel_sample(0) = '0' ELSE data_in(5,I);
145 sample_temp(3,I) <= data_in(6,I) WHEN sel_sample(0) = '0' ELSE data_in(7,I);
143 sample_temp(3,I) <= data_in(6,I) WHEN sel_sample(0) = '0' ELSE data_in(7,I);
146
144
147 sample_temp(4,I) <= sample_temp(0,I) WHEN sel_sample(1) = '0' ELSE sample_temp(1,I);
145 sample_temp(4,I) <= sample_temp(0,I) WHEN sel_sample(1) = '0' ELSE sample_temp(1,I);
148 sample_temp(5,I) <= sample_temp(2,I) WHEN sel_sample(1) = '0' ELSE sample_temp(3,I);
146 sample_temp(5,I) <= sample_temp(2,I) WHEN sel_sample(1) = '0' ELSE sample_temp(3,I);
149
147
150 sample(I) <= sample_temp(4,I) WHEN sel_sample(2) = '0' ELSE sample_temp(5,I);
148 sample(I) <= sample_temp(4,I) WHEN sel_sample(2) = '0' ELSE sample_temp(5,I);
151 END GENERATE all_bit;
149 END GENERATE all_bit;
152
150
153 -----------------------------------------------------------------------------
151 -----------------------------------------------------------------------------
154 -- SEL_DATA_IN_A
152 -- SEL_DATA_IN_A
155 -----------------------------------------------------------------------------
153 -----------------------------------------------------------------------------
156 sel_A <= OPERATION_reg(4 DOWNTO 3);
154 sel_A <= OPERATION_reg(4 DOWNTO 3);
157
155
158 all_data_mux_A: FOR I IN 15 DOWNTO 0 GENERATE
156 all_data_mux_A: FOR I IN 15 DOWNTO 0 GENERATE
159 data_A_temp(0,I) <= sample(I) WHEN sel_A(0) = '0' ELSE data_out(I);
157 data_A_temp(0,I) <= sample(I) WHEN sel_A(0) = '0' ELSE data_out(I);
160 data_A_temp(1,I) <= '0' WHEN sel_A(0) = '0' ELSE sample(15);
158 data_A_temp(1,I) <= '0' WHEN sel_A(0) = '0' ELSE sample(15);
161 data_A_temp(2,I) <= data_A_temp(0,I) WHEN sel_A(1) = '0' ELSE data_A_temp(1,I);
159 data_A_temp(2,I) <= data_A_temp(0,I) WHEN sel_A(1) = '0' ELSE data_A_temp(1,I);
162 data_A(I) <= data_A_temp(2,I) WHEN OPERATION_reg(14) = '0' ELSE data_B_reg(I);
160 data_A(I) <= data_A_temp(2,I) WHEN OPERATION_reg(14) = '0' ELSE data_B_reg(I);
163 END GENERATE all_data_mux_A;
161 END GENERATE all_data_mux_A;
164
162
165
163
166
164
167 -----------------------------------------------------------------------------
165 -----------------------------------------------------------------------------
168 -- ALU
166 -- ALU
169 -----------------------------------------------------------------------------
167 -----------------------------------------------------------------------------
170 ALU_OP <= OPERATION_reg(6 DOWNTO 5);
168 ALU_OP <= OPERATION_reg(6 DOWNTO 5);
171
169
172 ALU: cic_lfr_add_sub
170 ALU: cic_lfr_add_sub
173 PORT MAP (
171 PORT MAP (
174 clk => clk,
172 clk => clk,
175 rstn => rstn,
173 rstn => rstn,
176 run => run,
174 run => run,
177
175
178 OP => ALU_OP,
176 OP => ALU_OP,
179
177
180 data_in_A => data_A,
178 data_in_A => data_A,
181 data_in_B => data_B,
179 data_in_B => data_B,
182 data_in_Carry => data_in_Carry,
180 data_in_Carry => data_in_Carry,
183
181
184 data_out => data_out,
182 data_out => data_out,
185 data_out_Carry => data_out_Carry);
183 data_out_Carry => data_out_Carry);
186
184
187 -----------------------------------------------------------------------------
185 -----------------------------------------------------------------------------
188 -- CARRY_MANAGER
186 -- CARRY_MANAGER
189 -----------------------------------------------------------------------------
187 -----------------------------------------------------------------------------
190 data_in_Carry <= carry_reg(S_parameter-2) WHEN OPERATION_reg(7) = '0' ELSE carry_reg(S_parameter-1);
188 data_in_Carry <= carry_reg(S_parameter-2) WHEN OPERATION_reg(7) = '0' ELSE carry_reg(S_parameter-1);
191
189
192 -- CARRY_PUSH <= OPERATION_reg(7);
190 -- CARRY_PUSH <= OPERATION_reg(7);
193 -- CARRY_POP <= OPERATION_reg(6);
191 -- CARRY_POP <= OPERATION_reg(6);
194
192
195 PROCESS (clk, rstn)
193 PROCESS (clk, rstn)
196 BEGIN -- PROCESS
194 BEGIN -- PROCESS
197 IF rstn = '0' THEN -- asynchronous reset (active low)
195 IF rstn = '0' THEN -- asynchronous reset (active low)
198 carry_reg <= (OTHERS => '0');
196 carry_reg <= (OTHERS => '0');
199 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
197 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
200 --IF CARRY_POP = '1' OR CARRY_PUSH = '1' THEN
198 --IF CARRY_POP = '1' OR CARRY_PUSH = '1' THEN
201 carry_reg(S_parameter-1 DOWNTO 1) <= carry_reg(S_parameter-2 DOWNTO 0);
199 carry_reg(S_parameter-1 DOWNTO 1) <= carry_reg(S_parameter-2 DOWNTO 0);
202 carry_reg(0) <= data_out_Carry;
200 carry_reg(0) <= data_out_Carry;
203 --END IF;
201 --END IF;
204 END IF;
202 END IF;
205 END PROCESS;
203 END PROCESS;
206
204
207 -----------------------------------------------------------------------------
205 -----------------------------------------------------------------------------
208 -- MEMORY
206 -- MEMORY
209 -----------------------------------------------------------------------------
207 -----------------------------------------------------------------------------
210 all_bit_base_ADDR: FOR J IN 8 DOWNTO 0 GENERATE
208 all_bit_base_ADDR: FOR J IN 8 DOWNTO 0 GENERATE
211 all_channel: FOR I IN 7 DOWNTO 0 GENERATE
209 all_channel: FOR I IN 7 DOWNTO 0 GENERATE
212 base_addr_INT(I)(J) <= '1' WHEN (base_addr_delta * I/(2**J)) MOD 2 = 1 ELSE '0';
210 base_addr_INT(I)(J) <= '1' WHEN (base_addr_delta * I/(2**J)) MOD 2 = 1 ELSE '0';
213 END GENERATE all_channel;
211 END GENERATE all_channel;
214 END GENERATE all_bit_base_ADDR;
212 END GENERATE all_bit_base_ADDR;
215
213
216
214
217 addr_base_sel <= base_addr_INT(to_integer(UNSIGNED(OPERATION(2 DOWNTO 0))));
215 addr_base_sel <= base_addr_INT(to_integer(UNSIGNED(OPERATION(2 DOWNTO 0))));
218
216
219 cic_lfr_address_gen_1: cic_lfr_address_gen
217 cic_lfr_address_gen_1: cic_lfr_address_gen
220 GENERIC MAP (
218 GENERIC MAP (
221 ADDR_SIZE => 9)
219 ADDR_SIZE => 9)
222 PORT MAP (
220 PORT MAP (
223 clk => clk,
221 clk => clk,
224 rstn => rstn,
222 rstn => rstn,
225 run => run,
223 run => run,
226
224
227 addr_base => addr_base_sel,
225 addr_base => addr_base_sel,
228 addr_init => OPERATION(8),
226 addr_init => OPERATION(8),
229 addr_add_1 => OPERATION(9),
227 addr_add_1 => OPERATION(9),
230 addr => addr_gen);
228 addr => addr_gen);
231
229
232
230
233 addr_read <= addr_gen WHEN OPERATION(12 DOWNTO 10) = "000" ELSE
231 addr_read <= addr_gen WHEN OPERATION(12 DOWNTO 10) = "000" ELSE
234 STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(addr_base_sel))+2,9)) WHEN OPERATION(12 DOWNTO 10) = "001" ELSE
232 STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(addr_base_sel))+2,9)) WHEN OPERATION(12 DOWNTO 10) = "001" ELSE
235 STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(addr_base_sel))+5,9)) WHEN OPERATION(12 DOWNTO 10) = "010" ELSE
233 STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(addr_base_sel))+5,9)) WHEN OPERATION(12 DOWNTO 10) = "010" ELSE
236 STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(addr_base_sel))+8,9)) WHEN OPERATION(12 DOWNTO 10) = "011" ELSE
234 STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(addr_base_sel))+8,9)) WHEN OPERATION(12 DOWNTO 10) = "011" ELSE
237 STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(addr_gen ))+6,9)) WHEN OPERATION(12 DOWNTO 10) = "100" ELSE
235 STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(addr_gen ))+6,9)) WHEN OPERATION(12 DOWNTO 10) = "100" ELSE
238 STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(addr_gen ))+15,9));
236 STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(addr_gen ))+15,9));
239
237
240 PROCESS (clk, rstn)
238 PROCESS (clk, rstn)
241 BEGIN -- PROCESS
239 BEGIN -- PROCESS
242 IF rstn = '0' THEN -- asynchronous reset (active low)
240 IF rstn = '0' THEN -- asynchronous reset (active low)
243 addr_write <= (OTHERS => '0');
241 addr_write <= (OTHERS => '0');
244 data_we <= '0';
242 data_we <= '0';
245 addr_write_s <= (OTHERS => '0');
243 addr_write_s <= (OTHERS => '0');
246 data_we_s <= '0';
244 data_we_s <= '0';
247 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
245 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
248 addr_write_s <= addr_read;
246 addr_write_s <= addr_read;
249 data_we_s <= OPERATION(13);
247 data_we_s <= OPERATION(13);
250 IF OPERATION_reg(15) = '0' THEN
248 IF OPERATION_reg(15) = '0' THEN
251 addr_write <= addr_write_s;
249 addr_write <= addr_write_s;
252 ELSE
250 ELSE
253 addr_write <= addr_read;
251 addr_write <= addr_read;
254 END IF;
252 END IF;
255 data_we <= data_we_s;
253 data_we <= data_we_s;
256 END IF;
254 END IF;
257 END PROCESS;
255 END PROCESS;
258
256
259 memCEL : IF use_RAM_nCEL = 0 GENERATE
257 memCEL : IF use_RAM_nCEL = 0 GENERATE
260 data_wen <= NOT data_we;
258 data_wen <= NOT data_we;
261 RAMblk : RAM_CEL
259 RAMblk : RAM_CEL
262 GENERIC MAP(16, 9)
260 GENERIC MAP(16, 9)
263 PORT MAP(
261 PORT MAP(
264 WD => data_out,
262 WD => data_out,
265 RD => data_B,
263 RD => data_B,
266 WEN => data_wen,
264 WEN => data_wen,
267 REN => '0',
265 REN => '0',
268 WADDR => addr_write,
266 WADDR => addr_write,
269 RADDR => addr_read,
267 RADDR => addr_read,
270 RWCLK => clk,
268 RWCLK => clk,
271 RESET => rstn
269 RESET => rstn
272 ) ;
270 ) ;
273 END GENERATE;
271 END GENERATE;
274
272
275 memRAM : IF use_RAM_nCEL = 1 GENERATE
273 memRAM : IF use_RAM_nCEL = 1 GENERATE
276 SRAM : syncram_2p
274 SRAM : syncram_2p
277 GENERIC MAP(tech, 9, 16)
275 GENERIC MAP(tech, 9, 16)
278 PORT MAP(clk, '1', addr_read, data_B,
276 PORT MAP(clk, '1', addr_read, data_B,
279 clk, data_we, addr_write, data_out);
277 clk, data_we, addr_write, data_out);
280 END GENERATE;
278 END GENERATE;
281
279
282 -----------------------------------------------------------------------------
280 -----------------------------------------------------------------------------
283 -- CONTROL
281 -- CONTROL
284 -----------------------------------------------------------------------------
282 -----------------------------------------------------------------------------
285 cic_lfr_control_1: cic_lfr_control_r2
283 cic_lfr_control_1: cic_lfr_control_r2
286 PORT MAP (
284 PORT MAP (
287 clk => clk,
285 clk => clk,
288 rstn => rstn,
286 rstn => rstn,
289 run => run,
287 run => run,
290 data_in_valid => data_in_valid,
288 data_in_valid => data_in_valid,
291 data_out_16_valid => data_out_16_valid_s,
289 data_out_16_valid => data_out_16_valid_s,
292 data_out_256_valid => data_out_256_valid_s,
290 data_out_256_valid => data_out_256_valid_s,
293 OPERATION => OPERATION);
291 OPERATION => OPERATION);
294
292
295 -----------------------------------------------------------------------------
293 -----------------------------------------------------------------------------
296 PROCESS (clk, rstn)
294 PROCESS (clk, rstn)
297 BEGIN -- PROCESS
295 BEGIN -- PROCESS
298 IF rstn = '0' THEN -- asynchronous reset (active low)
296 IF rstn = '0' THEN -- asynchronous reset (active low)
299 data_out_16_valid_s1 <= '0';
297 data_out_16_valid_s1 <= '0';
300 data_out_256_valid_s1 <= '0';
298 data_out_256_valid_s1 <= '0';
301 data_out_16_valid_s2 <= '0';
299 data_out_16_valid_s2 <= '0';
302 data_out_256_valid_s2 <= '0';
300 data_out_256_valid_s2 <= '0';
303 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
301 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
304 data_out_16_valid_s1 <= data_out_16_valid_s;
302 data_out_16_valid_s1 <= data_out_16_valid_s;
305 data_out_256_valid_s1 <= data_out_256_valid_s;
303 data_out_256_valid_s1 <= data_out_256_valid_s;
306 data_out_16_valid_s2 <= data_out_16_valid_s1;
304 data_out_16_valid_s2 <= data_out_16_valid_s1;
307 data_out_256_valid_s2 <= data_out_256_valid_s1;
305 data_out_256_valid_s2 <= data_out_256_valid_s1;
308 END IF;
306 END IF;
309 END PROCESS;
307 END PROCESS;
310
308
311 PROCESS (clk, rstn)
309 PROCESS (clk, rstn)
312 BEGIN -- PROCESS
310 BEGIN -- PROCESS
313 IF rstn = '0' THEN -- asynchronous reset (active low)
311 IF rstn = '0' THEN -- asynchronous reset (active low)
314 sample_valid_reg16 <= "00000" & "000000" & "000001";
312 sample_valid_reg16 <= "00000" & "000000" & "000001";
315 sample_valid_reg256 <= '0' & "000000" & "000000" & "000001";
313 sample_valid_reg256 <= '0' & "000000" & "000000" & "000001";
316 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
314 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
317 IF run = '0' THEN
315 IF run = '0' THEN
318 sample_valid_reg16 <= "00000" & "000000" & "000001";
316 sample_valid_reg16 <= "00000" & "000000" & "000001";
319 sample_valid_reg256 <= '0' & "000000" & "000000" & "000001";
317 sample_valid_reg256 <= '0' & "000000" & "000000" & "000001";
320 ELSE
318 ELSE
321 IF data_out_16_valid_s2 = '1' OR sample_valid_reg16(8*2) = '1' THEN
319 IF data_out_16_valid_s2 = '1' OR sample_valid_reg16(8*2) = '1' THEN
322 sample_valid_reg16 <= sample_valid_reg16(8*2-1 DOWNTO 0) & sample_valid_reg16(8*2);
320 sample_valid_reg16 <= sample_valid_reg16(8*2-1 DOWNTO 0) & sample_valid_reg16(8*2);
323 END IF;
321 END IF;
324 IF data_out_256_valid_s2 = '1' OR sample_valid_reg256(6*3) = '1' THEN
322 IF data_out_256_valid_s2 = '1' OR sample_valid_reg256(6*3) = '1' THEN
325 sample_valid_reg256 <= sample_valid_reg256(6*3-1 DOWNTO 0) & sample_valid_reg256(6*3);
323 sample_valid_reg256 <= sample_valid_reg256(6*3-1 DOWNTO 0) & sample_valid_reg256(6*3);
326 END IF;
324 END IF;
327 END IF;
325 END IF;
328 END IF;
326 END IF;
329 END PROCESS;
327 END PROCESS;
330
328
331 data_out_16_valid <= sample_valid_reg16(8*2);
329 data_out_16_valid <= sample_valid_reg16(8*2);
332 data_out_256_valid <= sample_valid_reg256(6*3);
330 data_out_256_valid <= sample_valid_reg256(6*3);
333
331
334 -----------------------------------------------------------------------------
332 -----------------------------------------------------------------------------
335
333
336 all_bits: FOR J IN 15 DOWNTO 0 GENERATE
334 all_bits: FOR J IN 15 DOWNTO 0 GENERATE
337 all_channel_out16: FOR I IN 8*2-1 DOWNTO 0 GENERATE
335 all_channel_out16: FOR I IN 8*2-1 DOWNTO 0 GENERATE
338 PROCESS (clk, rstn)
336 PROCESS (clk, rstn)
339 BEGIN -- PROCESS
337 BEGIN -- PROCESS
340 IF rstn = '0' THEN -- asynchronous reset (active low)
338 IF rstn = '0' THEN -- asynchronous reset (active low)
341 sample_out_reg16(I,J) <= '0';
339 sample_out_reg16(I,J) <= '0';
342 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
340 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
343 IF run = '0' THEN
341 IF run = '0' THEN
344 sample_out_reg16(I,J) <= '0';
342 sample_out_reg16(I,J) <= '0';
345 ELSE
343 ELSE
346 IF sample_valid_reg16(I) = '1' AND data_out_16_valid_s2 = '1' THEN
344 IF sample_valid_reg16(I) = '1' AND data_out_16_valid_s2 = '1' THEN
347 sample_out_reg16(I,J) <= data_out(J);
345 sample_out_reg16(I,J) <= data_out(J);
348 END IF;
346 END IF;
349 END IF;
347 END IF;
350 END IF;
348 END IF;
351 END PROCESS;
349 END PROCESS;
352 END GENERATE all_channel_out16;
350 END GENERATE all_channel_out16;
353
351
354 all_channel_out256: FOR I IN 6*3-1 DOWNTO 0 GENERATE
352 all_channel_out256: FOR I IN 6*3-1 DOWNTO 0 GENERATE
355 PROCESS (clk, rstn)
353 PROCESS (clk, rstn)
356 BEGIN -- PROCESS
354 BEGIN -- PROCESS
357 IF rstn = '0' THEN -- asynchronous reset (active low)
355 IF rstn = '0' THEN -- asynchronous reset (active low)
358 sample_out_reg256(I,J) <= '0';
356 sample_out_reg256(I,J) <= '0';
359 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
357 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
360 IF run = '0' THEN
358 IF run = '0' THEN
361 sample_out_reg256(I,J) <= '0';
359 sample_out_reg256(I,J) <= '0';
362 ELSE
360 ELSE
363 IF sample_valid_reg256(I) = '1' AND data_out_256_valid_s2 = '1' THEN
361 IF sample_valid_reg256(I) = '1' AND data_out_256_valid_s2 = '1' THEN
364 sample_out_reg256(I,J) <= data_out(J);
362 sample_out_reg256(I,J) <= data_out(J);
365 END IF;
363 END IF;
366 END IF;
364 END IF;
367 END IF;
365 END IF;
368 END PROCESS;
366 END PROCESS;
369 END GENERATE all_channel_out256;
367 END GENERATE all_channel_out256;
370 END GENERATE all_bits;
368 END GENERATE all_bits;
371
369
372
370
373 all_bits_16: FOR J IN 15 DOWNTO 0 GENERATE
371 all_bits_16: FOR J IN 15 DOWNTO 0 GENERATE
374 all_reg_16: FOR K IN 1 DOWNTO 0 GENERATE
372 all_reg_16: FOR K IN 1 DOWNTO 0 GENERATE
375 sample_out_reg16_s(0,J+(K*16)) <= sample_out_reg16(2*0+K,J);
373 sample_out_reg16_s(0,J+(K*16)) <= sample_out_reg16(2*0+K,J);
376 sample_out_reg16_s(1,J+(K*16)) <= sample_out_reg16(2*1+K,J) WHEN param_r2 = '1' ELSE sample_out_reg16(2*6+K,J);
374 sample_out_reg16_s(1,J+(K*16)) <= sample_out_reg16(2*1+K,J) WHEN param_r2 = '1' ELSE sample_out_reg16(2*6+K,J);
377 sample_out_reg16_s(2,J+(K*16)) <= sample_out_reg16(2*2+K,J) WHEN param_r2 = '1' ELSE sample_out_reg16(2*7+K,J);
375 sample_out_reg16_s(2,J+(K*16)) <= sample_out_reg16(2*2+K,J) WHEN param_r2 = '1' ELSE sample_out_reg16(2*7+K,J);
378 sample_out_reg16_s(3,J+(K*16)) <= sample_out_reg16(2*3+K,J);
376 sample_out_reg16_s(3,J+(K*16)) <= sample_out_reg16(2*3+K,J);
379 sample_out_reg16_s(4,J+(K*16)) <= sample_out_reg16(2*4+K,J);
377 sample_out_reg16_s(4,J+(K*16)) <= sample_out_reg16(2*4+K,J);
380 sample_out_reg16_s(5,J+(K*16)) <= sample_out_reg16(2*5+K,J);
378 sample_out_reg16_s(5,J+(K*16)) <= sample_out_reg16(2*5+K,J);
381 END GENERATE all_reg_16;
379 END GENERATE all_reg_16;
382 END GENERATE all_bits_16;
380 END GENERATE all_bits_16;
383
381
384 all_channel_out_256: FOR I IN 5 DOWNTO 0 GENERATE
382 all_channel_out_256: FOR I IN 5 DOWNTO 0 GENERATE
385 all_bits_256: FOR J IN 15 DOWNTO 0 GENERATE
383 all_bits_256: FOR J IN 15 DOWNTO 0 GENERATE
386 all_reg_256: FOR K IN 2 DOWNTO 0 GENERATE
384 all_reg_256: FOR K IN 2 DOWNTO 0 GENERATE
387 sample_out_reg256_s(I,J+(K*16)) <= sample_out_reg256(3*I+K,J);
385 sample_out_reg256_s(I,J+(K*16)) <= sample_out_reg256(3*I+K,J);
388 END GENERATE all_reg_256;
386 END GENERATE all_reg_256;
389 END GENERATE all_bits_256;
387 END GENERATE all_bits_256;
390 END GENERATE all_channel_out_256;
388 END GENERATE all_channel_out_256;
391
389
392 all_channel_out_v: FOR I IN 5 DOWNTO 0 GENERATE
390 all_channel_out_v: FOR I IN 5 DOWNTO 0 GENERATE
393 all_bits: FOR J IN 15 DOWNTO 0 GENERATE
391 all_bits: FOR J IN 15 DOWNTO 0 GENERATE
394 data_out_256(I,J) <= sample_out_reg256_s(I,J+16*2-32+27);
392 data_out_256(I,J) <= sample_out_reg256_s(I,J+16*2-32+27);
395 data_out_16(I,J) <= sample_out_reg16_s (I,J+16 -16+15);
393 data_out_16(I,J) <= sample_out_reg16_s (I,J+16 -16+15);
396 END GENERATE all_bits;
394 END GENERATE all_bits;
397 END GENERATE all_channel_out_v;
395 END GENERATE all_channel_out_v;
398
396
399 END beh;
397 END beh;
400
@@ -1,396 +1,397
1 ----------------------------------------------------------------------------------
1 ----------------------------------------------------------------------------------
2 -- Company:
2 -- Company:
3 -- Engineer:
3 -- Engineer:
4 --
4 --
5 -- Create Date: 11:17:05 07/02/2012
5 -- Create Date: 11:17:05 07/02/2012
6 -- Design Name:
6 -- Design Name:
7 -- Module Name: apb_lfr_time_management - Behavioral
7 -- Module Name: apb_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 USE IEEE.NUMERIC_STD.ALL;
22 USE IEEE.NUMERIC_STD.ALL;
23 LIBRARY grlib;
23 LIBRARY grlib;
24 USE grlib.amba.ALL;
24 USE grlib.amba.ALL;
25 USE grlib.stdlib.ALL;
25 USE grlib.stdlib.ALL;
26 USE grlib.devices.ALL;
26 USE grlib.devices.ALL;
27 LIBRARY lpp;
27 LIBRARY lpp;
28 USE lpp.apb_devices_list.ALL;
28 USE lpp.apb_devices_list.ALL;
29 USE lpp.general_purpose.ALL;
29 USE lpp.general_purpose.ALL;
30 USE lpp.lpp_lfr_management.ALL;
30 USE lpp.lpp_lfr_management.ALL;
31 USE lpp.lpp_lfr_management_apbreg_pkg.ALL;
31 USE lpp.lpp_lfr_management_apbreg_pkg.ALL;
32
32
33
33
34 ENTITY apb_lfr_management IS
34 ENTITY apb_lfr_management IS
35
35
36 GENERIC(
36 GENERIC(
37 pindex : INTEGER := 0; --! APB slave index
37 pindex : INTEGER := 0; --! APB slave index
38 paddr : INTEGER := 0; --! ADDR field of the APB BAR
38 paddr : INTEGER := 0; --! ADDR field of the APB BAR
39 pmask : INTEGER := 16#fff#; --! MASK field of the APB BAR
39 pmask : INTEGER := 16#fff#; --! MASK field of the APB BAR
40 FIRST_DIVISION : INTEGER := 374;
40 FIRST_DIVISION : INTEGER := 374;
41 NB_SECOND_DESYNC : INTEGER := 60
41 NB_SECOND_DESYNC : INTEGER := 60
42 );
42 );
43
43
44 PORT (
44 PORT (
45 clk25MHz : IN STD_LOGIC; --! Clock
45 clk25MHz : IN STD_LOGIC; --! Clock
46 clk24_576MHz : IN STD_LOGIC; --! secondary clock
46 clk24_576MHz : IN STD_LOGIC; --! secondary clock
47 resetn : IN STD_LOGIC; --! Reset
47 resetn : IN STD_LOGIC; --! Reset
48
48
49 grspw_tick : IN STD_LOGIC; --! grspw signal asserted when a valid time-code is received
49 grspw_tick : IN STD_LOGIC; --! grspw signal asserted when a valid time-code is received
50
50
51 apbi : IN apb_slv_in_type; --! APB slave input signals
51 apbi : IN apb_slv_in_type; --! APB slave input signals
52 apbo : OUT apb_slv_out_type; --! APB slave output signals
52 apbo : OUT apb_slv_out_type; --! APB slave output signals
53 ---------------------------------------------------------------------------
53 ---------------------------------------------------------------------------
54 HK_sample : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
54 HK_sample : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
55 HK_val : IN STD_LOGIC;
55 HK_val : IN STD_LOGIC;
56 HK_sel : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
56 HK_sel : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
57 ---------------------------------------------------------------------------
57 ---------------------------------------------------------------------------
58 coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --! coarse time
58 coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --! coarse time
59 fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); --! fine TIME
59 fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); --! fine TIME
60 ---------------------------------------------------------------------------
60 ---------------------------------------------------------------------------
61 LFR_soft_rstn : OUT STD_LOGIC
61 LFR_soft_rstn : OUT STD_LOGIC
62 );
62 );
63
63
64 END apb_lfr_management;
64 END apb_lfr_management;
65
65
66 ARCHITECTURE Behavioral OF apb_lfr_management IS
66 ARCHITECTURE Behavioral OF apb_lfr_management IS
67
67
68 CONSTANT REVISION : INTEGER := 1;
68 CONSTANT REVISION : INTEGER := 1;
69 CONSTANT pconfig : apb_config_type := (
69 CONSTANT pconfig : apb_config_type := (
70 0 => ahb_device_reg (VENDOR_LPP, 14, 0, REVISION, 0),
70 0 => ahb_device_reg (VENDOR_LPP, 14, 0, REVISION, 0),
71 1 => apb_iobar(paddr, pmask)
71 1 => apb_iobar(paddr, pmask)
72 );
72 );
73
73
74 TYPE apb_lfr_time_management_Reg IS RECORD
74 TYPE apb_lfr_time_management_Reg IS RECORD
75 ctrl : STD_LOGIC;
75 ctrl : STD_LOGIC;
76 soft_reset : STD_LOGIC;
76 soft_reset : STD_LOGIC;
77 coarse_time_load : STD_LOGIC_VECTOR(30 DOWNTO 0);
77 coarse_time_load : STD_LOGIC_VECTOR(30 DOWNTO 0);
78 coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
78 coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
79 fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
79 fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
80 LFR_soft_reset : STD_LOGIC;
80 LFR_soft_reset : STD_LOGIC;
81 HK_temp_0 : STD_LOGIC_VECTOR(15 DOWNTO 0);
81 HK_temp_0 : STD_LOGIC_VECTOR(15 DOWNTO 0);
82 HK_temp_1 : STD_LOGIC_VECTOR(15 DOWNTO 0);
82 HK_temp_1 : STD_LOGIC_VECTOR(15 DOWNTO 0);
83 HK_temp_2 : STD_LOGIC_VECTOR(15 DOWNTO 0);
83 HK_temp_2 : STD_LOGIC_VECTOR(15 DOWNTO 0);
84 END RECORD;
84 END RECORD;
85 SIGNAL r : apb_lfr_time_management_Reg;
85 SIGNAL r : apb_lfr_time_management_Reg;
86
86
87 SIGNAL Rdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
87 SIGNAL Rdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
88 SIGNAL force_tick : STD_LOGIC;
88 SIGNAL force_tick : STD_LOGIC;
89 SIGNAL previous_force_tick : STD_LOGIC;
89 SIGNAL previous_force_tick : STD_LOGIC;
90 SIGNAL soft_tick : STD_LOGIC;
90 SIGNAL soft_tick : STD_LOGIC;
91
91
92 SIGNAL coarsetime_reg_updated : STD_LOGIC;
92 SIGNAL coarsetime_reg_updated : STD_LOGIC;
93 SIGNAL coarsetime_reg : STD_LOGIC_VECTOR(30 DOWNTO 0);
93 SIGNAL coarsetime_reg : STD_LOGIC_VECTOR(30 DOWNTO 0);
94
94
95 --SIGNAL coarse_time_new : STD_LOGIC;
95 --SIGNAL coarse_time_new : STD_LOGIC;
96 SIGNAL coarse_time_new_49 : STD_LOGIC;
96 SIGNAL coarse_time_new_49 : STD_LOGIC;
97 SIGNAL coarse_time_49 : STD_LOGIC_VECTOR(31 DOWNTO 0);
97 SIGNAL coarse_time_49 : STD_LOGIC_VECTOR(31 DOWNTO 0);
98 SIGNAL coarse_time_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
98 SIGNAL coarse_time_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
99
99
100 --SIGNAL fine_time_new : STD_LOGIC;
100 --SIGNAL fine_time_new : STD_LOGIC;
101 --SIGNAL fine_time_new_temp : STD_LOGIC;
101 --SIGNAL fine_time_new_temp : STD_LOGIC;
102 SIGNAL fine_time_new_49 : STD_LOGIC;
102 SIGNAL fine_time_new_49 : STD_LOGIC;
103 SIGNAL fine_time_49 : STD_LOGIC_VECTOR(15 DOWNTO 0);
103 SIGNAL fine_time_49 : STD_LOGIC_VECTOR(15 DOWNTO 0);
104 SIGNAL fine_time_s : STD_LOGIC_VECTOR(15 DOWNTO 0);
104 SIGNAL fine_time_s : STD_LOGIC_VECTOR(15 DOWNTO 0);
105 SIGNAL tick : STD_LOGIC;
105 SIGNAL tick : STD_LOGIC;
106 SIGNAL new_timecode : STD_LOGIC;
106 SIGNAL new_timecode : STD_LOGIC;
107 SIGNAL new_coarsetime : STD_LOGIC;
107 SIGNAL new_coarsetime : STD_LOGIC;
108
108
109 SIGNAL time_new_49 : STD_LOGIC;
109 SIGNAL time_new_49 : STD_LOGIC;
110 SIGNAL time_new : STD_LOGIC;
110 SIGNAL time_new : STD_LOGIC;
111
111
112 -----------------------------------------------------------------------------
112 -----------------------------------------------------------------------------
113 SIGNAL force_reset : STD_LOGIC;
113 SIGNAL force_reset : STD_LOGIC;
114 SIGNAL previous_force_reset : STD_LOGIC;
114 SIGNAL previous_force_reset : STD_LOGIC;
115 SIGNAL soft_reset : STD_LOGIC;
115 SIGNAL soft_reset : STD_LOGIC;
116 SIGNAL soft_reset_sync : STD_LOGIC;
116 SIGNAL soft_reset_sync : STD_LOGIC;
117 -----------------------------------------------------------------------------
117 -----------------------------------------------------------------------------
118 SIGNAL HK_temp_0_s : STD_LOGIC_VECTOR(15 DOWNTO 0);
119 SIGNAL HK_temp_1_s : STD_LOGIC_VECTOR(15 DOWNTO 0);
120 SIGNAL HK_temp_2_s : STD_LOGIC_VECTOR(15 DOWNTO 0);
121 SIGNAL HK_sel_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
118 SIGNAL HK_sel_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
122
119
123 SIGNAL previous_fine_time_bit : STD_LOGIC;
120 SIGNAL previous_fine_time_bit : STD_LOGIC;
124
121
125 SIGNAL rstn_LFR_TM : STD_LOGIC;
122 SIGNAL rstn_LFR_TM : STD_LOGIC;
126
123
127 BEGIN
124 BEGIN
128
125
129 LFR_soft_rstn <= NOT r.LFR_soft_reset;
126 LFR_soft_rstn <= NOT r.LFR_soft_reset;
130
127
131 PROCESS(resetn, clk25MHz)
128 PROCESS(resetn, clk25MHz)
132 VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2);
129 VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2);
133 BEGIN
130 BEGIN
134
131
135 IF resetn = '0' THEN
132 IF resetn = '0' THEN
136 Rdata <= (OTHERS => '0');
133 Rdata <= (OTHERS => '0');
137 r.coarse_time_load <= (OTHERS => '0');
134 r.coarse_time_load <= (OTHERS => '0');
138 r.soft_reset <= '0';
135 r.soft_reset <= '0';
139 r.ctrl <= '0';
136 r.ctrl <= '0';
140 r.LFR_soft_reset <= '1';
137 r.LFR_soft_reset <= '1';
141
138
142 force_tick <= '0';
139 force_tick <= '0';
143 previous_force_tick <= '0';
140 previous_force_tick <= '0';
144 soft_tick <= '0';
141 soft_tick <= '0';
145
142
146 coarsetime_reg_updated <= '0';
143 coarsetime_reg_updated <= '0';
147
144
148 ELSIF clk25MHz'EVENT AND clk25MHz = '1' THEN
145 ELSIF clk25MHz'EVENT AND clk25MHz = '1' THEN
149 coarsetime_reg_updated <= '0';
146 coarsetime_reg_updated <= '0';
150
147
151 force_tick <= r.ctrl;
148 force_tick <= r.ctrl;
152 previous_force_tick <= force_tick;
149 previous_force_tick <= force_tick;
153 IF (previous_force_tick = '0') AND (force_tick = '1') THEN
150 IF (previous_force_tick = '0') AND (force_tick = '1') THEN
154 soft_tick <= '1';
151 soft_tick <= '1';
155 ELSE
152 ELSE
156 soft_tick <= '0';
153 soft_tick <= '0';
157 END IF;
154 END IF;
158
155
159 force_reset <= r.soft_reset;
156 force_reset <= r.soft_reset;
160 previous_force_reset <= force_reset;
157 previous_force_reset <= force_reset;
161 IF (previous_force_reset = '0') AND (force_reset = '1') THEN
158 IF (previous_force_reset = '0') AND (force_reset = '1') THEN
162 soft_reset <= '1';
159 soft_reset <= '1';
163 ELSE
160 ELSE
164 soft_reset <= '0';
161 soft_reset <= '0';
165 END IF;
162 END IF;
166
163
167 paddr := "000000";
164 paddr := "000000";
168 paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2);
165 paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2);
169 Rdata <= (OTHERS => '0');
166 Rdata <= (OTHERS => '0');
170
167
171
168
172 IF apbi.psel(pindex) = '1' THEN
169 IF apbi.psel(pindex) = '1' THEN
173 --APB READ OP
170 --APB READ OP
174 CASE paddr(7 DOWNTO 2) IS
171 CASE paddr(7 DOWNTO 2) IS
175 WHEN ADDR_LFR_MANAGMENT_CONTROL =>
172 WHEN ADDR_LFR_MANAGMENT_CONTROL =>
176 Rdata(0) <= r.ctrl;
173 Rdata(0) <= r.ctrl;
177 Rdata(1) <= r.soft_reset;
174 Rdata(1) <= r.soft_reset;
178 Rdata(2) <= r.LFR_soft_reset;
175 Rdata(2) <= r.LFR_soft_reset;
179 Rdata(31 DOWNTO 3) <= (OTHERS => '0');
176 Rdata(31 DOWNTO 3) <= (OTHERS => '0');
180 WHEN ADDR_LFR_MANAGMENT_TIME_LOAD =>
177 WHEN ADDR_LFR_MANAGMENT_TIME_LOAD =>
181 Rdata(30 DOWNTO 0) <= r.coarse_time_load(30 DOWNTO 0);
178 Rdata(30 DOWNTO 0) <= r.coarse_time_load(30 DOWNTO 0);
182 WHEN ADDR_LFR_MANAGMENT_TIME_COARSE =>
179 WHEN ADDR_LFR_MANAGMENT_TIME_COARSE =>
183 Rdata(31 DOWNTO 0) <= r.coarse_time(31 DOWNTO 0);
180 Rdata(31 DOWNTO 0) <= r.coarse_time(31 DOWNTO 0);
184 WHEN ADDR_LFR_MANAGMENT_TIME_FINE =>
181 WHEN ADDR_LFR_MANAGMENT_TIME_FINE =>
185 Rdata(31 DOWNTO 16) <= (OTHERS => '0');
182 Rdata(31 DOWNTO 16) <= (OTHERS => '0');
186 Rdata(15 DOWNTO 0) <= r.fine_time(15 DOWNTO 0);
183 Rdata(15 DOWNTO 0) <= r.fine_time(15 DOWNTO 0);
187 WHEN ADDR_LFR_MANAGMENT_HK_TEMP_0 =>
184 WHEN ADDR_LFR_MANAGMENT_HK_TEMP_0 =>
188 Rdata(31 DOWNTO 16) <= (OTHERS => '0');
185 Rdata(31 DOWNTO 16) <= (OTHERS => '0');
189 Rdata(15 DOWNTO 0) <= r.HK_temp_0;
186 Rdata(15 DOWNTO 0) <= r.HK_temp_0;
190 WHEN ADDR_LFR_MANAGMENT_HK_TEMP_1 =>
187 WHEN ADDR_LFR_MANAGMENT_HK_TEMP_1 =>
191 Rdata(31 DOWNTO 16) <= (OTHERS => '0');
188 Rdata(31 DOWNTO 16) <= (OTHERS => '0');
192 Rdata(15 DOWNTO 0) <= r.HK_temp_1;
189 Rdata(15 DOWNTO 0) <= r.HK_temp_1;
193 WHEN ADDR_LFR_MANAGMENT_HK_TEMP_2 =>
190 WHEN ADDR_LFR_MANAGMENT_HK_TEMP_2 =>
194 Rdata(31 DOWNTO 16) <= (OTHERS => '0');
191 Rdata(31 DOWNTO 16) <= (OTHERS => '0');
195 Rdata(15 DOWNTO 0) <= r.HK_temp_2;
192 Rdata(15 DOWNTO 0) <= r.HK_temp_2;
196 WHEN OTHERS =>
193 WHEN OTHERS =>
197 Rdata(31 DOWNTO 0) <= (OTHERS => '0');
194 Rdata(31 DOWNTO 0) <= (OTHERS => '0');
198 END CASE;
195 END CASE;
199
196
200 --APB Write OP
197 --APB Write OP
201 IF (apbi.pwrite AND apbi.penable) = '1' THEN
198 IF (apbi.pwrite AND apbi.penable) = '1' THEN
202 CASE paddr(7 DOWNTO 2) IS
199 CASE paddr(7 DOWNTO 2) IS
203 WHEN ADDR_LFR_MANAGMENT_CONTROL =>
200 WHEN ADDR_LFR_MANAGMENT_CONTROL =>
204 r.ctrl <= apbi.pwdata(0);
201 r.ctrl <= apbi.pwdata(0);
205 r.soft_reset <= apbi.pwdata(1);
202 r.soft_reset <= apbi.pwdata(1);
206 r.LFR_soft_reset <= apbi.pwdata(2);
203 r.LFR_soft_reset <= apbi.pwdata(2);
207 WHEN ADDR_LFR_MANAGMENT_TIME_LOAD =>
204 WHEN ADDR_LFR_MANAGMENT_TIME_LOAD =>
208 r.coarse_time_load <= apbi.pwdata(30 DOWNTO 0);
205 r.coarse_time_load <= apbi.pwdata(30 DOWNTO 0);
209 coarsetime_reg_updated <= '1';
206 coarsetime_reg_updated <= '1';
210 WHEN OTHERS =>
207 WHEN OTHERS =>
211 NULL;
208 NULL;
212 END CASE;
209 END CASE;
213 ELSE
210 ELSE
214 IF r.ctrl = '1' THEN
211 IF r.ctrl = '1' THEN
215 r.ctrl <= '0';
212 r.ctrl <= '0';
216 END IF;
213 END IF;
217 IF r.soft_reset = '1' THEN
214 IF r.soft_reset = '1' THEN
218 r.soft_reset <= '0';
215 r.soft_reset <= '0';
219 END IF;
216 END IF;
220 END IF;
217 END IF;
221
218
222 END IF;
219 END IF;
223
220
224 END IF;
221 END IF;
225 END PROCESS;
222 END PROCESS;
226
223
227 apbo.pirq <= (OTHERS => '0');
224 apbo.pirq <= (OTHERS => '0');
228 apbo.prdata <= Rdata;
225 apbo.prdata <= Rdata;
229 apbo.pconfig <= pconfig;
226 apbo.pconfig <= pconfig;
230 apbo.pindex <= pindex;
227 apbo.pindex <= pindex;
231
228
232 -----------------------------------------------------------------------------
229 -----------------------------------------------------------------------------
233 -- IN
230 -- IN
234 coarse_time <= r.coarse_time;
231 coarse_time <= r.coarse_time;
235 fine_time <= r.fine_time;
232 fine_time <= r.fine_time;
236 coarsetime_reg <= r.coarse_time_load;
233 coarsetime_reg <= r.coarse_time_load;
237 -----------------------------------------------------------------------------
234 -----------------------------------------------------------------------------
238
235
239 -----------------------------------------------------------------------------
236 -----------------------------------------------------------------------------
240 -- OUT
237 -- OUT
241 r.coarse_time <= coarse_time_s;
238 r.coarse_time <= coarse_time_s;
242 r.fine_time <= fine_time_s;
239 r.fine_time <= fine_time_s;
243 -----------------------------------------------------------------------------
240 -----------------------------------------------------------------------------
244
241
245 -----------------------------------------------------------------------------
242 -----------------------------------------------------------------------------
246 tick <= grspw_tick OR soft_tick;
243 tick <= grspw_tick OR soft_tick;
247
244
248 SYNC_VALID_BIT_1 : SYNC_VALID_BIT
245 SYNC_VALID_BIT_1 : SYNC_VALID_BIT
249 GENERIC MAP (
246 GENERIC MAP (
250 NB_FF_OF_SYNC => 2)
247 NB_FF_OF_SYNC => 2)
251 PORT MAP (
248 PORT MAP (
252 clk_in => clk25MHz,
249 clk_in => clk25MHz,
253 clk_out => clk24_576MHz,
250 clk_out => clk24_576MHz,
254 rstn => resetn,
251 rstn => resetn,
255 sin => tick,
252 sin => tick,
256 sout => new_timecode);
253 sout => new_timecode);
257
254
258 SYNC_VALID_BIT_2 : SYNC_VALID_BIT
255 SYNC_VALID_BIT_2 : SYNC_VALID_BIT
259 GENERIC MAP (
256 GENERIC MAP (
260 NB_FF_OF_SYNC => 2)
257 NB_FF_OF_SYNC => 2)
261 PORT MAP (
258 PORT MAP (
262 clk_in => clk25MHz,
259 clk_in => clk25MHz,
263 clk_out => clk24_576MHz,
260 clk_out => clk24_576MHz,
264 rstn => resetn,
261 rstn => resetn,
265 sin => coarsetime_reg_updated,
262 sin => coarsetime_reg_updated,
266 sout => new_coarsetime);
263 sout => new_coarsetime);
267
264
268 SYNC_VALID_BIT_3 : SYNC_VALID_BIT
265 SYNC_VALID_BIT_3 : SYNC_VALID_BIT
269 GENERIC MAP (
266 GENERIC MAP (
270 NB_FF_OF_SYNC => 2)
267 NB_FF_OF_SYNC => 2)
271 PORT MAP (
268 PORT MAP (
272 clk_in => clk25MHz,
269 clk_in => clk25MHz,
273 clk_out => clk24_576MHz,
270 clk_out => clk24_576MHz,
274 rstn => resetn,
271 rstn => resetn,
275 sin => soft_reset,
272 sin => soft_reset,
276 sout => soft_reset_sync);
273 sout => soft_reset_sync);
277
274
278 -----------------------------------------------------------------------------
275 -----------------------------------------------------------------------------
279 --SYNC_FF_1 : SYNC_FF
276 --SYNC_FF_1 : SYNC_FF
280 -- GENERIC MAP (
277 -- GENERIC MAP (
281 -- NB_FF_OF_SYNC => 2)
278 -- NB_FF_OF_SYNC => 2)
282 -- PORT MAP (
279 -- PORT MAP (
283 -- clk => clk25MHz,
280 -- clk => clk25MHz,
284 -- rstn => resetn,
281 -- rstn => resetn,
285 -- A => fine_time_new_49,
282 -- A => fine_time_new_49,
286 -- A_sync => fine_time_new_temp);
283 -- A_sync => fine_time_new_temp);
287
284
288 --lpp_front_detection_1 : lpp_front_detection
285 --lpp_front_detection_1 : lpp_front_detection
289 -- PORT MAP (
286 -- PORT MAP (
290 -- clk => clk25MHz,
287 -- clk => clk25MHz,
291 -- rstn => resetn,
288 -- rstn => resetn,
292 -- sin => fine_time_new_temp,
289 -- sin => fine_time_new_temp,
293 -- sout => fine_time_new);
290 -- sout => fine_time_new);
294
291
295 --SYNC_VALID_BIT_4 : SYNC_VALID_BIT
292 --SYNC_VALID_BIT_4 : SYNC_VALID_BIT
296 -- GENERIC MAP (
293 -- GENERIC MAP (
297 -- NB_FF_OF_SYNC => 2)
294 -- NB_FF_OF_SYNC => 2)
298 -- PORT MAP (
295 -- PORT MAP (
299 -- clk_in => clk24_576MHz,
296 -- clk_in => clk24_576MHz,
300 -- clk_out => clk25MHz,
297 -- clk_out => clk25MHz,
301 -- rstn => resetn,
298 -- rstn => resetn,
302 -- sin => coarse_time_new_49,
299 -- sin => coarse_time_new_49,
303 -- sout => coarse_time_new);
300 -- sout => coarse_time_new);
304
301
305 time_new_49 <= coarse_time_new_49 OR fine_time_new_49;
302 time_new_49 <= coarse_time_new_49 OR fine_time_new_49;
306
303
307 SYNC_VALID_BIT_4 : SYNC_VALID_BIT
304 SYNC_VALID_BIT_4 : SYNC_VALID_BIT
308 GENERIC MAP (
305 GENERIC MAP (
309 NB_FF_OF_SYNC => 2)
306 NB_FF_OF_SYNC => 2)
310 PORT MAP (
307 PORT MAP (
311 clk_in => clk24_576MHz,
308 clk_in => clk24_576MHz,
312 clk_out => clk25MHz,
309 clk_out => clk25MHz,
313 rstn => resetn,
310 rstn => resetn,
314 sin => time_new_49,
311 sin => time_new_49,
315 sout => time_new);
312 sout => time_new);
316
313
317
314
318
315
319 PROCESS (clk25MHz, resetn)
316 PROCESS (clk25MHz, resetn)
320 BEGIN -- PROCESS
317 BEGIN -- PROCESS
321 IF resetn = '0' THEN -- asynchronous reset (active low)
318 IF resetn = '0' THEN -- asynchronous reset (active low)
322 fine_time_s <= (OTHERS => '0');
319 fine_time_s <= (OTHERS => '0');
323 coarse_time_s <= (OTHERS => '0');
320 coarse_time_s <= (OTHERS => '0');
324 ELSIF clk25MHz'EVENT AND clk25MHz = '1' THEN -- rising clock edge
321 ELSIF clk25MHz'EVENT AND clk25MHz = '1' THEN -- rising clock edge
325 IF time_new = '1' THEN
322 IF time_new = '1' THEN
326 fine_time_s <= fine_time_49;
323 fine_time_s <= fine_time_49;
327 coarse_time_s <= coarse_time_49;
324 coarse_time_s <= coarse_time_49;
328 END IF;
325 END IF;
329 END IF;
326 END IF;
330 END PROCESS;
327 END PROCESS;
331
328
332
329
333 rstn_LFR_TM <= '0' WHEN resetn = '0' ELSE
330 rstn_LFR_TM <= '0' WHEN resetn = '0' ELSE
334 '0' WHEN soft_reset_sync = '1' ELSE
331 '0' WHEN soft_reset_sync = '1' ELSE
335 '1';
332 '1';
336
333
337
334
338 -----------------------------------------------------------------------------
335 -----------------------------------------------------------------------------
339 -- LFR_TIME_MANAGMENT
336 -- LFR_TIME_MANAGMENT
340 -----------------------------------------------------------------------------
337 -----------------------------------------------------------------------------
341 lfr_time_management_1 : lfr_time_management
338 lfr_time_management_1 : lfr_time_management
342 GENERIC MAP (
339 GENERIC MAP (
343 FIRST_DIVISION => FIRST_DIVISION,
340 FIRST_DIVISION => FIRST_DIVISION,
344 NB_SECOND_DESYNC => NB_SECOND_DESYNC)
341 NB_SECOND_DESYNC => NB_SECOND_DESYNC)
345 PORT MAP (
342 PORT MAP (
346 clk => clk24_576MHz,
343 clk => clk24_576MHz,
347 rstn => rstn_LFR_TM,
344 rstn => rstn_LFR_TM,
348
345
349 tick => new_timecode,
346 tick => new_timecode,
350 new_coarsetime => new_coarsetime,
347 new_coarsetime => new_coarsetime,
351 coarsetime_reg => coarsetime_reg(30 DOWNTO 0),
348 coarsetime_reg => coarsetime_reg(30 DOWNTO 0),
352
349
353 fine_time => fine_time_49,
350 fine_time => fine_time_49,
354 fine_time_new => fine_time_new_49,
351 fine_time_new => fine_time_new_49,
355 coarse_time => coarse_time_49,
352 coarse_time => coarse_time_49,
356 coarse_time_new => coarse_time_new_49);
353 coarse_time_new => coarse_time_new_49);
357
354
358 -----------------------------------------------------------------------------
355 -----------------------------------------------------------------------------
359 -- HK
356 -- HK
360 -----------------------------------------------------------------------------
357 -----------------------------------------------------------------------------
361
358
362 PROCESS (clk25MHz, resetn)
359 PROCESS (clk25MHz, resetn)
363 CONSTANT BIT_FREQUENCY_UPDATE : INTEGER := 11; -- freq = 2^(16-BIT)
360 CONSTANT BIT_FREQUENCY_UPDATE : INTEGER := 14; -- freq = 2^(16-BIT)
364 -- for 11, the update frequency is 32Hz
365 -- for each HK, the update frequency is freq/3
361 -- for each HK, the update frequency is freq/3
362 --
363 -- for 14, the update frequency is
364 -- 4Hz and update for each
365 -- HK is 1.33Hz
366
366 BEGIN -- PROCESS
367 BEGIN -- PROCESS
367 IF resetn = '0' THEN -- asynchronous reset (active low)
368 IF resetn = '0' THEN -- asynchronous reset (active low)
368
369
369 r.HK_temp_0 <= (OTHERS => '0');
370 r.HK_temp_0 <= (OTHERS => '0');
370 r.HK_temp_1 <= (OTHERS => '0');
371 r.HK_temp_1 <= (OTHERS => '0');
371 r.HK_temp_2 <= (OTHERS => '0');
372 r.HK_temp_2 <= (OTHERS => '0');
372
373
373 HK_sel_s <= "00";
374 HK_sel_s <= "00";
374
375
375 previous_fine_time_bit <= '0';
376 previous_fine_time_bit <= '0';
376
377
377 ELSIF clk25MHz'EVENT AND clk25MHz = '1' THEN -- rising clock edge
378 ELSIF clk25MHz'EVENT AND clk25MHz = '1' THEN -- rising clock edge
378
379
379 IF HK_val = '1' THEN
380 IF HK_val = '1' THEN
380 IF previous_fine_time_bit = NOT(fine_time_s(BIT_FREQUENCY_UPDATE)) THEN
381 IF previous_fine_time_bit = NOT(fine_time_s(BIT_FREQUENCY_UPDATE)) THEN
381 previous_fine_time_bit <= fine_time_s(BIT_FREQUENCY_UPDATE);
382 previous_fine_time_bit <= fine_time_s(BIT_FREQUENCY_UPDATE);
382 CASE HK_sel_s IS
383 CASE HK_sel_s IS
383 WHEN "00" => r.HK_temp_0 <= HK_sample; HK_sel_s <= "01";
384 WHEN "00" => r.HK_temp_0 <= HK_sample; HK_sel_s <= "01";
384 WHEN "01" => r.HK_temp_1 <= HK_sample; HK_sel_s <= "10";
385 WHEN "01" => r.HK_temp_1 <= HK_sample; HK_sel_s <= "10";
385 WHEN "10" => r.HK_temp_2 <= HK_sample; HK_sel_s <= "00";
386 WHEN "10" => r.HK_temp_2 <= HK_sample; HK_sel_s <= "00";
386 WHEN OTHERS => NULL;
387 WHEN OTHERS => NULL;
387 END CASE;
388 END CASE;
388 END IF;
389 END IF;
389 END IF;
390 END IF;
390
391
391 END IF;
392 END IF;
392 END PROCESS;
393 END PROCESS;
393
394
394 HK_sel <= HK_sel_s;
395 HK_sel <= HK_sel_s;
395
396
396 END Behavioral; No newline at end of file
397 END Behavioral;
@@ -1,524 +1,542
1 LIBRARY ieee;
1 LIBRARY ieee;
2 USE ieee.std_logic_1164.ALL;
2 USE ieee.std_logic_1164.ALL;
3 USE ieee.numeric_std.ALL;
3 USE ieee.numeric_std.ALL;
4
4
5 LIBRARY lpp;
5 LIBRARY lpp;
6 USE lpp.lpp_ad_conv.ALL;
6 USE lpp.lpp_ad_conv.ALL;
7 USE lpp.iir_filter.ALL;
7 USE lpp.iir_filter.ALL;
8 USE lpp.FILTERcfg.ALL;
8 USE lpp.FILTERcfg.ALL;
9 USE lpp.lpp_memory.ALL;
9 USE lpp.lpp_memory.ALL;
10 USE lpp.lpp_waveform_pkg.ALL;
10 USE lpp.lpp_waveform_pkg.ALL;
11 USE lpp.lpp_dma_pkg.ALL;
11 USE lpp.lpp_dma_pkg.ALL;
12 USE lpp.lpp_top_lfr_pkg.ALL;
12 USE lpp.lpp_top_lfr_pkg.ALL;
13 USE lpp.lpp_lfr_pkg.ALL;
13 USE lpp.lpp_lfr_pkg.ALL;
14 USE lpp.general_purpose.ALL;
14 USE lpp.general_purpose.ALL;
15
15
16 LIBRARY techmap;
16 LIBRARY techmap;
17 USE techmap.gencomp.ALL;
17 USE techmap.gencomp.ALL;
18
18
19 LIBRARY grlib;
19 LIBRARY grlib;
20 USE grlib.amba.ALL;
20 USE grlib.amba.ALL;
21 USE grlib.stdlib.ALL;
21 USE grlib.stdlib.ALL;
22 USE grlib.devices.ALL;
22 USE grlib.devices.ALL;
23 USE GRLIB.DMA2AHB_Package.ALL;
23 USE GRLIB.DMA2AHB_Package.ALL;
24
24
25 ENTITY lpp_lfr IS
25 ENTITY lpp_lfr IS
26 GENERIC (
26 GENERIC (
27 Mem_use : INTEGER := use_RAM;
27 Mem_use : INTEGER := use_RAM;
28 nb_data_by_buffer_size : INTEGER := 11;
28 nb_data_by_buffer_size : INTEGER := 11;
29 nb_snapshot_param_size : INTEGER := 11;
29 nb_snapshot_param_size : INTEGER := 11;
30 delta_vector_size : INTEGER := 20;
30 delta_vector_size : INTEGER := 20;
31 delta_vector_size_f0_2 : INTEGER := 7;
31 delta_vector_size_f0_2 : INTEGER := 7;
32
32
33 pindex : INTEGER := 4;
33 pindex : INTEGER := 4;
34 paddr : INTEGER := 4;
34 paddr : INTEGER := 4;
35 pmask : INTEGER := 16#fff#;
35 pmask : INTEGER := 16#fff#;
36 pirq_ms : INTEGER := 0;
36 pirq_ms : INTEGER := 0;
37 pirq_wfp : INTEGER := 1;
37 pirq_wfp : INTEGER := 1;
38
38
39 hindex : INTEGER := 2;
39 hindex : INTEGER := 2;
40
40
41 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0) := (OTHERS => '0')
41 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0) := (OTHERS => '0')
42
42
43 );
43 );
44 PORT (
44 PORT (
45 clk : IN STD_LOGIC;
45 clk : IN STD_LOGIC;
46 rstn : IN STD_LOGIC;
46 rstn : IN STD_LOGIC;
47 -- SAMPLE
47 -- SAMPLE
48 sample_B : IN Samples(2 DOWNTO 0);
48 sample_B : IN Samples(2 DOWNTO 0);
49 sample_E : IN Samples(4 DOWNTO 0);
49 sample_E : IN Samples(4 DOWNTO 0);
50 sample_val : IN STD_LOGIC;
50 sample_val : IN STD_LOGIC;
51 -- APB
51 -- APB
52 apbi : IN apb_slv_in_type;
52 apbi : IN apb_slv_in_type;
53 apbo : OUT apb_slv_out_type;
53 apbo : OUT apb_slv_out_type;
54 -- AHB
54 -- AHB
55 ahbi : IN AHB_Mst_In_Type;
55 ahbi : IN AHB_Mst_In_Type;
56 ahbo : OUT AHB_Mst_Out_Type;
56 ahbo : OUT AHB_Mst_Out_Type;
57 -- TIME
57 -- TIME
58 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- todo
58 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- todo
59 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
59 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
60 --
60 --
61 data_shaping_BW : OUT STD_LOGIC;
61 data_shaping_BW : OUT STD_LOGIC;
62 --
62 --
63 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0);
63 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0);
64 debug_vector_ms : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
64 debug_vector_ms : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
65 );
65 );
66 END lpp_lfr;
66 END lpp_lfr;
67
67
68 ARCHITECTURE beh OF lpp_lfr IS
68 ARCHITECTURE beh OF lpp_lfr IS
69 SIGNAL sample_s : Samples(7 DOWNTO 0);
69 SIGNAL sample_s : Samples(7 DOWNTO 0);
70 --
70 --
71 SIGNAL data_shaping_SP0 : STD_LOGIC;
71 SIGNAL data_shaping_SP0 : STD_LOGIC;
72 SIGNAL data_shaping_SP1 : STD_LOGIC;
72 SIGNAL data_shaping_SP1 : STD_LOGIC;
73 SIGNAL data_shaping_R0 : STD_LOGIC;
73 SIGNAL data_shaping_R0 : STD_LOGIC;
74 SIGNAL data_shaping_R1 : STD_LOGIC;
74 SIGNAL data_shaping_R1 : STD_LOGIC;
75 SIGNAL data_shaping_R2 : STD_LOGIC;
75 SIGNAL data_shaping_R2 : STD_LOGIC;
76 --
76 --
77 SIGNAL sample_f0_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
77 SIGNAL sample_f0_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
78 SIGNAL sample_f1_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
78 SIGNAL sample_f1_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
79 SIGNAL sample_f2_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
79 SIGNAL sample_f2_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
80 --
80 --
81 SIGNAL sample_f0_val : STD_LOGIC;
81 SIGNAL sample_f0_val : STD_LOGIC;
82 SIGNAL sample_f1_val : STD_LOGIC;
82 SIGNAL sample_f1_val : STD_LOGIC;
83 SIGNAL sample_f2_val : STD_LOGIC;
83 SIGNAL sample_f2_val : STD_LOGIC;
84 SIGNAL sample_f3_val : STD_LOGIC;
84 SIGNAL sample_f3_val : STD_LOGIC;
85 --
85 --
86 SIGNAL sample_f0_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
86 SIGNAL sample_f0_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
87 SIGNAL sample_f1_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
87 SIGNAL sample_f1_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
88 SIGNAL sample_f2_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
88 SIGNAL sample_f2_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
89 SIGNAL sample_f3_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
89 SIGNAL sample_f3_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
90 --
90 --
91 SIGNAL sample_f0_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
91 SIGNAL sample_f0_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
92 SIGNAL sample_f1_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
92 SIGNAL sample_f1_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
93 SIGNAL sample_f2_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
93 SIGNAL sample_f2_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
94
94
95 -- SM
95 -- SM
96 SIGNAL ready_matrix_f0 : STD_LOGIC;
96 SIGNAL ready_matrix_f0 : STD_LOGIC;
97 -- SIGNAL ready_matrix_f0_1 : STD_LOGIC;
97 -- SIGNAL ready_matrix_f0_1 : STD_LOGIC;
98 SIGNAL ready_matrix_f1 : STD_LOGIC;
98 SIGNAL ready_matrix_f1 : STD_LOGIC;
99 SIGNAL ready_matrix_f2 : STD_LOGIC;
99 SIGNAL ready_matrix_f2 : STD_LOGIC;
100 SIGNAL status_ready_matrix_f0 : STD_LOGIC;
100 SIGNAL status_ready_matrix_f0 : STD_LOGIC;
101 -- SIGNAL status_ready_matrix_f0_1 : STD_LOGIC;
101 -- SIGNAL status_ready_matrix_f0_1 : STD_LOGIC;
102 SIGNAL status_ready_matrix_f1 : STD_LOGIC;
102 SIGNAL status_ready_matrix_f1 : STD_LOGIC;
103 SIGNAL status_ready_matrix_f2 : STD_LOGIC;
103 SIGNAL status_ready_matrix_f2 : STD_LOGIC;
104 SIGNAL addr_matrix_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
104 SIGNAL addr_matrix_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
105 SIGNAL addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
105 SIGNAL addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
106 SIGNAL addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
106 SIGNAL addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
107 SIGNAL length_matrix_f0 : STD_LOGIC_VECTOR(25 DOWNTO 0);
107 SIGNAL length_matrix_f0 : STD_LOGIC_VECTOR(25 DOWNTO 0);
108 SIGNAL length_matrix_f1 : STD_LOGIC_VECTOR(25 DOWNTO 0);
108 SIGNAL length_matrix_f1 : STD_LOGIC_VECTOR(25 DOWNTO 0);
109 SIGNAL length_matrix_f2 : STD_LOGIC_VECTOR(25 DOWNTO 0);
109 SIGNAL length_matrix_f2 : STD_LOGIC_VECTOR(25 DOWNTO 0);
110
110
111 -- WFP
111 -- WFP
112 SIGNAL status_new_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
112 SIGNAL status_new_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
113 SIGNAL delta_snapshot : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
113 SIGNAL delta_snapshot : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
114 SIGNAL delta_f0 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
114 SIGNAL delta_f0 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
115 SIGNAL delta_f0_2 : STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
115 SIGNAL delta_f0_2 : STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
116 SIGNAL delta_f1 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
116 SIGNAL delta_f1 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
117 SIGNAL delta_f2 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
117 SIGNAL delta_f2 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
118
118
119 SIGNAL nb_data_by_buffer : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
119 SIGNAL nb_data_by_buffer : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
120 SIGNAL nb_snapshot_param : STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
120 SIGNAL nb_snapshot_param : STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
121 SIGNAL enable_f0 : STD_LOGIC;
121 SIGNAL enable_f0 : STD_LOGIC;
122 SIGNAL enable_f1 : STD_LOGIC;
122 SIGNAL enable_f1 : STD_LOGIC;
123 SIGNAL enable_f2 : STD_LOGIC;
123 SIGNAL enable_f2 : STD_LOGIC;
124 SIGNAL enable_f3 : STD_LOGIC;
124 SIGNAL enable_f3 : STD_LOGIC;
125 SIGNAL burst_f0 : STD_LOGIC;
125 SIGNAL burst_f0 : STD_LOGIC;
126 SIGNAL burst_f1 : STD_LOGIC;
126 SIGNAL burst_f1 : STD_LOGIC;
127 SIGNAL burst_f2 : STD_LOGIC;
127 SIGNAL burst_f2 : STD_LOGIC;
128
128
129 --SIGNAL run : STD_LOGIC;
129 --SIGNAL run : STD_LOGIC;
130 SIGNAL start_date : STD_LOGIC_VECTOR(30 DOWNTO 0);
130 SIGNAL start_date : STD_LOGIC_VECTOR(30 DOWNTO 0);
131
131
132 -----------------------------------------------------------------------------
132 -----------------------------------------------------------------------------
133 --
133 --
134 -----------------------------------------------------------------------------
134 -----------------------------------------------------------------------------
135 -- SIGNAL data_f0_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
135 -- SIGNAL data_f0_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
136 -- SIGNAL data_f0_data_out_valid_s : STD_LOGIC;
136 -- SIGNAL data_f0_data_out_valid_s : STD_LOGIC;
137 -- SIGNAL data_f0_data_out_valid_burst_s : STD_LOGIC;
137 -- SIGNAL data_f0_data_out_valid_burst_s : STD_LOGIC;
138 --f1
138 --f1
139 -- SIGNAL data_f1_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
139 -- SIGNAL data_f1_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
140 -- SIGNAL data_f1_data_out_valid_s : STD_LOGIC;
140 -- SIGNAL data_f1_data_out_valid_s : STD_LOGIC;
141 -- SIGNAL data_f1_data_out_valid_burst_s : STD_LOGIC;
141 -- SIGNAL data_f1_data_out_valid_burst_s : STD_LOGIC;
142 --f2
142 --f2
143 -- SIGNAL data_f2_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
143 -- SIGNAL data_f2_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
144 -- SIGNAL data_f2_data_out_valid_s : STD_LOGIC;
144 -- SIGNAL data_f2_data_out_valid_s : STD_LOGIC;
145 -- SIGNAL data_f2_data_out_valid_burst_s : STD_LOGIC;
145 -- SIGNAL data_f2_data_out_valid_burst_s : STD_LOGIC;
146 --f3
146 --f3
147 -- SIGNAL data_f3_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
147 -- SIGNAL data_f3_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
148 -- SIGNAL data_f3_data_out_valid_s : STD_LOGIC;
148 -- SIGNAL data_f3_data_out_valid_s : STD_LOGIC;
149 -- SIGNAL data_f3_data_out_valid_burst_s : STD_LOGIC;
149 -- SIGNAL data_f3_data_out_valid_burst_s : STD_LOGIC;
150
150
151 SIGNAL wfp_status_buffer_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
151 SIGNAL wfp_status_buffer_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
152 SIGNAL wfp_addr_buffer : STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
152 SIGNAL wfp_addr_buffer : STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
153 SIGNAL wfp_length_buffer : STD_LOGIC_VECTOR(25 DOWNTO 0);
153 SIGNAL wfp_length_buffer : STD_LOGIC_VECTOR(25 DOWNTO 0);
154 SIGNAL wfp_ready_buffer : STD_LOGIC_VECTOR(3 DOWNTO 0);
154 SIGNAL wfp_ready_buffer : STD_LOGIC_VECTOR(3 DOWNTO 0);
155 SIGNAL wfp_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
155 SIGNAL wfp_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
156 SIGNAL wfp_error_buffer_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
156 SIGNAL wfp_error_buffer_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
157 -----------------------------------------------------------------------------
157 -----------------------------------------------------------------------------
158 -- DMA RR
158 -- DMA RR
159 -----------------------------------------------------------------------------
159 -----------------------------------------------------------------------------
160 -- SIGNAL dma_sel_valid : STD_LOGIC;
160 -- SIGNAL dma_sel_valid : STD_LOGIC;
161 -- SIGNAL dma_rr_valid : STD_LOGIC_VECTOR(3 DOWNTO 0);
161 -- SIGNAL dma_rr_valid : STD_LOGIC_VECTOR(3 DOWNTO 0);
162 -- SIGNAL dma_rr_grant_s : STD_LOGIC_VECTOR(3 DOWNTO 0);
162 -- SIGNAL dma_rr_grant_s : STD_LOGIC_VECTOR(3 DOWNTO 0);
163 -- SIGNAL dma_rr_grant_ms : STD_LOGIC_VECTOR(3 DOWNTO 0);
163 -- SIGNAL dma_rr_grant_ms : STD_LOGIC_VECTOR(3 DOWNTO 0);
164 -- SIGNAL dma_rr_valid_ms : STD_LOGIC_VECTOR(3 DOWNTO 0);
164 -- SIGNAL dma_rr_valid_ms : STD_LOGIC_VECTOR(3 DOWNTO 0);
165
165
166 -- SIGNAL dma_rr_grant : STD_LOGIC_VECTOR(4 DOWNTO 0);
166 -- SIGNAL dma_rr_grant : STD_LOGIC_VECTOR(4 DOWNTO 0);
167 -- SIGNAL dma_sel : STD_LOGIC_VECTOR(4 DOWNTO 0);
167 -- SIGNAL dma_sel : STD_LOGIC_VECTOR(4 DOWNTO 0);
168
168
169 -----------------------------------------------------------------------------
169 -----------------------------------------------------------------------------
170 -- DMA_REG
170 -- DMA_REG
171 -----------------------------------------------------------------------------
171 -----------------------------------------------------------------------------
172 -- SIGNAL ongoing_reg : STD_LOGIC;
172 -- SIGNAL ongoing_reg : STD_LOGIC;
173 -- SIGNAL dma_sel_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
173 -- SIGNAL dma_sel_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
174 -- SIGNAL dma_send_reg : STD_LOGIC;
174 -- SIGNAL dma_send_reg : STD_LOGIC;
175 -- SIGNAL dma_valid_burst_reg : STD_LOGIC; -- (1 => BURST , 0 => SINGLE)
175 -- SIGNAL dma_valid_burst_reg : STD_LOGIC; -- (1 => BURST , 0 => SINGLE)
176 -- SIGNAL dma_address_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
176 -- SIGNAL dma_address_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
177 -- SIGNAL dma_data_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
177 -- SIGNAL dma_data_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
178
178
179
179
180 -----------------------------------------------------------------------------
180 -----------------------------------------------------------------------------
181 -- DMA
181 -- DMA
182 -----------------------------------------------------------------------------
182 -----------------------------------------------------------------------------
183 -- SIGNAL dma_send : STD_LOGIC;
183 -- SIGNAL dma_send : STD_LOGIC;
184 -- SIGNAL dma_valid_burst : STD_LOGIC; -- (1 => BURST , 0 => SINGLE)
184 -- SIGNAL dma_valid_burst : STD_LOGIC; -- (1 => BURST , 0 => SINGLE)
185 -- SIGNAL dma_done : STD_LOGIC;
185 -- SIGNAL dma_done : STD_LOGIC;
186 -- SIGNAL dma_ren : STD_LOGIC;
186 -- SIGNAL dma_ren : STD_LOGIC;
187 -- SIGNAL dma_address : STD_LOGIC_VECTOR(31 DOWNTO 0);
187 -- SIGNAL dma_address : STD_LOGIC_VECTOR(31 DOWNTO 0);
188 -- SIGNAL dma_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
188 -- SIGNAL dma_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
189 -- SIGNAL dma_data_2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
189 -- SIGNAL dma_data_2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
190
190
191 -----------------------------------------------------------------------------
191 -----------------------------------------------------------------------------
192 -- MS
192 -- MS
193 -----------------------------------------------------------------------------
193 -----------------------------------------------------------------------------
194
194
195 -- SIGNAL data_ms_addr : STD_LOGIC_VECTOR(31 DOWNTO 0);
195 -- SIGNAL data_ms_addr : STD_LOGIC_VECTOR(31 DOWNTO 0);
196 -- SIGNAL data_ms_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
196 -- SIGNAL data_ms_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
197 -- SIGNAL data_ms_valid : STD_LOGIC;
197 -- SIGNAL data_ms_valid : STD_LOGIC;
198 -- SIGNAL data_ms_valid_burst : STD_LOGIC;
198 -- SIGNAL data_ms_valid_burst : STD_LOGIC;
199 -- SIGNAL data_ms_ren : STD_LOGIC;
199 -- SIGNAL data_ms_ren : STD_LOGIC;
200 -- SIGNAL data_ms_done : STD_LOGIC;
200 -- SIGNAL data_ms_done : STD_LOGIC;
201 -- SIGNAL dma_ms_ongoing : STD_LOGIC;
201 -- SIGNAL dma_ms_ongoing : STD_LOGIC;
202
202
203 -- SIGNAL run_ms : STD_LOGIC;
203 -- SIGNAL run_ms : STD_LOGIC;
204 -- SIGNAL ms_softandhard_rstn : STD_LOGIC;
204 -- SIGNAL ms_softandhard_rstn : STD_LOGIC;
205
205
206 SIGNAL matrix_time_f0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
206 SIGNAL matrix_time_f0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
207 -- SIGNAL matrix_time_f0_1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
207 -- SIGNAL matrix_time_f0_1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
208 SIGNAL matrix_time_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
208 SIGNAL matrix_time_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
209 SIGNAL matrix_time_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
209 SIGNAL matrix_time_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
210
210
211
211
212 SIGNAL error_buffer_full : STD_LOGIC;
212 SIGNAL error_buffer_full : STD_LOGIC;
213 SIGNAL error_input_fifo_write : STD_LOGIC_VECTOR(2 DOWNTO 0);
213 SIGNAL error_input_fifo_write : STD_LOGIC_VECTOR(2 DOWNTO 0);
214
214
215 -- SIGNAL debug_ms : STD_LOGIC_VECTOR(31 DOWNTO 0);
215 -- SIGNAL debug_ms : STD_LOGIC_VECTOR(31 DOWNTO 0);
216 -- SIGNAL debug_signal : STD_LOGIC_VECTOR(31 DOWNTO 0);
216 -- SIGNAL debug_signal : STD_LOGIC_VECTOR(31 DOWNTO 0);
217
217
218 -----------------------------------------------------------------------------
218 -----------------------------------------------------------------------------
219 SIGNAL dma_fifo_burst_valid : STD_LOGIC_VECTOR(4 DOWNTO 0);
219 SIGNAL dma_fifo_burst_valid : STD_LOGIC_VECTOR(4 DOWNTO 0);
220 SIGNAL dma_fifo_data : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
220 SIGNAL dma_fifo_data : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
221 SIGNAL dma_fifo_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
221 SIGNAL dma_fifo_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
222 SIGNAL dma_buffer_new : STD_LOGIC_VECTOR(4 DOWNTO 0);
222 SIGNAL dma_buffer_new : STD_LOGIC_VECTOR(4 DOWNTO 0);
223 SIGNAL dma_buffer_addr : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
223 SIGNAL dma_buffer_addr : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
224 SIGNAL dma_buffer_length : STD_LOGIC_VECTOR(26*5-1 DOWNTO 0);
224 SIGNAL dma_buffer_length : STD_LOGIC_VECTOR(26*5-1 DOWNTO 0);
225 SIGNAL dma_buffer_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
225 SIGNAL dma_buffer_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
226 SIGNAL dma_buffer_full_err : STD_LOGIC_VECTOR(4 DOWNTO 0);
226 SIGNAL dma_buffer_full_err : STD_LOGIC_VECTOR(4 DOWNTO 0);
227 SIGNAL dma_grant_error : STD_LOGIC;
227 SIGNAL dma_grant_error : STD_LOGIC;
228
228
229 SIGNAL apb_reg_debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0);
229 SIGNAL apb_reg_debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0);
230 -----------------------------------------------------------------------------
230 -----------------------------------------------------------------------------
231 -- SIGNAL run_dma : STD_LOGIC;
231 SIGNAL sample_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
232 SIGNAL sample_f0_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
233 SIGNAL sample_f1_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
234 SIGNAL sample_f2_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
235 SIGNAL sample_f3_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
236
232 BEGIN
237 BEGIN
233
238
234 debug_vector <= apb_reg_debug_vector;
239 debug_vector <= apb_reg_debug_vector;
235 -----------------------------------------------------------------------------
240 -----------------------------------------------------------------------------
236
241
237 sample_s(4 DOWNTO 0) <= sample_E(4 DOWNTO 0);
242 sample_s(4 DOWNTO 0) <= sample_E(4 DOWNTO 0);
238 sample_s(7 DOWNTO 5) <= sample_B(2 DOWNTO 0);
243 sample_s(7 DOWNTO 5) <= sample_B(2 DOWNTO 0);
239
244 sample_time <= coarse_time & fine_time;
245
240 --all_channel : FOR i IN 7 DOWNTO 0 GENERATE
246 --all_channel : FOR i IN 7 DOWNTO 0 GENERATE
241 -- sample_s(i) <= sample(i)(13) & sample(i)(13) & sample(i);
247 -- sample_s(i) <= sample(i)(13) & sample(i)(13) & sample(i);
242 --END GENERATE all_channel;
248 --END GENERATE all_channel;
243
249
244 -----------------------------------------------------------------------------
250 -----------------------------------------------------------------------------
245 lpp_lfr_filter_1 : lpp_lfr_filter
251 lpp_lfr_filter_1 : lpp_lfr_filter
246 GENERIC MAP (
252 GENERIC MAP (
247 Mem_use => Mem_use)
253 Mem_use => Mem_use)
248 PORT MAP (
254 PORT MAP (
249 sample => sample_s,
255 sample => sample_s,
250 sample_val => sample_val,
256 sample_val => sample_val,
257 sample_time => sample_time,
251 clk => clk,
258 clk => clk,
252 rstn => rstn,
259 rstn => rstn,
253 data_shaping_SP0 => data_shaping_SP0,
260 data_shaping_SP0 => data_shaping_SP0,
254 data_shaping_SP1 => data_shaping_SP1,
261 data_shaping_SP1 => data_shaping_SP1,
255 data_shaping_R0 => data_shaping_R0,
262 data_shaping_R0 => data_shaping_R0,
256 data_shaping_R1 => data_shaping_R1,
263 data_shaping_R1 => data_shaping_R1,
257 data_shaping_R2 => data_shaping_R2,
264 data_shaping_R2 => data_shaping_R2,
258 sample_f0_val => sample_f0_val,
265 sample_f0_val => sample_f0_val,
259 sample_f1_val => sample_f1_val,
266 sample_f1_val => sample_f1_val,
260 sample_f2_val => sample_f2_val,
267 sample_f2_val => sample_f2_val,
261 sample_f3_val => sample_f3_val,
268 sample_f3_val => sample_f3_val,
262 sample_f0_wdata => sample_f0_data,
269 sample_f0_wdata => sample_f0_data,
263 sample_f1_wdata => sample_f1_data,
270 sample_f1_wdata => sample_f1_data,
264 sample_f2_wdata => sample_f2_data,
271 sample_f2_wdata => sample_f2_data,
265 sample_f3_wdata => sample_f3_data);
272 sample_f3_wdata => sample_f3_data,
273 sample_f0_time => sample_f0_time,
274 sample_f1_time => sample_f1_time,
275 sample_f2_time => sample_f2_time,
276 sample_f3_time => sample_f3_time
277 );
266
278
267 -----------------------------------------------------------------------------
279 -----------------------------------------------------------------------------
268 lpp_lfr_apbreg_1 : lpp_lfr_apbreg
280 lpp_lfr_apbreg_1 : lpp_lfr_apbreg
269 GENERIC MAP (
281 GENERIC MAP (
270 nb_data_by_buffer_size => nb_data_by_buffer_size,
282 nb_data_by_buffer_size => nb_data_by_buffer_size,
271 -- nb_word_by_buffer_size => nb_word_by_buffer_size, -- TODO
283 -- nb_word_by_buffer_size => nb_word_by_buffer_size, -- TODO
272 nb_snapshot_param_size => nb_snapshot_param_size,
284 nb_snapshot_param_size => nb_snapshot_param_size,
273 delta_vector_size => delta_vector_size,
285 delta_vector_size => delta_vector_size,
274 delta_vector_size_f0_2 => delta_vector_size_f0_2,
286 delta_vector_size_f0_2 => delta_vector_size_f0_2,
275 pindex => pindex,
287 pindex => pindex,
276 paddr => paddr,
288 paddr => paddr,
277 pmask => pmask,
289 pmask => pmask,
278 pirq_ms => pirq_ms,
290 pirq_ms => pirq_ms,
279 pirq_wfp => pirq_wfp,
291 pirq_wfp => pirq_wfp,
280 top_lfr_version => top_lfr_version)
292 top_lfr_version => top_lfr_version)
281 PORT MAP (
293 PORT MAP (
282 HCLK => clk,
294 HCLK => clk,
283 HRESETn => rstn,
295 HRESETn => rstn,
284 apbi => apbi,
296 apbi => apbi,
285 apbo => apbo,
297 apbo => apbo,
286
298
287 run_ms => OPEN,--run_ms,
299 run_ms => OPEN,--run_ms,
288
300
289 ready_matrix_f0 => ready_matrix_f0,
301 ready_matrix_f0 => ready_matrix_f0,
290 ready_matrix_f1 => ready_matrix_f1,
302 ready_matrix_f1 => ready_matrix_f1,
291 ready_matrix_f2 => ready_matrix_f2,
303 ready_matrix_f2 => ready_matrix_f2,
292 error_buffer_full => error_buffer_full, -- TODO
304 error_buffer_full => error_buffer_full, -- TODO
293 error_input_fifo_write => error_input_fifo_write, -- TODO
305 error_input_fifo_write => error_input_fifo_write, -- TODO
294 status_ready_matrix_f0 => status_ready_matrix_f0,
306 status_ready_matrix_f0 => status_ready_matrix_f0,
295 status_ready_matrix_f1 => status_ready_matrix_f1,
307 status_ready_matrix_f1 => status_ready_matrix_f1,
296 status_ready_matrix_f2 => status_ready_matrix_f2,
308 status_ready_matrix_f2 => status_ready_matrix_f2,
297
309
298 matrix_time_f0 => matrix_time_f0,
310 matrix_time_f0 => matrix_time_f0,
299 matrix_time_f1 => matrix_time_f1,
311 matrix_time_f1 => matrix_time_f1,
300 matrix_time_f2 => matrix_time_f2,
312 matrix_time_f2 => matrix_time_f2,
301
313
302 addr_matrix_f0 => addr_matrix_f0,
314 addr_matrix_f0 => addr_matrix_f0,
303 addr_matrix_f1 => addr_matrix_f1,
315 addr_matrix_f1 => addr_matrix_f1,
304 addr_matrix_f2 => addr_matrix_f2,
316 addr_matrix_f2 => addr_matrix_f2,
305
317
306 length_matrix_f0 => length_matrix_f0,
318 length_matrix_f0 => length_matrix_f0,
307 length_matrix_f1 => length_matrix_f1,
319 length_matrix_f1 => length_matrix_f1,
308 length_matrix_f2 => length_matrix_f2,
320 length_matrix_f2 => length_matrix_f2,
309 -------------------------------------------------------------------------
321 -------------------------------------------------------------------------
310 --status_full => status_full, -- TODo
322 --status_full => status_full, -- TODo
311 --status_full_ack => status_full_ack, -- TODo
323 --status_full_ack => status_full_ack, -- TODo
312 --status_full_err => status_full_err, -- TODo
324 --status_full_err => status_full_err, -- TODo
313 status_new_err => status_new_err,
325 status_new_err => status_new_err,
314 data_shaping_BW => data_shaping_BW,
326 data_shaping_BW => data_shaping_BW,
315 data_shaping_SP0 => data_shaping_SP0,
327 data_shaping_SP0 => data_shaping_SP0,
316 data_shaping_SP1 => data_shaping_SP1,
328 data_shaping_SP1 => data_shaping_SP1,
317 data_shaping_R0 => data_shaping_R0,
329 data_shaping_R0 => data_shaping_R0,
318 data_shaping_R1 => data_shaping_R1,
330 data_shaping_R1 => data_shaping_R1,
319 data_shaping_R2 => data_shaping_R2,
331 data_shaping_R2 => data_shaping_R2,
320 delta_snapshot => delta_snapshot,
332 delta_snapshot => delta_snapshot,
321 delta_f0 => delta_f0,
333 delta_f0 => delta_f0,
322 delta_f0_2 => delta_f0_2,
334 delta_f0_2 => delta_f0_2,
323 delta_f1 => delta_f1,
335 delta_f1 => delta_f1,
324 delta_f2 => delta_f2,
336 delta_f2 => delta_f2,
325 nb_data_by_buffer => nb_data_by_buffer,
337 nb_data_by_buffer => nb_data_by_buffer,
326 -- nb_word_by_buffer => nb_word_by_buffer, -- TODO
338 -- nb_word_by_buffer => nb_word_by_buffer, -- TODO
327 nb_snapshot_param => nb_snapshot_param,
339 nb_snapshot_param => nb_snapshot_param,
328 enable_f0 => enable_f0,
340 enable_f0 => enable_f0,
329 enable_f1 => enable_f1,
341 enable_f1 => enable_f1,
330 enable_f2 => enable_f2,
342 enable_f2 => enable_f2,
331 enable_f3 => enable_f3,
343 enable_f3 => enable_f3,
332 burst_f0 => burst_f0,
344 burst_f0 => burst_f0,
333 burst_f1 => burst_f1,
345 burst_f1 => burst_f1,
334 burst_f2 => burst_f2,
346 burst_f2 => burst_f2,
335 run => OPEN, --run,
347 run => OPEN, --run,
336 start_date => start_date,
348 start_date => start_date,
337 -- debug_signal => debug_signal,
349 -- debug_signal => debug_signal,
338 wfp_status_buffer_ready => wfp_status_buffer_ready,-- TODO
350 wfp_status_buffer_ready => wfp_status_buffer_ready,-- TODO
339 wfp_addr_buffer => wfp_addr_buffer,-- TODO
351 wfp_addr_buffer => wfp_addr_buffer,-- TODO
340 wfp_length_buffer => wfp_length_buffer,-- TODO
352 wfp_length_buffer => wfp_length_buffer,-- TODO
341
353
342 wfp_ready_buffer => wfp_ready_buffer,-- TODO
354 wfp_ready_buffer => wfp_ready_buffer,-- TODO
343 wfp_buffer_time => wfp_buffer_time,-- TODO
355 wfp_buffer_time => wfp_buffer_time,-- TODO
344 wfp_error_buffer_full => wfp_error_buffer_full, -- TODO
356 wfp_error_buffer_full => wfp_error_buffer_full, -- TODO
345 -------------------------------------------------------------------------
357 -------------------------------------------------------------------------
346 sample_f3_v => sample_f3_data(1*16-1 DOWNTO 0*16),
358 sample_f3_v => sample_f3_data(1*16-1 DOWNTO 0*16),
347 sample_f3_e1 => sample_f3_data(2*16-1 DOWNTO 1*16),
359 sample_f3_e1 => sample_f3_data(2*16-1 DOWNTO 1*16),
348 sample_f3_e2 => sample_f3_data(3*16-1 DOWNTO 2*16),
360 sample_f3_e2 => sample_f3_data(3*16-1 DOWNTO 2*16),
349 sample_f3_valid => sample_f3_val,
361 sample_f3_valid => sample_f3_val,
350 debug_vector => apb_reg_debug_vector
362 debug_vector => apb_reg_debug_vector
351 );
363 );
352
364
353 -----------------------------------------------------------------------------
365 -----------------------------------------------------------------------------
354 -----------------------------------------------------------------------------
366 -----------------------------------------------------------------------------
355 lpp_waveform_1 : lpp_waveform
367 lpp_waveform_1 : lpp_waveform
356 GENERIC MAP (
368 GENERIC MAP (
357 tech => inferred,
369 tech => inferred,
358 data_size => 6*16,
370 data_size => 6*16,
359 nb_data_by_buffer_size => nb_data_by_buffer_size,
371 nb_data_by_buffer_size => nb_data_by_buffer_size,
360 nb_snapshot_param_size => nb_snapshot_param_size,
372 nb_snapshot_param_size => nb_snapshot_param_size,
361 delta_vector_size => delta_vector_size,
373 delta_vector_size => delta_vector_size,
362 delta_vector_size_f0_2 => delta_vector_size_f0_2
374 delta_vector_size_f0_2 => delta_vector_size_f0_2
363 )
375 )
364 PORT MAP (
376 PORT MAP (
365 clk => clk,
377 clk => clk,
366 rstn => rstn,
378 rstn => rstn,
367
379
368 reg_run => '1',--run,
380 reg_run => '1',--run,
369 reg_start_date => start_date,
381 reg_start_date => start_date,
370 reg_delta_snapshot => delta_snapshot,
382 reg_delta_snapshot => delta_snapshot,
371 reg_delta_f0 => delta_f0,
383 reg_delta_f0 => delta_f0,
372 reg_delta_f0_2 => delta_f0_2,
384 reg_delta_f0_2 => delta_f0_2,
373 reg_delta_f1 => delta_f1,
385 reg_delta_f1 => delta_f1,
374 reg_delta_f2 => delta_f2,
386 reg_delta_f2 => delta_f2,
375
387
376 enable_f0 => enable_f0,
388 enable_f0 => enable_f0,
377 enable_f1 => enable_f1,
389 enable_f1 => enable_f1,
378 enable_f2 => enable_f2,
390 enable_f2 => enable_f2,
379 enable_f3 => enable_f3,
391 enable_f3 => enable_f3,
380 burst_f0 => burst_f0,
392 burst_f0 => burst_f0,
381 burst_f1 => burst_f1,
393 burst_f1 => burst_f1,
382 burst_f2 => burst_f2,
394 burst_f2 => burst_f2,
383
395
384 nb_data_by_buffer => nb_data_by_buffer,
396 nb_data_by_buffer => nb_data_by_buffer,
385 nb_snapshot_param => nb_snapshot_param,
397 nb_snapshot_param => nb_snapshot_param,
386 status_new_err => status_new_err,
398 status_new_err => status_new_err,
387
399
388 status_buffer_ready => wfp_status_buffer_ready,
400 status_buffer_ready => wfp_status_buffer_ready,
389 addr_buffer => wfp_addr_buffer,
401 addr_buffer => wfp_addr_buffer,
390 length_buffer => wfp_length_buffer,
402 length_buffer => wfp_length_buffer,
391 ready_buffer => wfp_ready_buffer,
403 ready_buffer => wfp_ready_buffer,
392 buffer_time => wfp_buffer_time,
404 buffer_time => wfp_buffer_time,
393 error_buffer_full => wfp_error_buffer_full,
405 error_buffer_full => wfp_error_buffer_full,
394
406
395 coarse_time => coarse_time,
407 coarse_time => coarse_time,
396 fine_time => fine_time,
408 -- fine_time => fine_time,
397
409
398 --f0
410 --f0
399 data_f0_in_valid => sample_f0_val,
411 data_f0_in_valid => sample_f0_val,
400 data_f0_in => sample_f0_data,
412 data_f0_in => sample_f0_data,
413 data_f0_time => sample_f0_time,
401 --f1
414 --f1
402 data_f1_in_valid => sample_f1_val,
415 data_f1_in_valid => sample_f1_val,
403 data_f1_in => sample_f1_data,
416 data_f1_in => sample_f1_data,
417 data_f1_time => sample_f1_time,
404 --f2
418 --f2
405 data_f2_in_valid => sample_f2_val,
419 data_f2_in_valid => sample_f2_val,
406 data_f2_in => sample_f2_data,
420 data_f2_in => sample_f2_data,
421 data_f2_time => sample_f2_time,
407 --f3
422 --f3
408 data_f3_in_valid => sample_f3_val,
423 data_f3_in_valid => sample_f3_val,
409 data_f3_in => sample_f3_data,
424 data_f3_in => sample_f3_data,
425 data_f3_time => sample_f3_time,
410 -- OUTPUT -- DMA interface
426 -- OUTPUT -- DMA interface
411
427
412 dma_fifo_valid_burst => dma_fifo_burst_valid(3 DOWNTO 0),
428 dma_fifo_valid_burst => dma_fifo_burst_valid(3 DOWNTO 0),
413 dma_fifo_data => dma_fifo_data(32*4-1 DOWNTO 0),
429 dma_fifo_data => dma_fifo_data(32*4-1 DOWNTO 0),
414 dma_fifo_ren => dma_fifo_ren(3 DOWNTO 0),
430 dma_fifo_ren => dma_fifo_ren(3 DOWNTO 0),
415 dma_buffer_new => dma_buffer_new(3 DOWNTO 0),
431 dma_buffer_new => dma_buffer_new(3 DOWNTO 0),
416 dma_buffer_addr => dma_buffer_addr(32*4-1 DOWNTO 0),
432 dma_buffer_addr => dma_buffer_addr(32*4-1 DOWNTO 0),
417 dma_buffer_length => dma_buffer_length(26*4-1 DOWNTO 0),
433 dma_buffer_length => dma_buffer_length(26*4-1 DOWNTO 0),
418 dma_buffer_full => dma_buffer_full(3 DOWNTO 0),
434 dma_buffer_full => dma_buffer_full(3 DOWNTO 0),
419 dma_buffer_full_err => dma_buffer_full_err(3 DOWNTO 0)
435 dma_buffer_full_err => dma_buffer_full_err(3 DOWNTO 0)
420
436
421 );
437 );
422
438
423 -----------------------------------------------------------------------------
439 -----------------------------------------------------------------------------
424 -- Matrix Spectral
440 -- Matrix Spectral
425 -----------------------------------------------------------------------------
441 -----------------------------------------------------------------------------
426 sample_f0_wen <= NOT(sample_f0_val) & NOT(sample_f0_val) & NOT(sample_f0_val) &
442 sample_f0_wen <= NOT(sample_f0_val) & NOT(sample_f0_val) & NOT(sample_f0_val) &
427 NOT(sample_f0_val) & NOT(sample_f0_val);
443 NOT(sample_f0_val) & NOT(sample_f0_val);
428 sample_f1_wen <= NOT(sample_f1_val) & NOT(sample_f1_val) & NOT(sample_f1_val) &
444 sample_f1_wen <= NOT(sample_f1_val) & NOT(sample_f1_val) & NOT(sample_f1_val) &
429 NOT(sample_f1_val) & NOT(sample_f1_val);
445 NOT(sample_f1_val) & NOT(sample_f1_val);
430 sample_f2_wen <= NOT(sample_f2_val) & NOT(sample_f2_val) & NOT(sample_f2_val) &
446 sample_f2_wen <= NOT(sample_f2_val) & NOT(sample_f2_val) & NOT(sample_f2_val) &
431 NOT(sample_f2_val) & NOT(sample_f2_val);
447 NOT(sample_f2_val) & NOT(sample_f2_val);
432
448
433 sample_f0_wdata <= sample_f0_data((3*16)-1 DOWNTO (1*16)) & sample_f0_data((6*16)-1 DOWNTO (3*16)); -- (MSB) E2 E1 B2 B1 B0 (LSB)
449 sample_f0_wdata <= sample_f0_data((3*16)-1 DOWNTO (1*16)) & sample_f0_data((6*16)-1 DOWNTO (3*16)); -- (MSB) E2 E1 B2 B1 B0 (LSB)
434 sample_f1_wdata <= sample_f1_data((3*16)-1 DOWNTO (1*16)) & sample_f1_data((6*16)-1 DOWNTO (3*16));
450 sample_f1_wdata <= sample_f1_data((3*16)-1 DOWNTO (1*16)) & sample_f1_data((6*16)-1 DOWNTO (3*16));
435 sample_f2_wdata <= sample_f2_data((3*16)-1 DOWNTO (1*16)) & sample_f2_data((6*16)-1 DOWNTO (3*16));
451 sample_f2_wdata <= sample_f2_data((3*16)-1 DOWNTO (1*16)) & sample_f2_data((6*16)-1 DOWNTO (3*16));
436
452
437 -------------------------------------------------------------------------------
453 -------------------------------------------------------------------------------
438
454
439 --ms_softandhard_rstn <= rstn AND run_ms AND run;
455 --ms_softandhard_rstn <= rstn AND run_ms AND run;
440
456
441 -----------------------------------------------------------------------------
457 -----------------------------------------------------------------------------
442 lpp_lfr_ms_1 : lpp_lfr_ms
458 lpp_lfr_ms_1 : lpp_lfr_ms
443 GENERIC MAP (
459 GENERIC MAP (
444 Mem_use => Mem_use)
460 Mem_use => Mem_use)
445 PORT MAP (
461 PORT MAP (
446 clk => clk,
462 clk => clk,
447 --rstn => ms_softandhard_rstn, --rstn,
463 --rstn => ms_softandhard_rstn, --rstn,
448 rstn => rstn,
464 rstn => rstn,
449
465
450 run => '1',--run_ms,
466 run => '1',--run_ms,
451
467
452 start_date => start_date,
468 start_date => start_date,
453
469
454 coarse_time => coarse_time,
470 coarse_time => coarse_time,
455 fine_time => fine_time,
456
471
457 sample_f0_wen => sample_f0_wen,
472 sample_f0_wen => sample_f0_wen,
458 sample_f0_wdata => sample_f0_wdata,
473 sample_f0_wdata => sample_f0_wdata,
474 sample_f0_time => sample_f0_time,
459 sample_f1_wen => sample_f1_wen,
475 sample_f1_wen => sample_f1_wen,
460 sample_f1_wdata => sample_f1_wdata,
476 sample_f1_wdata => sample_f1_wdata,
477 sample_f1_time => sample_f1_time,
461 sample_f2_wen => sample_f2_wen,
478 sample_f2_wen => sample_f2_wen,
462 sample_f2_wdata => sample_f2_wdata,
479 sample_f2_wdata => sample_f2_wdata,
480 sample_f2_time => sample_f2_time,
463
481
464 --DMA
482 --DMA
465 dma_fifo_burst_valid => dma_fifo_burst_valid(4), -- OUT
483 dma_fifo_burst_valid => dma_fifo_burst_valid(4), -- OUT
466 dma_fifo_data => dma_fifo_data((4+1)*32-1 DOWNTO 4*32), -- OUT
484 dma_fifo_data => dma_fifo_data((4+1)*32-1 DOWNTO 4*32), -- OUT
467 dma_fifo_ren => dma_fifo_ren(4), -- IN
485 dma_fifo_ren => dma_fifo_ren(4), -- IN
468 dma_buffer_new => dma_buffer_new(4), -- OUT
486 dma_buffer_new => dma_buffer_new(4), -- OUT
469 dma_buffer_addr => dma_buffer_addr((4+1)*32-1 DOWNTO 4*32), -- OUT
487 dma_buffer_addr => dma_buffer_addr((4+1)*32-1 DOWNTO 4*32), -- OUT
470 dma_buffer_length => dma_buffer_length((4+1)*26-1 DOWNTO 4*26), -- OUT
488 dma_buffer_length => dma_buffer_length((4+1)*26-1 DOWNTO 4*26), -- OUT
471 dma_buffer_full => dma_buffer_full(4), -- IN
489 dma_buffer_full => dma_buffer_full(4), -- IN
472 dma_buffer_full_err => dma_buffer_full_err(4), -- IN
490 dma_buffer_full_err => dma_buffer_full_err(4), -- IN
473
491
474
492
475
493
476 --REG
494 --REG
477 ready_matrix_f0 => ready_matrix_f0,
495 ready_matrix_f0 => ready_matrix_f0,
478 ready_matrix_f1 => ready_matrix_f1,
496 ready_matrix_f1 => ready_matrix_f1,
479 ready_matrix_f2 => ready_matrix_f2,
497 ready_matrix_f2 => ready_matrix_f2,
480 error_buffer_full => error_buffer_full,
498 error_buffer_full => error_buffer_full,
481 error_input_fifo_write => error_input_fifo_write,
499 error_input_fifo_write => error_input_fifo_write,
482
500
483 status_ready_matrix_f0 => status_ready_matrix_f0,
501 status_ready_matrix_f0 => status_ready_matrix_f0,
484 status_ready_matrix_f1 => status_ready_matrix_f1,
502 status_ready_matrix_f1 => status_ready_matrix_f1,
485 status_ready_matrix_f2 => status_ready_matrix_f2,
503 status_ready_matrix_f2 => status_ready_matrix_f2,
486 addr_matrix_f0 => addr_matrix_f0,
504 addr_matrix_f0 => addr_matrix_f0,
487 addr_matrix_f1 => addr_matrix_f1,
505 addr_matrix_f1 => addr_matrix_f1,
488 addr_matrix_f2 => addr_matrix_f2,
506 addr_matrix_f2 => addr_matrix_f2,
489
507
490 length_matrix_f0 => length_matrix_f0,
508 length_matrix_f0 => length_matrix_f0,
491 length_matrix_f1 => length_matrix_f1,
509 length_matrix_f1 => length_matrix_f1,
492 length_matrix_f2 => length_matrix_f2,
510 length_matrix_f2 => length_matrix_f2,
493
511
494 matrix_time_f0 => matrix_time_f0,
512 matrix_time_f0 => matrix_time_f0,
495 matrix_time_f1 => matrix_time_f1,
513 matrix_time_f1 => matrix_time_f1,
496 matrix_time_f2 => matrix_time_f2,
514 matrix_time_f2 => matrix_time_f2,
497
515
498 debug_vector => debug_vector_ms);
516 debug_vector => debug_vector_ms);
499
517
500 -----------------------------------------------------------------------------
518 -----------------------------------------------------------------------------
501 --run_dma <= run_ms OR run;
519 --run_dma <= run_ms OR run;
502
520
503 DMA_SubSystem_1 : DMA_SubSystem
521 DMA_SubSystem_1 : DMA_SubSystem
504 GENERIC MAP (
522 GENERIC MAP (
505 hindex => hindex)
523 hindex => hindex)
506 PORT MAP (
524 PORT MAP (
507 clk => clk,
525 clk => clk,
508 rstn => rstn,
526 rstn => rstn,
509 run => '1',--run_dma,
527 run => '1',--run_dma,
510 ahbi => ahbi,
528 ahbi => ahbi,
511 ahbo => ahbo,
529 ahbo => ahbo,
512
530
513 fifo_burst_valid => dma_fifo_burst_valid, --fifo_burst_valid,
531 fifo_burst_valid => dma_fifo_burst_valid, --fifo_burst_valid,
514 fifo_data => dma_fifo_data, --fifo_data,
532 fifo_data => dma_fifo_data, --fifo_data,
515 fifo_ren => dma_fifo_ren, --fifo_ren,
533 fifo_ren => dma_fifo_ren, --fifo_ren,
516
534
517 buffer_new => dma_buffer_new, --buffer_new,
535 buffer_new => dma_buffer_new, --buffer_new,
518 buffer_addr => dma_buffer_addr, --buffer_addr,
536 buffer_addr => dma_buffer_addr, --buffer_addr,
519 buffer_length => dma_buffer_length, --buffer_length,
537 buffer_length => dma_buffer_length, --buffer_length,
520 buffer_full => dma_buffer_full, --buffer_full,
538 buffer_full => dma_buffer_full, --buffer_full,
521 buffer_full_err => dma_buffer_full_err, --buffer_full_err,
539 buffer_full_err => dma_buffer_full_err, --buffer_full_err,
522 grant_error => dma_grant_error); --grant_error);
540 grant_error => dma_grant_error); --grant_error);
523
541
524 END beh;
542 END beh; No newline at end of file
@@ -1,550 +1,640
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -- jean-christophe.pellion@easii-ic.com
21 -- jean-christophe.pellion@easii-ic.com
22 ----------------------------------------------------------------------------
22 ----------------------------------------------------------------------------
23 LIBRARY ieee;
23 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;
27 LIBRARY lpp;
28 USE lpp.lpp_ad_conv.ALL;
28 USE lpp.lpp_ad_conv.ALL;
29 USE lpp.iir_filter.ALL;
29 USE lpp.iir_filter.ALL;
30 USE lpp.FILTERcfg.ALL;
30 USE lpp.FILTERcfg.ALL;
31 USE lpp.lpp_memory.ALL;
31 USE lpp.lpp_memory.ALL;
32 USE lpp.lpp_waveform_pkg.ALL;
32 USE lpp.lpp_waveform_pkg.ALL;
33 USE lpp.cic_pkg.ALL;
33 USE lpp.cic_pkg.ALL;
34 USE lpp.data_type_pkg.ALL;
34 USE lpp.data_type_pkg.ALL;
35 USE lpp.lpp_lfr_filter_coeff.ALL;
35 USE lpp.lpp_lfr_filter_coeff.ALL;
36
36
37 LIBRARY techmap;
37 LIBRARY techmap;
38 USE techmap.gencomp.ALL;
38 USE techmap.gencomp.ALL;
39
39
40 LIBRARY grlib;
40 LIBRARY grlib;
41 USE grlib.amba.ALL;
41 USE grlib.amba.ALL;
42 USE grlib.stdlib.ALL;
42 USE grlib.stdlib.ALL;
43 USE grlib.devices.ALL;
43 USE grlib.devices.ALL;
44 USE GRLIB.DMA2AHB_Package.ALL;
44 USE GRLIB.DMA2AHB_Package.ALL;
45
45
46 ENTITY lpp_lfr_filter IS
46 ENTITY lpp_lfr_filter IS
47 GENERIC(
47 GENERIC(
48 Mem_use : INTEGER := use_RAM
48 Mem_use : INTEGER := use_RAM
49 );
49 );
50 PORT (
50 PORT (
51 sample : IN Samples(7 DOWNTO 0);
51 sample : IN Samples(7 DOWNTO 0);
52 sample_val : IN STD_LOGIC;
52 sample_val : IN STD_LOGIC;
53 sample_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
53 --
54 --
54 clk : IN STD_LOGIC;
55 clk : IN STD_LOGIC;
55 rstn : IN STD_LOGIC;
56 rstn : IN STD_LOGIC;
56 --
57 --
57 data_shaping_SP0 : IN STD_LOGIC;
58 data_shaping_SP0 : IN STD_LOGIC;
58 data_shaping_SP1 : IN STD_LOGIC;
59 data_shaping_SP1 : IN STD_LOGIC;
59 data_shaping_R0 : IN STD_LOGIC;
60 data_shaping_R0 : IN STD_LOGIC;
60 data_shaping_R1 : IN STD_LOGIC;
61 data_shaping_R1 : IN STD_LOGIC;
61 data_shaping_R2 : IN STD_LOGIC;
62 data_shaping_R2 : IN STD_LOGIC;
62 --
63 --
63 sample_f0_val : OUT STD_LOGIC;
64 sample_f0_val : OUT STD_LOGIC;
64 sample_f1_val : OUT STD_LOGIC;
65 sample_f1_val : OUT STD_LOGIC;
65 sample_f2_val : OUT STD_LOGIC;
66 sample_f2_val : OUT STD_LOGIC;
66 sample_f3_val : OUT STD_LOGIC;
67 sample_f3_val : OUT STD_LOGIC;
67 --
68 --
68 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
69 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
69 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
70 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
70 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
71 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
71 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0)
72 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
73 --
74 sample_f0_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
75 sample_f1_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
76 sample_f2_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
77 sample_f3_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0)
72 );
78 );
73 END lpp_lfr_filter;
79 END lpp_lfr_filter;
74
80
75 ARCHITECTURE tb OF lpp_lfr_filter IS
81 ARCHITECTURE tb OF lpp_lfr_filter IS
76
82
77 COMPONENT Downsampling
83 COMPONENT Downsampling
78 GENERIC (
84 GENERIC (
79 ChanelCount : INTEGER;
85 ChanelCount : INTEGER;
80 SampleSize : INTEGER;
86 SampleSize : INTEGER;
81 DivideParam : INTEGER);
87 DivideParam : INTEGER);
82 PORT (
88 PORT (
83 clk : IN STD_LOGIC;
89 clk : IN STD_LOGIC;
84 rstn : IN STD_LOGIC;
90 rstn : IN STD_LOGIC;
85 sample_in_val : IN STD_LOGIC;
91 sample_in_val : IN STD_LOGIC;
86 sample_in : IN samplT(ChanelCount-1 DOWNTO 0, SampleSize-1 DOWNTO 0);
92 sample_in : IN samplT(ChanelCount-1 DOWNTO 0, SampleSize-1 DOWNTO 0);
87 sample_out_val : OUT STD_LOGIC;
93 sample_out_val : OUT STD_LOGIC;
88 sample_out : OUT samplT(ChanelCount-1 DOWNTO 0, SampleSize-1 DOWNTO 0));
94 sample_out : OUT samplT(ChanelCount-1 DOWNTO 0, SampleSize-1 DOWNTO 0));
89 END COMPONENT;
95 END COMPONENT;
90
96
91 -----------------------------------------------------------------------------
97 -----------------------------------------------------------------------------
92 CONSTANT ChanelCount : INTEGER := 8;
98 CONSTANT ChanelCount : INTEGER := 8;
93
99
94 -----------------------------------------------------------------------------
100 -----------------------------------------------------------------------------
95 SIGNAL sample_val_delay : STD_LOGIC;
101 SIGNAL sample_val_delay : STD_LOGIC;
96 -----------------------------------------------------------------------------
102 -----------------------------------------------------------------------------
97 CONSTANT Coef_SZ : INTEGER := 9;
103 CONSTANT Coef_SZ : INTEGER := 9;
98 CONSTANT CoefCntPerCel : INTEGER := 6;
104 CONSTANT CoefCntPerCel : INTEGER := 6;
99 CONSTANT CoefPerCel : INTEGER := 5;
105 CONSTANT CoefPerCel : INTEGER := 5;
100 CONSTANT Cels_count : INTEGER := 5;
106 CONSTANT Cels_count : INTEGER := 5;
101
107
102 --SIGNAL coefs : STD_LOGIC_VECTOR((Coef_SZ*CoefCntPerCel*Cels_count)-1 DOWNTO 0);
108 --SIGNAL coefs : STD_LOGIC_VECTOR((Coef_SZ*CoefCntPerCel*Cels_count)-1 DOWNTO 0);
103 SIGNAL coefs_v2 : STD_LOGIC_VECTOR((Coef_SZ*CoefPerCel*Cels_count)-1 DOWNTO 0);
109 SIGNAL coefs_v2 : STD_LOGIC_VECTOR((Coef_SZ*CoefPerCel*Cels_count)-1 DOWNTO 0);
104 SIGNAL sample_filter_in : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
110 SIGNAL sample_filter_in : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
105 --SIGNAL sample_filter_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
111 --SIGNAL sample_filter_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
106 --
112 --
107 SIGNAL sample_filter_v2_out_val : STD_LOGIC;
113 SIGNAL sample_filter_v2_out_val : STD_LOGIC;
108 SIGNAL sample_filter_v2_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
114 SIGNAL sample_filter_v2_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
109 -----------------------------------------------------------------------------
115 -----------------------------------------------------------------------------
110 SIGNAL sample_data_shaping_out_val : STD_LOGIC;
116 SIGNAL sample_data_shaping_out_val : STD_LOGIC;
111 SIGNAL sample_data_shaping_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
117 SIGNAL sample_data_shaping_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
112 SIGNAL sample_data_shaping_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
118 SIGNAL sample_data_shaping_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
113 SIGNAL sample_data_shaping_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
119 SIGNAL sample_data_shaping_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
114 SIGNAL sample_data_shaping_f2_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
120 SIGNAL sample_data_shaping_f2_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
115 SIGNAL sample_data_shaping_f1_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
121 SIGNAL sample_data_shaping_f1_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
116 SIGNAL sample_data_shaping_f2_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
122 SIGNAL sample_data_shaping_f2_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
117 -----------------------------------------------------------------------------
123 -----------------------------------------------------------------------------
118 SIGNAL sample_filter_v2_out_val_s : STD_LOGIC;
124 SIGNAL sample_filter_v2_out_val_s : STD_LOGIC;
119 SIGNAL sample_filter_v2_out_s : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
125 SIGNAL sample_filter_v2_out_s : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
120 -----------------------------------------------------------------------------
126 -----------------------------------------------------------------------------
121 -- SIGNAL sample_f0_val : STD_LOGIC;
127 -- SIGNAL sample_f0_val : STD_LOGIC;
122 SIGNAL sample_f0 : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
128 SIGNAL sample_f0 : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
123 SIGNAL sample_f0_s : sample_vector(7 DOWNTO 0, 15 DOWNTO 0);
129 SIGNAL sample_f0_s : sample_vector(7 DOWNTO 0, 15 DOWNTO 0);
124 --
130 --
125 -- SIGNAL sample_f1_val : STD_LOGIC;
131 -- SIGNAL sample_f1_val : STD_LOGIC;
126
132
127 SIGNAL sample_f0_f1_s : samplT(5 DOWNTO 0, 17 DOWNTO 0);
133 SIGNAL sample_f0_f1_s : samplT(5 DOWNTO 0, 17 DOWNTO 0);
128 SIGNAL sample_f1_s : samplT(5 DOWNTO 0, 17 DOWNTO 0);
134 SIGNAL sample_f1_s : samplT(5 DOWNTO 0, 17 DOWNTO 0);
129 SIGNAL sample_f1 : samplT(5 DOWNTO 0, 17 DOWNTO 0);
135 SIGNAL sample_f1 : samplT(5 DOWNTO 0, 17 DOWNTO 0);
130 --
136 --
131 -- SIGNAL sample_f2_val : STD_LOGIC;
137 -- SIGNAL sample_f2_val : STD_LOGIC;
132 SIGNAL sample_f2 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
138 SIGNAL sample_f2 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
133 SIGNAL sample_f2_cic_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
139 SIGNAL sample_f2_cic_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
134 SIGNAL sample_f2_cic_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
140 SIGNAL sample_f2_cic_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
135 SIGNAL sample_f2_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
141 SIGNAL sample_f2_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
136 SIGNAL sample_f2_cic : sample_vector(5 DOWNTO 0, 15 DOWNTO 0);
142 SIGNAL sample_f2_cic : sample_vector(5 DOWNTO 0, 15 DOWNTO 0);
137 SIGNAL sample_f2_cic_val : STD_LOGIC;
143 SIGNAL sample_f2_cic_val : STD_LOGIC;
138 SIGNAL sample_f2_filter_val : STD_LOGIC;
144 SIGNAL sample_f2_filter_val : STD_LOGIC;
139
145
140 SIGNAL sample_f3 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
146 SIGNAL sample_f3 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
141 SIGNAL sample_f3_cic_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
147 SIGNAL sample_f3_cic_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
142 SIGNAL sample_f3_cic_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
148 SIGNAL sample_f3_cic_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
143 SIGNAL sample_f3_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
149 SIGNAL sample_f3_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
144 SIGNAL sample_f3_cic : sample_vector(5 DOWNTO 0, 15 DOWNTO 0);
150 SIGNAL sample_f3_cic : sample_vector(5 DOWNTO 0, 15 DOWNTO 0);
145 SIGNAL sample_f3_cic_val : STD_LOGIC;
151 SIGNAL sample_f3_cic_val : STD_LOGIC;
146 SIGNAL sample_f3_filter_val : STD_LOGIC;
152 SIGNAL sample_f3_filter_val : STD_LOGIC;
147
153
148 -----------------------------------------------------------------------------
154 -----------------------------------------------------------------------------
149 --SIGNAL data_f0_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
155 --SIGNAL data_f0_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
150 --SIGNAL data_f1_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
156 --SIGNAL data_f1_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
151 --SIGNAL data_f2_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
157 --SIGNAL data_f2_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
152 --SIGNAL data_f3_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
158 --SIGNAL data_f3_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
153 -----------------------------------------------------------------------------
159 -----------------------------------------------------------------------------
154
160
155 SIGNAL sample_f0_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
161 SIGNAL sample_f0_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
156 SIGNAL sample_f1_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
162 SIGNAL sample_f1_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
157 SIGNAL sample_f2_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
163 SIGNAL sample_f2_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
158 SIGNAL sample_f3_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
164 SIGNAL sample_f3_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
159
165
160 SIGNAL sample_f0_val_s : STD_LOGIC;
166 SIGNAL sample_f0_val_s : STD_LOGIC;
161 SIGNAL sample_f1_val_s : STD_LOGIC;
167 SIGNAL sample_f1_val_s : STD_LOGIC;
168 SIGNAL sample_f1_val_ss : STD_LOGIC;
169 SIGNAL sample_f2_val_s : STD_LOGIC;
170 SIGNAL sample_f3_val_s : STD_LOGIC;
162
171
163 -----------------------------------------------------------------------------
172 -----------------------------------------------------------------------------
164 -- CONFIG FILTER IIR f0 to f1
173 -- CONFIG FILTER IIR f0 to f1
165 -----------------------------------------------------------------------------
174 -----------------------------------------------------------------------------
166 CONSTANT f0_to_f1_CEL_NUMBER : INTEGER := 5;
175 CONSTANT f0_to_f1_CEL_NUMBER : INTEGER := 5;
167 CONSTANT f0_to_f1_COEFFICIENT_SIZE : INTEGER := 10;
176 CONSTANT f0_to_f1_COEFFICIENT_SIZE : INTEGER := 10;
168 CONSTANT f0_to_f1_POINT_POSITION : INTEGER := 8;
177 CONSTANT f0_to_f1_POINT_POSITION : INTEGER := 8;
169
178
170 CONSTANT f0_to_f1_sos : COEFF_CEL_ARRAY_REAL(1 TO 5) :=
179 CONSTANT f0_to_f1_sos : COEFF_CEL_ARRAY_REAL(1 TO 5) :=
171 (
180 (
172 (1.0, -1.61171504942096, 1.0, 1.0, -1.68876443778669, 0.908610171614583),
181 (1.0, -1.61171504942096, 1.0, 1.0, -1.68876443778669, 0.908610171614583),
173 (1.0, -1.53324505744412, 1.0, 1.0, -1.51088513595779, 0.732564401274351),
182 (1.0, -1.53324505744412, 1.0, 1.0, -1.51088513595779, 0.732564401274351),
174 (1.0, -1.30646173160060, 1.0, 1.0, -1.30571711968384, 0.546869268827102),
183 (1.0, -1.30646173160060, 1.0, 1.0, -1.30571711968384, 0.546869268827102),
175 (1.0, -0.651038739239370, 1.0, 1.0, -1.08747326287406, 0.358436944718464),
184 (1.0, -0.651038739239370, 1.0, 1.0, -1.08747326287406, 0.358436944718464),
176 (1.0, 1.24322747034001, 1.0, 1.0, -0.929530176676438, 0.224862726961691)
185 (1.0, 1.24322747034001, 1.0, 1.0, -0.929530176676438, 0.224862726961691)
177 );
186 );
178 CONSTANT f0_to_f1_gain : COEFF_CEL_REAL :=
187 CONSTANT f0_to_f1_gain : COEFF_CEL_REAL :=
179 ( 0.566196896119831, 0.474937156750133, 0.347712822970540, 0.200868393871900, 0.0910613125308450, 1.0);
188 ( 0.566196896119831, 0.474937156750133, 0.347712822970540, 0.200868393871900, 0.0910613125308450, 1.0);
180
189
181 CONSTANT coefs_iir_cel_f0_to_f1 : STD_LOGIC_VECTOR((f0_to_f1_CEL_NUMBER*f0_to_f1_COEFFICIENT_SIZE*5)-1 DOWNTO 0)
190 CONSTANT coefs_iir_cel_f0_to_f1 : STD_LOGIC_VECTOR((f0_to_f1_CEL_NUMBER*f0_to_f1_COEFFICIENT_SIZE*5)-1 DOWNTO 0)
182 := get_IIR_CEL_FILTER_CONFIG(
191 := get_IIR_CEL_FILTER_CONFIG(
183 f0_to_f1_COEFFICIENT_SIZE,
192 f0_to_f1_COEFFICIENT_SIZE,
184 f0_to_f1_POINT_POSITION,
193 f0_to_f1_POINT_POSITION,
185 f0_to_f1_CEL_NUMBER,
194 f0_to_f1_CEL_NUMBER,
186 f0_to_f1_sos,
195 f0_to_f1_sos,
187 f0_to_f1_gain);
196 f0_to_f1_gain);
188 -----------------------------------------------------------------------------
197 -----------------------------------------------------------------------------
189
198
190 -----------------------------------------------------------------------------
199 -----------------------------------------------------------------------------
191 -- CONFIG FILTER IIR f2 and f3
200 -- CONFIG FILTER IIR f2 and f3
192 -----------------------------------------------------------------------------
201 -----------------------------------------------------------------------------
193 CONSTANT f2_f3_CEL_NUMBER : INTEGER := 5;
202 CONSTANT f2_f3_CEL_NUMBER : INTEGER := 5;
194 CONSTANT f2_f3_COEFFICIENT_SIZE : INTEGER := 10;
203 CONSTANT f2_f3_COEFFICIENT_SIZE : INTEGER := 10;
195 CONSTANT f2_f3_POINT_POSITION : INTEGER := 8;
204 CONSTANT f2_f3_POINT_POSITION : INTEGER := 8;
196
205
197 CONSTANT f2_f3_sos : COEFF_CEL_ARRAY_REAL(1 TO 5) :=
206 CONSTANT f2_f3_sos : COEFF_CEL_ARRAY_REAL(1 TO 5) :=
198 (
207 (
199 (1.0, -1.61171504942096, 1.0, 1.0, -1.68876443778669, 0.908610171614583),
208 (1.0, -1.61171504942096, 1.0, 1.0, -1.68876443778669, 0.908610171614583),
200 (1.0, -1.53324505744412, 1.0, 1.0, -1.51088513595779, 0.732564401274351),
209 (1.0, -1.53324505744412, 1.0, 1.0, -1.51088513595779, 0.732564401274351),
201 (1.0, -1.30646173160060, 1.0, 1.0, -1.30571711968384, 0.546869268827102),
210 (1.0, -1.30646173160060, 1.0, 1.0, -1.30571711968384, 0.546869268827102),
202 (1.0, -0.651038739239370, 1.0, 1.0, -1.08747326287406, 0.358436944718464),
211 (1.0, -0.651038739239370, 1.0, 1.0, -1.08747326287406, 0.358436944718464),
203 (1.0, 1.24322747034001, 1.0, 1.0, -0.929530176676438, 0.224862726961691)
212 (1.0, 1.24322747034001, 1.0, 1.0, -0.929530176676438, 0.224862726961691)
204 );
213 );
205 CONSTANT f2_f3_gain : COEFF_CEL_REAL :=
214 CONSTANT f2_f3_gain : COEFF_CEL_REAL :=
206 ( 0.566196896119831, 0.474937156750133, 0.347712822970540, 0.200868393871900, 0.0910613125308450, 1.0);
215 ( 0.566196896119831, 0.474937156750133, 0.347712822970540, 0.200868393871900, 0.0910613125308450, 1.0);
207
216
208 CONSTANT coefs_iir_cel_f2_f3 : STD_LOGIC_VECTOR((f2_f3_CEL_NUMBER*f2_f3_COEFFICIENT_SIZE*5)-1 DOWNTO 0)
217 CONSTANT coefs_iir_cel_f2_f3 : STD_LOGIC_VECTOR((f2_f3_CEL_NUMBER*f2_f3_COEFFICIENT_SIZE*5)-1 DOWNTO 0)
209 := get_IIR_CEL_FILTER_CONFIG(
218 := get_IIR_CEL_FILTER_CONFIG(
210 f2_f3_COEFFICIENT_SIZE,
219 f2_f3_COEFFICIENT_SIZE,
211 f2_f3_POINT_POSITION,
220 f2_f3_POINT_POSITION,
212 f2_f3_CEL_NUMBER,
221 f2_f3_CEL_NUMBER,
213 f2_f3_sos,
222 f2_f3_sos,
214 f2_f3_gain);
223 f2_f3_gain);
215 -----------------------------------------------------------------------------
224 -----------------------------------------------------------------------------
216
225
226 SIGNAL sample_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
227 SIGNAL sample_f0_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
228 SIGNAL sample_f1_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
229 SIGNAL sample_f2_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
230 SIGNAL sample_f3_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
231 SIGNAL sample_f0_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
232 SIGNAL sample_f1_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
233 -- SIGNAL sample_f2_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
234 -- SIGNAL sample_f3_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
235 SIGNAL sample_filter_v2_out_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
217
236
218 BEGIN
237 BEGIN
219
238
220 -----------------------------------------------------------------------------
239 -----------------------------------------------------------------------------
221 PROCESS (clk, rstn)
240 PROCESS (clk, rstn)
222 BEGIN -- PROCESS
241 BEGIN -- PROCESS
223 IF rstn = '0' THEN -- asynchronous reset (active low)
242 IF rstn = '0' THEN -- asynchronous reset (active low)
224 sample_val_delay <= '0';
243 sample_val_delay <= '0';
225 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
244 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
226 sample_val_delay <= sample_val;
245 sample_val_delay <= sample_val;
227 END IF;
246 END IF;
228 END PROCESS;
247 END PROCESS;
229
248
230 -----------------------------------------------------------------------------
249 -----------------------------------------------------------------------------
231 ChanelLoop : FOR i IN 0 TO ChanelCount-1 GENERATE
250 ChanelLoop : FOR i IN 0 TO ChanelCount-1 GENERATE
232 SampleLoop : FOR j IN 0 TO 15 GENERATE
251 SampleLoop : FOR j IN 0 TO 15 GENERATE
233 sample_filter_in(i, j) <= sample(i)(j);
252 sample_filter_in(i, j) <= sample(i)(j);
234 END GENERATE;
253 END GENERATE;
235
254
236 sample_filter_in(i, 16) <= sample(i)(15);
255 sample_filter_in(i, 16) <= sample(i)(15);
237 sample_filter_in(i, 17) <= sample(i)(15);
256 sample_filter_in(i, 17) <= sample(i)(15);
238 END GENERATE;
257 END GENERATE;
239
258
240 coefs_v2 <= CoefsInitValCst_v2;
259 coefs_v2 <= CoefsInitValCst_v2;
241
260
242 IIR_CEL_CTRLR_v2_1 : IIR_CEL_CTRLR_v2
261 IIR_CEL_CTRLR_v2_1 : IIR_CEL_CTRLR_v2
243 GENERIC MAP (
262 GENERIC MAP (
244 tech => 0,
263 tech => 0,
245 Mem_use => Mem_use, -- use_RAM
264 Mem_use => Mem_use, -- use_RAM
246 Sample_SZ => 18,
265 Sample_SZ => 18,
247 Coef_SZ => Coef_SZ,
266 Coef_SZ => Coef_SZ,
248 Coef_Nb => 25,
267 Coef_Nb => 25,
249 Coef_sel_SZ => 5,
268 Coef_sel_SZ => 5,
250 Cels_count => Cels_count,
269 Cels_count => Cels_count,
251 ChanelsCount => ChanelCount)
270 ChanelsCount => ChanelCount)
252 PORT MAP (
271 PORT MAP (
253 rstn => rstn,
272 rstn => rstn,
254 clk => clk,
273 clk => clk,
255 virg_pos => 7,
274 virg_pos => 7,
256 coefs => coefs_v2,
275 coefs => coefs_v2,
257 sample_in_val => sample_val_delay,
276 sample_in_val => sample_val_delay,
258 sample_in => sample_filter_in,
277 sample_in => sample_filter_in,
259 sample_out_val => sample_filter_v2_out_val,
278 sample_out_val => sample_filter_v2_out_val,
260 sample_out => sample_filter_v2_out);
279 sample_out => sample_filter_v2_out);
261
280
281 -- TIME --
282 PROCESS (clk, rstn)
283 BEGIN -- PROCESS
284 IF rstn = '0' THEN -- asynchronous reset (active low)
285 sample_time_reg <= (OTHERS => '0');
286 sample_filter_v2_out_time <= (OTHERS => '0');
287 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
288 IF sample_val = '1' THEN
289 sample_time_reg <= sample_time;
290 END IF;
291 IF sample_filter_v2_out_val = '1' THEN
292 sample_filter_v2_out_time <= sample_time_reg;
293 END IF;
294 END IF;
295 END PROCESS;
296 ----------
297
298
262 -----------------------------------------------------------------------------
299 -----------------------------------------------------------------------------
263 -- DATA_SHAPING
300 -- DATA_SHAPING
264 -----------------------------------------------------------------------------
301 -----------------------------------------------------------------------------
265 all_data_shaping_in_loop : FOR I IN 17 DOWNTO 0 GENERATE
302 all_data_shaping_in_loop : FOR I IN 17 DOWNTO 0 GENERATE
266 sample_data_shaping_f0_s(I) <= sample_filter_v2_out(0, I);
303 sample_data_shaping_f0_s(I) <= sample_filter_v2_out(0, I);
267 sample_data_shaping_f1_s(I) <= sample_filter_v2_out(1, I);
304 sample_data_shaping_f1_s(I) <= sample_filter_v2_out(1, I);
268 sample_data_shaping_f2_s(I) <= sample_filter_v2_out(2, I);
305 sample_data_shaping_f2_s(I) <= sample_filter_v2_out(2, I);
269 END GENERATE all_data_shaping_in_loop;
306 END GENERATE all_data_shaping_in_loop;
270
307
271 sample_data_shaping_f1_f0_s <= sample_data_shaping_f1_s - sample_data_shaping_f0_s;
308 sample_data_shaping_f1_f0_s <= sample_data_shaping_f1_s - sample_data_shaping_f0_s;
272 sample_data_shaping_f2_f1_s <= sample_data_shaping_f2_s - sample_data_shaping_f1_s;
309 sample_data_shaping_f2_f1_s <= sample_data_shaping_f2_s - sample_data_shaping_f1_s;
273
310
274 PROCESS (clk, rstn)
311 PROCESS (clk, rstn)
275 BEGIN -- PROCESS
312 BEGIN -- PROCESS
276 IF rstn = '0' THEN -- asynchronous reset (active low)
313 IF rstn = '0' THEN -- asynchronous reset (active low)
277 sample_data_shaping_out_val <= '0';
314 sample_data_shaping_out_val <= '0';
278 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
315 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
279 sample_data_shaping_out_val <= sample_filter_v2_out_val;
316 sample_data_shaping_out_val <= sample_filter_v2_out_val;
280 END IF;
317 END IF;
281 END PROCESS;
318 END PROCESS;
282
319
283 SampleLoop_data_shaping : FOR j IN 0 TO 17 GENERATE
320 SampleLoop_data_shaping : FOR j IN 0 TO 17 GENERATE
284 PROCESS (clk, rstn)
321 PROCESS (clk, rstn)
285 BEGIN
322 BEGIN
286 IF rstn = '0' THEN
323 IF rstn = '0' THEN
287 sample_data_shaping_out(0, j) <= '0';
324 sample_data_shaping_out(0, j) <= '0';
288 sample_data_shaping_out(1, j) <= '0';
325 sample_data_shaping_out(1, j) <= '0';
289 sample_data_shaping_out(2, j) <= '0';
326 sample_data_shaping_out(2, j) <= '0';
290 sample_data_shaping_out(3, j) <= '0';
327 sample_data_shaping_out(3, j) <= '0';
291 sample_data_shaping_out(4, j) <= '0';
328 sample_data_shaping_out(4, j) <= '0';
292 sample_data_shaping_out(5, j) <= '0';
329 sample_data_shaping_out(5, j) <= '0';
293 sample_data_shaping_out(6, j) <= '0';
330 sample_data_shaping_out(6, j) <= '0';
294 sample_data_shaping_out(7, j) <= '0';
331 sample_data_shaping_out(7, j) <= '0';
295 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
332 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
296 sample_data_shaping_out(0, j) <= sample_filter_v2_out(0, j);
333 sample_data_shaping_out(0, j) <= sample_filter_v2_out(0, j);
297 IF data_shaping_SP0 = '1' THEN
334 IF data_shaping_SP0 = '1' THEN
298 sample_data_shaping_out(1, j) <= sample_data_shaping_f1_f0_s(j);
335 sample_data_shaping_out(1, j) <= sample_data_shaping_f1_f0_s(j);
299 ELSE
336 ELSE
300 sample_data_shaping_out(1, j) <= sample_filter_v2_out(1, j);
337 sample_data_shaping_out(1, j) <= sample_filter_v2_out(1, j);
301 END IF;
338 END IF;
302 IF data_shaping_SP1 = '1' THEN
339 IF data_shaping_SP1 = '1' THEN
303 sample_data_shaping_out(2, j) <= sample_data_shaping_f2_f1_s(j);
340 sample_data_shaping_out(2, j) <= sample_data_shaping_f2_f1_s(j);
304 ELSE
341 ELSE
305 sample_data_shaping_out(2, j) <= sample_filter_v2_out(2, j);
342 sample_data_shaping_out(2, j) <= sample_filter_v2_out(2, j);
306 END IF;
343 END IF;
307 sample_data_shaping_out(3, j) <= sample_filter_v2_out(3, j);
344 sample_data_shaping_out(3, j) <= sample_filter_v2_out(3, j);
308 sample_data_shaping_out(4, j) <= sample_filter_v2_out(4, j);
345 sample_data_shaping_out(4, j) <= sample_filter_v2_out(4, j);
309 sample_data_shaping_out(5, j) <= sample_filter_v2_out(5, j);
346 sample_data_shaping_out(5, j) <= sample_filter_v2_out(5, j);
310 sample_data_shaping_out(6, j) <= sample_filter_v2_out(6, j);
347 sample_data_shaping_out(6, j) <= sample_filter_v2_out(6, j);
311 sample_data_shaping_out(7, j) <= sample_filter_v2_out(7, j);
348 sample_data_shaping_out(7, j) <= sample_filter_v2_out(7, j);
312 END IF;
349 END IF;
313 END PROCESS;
350 END PROCESS;
314 END GENERATE;
351 END GENERATE;
315
352
316 sample_filter_v2_out_val_s <= sample_data_shaping_out_val;
353 sample_filter_v2_out_val_s <= sample_data_shaping_out_val;
317 ChanelLoopOut : FOR i IN 0 TO 7 GENERATE
354 ChanelLoopOut : FOR i IN 0 TO 7 GENERATE
318 SampleLoopOut : FOR j IN 0 TO 15 GENERATE
355 SampleLoopOut : FOR j IN 0 TO 15 GENERATE
319 sample_filter_v2_out_s(i, j) <= sample_data_shaping_out(i, j);
356 sample_filter_v2_out_s(i, j) <= sample_data_shaping_out(i, j);
320 END GENERATE;
357 END GENERATE;
321 END GENERATE;
358 END GENERATE;
322 -----------------------------------------------------------------------------
359 -----------------------------------------------------------------------------
323 -- F0 -- @24.576 kHz
360 -- F0 -- @24.576 kHz
324 -----------------------------------------------------------------------------
361 -----------------------------------------------------------------------------
325
362
326 Downsampling_f0 : Downsampling
363 Downsampling_f0 : Downsampling
327 GENERIC MAP (
364 GENERIC MAP (
328 ChanelCount => 8,
365 ChanelCount => 8,
329 SampleSize => 16,
366 SampleSize => 16,
330 DivideParam => 4)
367 DivideParam => 4)
331 PORT MAP (
368 PORT MAP (
332 clk => clk,
369 clk => clk,
333 rstn => rstn,
370 rstn => rstn,
334 sample_in_val => sample_filter_v2_out_val_s,
371 sample_in_val => sample_filter_v2_out_val_s,
335 sample_in => sample_filter_v2_out_s,
372 sample_in => sample_filter_v2_out_s,
336 sample_out_val => sample_f0_val_s,
373 sample_out_val => sample_f0_val_s,
337 sample_out => sample_f0);
374 sample_out => sample_f0);
338
375
376 -- TIME --
377 PROCESS (clk, rstn)
378 BEGIN
379 IF rstn = '0' THEN
380 sample_f0_time_reg <= (OTHERS => '0');
381 ELSIF clk'event AND clk = '1' THEN
382 IF sample_f0_val_s = '1' THEN
383 sample_f0_time_reg <= sample_filter_v2_out_time;
384 END IF;
385 END IF;
386 END PROCESS;
387 sample_f0_time_s <= sample_filter_v2_out_time WHEN sample_f0_val_s = '1' ELSE sample_f0_time_reg;
388 sample_f0_time <= sample_f0_time_s;
389 ----------
390
339 sample_f0_val <= sample_f0_val_s;
391 sample_f0_val <= sample_f0_val_s;
340
392
341 all_bit_sample_f0 : FOR I IN 15 DOWNTO 0 GENERATE
393 all_bit_sample_f0 : FOR I IN 15 DOWNTO 0 GENERATE
342 sample_f0_wdata_s(I) <= sample_f0(0, I); -- V
394 sample_f0_wdata_s(I) <= sample_f0(0, I); -- V
343 sample_f0_wdata_s(16*1+I) <= sample_f0(1, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(3, I); -- E1
395 sample_f0_wdata_s(16*1+I) <= sample_f0(1, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(3, I); -- E1
344 sample_f0_wdata_s(16*2+I) <= sample_f0(2, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(4, I); -- E2
396 sample_f0_wdata_s(16*2+I) <= sample_f0(2, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(4, I); -- E2
345 sample_f0_wdata_s(16*3+I) <= sample_f0(5, I); -- B1
397 sample_f0_wdata_s(16*3+I) <= sample_f0(5, I); -- B1
346 sample_f0_wdata_s(16*4+I) <= sample_f0(6, I); -- B2
398 sample_f0_wdata_s(16*4+I) <= sample_f0(6, I); -- B2
347 sample_f0_wdata_s(16*5+I) <= sample_f0(7, I); -- B3
399 sample_f0_wdata_s(16*5+I) <= sample_f0(7, I); -- B3
348 END GENERATE all_bit_sample_f0;
400 END GENERATE all_bit_sample_f0;
349
401
350 -----------------------------------------------------------------------------
402 -----------------------------------------------------------------------------
351 -- F1 -- @4096 Hz
403 -- F1 -- @4096 Hz
352 -----------------------------------------------------------------------------
404 -----------------------------------------------------------------------------
353
405
354 all_bit_sample_f0_f1 : FOR I IN 15 DOWNTO 0 GENERATE
406 all_bit_sample_f0_f1 : FOR I IN 15 DOWNTO 0 GENERATE
355 sample_f0_f1_s(0,I) <= sample_f0(0,I); --V
407 sample_f0_f1_s(0,I) <= sample_f0(0,I); --V
356 sample_f0_f1_s(1,I) <= sample_f0(1,I) WHEN data_shaping_R1 = '1' ELSE sample_f0(3,I); --E1
408 sample_f0_f1_s(1,I) <= sample_f0(1,I) WHEN data_shaping_R1 = '1' ELSE sample_f0(3,I); --E1
357 sample_f0_f1_s(2,I) <= sample_f0(2,I) WHEN data_shaping_R1 = '1' ELSE sample_f0(4,I); --E2
409 sample_f0_f1_s(2,I) <= sample_f0(2,I) WHEN data_shaping_R1 = '1' ELSE sample_f0(4,I); --E2
358 sample_f0_f1_s(3,I) <= sample_f0(5,I); --B1
410 sample_f0_f1_s(3,I) <= sample_f0(5,I); --B1
359 sample_f0_f1_s(4,I) <= sample_f0(6,I); --B2
411 sample_f0_f1_s(4,I) <= sample_f0(6,I); --B2
360 sample_f0_f1_s(5,I) <= sample_f0(7,I); --B3
412 sample_f0_f1_s(5,I) <= sample_f0(7,I); --B3
361 END GENERATE all_bit_sample_f0_f1;
413 END GENERATE all_bit_sample_f0_f1;
362 all_bit_sample_f0_f1_extended : FOR I IN 17 DOWNTO 16 GENERATE
414 all_bit_sample_f0_f1_extended : FOR I IN 17 DOWNTO 16 GENERATE
363 sample_f0_f1_s(0,I) <= sample_f0(0,15);
415 sample_f0_f1_s(0,I) <= sample_f0(0,15);
364 sample_f0_f1_s(1,I) <= sample_f0(1,15) WHEN data_shaping_R1 = '1' ELSE sample_f0(3,15); --E1
416 sample_f0_f1_s(1,I) <= sample_f0(1,15) WHEN data_shaping_R1 = '1' ELSE sample_f0(3,15); --E1
365 sample_f0_f1_s(2,I) <= sample_f0(2,15) WHEN data_shaping_R1 = '1' ELSE sample_f0(4,15); --E2
417 sample_f0_f1_s(2,I) <= sample_f0(2,15) WHEN data_shaping_R1 = '1' ELSE sample_f0(4,15); --E2
366 sample_f0_f1_s(3,I) <= sample_f0(5,15); --B1
418 sample_f0_f1_s(3,I) <= sample_f0(5,15); --B1
367 sample_f0_f1_s(4,I) <= sample_f0(6,15); --B2
419 sample_f0_f1_s(4,I) <= sample_f0(6,15); --B2
368 sample_f0_f1_s(5,I) <= sample_f0(7,15); --B3
420 sample_f0_f1_s(5,I) <= sample_f0(7,15); --B3
369 END GENERATE all_bit_sample_f0_f1_extended;
421 END GENERATE all_bit_sample_f0_f1_extended;
370
422
371
423
372 IIR_CEL_f0_to_f1 : IIR_CEL_CTRLR_v2
424 IIR_CEL_f0_to_f1 : IIR_CEL_CTRLR_v2
373 GENERIC MAP (
425 GENERIC MAP (
374 tech => 0,
426 tech => 0,
375 Mem_use => Mem_use, -- use_RAM
427 Mem_use => Mem_use, -- use_RAM
376 Sample_SZ => 18,
428 Sample_SZ => 18,
377 Coef_SZ => f0_to_f1_COEFFICIENT_SIZE,
429 Coef_SZ => f0_to_f1_COEFFICIENT_SIZE,
378 Coef_Nb => f0_to_f1_CEL_NUMBER*5,
430 Coef_Nb => f0_to_f1_CEL_NUMBER*5,
379 Coef_sel_SZ => 5,
431 Coef_sel_SZ => 5,
380 Cels_count => f0_to_f1_CEL_NUMBER,
432 Cels_count => f0_to_f1_CEL_NUMBER,
381 ChanelsCount => 6)
433 ChanelsCount => 6)
382 PORT MAP (
434 PORT MAP (
383 rstn => rstn,
435 rstn => rstn,
384 clk => clk,
436 clk => clk,
385 virg_pos => f0_to_f1_POINT_POSITION,
437 virg_pos => f0_to_f1_POINT_POSITION,
386 coefs => coefs_iir_cel_f0_to_f1,
438 coefs => coefs_iir_cel_f0_to_f1,
387
439
388 sample_in_val => sample_f0_val_s,
440 sample_in_val => sample_f0_val_s,
389 sample_in => sample_f0_f1_s,
441 sample_in => sample_f0_f1_s,
390
442
391 sample_out_val => sample_f1_val_s,
443 sample_out_val => sample_f1_val_s,
392 sample_out => sample_f1_s);
444 sample_out => sample_f1_s);
393
445
394 Downsampling_f1 : Downsampling
446 Downsampling_f1 : Downsampling
395 GENERIC MAP (
447 GENERIC MAP (
396 ChanelCount => 6,
448 ChanelCount => 6,
397 SampleSize => 18,
449 SampleSize => 18,
398 DivideParam => 6)
450 DivideParam => 6)
399 PORT MAP (
451 PORT MAP (
400 clk => clk,
452 clk => clk,
401 rstn => rstn,
453 rstn => rstn,
402 sample_in_val => sample_f1_val_s,
454 sample_in_val => sample_f1_val_s,
403 sample_in => sample_f1_s,
455 sample_in => sample_f1_s,
404 sample_out_val => sample_f1_val,
456 sample_out_val => sample_f1_val_ss,
405 sample_out => sample_f1);
457 sample_out => sample_f1);
458
459 sample_f1_val <= sample_f1_val_ss;
460
461 -- TIME --
462 PROCESS (clk, rstn)
463 BEGIN
464 IF rstn = '0' THEN
465 sample_f1_time_reg <= (OTHERS => '0');
466 ELSIF clk'event AND clk = '1' THEN
467 IF sample_f1_val_ss = '1' THEN
468 sample_f1_time_reg <= sample_f0_time_s;
469 END IF;
470 END IF;
471 END PROCESS;
472 sample_f1_time_s <= sample_f0_time_s WHEN sample_f1_val_ss = '1' ELSE sample_f1_time_reg;
473 sample_f1_time <= sample_f1_time_s;
474 ----------
475
406
476
407 all_bit_sample_f1 : FOR I IN 15 DOWNTO 0 GENERATE
477 all_bit_sample_f1 : FOR I IN 15 DOWNTO 0 GENERATE
408 all_channel_sample_f1: FOR J IN 5 DOWNTO 0 GENERATE
478 all_channel_sample_f1: FOR J IN 5 DOWNTO 0 GENERATE
409 sample_f1_wdata_s(16*J+I) <= sample_f1(J, I);
479 sample_f1_wdata_s(16*J+I) <= sample_f1(J, I);
410 END GENERATE all_channel_sample_f1;
480 END GENERATE all_channel_sample_f1;
411 END GENERATE all_bit_sample_f1;
481 END GENERATE all_bit_sample_f1;
412
482
413 -----------------------------------------------------------------------------
483 -----------------------------------------------------------------------------
414 -- F2 -- @256 Hz
484 -- F2 -- @256 Hz
415 -- F3 -- @16 Hz
485 -- F3 -- @16 Hz
416 -----------------------------------------------------------------------------
486 -----------------------------------------------------------------------------
417 all_bit_sample_f0_s : FOR I IN 15 DOWNTO 0 GENERATE
487 all_bit_sample_f0_s : FOR I IN 15 DOWNTO 0 GENERATE
418 sample_f0_s(0, I) <= sample_f0(0, I); -- V
488 sample_f0_s(0, I) <= sample_f0(0, I); -- V
419 sample_f0_s(1, I) <= sample_f0(1, I); -- E1
489 sample_f0_s(1, I) <= sample_f0(1, I); -- E1
420 sample_f0_s(2, I) <= sample_f0(2, I); -- E2
490 sample_f0_s(2, I) <= sample_f0(2, I); -- E2
421 sample_f0_s(3, I) <= sample_f0(5, I); -- B1
491 sample_f0_s(3, I) <= sample_f0(5, I); -- B1
422 sample_f0_s(4, I) <= sample_f0(6, I); -- B2
492 sample_f0_s(4, I) <= sample_f0(6, I); -- B2
423 sample_f0_s(5, I) <= sample_f0(7, I); -- B3
493 sample_f0_s(5, I) <= sample_f0(7, I); -- B3
424 sample_f0_s(6, I) <= sample_f0(3, I); --
494 sample_f0_s(6, I) <= sample_f0(3, I); --
425 sample_f0_s(7, I) <= sample_f0(4, I); --
495 sample_f0_s(7, I) <= sample_f0(4, I); --
426 END GENERATE all_bit_sample_f0_s;
496 END GENERATE all_bit_sample_f0_s;
427
497
428
498
429 cic_lfr_1: cic_lfr_r2
499 cic_lfr_1: cic_lfr_r2
430 GENERIC MAP (
500 GENERIC MAP (
431 tech => 0,
501 tech => 0,
432 use_RAM_nCEL => Mem_use)
502 use_RAM_nCEL => Mem_use)
433 PORT MAP (
503 PORT MAP (
434 clk => clk,
504 clk => clk,
435 rstn => rstn,
505 rstn => rstn,
436 run => '1',
506 run => '1',
437
507
438 param_r2 => data_shaping_R2,
508 param_r2 => data_shaping_R2,
439
509
440 data_in => sample_f0_s,
510 data_in => sample_f0_s,
441 data_in_valid => sample_f0_val_s,
511 data_in_valid => sample_f0_val_s,
442
512
443 data_out_16 => sample_f2_cic,
513 data_out_16 => sample_f2_cic,
444 data_out_16_valid => sample_f2_cic_val,
514 data_out_16_valid => sample_f2_cic_val,
445
515
446 data_out_256 => sample_f3_cic,
516 data_out_256 => sample_f3_cic,
447 data_out_256_valid => sample_f3_cic_val);
517 data_out_256_valid => sample_f3_cic_val);
448
518
449
519
450
520
451 all_channel_sample_f_cic : FOR J IN 5 DOWNTO 0 GENERATE
521 all_channel_sample_f_cic : FOR J IN 5 DOWNTO 0 GENERATE
452 all_bit_sample_f_cic : FOR I IN 15 DOWNTO 0 GENERATE
522 all_bit_sample_f_cic : FOR I IN 15 DOWNTO 0 GENERATE
453 sample_f2_cic_filter(J,I) <= sample_f2_cic(J,I);
523 sample_f2_cic_filter(J,I) <= sample_f2_cic(J,I);
454 sample_f3_cic_filter(J,I) <= sample_f3_cic(J,I);
524 sample_f3_cic_filter(J,I) <= sample_f3_cic(J,I);
455 END GENERATE all_bit_sample_f_cic;
525 END GENERATE all_bit_sample_f_cic;
456 sample_f2_cic_filter(J,16) <= sample_f2_cic(J,15);
526 sample_f2_cic_filter(J,16) <= sample_f2_cic(J,15);
457 sample_f2_cic_filter(J,17) <= sample_f2_cic(J,15);
527 sample_f2_cic_filter(J,17) <= sample_f2_cic(J,15);
458
528
459 sample_f3_cic_filter(J,16) <= sample_f3_cic(J,15);
529 sample_f3_cic_filter(J,16) <= sample_f3_cic(J,15);
460 sample_f3_cic_filter(J,17) <= sample_f3_cic(J,15);
530 sample_f3_cic_filter(J,17) <= sample_f3_cic(J,15);
461 END GENERATE all_channel_sample_f_cic;
531 END GENERATE all_channel_sample_f_cic;
462
532
463
533
464 IIR_CEL_CTRLR_v3_1:IIR_CEL_CTRLR_v3
534 IIR_CEL_CTRLR_v3_1:IIR_CEL_CTRLR_v3
465 GENERIC MAP (
535 GENERIC MAP (
466 tech => 0,
536 tech => 0,
467 Mem_use => Mem_use,
537 Mem_use => Mem_use,
468 Sample_SZ => 18,
538 Sample_SZ => 18,
469 Coef_SZ => f2_f3_COEFFICIENT_SIZE,
539 Coef_SZ => f2_f3_COEFFICIENT_SIZE,
470 Coef_Nb => f2_f3_CEL_NUMBER*5,
540 Coef_Nb => f2_f3_CEL_NUMBER*5,
471 Coef_sel_SZ => 5,
541 Coef_sel_SZ => 5,
472 Cels_count => f2_f3_CEL_NUMBER,
542 Cels_count => f2_f3_CEL_NUMBER,
473 ChanelsCount => 6)
543 ChanelsCount => 6)
474 PORT MAP (
544 PORT MAP (
475 rstn => rstn,
545 rstn => rstn,
476 clk => clk,
546 clk => clk,
477 virg_pos => f2_f3_POINT_POSITION,
547 virg_pos => f2_f3_POINT_POSITION,
478 coefs => coefs_iir_cel_f2_f3,
548 coefs => coefs_iir_cel_f2_f3,
479
549
480 sample_in1_val => sample_f2_cic_val,
550 sample_in1_val => sample_f2_cic_val,
481 sample_in1 => sample_f2_cic_filter,
551 sample_in1 => sample_f2_cic_filter,
482
552
483 sample_in2_val => sample_f3_cic_val,
553 sample_in2_val => sample_f3_cic_val,
484 sample_in2 => sample_f3_cic_filter,
554 sample_in2 => sample_f3_cic_filter,
485
555
486 sample_out1_val => sample_f2_filter_val,
556 sample_out1_val => sample_f2_filter_val,
487 sample_out1 => sample_f2_filter,
557 sample_out1 => sample_f2_filter,
488 sample_out2_val => sample_f3_filter_val,
558 sample_out2_val => sample_f3_filter_val,
489 sample_out2 => sample_f3_filter);
559 sample_out2 => sample_f3_filter);
490
560
491
561
492 all_channel_sample_f_filter : FOR J IN 5 DOWNTO 0 GENERATE
562 all_channel_sample_f_filter : FOR J IN 5 DOWNTO 0 GENERATE
493 all_bit_sample_f_filter : FOR I IN 15 DOWNTO 0 GENERATE
563 all_bit_sample_f_filter : FOR I IN 15 DOWNTO 0 GENERATE
494 sample_f2_cic_s(J,I) <= sample_f2_filter(J,I);
564 sample_f2_cic_s(J,I) <= sample_f2_filter(J,I);
495 sample_f3_cic_s(J,I) <= sample_f3_filter(J,I);
565 sample_f3_cic_s(J,I) <= sample_f3_filter(J,I);
496 END GENERATE all_bit_sample_f_filter;
566 END GENERATE all_bit_sample_f_filter;
497 END GENERATE all_channel_sample_f_filter;
567 END GENERATE all_channel_sample_f_filter;
498
568
499
569
500 -----------------------------------------------------------------------------
570 -----------------------------------------------------------------------------
501
571
502 Downsampling_f2 : Downsampling
572 Downsampling_f2 : Downsampling
503 GENERIC MAP (
573 GENERIC MAP (
504 ChanelCount => 6,
574 ChanelCount => 6,
505 SampleSize => 16,
575 SampleSize => 16,
506 DivideParam => 6)
576 DivideParam => 6)
507 PORT MAP (
577 PORT MAP (
508 clk => clk,
578 clk => clk,
509 rstn => rstn,
579 rstn => rstn,
510 sample_in_val => sample_f2_filter_val ,
580 sample_in_val => sample_f2_filter_val ,
511 sample_in => sample_f2_cic_s,
581 sample_in => sample_f2_cic_s,
512 sample_out_val => sample_f2_val,
582 sample_out_val => sample_f2_val_s,
513 sample_out => sample_f2);
583 sample_out => sample_f2);
584
585 sample_f2_val <= sample_f2_val_s;
514
586
515 all_bit_sample_f2 : FOR I IN 15 DOWNTO 0 GENERATE
587 all_bit_sample_f2 : FOR I IN 15 DOWNTO 0 GENERATE
516 all_channel_sample_f2 : FOR J IN 5 DOWNTO 0 GENERATE
588 all_channel_sample_f2 : FOR J IN 5 DOWNTO 0 GENERATE
517 sample_f2_wdata_s(16*J+I) <= sample_f2(J,I);
589 sample_f2_wdata_s(16*J+I) <= sample_f2(J,I);
518 END GENERATE all_channel_sample_f2;
590 END GENERATE all_channel_sample_f2;
519 END GENERATE all_bit_sample_f2;
591 END GENERATE all_bit_sample_f2;
520
592
521 -----------------------------------------------------------------------------
593 -----------------------------------------------------------------------------
522
594
523 Downsampling_f3 : Downsampling
595 Downsampling_f3 : Downsampling
524 GENERIC MAP (
596 GENERIC MAP (
525 ChanelCount => 6,
597 ChanelCount => 6,
526 SampleSize => 16,
598 SampleSize => 16,
527 DivideParam => 6)
599 DivideParam => 6)
528 PORT MAP (
600 PORT MAP (
529 clk => clk,
601 clk => clk,
530 rstn => rstn,
602 rstn => rstn,
531 sample_in_val => sample_f3_filter_val ,
603 sample_in_val => sample_f3_filter_val ,
532 sample_in => sample_f3_cic_s,
604 sample_in => sample_f3_cic_s,
533 sample_out_val => sample_f3_val,
605 sample_out_val => sample_f3_val_s,
534 sample_out => sample_f3);
606 sample_out => sample_f3);
607 sample_f3_val <= sample_f3_val_s;
535
608
536 all_bit_sample_f3 : FOR I IN 15 DOWNTO 0 GENERATE
609 all_bit_sample_f3 : FOR I IN 15 DOWNTO 0 GENERATE
537 all_channel_sample_f3 : FOR J IN 5 DOWNTO 0 GENERATE
610 all_channel_sample_f3 : FOR J IN 5 DOWNTO 0 GENERATE
538 sample_f3_wdata_s(16*J+I) <= sample_f3(J,I);
611 sample_f3_wdata_s(16*J+I) <= sample_f3(J,I);
539 END GENERATE all_channel_sample_f3;
612 END GENERATE all_channel_sample_f3;
540 END GENERATE all_bit_sample_f3;
613 END GENERATE all_bit_sample_f3;
614
615 -----------------------------------------------------------------------------
616
617 -- TIME --
618 PROCESS (clk, rstn)
619 BEGIN
620 IF rstn = '0' THEN
621 sample_f2_time_reg <= (OTHERS => '0');
622 sample_f3_time_reg <= (OTHERS => '0');
623 ELSIF clk'event AND clk = '1' THEN
624 IF sample_f2_val_s = '1' THEN sample_f2_time_reg <= sample_f0_time_s; END IF;
625 IF sample_f3_val_s = '1' THEN sample_f3_time_reg <= sample_f0_time_s; END IF;
626 END IF;
627 END PROCESS;
628 sample_f2_time <= sample_f0_time_s WHEN sample_f2_val_s = '1' ELSE sample_f2_time_reg;
629 sample_f3_time <= sample_f0_time_s WHEN sample_f3_val_s = '1' ELSE sample_f3_time_reg;
630 ----------
541
631
542 -----------------------------------------------------------------------------
632 -----------------------------------------------------------------------------
543 --
633 --
544 -----------------------------------------------------------------------------
634 -----------------------------------------------------------------------------
545 sample_f0_wdata <= sample_f0_wdata_s;
635 sample_f0_wdata <= sample_f0_wdata_s;
546 sample_f1_wdata <= sample_f1_wdata_s;
636 sample_f1_wdata <= sample_f1_wdata_s;
547 sample_f2_wdata <= sample_f2_wdata_s;
637 sample_f2_wdata <= sample_f2_wdata_s;
548 sample_f3_wdata <= sample_f3_wdata_s;
638 sample_f3_wdata <= sample_f3_wdata_s;
549
639
550 END tb;
640 END tb;
@@ -1,1214 +1,1217
1 LIBRARY ieee;
1 LIBRARY ieee;
2 USE ieee.std_logic_1164.ALL;
2 USE ieee.std_logic_1164.ALL;
3 USE ieee.numeric_std.ALL;
3 USE ieee.numeric_std.ALL;
4
4
5
5
6 LIBRARY lpp;
6 LIBRARY lpp;
7 USE lpp.lpp_memory.ALL;
7 USE lpp.lpp_memory.ALL;
8 USE lpp.iir_filter.ALL;
8 USE lpp.iir_filter.ALL;
9 USE lpp.spectral_matrix_package.ALL;
9 USE lpp.spectral_matrix_package.ALL;
10 USE lpp.lpp_dma_pkg.ALL;
10 USE lpp.lpp_dma_pkg.ALL;
11 USE lpp.lpp_Header.ALL;
11 USE lpp.lpp_Header.ALL;
12 USE lpp.lpp_matrix.ALL;
12 USE lpp.lpp_matrix.ALL;
13 USE lpp.lpp_matrix.ALL;
13 USE lpp.lpp_matrix.ALL;
14 USE lpp.lpp_lfr_pkg.ALL;
14 USE lpp.lpp_lfr_pkg.ALL;
15 USE lpp.lpp_fft.ALL;
15 USE lpp.lpp_fft.ALL;
16 USE lpp.fft_components.ALL;
16 USE lpp.fft_components.ALL;
17
17
18 ENTITY lpp_lfr_ms IS
18 ENTITY lpp_lfr_ms IS
19 GENERIC (
19 GENERIC (
20 Mem_use : INTEGER := use_RAM
20 Mem_use : INTEGER := use_RAM
21 );
21 );
22 PORT (
22 PORT (
23 clk : IN STD_LOGIC;
23 clk : IN STD_LOGIC;
24 rstn : IN STD_LOGIC;
24 rstn : IN STD_LOGIC;
25 run : IN STD_LOGIC;
25 run : IN STD_LOGIC;
26
26
27 ---------------------------------------------------------------------------
27 ---------------------------------------------------------------------------
28 -- DATA INPUT
28 -- DATA INPUT
29 ---------------------------------------------------------------------------
29 ---------------------------------------------------------------------------
30 start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
30 start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
31 -- TIME
31 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
32 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- todo
32 --fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
33 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
34 --
33 --
35 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
34 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
36 sample_f0_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
35 sample_f0_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
36 sample_f0_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
37 --
37 --
38 sample_f1_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
38 sample_f1_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
39 sample_f1_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
39 sample_f1_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
40 sample_f1_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
40 --
41 --
41 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
42 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
42 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
43 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
44 sample_f2_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
43
45
44 ---------------------------------------------------------------------------
46 ---------------------------------------------------------------------------
45 -- DMA
47 -- DMA
46 ---------------------------------------------------------------------------
48 ---------------------------------------------------------------------------
47 dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
49 dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
48 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
50 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
49 dma_fifo_ren : IN STD_LOGIC; --TODO
51 dma_fifo_ren : IN STD_LOGIC; --TODO
50 dma_buffer_new : OUT STD_LOGIC; --TODOx
52 dma_buffer_new : OUT STD_LOGIC; --TODOx
51 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
53 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
52 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
54 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
53 dma_buffer_full : IN STD_LOGIC; --TODO
55 dma_buffer_full : IN STD_LOGIC; --TODO
54 dma_buffer_full_err : IN STD_LOGIC; --TODO
56 dma_buffer_full_err : IN STD_LOGIC; --TODO
55
57
56 -- Reg out
58 -- Reg out
57 ready_matrix_f0 : OUT STD_LOGIC; -- TODO
59 ready_matrix_f0 : OUT STD_LOGIC; -- TODO
58 ready_matrix_f1 : OUT STD_LOGIC; -- TODO
60 ready_matrix_f1 : OUT STD_LOGIC; -- TODO
59 ready_matrix_f2 : OUT STD_LOGIC; -- TODO
61 ready_matrix_f2 : OUT STD_LOGIC; -- TODO
60 -- error_bad_component_error : OUT STD_LOGIC; -- TODO
62 -- error_bad_component_error : OUT STD_LOGIC; -- TODO
61 error_buffer_full : OUT STD_LOGIC; -- TODO
63 error_buffer_full : OUT STD_LOGIC; -- TODO
62 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
64 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
63
65
64 -- Reg In
66 -- Reg In
65 status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
67 status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
66 status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
68 status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
67 status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
69 status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
68
70
69 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
71 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
70 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
72 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
71 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
73 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
72
74
73 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
75 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
74 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
76 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
75 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
77 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
76
78
77 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
79 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
78 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
80 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
79 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
81 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
80 ---------------------------------------------------------------------------
82 ---------------------------------------------------------------------------
81 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
83 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
82 );
84 );
83 END;
85 END;
84
86
85 ARCHITECTURE Behavioral OF lpp_lfr_ms IS
87 ARCHITECTURE Behavioral OF lpp_lfr_ms IS
86
88
87 SIGNAL sample_f0_A_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
89 SIGNAL sample_f0_A_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
88 SIGNAL sample_f0_A_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
90 SIGNAL sample_f0_A_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
89 SIGNAL sample_f0_A_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
91 SIGNAL sample_f0_A_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
90 SIGNAL sample_f0_A_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
92 SIGNAL sample_f0_A_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
91 SIGNAL sample_f0_A_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
93 SIGNAL sample_f0_A_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
92
94
93 SIGNAL sample_f0_B_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
95 SIGNAL sample_f0_B_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
94 SIGNAL sample_f0_B_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
96 SIGNAL sample_f0_B_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
95 SIGNAL sample_f0_B_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
97 SIGNAL sample_f0_B_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
96 SIGNAL sample_f0_B_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
98 SIGNAL sample_f0_B_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
97 SIGNAL sample_f0_B_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
99 SIGNAL sample_f0_B_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
98
100
99 SIGNAL sample_f1_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
101 SIGNAL sample_f1_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
100 SIGNAL sample_f1_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
102 SIGNAL sample_f1_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
101 SIGNAL sample_f1_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
103 SIGNAL sample_f1_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
102 SIGNAL sample_f1_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
104 SIGNAL sample_f1_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
103
105
104 SIGNAL sample_f1_almost_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
106 SIGNAL sample_f1_almost_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
105
107
106 SIGNAL sample_f2_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
108 SIGNAL sample_f2_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
107 SIGNAL sample_f2_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
109 SIGNAL sample_f2_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
108 SIGNAL sample_f2_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
110 SIGNAL sample_f2_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
109 SIGNAL sample_f2_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
111 SIGNAL sample_f2_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
110
112
111 SIGNAL error_wen_f0 : STD_LOGIC;
113 SIGNAL error_wen_f0 : STD_LOGIC;
112 SIGNAL error_wen_f1 : STD_LOGIC;
114 SIGNAL error_wen_f1 : STD_LOGIC;
113 SIGNAL error_wen_f2 : STD_LOGIC;
115 SIGNAL error_wen_f2 : STD_LOGIC;
114
116
115 SIGNAL one_sample_f1_full : STD_LOGIC;
117 SIGNAL one_sample_f1_full : STD_LOGIC;
116 SIGNAL one_sample_f1_wen : STD_LOGIC;
118 SIGNAL one_sample_f1_wen : STD_LOGIC;
117 SIGNAL one_sample_f2_full : STD_LOGIC;
119 SIGNAL one_sample_f2_full : STD_LOGIC;
118 SIGNAL one_sample_f2_wen : STD_LOGIC;
120 SIGNAL one_sample_f2_wen : STD_LOGIC;
119
121
120 -----------------------------------------------------------------------------
122 -----------------------------------------------------------------------------
121 -- FSM / SWITCH SELECT CHANNEL
123 -- FSM / SWITCH SELECT CHANNEL
122 -----------------------------------------------------------------------------
124 -----------------------------------------------------------------------------
123 TYPE fsm_select_channel IS (IDLE, SWITCH_F0_A, SWITCH_F0_B, SWITCH_F1, SWITCH_F2);
125 TYPE fsm_select_channel IS (IDLE, SWITCH_F0_A, SWITCH_F0_B, SWITCH_F1, SWITCH_F2);
124 SIGNAL state_fsm_select_channel : fsm_select_channel;
126 SIGNAL state_fsm_select_channel : fsm_select_channel;
125 -- SIGNAL pre_state_fsm_select_channel : fsm_select_channel;
127 -- SIGNAL pre_state_fsm_select_channel : fsm_select_channel;
126 SIGNAL select_channel : STD_LOGIC_VECTOR(1 DOWNTO 0);
128 SIGNAL select_channel : STD_LOGIC_VECTOR(1 DOWNTO 0);
127 SIGNAL select_channel_reg : STD_LOGIC_VECTOR(1 DOWNTO 0);
129 SIGNAL select_channel_reg : STD_LOGIC_VECTOR(1 DOWNTO 0);
128
130
129 SIGNAL sample_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
131 SIGNAL sample_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
130 SIGNAL sample_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
132 SIGNAL sample_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
131 SIGNAL sample_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
133 SIGNAL sample_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
132 SIGNAL sample_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
134 SIGNAL sample_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
133
135
134 -----------------------------------------------------------------------------
136 -----------------------------------------------------------------------------
135 -- FSM LOAD FFT
137 -- FSM LOAD FFT
136 -----------------------------------------------------------------------------
138 -----------------------------------------------------------------------------
137 TYPE fsm_load_FFT IS (IDLE, FIFO_1, FIFO_2, FIFO_3, FIFO_4, FIFO_5);
139 TYPE fsm_load_FFT IS (IDLE, FIFO_1, FIFO_2, FIFO_3, FIFO_4, FIFO_5);
138 SIGNAL state_fsm_load_FFT : fsm_load_FFT;
140 SIGNAL state_fsm_load_FFT : fsm_load_FFT;
139 -- SIGNAL next_state_fsm_load_FFT : fsm_load_FFT;
141 -- SIGNAL next_state_fsm_load_FFT : fsm_load_FFT;
140 SIGNAL select_fifo : STD_LOGIC_VECTOR(2 DOWNTO 0);
142 SIGNAL select_fifo : STD_LOGIC_VECTOR(2 DOWNTO 0);
141 SIGNAL select_fifo_reg : STD_LOGIC_VECTOR(2 DOWNTO 0);
143 SIGNAL select_fifo_reg : STD_LOGIC_VECTOR(2 DOWNTO 0);
142
144
143 SIGNAL sample_ren_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
145 SIGNAL sample_ren_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
144 SIGNAL sample_load : STD_LOGIC;
146 SIGNAL sample_load : STD_LOGIC;
145 SIGNAL sample_valid : STD_LOGIC;
147 SIGNAL sample_valid : STD_LOGIC;
146 SIGNAL sample_valid_r : STD_LOGIC;
148 SIGNAL sample_valid_r : STD_LOGIC;
147 SIGNAL sample_data : STD_LOGIC_VECTOR(15 DOWNTO 0);
149 SIGNAL sample_data : STD_LOGIC_VECTOR(15 DOWNTO 0);
148
150
149
151
150 -----------------------------------------------------------------------------
152 -----------------------------------------------------------------------------
151 -- FFT
153 -- FFT
152 -----------------------------------------------------------------------------
154 -----------------------------------------------------------------------------
153 SIGNAL fft_read : STD_LOGIC;
155 SIGNAL fft_read : STD_LOGIC;
154 SIGNAL fft_pong : STD_LOGIC;
156 SIGNAL fft_pong : STD_LOGIC;
155 SIGNAL fft_data_im : STD_LOGIC_VECTOR(15 DOWNTO 0);
157 SIGNAL fft_data_im : STD_LOGIC_VECTOR(15 DOWNTO 0);
156 SIGNAL fft_data_re : STD_LOGIC_VECTOR(15 DOWNTO 0);
158 SIGNAL fft_data_re : STD_LOGIC_VECTOR(15 DOWNTO 0);
157 SIGNAL fft_data_valid : STD_LOGIC;
159 SIGNAL fft_data_valid : STD_LOGIC;
158 SIGNAL fft_ready : STD_LOGIC;
160 SIGNAL fft_ready : STD_LOGIC;
159 -----------------------------------------------------------------------------
161 -----------------------------------------------------------------------------
160 -- SIGNAL fft_linker_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
162 -- SIGNAL fft_linker_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
161 -----------------------------------------------------------------------------
163 -----------------------------------------------------------------------------
162 TYPE fsm_load_MS_memory IS (IDLE, LOAD_FIFO, TRASH_FFT);
164 TYPE fsm_load_MS_memory IS (IDLE, LOAD_FIFO, TRASH_FFT);
163 SIGNAL state_fsm_load_MS_memory : fsm_load_MS_memory;
165 SIGNAL state_fsm_load_MS_memory : fsm_load_MS_memory;
164 SIGNAL current_fifo_load : STD_LOGIC_VECTOR(4 DOWNTO 0);
166 SIGNAL current_fifo_load : STD_LOGIC_VECTOR(4 DOWNTO 0);
165 SIGNAL current_fifo_empty : STD_LOGIC;
167 SIGNAL current_fifo_empty : STD_LOGIC;
166 SIGNAL current_fifo_locked : STD_LOGIC;
168 SIGNAL current_fifo_locked : STD_LOGIC;
167 SIGNAL current_fifo_full : STD_LOGIC;
169 SIGNAL current_fifo_full : STD_LOGIC;
168 SIGNAL MEM_IN_SM_locked : STD_LOGIC_VECTOR(4 DOWNTO 0);
170 SIGNAL MEM_IN_SM_locked : STD_LOGIC_VECTOR(4 DOWNTO 0);
169
171
170 -----------------------------------------------------------------------------
172 -----------------------------------------------------------------------------
171 SIGNAL MEM_IN_SM_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
173 SIGNAL MEM_IN_SM_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
172 SIGNAL MEM_IN_SM_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
174 SIGNAL MEM_IN_SM_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
173 SIGNAL MEM_IN_SM_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
175 SIGNAL MEM_IN_SM_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
174 SIGNAL MEM_IN_SM_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
176 SIGNAL MEM_IN_SM_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
175 SIGNAL MEM_IN_SM_wData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
177 SIGNAL MEM_IN_SM_wData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
176 SIGNAL MEM_IN_SM_rData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
178 SIGNAL MEM_IN_SM_rData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
177 SIGNAL MEM_IN_SM_Full : STD_LOGIC_VECTOR(4 DOWNTO 0);
179 SIGNAL MEM_IN_SM_Full : STD_LOGIC_VECTOR(4 DOWNTO 0);
178 SIGNAL MEM_IN_SM_Empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
180 SIGNAL MEM_IN_SM_Empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
179 -----------------------------------------------------------------------------
181 -----------------------------------------------------------------------------
180 SIGNAL SM_in_data : STD_LOGIC_VECTOR(32*2-1 DOWNTO 0);
182 SIGNAL SM_in_data : STD_LOGIC_VECTOR(32*2-1 DOWNTO 0);
181 SIGNAL SM_in_ren : STD_LOGIC_VECTOR(1 DOWNTO 0);
183 SIGNAL SM_in_ren : STD_LOGIC_VECTOR(1 DOWNTO 0);
182 SIGNAL SM_in_empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
184 SIGNAL SM_in_empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
183
185
184 SIGNAL SM_correlation_start : STD_LOGIC;
186 SIGNAL SM_correlation_start : STD_LOGIC;
185 SIGNAL SM_correlation_auto : STD_LOGIC;
187 SIGNAL SM_correlation_auto : STD_LOGIC;
186 SIGNAL SM_correlation_done : STD_LOGIC;
188 SIGNAL SM_correlation_done : STD_LOGIC;
187 SIGNAL SM_correlation_done_reg1 : STD_LOGIC;
189 SIGNAL SM_correlation_done_reg1 : STD_LOGIC;
188 SIGNAL SM_correlation_done_reg2 : STD_LOGIC;
190 SIGNAL SM_correlation_done_reg2 : STD_LOGIC;
189 SIGNAL SM_correlation_done_reg3 : STD_LOGIC;
191 SIGNAL SM_correlation_done_reg3 : STD_LOGIC;
190 SIGNAL SM_correlation_begin : STD_LOGIC;
192 SIGNAL SM_correlation_begin : STD_LOGIC;
191
193
192 SIGNAL MEM_OUT_SM_Full_s : STD_LOGIC;
194 SIGNAL MEM_OUT_SM_Full_s : STD_LOGIC;
193 SIGNAL MEM_OUT_SM_Data_in_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
195 SIGNAL MEM_OUT_SM_Data_in_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
194 SIGNAL MEM_OUT_SM_Write_s : STD_LOGIC;
196 SIGNAL MEM_OUT_SM_Write_s : STD_LOGIC;
195
197
196 SIGNAL current_matrix_write : STD_LOGIC;
198 SIGNAL current_matrix_write : STD_LOGIC;
197 SIGNAL current_matrix_wait_empty : STD_LOGIC;
199 SIGNAL current_matrix_wait_empty : STD_LOGIC;
198 -----------------------------------------------------------------------------
200 -----------------------------------------------------------------------------
199 SIGNAL fifo_0_ready : STD_LOGIC;
201 SIGNAL fifo_0_ready : STD_LOGIC;
200 SIGNAL fifo_1_ready : STD_LOGIC;
202 SIGNAL fifo_1_ready : STD_LOGIC;
201 SIGNAL fifo_ongoing : STD_LOGIC;
203 SIGNAL fifo_ongoing : STD_LOGIC;
202
204
203 SIGNAL FSM_DMA_fifo_ren : STD_LOGIC;
205 SIGNAL FSM_DMA_fifo_ren : STD_LOGIC;
204 SIGNAL FSM_DMA_fifo_empty : STD_LOGIC;
206 SIGNAL FSM_DMA_fifo_empty : STD_LOGIC;
205 SIGNAL FSM_DMA_fifo_empty_threshold : STD_LOGIC;
207 SIGNAL FSM_DMA_fifo_empty_threshold : STD_LOGIC;
206 SIGNAL FSM_DMA_fifo_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
208 SIGNAL FSM_DMA_fifo_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
207 SIGNAL FSM_DMA_fifo_status : STD_LOGIC_VECTOR(53 DOWNTO 4);
209 SIGNAL FSM_DMA_fifo_status : STD_LOGIC_VECTOR(53 DOWNTO 4);
208 -----------------------------------------------------------------------------
210 -----------------------------------------------------------------------------
209 SIGNAL MEM_OUT_SM_Write : STD_LOGIC_VECTOR(1 DOWNTO 0);
211 SIGNAL MEM_OUT_SM_Write : STD_LOGIC_VECTOR(1 DOWNTO 0);
210 SIGNAL MEM_OUT_SM_Read : STD_LOGIC_VECTOR(1 DOWNTO 0);
212 SIGNAL MEM_OUT_SM_Read : STD_LOGIC_VECTOR(1 DOWNTO 0);
211 SIGNAL MEM_OUT_SM_Data_in : STD_LOGIC_VECTOR(63 DOWNTO 0);
213 SIGNAL MEM_OUT_SM_Data_in : STD_LOGIC_VECTOR(63 DOWNTO 0);
212 SIGNAL MEM_OUT_SM_Data_out : STD_LOGIC_VECTOR(63 DOWNTO 0);
214 SIGNAL MEM_OUT_SM_Data_out : STD_LOGIC_VECTOR(63 DOWNTO 0);
213 SIGNAL MEM_OUT_SM_Full : STD_LOGIC_VECTOR(1 DOWNTO 0);
215 SIGNAL MEM_OUT_SM_Full : STD_LOGIC_VECTOR(1 DOWNTO 0);
214 SIGNAL MEM_OUT_SM_Empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
216 SIGNAL MEM_OUT_SM_Empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
215 SIGNAL MEM_OUT_SM_Empty_Threshold : STD_LOGIC_VECTOR(1 DOWNTO 0);
217 SIGNAL MEM_OUT_SM_Empty_Threshold : STD_LOGIC_VECTOR(1 DOWNTO 0);
216
218
217 -----------------------------------------------------------------------------
219 -----------------------------------------------------------------------------
218 -- TIME REG & INFOs
220 -- TIME REG & INFOs
219 -----------------------------------------------------------------------------
221 -----------------------------------------------------------------------------
220 SIGNAL all_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
222 SIGNAL all_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
221
223
222 SIGNAL f_empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
224 SIGNAL f_empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
223 SIGNAL f_empty_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
225 SIGNAL f_empty_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
224 SIGNAL time_update_f : STD_LOGIC_VECTOR(3 DOWNTO 0);
226 SIGNAL time_update_f : STD_LOGIC_VECTOR(3 DOWNTO 0);
225 SIGNAL time_reg_f : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
227 SIGNAL time_reg_f : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
226
228
227 SIGNAL time_reg_f0_A : STD_LOGIC_VECTOR(47 DOWNTO 0);
229 SIGNAL time_reg_f0_A : STD_LOGIC_VECTOR(47 DOWNTO 0);
228 SIGNAL time_reg_f0_B : STD_LOGIC_VECTOR(47 DOWNTO 0);
230 SIGNAL time_reg_f0_B : STD_LOGIC_VECTOR(47 DOWNTO 0);
229 SIGNAL time_reg_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
231 SIGNAL time_reg_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
230 SIGNAL time_reg_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
232 SIGNAL time_reg_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
231
233
232 --SIGNAL time_update_f0_A : STD_LOGIC;
234 --SIGNAL time_update_f0_A : STD_LOGIC;
233 --SIGNAL time_update_f0_B : STD_LOGIC;
235 --SIGNAL time_update_f0_B : STD_LOGIC;
234 --SIGNAL time_update_f1 : STD_LOGIC;
236 --SIGNAL time_update_f1 : STD_LOGIC;
235 --SIGNAL time_update_f2 : STD_LOGIC;
237 --SIGNAL time_update_f2 : STD_LOGIC;
236 --
238 --
237 SIGNAL status_channel : STD_LOGIC_VECTOR(49 DOWNTO 0);
239 SIGNAL status_channel : STD_LOGIC_VECTOR(49 DOWNTO 0);
238 SIGNAL status_MS_input : STD_LOGIC_VECTOR(49 DOWNTO 0);
240 SIGNAL status_MS_input : STD_LOGIC_VECTOR(49 DOWNTO 0);
239 SIGNAL status_component : STD_LOGIC_VECTOR(53 DOWNTO 0);
241 SIGNAL status_component : STD_LOGIC_VECTOR(53 DOWNTO 0);
240
242
241 SIGNAL status_component_fifo_0 : STD_LOGIC_VECTOR(53 DOWNTO 4);
243 SIGNAL status_component_fifo_0 : STD_LOGIC_VECTOR(53 DOWNTO 4);
242 SIGNAL status_component_fifo_1 : STD_LOGIC_VECTOR(53 DOWNTO 4);
244 SIGNAL status_component_fifo_1 : STD_LOGIC_VECTOR(53 DOWNTO 4);
243 SIGNAL status_component_fifo_0_end : STD_LOGIC;
245 SIGNAL status_component_fifo_0_end : STD_LOGIC;
244 SIGNAL status_component_fifo_1_end : STD_LOGIC;
246 SIGNAL status_component_fifo_1_end : STD_LOGIC;
245 -----------------------------------------------------------------------------
247 -----------------------------------------------------------------------------
246 SIGNAL fft_ongoing_counter : STD_LOGIC;--_VECTOR(1 DOWNTO 0);
248 SIGNAL fft_ongoing_counter : STD_LOGIC;--_VECTOR(1 DOWNTO 0);
247
249
248 SIGNAL fft_ready_reg : STD_LOGIC;
250 SIGNAL fft_ready_reg : STD_LOGIC;
249 SIGNAL fft_ready_rising_down : STD_LOGIC;
251 SIGNAL fft_ready_rising_down : STD_LOGIC;
250
252
251 SIGNAL sample_load_reg : STD_LOGIC;
253 SIGNAL sample_load_reg : STD_LOGIC;
252 SIGNAL sample_load_rising_down : STD_LOGIC;
254 SIGNAL sample_load_rising_down : STD_LOGIC;
253
255
254 -----------------------------------------------------------------------------
256 -----------------------------------------------------------------------------
255 SIGNAL sample_f1_wen_head : STD_LOGIC_VECTOR(4 DOWNTO 0);
257 SIGNAL sample_f1_wen_head : STD_LOGIC_VECTOR(4 DOWNTO 0);
256 SIGNAL sample_f1_wen_head_in : STD_LOGIC;
258 SIGNAL sample_f1_wen_head_in : STD_LOGIC;
257 SIGNAL sample_f1_wen_head_out : STD_LOGIC;
259 SIGNAL sample_f1_wen_head_out : STD_LOGIC;
258 SIGNAL sample_f1_full_head_in : STD_LOGIC;
260 SIGNAL sample_f1_full_head_in : STD_LOGIC;
259 SIGNAL sample_f1_full_head_out : STD_LOGIC;
261 SIGNAL sample_f1_full_head_out : STD_LOGIC;
260 SIGNAL sample_f1_empty_head_in : STD_LOGIC;
262 SIGNAL sample_f1_empty_head_in : STD_LOGIC;
261
263
262 SIGNAL sample_f1_wdata_head : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
264 SIGNAL sample_f1_wdata_head : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
263 -----------------------------------------------------------------------------
265 -----------------------------------------------------------------------------
264 SIGNAL sample_f0_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
266 SIGNAL sample_f0_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
265 SIGNAL sample_f1_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
267 SIGNAL sample_f1_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
266 SIGNAL sample_f2_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
268 SIGNAL sample_f2_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
267 SIGNAL ongoing : STD_LOGIC;
269 SIGNAL ongoing : STD_LOGIC;
268
270
269 BEGIN
271 BEGIN
270
272
271 PROCESS (clk, rstn)
273 PROCESS (clk, rstn)
272 BEGIN -- PROCESS
274 BEGIN -- PROCESS
273 IF rstn = '0' THEN -- asynchronous reset (active low)
275 IF rstn = '0' THEN -- asynchronous reset (active low)
274 sample_f0_wen_s <= (OTHERS => '1');
276 sample_f0_wen_s <= (OTHERS => '1');
275 sample_f1_wen_s <= (OTHERS => '1');
277 sample_f1_wen_s <= (OTHERS => '1');
276 sample_f2_wen_s <= (OTHERS => '1');
278 sample_f2_wen_s <= (OTHERS => '1');
277 ongoing <= '0';
279 ongoing <= '0';
278 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
280 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
279 IF ongoing = '1' THEN
281 IF ongoing = '1' THEN
280 sample_f0_wen_s <= sample_f0_wen;
282 sample_f0_wen_s <= sample_f0_wen;
281 sample_f1_wen_s <= sample_f1_wen;
283 sample_f1_wen_s <= sample_f1_wen;
282 sample_f2_wen_s <= sample_f2_wen;
284 sample_f2_wen_s <= sample_f2_wen;
283 ELSE
285 ELSE
284 IF start_date = coarse_time(30 DOWNTO 0) THEN
286 IF start_date = coarse_time(30 DOWNTO 0) THEN
285 ongoing <= '1';
287 ongoing <= '1';
286 END IF;
288 END IF;
287 sample_f0_wen_s <= (OTHERS => '1');
289 sample_f0_wen_s <= (OTHERS => '1');
288 sample_f1_wen_s <= (OTHERS => '1');
290 sample_f1_wen_s <= (OTHERS => '1');
289 sample_f2_wen_s <= (OTHERS => '1');
291 sample_f2_wen_s <= (OTHERS => '1');
290 END IF;
292 END IF;
291 END IF;
293 END IF;
292 END PROCESS;
294 END PROCESS;
293
295
294
296
295 error_input_fifo_write <= error_wen_f2 & error_wen_f1 & error_wen_f0;
297 error_input_fifo_write <= error_wen_f2 & error_wen_f1 & error_wen_f0;
296
298
297
299
298 switch_f0_inst : spectral_matrix_switch_f0
300 switch_f0_inst : spectral_matrix_switch_f0
299 PORT MAP (
301 PORT MAP (
300 clk => clk,
302 clk => clk,
301 rstn => rstn,
303 rstn => rstn,
302
304
303 sample_wen => sample_f0_wen_s,
305 sample_wen => sample_f0_wen_s,
304
306
305 fifo_A_empty => sample_f0_A_empty,
307 fifo_A_empty => sample_f0_A_empty,
306 fifo_A_full => sample_f0_A_full,
308 fifo_A_full => sample_f0_A_full,
307 fifo_A_wen => sample_f0_A_wen,
309 fifo_A_wen => sample_f0_A_wen,
308
310
309 fifo_B_empty => sample_f0_B_empty,
311 fifo_B_empty => sample_f0_B_empty,
310 fifo_B_full => sample_f0_B_full,
312 fifo_B_full => sample_f0_B_full,
311 fifo_B_wen => sample_f0_B_wen,
313 fifo_B_wen => sample_f0_B_wen,
312
314
313 error_wen => error_wen_f0); -- TODO
315 error_wen => error_wen_f0); -- TODO
314
316
315 -----------------------------------------------------------------------------
317 -----------------------------------------------------------------------------
316 -- FIFO IN
318 -- FIFO IN
317 -----------------------------------------------------------------------------
319 -----------------------------------------------------------------------------
318 lppFIFOxN_f0_a : lppFIFOxN
320 lppFIFOxN_f0_a : lppFIFOxN
319 GENERIC MAP (
321 GENERIC MAP (
320 tech => 0,
322 tech => 0,
321 Mem_use => Mem_use,
323 Mem_use => Mem_use,
322 Data_sz => 16,
324 Data_sz => 16,
323 Addr_sz => 8,
325 Addr_sz => 8,
324 FifoCnt => 5)
326 FifoCnt => 5)
325 PORT MAP (
327 PORT MAP (
326 clk => clk,
328 clk => clk,
327 rstn => rstn,
329 rstn => rstn,
328
330
329 ReUse => (OTHERS => '0'),
331 ReUse => (OTHERS => '0'),
330
332
331 run => (OTHERS => '1'),
333 run => (OTHERS => '1'),
332
334
333 wen => sample_f0_A_wen,
335 wen => sample_f0_A_wen,
334 wdata => sample_f0_wdata,
336 wdata => sample_f0_wdata,
335
337
336 ren => sample_f0_A_ren,
338 ren => sample_f0_A_ren,
337 rdata => sample_f0_A_rdata,
339 rdata => sample_f0_A_rdata,
338
340
339 empty => sample_f0_A_empty,
341 empty => sample_f0_A_empty,
340 full => sample_f0_A_full,
342 full => sample_f0_A_full,
341 almost_full => OPEN);
343 almost_full => OPEN);
342
344
343 lppFIFOxN_f0_b : lppFIFOxN
345 lppFIFOxN_f0_b : lppFIFOxN
344 GENERIC MAP (
346 GENERIC MAP (
345 tech => 0,
347 tech => 0,
346 Mem_use => Mem_use,
348 Mem_use => Mem_use,
347 Data_sz => 16,
349 Data_sz => 16,
348 Addr_sz => 8,
350 Addr_sz => 8,
349 FifoCnt => 5)
351 FifoCnt => 5)
350 PORT MAP (
352 PORT MAP (
351 clk => clk,
353 clk => clk,
352 rstn => rstn,
354 rstn => rstn,
353
355
354 ReUse => (OTHERS => '0'),
356 ReUse => (OTHERS => '0'),
355 run => (OTHERS => '1'),
357 run => (OTHERS => '1'),
356
358
357 wen => sample_f0_B_wen,
359 wen => sample_f0_B_wen,
358 wdata => sample_f0_wdata,
360 wdata => sample_f0_wdata,
359 ren => sample_f0_B_ren,
361 ren => sample_f0_B_ren,
360 rdata => sample_f0_B_rdata,
362 rdata => sample_f0_B_rdata,
361 empty => sample_f0_B_empty,
363 empty => sample_f0_B_empty,
362 full => sample_f0_B_full,
364 full => sample_f0_B_full,
363 almost_full => OPEN);
365 almost_full => OPEN);
364
366
365 -----------------------------------------------------------------------------
367 -----------------------------------------------------------------------------
366 -- sample_f1_wen in
368 -- sample_f1_wen in
367 -- sample_f1_wdata in
369 -- sample_f1_wdata in
368 -- sample_f1_full OUT
370 -- sample_f1_full OUT
369
371
370 sample_f1_wen_head_in <= '0' WHEN sample_f1_wen_s = "00000" ELSE '1';
372 sample_f1_wen_head_in <= '0' WHEN sample_f1_wen_s = "00000" ELSE '1';
371 sample_f1_full_head_in <= '0' WHEN sample_f1_full = "00000" ELSE '1';
373 sample_f1_full_head_in <= '0' WHEN sample_f1_full = "00000" ELSE '1';
372 sample_f1_empty_head_in <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
374 sample_f1_empty_head_in <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
373
375
374 lpp_lfr_ms_reg_head_1:lpp_lfr_ms_reg_head
376 lpp_lfr_ms_reg_head_1:lpp_lfr_ms_reg_head
375 PORT MAP (
377 PORT MAP (
376 clk => clk,
378 clk => clk,
377 rstn => rstn,
379 rstn => rstn,
378 in_wen => sample_f1_wen_head_in,
380 in_wen => sample_f1_wen_head_in,
379 in_data => sample_f1_wdata,
381 in_data => sample_f1_wdata,
380 in_full => sample_f1_full_head_in,
382 in_full => sample_f1_full_head_in,
381 in_empty => sample_f1_empty_head_in,
383 in_empty => sample_f1_empty_head_in,
382 out_write_error => error_wen_f1,
384 out_write_error => error_wen_f1,
383 out_wen => sample_f1_wen_head_out,
385 out_wen => sample_f1_wen_head_out,
384 out_data => sample_f1_wdata_head,
386 out_data => sample_f1_wdata_head,
385 out_full => sample_f1_full_head_out);
387 out_full => sample_f1_full_head_out);
386
388
387 sample_f1_wen_head <= sample_f1_wen_head_out & sample_f1_wen_head_out & sample_f1_wen_head_out & sample_f1_wen_head_out & sample_f1_wen_head_out;
389 sample_f1_wen_head <= sample_f1_wen_head_out & sample_f1_wen_head_out & sample_f1_wen_head_out & sample_f1_wen_head_out & sample_f1_wen_head_out;
388
390
389
391
390 lppFIFOxN_f1 : lppFIFOxN
392 lppFIFOxN_f1 : lppFIFOxN
391 GENERIC MAP (
393 GENERIC MAP (
392 tech => 0,
394 tech => 0,
393 Mem_use => Mem_use,
395 Mem_use => Mem_use,
394 Data_sz => 16,
396 Data_sz => 16,
395 Addr_sz => 8,
397 Addr_sz => 8,
396 FifoCnt => 5)
398 FifoCnt => 5)
397 PORT MAP (
399 PORT MAP (
398 clk => clk,
400 clk => clk,
399 rstn => rstn,
401 rstn => rstn,
400
402
401 ReUse => (OTHERS => '0'),
403 ReUse => (OTHERS => '0'),
402 run => (OTHERS => '1'),
404 run => (OTHERS => '1'),
403
405
404 wen => sample_f1_wen_head,
406 wen => sample_f1_wen_head,
405 wdata => sample_f1_wdata_head,
407 wdata => sample_f1_wdata_head,
406 ren => sample_f1_ren,
408 ren => sample_f1_ren,
407 rdata => sample_f1_rdata,
409 rdata => sample_f1_rdata,
408 empty => sample_f1_empty,
410 empty => sample_f1_empty,
409 full => sample_f1_full,
411 full => sample_f1_full,
410 almost_full => sample_f1_almost_full);
412 almost_full => sample_f1_almost_full);
411
413
412
414
413 one_sample_f1_wen <= '0' WHEN sample_f1_wen_head = "11111" ELSE '1';
415 one_sample_f1_wen <= '0' WHEN sample_f1_wen_head = "11111" ELSE '1';
414
416
415 PROCESS (clk, rstn)
417 PROCESS (clk, rstn)
416 BEGIN -- PROCESS
418 BEGIN -- PROCESS
417 IF rstn = '0' THEN -- asynchronous reset (active low)
419 IF rstn = '0' THEN -- asynchronous reset (active low)
418 one_sample_f1_full <= '0';
420 one_sample_f1_full <= '0';
419 --error_wen_f1 <= '0';
421 --error_wen_f1 <= '0';
420 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
422 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
421 IF sample_f1_full_head_out = '0' THEN
423 IF sample_f1_full_head_out = '0' THEN
422 one_sample_f1_full <= '0';
424 one_sample_f1_full <= '0';
423 ELSE
425 ELSE
424 one_sample_f1_full <= '1';
426 one_sample_f1_full <= '1';
425 END IF;
427 END IF;
426 --error_wen_f1 <= one_sample_f1_wen AND one_sample_f1_full;
428 --error_wen_f1 <= one_sample_f1_wen AND one_sample_f1_full;
427 END IF;
429 END IF;
428 END PROCESS;
430 END PROCESS;
429
431
430 -----------------------------------------------------------------------------
432 -----------------------------------------------------------------------------
431
433
432
434
433 lppFIFOxN_f2 : lppFIFOxN
435 lppFIFOxN_f2 : lppFIFOxN
434 GENERIC MAP (
436 GENERIC MAP (
435 tech => 0,
437 tech => 0,
436 Mem_use => Mem_use,
438 Mem_use => Mem_use,
437 Data_sz => 16,
439 Data_sz => 16,
438 Addr_sz => 8,
440 Addr_sz => 8,
439 FifoCnt => 5)
441 FifoCnt => 5)
440 PORT MAP (
442 PORT MAP (
441 clk => clk,
443 clk => clk,
442 rstn => rstn,
444 rstn => rstn,
443
445
444 ReUse => (OTHERS => '0'),
446 ReUse => (OTHERS => '0'),
445 run => (OTHERS => '1'),
447 run => (OTHERS => '1'),
446
448
447 wen => sample_f2_wen_s,
449 wen => sample_f2_wen_s,
448 wdata => sample_f2_wdata,
450 wdata => sample_f2_wdata,
449 ren => sample_f2_ren,
451 ren => sample_f2_ren,
450 rdata => sample_f2_rdata,
452 rdata => sample_f2_rdata,
451 empty => sample_f2_empty,
453 empty => sample_f2_empty,
452 full => sample_f2_full,
454 full => sample_f2_full,
453 almost_full => OPEN);
455 almost_full => OPEN);
454
456
455
457
456 one_sample_f2_wen <= '0' WHEN sample_f2_wen_s = "11111" ELSE '1';
458 one_sample_f2_wen <= '0' WHEN sample_f2_wen_s = "11111" ELSE '1';
457
459
458 PROCESS (clk, rstn)
460 PROCESS (clk, rstn)
459 BEGIN -- PROCESS
461 BEGIN -- PROCESS
460 IF rstn = '0' THEN -- asynchronous reset (active low)
462 IF rstn = '0' THEN -- asynchronous reset (active low)
461 one_sample_f2_full <= '0';
463 one_sample_f2_full <= '0';
462 error_wen_f2 <= '0';
464 error_wen_f2 <= '0';
463 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
465 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
464 IF sample_f2_full = "00000" THEN
466 IF sample_f2_full = "00000" THEN
465 one_sample_f2_full <= '0';
467 one_sample_f2_full <= '0';
466 ELSE
468 ELSE
467 one_sample_f2_full <= '1';
469 one_sample_f2_full <= '1';
468 END IF;
470 END IF;
469 error_wen_f2 <= one_sample_f2_wen AND one_sample_f2_full;
471 error_wen_f2 <= one_sample_f2_wen AND one_sample_f2_full;
470 END IF;
472 END IF;
471 END PROCESS;
473 END PROCESS;
472
474
473 -----------------------------------------------------------------------------
475 -----------------------------------------------------------------------------
474 -- FSM SELECT CHANNEL
476 -- FSM SELECT CHANNEL
475 -----------------------------------------------------------------------------
477 -----------------------------------------------------------------------------
476 PROCESS (clk, rstn)
478 PROCESS (clk, rstn)
477 BEGIN
479 BEGIN
478 IF rstn = '0' THEN
480 IF rstn = '0' THEN
479 state_fsm_select_channel <= IDLE;
481 state_fsm_select_channel <= IDLE;
480 select_channel <= (OTHERS => '0');
482 select_channel <= (OTHERS => '0');
481 ELSIF clk'EVENT AND clk = '1' THEN
483 ELSIF clk'EVENT AND clk = '1' THEN
482 CASE state_fsm_select_channel IS
484 CASE state_fsm_select_channel IS
483 WHEN IDLE =>
485 WHEN IDLE =>
484 IF sample_f1_full = "11111" THEN
486 IF sample_f1_full = "11111" THEN
485 state_fsm_select_channel <= SWITCH_F1;
487 state_fsm_select_channel <= SWITCH_F1;
486 select_channel <= "10";
488 select_channel <= "10";
487 ELSIF sample_f1_almost_full = "00000" THEN
489 ELSIF sample_f1_almost_full = "00000" THEN
488 IF sample_f0_A_full = "11111" THEN
490 IF sample_f0_A_full = "11111" THEN
489 state_fsm_select_channel <= SWITCH_F0_A;
491 state_fsm_select_channel <= SWITCH_F0_A;
490 select_channel <= "00";
492 select_channel <= "00";
491 ELSIF sample_f0_B_full = "11111" THEN
493 ELSIF sample_f0_B_full = "11111" THEN
492 state_fsm_select_channel <= SWITCH_F0_B;
494 state_fsm_select_channel <= SWITCH_F0_B;
493 select_channel <= "01";
495 select_channel <= "01";
494 ELSIF sample_f2_full = "11111" THEN
496 ELSIF sample_f2_full = "11111" THEN
495 state_fsm_select_channel <= SWITCH_F2;
497 state_fsm_select_channel <= SWITCH_F2;
496 select_channel <= "11";
498 select_channel <= "11";
497 END IF;
499 END IF;
498 END IF;
500 END IF;
499
501
500 WHEN SWITCH_F0_A =>
502 WHEN SWITCH_F0_A =>
501 IF sample_f0_A_empty = "11111" THEN
503 IF sample_f0_A_empty = "11111" THEN
502 state_fsm_select_channel <= IDLE;
504 state_fsm_select_channel <= IDLE;
503 select_channel <= (OTHERS => '0');
505 select_channel <= (OTHERS => '0');
504 END IF;
506 END IF;
505 WHEN SWITCH_F0_B =>
507 WHEN SWITCH_F0_B =>
506 IF sample_f0_B_empty = "11111" THEN
508 IF sample_f0_B_empty = "11111" THEN
507 state_fsm_select_channel <= IDLE;
509 state_fsm_select_channel <= IDLE;
508 select_channel <= (OTHERS => '0');
510 select_channel <= (OTHERS => '0');
509 END IF;
511 END IF;
510 WHEN SWITCH_F1 =>
512 WHEN SWITCH_F1 =>
511 IF sample_f1_empty = "11111" THEN
513 IF sample_f1_empty = "11111" THEN
512 state_fsm_select_channel <= IDLE;
514 state_fsm_select_channel <= IDLE;
513 select_channel <= (OTHERS => '0');
515 select_channel <= (OTHERS => '0');
514 END IF;
516 END IF;
515 WHEN SWITCH_F2 =>
517 WHEN SWITCH_F2 =>
516 IF sample_f2_empty = "11111" THEN
518 IF sample_f2_empty = "11111" THEN
517 state_fsm_select_channel <= IDLE;
519 state_fsm_select_channel <= IDLE;
518 select_channel <= (OTHERS => '0');
520 select_channel <= (OTHERS => '0');
519 END IF;
521 END IF;
520 WHEN OTHERS => NULL;
522 WHEN OTHERS => NULL;
521 END CASE;
523 END CASE;
522
524
523 END IF;
525 END IF;
524 END PROCESS;
526 END PROCESS;
525
527
526 PROCESS (clk, rstn)
528 PROCESS (clk, rstn)
527 BEGIN
529 BEGIN
528 IF rstn = '0' THEN
530 IF rstn = '0' THEN
529 select_channel_reg <= (OTHERS => '0');
531 select_channel_reg <= (OTHERS => '0');
530 --pre_state_fsm_select_channel <= IDLE;
532 --pre_state_fsm_select_channel <= IDLE;
531 ELSIF clk'EVENT AND clk = '1' THEN
533 ELSIF clk'EVENT AND clk = '1' THEN
532 select_channel_reg <= select_channel;
534 select_channel_reg <= select_channel;
533 --pre_state_fsm_select_channel <= state_fsm_select_channel;
535 --pre_state_fsm_select_channel <= state_fsm_select_channel;
534 END IF;
536 END IF;
535 END PROCESS;
537 END PROCESS;
536
538
537
539
538 -----------------------------------------------------------------------------
540 -----------------------------------------------------------------------------
539 -- SWITCH SELECT CHANNEL
541 -- SWITCH SELECT CHANNEL
540 -----------------------------------------------------------------------------
542 -----------------------------------------------------------------------------
541 sample_empty <= sample_f0_A_empty WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
543 sample_empty <= sample_f0_A_empty WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
542 sample_f0_B_empty WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
544 sample_f0_B_empty WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
543 sample_f1_empty WHEN state_fsm_select_channel = SWITCH_F1 ELSE
545 sample_f1_empty WHEN state_fsm_select_channel = SWITCH_F1 ELSE
544 sample_f2_empty WHEN state_fsm_select_channel = SWITCH_F2 ELSE
546 sample_f2_empty WHEN state_fsm_select_channel = SWITCH_F2 ELSE
545 (OTHERS => '1');
547 (OTHERS => '1');
546
548
547 sample_full <= sample_f0_A_full WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
549 sample_full <= sample_f0_A_full WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
548 sample_f0_B_full WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
550 sample_f0_B_full WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
549 sample_f1_full WHEN state_fsm_select_channel = SWITCH_F1 ELSE
551 sample_f1_full WHEN state_fsm_select_channel = SWITCH_F1 ELSE
550 sample_f2_full WHEN state_fsm_select_channel = SWITCH_F2 ELSE
552 sample_f2_full WHEN state_fsm_select_channel = SWITCH_F2 ELSE
551 (OTHERS => '0');
553 (OTHERS => '0');
552
554
553 --sample_rdata <= sample_f0_A_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_A ELSE
555 --sample_rdata <= sample_f0_A_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_A ELSE
554 -- sample_f0_B_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_B ELSE
556 -- sample_f0_B_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_B ELSE
555 -- sample_f1_rdata WHEN pre_state_fsm_select_channel = SWITCH_F1 ELSE
557 -- sample_f1_rdata WHEN pre_state_fsm_select_channel = SWITCH_F1 ELSE
556 -- sample_f2_rdata; -- WHEN state_fsm_select_channel = SWITCH_F2 ELSE
558 -- sample_f2_rdata; -- WHEN state_fsm_select_channel = SWITCH_F2 ELSE
557 sample_rdata <= sample_f0_A_rdata WHEN select_channel_reg = "00" ELSE
559 sample_rdata <= sample_f0_A_rdata WHEN select_channel_reg = "00" ELSE
558 sample_f0_B_rdata WHEN select_channel_reg = "01" ELSE
560 sample_f0_B_rdata WHEN select_channel_reg = "01" ELSE
559 sample_f1_rdata WHEN select_channel_reg = "10" ELSE
561 sample_f1_rdata WHEN select_channel_reg = "10" ELSE
560 sample_f2_rdata; -- WHEN state_fsm_select_channel = SWITCH_F2 ELSE
562 sample_f2_rdata; -- WHEN state_fsm_select_channel = SWITCH_F2 ELSE
561
563
562
564
563 sample_f0_A_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_A ELSE (OTHERS => '1');
565 sample_f0_A_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_A ELSE (OTHERS => '1');
564 sample_f0_B_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_B ELSE (OTHERS => '1');
566 sample_f0_B_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_B ELSE (OTHERS => '1');
565 sample_f1_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F1 ELSE (OTHERS => '1');
567 sample_f1_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F1 ELSE (OTHERS => '1');
566 sample_f2_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F2 ELSE (OTHERS => '1');
568 sample_f2_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F2 ELSE (OTHERS => '1');
567
569
568
570
569 status_channel <= time_reg_f0_A & "00" WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
571 status_channel <= time_reg_f0_A & "00" WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
570 time_reg_f0_B & "00" WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
572 time_reg_f0_B & "00" WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
571 time_reg_f1 & "01" WHEN state_fsm_select_channel = SWITCH_F1 ELSE
573 time_reg_f1 & "01" WHEN state_fsm_select_channel = SWITCH_F1 ELSE
572 time_reg_f2 & "10"; -- WHEN state_fsm_select_channel = SWITCH_F2
574 time_reg_f2 & "10"; -- WHEN state_fsm_select_channel = SWITCH_F2
573
575
574 -----------------------------------------------------------------------------
576 -----------------------------------------------------------------------------
575 -- FSM LOAD FFT
577 -- FSM LOAD FFT
576 -----------------------------------------------------------------------------
578 -----------------------------------------------------------------------------
577
579
578 sample_ren <= (OTHERS => '1') WHEN fft_ongoing_counter = '1' ELSE
580 sample_ren <= (OTHERS => '1') WHEN fft_ongoing_counter = '1' ELSE
579 sample_ren_s WHEN sample_load = '1' ELSE
581 sample_ren_s WHEN sample_load = '1' ELSE
580 (OTHERS => '1');
582 (OTHERS => '1');
581
583
582 PROCESS (clk, rstn)
584 PROCESS (clk, rstn)
583 BEGIN
585 BEGIN
584 IF rstn = '0' THEN
586 IF rstn = '0' THEN
585 sample_ren_s <= (OTHERS => '1');
587 sample_ren_s <= (OTHERS => '1');
586 state_fsm_load_FFT <= IDLE;
588 state_fsm_load_FFT <= IDLE;
587 status_MS_input <= (OTHERS => '0');
589 status_MS_input <= (OTHERS => '0');
588 select_fifo <= "000";
590 select_fifo <= "000";
589 --next_state_fsm_load_FFT <= IDLE;
591 --next_state_fsm_load_FFT <= IDLE;
590 --sample_valid <= '0';
592 --sample_valid <= '0';
591 ELSIF clk'EVENT AND clk = '1' THEN
593 ELSIF clk'EVENT AND clk = '1' THEN
592 CASE state_fsm_load_FFT IS
594 CASE state_fsm_load_FFT IS
593 WHEN IDLE =>
595 WHEN IDLE =>
594 --sample_valid <= '0';
596 --sample_valid <= '0';
595 sample_ren_s <= (OTHERS => '1');
597 sample_ren_s <= (OTHERS => '1');
596 IF sample_full = "11111" AND sample_load = '1' THEN
598 IF sample_full = "11111" AND sample_load = '1' THEN
597 state_fsm_load_FFT <= FIFO_1;
599 state_fsm_load_FFT <= FIFO_1;
598 status_MS_input <= status_channel;
600 status_MS_input <= status_channel;
599 select_fifo <= "000";
601 select_fifo <= "000";
600 END IF;
602 END IF;
601
603
602 WHEN FIFO_1 =>
604 WHEN FIFO_1 =>
603 sample_ren_s <= "1111" & NOT(sample_load);
605 sample_ren_s <= "1111" & NOT(sample_load);
604 IF sample_empty(0) = '1' THEN
606 IF sample_empty(0) = '1' THEN
605 sample_ren_s <= (OTHERS => '1');
607 sample_ren_s <= (OTHERS => '1');
606 state_fsm_load_FFT <= FIFO_2;
608 state_fsm_load_FFT <= FIFO_2;
607 select_fifo <= "001";
609 select_fifo <= "001";
608 END IF;
610 END IF;
609
611
610 WHEN FIFO_2 =>
612 WHEN FIFO_2 =>
611 sample_ren_s <= "111" & NOT(sample_load) & '1';
613 sample_ren_s <= "111" & NOT(sample_load) & '1';
612 IF sample_empty(1) = '1' THEN
614 IF sample_empty(1) = '1' THEN
613 sample_ren_s <= (OTHERS => '1');
615 sample_ren_s <= (OTHERS => '1');
614 state_fsm_load_FFT <= FIFO_3;
616 state_fsm_load_FFT <= FIFO_3;
615 select_fifo <= "010";
617 select_fifo <= "010";
616 END IF;
618 END IF;
617
619
618 WHEN FIFO_3 =>
620 WHEN FIFO_3 =>
619 sample_ren_s <= "11" & NOT(sample_load) & "11";
621 sample_ren_s <= "11" & NOT(sample_load) & "11";
620 IF sample_empty(2) = '1' THEN
622 IF sample_empty(2) = '1' THEN
621 sample_ren_s <= (OTHERS => '1');
623 sample_ren_s <= (OTHERS => '1');
622 state_fsm_load_FFT <= FIFO_4;
624 state_fsm_load_FFT <= FIFO_4;
623 select_fifo <= "011";
625 select_fifo <= "011";
624 END IF;
626 END IF;
625
627
626 WHEN FIFO_4 =>
628 WHEN FIFO_4 =>
627 sample_ren_s <= '1' & NOT(sample_load) & "111";
629 sample_ren_s <= '1' & NOT(sample_load) & "111";
628 IF sample_empty(3) = '1' THEN
630 IF sample_empty(3) = '1' THEN
629 sample_ren_s <= (OTHERS => '1');
631 sample_ren_s <= (OTHERS => '1');
630 state_fsm_load_FFT <= FIFO_5;
632 state_fsm_load_FFT <= FIFO_5;
631 select_fifo <= "100";
633 select_fifo <= "100";
632 END IF;
634 END IF;
633
635
634 WHEN FIFO_5 =>
636 WHEN FIFO_5 =>
635 sample_ren_s <= NOT(sample_load) & "1111";
637 sample_ren_s <= NOT(sample_load) & "1111";
636 IF sample_empty(4) = '1' THEN
638 IF sample_empty(4) = '1' THEN
637 sample_ren_s <= (OTHERS => '1');
639 sample_ren_s <= (OTHERS => '1');
638 state_fsm_load_FFT <= IDLE;
640 state_fsm_load_FFT <= IDLE;
639 select_fifo <= "000";
641 select_fifo <= "000";
640 END IF;
642 END IF;
641 WHEN OTHERS => NULL;
643 WHEN OTHERS => NULL;
642 END CASE;
644 END CASE;
643 END IF;
645 END IF;
644 END PROCESS;
646 END PROCESS;
645
647
646 PROCESS (clk, rstn)
648 PROCESS (clk, rstn)
647 BEGIN
649 BEGIN
648 IF rstn = '0' THEN
650 IF rstn = '0' THEN
649 sample_valid_r <= '0';
651 sample_valid_r <= '0';
650 select_fifo_reg <= (OTHERS => '0');
652 select_fifo_reg <= (OTHERS => '0');
651 --next_state_fsm_load_FFT <= IDLE;
653 --next_state_fsm_load_FFT <= IDLE;
652 ELSIF clk'EVENT AND clk = '1' THEN
654 ELSIF clk'EVENT AND clk = '1' THEN
653 select_fifo_reg <= select_fifo;
655 select_fifo_reg <= select_fifo;
654 --next_state_fsm_load_FFT <= state_fsm_load_FFT;
656 --next_state_fsm_load_FFT <= state_fsm_load_FFT;
655 IF sample_ren_s = "11111" THEN
657 IF sample_ren_s = "11111" THEN
656 sample_valid_r <= '0';
658 sample_valid_r <= '0';
657 ELSE
659 ELSE
658 sample_valid_r <= '1';
660 sample_valid_r <= '1';
659 END IF;
661 END IF;
660 END IF;
662 END IF;
661 END PROCESS;
663 END PROCESS;
662
664
663 sample_valid <= '0' WHEN fft_ongoing_counter = '1' ELSE sample_valid_r AND sample_load;
665 sample_valid <= '0' WHEN fft_ongoing_counter = '1' ELSE sample_valid_r AND sample_load;
664
666
665 --sample_data <= sample_rdata(16*1-1 DOWNTO 16*0) WHEN next_state_fsm_load_FFT = FIFO_1 ELSE
667 --sample_data <= sample_rdata(16*1-1 DOWNTO 16*0) WHEN next_state_fsm_load_FFT = FIFO_1 ELSE
666 -- sample_rdata(16*2-1 DOWNTO 16*1) WHEN next_state_fsm_load_FFT = FIFO_2 ELSE
668 -- sample_rdata(16*2-1 DOWNTO 16*1) WHEN next_state_fsm_load_FFT = FIFO_2 ELSE
667 -- sample_rdata(16*3-1 DOWNTO 16*2) WHEN next_state_fsm_load_FFT = FIFO_3 ELSE
669 -- sample_rdata(16*3-1 DOWNTO 16*2) WHEN next_state_fsm_load_FFT = FIFO_3 ELSE
668 -- sample_rdata(16*4-1 DOWNTO 16*3) WHEN next_state_fsm_load_FFT = FIFO_4 ELSE
670 -- sample_rdata(16*4-1 DOWNTO 16*3) WHEN next_state_fsm_load_FFT = FIFO_4 ELSE
669 -- sample_rdata(16*5-1 DOWNTO 16*4); --WHEN next_state_fsm_load_FFT = FIFO_5 ELSE
671 -- sample_rdata(16*5-1 DOWNTO 16*4); --WHEN next_state_fsm_load_FFT = FIFO_5 ELSE
670 sample_data <= sample_rdata(16*1-1 DOWNTO 16*0) WHEN select_fifo_reg = "000" ELSE
672 sample_data <= sample_rdata(16*1-1 DOWNTO 16*0) WHEN select_fifo_reg = "000" ELSE
671 sample_rdata(16*2-1 DOWNTO 16*1) WHEN select_fifo_reg = "001" ELSE
673 sample_rdata(16*2-1 DOWNTO 16*1) WHEN select_fifo_reg = "001" ELSE
672 sample_rdata(16*3-1 DOWNTO 16*2) WHEN select_fifo_reg = "010" ELSE
674 sample_rdata(16*3-1 DOWNTO 16*2) WHEN select_fifo_reg = "010" ELSE
673 sample_rdata(16*4-1 DOWNTO 16*3) WHEN select_fifo_reg = "011" ELSE
675 sample_rdata(16*4-1 DOWNTO 16*3) WHEN select_fifo_reg = "011" ELSE
674 sample_rdata(16*5-1 DOWNTO 16*4); --WHEN next_state_fsm_load_FFT = FIFO_5 ELSE
676 sample_rdata(16*5-1 DOWNTO 16*4); --WHEN next_state_fsm_load_FFT = FIFO_5 ELSE
675
677
676 -----------------------------------------------------------------------------
678 -----------------------------------------------------------------------------
677 -- FFT
679 -- FFT
678 -----------------------------------------------------------------------------
680 -----------------------------------------------------------------------------
679 lpp_lfr_ms_FFT_1 : lpp_lfr_ms_FFT
681 lpp_lfr_ms_FFT_1 : lpp_lfr_ms_FFT
680 PORT MAP (
682 PORT MAP (
681 clk => clk,
683 clk => clk,
682 rstn => rstn,
684 rstn => rstn,
683 sample_valid => sample_valid,
685 sample_valid => sample_valid,
684 fft_read => fft_read,
686 fft_read => fft_read,
685 sample_data => sample_data,
687 sample_data => sample_data,
686 sample_load => sample_load,
688 sample_load => sample_load,
687 fft_pong => fft_pong,
689 fft_pong => fft_pong,
688 fft_data_im => fft_data_im,
690 fft_data_im => fft_data_im,
689 fft_data_re => fft_data_re,
691 fft_data_re => fft_data_re,
690 fft_data_valid => fft_data_valid,
692 fft_data_valid => fft_data_valid,
691 fft_ready => fft_ready);
693 fft_ready => fft_ready);
692
694
693 debug_vector(0) <= fft_data_valid;
695 debug_vector(0) <= fft_data_valid;
694 debug_vector(1) <= fft_ready;
696 debug_vector(1) <= fft_ready;
695 debug_vector(11 DOWNTO 2) <= (OTHERS => '0');
697 debug_vector(11 DOWNTO 2) <= (OTHERS => '0');
696
698
697
699
698 -----------------------------------------------------------------------------
700 -----------------------------------------------------------------------------
699 fft_ready_rising_down <= fft_ready_reg AND NOT fft_ready;
701 fft_ready_rising_down <= fft_ready_reg AND NOT fft_ready;
700 sample_load_rising_down <= sample_load_reg AND NOT sample_load;
702 sample_load_rising_down <= sample_load_reg AND NOT sample_load;
701
703
702 PROCESS (clk, rstn)
704 PROCESS (clk, rstn)
703 BEGIN
705 BEGIN
704 IF rstn = '0' THEN
706 IF rstn = '0' THEN
705 fft_ready_reg <= '0';
707 fft_ready_reg <= '0';
706 sample_load_reg <= '0';
708 sample_load_reg <= '0';
707
709
708 fft_ongoing_counter <= '0';
710 fft_ongoing_counter <= '0';
709 ELSIF clk'event AND clk = '1' THEN
711 ELSIF clk'event AND clk = '1' THEN
710 fft_ready_reg <= fft_ready;
712 fft_ready_reg <= fft_ready;
711 sample_load_reg <= sample_load;
713 sample_load_reg <= sample_load;
712
714
713 IF fft_ready_rising_down = '1' AND sample_load_rising_down = '0' THEN
715 IF fft_ready_rising_down = '1' AND sample_load_rising_down = '0' THEN
714 fft_ongoing_counter <= '0';
716 fft_ongoing_counter <= '0';
715
717
716 -- CASE fft_ongoing_counter IS
718 -- CASE fft_ongoing_counter IS
717 -- WHEN "01" => fft_ongoing_counter <= "00";
719 -- WHEN "01" => fft_ongoing_counter <= "00";
718 ---- WHEN "10" => fft_ongoing_counter <= "01";
720 ---- WHEN "10" => fft_ongoing_counter <= "01";
719 -- WHEN OTHERS => NULL;
721 -- WHEN OTHERS => NULL;
720 -- END CASE;
722 -- END CASE;
721 ELSIF fft_ready_rising_down = '0' AND sample_load_rising_down = '1' THEN
723 ELSIF fft_ready_rising_down = '0' AND sample_load_rising_down = '1' THEN
722 fft_ongoing_counter <= '1';
724 fft_ongoing_counter <= '1';
723 -- CASE fft_ongoing_counter IS
725 -- CASE fft_ongoing_counter IS
724 -- WHEN "00" => fft_ongoing_counter <= "01";
726 -- WHEN "00" => fft_ongoing_counter <= "01";
725 ---- WHEN "01" => fft_ongoing_counter <= "10";
727 ---- WHEN "01" => fft_ongoing_counter <= "10";
726 -- WHEN OTHERS => NULL;
728 -- WHEN OTHERS => NULL;
727 -- END CASE;
729 -- END CASE;
728 END IF;
730 END IF;
729
731
730 END IF;
732 END IF;
731 END PROCESS;
733 END PROCESS;
732
734
733 -----------------------------------------------------------------------------
735 -----------------------------------------------------------------------------
734 PROCESS (clk, rstn)
736 PROCESS (clk, rstn)
735 BEGIN
737 BEGIN
736 IF rstn = '0' THEN
738 IF rstn = '0' THEN
737 state_fsm_load_MS_memory <= IDLE;
739 state_fsm_load_MS_memory <= IDLE;
738 current_fifo_load <= "00001";
740 current_fifo_load <= "00001";
739 ELSIF clk'EVENT AND clk = '1' THEN
741 ELSIF clk'EVENT AND clk = '1' THEN
740 CASE state_fsm_load_MS_memory IS
742 CASE state_fsm_load_MS_memory IS
741 WHEN IDLE =>
743 WHEN IDLE =>
742 IF current_fifo_empty = '1' AND fft_ready = '1' AND current_fifo_locked = '0' THEN
744 IF current_fifo_empty = '1' AND fft_ready = '1' AND current_fifo_locked = '0' THEN
743 state_fsm_load_MS_memory <= LOAD_FIFO;
745 state_fsm_load_MS_memory <= LOAD_FIFO;
744 END IF;
746 END IF;
745 WHEN LOAD_FIFO =>
747 WHEN LOAD_FIFO =>
746 IF current_fifo_full = '1' THEN
748 IF current_fifo_full = '1' THEN
747 state_fsm_load_MS_memory <= TRASH_FFT;
749 state_fsm_load_MS_memory <= TRASH_FFT;
748 END IF;
750 END IF;
749 WHEN TRASH_FFT =>
751 WHEN TRASH_FFT =>
750 IF fft_ready = '0' THEN
752 IF fft_ready = '0' THEN
751 state_fsm_load_MS_memory <= IDLE;
753 state_fsm_load_MS_memory <= IDLE;
752 current_fifo_load <= current_fifo_load(3 DOWNTO 0) & current_fifo_load(4);
754 current_fifo_load <= current_fifo_load(3 DOWNTO 0) & current_fifo_load(4);
753 END IF;
755 END IF;
754 WHEN OTHERS => NULL;
756 WHEN OTHERS => NULL;
755 END CASE;
757 END CASE;
756
758
757 END IF;
759 END IF;
758 END PROCESS;
760 END PROCESS;
759
761
760 current_fifo_empty <= MEM_IN_SM_Empty(0) WHEN current_fifo_load(0) = '1' ELSE
762 current_fifo_empty <= MEM_IN_SM_Empty(0) WHEN current_fifo_load(0) = '1' ELSE
761 MEM_IN_SM_Empty(1) WHEN current_fifo_load(1) = '1' ELSE
763 MEM_IN_SM_Empty(1) WHEN current_fifo_load(1) = '1' ELSE
762 MEM_IN_SM_Empty(2) WHEN current_fifo_load(2) = '1' ELSE
764 MEM_IN_SM_Empty(2) WHEN current_fifo_load(2) = '1' ELSE
763 MEM_IN_SM_Empty(3) WHEN current_fifo_load(3) = '1' ELSE
765 MEM_IN_SM_Empty(3) WHEN current_fifo_load(3) = '1' ELSE
764 MEM_IN_SM_Empty(4); -- WHEN current_fifo_load(3) = '1' ELSE
766 MEM_IN_SM_Empty(4); -- WHEN current_fifo_load(3) = '1' ELSE
765
767
766 current_fifo_full <= MEM_IN_SM_Full(0) WHEN current_fifo_load(0) = '1' ELSE
768 current_fifo_full <= MEM_IN_SM_Full(0) WHEN current_fifo_load(0) = '1' ELSE
767 MEM_IN_SM_Full(1) WHEN current_fifo_load(1) = '1' ELSE
769 MEM_IN_SM_Full(1) WHEN current_fifo_load(1) = '1' ELSE
768 MEM_IN_SM_Full(2) WHEN current_fifo_load(2) = '1' ELSE
770 MEM_IN_SM_Full(2) WHEN current_fifo_load(2) = '1' ELSE
769 MEM_IN_SM_Full(3) WHEN current_fifo_load(3) = '1' ELSE
771 MEM_IN_SM_Full(3) WHEN current_fifo_load(3) = '1' ELSE
770 MEM_IN_SM_Full(4); -- WHEN current_fifo_load(3) = '1' ELSE
772 MEM_IN_SM_Full(4); -- WHEN current_fifo_load(3) = '1' ELSE
771
773
772 current_fifo_locked <= MEM_IN_SM_locked(0) WHEN current_fifo_load(0) = '1' ELSE
774 current_fifo_locked <= MEM_IN_SM_locked(0) WHEN current_fifo_load(0) = '1' ELSE
773 MEM_IN_SM_locked(1) WHEN current_fifo_load(1) = '1' ELSE
775 MEM_IN_SM_locked(1) WHEN current_fifo_load(1) = '1' ELSE
774 MEM_IN_SM_locked(2) WHEN current_fifo_load(2) = '1' ELSE
776 MEM_IN_SM_locked(2) WHEN current_fifo_load(2) = '1' ELSE
775 MEM_IN_SM_locked(3) WHEN current_fifo_load(3) = '1' ELSE
777 MEM_IN_SM_locked(3) WHEN current_fifo_load(3) = '1' ELSE
776 MEM_IN_SM_locked(4); -- WHEN current_fifo_load(3) = '1' ELSE
778 MEM_IN_SM_locked(4); -- WHEN current_fifo_load(3) = '1' ELSE
777
779
778 fft_read <= '0' WHEN state_fsm_load_MS_memory = IDLE ELSE '1';
780 fft_read <= '0' WHEN state_fsm_load_MS_memory = IDLE ELSE '1';
779
781
780 all_fifo : FOR I IN 4 DOWNTO 0 GENERATE
782 all_fifo : FOR I IN 4 DOWNTO 0 GENERATE
781 MEM_IN_SM_wen_s(I) <= '0' WHEN fft_data_valid = '1'
783 MEM_IN_SM_wen_s(I) <= '0' WHEN fft_data_valid = '1'
782 AND state_fsm_load_MS_memory = LOAD_FIFO
784 AND state_fsm_load_MS_memory = LOAD_FIFO
783 AND current_fifo_load(I) = '1'
785 AND current_fifo_load(I) = '1'
784 ELSE '1';
786 ELSE '1';
785 END GENERATE all_fifo;
787 END GENERATE all_fifo;
786
788
787 PROCESS (clk, rstn)
789 PROCESS (clk, rstn)
788 BEGIN
790 BEGIN
789 IF rstn = '0' THEN
791 IF rstn = '0' THEN
790 MEM_IN_SM_wen <= (OTHERS => '1');
792 MEM_IN_SM_wen <= (OTHERS => '1');
791 ELSIF clk'EVENT AND clk = '1' THEN
793 ELSIF clk'EVENT AND clk = '1' THEN
792 MEM_IN_SM_wen <= MEM_IN_SM_wen_s;
794 MEM_IN_SM_wen <= MEM_IN_SM_wen_s;
793 END IF;
795 END IF;
794 END PROCESS;
796 END PROCESS;
795
797
796 MEM_IN_SM_wData <= (fft_data_im & fft_data_re) &
798 MEM_IN_SM_wData <= (fft_data_im & fft_data_re) &
797 (fft_data_im & fft_data_re) &
799 (fft_data_im & fft_data_re) &
798 (fft_data_im & fft_data_re) &
800 (fft_data_im & fft_data_re) &
799 (fft_data_im & fft_data_re) &
801 (fft_data_im & fft_data_re) &
800 (fft_data_im & fft_data_re);
802 (fft_data_im & fft_data_re);
801 -----------------------------------------------------------------------------
803 -----------------------------------------------------------------------------
802
804
803
805
804 -----------------------------------------------------------------------------
806 -----------------------------------------------------------------------------
805 Mem_In_SpectralMatrix : lppFIFOxN
807 Mem_In_SpectralMatrix : lppFIFOxN
806 GENERIC MAP (
808 GENERIC MAP (
807 tech => 0,
809 tech => 0,
808 Mem_use => Mem_use,
810 Mem_use => Mem_use,
809 Data_sz => 32, --16,
811 Data_sz => 32, --16,
810 Addr_sz => 7, --8
812 Addr_sz => 7, --8
811 FifoCnt => 5)
813 FifoCnt => 5)
812 PORT MAP (
814 PORT MAP (
813 clk => clk,
815 clk => clk,
814 rstn => rstn,
816 rstn => rstn,
815
817
816 ReUse => MEM_IN_SM_ReUse,
818 ReUse => MEM_IN_SM_ReUse,
817 run => (OTHERS => '1'),
819 run => (OTHERS => '1'),
818
820
819 wen => MEM_IN_SM_wen,
821 wen => MEM_IN_SM_wen,
820 wdata => MEM_IN_SM_wData,
822 wdata => MEM_IN_SM_wData,
821
823
822 ren => MEM_IN_SM_ren,
824 ren => MEM_IN_SM_ren,
823 rdata => MEM_IN_SM_rData,
825 rdata => MEM_IN_SM_rData,
824 full => MEM_IN_SM_Full,
826 full => MEM_IN_SM_Full,
825 empty => MEM_IN_SM_Empty,
827 empty => MEM_IN_SM_Empty,
826 almost_full => OPEN);
828 almost_full => OPEN);
827
829
828
830
829 -----------------------------------------------------------------------------
831 -----------------------------------------------------------------------------
830 MS_control_1 : MS_control
832 MS_control_1 : MS_control
831 PORT MAP (
833 PORT MAP (
832 clk => clk,
834 clk => clk,
833 rstn => rstn,
835 rstn => rstn,
834
836
835 current_status_ms => status_MS_input,
837 current_status_ms => status_MS_input,
836
838
837 fifo_in_lock => MEM_IN_SM_locked,
839 fifo_in_lock => MEM_IN_SM_locked,
838 fifo_in_data => MEM_IN_SM_rdata,
840 fifo_in_data => MEM_IN_SM_rdata,
839 fifo_in_full => MEM_IN_SM_Full,
841 fifo_in_full => MEM_IN_SM_Full,
840 fifo_in_empty => MEM_IN_SM_Empty,
842 fifo_in_empty => MEM_IN_SM_Empty,
841 fifo_in_ren => MEM_IN_SM_ren,
843 fifo_in_ren => MEM_IN_SM_ren,
842 fifo_in_reuse => MEM_IN_SM_ReUse,
844 fifo_in_reuse => MEM_IN_SM_ReUse,
843
845
844 fifo_out_data => SM_in_data,
846 fifo_out_data => SM_in_data,
845 fifo_out_ren => SM_in_ren,
847 fifo_out_ren => SM_in_ren,
846 fifo_out_empty => SM_in_empty,
848 fifo_out_empty => SM_in_empty,
847
849
848 current_status_component => status_component,
850 current_status_component => status_component,
849
851
850 correlation_start => SM_correlation_start,
852 correlation_start => SM_correlation_start,
851 correlation_auto => SM_correlation_auto,
853 correlation_auto => SM_correlation_auto,
852 correlation_done => SM_correlation_done);
854 correlation_done => SM_correlation_done);
853
855
854
856
855 MS_calculation_1 : MS_calculation
857 MS_calculation_1 : MS_calculation
856 PORT MAP (
858 PORT MAP (
857 clk => clk,
859 clk => clk,
858 rstn => rstn,
860 rstn => rstn,
859
861
860 fifo_in_data => SM_in_data,
862 fifo_in_data => SM_in_data,
861 fifo_in_ren => SM_in_ren,
863 fifo_in_ren => SM_in_ren,
862 fifo_in_empty => SM_in_empty,
864 fifo_in_empty => SM_in_empty,
863
865
864 fifo_out_data => MEM_OUT_SM_Data_in_s, -- TODO
866 fifo_out_data => MEM_OUT_SM_Data_in_s, -- TODO
865 fifo_out_wen => MEM_OUT_SM_Write_s, -- TODO
867 fifo_out_wen => MEM_OUT_SM_Write_s, -- TODO
866 fifo_out_full => MEM_OUT_SM_Full_s, -- TODO
868 fifo_out_full => MEM_OUT_SM_Full_s, -- TODO
867
869
868 correlation_start => SM_correlation_start,
870 correlation_start => SM_correlation_start,
869 correlation_auto => SM_correlation_auto,
871 correlation_auto => SM_correlation_auto,
870 correlation_begin => SM_correlation_begin,
872 correlation_begin => SM_correlation_begin,
871 correlation_done => SM_correlation_done);
873 correlation_done => SM_correlation_done);
872
874
873 -----------------------------------------------------------------------------
875 -----------------------------------------------------------------------------
874 PROCESS (clk, rstn)
876 PROCESS (clk, rstn)
875 BEGIN -- PROCESS
877 BEGIN -- PROCESS
876 IF rstn = '0' THEN -- asynchronous reset (active low)
878 IF rstn = '0' THEN -- asynchronous reset (active low)
877 current_matrix_write <= '0';
879 current_matrix_write <= '0';
878 current_matrix_wait_empty <= '1';
880 current_matrix_wait_empty <= '1';
879 status_component_fifo_0 <= (OTHERS => '0');
881 status_component_fifo_0 <= (OTHERS => '0');
880 status_component_fifo_1 <= (OTHERS => '0');
882 status_component_fifo_1 <= (OTHERS => '0');
881 status_component_fifo_0_end <= '0';
883 status_component_fifo_0_end <= '0';
882 status_component_fifo_1_end <= '0';
884 status_component_fifo_1_end <= '0';
883 SM_correlation_done_reg1 <= '0';
885 SM_correlation_done_reg1 <= '0';
884 SM_correlation_done_reg2 <= '0';
886 SM_correlation_done_reg2 <= '0';
885 SM_correlation_done_reg3 <= '0';
887 SM_correlation_done_reg3 <= '0';
886
888
887 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
889 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
888 SM_correlation_done_reg1 <= SM_correlation_done;
890 SM_correlation_done_reg1 <= SM_correlation_done;
889 SM_correlation_done_reg2 <= SM_correlation_done_reg1;
891 SM_correlation_done_reg2 <= SM_correlation_done_reg1;
890 SM_correlation_done_reg3 <= SM_correlation_done_reg2;
892 SM_correlation_done_reg3 <= SM_correlation_done_reg2;
891 status_component_fifo_0_end <= '0';
893 status_component_fifo_0_end <= '0';
892 status_component_fifo_1_end <= '0';
894 status_component_fifo_1_end <= '0';
893 IF SM_correlation_begin = '1' THEN
895 IF SM_correlation_begin = '1' THEN
894 IF current_matrix_write = '0' THEN
896 IF current_matrix_write = '0' THEN
895 status_component_fifo_0 <= status_component(53 DOWNTO 4);
897 status_component_fifo_0 <= status_component(53 DOWNTO 4);
896 ELSE
898 ELSE
897 status_component_fifo_1 <= status_component(53 DOWNTO 4);
899 status_component_fifo_1 <= status_component(53 DOWNTO 4);
898 END IF;
900 END IF;
899 END IF;
901 END IF;
900
902
901 IF SM_correlation_done_reg3 = '1' THEN
903 IF SM_correlation_done_reg3 = '1' THEN
902 IF current_matrix_write = '0' THEN
904 IF current_matrix_write = '0' THEN
903 status_component_fifo_0_end <= '1';
905 status_component_fifo_0_end <= '1';
904 ELSE
906 ELSE
905 status_component_fifo_1_end <= '1';
907 status_component_fifo_1_end <= '1';
906 END IF;
908 END IF;
907 current_matrix_wait_empty <= '1';
909 current_matrix_wait_empty <= '1';
908 current_matrix_write <= NOT current_matrix_write;
910 current_matrix_write <= NOT current_matrix_write;
909 END IF;
911 END IF;
910
912
911 IF current_matrix_wait_empty <= '1' THEN
913 IF current_matrix_wait_empty <= '1' THEN
912 IF current_matrix_write = '0' THEN
914 IF current_matrix_write = '0' THEN
913 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(0);
915 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(0);
914 ELSE
916 ELSE
915 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(1);
917 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(1);
916 END IF;
918 END IF;
917 END IF;
919 END IF;
918
920
919 END IF;
921 END IF;
920 END PROCESS;
922 END PROCESS;
921
923
922 MEM_OUT_SM_Full_s <= '1' WHEN SM_correlation_done = '1' ELSE
924 MEM_OUT_SM_Full_s <= '1' WHEN SM_correlation_done = '1' ELSE
923 '1' WHEN SM_correlation_done_reg1 = '1' ELSE
925 '1' WHEN SM_correlation_done_reg1 = '1' ELSE
924 '1' WHEN SM_correlation_done_reg2 = '1' ELSE
926 '1' WHEN SM_correlation_done_reg2 = '1' ELSE
925 '1' WHEN SM_correlation_done_reg3 = '1' ELSE
927 '1' WHEN SM_correlation_done_reg3 = '1' ELSE
926 '1' WHEN current_matrix_wait_empty = '1' ELSE
928 '1' WHEN current_matrix_wait_empty = '1' ELSE
927 MEM_OUT_SM_Full(0) WHEN current_matrix_write = '0' ELSE
929 MEM_OUT_SM_Full(0) WHEN current_matrix_write = '0' ELSE
928 MEM_OUT_SM_Full(1);
930 MEM_OUT_SM_Full(1);
929
931
930 MEM_OUT_SM_Write(0) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '0' ELSE '1';
932 MEM_OUT_SM_Write(0) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '0' ELSE '1';
931 MEM_OUT_SM_Write(1) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '1' ELSE '1';
933 MEM_OUT_SM_Write(1) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '1' ELSE '1';
932
934
933 MEM_OUT_SM_Data_in <= MEM_OUT_SM_Data_in_s & MEM_OUT_SM_Data_in_s;
935 MEM_OUT_SM_Data_in <= MEM_OUT_SM_Data_in_s & MEM_OUT_SM_Data_in_s;
934 -----------------------------------------------------------------------------
936 -----------------------------------------------------------------------------
935
937
936 --Mem_Out_SpectralMatrix : lppFIFOxN
938 --Mem_Out_SpectralMatrix : lppFIFOxN
937 -- GENERIC MAP (
939 -- GENERIC MAP (
938 -- tech => 0,
940 -- tech => 0,
939 -- Mem_use => Mem_use,
941 -- Mem_use => Mem_use,
940 -- Data_sz => 32,
942 -- Data_sz => 32,
941 -- Addr_sz => 8,
943 -- Addr_sz => 8,
942 -- FifoCnt => 2)
944 -- FifoCnt => 2)
943 -- PORT MAP (
945 -- PORT MAP (
944 -- clk => clk,
946 -- clk => clk,
945 -- rstn => rstn,
947 -- rstn => rstn,
946
948
947 -- ReUse => (OTHERS => '0'),
949 -- ReUse => (OTHERS => '0'),
948 -- run => (OTHERS => '1'),
950 -- run => (OTHERS => '1'),
949
951
950 -- wen => MEM_OUT_SM_Write,
952 -- wen => MEM_OUT_SM_Write,
951 -- wdata => MEM_OUT_SM_Data_in,
953 -- wdata => MEM_OUT_SM_Data_in,
952
954
953 -- ren => MEM_OUT_SM_Read,
955 -- ren => MEM_OUT_SM_Read,
954 -- rdata => MEM_OUT_SM_Data_out,
956 -- rdata => MEM_OUT_SM_Data_out,
955
957
956 -- full => MEM_OUT_SM_Full,
958 -- full => MEM_OUT_SM_Full,
957 -- empty => MEM_OUT_SM_Empty,
959 -- empty => MEM_OUT_SM_Empty,
958 -- almost_full => OPEN);
960 -- almost_full => OPEN);
959
961
960
962
961 all_Mem_Out_SpectralMatrix: FOR I IN 1 DOWNTO 0 GENERATE
963 all_Mem_Out_SpectralMatrix: FOR I IN 1 DOWNTO 0 GENERATE
962 Mem_Out_SpectralMatrix_I: lpp_fifo
964 Mem_Out_SpectralMatrix_I: lpp_fifo
963 GENERIC MAP (
965 GENERIC MAP (
964 tech => 0,
966 tech => 0,
965 Mem_use => Mem_use,
967 Mem_use => Mem_use,
966 EMPTY_THRESHOLD_LIMIT => 15,
968 EMPTY_THRESHOLD_LIMIT => 15,
967 FULL_THRESHOLD_LIMIT => 1,
969 FULL_THRESHOLD_LIMIT => 1,
968 DataSz => 32,
970 DataSz => 32,
969 AddrSz => 8)
971 AddrSz => 8)
970 PORT MAP (
972 PORT MAP (
971 clk => clk,
973 clk => clk,
972 rstn => rstn,
974 rstn => rstn,
973 reUse => '0',
975 reUse => '0',
974 run => run,
976 run => run,
975
977
976 ren => MEM_OUT_SM_Read(I),
978 ren => MEM_OUT_SM_Read(I),
977 rdata => MEM_OUT_SM_Data_out(32*(I+1)-1 DOWNTO 32*i),
979 rdata => MEM_OUT_SM_Data_out(32*(I+1)-1 DOWNTO 32*i),
978
980
979 wen => MEM_OUT_SM_Write(I),
981 wen => MEM_OUT_SM_Write(I),
980 wdata => MEM_OUT_SM_Data_in(32*(I+1)-1 DOWNTO 32*i),
982 wdata => MEM_OUT_SM_Data_in(32*(I+1)-1 DOWNTO 32*i),
981
983
982 empty => MEM_OUT_SM_Empty(I),
984 empty => MEM_OUT_SM_Empty(I),
983 full => MEM_OUT_SM_Full(I),
985 full => MEM_OUT_SM_Full(I),
984 full_almost => OPEN,
986 full_almost => OPEN,
985 empty_threshold => MEM_OUT_SM_Empty_Threshold(I),
987 empty_threshold => MEM_OUT_SM_Empty_Threshold(I),
986
988
987 full_threshold => OPEN);
989 full_threshold => OPEN);
988
990
989 END GENERATE all_Mem_Out_SpectralMatrix;
991 END GENERATE all_Mem_Out_SpectralMatrix;
990
992
991 -----------------------------------------------------------------------------
993 -----------------------------------------------------------------------------
992 -- MEM_OUT_SM_Read <= "00";
994 -- MEM_OUT_SM_Read <= "00";
993 PROCESS (clk, rstn)
995 PROCESS (clk, rstn)
994 BEGIN
996 BEGIN
995 IF rstn = '0' THEN
997 IF rstn = '0' THEN
996 fifo_0_ready <= '0';
998 fifo_0_ready <= '0';
997 fifo_1_ready <= '0';
999 fifo_1_ready <= '0';
998 fifo_ongoing <= '0';
1000 fifo_ongoing <= '0';
999 ELSIF clk'EVENT AND clk = '1' THEN
1001 ELSIF clk'EVENT AND clk = '1' THEN
1000 IF fifo_0_ready = '1' AND MEM_OUT_SM_Empty(0) = '1' THEN
1002 IF fifo_0_ready = '1' AND MEM_OUT_SM_Empty(0) = '1' THEN
1001 fifo_ongoing <= '1';
1003 fifo_ongoing <= '1';
1002 fifo_0_ready <= '0';
1004 fifo_0_ready <= '0';
1003 ELSIF status_component_fifo_0_end = '1' THEN
1005 ELSIF status_component_fifo_0_end = '1' THEN
1004 fifo_0_ready <= '1';
1006 fifo_0_ready <= '1';
1005 END IF;
1007 END IF;
1006
1008
1007 IF fifo_1_ready = '1' AND MEM_OUT_SM_Empty(1) = '1' THEN
1009 IF fifo_1_ready = '1' AND MEM_OUT_SM_Empty(1) = '1' THEN
1008 fifo_ongoing <= '0';
1010 fifo_ongoing <= '0';
1009 fifo_1_ready <= '0';
1011 fifo_1_ready <= '0';
1010 ELSIF status_component_fifo_1_end = '1' THEN
1012 ELSIF status_component_fifo_1_end = '1' THEN
1011 fifo_1_ready <= '1';
1013 fifo_1_ready <= '1';
1012 END IF;
1014 END IF;
1013
1015
1014 END IF;
1016 END IF;
1015 END PROCESS;
1017 END PROCESS;
1016
1018
1017 MEM_OUT_SM_Read(0) <= '1' WHEN fifo_ongoing = '1' ELSE
1019 MEM_OUT_SM_Read(0) <= '1' WHEN fifo_ongoing = '1' ELSE
1018 '1' WHEN fifo_0_ready = '0' ELSE
1020 '1' WHEN fifo_0_ready = '0' ELSE
1019 FSM_DMA_fifo_ren;
1021 FSM_DMA_fifo_ren;
1020
1022
1021 MEM_OUT_SM_Read(1) <= '1' WHEN fifo_ongoing = '0' ELSE
1023 MEM_OUT_SM_Read(1) <= '1' WHEN fifo_ongoing = '0' ELSE
1022 '1' WHEN fifo_1_ready = '0' ELSE
1024 '1' WHEN fifo_1_ready = '0' ELSE
1023 FSM_DMA_fifo_ren;
1025 FSM_DMA_fifo_ren;
1024
1026
1025 FSM_DMA_fifo_empty <= MEM_OUT_SM_Empty(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
1027 FSM_DMA_fifo_empty <= MEM_OUT_SM_Empty(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
1026 MEM_OUT_SM_Empty(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
1028 MEM_OUT_SM_Empty(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
1027 '1';
1029 '1';
1028
1030
1029 FSM_DMA_fifo_status <= status_component_fifo_0 WHEN fifo_ongoing = '0' ELSE
1031 FSM_DMA_fifo_status <= status_component_fifo_0 WHEN fifo_ongoing = '0' ELSE
1030 status_component_fifo_1;
1032 status_component_fifo_1;
1031
1033
1032 FSM_DMA_fifo_data <= MEM_OUT_SM_Data_out(31 DOWNTO 0) WHEN fifo_ongoing = '0' ELSE
1034 FSM_DMA_fifo_data <= MEM_OUT_SM_Data_out(31 DOWNTO 0) WHEN fifo_ongoing = '0' ELSE
1033 MEM_OUT_SM_Data_out(63 DOWNTO 32);
1035 MEM_OUT_SM_Data_out(63 DOWNTO 32);
1034
1036
1035
1037
1036 FSM_DMA_fifo_empty_threshold <= MEM_OUT_SM_Empty_Threshold(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
1038 FSM_DMA_fifo_empty_threshold <= MEM_OUT_SM_Empty_Threshold(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
1037 MEM_OUT_SM_Empty_Threshold(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
1039 MEM_OUT_SM_Empty_Threshold(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
1038 '1';
1040 '1';
1039
1041
1040 -----------------------------------------------------------------------------
1042 -----------------------------------------------------------------------------
1041 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4), --IN
1043 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4), --IN
1042 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0), --IN
1044 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0), --IN
1043 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6), --IN
1045 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6), --IN
1044 -- fifo_data => FSM_DMA_fifo_data, --IN
1046 -- fifo_data => FSM_DMA_fifo_data, --IN
1045 -- fifo_empty => FSM_DMA_fifo_empty, --IN
1047 -- fifo_empty => FSM_DMA_fifo_empty, --IN
1046 -- fifo_empty_threshold => FSM_DMA_fifo_empty_threshold, --IN
1048 -- fifo_empty_threshold => FSM_DMA_fifo_empty_threshold, --IN
1047 -- fifo_ren => FSM_DMA_fifo_ren, --OUT
1049 -- fifo_ren => FSM_DMA_fifo_ren, --OUT
1048
1050
1049
1051
1050 lpp_lfr_ms_fsmdma_1: lpp_lfr_ms_fsmdma
1052 lpp_lfr_ms_fsmdma_1: lpp_lfr_ms_fsmdma
1051 PORT MAP (
1053 PORT MAP (
1052 clk => clk,
1054 clk => clk,
1053 rstn => rstn,
1055 rstn => rstn,
1054 run => run,
1056 run => run,
1055
1057
1056 fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1058 fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1057 fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1059 fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1058 fifo_data => FSM_DMA_fifo_data,
1060 fifo_data => FSM_DMA_fifo_data,
1059 fifo_empty => FSM_DMA_fifo_empty,
1061 fifo_empty => FSM_DMA_fifo_empty,
1060 fifo_empty_threshold => FSM_DMA_fifo_empty_threshold,
1062 fifo_empty_threshold => FSM_DMA_fifo_empty_threshold,
1061 fifo_ren => FSM_DMA_fifo_ren,
1063 fifo_ren => FSM_DMA_fifo_ren,
1062
1064
1063 dma_fifo_valid_burst => dma_fifo_burst_valid,
1065 dma_fifo_valid_burst => dma_fifo_burst_valid,
1064 dma_fifo_data => dma_fifo_data,
1066 dma_fifo_data => dma_fifo_data,
1065 dma_fifo_ren => dma_fifo_ren,
1067 dma_fifo_ren => dma_fifo_ren,
1066 dma_buffer_new => dma_buffer_new,
1068 dma_buffer_new => dma_buffer_new,
1067 dma_buffer_addr => dma_buffer_addr,
1069 dma_buffer_addr => dma_buffer_addr,
1068 dma_buffer_length => dma_buffer_length,
1070 dma_buffer_length => dma_buffer_length,
1069 dma_buffer_full => dma_buffer_full,
1071 dma_buffer_full => dma_buffer_full,
1070 dma_buffer_full_err => dma_buffer_full_err,
1072 dma_buffer_full_err => dma_buffer_full_err,
1071
1073
1072 status_ready_matrix_f0 => status_ready_matrix_f0,
1074 status_ready_matrix_f0 => status_ready_matrix_f0,
1073 status_ready_matrix_f1 => status_ready_matrix_f1,
1075 status_ready_matrix_f1 => status_ready_matrix_f1,
1074 status_ready_matrix_f2 => status_ready_matrix_f2,
1076 status_ready_matrix_f2 => status_ready_matrix_f2,
1075 addr_matrix_f0 => addr_matrix_f0,
1077 addr_matrix_f0 => addr_matrix_f0,
1076 addr_matrix_f1 => addr_matrix_f1,
1078 addr_matrix_f1 => addr_matrix_f1,
1077 addr_matrix_f2 => addr_matrix_f2,
1079 addr_matrix_f2 => addr_matrix_f2,
1078 length_matrix_f0 => length_matrix_f0,
1080 length_matrix_f0 => length_matrix_f0,
1079 length_matrix_f1 => length_matrix_f1,
1081 length_matrix_f1 => length_matrix_f1,
1080 length_matrix_f2 => length_matrix_f2,
1082 length_matrix_f2 => length_matrix_f2,
1081 ready_matrix_f0 => ready_matrix_f0,
1083 ready_matrix_f0 => ready_matrix_f0,
1082 ready_matrix_f1 => ready_matrix_f1,
1084 ready_matrix_f1 => ready_matrix_f1,
1083 ready_matrix_f2 => ready_matrix_f2,
1085 ready_matrix_f2 => ready_matrix_f2,
1084 matrix_time_f0 => matrix_time_f0,
1086 matrix_time_f0 => matrix_time_f0,
1085 matrix_time_f1 => matrix_time_f1,
1087 matrix_time_f1 => matrix_time_f1,
1086 matrix_time_f2 => matrix_time_f2,
1088 matrix_time_f2 => matrix_time_f2,
1087 error_buffer_full => error_buffer_full);
1089 error_buffer_full => error_buffer_full);
1088
1090
1089
1091
1090
1092
1091
1093
1092
1094
1093 --dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
1095 --dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
1094 --dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1096 --dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1095 --dma_fifo_ren : IN STD_LOGIC; --TODO
1097 --dma_fifo_ren : IN STD_LOGIC; --TODO
1096 --dma_buffer_new : OUT STD_LOGIC; --TODO
1098 --dma_buffer_new : OUT STD_LOGIC; --TODO
1097 --dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1099 --dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1098 --dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
1100 --dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
1099 --dma_buffer_full : IN STD_LOGIC; --TODO
1101 --dma_buffer_full : IN STD_LOGIC; --TODO
1100 --dma_buffer_full_err : IN STD_LOGIC; --TODO
1102 --dma_buffer_full_err : IN STD_LOGIC; --TODO
1101
1103
1102 ---- Reg out
1104 ---- Reg out
1103 --ready_matrix_f0 : OUT STD_LOGIC; -- TODO
1105 --ready_matrix_f0 : OUT STD_LOGIC; -- TODO
1104 --ready_matrix_f1 : OUT STD_LOGIC; -- TODO
1106 --ready_matrix_f1 : OUT STD_LOGIC; -- TODO
1105 --ready_matrix_f2 : OUT STD_LOGIC; -- TODO
1107 --ready_matrix_f2 : OUT STD_LOGIC; -- TODO
1106 --error_bad_component_error : OUT STD_LOGIC; -- TODO
1108 --error_bad_component_error : OUT STD_LOGIC; -- TODO
1107 --error_buffer_full : OUT STD_LOGIC; -- TODO
1109 --error_buffer_full : OUT STD_LOGIC; -- TODO
1108
1110
1109 ---- Reg In
1111 ---- Reg In
1110 --status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
1112 --status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
1111 --status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
1113 --status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
1112 --status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
1114 --status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
1113
1115
1114 --addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1116 --addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1115 --addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1117 --addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1116 --addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1118 --addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1117
1119
1118 --matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1120 --matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1119 --matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1121 --matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1120 --matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0) -- TODO
1122 --matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0) -- TODO
1121 -----------------------------------------------------------------------------
1123 -----------------------------------------------------------------------------
1122
1124
1123 -----------------------------------------------------------------------------
1125 -----------------------------------------------------------------------------
1124 --lpp_lfr_ms_fsmdma_1 : lpp_lfr_ms_fsmdma
1126 --lpp_lfr_ms_fsmdma_1 : lpp_lfr_ms_fsmdma
1125 -- PORT MAP (
1127 -- PORT MAP (
1126 -- HCLK => clk,
1128 -- HCLK => clk,
1127 -- HRESETn => rstn,
1129 -- HRESETn => rstn,
1128
1130
1129 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1131 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1130 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0),
1132 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0),
1131 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1133 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1132 -- fifo_data => FSM_DMA_fifo_data,
1134 -- fifo_data => FSM_DMA_fifo_data,
1133 -- fifo_empty => FSM_DMA_fifo_empty,
1135 -- fifo_empty => FSM_DMA_fifo_empty,
1134 -- fifo_ren => FSM_DMA_fifo_ren,
1136 -- fifo_ren => FSM_DMA_fifo_ren,
1135
1137
1136 -- dma_addr => dma_addr,
1138 -- dma_addr => dma_addr,
1137 -- dma_data => dma_data,
1139 -- dma_data => dma_data,
1138 -- dma_valid => dma_valid,
1140 -- dma_valid => dma_valid,
1139 -- dma_valid_burst => dma_valid_burst,
1141 -- dma_valid_burst => dma_valid_burst,
1140 -- dma_ren => dma_ren,
1142 -- dma_ren => dma_ren,
1141 -- dma_done => dma_done,
1143 -- dma_done => dma_done,
1142
1144
1143 -- ready_matrix_f0 => ready_matrix_f0,
1145 -- ready_matrix_f0 => ready_matrix_f0,
1144 -- ready_matrix_f1 => ready_matrix_f1,
1146 -- ready_matrix_f1 => ready_matrix_f1,
1145 -- ready_matrix_f2 => ready_matrix_f2,
1147 -- ready_matrix_f2 => ready_matrix_f2,
1146
1148
1147 -- error_bad_component_error => error_bad_component_error,
1149 -- error_bad_component_error => error_bad_component_error,
1148 -- error_buffer_full => error_buffer_full,
1150 -- error_buffer_full => error_buffer_full,
1149
1151
1150 -- debug_reg => debug_reg,
1152 -- debug_reg => debug_reg,
1151 -- status_ready_matrix_f0 => status_ready_matrix_f0,
1153 -- status_ready_matrix_f0 => status_ready_matrix_f0,
1152 -- status_ready_matrix_f1 => status_ready_matrix_f1,
1154 -- status_ready_matrix_f1 => status_ready_matrix_f1,
1153 -- status_ready_matrix_f2 => status_ready_matrix_f2,
1155 -- status_ready_matrix_f2 => status_ready_matrix_f2,
1154
1156
1155 -- config_active_interruption_onNewMatrix => config_active_interruption_onNewMatrix,
1157 -- config_active_interruption_onNewMatrix => config_active_interruption_onNewMatrix,
1156 -- config_active_interruption_onError => config_active_interruption_onError,
1158 -- config_active_interruption_onError => config_active_interruption_onError,
1157
1159
1158 -- addr_matrix_f0 => addr_matrix_f0,
1160 -- addr_matrix_f0 => addr_matrix_f0,
1159 -- addr_matrix_f1 => addr_matrix_f1,
1161 -- addr_matrix_f1 => addr_matrix_f1,
1160 -- addr_matrix_f2 => addr_matrix_f2,
1162 -- addr_matrix_f2 => addr_matrix_f2,
1161
1163
1162 -- matrix_time_f0 => matrix_time_f0,
1164 -- matrix_time_f0 => matrix_time_f0,
1163 -- matrix_time_f1 => matrix_time_f1,
1165 -- matrix_time_f1 => matrix_time_f1,
1164 -- matrix_time_f2 => matrix_time_f2
1166 -- matrix_time_f2 => matrix_time_f2
1165 -- );
1167 -- );
1166 -----------------------------------------------------------------------------
1168 -----------------------------------------------------------------------------
1167
1169
1168
1170
1169
1171
1170
1172
1171
1173
1172
1174
1173 -----------------------------------------------------------------------------
1175 -----------------------------------------------------------------------------
1174 -- TIME MANAGMENT
1176 -- TIME MANAGMENT
1175 -----------------------------------------------------------------------------
1177 -----------------------------------------------------------------------------
1176 all_time <= coarse_time & fine_time;
1178 all_time <= sample_f2_time & sample_f1_time & sample_f0_time & sample_f0_time;
1179 --all_time <= coarse_time & fine_time;
1177 --
1180 --
1178 f_empty(0) <= '1' WHEN sample_f0_A_empty = "11111" ELSE '0';
1181 f_empty(0) <= '1' WHEN sample_f0_A_empty = "11111" ELSE '0';
1179 f_empty(1) <= '1' WHEN sample_f0_B_empty = "11111" ELSE '0';
1182 f_empty(1) <= '1' WHEN sample_f0_B_empty = "11111" ELSE '0';
1180 f_empty(2) <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
1183 f_empty(2) <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
1181 f_empty(3) <= '1' WHEN sample_f2_empty = "11111" ELSE '0';
1184 f_empty(3) <= '1' WHEN sample_f2_empty = "11111" ELSE '0';
1182
1185
1183 all_time_reg: FOR I IN 0 TO 3 GENERATE
1186 all_time_reg: FOR I IN 0 TO 3 GENERATE
1184
1187
1185 PROCESS (clk, rstn)
1188 PROCESS (clk, rstn)
1186 BEGIN
1189 BEGIN
1187 IF rstn = '0' THEN
1190 IF rstn = '0' THEN
1188 f_empty_reg(I) <= '1';
1191 f_empty_reg(I) <= '1';
1189 ELSIF clk'event AND clk = '1' THEN
1192 ELSIF clk'event AND clk = '1' THEN
1190 f_empty_reg(I) <= f_empty(I);
1193 f_empty_reg(I) <= f_empty(I);
1191 END IF;
1194 END IF;
1192 END PROCESS;
1195 END PROCESS;
1193
1196
1194 time_update_f(I) <= '1' WHEN f_empty(I) = '0' AND f_empty_reg(I) = '1' ELSE '0';
1197 time_update_f(I) <= '1' WHEN f_empty(I) = '0' AND f_empty_reg(I) = '1' ELSE '0';
1195
1198
1196 s_m_t_m_f0_A : spectral_matrix_time_managment
1199 s_m_t_m_f0_A : spectral_matrix_time_managment
1197 PORT MAP (
1200 PORT MAP (
1198 clk => clk,
1201 clk => clk,
1199 rstn => rstn,
1202 rstn => rstn,
1200 time_in => all_time,
1203 time_in => all_time((I+1)*48-1 DOWNTO I*48),
1201 update_1 => time_update_f(I),
1204 update_1 => time_update_f(I),
1202 time_out => time_reg_f((I+1)*48-1 DOWNTO I*48)
1205 time_out => time_reg_f((I+1)*48-1 DOWNTO I*48)
1203 );
1206 );
1204
1207
1205 END GENERATE all_time_reg;
1208 END GENERATE all_time_reg;
1206
1209
1207 time_reg_f0_A <= time_reg_f((0+1)*48-1 DOWNTO 0*48);
1210 time_reg_f0_A <= time_reg_f((0+1)*48-1 DOWNTO 0*48);
1208 time_reg_f0_B <= time_reg_f((1+1)*48-1 DOWNTO 1*48);
1211 time_reg_f0_B <= time_reg_f((1+1)*48-1 DOWNTO 1*48);
1209 time_reg_f1 <= time_reg_f((2+1)*48-1 DOWNTO 2*48);
1212 time_reg_f1 <= time_reg_f((2+1)*48-1 DOWNTO 2*48);
1210 time_reg_f2 <= time_reg_f((3+1)*48-1 DOWNTO 3*48);
1213 time_reg_f2 <= time_reg_f((3+1)*48-1 DOWNTO 3*48);
1211
1214
1212 -----------------------------------------------------------------------------
1215 -----------------------------------------------------------------------------
1213
1216
1214 END Behavioral;
1217 END Behavioral;
This diff has been collapsed as it changes many lines, (798 lines changed) Show them Hide them
@@ -1,395 +1,403
1 LIBRARY ieee;
1 LIBRARY ieee;
2 USE ieee.std_logic_1164.ALL;
2 USE ieee.std_logic_1164.ALL;
3
3
4 LIBRARY grlib;
4 LIBRARY grlib;
5 USE grlib.amba.ALL;
5 USE grlib.amba.ALL;
6
6
7 LIBRARY lpp;
7 LIBRARY lpp;
8 USE lpp.lpp_ad_conv.ALL;
8 USE lpp.lpp_ad_conv.ALL;
9 USE lpp.iir_filter.ALL;
9 USE lpp.iir_filter.ALL;
10 USE lpp.FILTERcfg.ALL;
10 USE lpp.FILTERcfg.ALL;
11 USE lpp.lpp_memory.ALL;
11 USE lpp.lpp_memory.ALL;
12 LIBRARY techmap;
12 LIBRARY techmap;
13 USE techmap.gencomp.ALL;
13 USE techmap.gencomp.ALL;
14
14
15 PACKAGE lpp_lfr_pkg IS
15 PACKAGE lpp_lfr_pkg IS
16 -----------------------------------------------------------------------------
16 -----------------------------------------------------------------------------
17 -- TEMP
17 -- TEMP
18 -----------------------------------------------------------------------------
18 -----------------------------------------------------------------------------
19 COMPONENT lpp_lfr_ms_test
19 COMPONENT lpp_lfr_ms_test
20 GENERIC (
20 GENERIC (
21 Mem_use : INTEGER);
21 Mem_use : INTEGER);
22 PORT (
22 PORT (
23 clk : IN STD_LOGIC;
23 clk : IN STD_LOGIC;
24 rstn : IN STD_LOGIC;
24 rstn : IN STD_LOGIC;
25
25
26 -- TIME
26 -- TIME
27 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- todo
27 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- todo
28 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
28 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
29 --
29 --
30 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
30 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
31 sample_f0_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
31 sample_f0_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
32 --
32 --
33 sample_f1_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
33 sample_f1_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
34 sample_f1_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
34 sample_f1_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
35 --
35 --
36 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
36 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
37 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
37 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
38
38
39
39
40
40
41 ---------------------------------------------------------------------------
41 ---------------------------------------------------------------------------
42 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
42 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
43
43
44 --
44 --
45 --sample_ren : OUT STD_LOGIC_VECTOR(4 DOWNTO 0);
45 --sample_ren : OUT STD_LOGIC_VECTOR(4 DOWNTO 0);
46 --sample_full : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
46 --sample_full : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
47 --sample_empty : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
47 --sample_empty : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
48 --sample_rdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
48 --sample_rdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
49
49
50 --status_channel : IN STD_LOGIC_VECTOR(49 DOWNTO 0);
50 --status_channel : IN STD_LOGIC_VECTOR(49 DOWNTO 0);
51
51
52 -- IN
52 -- IN
53 MEM_IN_SM_locked : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
53 MEM_IN_SM_locked : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
54
54
55 -----------------------------------------------------------------------------
55 -----------------------------------------------------------------------------
56
56
57 status_component : OUT STD_LOGIC_VECTOR(53 DOWNTO 0);
57 status_component : OUT STD_LOGIC_VECTOR(53 DOWNTO 0);
58 SM_in_data : OUT STD_LOGIC_VECTOR(32*2-1 DOWNTO 0);
58 SM_in_data : OUT STD_LOGIC_VECTOR(32*2-1 DOWNTO 0);
59 SM_in_ren : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
59 SM_in_ren : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
60 SM_in_empty : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
60 SM_in_empty : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
61
61
62 SM_correlation_start : OUT STD_LOGIC;
62 SM_correlation_start : OUT STD_LOGIC;
63 SM_correlation_auto : OUT STD_LOGIC;
63 SM_correlation_auto : OUT STD_LOGIC;
64 SM_correlation_done : IN STD_LOGIC
64 SM_correlation_done : IN STD_LOGIC
65 );
65 );
66 END COMPONENT;
66 END COMPONENT;
67
67
68
68
69 -----------------------------------------------------------------------------
69 -----------------------------------------------------------------------------
70 COMPONENT lpp_lfr_ms
70 COMPONENT lpp_lfr_ms
71 GENERIC (
71 GENERIC (
72 Mem_use : INTEGER);
72 Mem_use : INTEGER);
73 PORT (
73 PORT (
74 clk : IN STD_LOGIC;
74 clk : IN STD_LOGIC;
75 rstn : IN STD_LOGIC;
75 rstn : IN STD_LOGIC;
76 run : IN STD_LOGIC;
76 run : IN STD_LOGIC;
77 start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
77 start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
78 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
78 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
79 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
79 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
80 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
80 sample_f0_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
81 sample_f0_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
81 sample_f0_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
82 sample_f1_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
82 sample_f1_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
83 sample_f1_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
83 sample_f1_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
84 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
84 sample_f1_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
85 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
85 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
86 dma_fifo_burst_valid : OUT STD_LOGIC;
86 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
87 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
87 sample_f2_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
88 dma_fifo_ren : IN STD_LOGIC;
88 dma_fifo_burst_valid : OUT STD_LOGIC;
89 dma_buffer_new : OUT STD_LOGIC;
89 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
90 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
90 dma_fifo_ren : IN STD_LOGIC;
91 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
91 dma_buffer_new : OUT STD_LOGIC;
92 dma_buffer_full : IN STD_LOGIC;
92 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
93 dma_buffer_full_err : IN STD_LOGIC;
93 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
94 ready_matrix_f0 : OUT STD_LOGIC;
94 dma_buffer_full : IN STD_LOGIC;
95 ready_matrix_f1 : OUT STD_LOGIC;
95 dma_buffer_full_err : IN STD_LOGIC;
96 ready_matrix_f2 : OUT STD_LOGIC;
96 ready_matrix_f0 : OUT STD_LOGIC;
97 error_buffer_full : OUT STD_LOGIC;
97 ready_matrix_f1 : OUT STD_LOGIC;
98 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
98 ready_matrix_f2 : OUT STD_LOGIC;
99 status_ready_matrix_f0 : IN STD_LOGIC;
99 error_buffer_full : OUT STD_LOGIC;
100 status_ready_matrix_f1 : IN STD_LOGIC;
100 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
101 status_ready_matrix_f2 : IN STD_LOGIC;
101 status_ready_matrix_f0 : IN STD_LOGIC;
102 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
102 status_ready_matrix_f1 : IN STD_LOGIC;
103 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
103 status_ready_matrix_f2 : IN STD_LOGIC;
104 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
104 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
105 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
105 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
106 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
106 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
107 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
107 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
108 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
108 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
109 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
109 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
110 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
110 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
111 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0));
111 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
112 END COMPONENT;
112 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
113
113 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0));
114 COMPONENT lpp_lfr_ms_fsmdma
114 END COMPONENT;
115 PORT (
115
116 clk : IN STD_ULOGIC;
116 COMPONENT lpp_lfr_ms_fsmdma
117 rstn : IN STD_ULOGIC;
117 PORT (
118 run : IN STD_LOGIC;
118 clk : IN STD_ULOGIC;
119 fifo_matrix_type : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
119 rstn : IN STD_ULOGIC;
120 fifo_matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
120 run : IN STD_LOGIC;
121 fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
121 fifo_matrix_type : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
122 fifo_empty : IN STD_LOGIC;
122 fifo_matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
123 fifo_empty_threshold : IN STD_LOGIC;
123 fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
124 fifo_ren : OUT STD_LOGIC;
124 fifo_empty : IN STD_LOGIC;
125 dma_fifo_valid_burst : OUT STD_LOGIC;
125 fifo_empty_threshold : IN STD_LOGIC;
126 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
126 fifo_ren : OUT STD_LOGIC;
127 dma_fifo_ren : IN STD_LOGIC;
127 dma_fifo_valid_burst : OUT STD_LOGIC;
128 dma_buffer_new : OUT STD_LOGIC;
128 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
129 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
129 dma_fifo_ren : IN STD_LOGIC;
130 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
130 dma_buffer_new : OUT STD_LOGIC;
131 dma_buffer_full : IN STD_LOGIC;
131 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
132 dma_buffer_full_err : IN STD_LOGIC;
132 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
133 status_ready_matrix_f0 : IN STD_LOGIC;
133 dma_buffer_full : IN STD_LOGIC;
134 status_ready_matrix_f1 : IN STD_LOGIC;
134 dma_buffer_full_err : IN STD_LOGIC;
135 status_ready_matrix_f2 : IN STD_LOGIC;
135 status_ready_matrix_f0 : IN STD_LOGIC;
136 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
136 status_ready_matrix_f1 : IN STD_LOGIC;
137 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
137 status_ready_matrix_f2 : IN STD_LOGIC;
138 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
138 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
139 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
139 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
140 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
140 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
141 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
141 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
142 ready_matrix_f0 : OUT STD_LOGIC;
142 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
143 ready_matrix_f1 : OUT STD_LOGIC;
143 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
144 ready_matrix_f2 : OUT STD_LOGIC;
144 ready_matrix_f0 : OUT STD_LOGIC;
145 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
145 ready_matrix_f1 : OUT STD_LOGIC;
146 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
146 ready_matrix_f2 : OUT STD_LOGIC;
147 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
147 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
148 error_buffer_full : OUT STD_LOGIC);
148 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
149 END COMPONENT;
149 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
150
150 error_buffer_full : OUT STD_LOGIC);
151 COMPONENT lpp_lfr_ms_FFT
151 END COMPONENT;
152 PORT (
152
153 clk : IN STD_LOGIC;
153 COMPONENT lpp_lfr_ms_FFT
154 rstn : IN STD_LOGIC;
154 PORT (
155 sample_valid : IN STD_LOGIC;
155 clk : IN STD_LOGIC;
156 fft_read : IN STD_LOGIC;
156 rstn : IN STD_LOGIC;
157 sample_data : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
157 sample_valid : IN STD_LOGIC;
158 sample_load : OUT STD_LOGIC;
158 fft_read : IN STD_LOGIC;
159 fft_pong : OUT STD_LOGIC;
159 sample_data : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
160 fft_data_im : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
160 sample_load : OUT STD_LOGIC;
161 fft_data_re : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
161 fft_pong : OUT STD_LOGIC;
162 fft_data_valid : OUT STD_LOGIC;
162 fft_data_im : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
163 fft_ready : OUT STD_LOGIC);
163 fft_data_re : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
164 END COMPONENT;
164 fft_data_valid : OUT STD_LOGIC;
165
165 fft_ready : OUT STD_LOGIC);
166 COMPONENT lpp_lfr_filter
166 END COMPONENT;
167 GENERIC (
167
168 Mem_use : INTEGER);
168 COMPONENT lpp_lfr_filter
169 PORT (
169 GENERIC (
170 sample : IN Samples(7 DOWNTO 0);
170 Mem_use : INTEGER);
171 sample_val : IN STD_LOGIC;
171 PORT (
172 clk : IN STD_LOGIC;
172 sample : IN Samples(7 DOWNTO 0);
173 rstn : IN STD_LOGIC;
173 sample_val : IN STD_LOGIC;
174 data_shaping_SP0 : IN STD_LOGIC;
174 sample_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
175 data_shaping_SP1 : IN STD_LOGIC;
175 clk : IN STD_LOGIC;
176 data_shaping_R0 : IN STD_LOGIC;
176 rstn : IN STD_LOGIC;
177 data_shaping_R1 : IN STD_LOGIC;
177 data_shaping_SP0 : IN STD_LOGIC;
178 data_shaping_R2 : IN STD_LOGIC;
178 data_shaping_SP1 : IN STD_LOGIC;
179 sample_f0_val : OUT STD_LOGIC;
179 data_shaping_R0 : IN STD_LOGIC;
180 sample_f1_val : OUT STD_LOGIC;
180 data_shaping_R1 : IN STD_LOGIC;
181 sample_f2_val : OUT STD_LOGIC;
181 data_shaping_R2 : IN STD_LOGIC;
182 sample_f3_val : OUT STD_LOGIC;
182 sample_f0_val : OUT STD_LOGIC;
183 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
183 sample_f1_val : OUT STD_LOGIC;
184 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
184 sample_f2_val : OUT STD_LOGIC;
185 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
185 sample_f3_val : OUT STD_LOGIC;
186 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0));
186 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
187 END COMPONENT;
187 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
188
188 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
189 COMPONENT lpp_lfr
189 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
190 GENERIC (
190 sample_f0_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
191 Mem_use : INTEGER;
191 sample_f1_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
192 nb_data_by_buffer_size : INTEGER;
192 sample_f2_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
193 -- nb_word_by_buffer_size : INTEGER;
193 sample_f3_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0)
194 nb_snapshot_param_size : INTEGER;
194 );
195 delta_vector_size : INTEGER;
195 END COMPONENT;
196 delta_vector_size_f0_2 : INTEGER;
196
197 pindex : INTEGER;
197 COMPONENT lpp_lfr
198 paddr : INTEGER;
198 GENERIC (
199 pmask : INTEGER;
199 Mem_use : INTEGER;
200 pirq_ms : INTEGER;
200 nb_data_by_buffer_size : INTEGER;
201 pirq_wfp : INTEGER;
201 -- nb_word_by_buffer_size : INTEGER;
202 hindex : INTEGER;
202 nb_snapshot_param_size : INTEGER;
203 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0)
203 delta_vector_size : INTEGER;
204 );
204 delta_vector_size_f0_2 : INTEGER;
205 PORT (
205 pindex : INTEGER;
206 clk : IN STD_LOGIC;
206 paddr : INTEGER;
207 rstn : IN STD_LOGIC;
207 pmask : INTEGER;
208 sample_B : IN Samples(2 DOWNTO 0);
208 pirq_ms : INTEGER;
209 sample_E : IN Samples(4 DOWNTO 0);
209 pirq_wfp : INTEGER;
210 sample_val : IN STD_LOGIC;
210 hindex : INTEGER;
211 apbi : IN apb_slv_in_type;
211 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0)
212 apbo : OUT apb_slv_out_type;
212 );
213 ahbi : IN AHB_Mst_In_Type;
213 PORT (
214 ahbo : OUT AHB_Mst_Out_Type;
214 clk : IN STD_LOGIC;
215 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
215 rstn : IN STD_LOGIC;
216 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
216 sample_B : IN Samples(2 DOWNTO 0);
217 data_shaping_BW : OUT STD_LOGIC ;
217 sample_E : IN Samples(4 DOWNTO 0);
218 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0);
218 sample_val : IN STD_LOGIC;
219 debug_vector_ms : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
219 apbi : IN apb_slv_in_type;
220 );
220 apbo : OUT apb_slv_out_type;
221 END COMPONENT;
221 ahbi : IN AHB_Mst_In_Type;
222
222 ahbo : OUT AHB_Mst_Out_Type;
223 -----------------------------------------------------------------------------
223 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
224 -- LPP_LFR with only WaveForm Picker (and without Spectral Matrix Sub System)
224 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
225 -----------------------------------------------------------------------------
225 data_shaping_BW : OUT STD_LOGIC;
226 COMPONENT lpp_lfr_WFP_nMS
226 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0);
227 GENERIC (
227 debug_vector_ms : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
228 Mem_use : INTEGER;
228 );
229 nb_data_by_buffer_size : INTEGER;
229 END COMPONENT;
230 nb_word_by_buffer_size : INTEGER;
230
231 nb_snapshot_param_size : INTEGER;
231 -----------------------------------------------------------------------------
232 delta_vector_size : INTEGER;
232 -- LPP_LFR with only WaveForm Picker (and without Spectral Matrix Sub System)
233 delta_vector_size_f0_2 : INTEGER;
233 -----------------------------------------------------------------------------
234 pindex : INTEGER;
234 COMPONENT lpp_lfr_WFP_nMS
235 paddr : INTEGER;
235 GENERIC (
236 pmask : INTEGER;
236 Mem_use : INTEGER;
237 pirq_ms : INTEGER;
237 nb_data_by_buffer_size : INTEGER;
238 pirq_wfp : INTEGER;
238 nb_word_by_buffer_size : INTEGER;
239 hindex : INTEGER;
239 nb_snapshot_param_size : INTEGER;
240 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
240 delta_vector_size : INTEGER;
241 PORT (
241 delta_vector_size_f0_2 : INTEGER;
242 clk : IN STD_LOGIC;
242 pindex : INTEGER;
243 rstn : IN STD_LOGIC;
243 paddr : INTEGER;
244 sample_B : IN Samples(2 DOWNTO 0);
244 pmask : INTEGER;
245 sample_E : IN Samples(4 DOWNTO 0);
245 pirq_ms : INTEGER;
246 sample_val : IN STD_LOGIC;
246 pirq_wfp : INTEGER;
247 apbi : IN apb_slv_in_type;
247 hindex : INTEGER;
248 apbo : OUT apb_slv_out_type;
248 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
249 ahbi : IN AHB_Mst_In_Type;
249 PORT (
250 ahbo : OUT AHB_Mst_Out_Type;
250 clk : IN STD_LOGIC;
251 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
251 rstn : IN STD_LOGIC;
252 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
252 sample_B : IN Samples(2 DOWNTO 0);
253 data_shaping_BW : OUT STD_LOGIC;
253 sample_E : IN Samples(4 DOWNTO 0);
254 observation_reg : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
254 sample_val : IN STD_LOGIC;
255 END COMPONENT;
255 apbi : IN apb_slv_in_type;
256 -----------------------------------------------------------------------------
256 apbo : OUT apb_slv_out_type;
257
257 ahbi : IN AHB_Mst_In_Type;
258 COMPONENT lpp_lfr_apbreg
258 ahbo : OUT AHB_Mst_Out_Type;
259 GENERIC (
259 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
260 nb_data_by_buffer_size : INTEGER;
260 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
261 nb_snapshot_param_size : INTEGER;
261 data_shaping_BW : OUT STD_LOGIC;
262 delta_vector_size : INTEGER;
262 observation_reg : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
263 delta_vector_size_f0_2 : INTEGER;
263 END COMPONENT;
264 pindex : INTEGER;
264 -----------------------------------------------------------------------------
265 paddr : INTEGER;
265
266 pmask : INTEGER;
266 COMPONENT lpp_lfr_apbreg
267 pirq_ms : INTEGER;
267 GENERIC (
268 pirq_wfp : INTEGER;
268 nb_data_by_buffer_size : INTEGER;
269 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
269 nb_snapshot_param_size : INTEGER;
270 PORT (
270 delta_vector_size : INTEGER;
271 HCLK : IN STD_ULOGIC;
271 delta_vector_size_f0_2 : INTEGER;
272 HRESETn : IN STD_ULOGIC;
272 pindex : INTEGER;
273 apbi : IN apb_slv_in_type;
273 paddr : INTEGER;
274 apbo : OUT apb_slv_out_type;
274 pmask : INTEGER;
275 run_ms : OUT STD_LOGIC;
275 pirq_ms : INTEGER;
276 ready_matrix_f0 : IN STD_LOGIC;
276 pirq_wfp : INTEGER;
277 ready_matrix_f1 : IN STD_LOGIC;
277 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
278 ready_matrix_f2 : IN STD_LOGIC;
278 PORT (
279 error_buffer_full : IN STD_LOGIC;
279 HCLK : IN STD_ULOGIC;
280 error_input_fifo_write : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
280 HRESETn : IN STD_ULOGIC;
281 status_ready_matrix_f0 : OUT STD_LOGIC;
281 apbi : IN apb_slv_in_type;
282 status_ready_matrix_f1 : OUT STD_LOGIC;
282 apbo : OUT apb_slv_out_type;
283 status_ready_matrix_f2 : OUT STD_LOGIC;
283 run_ms : OUT STD_LOGIC;
284 addr_matrix_f0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
284 ready_matrix_f0 : IN STD_LOGIC;
285 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
285 ready_matrix_f1 : IN STD_LOGIC;
286 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
286 ready_matrix_f2 : IN STD_LOGIC;
287 length_matrix_f0 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
287 error_buffer_full : IN STD_LOGIC;
288 length_matrix_f1 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
288 error_input_fifo_write : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
289 length_matrix_f2 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
289 status_ready_matrix_f0 : OUT STD_LOGIC;
290 matrix_time_f0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
290 status_ready_matrix_f1 : OUT STD_LOGIC;
291 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
291 status_ready_matrix_f2 : OUT STD_LOGIC;
292 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
292 addr_matrix_f0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
293 status_new_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
293 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
294 data_shaping_BW : OUT STD_LOGIC;
294 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
295 data_shaping_SP0 : OUT STD_LOGIC;
295 length_matrix_f0 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
296 data_shaping_SP1 : OUT STD_LOGIC;
296 length_matrix_f1 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
297 data_shaping_R0 : OUT STD_LOGIC;
297 length_matrix_f2 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
298 data_shaping_R1 : OUT STD_LOGIC;
298 matrix_time_f0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
299 data_shaping_R2 : OUT STD_LOGIC;
299 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
300 delta_snapshot : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
300 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
301 delta_f0 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
301 status_new_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
302 delta_f0_2 : OUT STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
302 data_shaping_BW : OUT STD_LOGIC;
303 delta_f1 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
303 data_shaping_SP0 : OUT STD_LOGIC;
304 delta_f2 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
304 data_shaping_SP1 : OUT STD_LOGIC;
305 nb_data_by_buffer : OUT STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
305 data_shaping_R0 : OUT STD_LOGIC;
306 nb_snapshot_param : OUT STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
306 data_shaping_R1 : OUT STD_LOGIC;
307 enable_f0 : OUT STD_LOGIC;
307 data_shaping_R2 : OUT STD_LOGIC;
308 enable_f1 : OUT STD_LOGIC;
308 delta_snapshot : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
309 enable_f2 : OUT STD_LOGIC;
309 delta_f0 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
310 enable_f3 : OUT STD_LOGIC;
310 delta_f0_2 : OUT STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
311 burst_f0 : OUT STD_LOGIC;
311 delta_f1 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
312 burst_f1 : OUT STD_LOGIC;
312 delta_f2 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
313 burst_f2 : OUT STD_LOGIC;
313 nb_data_by_buffer : OUT STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
314 run : OUT STD_LOGIC;
314 nb_snapshot_param : OUT STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
315 start_date : OUT STD_LOGIC_VECTOR(30 DOWNTO 0);
315 enable_f0 : OUT STD_LOGIC;
316 wfp_status_buffer_ready : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
316 enable_f1 : OUT STD_LOGIC;
317 wfp_addr_buffer : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
317 enable_f2 : OUT STD_LOGIC;
318 wfp_length_buffer : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
318 enable_f3 : OUT STD_LOGIC;
319 wfp_ready_buffer : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
319 burst_f0 : OUT STD_LOGIC;
320 wfp_buffer_time : IN STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
320 burst_f1 : OUT STD_LOGIC;
321 wfp_error_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
321 burst_f2 : OUT STD_LOGIC;
322 sample_f3_v : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
322 run : OUT STD_LOGIC;
323 sample_f3_e1 : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
323 start_date : OUT STD_LOGIC_VECTOR(30 DOWNTO 0);
324 sample_f3_e2 : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
324 wfp_status_buffer_ready : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
325 sample_f3_valid : IN STD_LOGIC;
325 wfp_addr_buffer : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
326 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0));
326 wfp_length_buffer : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
327 END COMPONENT;
327 wfp_ready_buffer : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
328
328 wfp_buffer_time : IN STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
329 COMPONENT lpp_top_ms
329 wfp_error_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
330 GENERIC (
330 sample_f3_v : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
331 Mem_use : INTEGER;
331 sample_f3_e1 : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
332 nb_burst_available_size : INTEGER;
332 sample_f3_e2 : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
333 nb_snapshot_param_size : INTEGER;
333 sample_f3_valid : IN STD_LOGIC;
334 delta_snapshot_size : INTEGER;
334 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0));
335 delta_f2_f0_size : INTEGER;
335 END COMPONENT;
336 delta_f2_f1_size : INTEGER;
336
337 pindex : INTEGER;
337 COMPONENT lpp_top_ms
338 paddr : INTEGER;
338 GENERIC (
339 pmask : INTEGER;
339 Mem_use : INTEGER;
340 pirq_ms : INTEGER;
340 nb_burst_available_size : INTEGER;
341 pirq_wfp : INTEGER;
341 nb_snapshot_param_size : INTEGER;
342 hindex_wfp : INTEGER;
342 delta_snapshot_size : INTEGER;
343 hindex_ms : INTEGER);
343 delta_f2_f0_size : INTEGER;
344 PORT (
344 delta_f2_f1_size : INTEGER;
345 clk : IN STD_LOGIC;
345 pindex : INTEGER;
346 rstn : IN STD_LOGIC;
346 paddr : INTEGER;
347 sample_B : IN Samples14v(2 DOWNTO 0);
347 pmask : INTEGER;
348 sample_E : IN Samples14v(4 DOWNTO 0);
348 pirq_ms : INTEGER;
349 sample_val : IN STD_LOGIC;
349 pirq_wfp : INTEGER;
350 apbi : IN apb_slv_in_type;
350 hindex_wfp : INTEGER;
351 apbo : OUT apb_slv_out_type;
351 hindex_ms : INTEGER);
352 ahbi_ms : IN AHB_Mst_In_Type;
352 PORT (
353 ahbo_ms : OUT AHB_Mst_Out_Type;
353 clk : IN STD_LOGIC;
354 data_shaping_BW : OUT STD_LOGIC;
354 rstn : IN STD_LOGIC;
355 matrix_time_f0_0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
355 sample_B : IN Samples14v(2 DOWNTO 0);
356 matrix_time_f0_1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
356 sample_E : IN Samples14v(4 DOWNTO 0);
357 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
357 sample_val : IN STD_LOGIC;
358 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0)
358 apbi : IN apb_slv_in_type;
359 );
359 apbo : OUT apb_slv_out_type;
360 END COMPONENT;
360 ahbi_ms : IN AHB_Mst_In_Type;
361
361 ahbo_ms : OUT AHB_Mst_Out_Type;
362 COMPONENT lpp_apbreg_ms_pointer
362 data_shaping_BW : OUT STD_LOGIC;
363 PORT (
363 matrix_time_f0_0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
364 clk : IN STD_LOGIC;
364 matrix_time_f0_1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
365 rstn : IN STD_LOGIC;
365 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
366 run : IN STD_LOGIC;
366 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0)
367 reg0_status_ready_matrix : IN STD_LOGIC;
367 );
368 reg0_ready_matrix : OUT STD_LOGIC;
368 END COMPONENT;
369 reg0_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
369
370 reg0_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
370 COMPONENT lpp_apbreg_ms_pointer
371 reg1_status_ready_matrix : IN STD_LOGIC;
371 PORT (
372 reg1_ready_matrix : OUT STD_LOGIC;
372 clk : IN STD_LOGIC;
373 reg1_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
373 rstn : IN STD_LOGIC;
374 reg1_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
374 run : IN STD_LOGIC;
375 ready_matrix : IN STD_LOGIC;
375 reg0_status_ready_matrix : IN STD_LOGIC;
376 status_ready_matrix : OUT STD_LOGIC;
376 reg0_ready_matrix : OUT STD_LOGIC;
377 addr_matrix : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
377 reg0_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
378 matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0));
378 reg0_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
379 END COMPONENT;
379 reg1_status_ready_matrix : IN STD_LOGIC;
380
380 reg1_ready_matrix : OUT STD_LOGIC;
381 COMPONENT lpp_lfr_ms_reg_head
381 reg1_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
382 PORT (
382 reg1_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
383 clk : IN STD_LOGIC;
383 ready_matrix : IN STD_LOGIC;
384 rstn : IN STD_LOGIC;
384 status_ready_matrix : OUT STD_LOGIC;
385 in_wen : IN STD_LOGIC;
385 addr_matrix : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
386 in_data : IN STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
386 matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0));
387 in_full : IN STD_LOGIC;
387 END COMPONENT;
388 in_empty : IN STD_LOGIC;
388
389 out_write_error : OUT STD_LOGIC;
389 COMPONENT lpp_lfr_ms_reg_head
390 out_wen : OUT STD_LOGIC;
390 PORT (
391 out_data : OUT STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
391 clk : IN STD_LOGIC;
392 out_full : OUT STD_LOGIC);
392 rstn : IN STD_LOGIC;
393 END COMPONENT;
393 in_wen : IN STD_LOGIC;
394
394 in_data : IN STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
395 END lpp_lfr_pkg;
395 in_full : IN STD_LOGIC;
396 in_empty : IN STD_LOGIC;
397 out_write_error : OUT STD_LOGIC;
398 out_wen : OUT STD_LOGIC;
399 out_data : OUT STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
400 out_full : OUT STD_LOGIC);
401 END COMPONENT;
402
403 END lpp_lfr_pkg; No newline at end of file
@@ -1,478 +1,485
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -- jean-christophe.pellion@easii-ic.com
21 -- jean-christophe.pellion@easii-ic.com
22 -------------------------------------------------------------------------------
22 -------------------------------------------------------------------------------
23 LIBRARY IEEE;
23 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 grlib;
27 LIBRARY grlib;
28 USE grlib.amba.ALL;
28 USE grlib.amba.ALL;
29 USE grlib.stdlib.ALL;
29 USE grlib.stdlib.ALL;
30 USE grlib.devices.ALL;
30 USE grlib.devices.ALL;
31 USE GRLIB.DMA2AHB_Package.ALL;
31 USE GRLIB.DMA2AHB_Package.ALL;
32
32
33 LIBRARY lpp;
33 LIBRARY lpp;
34 USE lpp.lpp_waveform_pkg.ALL;
34 USE lpp.lpp_waveform_pkg.ALL;
35 USE lpp.iir_filter.ALL;
35 USE lpp.iir_filter.ALL;
36 USE lpp.lpp_memory.ALL;
36 USE lpp.lpp_memory.ALL;
37
37
38 LIBRARY techmap;
38 LIBRARY techmap;
39 USE techmap.gencomp.ALL;
39 USE techmap.gencomp.ALL;
40
40
41 ENTITY lpp_waveform IS
41 ENTITY lpp_waveform IS
42
42
43 GENERIC (
43 GENERIC (
44 tech : INTEGER := inferred;
44 tech : INTEGER := inferred;
45 data_size : INTEGER := 96; --16*6
45 data_size : INTEGER := 96; --16*6
46 nb_data_by_buffer_size : INTEGER := 11;
46 nb_data_by_buffer_size : INTEGER := 11;
47 -- nb_word_by_buffer_size : INTEGER := 11;
47 -- nb_word_by_buffer_size : INTEGER := 11;
48 nb_snapshot_param_size : INTEGER := 11;
48 nb_snapshot_param_size : INTEGER := 11;
49 delta_vector_size : INTEGER := 20;
49 delta_vector_size : INTEGER := 20;
50 delta_vector_size_f0_2 : INTEGER := 3);
50 delta_vector_size_f0_2 : INTEGER := 3);
51
51
52 PORT (
52 PORT (
53 clk : IN STD_LOGIC;
53 clk : IN STD_LOGIC;
54 rstn : IN STD_LOGIC;
54 rstn : IN STD_LOGIC;
55
55
56 ---- AMBA AHB Master Interface
56 ---- AMBA AHB Master Interface
57 --AHB_Master_In : IN AHB_Mst_In_Type; -- TODO
57 --AHB_Master_In : IN AHB_Mst_In_Type; -- TODO
58 --AHB_Master_Out : OUT AHB_Mst_Out_Type; -- TODO
58 --AHB_Master_Out : OUT AHB_Mst_Out_Type; -- TODO
59
59
60 --config
60 --config
61 reg_run : IN STD_LOGIC;
61 reg_run : IN STD_LOGIC;
62 reg_start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
62 reg_start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
63 reg_delta_snapshot : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
63 reg_delta_snapshot : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
64 reg_delta_f0 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
64 reg_delta_f0 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
65 reg_delta_f0_2 : IN STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
65 reg_delta_f0_2 : IN STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
66 reg_delta_f1 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
66 reg_delta_f1 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
67 reg_delta_f2 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
67 reg_delta_f2 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
68
68
69 enable_f0 : IN STD_LOGIC;
69 enable_f0 : IN STD_LOGIC;
70 enable_f1 : IN STD_LOGIC;
70 enable_f1 : IN STD_LOGIC;
71 enable_f2 : IN STD_LOGIC;
71 enable_f2 : IN STD_LOGIC;
72 enable_f3 : IN STD_LOGIC;
72 enable_f3 : IN STD_LOGIC;
73
73
74 burst_f0 : IN STD_LOGIC;
74 burst_f0 : IN STD_LOGIC;
75 burst_f1 : IN STD_LOGIC;
75 burst_f1 : IN STD_LOGIC;
76 burst_f2 : IN STD_LOGIC;
76 burst_f2 : IN STD_LOGIC;
77
77
78 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
78 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
79 -- nb_word_by_buffer : IN STD_LOGIC_VECTOR(nb_word_by_buffer_size-1 DOWNTO 0);
79 -- nb_word_by_buffer : IN STD_LOGIC_VECTOR(nb_word_by_buffer_size-1 DOWNTO 0);
80 nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
80 nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
81
81
82 status_new_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); -- New data f(i) before the current data is write by dma
82 status_new_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); -- New data f(i) before the current data is write by dma
83
83
84
84
85 -- REG DMA
85 -- REG DMA
86 status_buffer_ready : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
86 status_buffer_ready : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
87 addr_buffer : IN STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
87 addr_buffer : IN STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
88 length_buffer : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
88 length_buffer : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
89
89
90 ready_buffer : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
90 ready_buffer : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
91 buffer_time : OUT STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
91 buffer_time : OUT STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
92 error_buffer_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
92 error_buffer_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
93
93
94 ---------------------------------------------------------------------------
94 ---------------------------------------------------------------------------
95 -- INPUT
95 -- INPUT
96 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
96 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
97 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
97 -- fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
98
98
99 --f0
99 --f0
100 data_f0_in_valid : IN STD_LOGIC;
100 data_f0_in_valid : IN STD_LOGIC;
101 data_f0_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
101 data_f0_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
102 data_f0_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
102 --f1
103 --f1
103 data_f1_in_valid : IN STD_LOGIC;
104 data_f1_in_valid : IN STD_LOGIC;
104 data_f1_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
105 data_f1_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
106 data_f1_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
105 --f2
107 --f2
106 data_f2_in_valid : IN STD_LOGIC;
108 data_f2_in_valid : IN STD_LOGIC;
107 data_f2_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
109 data_f2_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
110 data_f2_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
108 --f3
111 --f3
109 data_f3_in_valid : IN STD_LOGIC;
112 data_f3_in_valid : IN STD_LOGIC;
110 data_f3_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
113 data_f3_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
114 data_f3_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
111
115
112 ---------------------------------------------------------------------------
116 ---------------------------------------------------------------------------
113 -- DMA --------------------------------------------------------------------
117 -- DMA --------------------------------------------------------------------
114
118
115 dma_fifo_valid_burst : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
119 dma_fifo_valid_burst : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
116 dma_fifo_data : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
120 dma_fifo_data : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
117 dma_fifo_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
121 dma_fifo_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
118 dma_buffer_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
122 dma_buffer_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
119 dma_buffer_addr : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
123 dma_buffer_addr : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
120 dma_buffer_length : OUT STD_LOGIC_VECTOR(26*4-1 DOWNTO 0);
124 dma_buffer_length : OUT STD_LOGIC_VECTOR(26*4-1 DOWNTO 0);
121 dma_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
125 dma_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
122 dma_buffer_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0)
126 dma_buffer_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0)
123
127
124 );
128 );
125
129
126 END lpp_waveform;
130 END lpp_waveform;
127
131
128 ARCHITECTURE beh OF lpp_waveform IS
132 ARCHITECTURE beh OF lpp_waveform IS
129 SIGNAL start_snapshot_f0 : STD_LOGIC;
133 SIGNAL start_snapshot_f0 : STD_LOGIC;
130 SIGNAL start_snapshot_f1 : STD_LOGIC;
134 SIGNAL start_snapshot_f1 : STD_LOGIC;
131 SIGNAL start_snapshot_f2 : STD_LOGIC;
135 SIGNAL start_snapshot_f2 : STD_LOGIC;
132
136
133 SIGNAL data_f0_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
137 SIGNAL data_f0_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
134 SIGNAL data_f1_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
138 SIGNAL data_f1_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
135 SIGNAL data_f2_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
139 SIGNAL data_f2_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
136 SIGNAL data_f3_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
140 SIGNAL data_f3_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
137
141
138 SIGNAL data_f0_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
142 SIGNAL data_f0_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
139 SIGNAL data_f1_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
143 SIGNAL data_f1_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
140 SIGNAL data_f2_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
144 SIGNAL data_f2_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
141 SIGNAL data_f3_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
145 SIGNAL data_f3_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
142
146
143 SIGNAL data_f0_out_valid : STD_LOGIC;
147 SIGNAL data_f0_out_valid : STD_LOGIC;
144 SIGNAL data_f1_out_valid : STD_LOGIC;
148 SIGNAL data_f1_out_valid : STD_LOGIC;
145 SIGNAL data_f2_out_valid : STD_LOGIC;
149 SIGNAL data_f2_out_valid : STD_LOGIC;
146 SIGNAL data_f3_out_valid : STD_LOGIC;
150 SIGNAL data_f3_out_valid : STD_LOGIC;
147 SIGNAL nb_snapshot_param_more_one : STD_LOGIC_VECTOR(nb_snapshot_param_size DOWNTO 0);
151 SIGNAL nb_snapshot_param_more_one : STD_LOGIC_VECTOR(nb_snapshot_param_size DOWNTO 0);
148 --
152 --
149 SIGNAL valid_in : STD_LOGIC_VECTOR(3 DOWNTO 0);
153 SIGNAL valid_in : STD_LOGIC_VECTOR(3 DOWNTO 0);
150 SIGNAL valid_out : STD_LOGIC_VECTOR(3 DOWNTO 0);
154 SIGNAL valid_out : STD_LOGIC_VECTOR(3 DOWNTO 0);
151 SIGNAL valid_ack : STD_LOGIC_VECTOR(3 DOWNTO 0);
155 SIGNAL valid_ack : STD_LOGIC_VECTOR(3 DOWNTO 0);
152 SIGNAL time_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
156 SIGNAL time_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
153 SIGNAL data_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
157 SIGNAL data_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
154 SIGNAL ready_arb : STD_LOGIC_VECTOR(3 DOWNTO 0);
158 SIGNAL ready_arb : STD_LOGIC_VECTOR(3 DOWNTO 0);
155 SIGNAL data_wen : STD_LOGIC_VECTOR(3 DOWNTO 0);
159 SIGNAL data_wen : STD_LOGIC_VECTOR(3 DOWNTO 0);
156 SIGNAL time_wen : STD_LOGIC_VECTOR(3 DOWNTO 0);
160 SIGNAL time_wen : STD_LOGIC_VECTOR(3 DOWNTO 0);
157 SIGNAL wdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
161 SIGNAL wdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
158 SIGNAL full_almost : STD_LOGIC_VECTOR(3 DOWNTO 0);
162 SIGNAL full_almost : STD_LOGIC_VECTOR(3 DOWNTO 0);
159 SIGNAL full : STD_LOGIC_VECTOR(3 DOWNTO 0);
163 SIGNAL full : STD_LOGIC_VECTOR(3 DOWNTO 0);
160 SIGNAL empty_almost : STD_LOGIC_VECTOR(3 DOWNTO 0);
164 SIGNAL empty_almost : STD_LOGIC_VECTOR(3 DOWNTO 0);
161 SIGNAL empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
165 SIGNAL empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
162 --
166 --
163 SIGNAL data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
167 SIGNAL data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
164 SIGNAL time_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
168 SIGNAL time_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
165 SIGNAL rdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
169 SIGNAL rdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
166 SIGNAL enable : STD_LOGIC_VECTOR(3 DOWNTO 0);
170 SIGNAL enable : STD_LOGIC_VECTOR(3 DOWNTO 0);
167 --
171 --
168 SIGNAL run : STD_LOGIC;
172 SIGNAL run : STD_LOGIC;
169 --
173 --
170 TYPE TIME_VECTOR IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(47 DOWNTO 0);
174 TYPE TIME_VECTOR IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(47 DOWNTO 0);
171 SIGNAL data_out : Data_Vector(3 DOWNTO 0, 95 DOWNTO 0);
175 SIGNAL data_out : Data_Vector(3 DOWNTO 0, 95 DOWNTO 0);
172 SIGNAL time_out_2 : Data_Vector(3 DOWNTO 0, 47 DOWNTO 0);
176 SIGNAL time_out_2 : Data_Vector(3 DOWNTO 0, 47 DOWNTO 0);
173 SIGNAL time_out : TIME_VECTOR(3 DOWNTO 0);
177 SIGNAL time_out : TIME_VECTOR(3 DOWNTO 0);
174 SIGNAL time_out_debug : TIME_VECTOR(3 DOWNTO 0); -- TODO : debug
178 SIGNAL time_out_debug : TIME_VECTOR(3 DOWNTO 0); -- TODO : debug
175 SIGNAL time_reg1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
179 SIGNAL time_reg1 : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
176 SIGNAL time_reg2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
180 SIGNAL time_reg2 : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
177 --
181 --
178
182
179 SIGNAL s_empty_almost : STD_LOGIC_VECTOR(3 DOWNTO 0); --occupancy is lesser than 16 * 32b
183 SIGNAL s_empty_almost : STD_LOGIC_VECTOR(3 DOWNTO 0); --occupancy is lesser than 16 * 32b
180 SIGNAL s_empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
184 SIGNAL s_empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
181 SIGNAL s_data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
185 SIGNAL s_data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
182 -- SIGNAL s_rdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
186 -- SIGNAL s_rdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
183 SIGNAL s_rdata_v : STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
187 SIGNAL s_rdata_v : STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
184
188
185 --
189 --
186 SIGNAL arbiter_time_out : STD_LOGIC_VECTOR(47 DOWNTO 0);
190 SIGNAL arbiter_time_out : STD_LOGIC_VECTOR(47 DOWNTO 0);
187 SIGNAL arbiter_time_out_new : STD_LOGIC_VECTOR(3 DOWNTO 0);
191 SIGNAL arbiter_time_out_new : STD_LOGIC_VECTOR(3 DOWNTO 0);
188
192
189 SIGNAL fifo_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
193 SIGNAL fifo_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
190
194
191 SIGNAL fifo_buffer_time_s : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
195 SIGNAL fifo_buffer_time_s : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
192
196
193 BEGIN -- beh
197 BEGIN -- beh
194
198
195 -----------------------------------------------------------------------------
199 -----------------------------------------------------------------------------
196
200
197 lpp_waveform_snapshot_controler_1 : lpp_waveform_snapshot_controler
201 lpp_waveform_snapshot_controler_1 : lpp_waveform_snapshot_controler
198 GENERIC MAP (
202 GENERIC MAP (
199 delta_vector_size => delta_vector_size,
203 delta_vector_size => delta_vector_size,
200 delta_vector_size_f0_2 => delta_vector_size_f0_2
204 delta_vector_size_f0_2 => delta_vector_size_f0_2
201 )
205 )
202 PORT MAP (
206 PORT MAP (
203 clk => clk,
207 clk => clk,
204 rstn => rstn,
208 rstn => rstn,
205 reg_run => reg_run,
209 reg_run => reg_run,
206 reg_start_date => reg_start_date,
210 reg_start_date => reg_start_date,
207 reg_delta_snapshot => reg_delta_snapshot,
211 reg_delta_snapshot => reg_delta_snapshot,
208 reg_delta_f0 => reg_delta_f0,
212 reg_delta_f0 => reg_delta_f0,
209 reg_delta_f0_2 => reg_delta_f0_2,
213 reg_delta_f0_2 => reg_delta_f0_2,
210 reg_delta_f1 => reg_delta_f1,
214 reg_delta_f1 => reg_delta_f1,
211 reg_delta_f2 => reg_delta_f2,
215 reg_delta_f2 => reg_delta_f2,
212 coarse_time => coarse_time(30 DOWNTO 0),
216 coarse_time => coarse_time(30 DOWNTO 0),
213 data_f0_valid => data_f0_in_valid,
217 data_f0_valid => data_f0_in_valid,
214 data_f2_valid => data_f2_in_valid,
218 data_f2_valid => data_f2_in_valid,
215 start_snapshot_f0 => start_snapshot_f0,
219 start_snapshot_f0 => start_snapshot_f0,
216 start_snapshot_f1 => start_snapshot_f1,
220 start_snapshot_f1 => start_snapshot_f1,
217 start_snapshot_f2 => start_snapshot_f2,
221 start_snapshot_f2 => start_snapshot_f2,
218 wfp_on => run);
222 wfp_on => run);
219
223
220 lpp_waveform_snapshot_f0 : lpp_waveform_snapshot
224 lpp_waveform_snapshot_f0 : lpp_waveform_snapshot
221 GENERIC MAP (
225 GENERIC MAP (
222 data_size => data_size,
226 data_size => data_size,
223 nb_snapshot_param_size => nb_snapshot_param_size)
227 nb_snapshot_param_size => nb_snapshot_param_size)
224 PORT MAP (
228 PORT MAP (
225 clk => clk,
229 clk => clk,
226 rstn => rstn,
230 rstn => rstn,
227 run => run,
231 run => run,
228 enable => enable_f0,
232 enable => enable_f0,
229 burst_enable => burst_f0,
233 burst_enable => burst_f0,
230 nb_snapshot_param => nb_snapshot_param,
234 nb_snapshot_param => nb_snapshot_param,
231 start_snapshot => start_snapshot_f0,
235 start_snapshot => start_snapshot_f0,
232 data_in => data_f0_in,
236 data_in => data_f0_in,
233 data_in_valid => data_f0_in_valid,
237 data_in_valid => data_f0_in_valid,
234 data_out => data_f0_out,
238 data_out => data_f0_out,
235 data_out_valid => data_f0_out_valid);
239 data_out_valid => data_f0_out_valid);
236
240
237 nb_snapshot_param_more_one <= ('0' & nb_snapshot_param) ;--+ 1;
241 nb_snapshot_param_more_one <= ('0' & nb_snapshot_param) ;--+ 1;
238
242
239 lpp_waveform_snapshot_f1 : lpp_waveform_snapshot
243 lpp_waveform_snapshot_f1 : lpp_waveform_snapshot
240 GENERIC MAP (
244 GENERIC MAP (
241 data_size => data_size,
245 data_size => data_size,
242 nb_snapshot_param_size => nb_snapshot_param_size+1)
246 nb_snapshot_param_size => nb_snapshot_param_size+1)
243 PORT MAP (
247 PORT MAP (
244 clk => clk,
248 clk => clk,
245 rstn => rstn,
249 rstn => rstn,
246 run => run,
250 run => run,
247 enable => enable_f1,
251 enable => enable_f1,
248 burst_enable => burst_f1,
252 burst_enable => burst_f1,
249 nb_snapshot_param => nb_snapshot_param_more_one,
253 nb_snapshot_param => nb_snapshot_param_more_one,
250 start_snapshot => start_snapshot_f1,
254 start_snapshot => start_snapshot_f1,
251 data_in => data_f1_in,
255 data_in => data_f1_in,
252 data_in_valid => data_f1_in_valid,
256 data_in_valid => data_f1_in_valid,
253 data_out => data_f1_out,
257 data_out => data_f1_out,
254 data_out_valid => data_f1_out_valid);
258 data_out_valid => data_f1_out_valid);
255
259
256 lpp_waveform_snapshot_f2 : lpp_waveform_snapshot
260 lpp_waveform_snapshot_f2 : lpp_waveform_snapshot
257 GENERIC MAP (
261 GENERIC MAP (
258 data_size => data_size,
262 data_size => data_size,
259 nb_snapshot_param_size => nb_snapshot_param_size+1)
263 nb_snapshot_param_size => nb_snapshot_param_size+1)
260 PORT MAP (
264 PORT MAP (
261 clk => clk,
265 clk => clk,
262 rstn => rstn,
266 rstn => rstn,
263 run => run,
267 run => run,
264 enable => enable_f2,
268 enable => enable_f2,
265 burst_enable => burst_f2,
269 burst_enable => burst_f2,
266 nb_snapshot_param => nb_snapshot_param_more_one,
270 nb_snapshot_param => nb_snapshot_param_more_one,
267 start_snapshot => start_snapshot_f2,
271 start_snapshot => start_snapshot_f2,
268 data_in => data_f2_in,
272 data_in => data_f2_in,
269 data_in_valid => data_f2_in_valid,
273 data_in_valid => data_f2_in_valid,
270 data_out => data_f2_out,
274 data_out => data_f2_out,
271 data_out_valid => data_f2_out_valid);
275 data_out_valid => data_f2_out_valid);
272
276
273 lpp_waveform_burst_f3 : lpp_waveform_burst
277 lpp_waveform_burst_f3 : lpp_waveform_burst
274 GENERIC MAP (
278 GENERIC MAP (
275 data_size => data_size)
279 data_size => data_size)
276 PORT MAP (
280 PORT MAP (
277 clk => clk,
281 clk => clk,
278 rstn => rstn,
282 rstn => rstn,
279 run => run,
283 run => run,
280 enable => enable_f3,
284 enable => enable_f3,
281 data_in => data_f3_in,
285 data_in => data_f3_in,
282 data_in_valid => data_f3_in_valid,
286 data_in_valid => data_f3_in_valid,
283 data_out => data_f3_out,
287 data_out => data_f3_out,
284 data_out_valid => data_f3_out_valid);
288 data_out_valid => data_f3_out_valid);
285
289
286 -----------------------------------------------------------------------------
290 -----------------------------------------------------------------------------
287 -- DEBUG -- SNAPSHOT OUT
291 -- DEBUG -- SNAPSHOT OUT
288 --debug_f0_data_valid <= data_f0_out_valid;
292 --debug_f0_data_valid <= data_f0_out_valid;
289 --debug_f0_data <= data_f0_out;
293 --debug_f0_data <= data_f0_out;
290 --debug_f1_data_valid <= data_f1_out_valid;
294 --debug_f1_data_valid <= data_f1_out_valid;
291 --debug_f1_data <= data_f1_out;
295 --debug_f1_data <= data_f1_out;
292 --debug_f2_data_valid <= data_f2_out_valid;
296 --debug_f2_data_valid <= data_f2_out_valid;
293 --debug_f2_data <= data_f2_out;
297 --debug_f2_data <= data_f2_out;
294 --debug_f3_data_valid <= data_f3_out_valid;
298 --debug_f3_data_valid <= data_f3_out_valid;
295 --debug_f3_data <= data_f3_out;
299 --debug_f3_data <= data_f3_out;
296 -----------------------------------------------------------------------------
300 -----------------------------------------------------------------------------
297
301
298 PROCESS (clk, rstn)
302 PROCESS (clk, rstn)
299 BEGIN -- PROCESS
303 BEGIN -- PROCESS
300 IF rstn = '0' THEN -- asynchronous reset (active low)
304 IF rstn = '0' THEN -- asynchronous reset (active low)
301 time_reg1 <= (OTHERS => '0');
305 time_reg1 <= (OTHERS => '0');
302 time_reg2 <= (OTHERS => '0');
306 time_reg2 <= (OTHERS => '0');
303 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
307 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
304 time_reg1 <= fine_time & coarse_time;
308 time_reg1(48*1-1 DOWNTO 48*0) <= data_f0_time(15 DOWNTO 0) & data_f0_time(47 DOWNTO 16);
309 time_reg1(48*2-1 DOWNTO 48*1) <= data_f1_time(15 DOWNTO 0) & data_f1_time(47 DOWNTO 16);
310 time_reg1(48*3-1 DOWNTO 48*2) <= data_f2_time(15 DOWNTO 0) & data_f2_time(47 DOWNTO 16);
311 time_reg1(48*4-1 DOWNTO 48*3) <= data_f3_time(15 DOWNTO 0) & data_f3_time(47 DOWNTO 16);
305 time_reg2 <= time_reg1;
312 time_reg2 <= time_reg1;
306 END IF;
313 END IF;
307 END PROCESS;
314 END PROCESS;
308
315
309 valid_in <= data_f3_out_valid & data_f2_out_valid & data_f1_out_valid & data_f0_out_valid;
316 valid_in <= data_f3_out_valid & data_f2_out_valid & data_f1_out_valid & data_f0_out_valid;
310 all_input_valid : FOR i IN 3 DOWNTO 0 GENERATE
317 all_input_valid : FOR i IN 3 DOWNTO 0 GENERATE
311 lpp_waveform_dma_genvalid_I : lpp_waveform_dma_genvalid
318 lpp_waveform_dma_genvalid_I : lpp_waveform_dma_genvalid
312 PORT MAP (
319 PORT MAP (
313 HCLK => clk,
320 HCLK => clk,
314 HRESETn => rstn,
321 HRESETn => rstn,
315 run => run,
322 run => run,
316 valid_in => valid_in(I),
323 valid_in => valid_in(I),
317 ack_in => valid_ack(I),
324 ack_in => valid_ack(I),
318 time_in => time_reg2, -- Todo
325 time_in => time_reg2(48*(I+1)-1 DOWNTO 48*I), -- Todo
319 valid_out => valid_out(I),
326 valid_out => valid_out(I),
320 time_out => time_out(I), -- Todo
327 time_out => time_out(I), -- Todo
321 error => status_new_err(I));
328 error => status_new_err(I));
322 END GENERATE all_input_valid;
329 END GENERATE all_input_valid;
323
330
324 data_f0_out_swap <= data_f0_out((16*5)-1 DOWNTO 16*4) &
331 data_f0_out_swap <= data_f0_out((16*5)-1 DOWNTO 16*4) &
325 data_f0_out((16*6)-1 DOWNTO 16*5) &
332 data_f0_out((16*6)-1 DOWNTO 16*5) &
326 data_f0_out((16*3)-1 DOWNTO 16*2) &
333 data_f0_out((16*3)-1 DOWNTO 16*2) &
327 data_f0_out((16*4)-1 DOWNTO 16*3) &
334 data_f0_out((16*4)-1 DOWNTO 16*3) &
328 data_f0_out((16*1)-1 DOWNTO 16*0) &
335 data_f0_out((16*1)-1 DOWNTO 16*0) &
329 data_f0_out((16*2)-1 DOWNTO 16*1) ;
336 data_f0_out((16*2)-1 DOWNTO 16*1) ;
330
337
331 data_f1_out_swap <= data_f1_out((16*5)-1 DOWNTO 16*4) &
338 data_f1_out_swap <= data_f1_out((16*5)-1 DOWNTO 16*4) &
332 data_f1_out((16*6)-1 DOWNTO 16*5) &
339 data_f1_out((16*6)-1 DOWNTO 16*5) &
333 data_f1_out((16*3)-1 DOWNTO 16*2) &
340 data_f1_out((16*3)-1 DOWNTO 16*2) &
334 data_f1_out((16*4)-1 DOWNTO 16*3) &
341 data_f1_out((16*4)-1 DOWNTO 16*3) &
335 data_f1_out((16*1)-1 DOWNTO 16*0) &
342 data_f1_out((16*1)-1 DOWNTO 16*0) &
336 data_f1_out((16*2)-1 DOWNTO 16*1) ;
343 data_f1_out((16*2)-1 DOWNTO 16*1) ;
337
344
338 data_f2_out_swap <= data_f2_out((16*5)-1 DOWNTO 16*4) &
345 data_f2_out_swap <= data_f2_out((16*5)-1 DOWNTO 16*4) &
339 data_f2_out((16*6)-1 DOWNTO 16*5) &
346 data_f2_out((16*6)-1 DOWNTO 16*5) &
340 data_f2_out((16*3)-1 DOWNTO 16*2) &
347 data_f2_out((16*3)-1 DOWNTO 16*2) &
341 data_f2_out((16*4)-1 DOWNTO 16*3) &
348 data_f2_out((16*4)-1 DOWNTO 16*3) &
342 data_f2_out((16*1)-1 DOWNTO 16*0) &
349 data_f2_out((16*1)-1 DOWNTO 16*0) &
343 data_f2_out((16*2)-1 DOWNTO 16*1) ;
350 data_f2_out((16*2)-1 DOWNTO 16*1) ;
344
351
345 data_f3_out_swap <= data_f3_out((16*5)-1 DOWNTO 16*4) &
352 data_f3_out_swap <= data_f3_out((16*5)-1 DOWNTO 16*4) &
346 data_f3_out((16*6)-1 DOWNTO 16*5) &
353 data_f3_out((16*6)-1 DOWNTO 16*5) &
347 data_f3_out((16*3)-1 DOWNTO 16*2) &
354 data_f3_out((16*3)-1 DOWNTO 16*2) &
348 data_f3_out((16*4)-1 DOWNTO 16*3) &
355 data_f3_out((16*4)-1 DOWNTO 16*3) &
349 data_f3_out((16*1)-1 DOWNTO 16*0) &
356 data_f3_out((16*1)-1 DOWNTO 16*0) &
350 data_f3_out((16*2)-1 DOWNTO 16*1) ;
357 data_f3_out((16*2)-1 DOWNTO 16*1) ;
351
358
352 all_bit_of_data_out : FOR I IN 95 DOWNTO 0 GENERATE
359 all_bit_of_data_out : FOR I IN 95 DOWNTO 0 GENERATE
353 data_out(0, I) <= data_f0_out_swap(I);
360 data_out(0, I) <= data_f0_out_swap(I);
354 data_out(1, I) <= data_f1_out_swap(I);
361 data_out(1, I) <= data_f1_out_swap(I);
355 data_out(2, I) <= data_f2_out_swap(I);
362 data_out(2, I) <= data_f2_out_swap(I);
356 data_out(3, I) <= data_f3_out_swap(I);
363 data_out(3, I) <= data_f3_out_swap(I);
357 END GENERATE all_bit_of_data_out;
364 END GENERATE all_bit_of_data_out;
358
365
359 -----------------------------------------------------------------------------
366 -----------------------------------------------------------------------------
360 -- TODO : debug
367 -- TODO : debug
361 -----------------------------------------------------------------------------
368 -----------------------------------------------------------------------------
362 all_bit_of_time_out : FOR I IN 47 DOWNTO 0 GENERATE
369 all_bit_of_time_out : FOR I IN 47 DOWNTO 0 GENERATE
363 all_sample_of_time_out : FOR J IN 3 DOWNTO 0 GENERATE
370 all_sample_of_time_out : FOR J IN 3 DOWNTO 0 GENERATE
364 time_out_2(J, I) <= time_out(J)(I);
371 time_out_2(J, I) <= time_out(J)(I);
365 END GENERATE all_sample_of_time_out;
372 END GENERATE all_sample_of_time_out;
366 END GENERATE all_bit_of_time_out;
373 END GENERATE all_bit_of_time_out;
367
374
368 lpp_waveform_fifo_arbiter_1 : lpp_waveform_fifo_arbiter
375 lpp_waveform_fifo_arbiter_1 : lpp_waveform_fifo_arbiter
369 GENERIC MAP (tech => tech,
376 GENERIC MAP (tech => tech,
370 nb_data_by_buffer_size => nb_data_by_buffer_size)
377 nb_data_by_buffer_size => nb_data_by_buffer_size)
371 PORT MAP (
378 PORT MAP (
372 clk => clk,
379 clk => clk,
373 rstn => rstn,
380 rstn => rstn,
374 run => run,
381 run => run,
375 nb_data_by_buffer => nb_data_by_buffer,
382 nb_data_by_buffer => nb_data_by_buffer,
376 data_in_valid => valid_out,
383 data_in_valid => valid_out,
377 data_in_ack => valid_ack,
384 data_in_ack => valid_ack,
378 data_in => data_out,
385 data_in => data_out,
379 time_in => time_out_2,
386 time_in => time_out_2,
380
387
381 data_out => wdata,
388 data_out => wdata,
382 data_out_wen => data_wen,
389 data_out_wen => data_wen,
383 full_almost => full_almost,
390 full_almost => full_almost,
384 full => full,
391 full => full,
385
392
386 time_out => arbiter_time_out,
393 time_out => arbiter_time_out,
387 time_out_new => arbiter_time_out_new
394 time_out_new => arbiter_time_out_new
388
395
389 );
396 );
390
397
391 -----------------------------------------------------------------------------
398 -----------------------------------------------------------------------------
392 -----------------------------------------------------------------------------
399 -----------------------------------------------------------------------------
393
400
394 generate_all_fifo: FOR I IN 0 TO 3 GENERATE
401 generate_all_fifo: FOR I IN 0 TO 3 GENERATE
395 lpp_fifo_1: lpp_fifo
402 lpp_fifo_1: lpp_fifo
396 GENERIC MAP (
403 GENERIC MAP (
397 tech => tech,
404 tech => tech,
398 Mem_use => use_RAM,
405 Mem_use => use_RAM,
399 EMPTY_THRESHOLD_LIMIT => 15,
406 EMPTY_THRESHOLD_LIMIT => 15,
400 FULL_THRESHOLD_LIMIT => 3,
407 FULL_THRESHOLD_LIMIT => 3,
401 DataSz => 32,
408 DataSz => 32,
402 AddrSz => 7)
409 AddrSz => 7)
403 PORT MAP (
410 PORT MAP (
404 clk => clk,
411 clk => clk,
405 rstn => rstn,
412 rstn => rstn,
406 reUse => '0',
413 reUse => '0',
407 run => run,
414 run => run,
408 ren => data_ren(I),
415 ren => data_ren(I),
409 rdata => s_rdata_v((I+1)*32-1 downto I*32),
416 rdata => s_rdata_v((I+1)*32-1 downto I*32),
410 wen => data_wen(I),
417 wen => data_wen(I),
411 wdata => wdata,
418 wdata => wdata,
412 empty => empty(I),
419 empty => empty(I),
413 full => full(I),
420 full => full(I),
414 full_almost => OPEN,
421 full_almost => OPEN,
415 empty_threshold => empty_almost(I),
422 empty_threshold => empty_almost(I),
416 full_threshold => full_almost(I) );
423 full_threshold => full_almost(I) );
417
424
418 END GENERATE generate_all_fifo;
425 END GENERATE generate_all_fifo;
419
426
420 -----------------------------------------------------------------------------
427 -----------------------------------------------------------------------------
421 --
428 --
422 -----------------------------------------------------------------------------
429 -----------------------------------------------------------------------------
423
430
424 all_channel: FOR I IN 3 DOWNTO 0 GENERATE
431 all_channel: FOR I IN 3 DOWNTO 0 GENERATE
425
432
426 PROCESS (clk, rstn)
433 PROCESS (clk, rstn)
427 BEGIN
434 BEGIN
428 IF rstn = '0' THEN
435 IF rstn = '0' THEN
429 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0');
436 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0');
430 ELSIF clk'event AND clk = '1' THEN
437 ELSIF clk'event AND clk = '1' THEN
431 IF run = '0' THEN
438 IF run = '0' THEN
432 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0');
439 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0');
433 ELSE
440 ELSE
434 IF arbiter_time_out_new(I) = '1' THEN -- modif JC 15-01-2015
441 IF arbiter_time_out_new(I) = '1' THEN -- modif JC 15-01-2015
435 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= arbiter_time_out;
442 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= arbiter_time_out;
436 END IF;
443 END IF;
437 END IF;
444 END IF;
438 END IF;
445 END IF;
439 END PROCESS;
446 END PROCESS;
440
447
441 fifo_buffer_time_s(48*(I+1)-1 DOWNTO 48*I) <= arbiter_time_out WHEN arbiter_time_out_new(I) = '1' ELSE
448 fifo_buffer_time_s(48*(I+1)-1 DOWNTO 48*I) <= arbiter_time_out WHEN arbiter_time_out_new(I) = '1' ELSE
442 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I);
449 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I);
443
450
444 lpp_waveform_fsmdma_I: lpp_waveform_fsmdma
451 lpp_waveform_fsmdma_I: lpp_waveform_fsmdma
445 PORT MAP (
452 PORT MAP (
446 clk => clk,
453 clk => clk,
447 rstn => rstn,
454 rstn => rstn,
448 run => run,
455 run => run,
449
456
450 fifo_buffer_time => fifo_buffer_time_s(48*(I+1)-1 DOWNTO 48*I),
457 fifo_buffer_time => fifo_buffer_time_s(48*(I+1)-1 DOWNTO 48*I),
451
458
452 fifo_data => s_rdata_v(32*(I+1)-1 DOWNTO 32*I),
459 fifo_data => s_rdata_v(32*(I+1)-1 DOWNTO 32*I),
453 fifo_empty => empty(I),
460 fifo_empty => empty(I),
454 fifo_empty_threshold => empty_almost(I),
461 fifo_empty_threshold => empty_almost(I),
455 fifo_ren => data_ren(I),
462 fifo_ren => data_ren(I),
456
463
457 dma_fifo_valid_burst => dma_fifo_valid_burst(I),
464 dma_fifo_valid_burst => dma_fifo_valid_burst(I),
458 dma_fifo_data => dma_fifo_data(32*(I+1)-1 DOWNTO 32*I),
465 dma_fifo_data => dma_fifo_data(32*(I+1)-1 DOWNTO 32*I),
459 dma_fifo_ren => dma_fifo_ren(I),
466 dma_fifo_ren => dma_fifo_ren(I),
460 dma_buffer_new => dma_buffer_new(I),
467 dma_buffer_new => dma_buffer_new(I),
461 dma_buffer_addr => dma_buffer_addr(32*(I+1)-1 DOWNTO 32*I),
468 dma_buffer_addr => dma_buffer_addr(32*(I+1)-1 DOWNTO 32*I),
462 dma_buffer_length => dma_buffer_length(26*(I+1)-1 DOWNTO 26*I),
469 dma_buffer_length => dma_buffer_length(26*(I+1)-1 DOWNTO 26*I),
463 dma_buffer_full => dma_buffer_full(I),
470 dma_buffer_full => dma_buffer_full(I),
464 dma_buffer_full_err => dma_buffer_full_err(I),
471 dma_buffer_full_err => dma_buffer_full_err(I),
465
472
466 status_buffer_ready => status_buffer_ready(I), -- TODO
473 status_buffer_ready => status_buffer_ready(I), -- TODO
467 addr_buffer => addr_buffer(32*(I+1)-1 DOWNTO 32*I), -- TODO
474 addr_buffer => addr_buffer(32*(I+1)-1 DOWNTO 32*I), -- TODO
468 length_buffer => length_buffer,--(26*(I+1)-1 DOWNTO 26*I), -- TODO
475 length_buffer => length_buffer,--(26*(I+1)-1 DOWNTO 26*I), -- TODO
469 ready_buffer => ready_buffer(I), -- TODO
476 ready_buffer => ready_buffer(I), -- TODO
470 buffer_time => OPEN,--buffer_time(48*(I+1)-1 DOWNTO 48*I), -- TODO
477 buffer_time => OPEN,--buffer_time(48*(I+1)-1 DOWNTO 48*I), -- TODO
471 error_buffer_full => error_buffer_full(I)); -- TODO
478 error_buffer_full => error_buffer_full(I)); -- TODO
472
479
473 buffer_time(48*(I+1)-1 DOWNTO 48*I) <= fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I);
480 buffer_time(48*(I+1)-1 DOWNTO 48*I) <= fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I);
474
481
475 END GENERATE all_channel;
482 END GENERATE all_channel;
476
483
477
484
478 END beh;
485 END beh;
@@ -1,370 +1,374
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -- jean-christophe.pellion@easii-ic.com
21 -- jean-christophe.pellion@easii-ic.com
22 -------------------------------------------------------------------------------
22 -------------------------------------------------------------------------------
23 LIBRARY IEEE;
23 LIBRARY IEEE;
24 USE IEEE.STD_LOGIC_1164.ALL;
24 USE IEEE.STD_LOGIC_1164.ALL;
25
25
26 LIBRARY grlib;
26 LIBRARY grlib;
27 USE grlib.amba.ALL;
27 USE grlib.amba.ALL;
28 USE grlib.stdlib.ALL;
28 USE grlib.stdlib.ALL;
29 USE grlib.devices.ALL;
29 USE grlib.devices.ALL;
30 USE GRLIB.DMA2AHB_Package.ALL;
30 USE GRLIB.DMA2AHB_Package.ALL;
31
31
32 LIBRARY techmap;
32 LIBRARY techmap;
33 USE techmap.gencomp.ALL;
33 USE techmap.gencomp.ALL;
34
34
35 PACKAGE lpp_waveform_pkg IS
35 PACKAGE lpp_waveform_pkg IS
36
36
37 TYPE LPP_TYPE_ADDR_FIFO_WAVEFORM IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(6 DOWNTO 0);
37 TYPE LPP_TYPE_ADDR_FIFO_WAVEFORM IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(6 DOWNTO 0);
38
38
39 TYPE Data_Vector IS ARRAY (NATURAL RANGE <>, NATURAL RANGE <>) OF STD_LOGIC;
39 TYPE Data_Vector IS ARRAY (NATURAL RANGE <>, NATURAL RANGE <>) OF STD_LOGIC;
40
40
41 -----------------------------------------------------------------------------
41 -----------------------------------------------------------------------------
42 -- SNAPSHOT
42 -- SNAPSHOT
43 -----------------------------------------------------------------------------
43 -----------------------------------------------------------------------------
44
44
45 COMPONENT lpp_waveform_snapshot
45 COMPONENT lpp_waveform_snapshot
46 GENERIC (
46 GENERIC (
47 data_size : INTEGER;
47 data_size : INTEGER;
48 nb_snapshot_param_size : INTEGER);
48 nb_snapshot_param_size : INTEGER);
49 PORT (
49 PORT (
50 clk : IN STD_LOGIC;
50 clk : IN STD_LOGIC;
51 rstn : IN STD_LOGIC;
51 rstn : IN STD_LOGIC;
52 run : IN STD_LOGIC;
52 run : IN STD_LOGIC;
53 enable : IN STD_LOGIC;
53 enable : IN STD_LOGIC;
54 burst_enable : IN STD_LOGIC;
54 burst_enable : IN STD_LOGIC;
55 nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
55 nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
56 start_snapshot : IN STD_LOGIC;
56 start_snapshot : IN STD_LOGIC;
57 data_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
57 data_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
58 data_in_valid : IN STD_LOGIC;
58 data_in_valid : IN STD_LOGIC;
59 data_out : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
59 data_out : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
60 data_out_valid : OUT STD_LOGIC);
60 data_out_valid : OUT STD_LOGIC);
61 END COMPONENT;
61 END COMPONENT;
62
62
63 COMPONENT lpp_waveform_burst
63 COMPONENT lpp_waveform_burst
64 GENERIC (
64 GENERIC (
65 data_size : INTEGER);
65 data_size : INTEGER);
66 PORT (
66 PORT (
67 clk : IN STD_LOGIC;
67 clk : IN STD_LOGIC;
68 rstn : IN STD_LOGIC;
68 rstn : IN STD_LOGIC;
69 run : IN STD_LOGIC;
69 run : IN STD_LOGIC;
70 enable : IN STD_LOGIC;
70 enable : IN STD_LOGIC;
71 data_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
71 data_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
72 data_in_valid : IN STD_LOGIC;
72 data_in_valid : IN STD_LOGIC;
73 data_out : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
73 data_out : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
74 data_out_valid : OUT STD_LOGIC);
74 data_out_valid : OUT STD_LOGIC);
75 END COMPONENT;
75 END COMPONENT;
76
76
77 COMPONENT lpp_waveform_snapshot_controler
77 COMPONENT lpp_waveform_snapshot_controler
78 GENERIC (
78 GENERIC (
79 delta_vector_size : INTEGER;
79 delta_vector_size : INTEGER;
80 delta_vector_size_f0_2 : INTEGER);
80 delta_vector_size_f0_2 : INTEGER);
81 PORT (
81 PORT (
82 clk : IN STD_LOGIC;
82 clk : IN STD_LOGIC;
83 rstn : IN STD_LOGIC;
83 rstn : IN STD_LOGIC;
84 reg_run : IN STD_LOGIC;
84 reg_run : IN STD_LOGIC;
85 reg_start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
85 reg_start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
86 reg_delta_snapshot : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
86 reg_delta_snapshot : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
87 reg_delta_f0 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
87 reg_delta_f0 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
88 reg_delta_f0_2 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
88 reg_delta_f0_2 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
89 reg_delta_f1 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
89 reg_delta_f1 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
90 reg_delta_f2 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
90 reg_delta_f2 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
91 coarse_time : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
91 coarse_time : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
92 data_f0_valid : IN STD_LOGIC;
92 data_f0_valid : IN STD_LOGIC;
93 data_f2_valid : IN STD_LOGIC;
93 data_f2_valid : IN STD_LOGIC;
94 start_snapshot_f0 : OUT STD_LOGIC;
94 start_snapshot_f0 : OUT STD_LOGIC;
95 start_snapshot_f1 : OUT STD_LOGIC;
95 start_snapshot_f1 : OUT STD_LOGIC;
96 start_snapshot_f2 : OUT STD_LOGIC;
96 start_snapshot_f2 : OUT STD_LOGIC;
97 wfp_on : OUT STD_LOGIC);
97 wfp_on : OUT STD_LOGIC);
98 END COMPONENT;
98 END COMPONENT;
99
99
100 -----------------------------------------------------------------------------
100 -----------------------------------------------------------------------------
101 --
101 --
102 -----------------------------------------------------------------------------
102 -----------------------------------------------------------------------------
103 COMPONENT lpp_waveform
103 COMPONENT lpp_waveform
104 GENERIC (
104 GENERIC (
105 tech : INTEGER;
105 tech : INTEGER;
106 data_size : INTEGER;
106 data_size : INTEGER;
107 nb_data_by_buffer_size : INTEGER;
107 nb_data_by_buffer_size : INTEGER;
108 nb_snapshot_param_size : INTEGER;
108 nb_snapshot_param_size : INTEGER;
109 delta_vector_size : INTEGER;
109 delta_vector_size : INTEGER;
110 delta_vector_size_f0_2 : INTEGER);
110 delta_vector_size_f0_2 : INTEGER);
111 PORT (
111 PORT (
112 clk : IN STD_LOGIC;
112 clk : IN STD_LOGIC;
113 rstn : IN STD_LOGIC;
113 rstn : IN STD_LOGIC;
114 reg_run : IN STD_LOGIC;
114 reg_run : IN STD_LOGIC;
115 reg_start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
115 reg_start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
116 reg_delta_snapshot : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
116 reg_delta_snapshot : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
117 reg_delta_f0 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
117 reg_delta_f0 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
118 reg_delta_f0_2 : IN STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
118 reg_delta_f0_2 : IN STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
119 reg_delta_f1 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
119 reg_delta_f1 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
120 reg_delta_f2 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
120 reg_delta_f2 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
121 enable_f0 : IN STD_LOGIC;
121 enable_f0 : IN STD_LOGIC;
122 enable_f1 : IN STD_LOGIC;
122 enable_f1 : IN STD_LOGIC;
123 enable_f2 : IN STD_LOGIC;
123 enable_f2 : IN STD_LOGIC;
124 enable_f3 : IN STD_LOGIC;
124 enable_f3 : IN STD_LOGIC;
125 burst_f0 : IN STD_LOGIC;
125 burst_f0 : IN STD_LOGIC;
126 burst_f1 : IN STD_LOGIC;
126 burst_f1 : IN STD_LOGIC;
127 burst_f2 : IN STD_LOGIC;
127 burst_f2 : IN STD_LOGIC;
128 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
128 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
129 nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
129 nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
130 status_new_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
130 status_new_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
131 status_buffer_ready : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
131 status_buffer_ready : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
132 addr_buffer : IN STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
132 addr_buffer : IN STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
133 length_buffer : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
133 length_buffer : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
134 ready_buffer : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
134 ready_buffer : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
135 buffer_time : OUT STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
135 buffer_time : OUT STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
136 error_buffer_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
136 error_buffer_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
137 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
137 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
138 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
138 --fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
139 data_f0_in_valid : IN STD_LOGIC;
139 data_f0_in_valid : IN STD_LOGIC;
140 data_f0_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
140 data_f0_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
141 data_f0_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
141 data_f1_in_valid : IN STD_LOGIC;
142 data_f1_in_valid : IN STD_LOGIC;
142 data_f1_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
143 data_f1_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
144 data_f1_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
143 data_f2_in_valid : IN STD_LOGIC;
145 data_f2_in_valid : IN STD_LOGIC;
144 data_f2_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
146 data_f2_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
147 data_f2_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
145 data_f3_in_valid : IN STD_LOGIC;
148 data_f3_in_valid : IN STD_LOGIC;
146 data_f3_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
149 data_f3_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
150 data_f3_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
147
151
148 dma_fifo_valid_burst : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
152 dma_fifo_valid_burst : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
149 dma_fifo_data : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
153 dma_fifo_data : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
150 dma_fifo_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
154 dma_fifo_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
151 dma_buffer_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
155 dma_buffer_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
152 dma_buffer_addr : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
156 dma_buffer_addr : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
153 dma_buffer_length : OUT STD_LOGIC_VECTOR(26*4-1 DOWNTO 0);
157 dma_buffer_length : OUT STD_LOGIC_VECTOR(26*4-1 DOWNTO 0);
154 dma_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
158 dma_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
155 dma_buffer_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0)
159 dma_buffer_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0)
156 );
160 );
157 END COMPONENT;
161 END COMPONENT;
158
162
159 COMPONENT lpp_waveform_dma_genvalid
163 COMPONENT lpp_waveform_dma_genvalid
160 PORT (
164 PORT (
161 HCLK : IN STD_LOGIC;
165 HCLK : IN STD_LOGIC;
162 HRESETn : IN STD_LOGIC;
166 HRESETn : IN STD_LOGIC;
163 run : IN STD_LOGIC;
167 run : IN STD_LOGIC;
164 valid_in : IN STD_LOGIC;
168 valid_in : IN STD_LOGIC;
165 ack_in : IN STD_LOGIC;
169 ack_in : IN STD_LOGIC;
166 time_in : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
170 time_in : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
167 valid_out : OUT STD_LOGIC;
171 valid_out : OUT STD_LOGIC;
168 time_out : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
172 time_out : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
169 error : OUT STD_LOGIC);
173 error : OUT STD_LOGIC);
170 END COMPONENT;
174 END COMPONENT;
171
175
172 -----------------------------------------------------------------------------
176 -----------------------------------------------------------------------------
173 -- FIFO
177 -- FIFO
174 -----------------------------------------------------------------------------
178 -----------------------------------------------------------------------------
175 COMPONENT lpp_waveform_fifo_ctrl
179 COMPONENT lpp_waveform_fifo_ctrl
176 GENERIC (
180 GENERIC (
177 offset : INTEGER;
181 offset : INTEGER;
178 length : INTEGER);
182 length : INTEGER);
179 PORT (
183 PORT (
180 clk : IN STD_LOGIC;
184 clk : IN STD_LOGIC;
181 rstn : IN STD_LOGIC;
185 rstn : IN STD_LOGIC;
182 run : IN STD_LOGIC;
186 run : IN STD_LOGIC;
183 ren : IN STD_LOGIC;
187 ren : IN STD_LOGIC;
184 wen : IN STD_LOGIC;
188 wen : IN STD_LOGIC;
185 mem_re : OUT STD_LOGIC;
189 mem_re : OUT STD_LOGIC;
186 mem_we : OUT STD_LOGIC;
190 mem_we : OUT STD_LOGIC;
187 mem_addr_ren : OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
191 mem_addr_ren : OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
188 mem_addr_wen : OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
192 mem_addr_wen : OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
189 empty_almost : OUT STD_LOGIC;
193 empty_almost : OUT STD_LOGIC;
190 empty : OUT STD_LOGIC;
194 empty : OUT STD_LOGIC;
191 full_almost : OUT STD_LOGIC;
195 full_almost : OUT STD_LOGIC;
192 full : OUT STD_LOGIC);
196 full : OUT STD_LOGIC);
193 END COMPONENT;
197 END COMPONENT;
194
198
195 COMPONENT lpp_waveform_fifo_arbiter
199 COMPONENT lpp_waveform_fifo_arbiter
196 GENERIC (
200 GENERIC (
197 tech : INTEGER;
201 tech : INTEGER;
198 nb_data_by_buffer_size : INTEGER);
202 nb_data_by_buffer_size : INTEGER);
199 PORT (
203 PORT (
200 clk : IN STD_LOGIC;
204 clk : IN STD_LOGIC;
201 rstn : IN STD_LOGIC;
205 rstn : IN STD_LOGIC;
202 run : IN STD_LOGIC;
206 run : IN STD_LOGIC;
203 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size - 1 DOWNTO 0);
207 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size - 1 DOWNTO 0);
204 data_in_valid : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
208 data_in_valid : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
205 data_in_ack : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
209 data_in_ack : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
206 data_in : IN Data_Vector(3 DOWNTO 0, 95 DOWNTO 0);
210 data_in : IN Data_Vector(3 DOWNTO 0, 95 DOWNTO 0);
207 time_in : IN Data_Vector(3 DOWNTO 0, 47 DOWNTO 0);
211 time_in : IN Data_Vector(3 DOWNTO 0, 47 DOWNTO 0);
208 data_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
212 data_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
209 data_out_wen : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
213 data_out_wen : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
210 full_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
214 full_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
211 full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
215 full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
212 time_out : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
216 time_out : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
213 time_out_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
217 time_out_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
214 );
218 );
215 END COMPONENT;
219 END COMPONENT;
216
220
217 COMPONENT lpp_waveform_fifo
221 COMPONENT lpp_waveform_fifo
218 GENERIC (
222 GENERIC (
219 tech : INTEGER);
223 tech : INTEGER);
220 PORT (
224 PORT (
221 clk : IN STD_LOGIC;
225 clk : IN STD_LOGIC;
222 rstn : IN STD_LOGIC;
226 rstn : IN STD_LOGIC;
223 run : IN STD_LOGIC;
227 run : IN STD_LOGIC;
224 empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
228 empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
225 empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
229 empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
226 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
230 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
227 rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
231 rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
228 full_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
232 full_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
229 full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
233 full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
230 data_wen : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
234 data_wen : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
231 wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
235 wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
232 END COMPONENT;
236 END COMPONENT;
233
237
234 COMPONENT lpp_waveform_fifo_headreg
238 COMPONENT lpp_waveform_fifo_headreg
235 GENERIC (
239 GENERIC (
236 tech : INTEGER);
240 tech : INTEGER);
237 PORT (
241 PORT (
238 clk : IN STD_LOGIC;
242 clk : IN STD_LOGIC;
239 rstn : IN STD_LOGIC;
243 rstn : IN STD_LOGIC;
240 run : IN STD_LOGIC;
244 run : IN STD_LOGIC;
241 o_empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
245 o_empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
242 o_empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
246 o_empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
243 o_data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
247 o_data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
244 o_rdata_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
248 o_rdata_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
245 o_rdata_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
249 o_rdata_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
246 o_rdata_2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
250 o_rdata_2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
247 o_rdata_3 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
251 o_rdata_3 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
248 i_empty_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
252 i_empty_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
249 i_empty : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
253 i_empty : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
250 i_data_ren : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
254 i_data_ren : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
251 i_rdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
255 i_rdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
252 END COMPONENT;
256 END COMPONENT;
253
257
254 COMPONENT lpp_waveform_fifo_latencyCorrection
258 COMPONENT lpp_waveform_fifo_latencyCorrection
255 GENERIC (
259 GENERIC (
256 tech : INTEGER);
260 tech : INTEGER);
257 PORT (
261 PORT (
258 clk : IN STD_LOGIC;
262 clk : IN STD_LOGIC;
259 rstn : IN STD_LOGIC;
263 rstn : IN STD_LOGIC;
260 run : IN STD_LOGIC;
264 run : IN STD_LOGIC;
261 empty_almost : OUT STD_LOGIC;
265 empty_almost : OUT STD_LOGIC;
262 empty : OUT STD_LOGIC;
266 empty : OUT STD_LOGIC;
263 data_ren : IN STD_LOGIC;
267 data_ren : IN STD_LOGIC;
264 rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
268 rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
265 empty_almost_fifo : IN STD_LOGIC;
269 empty_almost_fifo : IN STD_LOGIC;
266 empty_fifo : IN STD_LOGIC;
270 empty_fifo : IN STD_LOGIC;
267 data_ren_fifo : OUT STD_LOGIC;
271 data_ren_fifo : OUT STD_LOGIC;
268 rdata_fifo : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
272 rdata_fifo : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
269 END COMPONENT;
273 END COMPONENT;
270
274
271 COMPONENT lpp_waveform_fifo_withoutLatency
275 COMPONENT lpp_waveform_fifo_withoutLatency
272 GENERIC (
276 GENERIC (
273 tech : INTEGER);
277 tech : INTEGER);
274 PORT (
278 PORT (
275 clk : IN STD_LOGIC;
279 clk : IN STD_LOGIC;
276 rstn : IN STD_LOGIC;
280 rstn : IN STD_LOGIC;
277 run : IN STD_LOGIC;
281 run : IN STD_LOGIC;
278 empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
282 empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
279 empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
283 empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
280 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
284 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
281 rdata_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
285 rdata_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
282 rdata_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
286 rdata_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
283 rdata_2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
287 rdata_2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
284 rdata_3 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
288 rdata_3 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
285 full_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
289 full_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
286 full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
290 full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
287 data_wen : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
291 data_wen : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
288 wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
292 wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
289 END COMPONENT;
293 END COMPONENT;
290
294
291 -----------------------------------------------------------------------------
295 -----------------------------------------------------------------------------
292 -- GEN ADDRESS
296 -- GEN ADDRESS
293 -----------------------------------------------------------------------------
297 -----------------------------------------------------------------------------
294 COMPONENT lpp_waveform_genaddress
298 COMPONENT lpp_waveform_genaddress
295 GENERIC (
299 GENERIC (
296 nb_data_by_buffer_size : INTEGER);
300 nb_data_by_buffer_size : INTEGER);
297 PORT (
301 PORT (
298 clk : IN STD_LOGIC;
302 clk : IN STD_LOGIC;
299 rstn : IN STD_LOGIC;
303 rstn : IN STD_LOGIC;
300 run : IN STD_LOGIC;
304 run : IN STD_LOGIC;
301 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
305 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
302 addr_data_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
306 addr_data_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
303 addr_data_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
307 addr_data_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
304 addr_data_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
308 addr_data_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
305 addr_data_f3 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
309 addr_data_f3 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
306 empty : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
310 empty : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
307 empty_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
311 empty_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
308 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
312 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
309 status_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
313 status_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
310 status_full_ack : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
314 status_full_ack : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
311 status_full_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
315 status_full_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
312 data_f0_data_out_valid_burst : OUT STD_LOGIC;
316 data_f0_data_out_valid_burst : OUT STD_LOGIC;
313 data_f1_data_out_valid_burst : OUT STD_LOGIC;
317 data_f1_data_out_valid_burst : OUT STD_LOGIC;
314 data_f2_data_out_valid_burst : OUT STD_LOGIC;
318 data_f2_data_out_valid_burst : OUT STD_LOGIC;
315 data_f3_data_out_valid_burst : OUT STD_LOGIC;
319 data_f3_data_out_valid_burst : OUT STD_LOGIC;
316 data_f0_data_out_valid : OUT STD_LOGIC;
320 data_f0_data_out_valid : OUT STD_LOGIC;
317 data_f1_data_out_valid : OUT STD_LOGIC;
321 data_f1_data_out_valid : OUT STD_LOGIC;
318 data_f2_data_out_valid : OUT STD_LOGIC;
322 data_f2_data_out_valid : OUT STD_LOGIC;
319 data_f3_data_out_valid : OUT STD_LOGIC;
323 data_f3_data_out_valid : OUT STD_LOGIC;
320 data_f0_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
324 data_f0_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
321 data_f1_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
325 data_f1_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
322 data_f2_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
326 data_f2_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
323 data_f3_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
327 data_f3_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
324 END COMPONENT;
328 END COMPONENT;
325
329
326 -----------------------------------------------------------------------------
330 -----------------------------------------------------------------------------
327 -- lpp_waveform_fifo_arbiter_reg
331 -- lpp_waveform_fifo_arbiter_reg
328 -----------------------------------------------------------------------------
332 -----------------------------------------------------------------------------
329 COMPONENT lpp_waveform_fifo_arbiter_reg
333 COMPONENT lpp_waveform_fifo_arbiter_reg
330 GENERIC (
334 GENERIC (
331 data_size : INTEGER;
335 data_size : INTEGER;
332 data_nb : INTEGER);
336 data_nb : INTEGER);
333 PORT (
337 PORT (
334 clk : IN STD_LOGIC;
338 clk : IN STD_LOGIC;
335 rstn : IN STD_LOGIC;
339 rstn : IN STD_LOGIC;
336 run : IN STD_LOGIC;
340 run : IN STD_LOGIC;
337 max_count : IN STD_LOGIC_VECTOR(data_size -1 DOWNTO 0);
341 max_count : IN STD_LOGIC_VECTOR(data_size -1 DOWNTO 0);
338 enable : IN STD_LOGIC;
342 enable : IN STD_LOGIC;
339 sel : IN STD_LOGIC_VECTOR(data_nb-1 DOWNTO 0);
343 sel : IN STD_LOGIC_VECTOR(data_nb-1 DOWNTO 0);
340 data : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
344 data : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
341 data_s : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0));
345 data_s : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0));
342 END COMPONENT;
346 END COMPONENT;
343
347
344 COMPONENT lpp_waveform_fsmdma
348 COMPONENT lpp_waveform_fsmdma
345 PORT (
349 PORT (
346 clk : IN STD_ULOGIC;
350 clk : IN STD_ULOGIC;
347 rstn : IN STD_ULOGIC;
351 rstn : IN STD_ULOGIC;
348 run : IN STD_LOGIC;
352 run : IN STD_LOGIC;
349 fifo_buffer_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
353 fifo_buffer_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
350 fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
354 fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
351 fifo_empty : IN STD_LOGIC;
355 fifo_empty : IN STD_LOGIC;
352 fifo_empty_threshold : IN STD_LOGIC;
356 fifo_empty_threshold : IN STD_LOGIC;
353 fifo_ren : OUT STD_LOGIC;
357 fifo_ren : OUT STD_LOGIC;
354 dma_fifo_valid_burst : OUT STD_LOGIC;
358 dma_fifo_valid_burst : OUT STD_LOGIC;
355 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
359 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
356 dma_fifo_ren : IN STD_LOGIC;
360 dma_fifo_ren : IN STD_LOGIC;
357 dma_buffer_new : OUT STD_LOGIC;
361 dma_buffer_new : OUT STD_LOGIC;
358 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
362 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
359 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
363 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
360 dma_buffer_full : IN STD_LOGIC;
364 dma_buffer_full : IN STD_LOGIC;
361 dma_buffer_full_err : IN STD_LOGIC;
365 dma_buffer_full_err : IN STD_LOGIC;
362 status_buffer_ready : IN STD_LOGIC;
366 status_buffer_ready : IN STD_LOGIC;
363 addr_buffer : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
367 addr_buffer : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
364 length_buffer : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
368 length_buffer : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
365 ready_buffer : OUT STD_LOGIC;
369 ready_buffer : OUT STD_LOGIC;
366 buffer_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
370 buffer_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
367 error_buffer_full : OUT STD_LOGIC);
371 error_buffer_full : OUT STD_LOGIC);
368 END COMPONENT;
372 END COMPONENT;
369
373
370 END lpp_waveform_pkg;
374 END lpp_waveform_pkg;
General Comments 0
You need to be logged in to leave comments. Login now