##// END OF EJS Templates
1.1.34 : idem 1.1.33 avec reset soft pour LFR subsystem
pellion -
r463:832e74562224 (LFR-EM) WFP_MS-1-1-34 JC
parent child
Show More
@@ -1,428 +1,435
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_time_management.ALL;
45 USE lpp.lpp_lfr_time_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 ---------------------------------------------------------------------------
85 ---------------------------------------------------------------------------
86 TAG8 : OUT STD_LOGIC;
86 TAG8 : OUT STD_LOGIC;
87 led : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
87 led : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
88 );
88 );
89
89
90 END LFR_em;
90 END LFR_em;
91
91
92
92
93 ARCHITECTURE beh OF LFR_em IS
93 ARCHITECTURE beh OF LFR_em IS
94 SIGNAL clk_50_s : STD_LOGIC := '0';
94 SIGNAL clk_50_s : STD_LOGIC := '0';
95 SIGNAL clk_25 : STD_LOGIC := '0';
95 SIGNAL clk_25 : STD_LOGIC := '0';
96 SIGNAL clk_24 : STD_LOGIC := '0';
96 SIGNAL clk_24 : STD_LOGIC := '0';
97 -----------------------------------------------------------------------------
97 -----------------------------------------------------------------------------
98 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
98 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
99 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
99 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
100
100
101 -- CONSTANTS
101 -- CONSTANTS
102 CONSTANT CFG_PADTECH : INTEGER := inferred;
102 CONSTANT CFG_PADTECH : INTEGER := inferred;
103 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
103 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
104 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
104 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
105 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
105 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
106
106
107 SIGNAL apbi_ext : apb_slv_in_type;
107 SIGNAL apbi_ext : apb_slv_in_type;
108 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5) := (OTHERS => apb_none);
108 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5) := (OTHERS => apb_none);
109 SIGNAL ahbi_s_ext : ahb_slv_in_type;
109 SIGNAL ahbi_s_ext : ahb_slv_in_type;
110 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3) := (OTHERS => ahbs_none);
110 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3) := (OTHERS => ahbs_none);
111 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
111 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
112 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1) := (OTHERS => ahbm_none);
112 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1) := (OTHERS => ahbm_none);
113
113
114 -- Spacewire signals
114 -- Spacewire signals
115 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
115 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
116 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
116 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
117 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
117 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
118 SIGNAL spw_rxtxclk : STD_ULOGIC;
118 SIGNAL spw_rxtxclk : STD_ULOGIC;
119 SIGNAL spw_rxclkn : STD_ULOGIC;
119 SIGNAL spw_rxclkn : STD_ULOGIC;
120 SIGNAL spw_clk : STD_LOGIC;
120 SIGNAL spw_clk : STD_LOGIC;
121 SIGNAL swni : grspw_in_type;
121 SIGNAL swni : grspw_in_type;
122 SIGNAL swno : grspw_out_type;
122 SIGNAL swno : grspw_out_type;
123
123
124 --GPIO
124 --GPIO
125 SIGNAL gpioi : gpio_in_type;
125 SIGNAL gpioi : gpio_in_type;
126 SIGNAL gpioo : gpio_out_type;
126 SIGNAL gpioo : gpio_out_type;
127
127
128 -- AD Converter ADS7886
128 -- AD Converter ADS7886
129 SIGNAL sample : Samples14v(7 DOWNTO 0);
129 SIGNAL sample : Samples14v(7 DOWNTO 0);
130 SIGNAL sample_s : Samples(7 DOWNTO 0);
130 SIGNAL sample_s : Samples(7 DOWNTO 0);
131 SIGNAL sample_val : STD_LOGIC;
131 SIGNAL sample_val : STD_LOGIC;
132 SIGNAL ADC_nCS_sig : STD_LOGIC;
132 SIGNAL ADC_nCS_sig : STD_LOGIC;
133 SIGNAL ADC_CLK_sig : STD_LOGIC;
133 SIGNAL ADC_CLK_sig : STD_LOGIC;
134 SIGNAL ADC_SDO_sig : STD_LOGIC_VECTOR(7 DOWNTO 0);
134 SIGNAL ADC_SDO_sig : STD_LOGIC_VECTOR(7 DOWNTO 0);
135
135
136 -----------------------------------------------------------------------------
136 -----------------------------------------------------------------------------
137 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
137 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
138
138
139 -----------------------------------------------------------------------------
139 -----------------------------------------------------------------------------
140 SIGNAL rstn : STD_LOGIC;
140 SIGNAL rstn : STD_LOGIC;
141
141
142 SIGNAL LFR_soft_rstn : STD_LOGIC;
143 SIGNAL LFR_rstn : STD_LOGIC;
144
142 SIGNAL ADC_smpclk_s : STD_LOGIC;
145 SIGNAL ADC_smpclk_s : STD_LOGIC;
143
146
144 BEGIN -- beh
147 BEGIN -- beh
145
148
146 -----------------------------------------------------------------------------
149 -----------------------------------------------------------------------------
147 -- CLK
150 -- CLK
148 -----------------------------------------------------------------------------
151 -----------------------------------------------------------------------------
149 rst0 : rstgen PORT MAP (reset, clk_25, '1', rstn, OPEN);
152 rst0 : rstgen PORT MAP (reset, clk_25, '1', rstn, OPEN);
150
153
151 PROCESS(clk100MHz)
154 PROCESS(clk100MHz)
152 BEGIN
155 BEGIN
153 IF clk100MHz'EVENT AND clk100MHz = '1' THEN
156 IF clk100MHz'EVENT AND clk100MHz = '1' THEN
154 clk_50_s <= NOT clk_50_s;
157 clk_50_s <= NOT clk_50_s;
155 END IF;
158 END IF;
156 END PROCESS;
159 END PROCESS;
157
160
158 PROCESS(clk_50_s)
161 PROCESS(clk_50_s)
159 BEGIN
162 BEGIN
160 IF clk_50_s'EVENT AND clk_50_s = '1' THEN
163 IF clk_50_s'EVENT AND clk_50_s = '1' THEN
161 clk_25 <= NOT clk_25;
164 clk_25 <= NOT clk_25;
162 END IF;
165 END IF;
163 END PROCESS;
166 END PROCESS;
164
167
165 PROCESS(clk49_152MHz)
168 PROCESS(clk49_152MHz)
166 BEGIN
169 BEGIN
167 IF clk49_152MHz'EVENT AND clk49_152MHz = '1' THEN
170 IF clk49_152MHz'EVENT AND clk49_152MHz = '1' THEN
168 clk_24 <= NOT clk_24;
171 clk_24 <= NOT clk_24;
169 END IF;
172 END IF;
170 END PROCESS;
173 END PROCESS;
171
174
172 -----------------------------------------------------------------------------
175 -----------------------------------------------------------------------------
173
176
174 PROCESS (clk_25, rstn)
177 PROCESS (clk_25, rstn)
175 BEGIN -- PROCESS
178 BEGIN -- PROCESS
176 IF rstn = '0' THEN -- asynchronous reset (active low)
179 IF rstn = '0' THEN -- asynchronous reset (active low)
177 led(0) <= '0';
180 led(0) <= '0';
178 led(1) <= '0';
181 led(1) <= '0';
179 led(2) <= '0';
182 led(2) <= '0';
180 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
183 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
181 led(0) <= '0';
184 led(0) <= '0';
182 led(1) <= '1';
185 led(1) <= '1';
183 led(2) <= '1';
186 led(2) <= '1';
184 END IF;
187 END IF;
185 END PROCESS;
188 END PROCESS;
186
189
187 --
190 --
188 leon3_soc_1 : leon3_soc
191 leon3_soc_1 : leon3_soc
189 GENERIC MAP (
192 GENERIC MAP (
190 fabtech => apa3e,
193 fabtech => apa3e,
191 memtech => apa3e,
194 memtech => apa3e,
192 padtech => inferred,
195 padtech => inferred,
193 clktech => inferred,
196 clktech => inferred,
194 disas => 0,
197 disas => 0,
195 dbguart => 0,
198 dbguart => 0,
196 pclow => 2,
199 pclow => 2,
197 clk_freq => 25000,
200 clk_freq => 25000,
198 NB_CPU => 1,
201 NB_CPU => 1,
199 ENABLE_FPU => 1,
202 ENABLE_FPU => 1,
200 FPU_NETLIST => 0,
203 FPU_NETLIST => 0,
201 ENABLE_DSU => 1,
204 ENABLE_DSU => 1,
202 ENABLE_AHB_UART => 1,
205 ENABLE_AHB_UART => 1,
203 ENABLE_APB_UART => 1,
206 ENABLE_APB_UART => 1,
204 ENABLE_IRQMP => 1,
207 ENABLE_IRQMP => 1,
205 ENABLE_GPT => 1,
208 ENABLE_GPT => 1,
206 NB_AHB_MASTER => NB_AHB_MASTER,
209 NB_AHB_MASTER => NB_AHB_MASTER,
207 NB_AHB_SLAVE => NB_AHB_SLAVE,
210 NB_AHB_SLAVE => NB_AHB_SLAVE,
208 NB_APB_SLAVE => NB_APB_SLAVE)
211 NB_APB_SLAVE => NB_APB_SLAVE)
209 PORT MAP (
212 PORT MAP (
210 clk => clk_25,
213 clk => clk_25,
211 reset => rstn,
214 reset => rstn,
212 errorn => OPEN,
215 errorn => OPEN,
213
216
214 ahbrxd => TAG1,
217 ahbrxd => TAG1,
215 ahbtxd => TAG3,
218 ahbtxd => TAG3,
216 urxd1 => TAG2,
219 urxd1 => TAG2,
217 utxd1 => TAG4,
220 utxd1 => TAG4,
218
221
219 address => address,
222 address => address,
220 data => data,
223 data => data,
221 nSRAM_BE0 => nSRAM_BE0,
224 nSRAM_BE0 => nSRAM_BE0,
222 nSRAM_BE1 => nSRAM_BE1,
225 nSRAM_BE1 => nSRAM_BE1,
223 nSRAM_BE2 => nSRAM_BE2,
226 nSRAM_BE2 => nSRAM_BE2,
224 nSRAM_BE3 => nSRAM_BE3,
227 nSRAM_BE3 => nSRAM_BE3,
225 nSRAM_WE => nSRAM_WE,
228 nSRAM_WE => nSRAM_WE,
226 nSRAM_CE => nSRAM_CE,
229 nSRAM_CE => nSRAM_CE,
227 nSRAM_OE => nSRAM_OE,
230 nSRAM_OE => nSRAM_OE,
228
231
229 apbi_ext => apbi_ext,
232 apbi_ext => apbi_ext,
230 apbo_ext => apbo_ext,
233 apbo_ext => apbo_ext,
231 ahbi_s_ext => ahbi_s_ext,
234 ahbi_s_ext => ahbi_s_ext,
232 ahbo_s_ext => ahbo_s_ext,
235 ahbo_s_ext => ahbo_s_ext,
233 ahbi_m_ext => ahbi_m_ext,
236 ahbi_m_ext => ahbi_m_ext,
234 ahbo_m_ext => ahbo_m_ext);
237 ahbo_m_ext => ahbo_m_ext);
235
238
236
239
237 -------------------------------------------------------------------------------
240 -------------------------------------------------------------------------------
238 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
241 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
239 -------------------------------------------------------------------------------
242 -------------------------------------------------------------------------------
240 apb_lfr_time_management_1 : apb_lfr_time_management
243 apb_lfr_time_management_1 : apb_lfr_time_management
241 GENERIC MAP (
244 GENERIC MAP (
242 pindex => 6,
245 pindex => 6,
243 paddr => 6,
246 paddr => 6,
244 pmask => 16#fff#,
247 pmask => 16#fff#,
245 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
248 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
246 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
249 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
247 PORT MAP (
250 PORT MAP (
248 clk25MHz => clk_25,
251 clk25MHz => clk_25,
249 clk24_576MHz => clk_24, -- 49.152MHz/2
252 clk24_576MHz => clk_24, -- 49.152MHz/2
250 resetn => rstn,
253 resetn => rstn,
251 grspw_tick => swno.tickout,
254 grspw_tick => swno.tickout,
252 apbi => apbi_ext,
255 apbi => apbi_ext,
253 apbo => apbo_ext(6),
256 apbo => apbo_ext(6),
254 coarse_time => coarse_time,
257 coarse_time => coarse_time,
255 fine_time => fine_time);
258 fine_time => fine_time,
259 LFR_soft_rstn => LFR_soft_rstn
260 );
256
261
257 -----------------------------------------------------------------------
262 -----------------------------------------------------------------------
258 --- SpaceWire --------------------------------------------------------
263 --- SpaceWire --------------------------------------------------------
259 -----------------------------------------------------------------------
264 -----------------------------------------------------------------------
260
265
261 -- SPW_EN <= '1';
266 -- SPW_EN <= '1';
262
267
263 spw_clk <= clk_50_s;
268 spw_clk <= clk_50_s;
264 spw_rxtxclk <= spw_clk;
269 spw_rxtxclk <= spw_clk;
265 spw_rxclkn <= NOT spw_rxtxclk;
270 spw_rxclkn <= NOT spw_rxtxclk;
266
271
267 -- PADS for SPW1
272 -- PADS for SPW1
268 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
273 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
269 PORT MAP (spw1_din, dtmp(0));
274 PORT MAP (spw1_din, dtmp(0));
270 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
275 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
271 PORT MAP (spw1_sin, stmp(0));
276 PORT MAP (spw1_sin, stmp(0));
272 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
277 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
273 PORT MAP (spw1_dout, swno.d(0));
278 PORT MAP (spw1_dout, swno.d(0));
274 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
279 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
275 PORT MAP (spw1_sout, swno.s(0));
280 PORT MAP (spw1_sout, swno.s(0));
276 -- PADS FOR SPW2
281 -- PADS FOR SPW2
277 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
282 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
278 PORT MAP (spw2_din, dtmp(1));
283 PORT MAP (spw2_din, dtmp(1));
279 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
284 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
280 PORT MAP (spw2_sin, stmp(1));
285 PORT MAP (spw2_sin, stmp(1));
281 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
286 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
282 PORT MAP (spw2_dout, swno.d(1));
287 PORT MAP (spw2_dout, swno.d(1));
283 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
288 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
284 PORT MAP (spw2_sout, swno.s(1));
289 PORT MAP (spw2_sout, swno.s(1));
285
290
286 -- GRSPW PHY
291 -- GRSPW PHY
287 --spw1_input: if CFG_SPW_GRSPW = 1 generate
292 --spw1_input: if CFG_SPW_GRSPW = 1 generate
288 spw_inputloop : FOR j IN 0 TO 1 GENERATE
293 spw_inputloop : FOR j IN 0 TO 1 GENERATE
289 spw_phy0 : grspw_phy
294 spw_phy0 : grspw_phy
290 GENERIC MAP(
295 GENERIC MAP(
291 tech => apa3e,
296 tech => apa3e,
292 rxclkbuftype => 1,
297 rxclkbuftype => 1,
293 scantest => 0)
298 scantest => 0)
294 PORT MAP(
299 PORT MAP(
295 rxrst => swno.rxrst,
300 rxrst => swno.rxrst,
296 di => dtmp(j),
301 di => dtmp(j),
297 si => stmp(j),
302 si => stmp(j),
298 rxclko => spw_rxclk(j),
303 rxclko => spw_rxclk(j),
299 do => swni.d(j),
304 do => swni.d(j),
300 ndo => swni.nd(j*5+4 DOWNTO j*5),
305 ndo => swni.nd(j*5+4 DOWNTO j*5),
301 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
306 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
302 END GENERATE spw_inputloop;
307 END GENERATE spw_inputloop;
303
308
304 -- SPW core
309 -- SPW core
305 sw0 : grspwm GENERIC MAP(
310 sw0 : grspwm GENERIC MAP(
306 tech => apa3e,
311 tech => apa3e,
307 hindex => 1,
312 hindex => 1,
308 pindex => 5,
313 pindex => 5,
309 paddr => 5,
314 paddr => 5,
310 pirq => 11,
315 pirq => 11,
311 sysfreq => 25000, -- CPU_FREQ
316 sysfreq => 25000, -- CPU_FREQ
312 rmap => 1,
317 rmap => 1,
313 rmapcrc => 1,
318 rmapcrc => 1,
314 fifosize1 => 16,
319 fifosize1 => 16,
315 fifosize2 => 16,
320 fifosize2 => 16,
316 rxclkbuftype => 1,
321 rxclkbuftype => 1,
317 rxunaligned => 0,
322 rxunaligned => 0,
318 rmapbufs => 4,
323 rmapbufs => 4,
319 ft => 0,
324 ft => 0,
320 netlist => 0,
325 netlist => 0,
321 ports => 2,
326 ports => 2,
322 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
327 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
323 memtech => apa3e,
328 memtech => apa3e,
324 destkey => 2,
329 destkey => 2,
325 spwcore => 1
330 spwcore => 1
326 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
331 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
327 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
332 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
328 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
333 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
329 )
334 )
330 PORT MAP(rstn, clk_25, spw_rxclk(0),
335 PORT MAP(rstn, clk_25, spw_rxclk(0),
331 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
336 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
332 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
337 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
333 swni, swno);
338 swni, swno);
334
339
335 swni.tickin <= '0';
340 swni.tickin <= '0';
336 swni.rmapen <= '1';
341 swni.rmapen <= '1';
337 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
342 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
338 swni.tickinraw <= '0';
343 swni.tickinraw <= '0';
339 swni.timein <= (OTHERS => '0');
344 swni.timein <= (OTHERS => '0');
340 swni.dcrstval <= (OTHERS => '0');
345 swni.dcrstval <= (OTHERS => '0');
341 swni.timerrstval <= (OTHERS => '0');
346 swni.timerrstval <= (OTHERS => '0');
342
347
343 -------------------------------------------------------------------------------
348 -------------------------------------------------------------------------------
344 -- LFR ------------------------------------------------------------------------
349 -- LFR ------------------------------------------------------------------------
345 -------------------------------------------------------------------------------
350 -------------------------------------------------------------------------------
351 LFR_rstn <= LFR_soft_rstn AND rstn;
352
346 lpp_lfr_1 : lpp_lfr
353 lpp_lfr_1 : lpp_lfr
347 GENERIC MAP (
354 GENERIC MAP (
348 Mem_use => use_RAM,
355 Mem_use => use_RAM,
349 nb_data_by_buffer_size => 32,
356 nb_data_by_buffer_size => 32,
350 --nb_word_by_buffer_size => 30,
357 --nb_word_by_buffer_size => 30,
351 nb_snapshot_param_size => 32,
358 nb_snapshot_param_size => 32,
352 delta_vector_size => 32,
359 delta_vector_size => 32,
353 delta_vector_size_f0_2 => 7, -- log2(96)
360 delta_vector_size_f0_2 => 7, -- log2(96)
354 pindex => 15,
361 pindex => 15,
355 paddr => 15,
362 paddr => 15,
356 pmask => 16#fff#,
363 pmask => 16#fff#,
357 pirq_ms => 6,
364 pirq_ms => 6,
358 pirq_wfp => 14,
365 pirq_wfp => 14,
359 hindex => 2,
366 hindex => 2,
360 top_lfr_version => X"010121") -- aa.bb.cc version
367 top_lfr_version => X"010122") -- aa.bb.cc version
361 -- AA : BOARD NUMBER
368 -- AA : BOARD NUMBER
362 -- 0 => MINI_LFR
369 -- 0 => MINI_LFR
363 -- 1 => EM
370 -- 1 => EM
364 PORT MAP (
371 PORT MAP (
365 clk => clk_25,
372 clk => clk_25,
366 rstn => rstn,
373 rstn => LFR_rstn,
367 sample_B => sample_s(2 DOWNTO 0),
374 sample_B => sample_s(2 DOWNTO 0),
368 sample_E => sample_s(7 DOWNTO 3),
375 sample_E => sample_s(7 DOWNTO 3),
369 sample_val => sample_val,
376 sample_val => sample_val,
370 apbi => apbi_ext,
377 apbi => apbi_ext,
371 apbo => apbo_ext(15),
378 apbo => apbo_ext(15),
372 ahbi => ahbi_m_ext,
379 ahbi => ahbi_m_ext,
373 ahbo => ahbo_m_ext(2),
380 ahbo => ahbo_m_ext(2),
374 coarse_time => coarse_time,
381 coarse_time => coarse_time,
375 fine_time => fine_time,
382 fine_time => fine_time,
376 data_shaping_BW => bias_fail_sw);--,
383 data_shaping_BW => bias_fail_sw);--,
377 --observation_vector_0 => OPEN,
384 --observation_vector_0 => OPEN,
378 --observation_vector_1 => OPEN,
385 --observation_vector_1 => OPEN,
379 --observation_reg => observation_reg);
386 --observation_reg => observation_reg);
380
387
381
388
382 all_sample: FOR I IN 7 DOWNTO 0 GENERATE
389 all_sample: FOR I IN 7 DOWNTO 0 GENERATE
383 sample_s(I) <= sample(I) & '0' & '0';
390 sample_s(I) <= sample(I) & '0' & '0';
384 END GENERATE all_sample;
391 END GENERATE all_sample;
385
392
386 -----------------------------------------------------------------------------
393 -----------------------------------------------------------------------------
387 --
394 --
388 -----------------------------------------------------------------------------
395 -----------------------------------------------------------------------------
389 top_ad_conv_RHF1401_withFilter_1: top_ad_conv_RHF1401_withFilter
396 top_ad_conv_RHF1401_withFilter_1: top_ad_conv_RHF1401_withFilter
390 GENERIC MAP (
397 GENERIC MAP (
391 ChanelCount => 8,
398 ChanelCount => 8,
392 ncycle_cnv_high => 13,
399 ncycle_cnv_high => 13,
393 ncycle_cnv => 25)
400 ncycle_cnv => 25)
394 PORT MAP (
401 PORT MAP (
395 cnv_clk => clk_24,
402 cnv_clk => clk_24,
396 cnv_rstn => rstn,
403 cnv_rstn => rstn,
397 cnv => ADC_smpclk_s,
404 cnv => ADC_smpclk_s,
398 clk => clk_25,
405 clk => clk_25,
399 rstn => rstn,
406 rstn => rstn,
400 ADC_data => ADC_data,
407 ADC_data => ADC_data,
401 ADC_nOE => ADC_OEB_bar_CH,
408 ADC_nOE => ADC_OEB_bar_CH,
402 sample => sample,
409 sample => sample,
403 sample_val => sample_val);
410 sample_val => sample_val);
404
411
405
412
406
413
407
414
408 --top_ad_conv_RHF1401_1 : top_ad_conv_RHF1401
415 --top_ad_conv_RHF1401_1 : top_ad_conv_RHF1401
409 -- GENERIC MAP (
416 -- GENERIC MAP (
410 -- ChanelCount => 8,
417 -- ChanelCount => 8,
411 -- ncycle_cnv_high => 40, -- TODO : 79
418 -- ncycle_cnv_high => 40, -- TODO : 79
412 -- ncycle_cnv => 250) -- TODO : 500
419 -- ncycle_cnv => 250) -- TODO : 500
413 -- PORT MAP (
420 -- PORT MAP (
414 -- cnv_clk => clk_24, -- TODO : 49.152
421 -- cnv_clk => clk_24, -- TODO : 49.152
415 -- cnv_rstn => rstn, -- ok
422 -- cnv_rstn => rstn, -- ok
416 -- cnv => ADC_smpclk_s, -- ok
423 -- cnv => ADC_smpclk_s, -- ok
417 -- clk => clk_25, -- ok
424 -- clk => clk_25, -- ok
418 -- rstn => rstn, -- ok
425 -- rstn => rstn, -- ok
419 -- ADC_data => ADC_data, -- ok
426 -- ADC_data => ADC_data, -- ok
420 -- ADC_nOE => ADC_OEB_bar_CH, -- ok
427 -- ADC_nOE => ADC_OEB_bar_CH, -- ok
421 -- sample => sample, -- ok
428 -- sample => sample, -- ok
422 -- sample_val => sample_val); -- ok
429 -- sample_val => sample_val); -- ok
423
430
424 ADC_smpclk <= ADC_smpclk_s;
431 ADC_smpclk <= ADC_smpclk_s;
425
432
426 TAG8 <= ADC_smpclk_s;
433 TAG8 <= ADC_smpclk_s;
427
434
428 END beh;
435 END beh;
@@ -1,691 +1,698
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_time_management.ALL;
45 USE lpp.lpp_lfr_time_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 BEGIN -- beh
192 BEGIN -- beh
193
193
194 -----------------------------------------------------------------------------
194 -----------------------------------------------------------------------------
195 -- CLK
195 -- CLK
196 -----------------------------------------------------------------------------
196 -----------------------------------------------------------------------------
197
197
198 --PROCESS(clk_50)
198 --PROCESS(clk_50)
199 --BEGIN
199 --BEGIN
200 -- IF clk_50'EVENT AND clk_50 = '1' THEN
200 -- IF clk_50'EVENT AND clk_50 = '1' THEN
201 -- clk_50_s <= NOT clk_50_s;
201 -- clk_50_s <= NOT clk_50_s;
202 -- END IF;
202 -- END IF;
203 --END PROCESS;
203 --END PROCESS;
204
204
205 --PROCESS(clk_50_s)
205 --PROCESS(clk_50_s)
206 --BEGIN
206 --BEGIN
207 -- IF clk_50_s'EVENT AND clk_50_s = '1' THEN
207 -- IF clk_50_s'EVENT AND clk_50_s = '1' THEN
208 -- clk_25 <= NOT clk_25;
208 -- clk_25 <= NOT clk_25;
209 -- END IF;
209 -- END IF;
210 --END PROCESS;
210 --END PROCESS;
211
211
212 --PROCESS(clk_49)
212 --PROCESS(clk_49)
213 --BEGIN
213 --BEGIN
214 -- IF clk_49'EVENT AND clk_49 = '1' THEN
214 -- IF clk_49'EVENT AND clk_49 = '1' THEN
215 -- clk_24 <= NOT clk_24;
215 -- clk_24 <= NOT clk_24;
216 -- END IF;
216 -- END IF;
217 --END PROCESS;
217 --END PROCESS;
218
218
219 --PROCESS(clk_25)
219 --PROCESS(clk_25)
220 --BEGIN
220 --BEGIN
221 -- IF clk_25'EVENT AND clk_25 = '1' THEN
221 -- IF clk_25'EVENT AND clk_25 = '1' THEN
222 -- rstn_25 <= reset;
222 -- rstn_25 <= reset;
223 -- END IF;
223 -- END IF;
224 --END PROCESS;
224 --END PROCESS;
225
225
226 PROCESS (clk_50, reset)
226 PROCESS (clk_50, reset)
227 BEGIN -- PROCESS
227 BEGIN -- PROCESS
228 IF reset = '0' THEN -- asynchronous reset (active low)
228 IF reset = '0' THEN -- asynchronous reset (active low)
229 clk_50_s <= '0';
229 clk_50_s <= '0';
230 rstn_50 <= '0';
230 rstn_50 <= '0';
231 rstn_50_d1 <= '0';
231 rstn_50_d1 <= '0';
232 rstn_50_d2 <= '0';
232 rstn_50_d2 <= '0';
233 rstn_50_d3 <= '0';
233 rstn_50_d3 <= '0';
234
234
235 ELSIF clk_50'event AND clk_50 = '1' THEN -- rising clock edge
235 ELSIF clk_50'event AND clk_50 = '1' THEN -- rising clock edge
236 clk_50_s <= NOT clk_50_s;
236 clk_50_s <= NOT clk_50_s;
237 rstn_50_d1 <= '1';
237 rstn_50_d1 <= '1';
238 rstn_50_d2 <= rstn_50_d1;
238 rstn_50_d2 <= rstn_50_d1;
239 rstn_50_d3 <= rstn_50_d2;
239 rstn_50_d3 <= rstn_50_d2;
240 rstn_50 <= rstn_50_d3;
240 rstn_50 <= rstn_50_d3;
241 END IF;
241 END IF;
242 END PROCESS;
242 END PROCESS;
243
243
244 PROCESS (clk_50_s, rstn_50)
244 PROCESS (clk_50_s, rstn_50)
245 BEGIN -- PROCESS
245 BEGIN -- PROCESS
246 IF rstn_50 = '0' THEN -- asynchronous reset (active low)
246 IF rstn_50 = '0' THEN -- asynchronous reset (active low)
247 clk_25 <= '0';
247 clk_25 <= '0';
248 rstn_25 <= '0';
248 rstn_25 <= '0';
249 rstn_25_d1 <= '0';
249 rstn_25_d1 <= '0';
250 rstn_25_d2 <= '0';
250 rstn_25_d2 <= '0';
251 rstn_25_d3 <= '0';
251 rstn_25_d3 <= '0';
252 ELSIF clk_50_s'event AND clk_50_s = '1' THEN -- rising clock edge
252 ELSIF clk_50_s'event AND clk_50_s = '1' THEN -- rising clock edge
253 clk_25 <= NOT clk_25;
253 clk_25 <= NOT clk_25;
254 rstn_25_d1 <= '1';
254 rstn_25_d1 <= '1';
255 rstn_25_d2 <= rstn_25_d1;
255 rstn_25_d2 <= rstn_25_d1;
256 rstn_25_d3 <= rstn_25_d2;
256 rstn_25_d3 <= rstn_25_d2;
257 rstn_25 <= rstn_25_d3;
257 rstn_25 <= rstn_25_d3;
258 END IF;
258 END IF;
259 END PROCESS;
259 END PROCESS;
260
260
261 PROCESS (clk_49, reset)
261 PROCESS (clk_49, reset)
262 BEGIN -- PROCESS
262 BEGIN -- PROCESS
263 IF reset = '0' THEN -- asynchronous reset (active low)
263 IF reset = '0' THEN -- asynchronous reset (active low)
264 clk_24 <= '0';
264 clk_24 <= '0';
265 ELSIF clk_49'event AND clk_49 = '1' THEN -- rising clock edge
265 ELSIF clk_49'event AND clk_49 = '1' THEN -- rising clock edge
266 clk_24 <= NOT clk_24;
266 clk_24 <= NOT clk_24;
267 END IF;
267 END IF;
268 END PROCESS;
268 END PROCESS;
269
269
270 -----------------------------------------------------------------------------
270 -----------------------------------------------------------------------------
271
271
272 PROCESS (clk_25, rstn_25)
272 PROCESS (clk_25, rstn_25)
273 BEGIN -- PROCESS
273 BEGIN -- PROCESS
274 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
274 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
275 LED0 <= '0';
275 LED0 <= '0';
276 LED1 <= '0';
276 LED1 <= '0';
277 LED2 <= '0';
277 LED2 <= '0';
278 --IO1 <= '0';
278 --IO1 <= '0';
279 --IO2 <= '1';
279 --IO2 <= '1';
280 --IO3 <= '0';
280 --IO3 <= '0';
281 --IO4 <= '0';
281 --IO4 <= '0';
282 --IO5 <= '0';
282 --IO5 <= '0';
283 --IO6 <= '0';
283 --IO6 <= '0';
284 --IO7 <= '0';
284 --IO7 <= '0';
285 --IO8 <= '0';
285 --IO8 <= '0';
286 --IO9 <= '0';
286 --IO9 <= '0';
287 --IO10 <= '0';
287 --IO10 <= '0';
288 --IO11 <= '0';
288 --IO11 <= '0';
289 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
289 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
290 LED0 <= '0';
290 LED0 <= '0';
291 LED1 <= '1';
291 LED1 <= '1';
292 LED2 <= BP0 OR BP1 OR nDTR2 OR nRTS2 OR nRTS1;
292 LED2 <= BP0 OR BP1 OR nDTR2 OR nRTS2 OR nRTS1;
293 --IO1 <= '1';
293 --IO1 <= '1';
294 --IO2 <= SPW_NOM_DIN OR SPW_NOM_SIN OR SPW_RED_DIN OR SPW_RED_SIN;
294 --IO2 <= SPW_NOM_DIN OR SPW_NOM_SIN OR SPW_RED_DIN OR SPW_RED_SIN;
295 --IO3 <= ADC_SDO(0);
295 --IO3 <= ADC_SDO(0);
296 --IO4 <= ADC_SDO(1);
296 --IO4 <= ADC_SDO(1);
297 --IO5 <= ADC_SDO(2);
297 --IO5 <= ADC_SDO(2);
298 --IO6 <= ADC_SDO(3);
298 --IO6 <= ADC_SDO(3);
299 --IO7 <= ADC_SDO(4);
299 --IO7 <= ADC_SDO(4);
300 --IO8 <= ADC_SDO(5);
300 --IO8 <= ADC_SDO(5);
301 --IO9 <= ADC_SDO(6);
301 --IO9 <= ADC_SDO(6);
302 --IO10 <= ADC_SDO(7);
302 --IO10 <= ADC_SDO(7);
303 --IO11 <= BP1 OR nDTR2 OR nRTS2 OR nRTS1;
303 --IO11 <= BP1 OR nDTR2 OR nRTS2 OR nRTS1;
304 END IF;
304 END IF;
305 END PROCESS;
305 END PROCESS;
306
306
307 PROCESS (clk_24, rstn_25)
307 PROCESS (clk_24, rstn_25)
308 BEGIN -- PROCESS
308 BEGIN -- PROCESS
309 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
309 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
310 I00_s <= '0';
310 I00_s <= '0';
311 ELSIF clk_24'EVENT AND clk_24 = '1' THEN -- rising clock edge
311 ELSIF clk_24'EVENT AND clk_24 = '1' THEN -- rising clock edge
312 I00_s <= NOT I00_s ;
312 I00_s <= NOT I00_s ;
313 END IF;
313 END IF;
314 END PROCESS;
314 END PROCESS;
315 -- IO0 <= I00_s;
315 -- IO0 <= I00_s;
316
316
317 --UARTs
317 --UARTs
318 nCTS1 <= '1';
318 nCTS1 <= '1';
319 nCTS2 <= '1';
319 nCTS2 <= '1';
320 nDCD2 <= '1';
320 nDCD2 <= '1';
321
321
322 --EXT CONNECTOR
322 --EXT CONNECTOR
323
323
324 --SPACE WIRE
324 --SPACE WIRE
325
325
326 leon3_soc_1 : leon3_soc
326 leon3_soc_1 : leon3_soc
327 GENERIC MAP (
327 GENERIC MAP (
328 fabtech => apa3e,
328 fabtech => apa3e,
329 memtech => apa3e,
329 memtech => apa3e,
330 padtech => inferred,
330 padtech => inferred,
331 clktech => inferred,
331 clktech => inferred,
332 disas => 0,
332 disas => 0,
333 dbguart => 0,
333 dbguart => 0,
334 pclow => 2,
334 pclow => 2,
335 clk_freq => 25000,
335 clk_freq => 25000,
336 NB_CPU => 1,
336 NB_CPU => 1,
337 ENABLE_FPU => 1,
337 ENABLE_FPU => 1,
338 FPU_NETLIST => 0,
338 FPU_NETLIST => 0,
339 ENABLE_DSU => 1,
339 ENABLE_DSU => 1,
340 ENABLE_AHB_UART => 1,
340 ENABLE_AHB_UART => 1,
341 ENABLE_APB_UART => 1,
341 ENABLE_APB_UART => 1,
342 ENABLE_IRQMP => 1,
342 ENABLE_IRQMP => 1,
343 ENABLE_GPT => 1,
343 ENABLE_GPT => 1,
344 NB_AHB_MASTER => NB_AHB_MASTER,
344 NB_AHB_MASTER => NB_AHB_MASTER,
345 NB_AHB_SLAVE => NB_AHB_SLAVE,
345 NB_AHB_SLAVE => NB_AHB_SLAVE,
346 NB_APB_SLAVE => NB_APB_SLAVE,
346 NB_APB_SLAVE => NB_APB_SLAVE,
347 ADDRESS_SIZE => 20)
347 ADDRESS_SIZE => 20)
348 PORT MAP (
348 PORT MAP (
349 clk => clk_25,
349 clk => clk_25,
350 reset => rstn_25,
350 reset => rstn_25,
351 errorn => errorn,
351 errorn => errorn,
352 ahbrxd => TXD1,
352 ahbrxd => TXD1,
353 ahbtxd => RXD1,
353 ahbtxd => RXD1,
354 urxd1 => TXD2,
354 urxd1 => TXD2,
355 utxd1 => RXD2,
355 utxd1 => RXD2,
356 address => SRAM_A,
356 address => SRAM_A,
357 data => SRAM_DQ,
357 data => SRAM_DQ,
358 nSRAM_BE0 => SRAM_nBE(0),
358 nSRAM_BE0 => SRAM_nBE(0),
359 nSRAM_BE1 => SRAM_nBE(1),
359 nSRAM_BE1 => SRAM_nBE(1),
360 nSRAM_BE2 => SRAM_nBE(2),
360 nSRAM_BE2 => SRAM_nBE(2),
361 nSRAM_BE3 => SRAM_nBE(3),
361 nSRAM_BE3 => SRAM_nBE(3),
362 nSRAM_WE => SRAM_nWE,
362 nSRAM_WE => SRAM_nWE,
363 nSRAM_CE => SRAM_CE,
363 nSRAM_CE => SRAM_CE,
364 nSRAM_OE => SRAM_nOE,
364 nSRAM_OE => SRAM_nOE,
365
365
366 apbi_ext => apbi_ext,
366 apbi_ext => apbi_ext,
367 apbo_ext => apbo_ext,
367 apbo_ext => apbo_ext,
368 ahbi_s_ext => ahbi_s_ext,
368 ahbi_s_ext => ahbi_s_ext,
369 ahbo_s_ext => ahbo_s_ext,
369 ahbo_s_ext => ahbo_s_ext,
370 ahbi_m_ext => ahbi_m_ext,
370 ahbi_m_ext => ahbi_m_ext,
371 ahbo_m_ext => ahbo_m_ext);
371 ahbo_m_ext => ahbo_m_ext);
372
372
373 -------------------------------------------------------------------------------
373 -------------------------------------------------------------------------------
374 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
374 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
375 -------------------------------------------------------------------------------
375 -------------------------------------------------------------------------------
376 apb_lfr_time_management_1 : apb_lfr_time_management
376 apb_lfr_time_management_1 : apb_lfr_time_management
377 GENERIC MAP (
377 GENERIC MAP (
378 pindex => 6,
378 pindex => 6,
379 paddr => 6,
379 paddr => 6,
380 pmask => 16#fff#,
380 pmask => 16#fff#,
381 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
381 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
382 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
382 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
383 PORT MAP (
383 PORT MAP (
384 clk25MHz => clk_25,
384 clk25MHz => clk_25,
385 clk24_576MHz => clk_24, -- 49.152MHz/2
385 clk24_576MHz => clk_24, -- 49.152MHz/2
386 resetn => rstn_25,
386 resetn => rstn_25,
387 grspw_tick => swno.tickout,
387 grspw_tick => swno.tickout,
388 apbi => apbi_ext,
388 apbi => apbi_ext,
389 apbo => apbo_ext(6),
389 apbo => apbo_ext(6),
390 coarse_time => coarse_time,
390 coarse_time => coarse_time,
391 fine_time => fine_time,
391 fine_time => fine_time,
392 LFR_soft_rstn => LFR_soft_rstn
392 LFR_soft_rstn => LFR_soft_rstn
393 );
393 );
394
394
395 -----------------------------------------------------------------------
395 -----------------------------------------------------------------------
396 --- SpaceWire --------------------------------------------------------
396 --- SpaceWire --------------------------------------------------------
397 -----------------------------------------------------------------------
397 -----------------------------------------------------------------------
398
398
399 SPW_EN <= '1';
399 SPW_EN <= '1';
400
400
401 spw_clk <= clk_50_s;
401 spw_clk <= clk_50_s;
402 spw_rxtxclk <= spw_clk;
402 spw_rxtxclk <= spw_clk;
403 spw_rxclkn <= NOT spw_rxtxclk;
403 spw_rxclkn <= NOT spw_rxtxclk;
404
404
405 -- PADS for SPW1
405 -- PADS for SPW1
406 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
406 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
407 PORT MAP (SPW_NOM_DIN, dtmp(0));
407 PORT MAP (SPW_NOM_DIN, dtmp(0));
408 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
408 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
409 PORT MAP (SPW_NOM_SIN, stmp(0));
409 PORT MAP (SPW_NOM_SIN, stmp(0));
410 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
410 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
411 PORT MAP (SPW_NOM_DOUT, swno.d(0));
411 PORT MAP (SPW_NOM_DOUT, swno.d(0));
412 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
412 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
413 PORT MAP (SPW_NOM_SOUT, swno.s(0));
413 PORT MAP (SPW_NOM_SOUT, swno.s(0));
414 -- PADS FOR SPW2
414 -- PADS FOR SPW2
415 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
415 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
416 PORT MAP (SPW_RED_SIN, dtmp(1));
416 PORT MAP (SPW_RED_SIN, dtmp(1));
417 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
417 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
418 PORT MAP (SPW_RED_DIN, stmp(1));
418 PORT MAP (SPW_RED_DIN, stmp(1));
419 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
419 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
420 PORT MAP (SPW_RED_DOUT, swno.d(1));
420 PORT MAP (SPW_RED_DOUT, swno.d(1));
421 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
421 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
422 PORT MAP (SPW_RED_SOUT, swno.s(1));
422 PORT MAP (SPW_RED_SOUT, swno.s(1));
423
423
424 -- GRSPW PHY
424 -- GRSPW PHY
425 --spw1_input: if CFG_SPW_GRSPW = 1 generate
425 --spw1_input: if CFG_SPW_GRSPW = 1 generate
426 spw_inputloop : FOR j IN 0 TO 1 GENERATE
426 spw_inputloop : FOR j IN 0 TO 1 GENERATE
427 spw_phy0 : grspw_phy
427 spw_phy0 : grspw_phy
428 GENERIC MAP(
428 GENERIC MAP(
429 tech => apa3e,
429 tech => apa3e,
430 rxclkbuftype => 1,
430 rxclkbuftype => 1,
431 scantest => 0)
431 scantest => 0)
432 PORT MAP(
432 PORT MAP(
433 rxrst => swno.rxrst,
433 rxrst => swno.rxrst,
434 di => dtmp(j),
434 di => dtmp(j),
435 si => stmp(j),
435 si => stmp(j),
436 rxclko => spw_rxclk(j),
436 rxclko => spw_rxclk(j),
437 do => swni.d(j),
437 do => swni.d(j),
438 ndo => swni.nd(j*5+4 DOWNTO j*5),
438 ndo => swni.nd(j*5+4 DOWNTO j*5),
439 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
439 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
440 END GENERATE spw_inputloop;
440 END GENERATE spw_inputloop;
441
441
442 swni.rmapnodeaddr <= (others => '0');
443
442 -- SPW core
444 -- SPW core
443 sw0 : grspwm GENERIC MAP(
445 sw0 : grspwm GENERIC MAP(
444 tech => apa3e,
446 tech => apa3e,
445 hindex => 1,
447 hindex => 1,
446 pindex => 5,
448 pindex => 5,
447 paddr => 5,
449 paddr => 5,
448 pirq => 11,
450 pirq => 11,
449 sysfreq => 25000, -- CPU_FREQ
451 sysfreq => 25000, -- CPU_FREQ
450 rmap => 1,
452 rmap => 1,
451 rmapcrc => 1,
453 rmapcrc => 1,
452 fifosize1 => 16,
454 fifosize1 => 16,
453 fifosize2 => 16,
455 fifosize2 => 16,
454 rxclkbuftype => 1,
456 rxclkbuftype => 1,
455 rxunaligned => 0,
457 rxunaligned => 0,
456 rmapbufs => 4,
458 rmapbufs => 4,
457 ft => 0,
459 ft => 0,
458 netlist => 0,
460 netlist => 0,
459 ports => 2,
461 ports => 2,
460 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
462 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
461 memtech => apa3e,
463 memtech => apa3e,
462 destkey => 2,
464 destkey => 2,
463 spwcore => 1
465 spwcore => 1
464 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
466 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
465 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
467 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
466 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
468 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
467 )
469 )
468 PORT MAP(rstn_25, clk_25, spw_rxclk(0),
470 PORT MAP(rstn_25, clk_25, spw_rxclk(0),
469 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
471 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
470 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
472 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
471 swni, swno);
473 swni, swno);
472
474
473 swni.tickin <= '0';
475 swni.tickin <= '0';
474 swni.rmapen <= '1';
476 swni.rmapen <= '1';
475 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
477 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
476 swni.tickinraw <= '0';
478 swni.tickinraw <= '0';
477 swni.timein <= (OTHERS => '0');
479 swni.timein <= (OTHERS => '0');
478 swni.dcrstval <= (OTHERS => '0');
480 swni.dcrstval <= (OTHERS => '0');
479 swni.timerrstval <= (OTHERS => '0');
481 swni.timerrstval <= (OTHERS => '0');
480
482
481 -------------------------------------------------------------------------------
483 -------------------------------------------------------------------------------
482 -- LFR ------------------------------------------------------------------------
484 -- LFR ------------------------------------------------------------------------
483 -------------------------------------------------------------------------------
485 -------------------------------------------------------------------------------
484
486
485
487
486 --LFR_rstn <= LFR_soft_rstn AND rstn_25;
488 --LFR_rstn <= LFR_soft_rstn AND rstn_25;
487 LFR_rstn <= rstn_25;
489 LFR_rstn <= rstn_25;
488
490
489 lpp_lfr_1 : lpp_lfr
491 lpp_lfr_1 : lpp_lfr
490 GENERIC MAP (
492 GENERIC MAP (
491 Mem_use => use_RAM,
493 Mem_use => use_RAM,
492 nb_data_by_buffer_size => 32,
494 nb_data_by_buffer_size => 32,
493 nb_snapshot_param_size => 32,
495 nb_snapshot_param_size => 32,
494 delta_vector_size => 32,
496 delta_vector_size => 32,
495 delta_vector_size_f0_2 => 7, -- log2(96)
497 delta_vector_size_f0_2 => 7, -- log2(96)
496 pindex => 15,
498 pindex => 15,
497 paddr => 15,
499 paddr => 15,
498 pmask => 16#fff#,
500 pmask => 16#fff#,
499 pirq_ms => 6,
501 pirq_ms => 6,
500 pirq_wfp => 14,
502 pirq_wfp => 14,
501 hindex => 2,
503 hindex => 2,
502 top_lfr_version => X"000122") -- aa.bb.cc version
504 top_lfr_version => X"000122") -- aa.bb.cc version
503 PORT MAP (
505 PORT MAP (
504 clk => clk_25,
506 clk => clk_25,
505 rstn => LFR_rstn,
507 rstn => LFR_rstn,
506 sample_B => sample_s(2 DOWNTO 0),
508 sample_B => sample_s(2 DOWNTO 0),
507 sample_E => sample_s(7 DOWNTO 3),
509 sample_E => sample_s(7 DOWNTO 3),
508 sample_val => sample_val,
510 sample_val => sample_val,
509 apbi => apbi_ext,
511 apbi => apbi_ext,
510 apbo => apbo_ext(15),
512 apbo => apbo_ext(15),
511 ahbi => ahbi_m_ext,
513 ahbi => ahbi_m_ext,
512 ahbo => ahbo_m_ext(2),
514 ahbo => ahbo_m_ext(2),
513 coarse_time => coarse_time,
515 coarse_time => coarse_time,
514 fine_time => fine_time,
516 fine_time => fine_time,
515 data_shaping_BW => bias_fail_sw_sig);
517 data_shaping_BW => bias_fail_sw_sig);
516
518
519 observation_reg <= (others => '0');
520 observation_vector_0 <= (others => '0');
521 observation_vector_1 <= (others => '0');
522
517 all_sample: FOR I IN 7 DOWNTO 0 GENERATE
523 all_sample: FOR I IN 7 DOWNTO 0 GENERATE
518 sample_s(I) <= sample(I)(11 DOWNTO 0) & '0' & '0' & '0' & '0';
524 sample_s(I) <= sample(I)(11 DOWNTO 0) & '0' & '0' & '0' & '0';
519 END GENERATE all_sample;
525 END GENERATE all_sample;
520
526
521
522
523 top_ad_conv_ADS7886_v2_1 : top_ad_conv_ADS7886_v2
527 top_ad_conv_ADS7886_v2_1 : top_ad_conv_ADS7886_v2
524 GENERIC MAP(
528 GENERIC MAP(
525 ChannelCount => 8,
529 ChannelCount => 8,
526 SampleNbBits => 14,
530 SampleNbBits => 14,
527 ncycle_cnv_high => 40, -- at least 32 cycles at 25 MHz, 32 * 49.152 / 25 /2 = 31.5
531 ncycle_cnv_high => 40, -- at least 32 cycles at 25 MHz, 32 * 49.152 / 25 /2 = 31.5
528 ncycle_cnv => 249) -- 49 152 000 / 98304 /2
532 ncycle_cnv => 249) -- 49 152 000 / 98304 /2
529 PORT MAP (
533 PORT MAP (
530 -- CONV
534 -- CONV
531 cnv_clk => clk_24,
535 cnv_clk => clk_24,
532 cnv_rstn => rstn_25,
536 cnv_rstn => rstn_25,
533 cnv => ADC_nCS_sig,
537 cnv => ADC_nCS_sig,
534 -- DATA
538 -- DATA
535 clk => clk_25,
539 clk => clk_25,
536 rstn => rstn_25,
540 rstn => rstn_25,
537 sck => ADC_CLK_sig,
541 sck => ADC_CLK_sig,
538 sdo => ADC_SDO_sig,
542 sdo => ADC_SDO_sig,
539 -- SAMPLE
543 -- SAMPLE
540 sample => sample,
544 sample => sample,
541 sample_val => sample_val);
545 sample_val => sample_val);
542
546
543 --IO10 <= ADC_SDO_sig(5);
547 --IO10 <= ADC_SDO_sig(5);
544 --IO9 <= ADC_SDO_sig(4);
548 --IO9 <= ADC_SDO_sig(4);
545 --IO8 <= ADC_SDO_sig(3);
549 --IO8 <= ADC_SDO_sig(3);
546
550
547 ADC_nCS <= ADC_nCS_sig;
551 ADC_nCS <= ADC_nCS_sig;
548 ADC_CLK <= ADC_CLK_sig;
552 ADC_CLK <= ADC_CLK_sig;
549 ADC_SDO_sig <= ADC_SDO;
553 ADC_SDO_sig <= ADC_SDO;
550
554
551 ----------------------------------------------------------------------
555 ----------------------------------------------------------------------
552 --- GPIO -----------------------------------------------------------
556 --- GPIO -----------------------------------------------------------
553 ----------------------------------------------------------------------
557 ----------------------------------------------------------------------
554
558
555 grgpio0 : grgpio
559 grgpio0 : grgpio
556 GENERIC MAP(pindex => 11, paddr => 11, imask => 16#0000#, nbits => 8)
560 GENERIC MAP(pindex => 11, paddr => 11, imask => 16#0000#, nbits => 8)
557 PORT MAP(rstn_25, clk_25, apbi_ext, apbo_ext(11), gpioi, gpioo);
561 PORT MAP(rstn_25, clk_25, apbi_ext, apbo_ext(11), gpioi, gpioo);
558
562
563 gpioi.sig_en <= (others => '0');
564 gpioi.sig_in <= (others => '0');
565 gpioi.din <= (others => '0');
559 --pio_pad_0 : iopad
566 --pio_pad_0 : iopad
560 -- GENERIC MAP (tech => CFG_PADTECH)
567 -- GENERIC MAP (tech => CFG_PADTECH)
561 -- PORT MAP (IO0, gpioo.dout(0), gpioo.oen(0), gpioi.din(0));
568 -- PORT MAP (IO0, gpioo.dout(0), gpioo.oen(0), gpioi.din(0));
562 --pio_pad_1 : iopad
569 --pio_pad_1 : iopad
563 -- GENERIC MAP (tech => CFG_PADTECH)
570 -- GENERIC MAP (tech => CFG_PADTECH)
564 -- PORT MAP (IO1, gpioo.dout(1), gpioo.oen(1), gpioi.din(1));
571 -- PORT MAP (IO1, gpioo.dout(1), gpioo.oen(1), gpioi.din(1));
565 --pio_pad_2 : iopad
572 --pio_pad_2 : iopad
566 -- GENERIC MAP (tech => CFG_PADTECH)
573 -- GENERIC MAP (tech => CFG_PADTECH)
567 -- PORT MAP (IO2, gpioo.dout(2), gpioo.oen(2), gpioi.din(2));
574 -- PORT MAP (IO2, gpioo.dout(2), gpioo.oen(2), gpioi.din(2));
568 --pio_pad_3 : iopad
575 --pio_pad_3 : iopad
569 -- GENERIC MAP (tech => CFG_PADTECH)
576 -- GENERIC MAP (tech => CFG_PADTECH)
570 -- PORT MAP (IO3, gpioo.dout(3), gpioo.oen(3), gpioi.din(3));
577 -- PORT MAP (IO3, gpioo.dout(3), gpioo.oen(3), gpioi.din(3));
571 --pio_pad_4 : iopad
578 --pio_pad_4 : iopad
572 -- GENERIC MAP (tech => CFG_PADTECH)
579 -- GENERIC MAP (tech => CFG_PADTECH)
573 -- PORT MAP (IO4, gpioo.dout(4), gpioo.oen(4), gpioi.din(4));
580 -- PORT MAP (IO4, gpioo.dout(4), gpioo.oen(4), gpioi.din(4));
574 --pio_pad_5 : iopad
581 --pio_pad_5 : iopad
575 -- GENERIC MAP (tech => CFG_PADTECH)
582 -- GENERIC MAP (tech => CFG_PADTECH)
576 -- PORT MAP (IO5, gpioo.dout(5), gpioo.oen(5), gpioi.din(5));
583 -- PORT MAP (IO5, gpioo.dout(5), gpioo.oen(5), gpioi.din(5));
577 --pio_pad_6 : iopad
584 --pio_pad_6 : iopad
578 -- GENERIC MAP (tech => CFG_PADTECH)
585 -- GENERIC MAP (tech => CFG_PADTECH)
579 -- PORT MAP (IO6, gpioo.dout(6), gpioo.oen(6), gpioi.din(6));
586 -- PORT MAP (IO6, gpioo.dout(6), gpioo.oen(6), gpioi.din(6));
580 --pio_pad_7 : iopad
587 --pio_pad_7 : iopad
581 -- GENERIC MAP (tech => CFG_PADTECH)
588 -- GENERIC MAP (tech => CFG_PADTECH)
582 -- PORT MAP (IO7, gpioo.dout(7), gpioo.oen(7), gpioi.din(7));
589 -- PORT MAP (IO7, gpioo.dout(7), gpioo.oen(7), gpioi.din(7));
583
590
584 PROCESS (clk_25, rstn_25)
591 PROCESS (clk_25, rstn_25)
585 BEGIN -- PROCESS
592 BEGIN -- PROCESS
586 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
593 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
587 IO0 <= '0';
594 IO0 <= '0';
588 IO1 <= '0';
595 IO1 <= '0';
589 IO2 <= '0';
596 IO2 <= '0';
590 IO3 <= '0';
597 IO3 <= '0';
591 IO4 <= '0';
598 IO4 <= '0';
592 IO5 <= '0';
599 IO5 <= '0';
593 IO6 <= '0';
600 IO6 <= '0';
594 IO7 <= '0';
601 IO7 <= '0';
595 IO8 <= '0';
602 IO8 <= '0';
596 IO9 <= '0';
603 IO9 <= '0';
597 IO10 <= '0';
604 IO10 <= '0';
598 IO11 <= '0';
605 IO11 <= '0';
599 ELSIF clk_25'event AND clk_25 = '1' THEN -- rising clock edge
606 ELSIF clk_25'event AND clk_25 = '1' THEN -- rising clock edge
600 CASE gpioo.dout(2 DOWNTO 0) IS
607 CASE gpioo.dout(2 DOWNTO 0) IS
601 WHEN "011" =>
608 WHEN "011" =>
602 IO0 <= observation_reg(0 );
609 IO0 <= observation_reg(0 );
603 IO1 <= observation_reg(1 );
610 IO1 <= observation_reg(1 );
604 IO2 <= observation_reg(2 );
611 IO2 <= observation_reg(2 );
605 IO3 <= observation_reg(3 );
612 IO3 <= observation_reg(3 );
606 IO4 <= observation_reg(4 );
613 IO4 <= observation_reg(4 );
607 IO5 <= observation_reg(5 );
614 IO5 <= observation_reg(5 );
608 IO6 <= observation_reg(6 );
615 IO6 <= observation_reg(6 );
609 IO7 <= observation_reg(7 );
616 IO7 <= observation_reg(7 );
610 IO8 <= observation_reg(8 );
617 IO8 <= observation_reg(8 );
611 IO9 <= observation_reg(9 );
618 IO9 <= observation_reg(9 );
612 IO10 <= observation_reg(10);
619 IO10 <= observation_reg(10);
613 IO11 <= observation_reg(11);
620 IO11 <= observation_reg(11);
614 WHEN "001" =>
621 WHEN "001" =>
615 IO0 <= observation_reg(0 + 12);
622 IO0 <= observation_reg(0 + 12);
616 IO1 <= observation_reg(1 + 12);
623 IO1 <= observation_reg(1 + 12);
617 IO2 <= observation_reg(2 + 12);
624 IO2 <= observation_reg(2 + 12);
618 IO3 <= observation_reg(3 + 12);
625 IO3 <= observation_reg(3 + 12);
619 IO4 <= observation_reg(4 + 12);
626 IO4 <= observation_reg(4 + 12);
620 IO5 <= observation_reg(5 + 12);
627 IO5 <= observation_reg(5 + 12);
621 IO6 <= observation_reg(6 + 12);
628 IO6 <= observation_reg(6 + 12);
622 IO7 <= observation_reg(7 + 12);
629 IO7 <= observation_reg(7 + 12);
623 IO8 <= observation_reg(8 + 12);
630 IO8 <= observation_reg(8 + 12);
624 IO9 <= observation_reg(9 + 12);
631 IO9 <= observation_reg(9 + 12);
625 IO10 <= observation_reg(10 + 12);
632 IO10 <= observation_reg(10 + 12);
626 IO11 <= observation_reg(11 + 12);
633 IO11 <= observation_reg(11 + 12);
627 WHEN "010" =>
634 WHEN "010" =>
628 IO0 <= observation_reg(0 + 12 + 12);
635 IO0 <= observation_reg(0 + 12 + 12);
629 IO1 <= observation_reg(1 + 12 + 12);
636 IO1 <= observation_reg(1 + 12 + 12);
630 IO2 <= observation_reg(2 + 12 + 12);
637 IO2 <= observation_reg(2 + 12 + 12);
631 IO3 <= observation_reg(3 + 12 + 12);
638 IO3 <= observation_reg(3 + 12 + 12);
632 IO4 <= observation_reg(4 + 12 + 12);
639 IO4 <= observation_reg(4 + 12 + 12);
633 IO5 <= observation_reg(5 + 12 + 12);
640 IO5 <= observation_reg(5 + 12 + 12);
634 IO6 <= observation_reg(6 + 12 + 12);
641 IO6 <= observation_reg(6 + 12 + 12);
635 IO7 <= observation_reg(7 + 12 + 12);
642 IO7 <= observation_reg(7 + 12 + 12);
636 IO8 <= '0';
643 IO8 <= '0';
637 IO9 <= '0';
644 IO9 <= '0';
638 IO10 <= '0';
645 IO10 <= '0';
639 IO11 <= '0';
646 IO11 <= '0';
640 WHEN "000" =>
647 WHEN "000" =>
641 IO0 <= observation_vector_0(0 );
648 IO0 <= observation_vector_0(0 );
642 IO1 <= observation_vector_0(1 );
649 IO1 <= observation_vector_0(1 );
643 IO2 <= observation_vector_0(2 );
650 IO2 <= observation_vector_0(2 );
644 IO3 <= observation_vector_0(3 );
651 IO3 <= observation_vector_0(3 );
645 IO4 <= observation_vector_0(4 );
652 IO4 <= observation_vector_0(4 );
646 IO5 <= observation_vector_0(5 );
653 IO5 <= observation_vector_0(5 );
647 IO6 <= observation_vector_0(6 );
654 IO6 <= observation_vector_0(6 );
648 IO7 <= observation_vector_0(7 );
655 IO7 <= observation_vector_0(7 );
649 IO8 <= observation_vector_0(8 );
656 IO8 <= observation_vector_0(8 );
650 IO9 <= observation_vector_0(9 );
657 IO9 <= observation_vector_0(9 );
651 IO10 <= observation_vector_0(10);
658 IO10 <= observation_vector_0(10);
652 IO11 <= observation_vector_0(11);
659 IO11 <= observation_vector_0(11);
653 WHEN "100" =>
660 WHEN "100" =>
654 IO0 <= observation_vector_1(0 );
661 IO0 <= observation_vector_1(0 );
655 IO1 <= observation_vector_1(1 );
662 IO1 <= observation_vector_1(1 );
656 IO2 <= observation_vector_1(2 );
663 IO2 <= observation_vector_1(2 );
657 IO3 <= observation_vector_1(3 );
664 IO3 <= observation_vector_1(3 );
658 IO4 <= observation_vector_1(4 );
665 IO4 <= observation_vector_1(4 );
659 IO5 <= observation_vector_1(5 );
666 IO5 <= observation_vector_1(5 );
660 IO6 <= observation_vector_1(6 );
667 IO6 <= observation_vector_1(6 );
661 IO7 <= observation_vector_1(7 );
668 IO7 <= observation_vector_1(7 );
662 IO8 <= observation_vector_1(8 );
669 IO8 <= observation_vector_1(8 );
663 IO9 <= observation_vector_1(9 );
670 IO9 <= observation_vector_1(9 );
664 IO10 <= observation_vector_1(10);
671 IO10 <= observation_vector_1(10);
665 IO11 <= observation_vector_1(11);
672 IO11 <= observation_vector_1(11);
666 WHEN OTHERS => NULL;
673 WHEN OTHERS => NULL;
667 END CASE;
674 END CASE;
668
675
669 END IF;
676 END IF;
670 END PROCESS;
677 END PROCESS;
671 -----------------------------------------------------------------------------
678 -----------------------------------------------------------------------------
672 --
679 --
673 -----------------------------------------------------------------------------
680 -----------------------------------------------------------------------------
674 all_apbo_ext: FOR I IN NB_APB_SLAVE-1+5 DOWNTO 5 GENERATE
681 all_apbo_ext: FOR I IN NB_APB_SLAVE-1+5 DOWNTO 5 GENERATE
675 apbo_ext_not_used: IF I /= 5 AND I /= 6 AND I /= 11 AND I /= 15 GENERATE
682 apbo_ext_not_used: IF I /= 5 AND I /= 6 AND I /= 11 AND I /= 15 GENERATE
676 apbo_ext(I) <= apb_none;
683 apbo_ext(I) <= apb_none;
677 END GENERATE apbo_ext_not_used;
684 END GENERATE apbo_ext_not_used;
678 END GENERATE all_apbo_ext;
685 END GENERATE all_apbo_ext;
679
686
680
687
681 all_ahbo_ext: FOR I IN NB_AHB_SLAVE-1+3 DOWNTO 3 GENERATE
688 all_ahbo_ext: FOR I IN NB_AHB_SLAVE-1+3 DOWNTO 3 GENERATE
682 ahbo_s_ext(I) <= ahbs_none;
689 ahbo_s_ext(I) <= ahbs_none;
683 END GENERATE all_ahbo_ext;
690 END GENERATE all_ahbo_ext;
684
691
685 all_ahbo_m_ext: FOR I IN NB_AHB_MASTER-1+1 DOWNTO 1 GENERATE
692 all_ahbo_m_ext: FOR I IN NB_AHB_MASTER-1+1 DOWNTO 1 GENERATE
686 ahbo_m_ext_not_used: IF I /=1 AND I /= 2 GENERATE
693 ahbo_m_ext_not_used: IF I /=1 AND I /= 2 GENERATE
687 ahbo_m_ext(I) <= ahbm_none;
694 ahbo_m_ext(I) <= ahbm_none;
688 END GENERATE ahbo_m_ext_not_used;
695 END GENERATE ahbo_m_ext_not_used;
689 END GENERATE all_ahbo_m_ext;
696 END GENERATE all_ahbo_m_ext;
690
697
691 END beh;
698 END beh; No newline at end of file
This diff has been collapsed as it changes many lines, (543 lines changed) Show them Hide them
@@ -1,270 +1,273
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 use IEEE.std_logic_textio.all;
4 use IEEE.std_logic_textio.all;
5 LIBRARY STD;
5 LIBRARY STD;
6 use std.textio.all;
6 use std.textio.all;
7
7
8 LIBRARY grlib;
8 LIBRARY grlib;
9 USE grlib.stdlib.ALL;
9 USE grlib.stdlib.ALL;
10 LIBRARY gaisler;
10 LIBRARY gaisler;
11 USE gaisler.libdcom.ALL;
11 USE gaisler.libdcom.ALL;
12 USE gaisler.sim.ALL;
12 USE gaisler.sim.ALL;
13 USE gaisler.jtagtst.ALL;
13 USE gaisler.jtagtst.ALL;
14 LIBRARY techmap;
14 LIBRARY techmap;
15 USE techmap.gencomp.ALL;
15 USE techmap.gencomp.ALL;
16
16
17 LIBRARY lpp;
17 LIBRARY lpp;
18 USE lpp.lpp_sim_pkg.ALL;
18 USE lpp.lpp_sim_pkg.ALL;
19 USE lpp.lpp_lfr_apbreg_pkg.ALL;
19 USE lpp.lpp_lfr_apbreg_pkg.ALL;
20 USE lpp.lpp_lfr_time_management_apbreg_pkg.ALL;
20 USE lpp.lpp_lfr_time_management_apbreg_pkg.ALL;
21
21
22 ENTITY testbench IS
22 LIBRARY postlayout;
23 END;
23 USE postlayout.ALL;
24
24
25 ARCHITECTURE behav OF testbench IS
25 ENTITY testbench IS
26
26 END;
27 COMPONENT MINI_LFR_top
27
28 PORT (
28 ARCHITECTURE behav OF testbench IS
29 clk_50 : IN STD_LOGIC;
29
30 clk_49 : IN STD_LOGIC;
30 COMPONENT MINI_LFR_top
31 reset : IN STD_LOGIC;
31 PORT (
32 BP0 : IN STD_LOGIC;
32 clk_50 : IN STD_LOGIC;
33 BP1 : IN STD_LOGIC;
33 clk_49 : IN STD_LOGIC;
34 LED0 : OUT STD_LOGIC;
34 reset : IN STD_LOGIC;
35 LED1 : OUT STD_LOGIC;
35 BP0 : IN STD_LOGIC;
36 LED2 : OUT STD_LOGIC;
36 BP1 : IN STD_LOGIC;
37 TXD1 : IN STD_LOGIC;
37 LED0 : OUT STD_LOGIC;
38 RXD1 : OUT STD_LOGIC;
38 LED1 : OUT STD_LOGIC;
39 nCTS1 : OUT STD_LOGIC;
39 LED2 : OUT STD_LOGIC;
40 nRTS1 : IN STD_LOGIC;
40 TXD1 : IN STD_LOGIC;
41 TXD2 : IN STD_LOGIC;
41 RXD1 : OUT STD_LOGIC;
42 RXD2 : OUT STD_LOGIC;
42 nCTS1 : OUT STD_LOGIC;
43 nCTS2 : OUT STD_LOGIC;
43 nRTS1 : IN STD_LOGIC;
44 nDTR2 : IN STD_LOGIC;
44 TXD2 : IN STD_LOGIC;
45 nRTS2 : IN STD_LOGIC;
45 RXD2 : OUT STD_LOGIC;
46 nDCD2 : OUT STD_LOGIC;
46 nCTS2 : OUT STD_LOGIC;
47 IO0 : INOUT STD_LOGIC;
47 nDTR2 : IN STD_LOGIC;
48 IO1 : INOUT STD_LOGIC;
48 nRTS2 : IN STD_LOGIC;
49 IO2 : INOUT STD_LOGIC;
49 nDCD2 : OUT STD_LOGIC;
50 IO3 : INOUT STD_LOGIC;
50 IO0 : INOUT STD_LOGIC;
51 IO4 : INOUT STD_LOGIC;
51 IO1 : INOUT STD_LOGIC;
52 IO5 : INOUT STD_LOGIC;
52 IO2 : INOUT STD_LOGIC;
53 IO6 : INOUT STD_LOGIC;
53 IO3 : INOUT STD_LOGIC;
54 IO7 : INOUT STD_LOGIC;
54 IO4 : INOUT STD_LOGIC;
55 IO8 : INOUT STD_LOGIC;
55 IO5 : INOUT STD_LOGIC;
56 IO9 : INOUT STD_LOGIC;
56 IO6 : INOUT STD_LOGIC;
57 IO10 : INOUT STD_LOGIC;
57 IO7 : INOUT STD_LOGIC;
58 IO11 : INOUT STD_LOGIC;
58 IO8 : INOUT STD_LOGIC;
59 SPW_EN : OUT STD_LOGIC;
59 IO9 : INOUT STD_LOGIC;
60 SPW_NOM_DIN : IN STD_LOGIC;
60 IO10 : INOUT STD_LOGIC;
61 SPW_NOM_SIN : IN STD_LOGIC;
61 IO11 : INOUT STD_LOGIC;
62 SPW_NOM_DOUT : OUT STD_LOGIC;
62 SPW_EN : OUT STD_LOGIC;
63 SPW_NOM_SOUT : OUT STD_LOGIC;
63 SPW_NOM_DIN : IN STD_LOGIC;
64 SPW_RED_DIN : IN STD_LOGIC;
64 SPW_NOM_SIN : IN STD_LOGIC;
65 SPW_RED_SIN : IN STD_LOGIC;
65 SPW_NOM_DOUT : OUT STD_LOGIC;
66 SPW_RED_DOUT : OUT STD_LOGIC;
66 SPW_NOM_SOUT : OUT STD_LOGIC;
67 SPW_RED_SOUT : OUT STD_LOGIC;
67 SPW_RED_DIN : IN STD_LOGIC;
68 ADC_nCS : OUT STD_LOGIC;
68 SPW_RED_SIN : IN STD_LOGIC;
69 ADC_CLK : OUT STD_LOGIC;
69 SPW_RED_DOUT : OUT STD_LOGIC;
70 ADC_SDO : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
70 SPW_RED_SOUT : OUT STD_LOGIC;
71 SRAM_nWE : OUT STD_LOGIC;
71 ADC_nCS : OUT STD_LOGIC;
72 SRAM_CE : OUT STD_LOGIC;
72 ADC_CLK : OUT STD_LOGIC;
73 SRAM_nOE : OUT STD_LOGIC;
73 ADC_SDO : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
74 SRAM_nBE : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
74 SRAM_nWE : OUT STD_LOGIC;
75 SRAM_A : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
75 SRAM_CE : OUT STD_LOGIC;
76 SRAM_DQ : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0));
76 SRAM_nOE : OUT STD_LOGIC;
77 END COMPONENT;
77 SRAM_nBE : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
78
78 SRAM_A : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
79 -----------------------------------------------------------------------------
79 SRAM_DQ : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0));
80 SIGNAL clk_50 : STD_LOGIC := '0';
80 END COMPONENT;
81 SIGNAL clk_49 : STD_LOGIC := '0';
81
82 SIGNAL reset : STD_LOGIC;
82 -----------------------------------------------------------------------------
83 SIGNAL BP0 : STD_LOGIC;
83 SIGNAL clk_50 : STD_LOGIC := '0';
84 SIGNAL BP1 : STD_LOGIC;
84 SIGNAL clk_49 : STD_LOGIC := '0';
85 SIGNAL LED0 : STD_LOGIC;
85 SIGNAL reset : STD_LOGIC;
86 SIGNAL LED1 : STD_LOGIC;
86 SIGNAL BP0 : STD_LOGIC;
87 SIGNAL LED2 : STD_LOGIC;
87 SIGNAL BP1 : STD_LOGIC;
88 SIGNAL TXD1 : STD_LOGIC;
88 SIGNAL LED0 : STD_LOGIC;
89 SIGNAL RXD1 : STD_LOGIC;
89 SIGNAL LED1 : STD_LOGIC;
90 SIGNAL nCTS1 : STD_LOGIC;
90 SIGNAL LED2 : STD_LOGIC;
91 SIGNAL nRTS1 : STD_LOGIC;
91 SIGNAL TXD1 : STD_LOGIC;
92 SIGNAL TXD2 : STD_LOGIC;
92 SIGNAL RXD1 : STD_LOGIC;
93 SIGNAL RXD2 : STD_LOGIC;
93 SIGNAL nCTS1 : STD_LOGIC;
94 SIGNAL nCTS2 : STD_LOGIC;
94 SIGNAL nRTS1 : STD_LOGIC;
95 SIGNAL nDTR2 : STD_LOGIC;
95 SIGNAL TXD2 : STD_LOGIC;
96 SIGNAL nRTS2 : STD_LOGIC;
96 SIGNAL RXD2 : STD_LOGIC;
97 SIGNAL nDCD2 : STD_LOGIC;
97 SIGNAL nCTS2 : STD_LOGIC;
98 SIGNAL IO0 : STD_LOGIC;
98 SIGNAL nDTR2 : STD_LOGIC;
99 SIGNAL IO1 : STD_LOGIC;
99 SIGNAL nRTS2 : STD_LOGIC;
100 SIGNAL IO2 : STD_LOGIC;
100 SIGNAL nDCD2 : STD_LOGIC;
101 SIGNAL IO3 : STD_LOGIC;
101 SIGNAL IO0 : STD_LOGIC;
102 SIGNAL IO4 : STD_LOGIC;
102 SIGNAL IO1 : STD_LOGIC;
103 SIGNAL IO5 : STD_LOGIC;
103 SIGNAL IO2 : STD_LOGIC;
104 SIGNAL IO6 : STD_LOGIC;
104 SIGNAL IO3 : STD_LOGIC;
105 SIGNAL IO7 : STD_LOGIC;
105 SIGNAL IO4 : STD_LOGIC;
106 SIGNAL IO8 : STD_LOGIC;
106 SIGNAL IO5 : STD_LOGIC;
107 SIGNAL IO9 : STD_LOGIC;
107 SIGNAL IO6 : STD_LOGIC;
108 SIGNAL IO10 : STD_LOGIC;
108 SIGNAL IO7 : STD_LOGIC;
109 SIGNAL IO11 : STD_LOGIC;
109 SIGNAL IO8 : STD_LOGIC;
110 SIGNAL SPW_EN : STD_LOGIC;
110 SIGNAL IO9 : STD_LOGIC;
111 SIGNAL SPW_NOM_DIN : STD_LOGIC;
111 SIGNAL IO10 : STD_LOGIC;
112 SIGNAL SPW_NOM_SIN : STD_LOGIC;
112 SIGNAL IO11 : STD_LOGIC;
113 SIGNAL SPW_NOM_DOUT : STD_LOGIC;
113 SIGNAL SPW_EN : STD_LOGIC;
114 SIGNAL SPW_NOM_SOUT : STD_LOGIC;
114 SIGNAL SPW_NOM_DIN : STD_LOGIC;
115 SIGNAL SPW_RED_DIN : STD_LOGIC;
115 SIGNAL SPW_NOM_SIN : STD_LOGIC;
116 SIGNAL SPW_RED_SIN : STD_LOGIC;
116 SIGNAL SPW_NOM_DOUT : STD_LOGIC;
117 SIGNAL SPW_RED_DOUT : STD_LOGIC;
117 SIGNAL SPW_NOM_SOUT : STD_LOGIC;
118 SIGNAL SPW_RED_SOUT : STD_LOGIC;
118 SIGNAL SPW_RED_DIN : STD_LOGIC;
119 SIGNAL ADC_nCS : STD_LOGIC;
119 SIGNAL SPW_RED_SIN : STD_LOGIC;
120 SIGNAL ADC_CLK : STD_LOGIC;
120 SIGNAL SPW_RED_DOUT : STD_LOGIC;
121 SIGNAL ADC_SDO : STD_LOGIC_VECTOR(7 DOWNTO 0);
121 SIGNAL SPW_RED_SOUT : STD_LOGIC;
122 SIGNAL SRAM_nWE : STD_LOGIC;
122 SIGNAL ADC_nCS : STD_LOGIC;
123 SIGNAL SRAM_CE : STD_LOGIC;
123 SIGNAL ADC_CLK : STD_LOGIC;
124 SIGNAL SRAM_nOE : STD_LOGIC;
124 SIGNAL ADC_SDO : STD_LOGIC_VECTOR(7 DOWNTO 0);
125 SIGNAL SRAM_nBE : STD_LOGIC_VECTOR(3 DOWNTO 0);
125 SIGNAL SRAM_nWE : STD_LOGIC;
126 SIGNAL SRAM_A : STD_LOGIC_VECTOR(19 DOWNTO 0);
126 SIGNAL SRAM_CE : STD_LOGIC;
127 SIGNAL SRAM_DQ : STD_LOGIC_VECTOR(31 DOWNTO 0);
127 SIGNAL SRAM_nOE : STD_LOGIC;
128 -----------------------------------------------------------------------------
128 SIGNAL SRAM_nBE : STD_LOGIC_VECTOR(3 DOWNTO 0);
129
129 SIGNAL SRAM_A : STD_LOGIC_VECTOR(19 DOWNTO 0);
130 CONSTANT ADDR_BASE_LFR : STD_LOGIC_VECTOR(31 DOWNTO 8) := X"80000F";
130 SIGNAL SRAM_DQ : STD_LOGIC_VECTOR(31 DOWNTO 0);
131 CONSTANT ADDR_BASE_TIME_MANAGMENT : STD_LOGIC_VECTOR(31 DOWNTO 8) := X"800006";
131 -----------------------------------------------------------------------------
132 CONSTANT ADDR_BASE_GPIO : STD_LOGIC_VECTOR(31 DOWNTO 8) := X"80000B";
132
133
133 CONSTANT ADDR_BASE_LFR : STD_LOGIC_VECTOR(31 DOWNTO 8) := X"80000F";
134
134 CONSTANT ADDR_BASE_TIME_MANAGMENT : STD_LOGIC_VECTOR(31 DOWNTO 8) := X"800006";
135 SIGNAL message_simu : STRING(1 TO 15) := "---------------";
135 CONSTANT ADDR_BASE_GPIO : STD_LOGIC_VECTOR(31 DOWNTO 8) := X"80000B";
136
136
137 BEGIN
137
138
138 SIGNAL message_simu : STRING(1 TO 15) := "---------------";
139 -----------------------------------------------------------------------------
139
140 -- TB
140 BEGIN
141 -----------------------------------------------------------------------------
141
142 PROCESS
142 -----------------------------------------------------------------------------
143 CONSTANT txp : TIME := 320 ns;
143 -- TB
144 BEGIN -- PROCESS
144 -----------------------------------------------------------------------------
145 TXD1 <= '1';
145 PROCESS
146 reset <= '0';
146 CONSTANT txp : TIME := 320 ns;
147 WAIT FOR 500 ns;
147 BEGIN -- PROCESS
148 reset <= '1';
148 TXD1 <= '1';
149 WAIT FOR 10000 ns;
149 reset <= '0';
150 message_simu <= "0 - UART init ";
150 WAIT FOR 500 ns;
151 UART_INIT(TXD1,txp);
151 reset <= '1';
152
152 WAIT FOR 10000 ns;
153 message_simu <= "1 - UART test ";
153 message_simu <= "0 - UART init ";
154 UART_WRITE(TXD1,txp,ADDR_BASE_GPIO & "000010",X"0000FFFF");
154 UART_INIT(TXD1,txp);
155 UART_WRITE(TXD1,txp,ADDR_BASE_GPIO & "000001",X"00000A0A");
155
156 UART_WRITE(TXD1,txp,ADDR_BASE_GPIO & "000001",X"00000B0B");
156 message_simu <= "1 - UART test ";
157
157 UART_WRITE(TXD1,txp,ADDR_BASE_GPIO & "000010",X"0000FFFF");
158 -- UNSET the LFR reset
158 UART_WRITE(TXD1,txp,ADDR_BASE_GPIO & "000001",X"00000A0A");
159 message_simu <= "2 - LFR UNRESET";
159 UART_WRITE(TXD1,txp,ADDR_BASE_GPIO & "000001",X"00000B0B");
160 UART_WRITE(TXD1,txp,ADDR_BASE_TIME_MANAGMENT & ADDR_LFR_TM_CONTROL , X"00000000");
160
161 UART_WRITE(TXD1,txp,ADDR_BASE_TIME_MANAGMENT & ADDR_LFR_TM_TIME_LOAD , X"00000000");
161 -- UNSET the LFR reset
162 --
162 message_simu <= "2 - LFR UNRESET";
163 message_simu <= "3 - LFR CONFIG ";
163 UART_WRITE(TXD1,txp,ADDR_BASE_TIME_MANAGMENT & ADDR_LFR_TM_CONTROL , X"00000000");
164 UART_WRITE(TXD1,txp,ADDR_BASE_LFR & ADDR_LFR_SM_F0_0_ADDR , X"00000B0B");
164 UART_WRITE(TXD1,txp,ADDR_BASE_TIME_MANAGMENT & ADDR_LFR_TM_TIME_LOAD , X"00000000");
165
165 --
166 WAIT;
166 message_simu <= "3 - LFR CONFIG ";
167 END PROCESS;
167 UART_WRITE(TXD1,txp,ADDR_BASE_LFR & ADDR_LFR_SM_F0_0_ADDR , X"00000B0B");
168
168
169 -----------------------------------------------------------------------------
169 WAIT;
170 -- CLOCK
170 END PROCESS;
171 -----------------------------------------------------------------------------
171
172 clk_50 <= NOT clk_50 AFTER 5 ns;
172 -----------------------------------------------------------------------------
173 clk_49 <= NOT clk_49 AFTER 10172 ps;
173 -- CLOCK
174
174 -----------------------------------------------------------------------------
175 -----------------------------------------------------------------------------
175 clk_50 <= NOT clk_50 AFTER 5 ns;
176 -- DON'T CARE
176 clk_49 <= NOT clk_49 AFTER 10172 ps;
177 -----------------------------------------------------------------------------
177
178 BP0 <= '0';
178 -----------------------------------------------------------------------------
179 BP1 <= '0';
179 -- DON'T CARE
180 nRTS1 <= '0' ;
180 -----------------------------------------------------------------------------
181
181 BP0 <= '0';
182 TXD2 <= '1';
182 BP1 <= '0';
183 nRTS2 <= '1';
183 nRTS1 <= '0' ;
184 nDTR2 <= '1';
184
185
185 TXD2 <= '1';
186 SPW_NOM_DIN <= '1';
186 nRTS2 <= '1';
187 SPW_NOM_SIN <= '1';
187 nDTR2 <= '1';
188 SPW_RED_DIN <= '1';
188
189 SPW_RED_SIN <= '1';
189 SPW_NOM_DIN <= '1';
190
190 SPW_NOM_SIN <= '1';
191 ADC_SDO <= x"AA";
191 SPW_RED_DIN <= '1';
192
192 SPW_RED_SIN <= '1';
193 SRAM_DQ <= (OTHERS => 'Z');
193
194 IO0 <= 'Z';
194 ADC_SDO <= x"AA";
195 IO1 <= 'Z';
195
196 IO2 <= 'Z';
196 SRAM_DQ <= (OTHERS => 'Z');
197 IO3 <= 'Z';
197 IO0 <= 'Z';
198 IO4 <= 'Z';
198 IO1 <= 'Z';
199 IO5 <= 'Z';
199 IO2 <= 'Z';
200 IO6 <= 'Z';
200 IO3 <= 'Z';
201 IO7 <= 'Z';
201 IO4 <= 'Z';
202 IO8 <= 'Z';
202 IO5 <= 'Z';
203 IO9 <= 'Z';
203 IO6 <= 'Z';
204 IO10 <= 'Z';
204 IO7 <= 'Z';
205 IO11 <= 'Z';
205 IO8 <= 'Z';
206
206 IO9 <= 'Z';
207 -----------------------------------------------------------------------------
207 IO10 <= 'Z';
208 -- DUT
208 IO11 <= 'Z';
209 -----------------------------------------------------------------------------
209
210 MINI_LFR_top_1: MINI_LFR_top
210 -----------------------------------------------------------------------------
211 PORT MAP (
211 -- DUT
212 clk_50 => clk_50,
212 -----------------------------------------------------------------------------
213 clk_49 => clk_49,
213 MINI_LFR_top_1: MINI_LFR_top
214 reset => reset,
214 PORT MAP (
215
215 clk_50 => clk_50,
216 BP0 => BP0,
216 clk_49 => clk_49,
217 BP1 => BP1,
217 reset => reset,
218
218
219 LED0 => LED0,
219 BP0 => BP0,
220 LED1 => LED1,
220 BP1 => BP1,
221 LED2 => LED2,
221
222
222 LED0 => LED0,
223 TXD1 => TXD1,
223 LED1 => LED1,
224 RXD1 => RXD1,
224 LED2 => LED2,
225 nCTS1 => nCTS1,
225
226 nRTS1 => nRTS1,
226 TXD1 => TXD1,
227
227 RXD1 => RXD1,
228 TXD2 => TXD2,
228 nCTS1 => nCTS1,
229 RXD2 => RXD2,
229 nRTS1 => nRTS1,
230 nCTS2 => nCTS2,
230
231 nDTR2 => nDTR2,
231 TXD2 => TXD2,
232 nRTS2 => nRTS2,
232 RXD2 => RXD2,
233 nDCD2 => nDCD2,
233 nCTS2 => nCTS2,
234
234 nDTR2 => nDTR2,
235 IO0 => IO0,
235 nRTS2 => nRTS2,
236 IO1 => IO1,
236 nDCD2 => nDCD2,
237 IO2 => IO2,
237
238 IO3 => IO3,
238 IO0 => IO0,
239 IO4 => IO4,
239 IO1 => IO1,
240 IO5 => IO5,
240 IO2 => IO2,
241 IO6 => IO6,
241 IO3 => IO3,
242 IO7 => IO7,
242 IO4 => IO4,
243 IO8 => IO8,
243 IO5 => IO5,
244 IO9 => IO9,
244 IO6 => IO6,
245 IO10 => IO10,
245 IO7 => IO7,
246 IO11 => IO11,
246 IO8 => IO8,
247
247 IO9 => IO9,
248 SPW_EN => SPW_EN,
248 IO10 => IO10,
249 SPW_NOM_DIN => SPW_NOM_DIN,
249 IO11 => IO11,
250 SPW_NOM_SIN => SPW_NOM_SIN,
250
251 SPW_NOM_DOUT => SPW_NOM_DOUT,
251 SPW_EN => SPW_EN,
252 SPW_NOM_SOUT => SPW_NOM_SOUT,
252 SPW_NOM_DIN => SPW_NOM_DIN,
253 SPW_RED_DIN => SPW_RED_DIN,
253 SPW_NOM_SIN => SPW_NOM_SIN,
254 SPW_RED_SIN => SPW_RED_SIN,
254 SPW_NOM_DOUT => SPW_NOM_DOUT,
255 SPW_RED_DOUT => SPW_RED_DOUT,
255 SPW_NOM_SOUT => SPW_NOM_SOUT,
256 SPW_RED_SOUT => SPW_RED_SOUT,
256 SPW_RED_DIN => SPW_RED_DIN,
257
257 SPW_RED_SIN => SPW_RED_SIN,
258 ADC_nCS => ADC_nCS,
258 SPW_RED_DOUT => SPW_RED_DOUT,
259 ADC_CLK => ADC_CLK,
259 SPW_RED_SOUT => SPW_RED_SOUT,
260 ADC_SDO => ADC_SDO,
260
261
261 ADC_nCS => ADC_nCS,
262 SRAM_nWE => SRAM_nWE,
262 ADC_CLK => ADC_CLK,
263 SRAM_CE => SRAM_CE,
263 ADC_SDO => ADC_SDO,
264 SRAM_nOE => SRAM_nOE,
264
265 SRAM_nBE => SRAM_nBE,
265 SRAM_nWE => SRAM_nWE,
266 SRAM_A => SRAM_A,
266 SRAM_CE => SRAM_CE,
267 SRAM_DQ => SRAM_DQ);
267 SRAM_nOE => SRAM_nOE,
268
268 SRAM_nBE => SRAM_nBE,
269
269 SRAM_A => SRAM_A,
270 END;
270 SRAM_DQ => SRAM_DQ);
271
272
273 END;
@@ -1,328 +1,327
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 : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@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 lpp;
25 LIBRARY lpp;
26 USE lpp.general_purpose.ALL;
26 USE lpp.general_purpose.ALL;
27 --TODO
27 --TODO
28 --terminer le testbensh puis changer le resize dans les instanciations
28 --terminer le testbensh puis changer le resize dans les instanciations
29 --par un resize sur un vecteur en combi
29 --par un resize sur un vecteur en combi
30
30
31
31
32 ENTITY MAC IS
32 ENTITY MAC IS
33 GENERIC(
33 GENERIC(
34 Input_SZ_A : INTEGER := 8;
34 Input_SZ_A : INTEGER := 8;
35 Input_SZ_B : INTEGER := 8;
35 Input_SZ_B : INTEGER := 8;
36 COMP_EN : INTEGER := 0 -- 1 => No Comp
36 COMP_EN : INTEGER := 0 -- 1 => No Comp
37
37
38 );
38 );
39 PORT(
39 PORT(
40 clk : IN STD_LOGIC;
40 clk : IN STD_LOGIC;
41 reset : IN STD_LOGIC;
41 reset : IN STD_LOGIC;
42 clr_MAC : IN STD_LOGIC;
42 clr_MAC : IN STD_LOGIC;
43 MAC_MUL_ADD : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
43 MAC_MUL_ADD : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
44 Comp_2C : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
44 Comp_2C : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
45 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
45 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
46 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
46 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
47 RES : OUT STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0)
47 RES : OUT STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0)
48 );
48 );
49 END MAC;
49 END MAC;
50
50
51
51
52
52
53
53
54 ARCHITECTURE ar_MAC OF MAC IS
54 ARCHITECTURE ar_MAC OF MAC IS
55
55
56
56
57 SIGNAL clr_MAC_s : STD_LOGIC;
57 SIGNAL clr_MAC_s : STD_LOGIC;
58 SIGNAL MAC_MUL_ADD_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
58 SIGNAL MAC_MUL_ADD_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
59
59
60 SIGNAL add, mult : STD_LOGIC;
60 SIGNAL add, mult : STD_LOGIC;
61 SIGNAL MULTout : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
61 SIGNAL MULTout : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
62
62
63 SIGNAL ADDERinA : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
63 SIGNAL ADDERinA : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
64 SIGNAL ADDERinB : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
64 SIGNAL ADDERinB : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
65 SIGNAL ADDERout : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
65 SIGNAL ADDERout : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
66
66
67 SIGNAL MACMUXsel : STD_LOGIC;
67 SIGNAL MACMUXsel : STD_LOGIC;
68 SIGNAL OP1_2C_D_Resz : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
68 SIGNAL OP1_2C_D_Resz : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
69 SIGNAL OP2_2C_D_Resz : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
69 SIGNAL OP2_2C_D_Resz : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
70
70
71 SIGNAL OP1_2C : STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
71 SIGNAL OP1_2C : STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
72 SIGNAL OP2_2C : STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
72 SIGNAL OP2_2C : STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
73
73
74 SIGNAL MACMUX2sel : STD_LOGIC;
74 SIGNAL MACMUX2sel : STD_LOGIC;
75
75
76 SIGNAL add_D : STD_LOGIC;
76 SIGNAL add_D : STD_LOGIC;
77 SIGNAL OP1_2C_D : STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
77 SIGNAL OP1_2C_D : STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
78 SIGNAL OP2_2C_D : STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
78 SIGNAL OP2_2C_D : STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
79 SIGNAL MULTout_D : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
79 SIGNAL MULTout_D : STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0);
80 SIGNAL MACMUXsel_D : STD_LOGIC;
80 SIGNAL MACMUXsel_D : STD_LOGIC;
81 SIGNAL MACMUX2sel_D : STD_LOGIC;
81 SIGNAL MACMUX2sel_D : STD_LOGIC;
82 SIGNAL MACMUX2sel_D_D : STD_LOGIC;
82 SIGNAL MACMUX2sel_D_D : STD_LOGIC;
83 SIGNAL clr_MAC_D : STD_LOGIC;
83 SIGNAL clr_MAC_D : STD_LOGIC;
84 -- SIGNAL clr_MAC_D_D : STD_LOGIC;
84 -- SIGNAL clr_MAC_D_D : STD_LOGIC;
85 -- SIGNAL MAC_MUL_ADD_2C_D : STD_LOGIC_VECTOR(1 DOWNTO 0);
85 -- SIGNAL MAC_MUL_ADD_2C_D : STD_LOGIC_VECTOR(1 DOWNTO 0);
86
86
87 SIGNAL load_mult_result : STD_LOGIC;
87 -- SIGNAL load_mult_result : STD_LOGIC;
88 SIGNAL load_mult_result_D : STD_LOGIC;
88 -- SIGNAL load_mult_result_D : STD_LOGIC;
89
89
90 BEGIN
90 BEGIN
91
91
92
92
93
93
94
94
95 --==============================================================
95 --==============================================================
96 --=============M A C C O N T R O L E R=========================
96 --=============M A C C O N T R O L E R=========================
97 --==============================================================
97 --==============================================================
98 MAC_CONTROLER1 : MAC_CONTROLER
98 MAC_CONTROLER1 : MAC_CONTROLER
99 PORT MAP(
99 PORT MAP(
100 ctrl => MAC_MUL_ADD_s,
100 ctrl => MAC_MUL_ADD_s,
101 MULT => mult,
101 MULT => mult,
102 ADD => add,
102 ADD => add,
103 LOAD_ADDER => load_mult_result,
103 --LOAD_ADDER => load_mult_result,
104 MACMUX_sel => MACMUXsel,
104 MACMUX_sel => MACMUXsel,
105 MACMUX2_sel => MACMUX2sel
105 MACMUX2_sel => MACMUX2sel
106
106
107 );
107 );
108 --==============================================================
108 --==============================================================
109
109
110
110
111
111
112
112
113 --==============================================================
113 --==============================================================
114 --=============M U L T I P L I E R==============================
114 --=============M U L T I P L I E R==============================
115 --==============================================================
115 --==============================================================
116 Multiplieri_nst : Multiplier
116 Multiplieri_nst : Multiplier
117 GENERIC MAP(
117 GENERIC MAP(
118 Input_SZ_A => Input_SZ_A,
118 Input_SZ_A => Input_SZ_A,
119 Input_SZ_B => Input_SZ_B
119 Input_SZ_B => Input_SZ_B
120 )
120 )
121 PORT MAP(
121 PORT MAP(
122 clk => clk,
122 clk => clk,
123 reset => reset,
123 reset => reset,
124 mult => mult,
124 mult => mult,
125 OP1 => OP1_2C,
125 OP1 => OP1_2C,
126 OP2 => OP2_2C,
126 OP2 => OP2_2C,
127 RES => MULTout
127 RES => MULTout
128 );
128 );
129 --==============================================================
129 --==============================================================
130
130
131 PROCESS (clk, reset)
131 --PROCESS (clk, reset)
132 BEGIN -- PROCESS
132 --BEGIN -- PROCESS
133 IF reset = '0' THEN -- asynchronous reset (active low)
133 -- IF reset = '0' THEN -- asynchronous reset (active low)
134 load_mult_result_D <= '0';
134 -- load_mult_result_D <= '0';
135 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
135 -- ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
136 load_mult_result_D <= load_mult_result;
136 -- load_mult_result_D <= load_mult_result;
137 END IF;
137 -- END IF;
138 END PROCESS;
138 --END PROCESS;
139
139
140 --==============================================================
140 --==============================================================
141 --======================A D D E R ==============================
141 --======================A D D E R ==============================
142 --==============================================================
142 --==============================================================
143 adder_inst : Adder
143 adder_inst : Adder
144 GENERIC MAP(
144 GENERIC MAP(
145 Input_SZ_A => Input_SZ_A+Input_SZ_B,
145 Input_SZ_A => Input_SZ_A+Input_SZ_B,
146 Input_SZ_B => Input_SZ_A+Input_SZ_B
146 Input_SZ_B => Input_SZ_A+Input_SZ_B
147 )
147 )
148 PORT MAP(
148 PORT MAP(
149 clk => clk,
149 clk => clk,
150 reset => reset,
150 reset => reset,
151 clr => clr_MAC_D,
151 clr => clr_MAC_D,
152 load => load_mult_result_D,
152 load => MACMUX2sel_D, --load_mult_result_D,
153 add => add_D,
153 add => add_D,
154 OP1 => ADDERinA,
154 OP1 => ADDERinA,
155 OP2 => ADDERinB,
155 OP2 => ADDERinB,
156 RES => ADDERout
156 RES => ADDERout
157 );
157 );
158
158
159 --==============================================================
159 --==============================================================
160 --===================TWO COMPLEMENTERS==========================
160 --===================TWO COMPLEMENTERS==========================
161 --==============================================================
161 --==============================================================
162 gen_comp : IF COMP_EN = 0 GENERATE
162 gen_comp : IF COMP_EN = 0 GENERATE
163 TWO_COMPLEMENTER1 : TwoComplementer
163 TWO_COMPLEMENTER1 : TwoComplementer
164 GENERIC MAP(
164 GENERIC MAP(
165 Input_SZ => Input_SZ_A
165 Input_SZ => Input_SZ_A
166 )
166 )
167 PORT MAP(
167 PORT MAP(
168 clk => clk,
168 clk => clk,
169 reset => reset,
169 reset => reset,
170 clr => '0',--clr_MAC,
170 clr => '0', --clr_MAC,
171 TwoComp => Comp_2C(0),
171 TwoComp => Comp_2C(0),
172 OP => OP1,
172 OP => OP1,
173 RES => OP1_2C
173 RES => OP1_2C
174 );
174 );
175
175
176 TWO_COMPLEMENTER2 : TwoComplementer
176 TWO_COMPLEMENTER2 : TwoComplementer
177 GENERIC MAP(
177 GENERIC MAP(
178 Input_SZ => Input_SZ_B
178 Input_SZ => Input_SZ_B
179 )
179 )
180 PORT MAP(
180 PORT MAP(
181 clk => clk,
181 clk => clk,
182 reset => reset,
182 reset => reset,
183 clr => '0',--clr_MAC,
183 clr => '0', --clr_MAC,
184 TwoComp => Comp_2C(1),
184 TwoComp => Comp_2C(1),
185 OP => OP2,
185 OP => OP2,
186 RES => OP2_2C
186 RES => OP2_2C
187 );
187 );
188
188
189
190 clr_MACREG_comp : MAC_REG
189 clr_MACREG_comp : MAC_REG
191 GENERIC MAP(size => 1)
190 GENERIC MAP(size => 1)
192 PORT MAP(
191 PORT MAP(
193 reset => reset,
192 reset => reset,
194 clk => clk,
193 clk => clk,
195 D(0) => clr_MAC,
194 D(0) => clr_MAC,
196 Q(0) => clr_MAC_s
195 Q(0) => clr_MAC_s
197 );
196 );
198
197
199 MAC_MUL_ADD_REG : MAC_REG
198 MAC_MUL_ADD_REG : MAC_REG
200 GENERIC MAP(size => 2)
199 GENERIC MAP(size => 2)
201 PORT MAP(
200 PORT MAP(
202 reset => reset,
201 reset => reset,
203 clk => clk,
202 clk => clk,
204 D => MAC_MUL_ADD,
203 D => MAC_MUL_ADD,
205 Q => MAC_MUL_ADD_s
204 Q => MAC_MUL_ADD_s
206 );
205 );
207
206
208 END GENERATE gen_comp;
207 END GENERATE gen_comp;
209
208
210 no_gen_comp : IF COMP_EN = 1 GENERATE
209 no_gen_comp : IF COMP_EN = 1 GENERATE
211 OP2_2C <= OP2;
210 OP2_2C <= OP2;
212 OP1_2C <= OP1;
211 OP1_2C <= OP1;
213
212
214 clr_MAC_s <= clr_MAC;
213 clr_MAC_s <= clr_MAC;
215 MAC_MUL_ADD_s <= MAC_MUL_ADD;
214 MAC_MUL_ADD_s <= MAC_MUL_ADD;
216 END GENERATE no_gen_comp;
215 END GENERATE no_gen_comp;
217 --==============================================================
216 --==============================================================
218
217
219 clr_MACREG1 : MAC_REG
218 clr_MACREG1 : MAC_REG
220 GENERIC MAP(size => 1)
219 GENERIC MAP(size => 1)
221 PORT MAP(
220 PORT MAP(
222 reset => reset,
221 reset => reset,
223 clk => clk,
222 clk => clk,
224 D(0) => clr_MAC_s,
223 D(0) => clr_MAC_s,
225 Q(0) => clr_MAC_D
224 Q(0) => clr_MAC_D
226 );
225 );
227
226
228 addREG : MAC_REG
227 addREG : MAC_REG
229 GENERIC MAP(size => 1)
228 GENERIC MAP(size => 1)
230 PORT MAP(
229 PORT MAP(
231 reset => reset,
230 reset => reset,
232 clk => clk,
231 clk => clk,
233 D(0) => add,
232 D(0) => add,
234 Q(0) => add_D
233 Q(0) => add_D
235 );
234 );
236
235
237 OP1REG : MAC_REG
236 OP1REG : MAC_REG
238 GENERIC MAP(size => Input_SZ_A)
237 GENERIC MAP(size => Input_SZ_A)
239 PORT MAP(
238 PORT MAP(
240 reset => reset,
239 reset => reset,
241 clk => clk,
240 clk => clk,
242 D => OP1_2C,
241 D => OP1_2C,
243 Q => OP1_2C_D
242 Q => OP1_2C_D
244 );
243 );
245
244
246
245
247 OP2REG : MAC_REG
246 OP2REG : MAC_REG
248 GENERIC MAP(size => Input_SZ_B)
247 GENERIC MAP(size => Input_SZ_B)
249 PORT MAP(
248 PORT MAP(
250 reset => reset,
249 reset => reset,
251 clk => clk,
250 clk => clk,
252 D => OP2_2C,
251 D => OP2_2C,
253 Q => OP2_2C_D
252 Q => OP2_2C_D
254 );
253 );
255
254
256 MULToutREG : MAC_REG
255 MULToutREG : MAC_REG
257 GENERIC MAP(size => Input_SZ_A+Input_SZ_B)
256 GENERIC MAP(size => Input_SZ_A+Input_SZ_B)
258 PORT MAP(
257 PORT MAP(
259 reset => reset,
258 reset => reset,
260 clk => clk,
259 clk => clk,
261 D => MULTout,
260 D => MULTout,
262 Q => MULTout_D
261 Q => MULTout_D
263 );
262 );
264
263
265 MACMUXselREG : MAC_REG
264 MACMUXselREG : MAC_REG
266 GENERIC MAP(size => 1)
265 GENERIC MAP(size => 1)
267 PORT MAP(
266 PORT MAP(
268 reset => reset,
267 reset => reset,
269 clk => clk,
268 clk => clk,
270 D(0) => MACMUXsel,
269 D(0) => MACMUXsel,
271 Q(0) => MACMUXsel_D
270 Q(0) => MACMUXsel_D
272 );
271 );
273
272
274 MACMUX2selREG : MAC_REG
273 MACMUX2selREG : MAC_REG
275 GENERIC MAP(size => 1)
274 GENERIC MAP(size => 1)
276 PORT MAP(
275 PORT MAP(
277 reset => reset,
276 reset => reset,
278 clk => clk,
277 clk => clk,
279 D(0) => MACMUX2sel,
278 D(0) => MACMUX2sel,
280 Q(0) => MACMUX2sel_D
279 Q(0) => MACMUX2sel_D
281 );
280 );
282
281
283 MACMUX2selREG2 : MAC_REG
282 MACMUX2selREG2 : MAC_REG
284 GENERIC MAP(size => 1)
283 GENERIC MAP(size => 1)
285 PORT MAP(
284 PORT MAP(
286 reset => reset,
285 reset => reset,
287 clk => clk,
286 clk => clk,
288 D(0) => MACMUX2sel_D,
287 D(0) => MACMUX2sel_D,
289 Q(0) => MACMUX2sel_D_D
288 Q(0) => MACMUX2sel_D_D
290 );
289 );
291
290
292 --==============================================================
291 --==============================================================
293 --======================M A C M U X ===========================
292 --======================M A C M U X ===========================
294 --==============================================================
293 --==============================================================
295 MACMUX_inst : MAC_MUX
294 MACMUX_inst : MAC_MUX
296 GENERIC MAP(
295 GENERIC MAP(
297 Input_SZ_A => Input_SZ_A+Input_SZ_B,
296 Input_SZ_A => Input_SZ_A+Input_SZ_B,
298 Input_SZ_B => Input_SZ_A+Input_SZ_B
297 Input_SZ_B => Input_SZ_A+Input_SZ_B
299
298
300 )
299 )
301 PORT MAP(
300 PORT MAP(
302 sel => MACMUXsel_D,
301 sel => MACMUXsel_D,
303 INA1 => ADDERout,
302 INA1 => ADDERout,
304 INA2 => OP2_2C_D_Resz,
303 INA2 => OP2_2C_D_Resz,
305 INB1 => MULTout,
304 INB1 => MULTout,
306 INB2 => OP1_2C_D_Resz,
305 INB2 => OP1_2C_D_Resz,
307 OUTA => ADDERinA,
306 OUTA => ADDERinA,
308 OUTB => ADDERinB
307 OUTB => ADDERinB
309 );
308 );
310 OP1_2C_D_Resz <= STD_LOGIC_VECTOR(resize(SIGNED(OP1_2C_D), Input_SZ_A+Input_SZ_B));
309 OP1_2C_D_Resz <= STD_LOGIC_VECTOR(resize(SIGNED(OP1_2C_D), Input_SZ_A+Input_SZ_B));
311 OP2_2C_D_Resz <= STD_LOGIC_VECTOR(resize(SIGNED(OP2_2C_D), Input_SZ_A+Input_SZ_B));
310 OP2_2C_D_Resz <= STD_LOGIC_VECTOR(resize(SIGNED(OP2_2C_D), Input_SZ_A+Input_SZ_B));
312 --==============================================================
311 --==============================================================
313
312
314
313
315 --==============================================================
314 --==============================================================
316 --======================M A C M U X2 ==========================
315 --======================M A C M U X2 ==========================
317 --==============================================================
316 --==============================================================
318 MAC_MUX2_inst : MAC_MUX2
317 MAC_MUX2_inst : MAC_MUX2
319 GENERIC MAP(Input_SZ => Input_SZ_A+Input_SZ_B)
318 GENERIC MAP(Input_SZ => Input_SZ_A+Input_SZ_B)
320 PORT MAP(
319 PORT MAP(
321 sel => MACMUX2sel_D_D,
320 sel => MACMUX2sel_D_D,
322 RES2 => MULTout_D,
321 RES2 => MULTout_D,
323 RES1 => ADDERout,
322 RES1 => ADDERout,
324 RES => RES
323 RES => RES
325 );
324 );
326 --==============================================================
325 --==============================================================
327
326
328 END ar_MAC;
327 END ar_MAC;
@@ -1,71 +1,71
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 : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@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
25
26 --IDLE =00 MAC =01 MULT =10 ADD =11
26 --IDLE =00 MAC =01 MULT =10 ADD =11
27
27
28
28
29 entity MAC_CONTROLER is
29 entity MAC_CONTROLER is
30 port(
30 port(
31 ctrl : in std_logic_vector(1 downto 0);
31 ctrl : in std_logic_vector(1 downto 0);
32 MULT : out std_logic;
32 MULT : out std_logic;
33 ADD : out std_logic;
33 ADD : out std_logic;
34 LOAD_ADDER : out std_logic;
34 -- LOAD_ADDER : out std_logic;
35 MACMUX_sel : out std_logic;
35 MACMUX_sel : out std_logic;
36 MACMUX2_sel : out std_logic
36 MACMUX2_sel : out std_logic
37
37
38 );
38 );
39 end MAC_CONTROLER;
39 end MAC_CONTROLER;
40
40
41
41
42
42
43
43
44
44
45 architecture ar_MAC_CONTROLER of MAC_CONTROLER is
45 architecture ar_MAC_CONTROLER of MAC_CONTROLER is
46
46
47 begin
47 begin
48
48
49
49
50
50
51 MULT <= '0' when (ctrl = "00" or ctrl = "11") else '1';
51 MULT <= '0' when (ctrl = "00" or ctrl = "11") else '1';
52 ADD <= '0' when (ctrl = "00" or ctrl = "10") else '1';
52 ADD <= '0' when (ctrl = "00" or ctrl = "10") else '1';
53 LOAD_ADDER <= '1' when (ctrl = "10") else '0'; -- PATCH JC : mem mult result
53 --LOAD_ADDER <= '1' when ( ctrl = "10") else '0'; -- PATCH JC : mem mult result
54 -- to permit to compute a
54 -- to permit to compute a
55 -- MULT follow by a MAC
55 -- MULT follow by a MAC
56 --MACMUX_sel <= '0' when (ctrl = "00" or ctrl = "01") else '1';
56 --MACMUX_sel <= '0' when (ctrl = "00" or ctrl = "01") else '1';
57 MACMUX_sel <= '0' when (ctrl = "00" or ctrl = "01" OR ctrl = "10") else '1';
57 MACMUX_sel <= '0' when (ctrl = "00" or ctrl = "01" OR ctrl = "10") else '1';
58 MACMUX2_sel <= '0' when (ctrl = "00" or ctrl = "01" or ctrl = "11") else '1';
58 MACMUX2_sel <= '0' when (ctrl = "00" or ctrl = "01" or ctrl = "11") else '1';
59
59
60
60
61 end ar_MAC_CONTROLER;
61 end ar_MAC_CONTROLER;
62
62
63
63
64
64
65
65
66
66
67
67
68
68
69
69
70
70
71
71
@@ -1,395 +1,395
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 : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------
21 ----------------------------------------------------------------------------
22 --UPDATE
22 --UPDATE
23 -------------------------------------------------------------------------------
23 -------------------------------------------------------------------------------
24 -- 14-03-2013 - Jean-christophe Pellion
24 -- 14-03-2013 - Jean-christophe Pellion
25 -- ADD MUXN (a parametric multiplexor (N stage of MUX2))
25 -- ADD MUXN (a parametric multiplexor (N stage of MUX2))
26 -------------------------------------------------------------------------------
26 -------------------------------------------------------------------------------
27
27
28 LIBRARY ieee;
28 LIBRARY ieee;
29 USE ieee.std_logic_1164.ALL;
29 USE ieee.std_logic_1164.ALL;
30 USE IEEE.NUMERIC_STD.ALL;
30 USE IEEE.NUMERIC_STD.ALL;
31
31
32
32
33
33
34 PACKAGE general_purpose IS
34 PACKAGE general_purpose IS
35
35
36 COMPONENT general_counter
36 COMPONENT general_counter
37 GENERIC (
37 GENERIC (
38 CYCLIC : STD_LOGIC;
38 CYCLIC : STD_LOGIC;
39 NB_BITS_COUNTER : INTEGER);
39 NB_BITS_COUNTER : INTEGER);
40 PORT (
40 PORT (
41 clk : IN STD_LOGIC;
41 clk : IN STD_LOGIC;
42 rstn : IN STD_LOGIC;
42 rstn : IN STD_LOGIC;
43 RST_VALUE : IN STD_LOGIC_VECTOR(NB_BITS_COUNTER-1 DOWNTO 0);
43 RST_VALUE : IN STD_LOGIC_VECTOR(NB_BITS_COUNTER-1 DOWNTO 0);
44 MAX_VALUE : IN STD_LOGIC_VECTOR(NB_BITS_COUNTER-1 DOWNTO 0);
44 MAX_VALUE : IN STD_LOGIC_VECTOR(NB_BITS_COUNTER-1 DOWNTO 0);
45 set : IN STD_LOGIC;
45 set : IN STD_LOGIC;
46 set_value : IN STD_LOGIC_VECTOR(NB_BITS_COUNTER-1 DOWNTO 0);
46 set_value : IN STD_LOGIC_VECTOR(NB_BITS_COUNTER-1 DOWNTO 0);
47 add1 : IN STD_LOGIC;
47 add1 : IN STD_LOGIC;
48 counter : OUT STD_LOGIC_VECTOR(NB_BITS_COUNTER-1 DOWNTO 0));
48 counter : OUT STD_LOGIC_VECTOR(NB_BITS_COUNTER-1 DOWNTO 0));
49 END COMPONENT;
49 END COMPONENT;
50
50
51 COMPONENT Clk_divider IS
51 COMPONENT Clk_divider IS
52 GENERIC(OSC_freqHz : INTEGER := 50000000;
52 GENERIC(OSC_freqHz : INTEGER := 50000000;
53 TargetFreq_Hz : INTEGER := 50000);
53 TargetFreq_Hz : INTEGER := 50000);
54 PORT (clk : IN STD_LOGIC;
54 PORT (clk : IN STD_LOGIC;
55 reset : IN STD_LOGIC;
55 reset : IN STD_LOGIC;
56 clk_divided : OUT STD_LOGIC);
56 clk_divided : OUT STD_LOGIC);
57 END COMPONENT;
57 END COMPONENT;
58
58
59
59
60 COMPONENT Clk_divider2 IS
60 COMPONENT Clk_divider2 IS
61 generic(N : integer := 16);
61 generic(N : integer := 16);
62 port(
62 port(
63 clk_in : in std_logic;
63 clk_in : in std_logic;
64 clk_out : out std_logic);
64 clk_out : out std_logic);
65 END COMPONENT;
65 END COMPONENT;
66
66
67 COMPONENT Adder IS
67 COMPONENT Adder IS
68 GENERIC(
68 GENERIC(
69 Input_SZ_A : INTEGER := 16;
69 Input_SZ_A : INTEGER := 16;
70 Input_SZ_B : INTEGER := 16
70 Input_SZ_B : INTEGER := 16
71
71
72 );
72 );
73 PORT(
73 PORT(
74 clk : IN STD_LOGIC;
74 clk : IN STD_LOGIC;
75 reset : IN STD_LOGIC;
75 reset : IN STD_LOGIC;
76 clr : IN STD_LOGIC;
76 clr : IN STD_LOGIC;
77 load : IN STD_LOGIC;
77 load : IN STD_LOGIC;
78 add : IN STD_LOGIC;
78 add : IN STD_LOGIC;
79 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
79 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
80 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
80 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
81 RES : OUT STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0)
81 RES : OUT STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0)
82 );
82 );
83 END COMPONENT;
83 END COMPONENT;
84
84
85 COMPONENT Adder_V0 is
85 COMPONENT Adder_V0 is
86 generic(
86 generic(
87 Input_SZ_A : integer := 16;
87 Input_SZ_A : integer := 16;
88 Input_SZ_B : integer := 16
88 Input_SZ_B : integer := 16
89
89
90 );
90 );
91 port(
91 port(
92 clk : in std_logic;
92 clk : in std_logic;
93 reset : in std_logic;
93 reset : in std_logic;
94 clr : in std_logic;
94 clr : in std_logic;
95 add : in std_logic;
95 add : in std_logic;
96 OP1 : in std_logic_vector(Input_SZ_A-1 downto 0);
96 OP1 : in std_logic_vector(Input_SZ_A-1 downto 0);
97 OP2 : in std_logic_vector(Input_SZ_B-1 downto 0);
97 OP2 : in std_logic_vector(Input_SZ_B-1 downto 0);
98 RES : out std_logic_vector(Input_SZ_A-1 downto 0)
98 RES : out std_logic_vector(Input_SZ_A-1 downto 0)
99 );
99 );
100 end COMPONENT;
100 end COMPONENT;
101
101
102 COMPONENT ADDRcntr IS
102 COMPONENT ADDRcntr IS
103 PORT(
103 PORT(
104 clk : IN STD_LOGIC;
104 clk : IN STD_LOGIC;
105 reset : IN STD_LOGIC;
105 reset : IN STD_LOGIC;
106 count : IN STD_LOGIC;
106 count : IN STD_LOGIC;
107 clr : IN STD_LOGIC;
107 clr : IN STD_LOGIC;
108 Q : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
108 Q : OUT STD_LOGIC_VECTOR(7 DOWNTO 0)
109 );
109 );
110 END COMPONENT;
110 END COMPONENT;
111
111
112 COMPONENT ALU IS
112 COMPONENT ALU IS
113 GENERIC(
113 GENERIC(
114 Arith_en : INTEGER := 1;
114 Arith_en : INTEGER := 1;
115 Logic_en : INTEGER := 1;
115 Logic_en : INTEGER := 1;
116 Input_SZ_1 : INTEGER := 16;
116 Input_SZ_1 : INTEGER := 16;
117 Input_SZ_2 : INTEGER := 9;
117 Input_SZ_2 : INTEGER := 9;
118 COMP_EN : INTEGER := 0 -- 1 => No Comp
118 COMP_EN : INTEGER := 0 -- 1 => No Comp
119
119
120 );
120 );
121 PORT(
121 PORT(
122 clk : IN STD_LOGIC;
122 clk : IN STD_LOGIC;
123 reset : IN STD_LOGIC;
123 reset : IN STD_LOGIC;
124 ctrl : IN STD_LOGIC_VECTOR(2 downto 0);
124 ctrl : IN STD_LOGIC_VECTOR(2 downto 0);
125 comp : IN STD_LOGIC_VECTOR(1 downto 0);
125 comp : IN STD_LOGIC_VECTOR(1 downto 0);
126 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_1-1 DOWNTO 0);
126 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_1-1 DOWNTO 0);
127 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_2-1 DOWNTO 0);
127 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_2-1 DOWNTO 0);
128 RES : OUT STD_LOGIC_VECTOR(Input_SZ_1+Input_SZ_2-1 DOWNTO 0)
128 RES : OUT STD_LOGIC_VECTOR(Input_SZ_1+Input_SZ_2-1 DOWNTO 0)
129 );
129 );
130 END COMPONENT;
130 END COMPONENT;
131
131
132 COMPONENT ALU_V0 IS
132 COMPONENT ALU_V0 IS
133 GENERIC(
133 GENERIC(
134 Arith_en : INTEGER := 1;
134 Arith_en : INTEGER := 1;
135 Logic_en : INTEGER := 1;
135 Logic_en : INTEGER := 1;
136 Input_SZ_1 : INTEGER := 16;
136 Input_SZ_1 : INTEGER := 16;
137 Input_SZ_2 : INTEGER := 9
137 Input_SZ_2 : INTEGER := 9
138
138
139 );
139 );
140 PORT(
140 PORT(
141 clk : IN STD_LOGIC;
141 clk : IN STD_LOGIC;
142 reset : IN STD_LOGIC;
142 reset : IN STD_LOGIC;
143 ctrl : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
143 ctrl : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
144 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_1-1 DOWNTO 0);
144 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_1-1 DOWNTO 0);
145 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_2-1 DOWNTO 0);
145 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_2-1 DOWNTO 0);
146 RES : OUT STD_LOGIC_VECTOR(Input_SZ_1+Input_SZ_2-1 DOWNTO 0)
146 RES : OUT STD_LOGIC_VECTOR(Input_SZ_1+Input_SZ_2-1 DOWNTO 0)
147 );
147 );
148 END COMPONENT;
148 END COMPONENT;
149
149
150 COMPONENT MAC_V0 is
150 COMPONENT MAC_V0 is
151 generic(
151 generic(
152 Input_SZ_A : integer := 8;
152 Input_SZ_A : integer := 8;
153 Input_SZ_B : integer := 8
153 Input_SZ_B : integer := 8
154
154
155 );
155 );
156 port(
156 port(
157 clk : in std_logic;
157 clk : in std_logic;
158 reset : in std_logic;
158 reset : in std_logic;
159 clr_MAC : in std_logic;
159 clr_MAC : in std_logic;
160 MAC_MUL_ADD : in std_logic_vector(1 downto 0);
160 MAC_MUL_ADD : in std_logic_vector(1 downto 0);
161 OP1 : in std_logic_vector(Input_SZ_A-1 downto 0);
161 OP1 : in std_logic_vector(Input_SZ_A-1 downto 0);
162 OP2 : in std_logic_vector(Input_SZ_B-1 downto 0);
162 OP2 : in std_logic_vector(Input_SZ_B-1 downto 0);
163 RES : out std_logic_vector(Input_SZ_A+Input_SZ_B-1 downto 0)
163 RES : out std_logic_vector(Input_SZ_A+Input_SZ_B-1 downto 0)
164 );
164 );
165 end COMPONENT;
165 end COMPONENT;
166
166
167 ---------------------------------------------------------
167 ---------------------------------------------------------
168 -------- // SΓ©lection grace a l'entrΓ©e "ctrl" \\ --------
168 -------- // SΓ©lection grace a l'entrΓ©e "ctrl" \\ --------
169 ---------------------------------------------------------
169 ---------------------------------------------------------
170 Constant ctrl_IDLE : std_logic_vector(2 downto 0) := "000";
170 Constant ctrl_IDLE : std_logic_vector(2 downto 0) := "000";
171 Constant ctrl_MAC : std_logic_vector(2 downto 0) := "001";
171 Constant ctrl_MAC : std_logic_vector(2 downto 0) := "001";
172 Constant ctrl_MULT : std_logic_vector(2 downto 0) := "010";
172 Constant ctrl_MULT : std_logic_vector(2 downto 0) := "010";
173 Constant ctrl_ADD : std_logic_vector(2 downto 0) := "011";
173 Constant ctrl_ADD : std_logic_vector(2 downto 0) := "011";
174 Constant ctrl_CLRMAC : std_logic_vector(2 downto 0) := "100";
174 Constant ctrl_CLRMAC : std_logic_vector(2 downto 0) := "100";
175
175
176
176
177 Constant IDLE_V0 : std_logic_vector(3 downto 0) := "0000";
177 Constant IDLE_V0 : std_logic_vector(3 downto 0) := "0000";
178 Constant MAC_op_V0 : std_logic_vector(3 downto 0) := "0001";
178 Constant MAC_op_V0 : std_logic_vector(3 downto 0) := "0001";
179 Constant MULT_V0 : std_logic_vector(3 downto 0) := "0010";
179 Constant MULT_V0 : std_logic_vector(3 downto 0) := "0010";
180 Constant ADD_V0 : std_logic_vector(3 downto 0) := "0011";
180 Constant ADD_V0 : std_logic_vector(3 downto 0) := "0011";
181 Constant CLR_MAC_V0 : std_logic_vector(3 downto 0) := "0100";
181 Constant CLR_MAC_V0 : std_logic_vector(3 downto 0) := "0100";
182 ---------------------------------------------------------
182 ---------------------------------------------------------
183
183
184 COMPONENT MAC IS
184 COMPONENT MAC IS
185 GENERIC(
185 GENERIC(
186 Input_SZ_A : INTEGER := 8;
186 Input_SZ_A : INTEGER := 8;
187 Input_SZ_B : INTEGER := 8;
187 Input_SZ_B : INTEGER := 8;
188 COMP_EN : INTEGER := 0 -- 1 => No Comp
188 COMP_EN : INTEGER := 0 -- 1 => No Comp
189 );
189 );
190 PORT(
190 PORT(
191 clk : IN STD_LOGIC;
191 clk : IN STD_LOGIC;
192 reset : IN STD_LOGIC;
192 reset : IN STD_LOGIC;
193 clr_MAC : IN STD_LOGIC;
193 clr_MAC : IN STD_LOGIC;
194 MAC_MUL_ADD : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
194 MAC_MUL_ADD : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
195 Comp_2C : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
195 Comp_2C : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
196 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
196 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
197 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
197 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
198 RES : OUT STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0)
198 RES : OUT STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0)
199 );
199 );
200 END COMPONENT;
200 END COMPONENT;
201
201
202 COMPONENT TwoComplementer is
202 COMPONENT TwoComplementer is
203 generic(
203 generic(
204 Input_SZ : integer := 16);
204 Input_SZ : integer := 16);
205 port(
205 port(
206 clk : in std_logic; --! Horloge du composant
206 clk : in std_logic; --! Horloge du composant
207 reset : in std_logic; --! Reset general du composant
207 reset : in std_logic; --! Reset general du composant
208 clr : in std_logic; --! Un reset spΓ©cifique au programme
208 clr : in std_logic; --! Un reset spΓ©cifique au programme
209 TwoComp : in std_logic; --! Autorise l'utilisation du complΓ©ment
209 TwoComp : in std_logic; --! Autorise l'utilisation du complΓ©ment
210 OP : in std_logic_vector(Input_SZ-1 downto 0); --! OpΓ©rande d'entrΓ©e
210 OP : in std_logic_vector(Input_SZ-1 downto 0); --! OpΓ©rande d'entrΓ©e
211 RES : out std_logic_vector(Input_SZ-1 downto 0) --! RΓ©sultat, opΓ©rande complΓ©mentΓ© ou non
211 RES : out std_logic_vector(Input_SZ-1 downto 0) --! RΓ©sultat, opΓ©rande complΓ©mentΓ© ou non
212 );
212 );
213 end COMPONENT;
213 end COMPONENT;
214
214
215 COMPONENT MAC_CONTROLER IS
215 COMPONENT MAC_CONTROLER IS
216 PORT(
216 PORT(
217 ctrl : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
217 ctrl : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
218 MULT : OUT STD_LOGIC;
218 MULT : OUT STD_LOGIC;
219 ADD : OUT STD_LOGIC;
219 ADD : OUT STD_LOGIC;
220 LOAD_ADDER : out std_logic;
220 -- LOAD_ADDER : out std_logic;
221 MACMUX_sel : OUT STD_LOGIC;
221 MACMUX_sel : OUT STD_LOGIC;
222 MACMUX2_sel : OUT STD_LOGIC
222 MACMUX2_sel : OUT STD_LOGIC
223 );
223 );
224 END COMPONENT;
224 END COMPONENT;
225
225
226 COMPONENT MAC_MUX IS
226 COMPONENT MAC_MUX IS
227 GENERIC(
227 GENERIC(
228 Input_SZ_A : INTEGER := 16;
228 Input_SZ_A : INTEGER := 16;
229 Input_SZ_B : INTEGER := 16
229 Input_SZ_B : INTEGER := 16
230
230
231 );
231 );
232 PORT(
232 PORT(
233 sel : IN STD_LOGIC;
233 sel : IN STD_LOGIC;
234 INA1 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
234 INA1 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
235 INA2 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
235 INA2 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
236 INB1 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
236 INB1 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
237 INB2 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
237 INB2 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
238 OUTA : OUT STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
238 OUTA : OUT STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
239 OUTB : OUT STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0)
239 OUTB : OUT STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0)
240 );
240 );
241 END COMPONENT;
241 END COMPONENT;
242
242
243
243
244 COMPONENT MAC_MUX2 IS
244 COMPONENT MAC_MUX2 IS
245 GENERIC(Input_SZ : INTEGER := 16);
245 GENERIC(Input_SZ : INTEGER := 16);
246 PORT(
246 PORT(
247 sel : IN STD_LOGIC;
247 sel : IN STD_LOGIC;
248 RES1 : IN STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
248 RES1 : IN STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
249 RES2 : IN STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
249 RES2 : IN STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
250 RES : OUT STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0)
250 RES : OUT STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0)
251 );
251 );
252 END COMPONENT;
252 END COMPONENT;
253
253
254
254
255 COMPONENT MAC_REG IS
255 COMPONENT MAC_REG IS
256 GENERIC(size : INTEGER := 16);
256 GENERIC(size : INTEGER := 16);
257 PORT(
257 PORT(
258 reset : IN STD_LOGIC;
258 reset : IN STD_LOGIC;
259 clk : IN STD_LOGIC;
259 clk : IN STD_LOGIC;
260 D : IN STD_LOGIC_VECTOR(size-1 DOWNTO 0);
260 D : IN STD_LOGIC_VECTOR(size-1 DOWNTO 0);
261 Q : OUT STD_LOGIC_VECTOR(size-1 DOWNTO 0)
261 Q : OUT STD_LOGIC_VECTOR(size-1 DOWNTO 0)
262 );
262 );
263 END COMPONENT;
263 END COMPONENT;
264
264
265
265
266 COMPONENT MUX2 IS
266 COMPONENT MUX2 IS
267 GENERIC(Input_SZ : INTEGER := 16);
267 GENERIC(Input_SZ : INTEGER := 16);
268 PORT(
268 PORT(
269 sel : IN STD_LOGIC;
269 sel : IN STD_LOGIC;
270 IN1 : IN STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
270 IN1 : IN STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
271 IN2 : IN STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
271 IN2 : IN STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
272 RES : OUT STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0)
272 RES : OUT STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0)
273 );
273 );
274 END COMPONENT;
274 END COMPONENT;
275
275
276 TYPE MUX_INPUT_TYPE IS ARRAY (NATURAL RANGE <>, NATURAL RANGE <>) OF STD_LOGIC;
276 TYPE MUX_INPUT_TYPE IS ARRAY (NATURAL RANGE <>, NATURAL RANGE <>) OF STD_LOGIC;
277 TYPE MUX_OUTPUT_TYPE IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC;
277 TYPE MUX_OUTPUT_TYPE IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC;
278
278
279 COMPONENT MUXN
279 COMPONENT MUXN
280 GENERIC (
280 GENERIC (
281 Input_SZ : INTEGER;
281 Input_SZ : INTEGER;
282 NbStage : INTEGER);
282 NbStage : INTEGER);
283 PORT (
283 PORT (
284 sel : IN STD_LOGIC_VECTOR(NbStage-1 DOWNTO 0);
284 sel : IN STD_LOGIC_VECTOR(NbStage-1 DOWNTO 0);
285 INPUT : IN MUX_INPUT_TYPE(0 TO (2**NbStage)-1,Input_SZ-1 DOWNTO 0);
285 INPUT : IN MUX_INPUT_TYPE(0 TO (2**NbStage)-1,Input_SZ-1 DOWNTO 0);
286 --INPUT : IN ARRAY (0 TO (2**NbStage)-1) OF STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
286 --INPUT : IN ARRAY (0 TO (2**NbStage)-1) OF STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
287 RES : OUT MUX_OUTPUT_TYPE(Input_SZ-1 DOWNTO 0));
287 RES : OUT MUX_OUTPUT_TYPE(Input_SZ-1 DOWNTO 0));
288 END COMPONENT;
288 END COMPONENT;
289
289
290
290
291
291
292 COMPONENT Multiplier IS
292 COMPONENT Multiplier IS
293 GENERIC(
293 GENERIC(
294 Input_SZ_A : INTEGER := 16;
294 Input_SZ_A : INTEGER := 16;
295 Input_SZ_B : INTEGER := 16
295 Input_SZ_B : INTEGER := 16
296
296
297 );
297 );
298 PORT(
298 PORT(
299 clk : IN STD_LOGIC;
299 clk : IN STD_LOGIC;
300 reset : IN STD_LOGIC;
300 reset : IN STD_LOGIC;
301 mult : IN STD_LOGIC;
301 mult : IN STD_LOGIC;
302 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
302 OP1 : IN STD_LOGIC_VECTOR(Input_SZ_A-1 DOWNTO 0);
303 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
303 OP2 : IN STD_LOGIC_VECTOR(Input_SZ_B-1 DOWNTO 0);
304 RES : OUT STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0)
304 RES : OUT STD_LOGIC_VECTOR(Input_SZ_A+Input_SZ_B-1 DOWNTO 0)
305 );
305 );
306 END COMPONENT;
306 END COMPONENT;
307
307
308 COMPONENT REG IS
308 COMPONENT REG IS
309 GENERIC(size : INTEGER := 16; initial_VALUE : INTEGER := 0);
309 GENERIC(size : INTEGER := 16; initial_VALUE : INTEGER := 0);
310 PORT(
310 PORT(
311 reset : IN STD_LOGIC;
311 reset : IN STD_LOGIC;
312 clk : IN STD_LOGIC;
312 clk : IN STD_LOGIC;
313 D : IN STD_LOGIC_VECTOR(size-1 DOWNTO 0);
313 D : IN STD_LOGIC_VECTOR(size-1 DOWNTO 0);
314 Q : OUT STD_LOGIC_VECTOR(size-1 DOWNTO 0)
314 Q : OUT STD_LOGIC_VECTOR(size-1 DOWNTO 0)
315 );
315 );
316 END COMPONENT;
316 END COMPONENT;
317
317
318
318
319
319
320 COMPONENT RShifter IS
320 COMPONENT RShifter IS
321 GENERIC(
321 GENERIC(
322 Input_SZ : INTEGER := 16;
322 Input_SZ : INTEGER := 16;
323 shift_SZ : INTEGER := 4
323 shift_SZ : INTEGER := 4
324 );
324 );
325 PORT(
325 PORT(
326 clk : IN STD_LOGIC;
326 clk : IN STD_LOGIC;
327 reset : IN STD_LOGIC;
327 reset : IN STD_LOGIC;
328 shift : IN STD_LOGIC;
328 shift : IN STD_LOGIC;
329 OP : IN STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
329 OP : IN STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0);
330 cnt : IN STD_LOGIC_VECTOR(shift_SZ-1 DOWNTO 0);
330 cnt : IN STD_LOGIC_VECTOR(shift_SZ-1 DOWNTO 0);
331 RES : OUT STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0)
331 RES : OUT STD_LOGIC_VECTOR(Input_SZ-1 DOWNTO 0)
332 );
332 );
333 END COMPONENT;
333 END COMPONENT;
334
334
335 COMPONENT SYNC_FF
335 COMPONENT SYNC_FF
336 GENERIC (
336 GENERIC (
337 NB_FF_OF_SYNC : INTEGER);
337 NB_FF_OF_SYNC : INTEGER);
338 PORT (
338 PORT (
339 clk : IN STD_LOGIC;
339 clk : IN STD_LOGIC;
340 rstn : IN STD_LOGIC;
340 rstn : IN STD_LOGIC;
341 A : IN STD_LOGIC;
341 A : IN STD_LOGIC;
342 A_sync : OUT STD_LOGIC);
342 A_sync : OUT STD_LOGIC);
343 END COMPONENT;
343 END COMPONENT;
344
344
345 COMPONENT lpp_front_to_level
345 COMPONENT lpp_front_to_level
346 PORT (
346 PORT (
347 clk : IN STD_LOGIC;
347 clk : IN STD_LOGIC;
348 rstn : IN STD_LOGIC;
348 rstn : IN STD_LOGIC;
349 sin : IN STD_LOGIC;
349 sin : IN STD_LOGIC;
350 sout : OUT STD_LOGIC);
350 sout : OUT STD_LOGIC);
351 END COMPONENT;
351 END COMPONENT;
352
352
353 COMPONENT lpp_front_detection
353 COMPONENT lpp_front_detection
354 PORT (
354 PORT (
355 clk : IN STD_LOGIC;
355 clk : IN STD_LOGIC;
356 rstn : IN STD_LOGIC;
356 rstn : IN STD_LOGIC;
357 sin : IN STD_LOGIC;
357 sin : IN STD_LOGIC;
358 sout : OUT STD_LOGIC);
358 sout : OUT STD_LOGIC);
359 END COMPONENT;
359 END COMPONENT;
360
360
361 COMPONENT lpp_front_positive_detection
361 COMPONENT lpp_front_positive_detection
362 PORT (
362 PORT (
363 clk : IN STD_LOGIC;
363 clk : IN STD_LOGIC;
364 rstn : IN STD_LOGIC;
364 rstn : IN STD_LOGIC;
365 sin : IN STD_LOGIC;
365 sin : IN STD_LOGIC;
366 sout : OUT STD_LOGIC);
366 sout : OUT STD_LOGIC);
367 END COMPONENT;
367 END COMPONENT;
368
368
369 COMPONENT SYNC_VALID_BIT
369 COMPONENT SYNC_VALID_BIT
370 GENERIC (
370 GENERIC (
371 NB_FF_OF_SYNC : INTEGER);
371 NB_FF_OF_SYNC : INTEGER);
372 PORT (
372 PORT (
373 clk_in : IN STD_LOGIC;
373 clk_in : IN STD_LOGIC;
374 clk_out : IN STD_LOGIC;
374 clk_out : IN STD_LOGIC;
375 rstn : IN STD_LOGIC;
375 rstn : IN STD_LOGIC;
376 sin : IN STD_LOGIC;
376 sin : IN STD_LOGIC;
377 sout : OUT STD_LOGIC);
377 sout : OUT STD_LOGIC);
378 END COMPONENT;
378 END COMPONENT;
379
379
380 COMPONENT RR_Arbiter_4
380 COMPONENT RR_Arbiter_4
381 PORT (
381 PORT (
382 clk : IN STD_LOGIC;
382 clk : IN STD_LOGIC;
383 rstn : IN STD_LOGIC;
383 rstn : IN STD_LOGIC;
384 in_valid : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
384 in_valid : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
385 out_grant : OUT STD_LOGIC_VECTOR(3 DOWNTO 0));
385 out_grant : OUT STD_LOGIC_VECTOR(3 DOWNTO 0));
386 END COMPONENT;
386 END COMPONENT;
387
387
388 COMPONENT Clock_Divider is
388 COMPONENT Clock_Divider is
389 generic(N :integer := 10);
389 generic(N :integer := 10);
390 port(
390 port(
391 clk, rst : in std_logic;
391 clk, rst : in std_logic;
392 sclk : out std_logic);
392 sclk : out std_logic);
393 end COMPONENT;
393 end COMPONENT;
394
394
395 END;
395 END;
@@ -1,119 +1,119
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 : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 -------------------------------------------------------------------------------
21 -------------------------------------------------------------------------------
22 -- MODIFIED by Jean-christophe PELLION
22 -- MODIFIED by Jean-christophe PELLION
23 -- jean-christophe.pellion@lpp.polytechnique.fr
23 -- jean-christophe.pellion@lpp.polytechnique.fr
24 -------------------------------------------------------------------------------
24 -------------------------------------------------------------------------------
25 -------------------------------------------------------------------------------
25 -------------------------------------------------------------------------------
26 -- MODIFIED by Paul LEROY
26 -- MODIFIED by Paul LEROY
27 -- paul.leroy@lpp.polytechnique.fr
27 -- paul.leroy@lpp.polytechnique.fr
28 -------------------------------------------------------------------------------
28 -------------------------------------------------------------------------------
29
29
30 LIBRARY IEEE;
30 LIBRARY IEEE;
31 USE IEEE.STD_LOGIC_1164.ALL;
31 USE IEEE.STD_LOGIC_1164.ALL;
32 LIBRARY lpp;
32 LIBRARY lpp;
33 USE lpp.lpp_ad_conv.ALL;
33 USE lpp.lpp_ad_conv.ALL;
34
34
35 ENTITY ADS7886_drvr_v2 IS
35 ENTITY ADS7886_drvr_v2 IS
36 GENERIC(
36 GENERIC(
37 ChannelCount : INTEGER := 8;
37 ChannelCount : INTEGER := 8;
38 NbBitsSamples : INTEGER := 16);
38 NbBitsSamples : INTEGER := 16);
39 PORT (
39 PORT (
40 -- CONV --
40 -- CONV --
41 cnv_clk : IN STD_LOGIC;
41 cnv_clk : IN STD_LOGIC;
42 cnv_rstn : IN STD_LOGIC;
42 cnv_rstn : IN STD_LOGIC;
43 -- DATA --
43 -- DATA --
44 clk : IN STD_LOGIC;
44 clk : IN STD_LOGIC;
45 rstn : IN STD_LOGIC;
45 rstn : IN STD_LOGIC;
46 sck : OUT STD_LOGIC;
46 sck : OUT STD_LOGIC;
47 sdo : IN STD_LOGIC_VECTOR(ChannelCount-1 DOWNTO 0);
47 sdo : IN STD_LOGIC_VECTOR(ChannelCount-1 DOWNTO 0);
48 -- SAMPLE --
48 -- SAMPLE --
49 sample : OUT Samples(ChannelCount-1 DOWNTO 0);
49 sample : OUT Samples(ChannelCount-1 DOWNTO 0);
50 sample_val : OUT STD_LOGIC
50 sample_val : OUT STD_LOGIC
51 );
51 );
52 END ADS7886_drvr_v2;
52 END ADS7886_drvr_v2;
53
53
54 ARCHITECTURE ar_ADS7886_drvr_v2 OF ADS7886_drvr_v2 IS
54 ARCHITECTURE ar_ADS7886_drvr_v2 OF ADS7886_drvr_v2 IS
55
55
56 SIGNAL cnv_sync : STD_LOGIC;
56 SIGNAL cnv_sync : STD_LOGIC;
57 SIGNAL cnv_sync_r : STD_LOGIC;
57 SIGNAL cnv_sync_r : STD_LOGIC;
58 SIGNAL cnv_done : STD_LOGIC;
58 SIGNAL cnv_done : STD_LOGIC;
59 SIGNAL sample_bit_counter : INTEGER;
59 SIGNAL sample_bit_counter : INTEGER;
60 SIGNAL shift_reg : Samples(ChannelCount-1 DOWNTO 0);
60 SIGNAL shift_reg : Samples_15(ChannelCount-1 DOWNTO 0);
61
61
62 BEGIN
62 BEGIN
63
63
64 cnv_sync <= cnv_clk;
64 cnv_sync <= cnv_clk;
65
65
66 PROCESS (clk, rstn) -- falling edge detection on cnv_sync
66 PROCESS (clk, rstn) -- falling edge detection on cnv_sync
67 BEGIN
67 BEGIN
68 IF rstn = '0' THEN
68 IF rstn = '0' THEN
69 cnv_sync_r <= '1';
69 cnv_sync_r <= '1';
70 cnv_done <= '0';
70 cnv_done <= '0';
71 ELSIF clk'EVENT AND clk = '1' THEN
71 ELSIF clk'EVENT AND clk = '1' THEN
72 cnv_sync_r <= cnv_sync;
72 cnv_sync_r <= cnv_sync;
73 cnv_done <= (NOT cnv_sync) AND cnv_sync_r;
73 cnv_done <= (NOT cnv_sync) AND cnv_sync_r;
74 END IF;
74 END IF;
75 END PROCESS;
75 END PROCESS;
76
76
77 -----------------------------------------------------------------------------
77 -----------------------------------------------------------------------------
78 -- DATA
78 -- DATA
79 -----------------------------------------------------------------------------
79 -----------------------------------------------------------------------------
80
80
81 PROCESS (clk, rstn)
81 PROCESS (clk, rstn)
82 BEGIN -- PROCESS
82 BEGIN -- PROCESS
83 IF rstn = '0' THEN
83 IF rstn = '0' THEN
84 FOR k IN 0 TO ChannelCount-1 LOOP
84 FOR k IN 0 TO ChannelCount-1 LOOP
85 shift_reg(k)(15 downto 0) <= (OTHERS => '0');
85 shift_reg(k)(14 downto 0) <= (OTHERS => '0');
86 sample(k)(15 downto 0) <= (OTHERS => '0');
86 sample(k)(15 downto 0) <= (OTHERS => '0');
87 END LOOP;
87 END LOOP;
88 sample_bit_counter <= 0;
88 sample_bit_counter <= 0;
89 sample_val <= '0';
89 sample_val <= '0';
90 SCK <= '1';
90 SCK <= '1';
91 ELSIF clk'EVENT AND clk = '1' THEN
91 ELSIF clk'EVENT AND clk = '1' THEN
92 IF (cnv_done = '1') AND (sample_bit_counter = 0) THEN
92 IF (cnv_done = '1') AND (sample_bit_counter = 0) THEN
93 sample_bit_counter <= 1;
93 sample_bit_counter <= 1;
94 ELSIF sample_bit_counter > 0 AND sample_bit_counter < 31 THEN
94 ELSIF sample_bit_counter > 0 AND sample_bit_counter < 31 THEN
95 sample_bit_counter <= sample_bit_counter + 1;
95 sample_bit_counter <= sample_bit_counter + 1;
96 ELSIF sample_bit_counter = 31 THEN
96 ELSIF sample_bit_counter = 31 THEN
97 sample_val <= '1';
97 sample_val <= '1';
98 FOR k IN 0 TO ChannelCount-1 LOOP
98 FOR k IN 0 TO ChannelCount-1 LOOP
99 sample(k)(0) <= sdo(k);
99 sample(k)(0) <= sdo(k);
100 sample(k)(15 DOWNTO 1) <= shift_reg(k)(14 DOWNTO 0);
100 sample(k)(15 DOWNTO 1) <= shift_reg(k)(14 DOWNTO 0);
101 END LOOP;
101 END LOOP;
102 sample_bit_counter <= 0;
102 sample_bit_counter <= 0;
103 ELSE
103 ELSE
104 sample_val <= '0';
104 sample_val <= '0';
105 END IF;
105 END IF;
106
106
107 IF (sample_bit_counter MOD 2) = 1 THEN -- get data on each channel
107 IF (sample_bit_counter MOD 2) = 1 THEN -- get data on each channel
108 FOR k IN 0 TO ChannelCount-1 LOOP
108 FOR k IN 0 TO ChannelCount-1 LOOP
109 shift_reg(k)(0) <= sdo(k);
109 shift_reg(k)(0) <= sdo(k);
110 shift_reg(k)(15 DOWNTO 1) <= shift_reg(k)(14 DOWNTO 0);
110 shift_reg(k)(14 DOWNTO 1) <= shift_reg(k)(13 DOWNTO 0);
111 END LOOP;
111 END LOOP;
112 SCK <= '0';
112 SCK <= '0';
113 ELSE
113 ELSE
114 SCK <= '1';
114 SCK <= '1';
115 END IF;
115 END IF;
116 END IF;
116 END IF;
117 END PROCESS;
117 END PROCESS;
118
118
119 END ar_ADS7886_drvr_v2; No newline at end of file
119 END ar_ADS7886_drvr_v2;
@@ -1,372 +1,373
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 : Alexis Jeandet
19 -- Author : Alexis Jeandet
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
20 -- Mail : alexis.jeandet@lpp.polytechnique.fr
21 ----------------------------------------------------------------------------
21 ----------------------------------------------------------------------------
22
22
23 LIBRARY IEEE;
23 LIBRARY IEEE;
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 USE grlib.devices.ALL;
28 USE grlib.devices.ALL;
29
29
30 PACKAGE lpp_ad_conv IS
30 PACKAGE lpp_ad_conv IS
31
31
32
32
33 --CONSTANT AD7688 : INTEGER := 0;
33 --CONSTANT AD7688 : INTEGER := 0;
34 --CONSTANT ADS7886 : INTEGER := 1;
34 --CONSTANT ADS7886 : INTEGER := 1;
35
35
36
36
37 --TYPE AD7688_out IS
37 --TYPE AD7688_out IS
38 --RECORD
38 --RECORD
39 -- CNV : STD_LOGIC;
39 -- CNV : STD_LOGIC;
40 -- SCK : STD_LOGIC;
40 -- SCK : STD_LOGIC;
41 --END RECORD;
41 --END RECORD;
42
42
43 --TYPE AD7688_in_element IS
43 --TYPE AD7688_in_element IS
44 --RECORD
44 --RECORD
45 -- SDI : STD_LOGIC;
45 -- SDI : STD_LOGIC;
46 --END RECORD;
46 --END RECORD;
47
47
48 --TYPE AD7688_in IS ARRAY(NATURAL RANGE <>) OF AD7688_in_element;
48 --TYPE AD7688_in IS ARRAY(NATURAL RANGE <>) OF AD7688_in_element;
49
49
50 TYPE Samples IS ARRAY(NATURAL RANGE <>) OF STD_LOGIC_VECTOR(15 DOWNTO 0);
50 TYPE Samples IS ARRAY(NATURAL RANGE <>) OF STD_LOGIC_VECTOR(15 DOWNTO 0);
51 TYPE Samples_15 IS ARRAY(NATURAL RANGE <>) OF STD_LOGIC_VECTOR(14 DOWNTO 0);
51
52
52 SUBTYPE Samples24 IS STD_LOGIC_VECTOR(23 DOWNTO 0);
53 SUBTYPE Samples24 IS STD_LOGIC_VECTOR(23 DOWNTO 0);
53
54
54 SUBTYPE Samples16 IS STD_LOGIC_VECTOR(15 DOWNTO 0);
55 SUBTYPE Samples16 IS STD_LOGIC_VECTOR(15 DOWNTO 0);
55
56
56 SUBTYPE Samples15 IS STD_LOGIC_VECTOR(14 DOWNTO 0);
57 SUBTYPE Samples15 IS STD_LOGIC_VECTOR(14 DOWNTO 0);
57
58
58 SUBTYPE Samples14 IS STD_LOGIC_VECTOR(13 DOWNTO 0);
59 SUBTYPE Samples14 IS STD_LOGIC_VECTOR(13 DOWNTO 0);
59
60
60 SUBTYPE Samples12 IS STD_LOGIC_VECTOR(11 DOWNTO 0);
61 SUBTYPE Samples12 IS STD_LOGIC_VECTOR(11 DOWNTO 0);
61
62
62 SUBTYPE Samples10 IS STD_LOGIC_VECTOR(9 DOWNTO 0);
63 SUBTYPE Samples10 IS STD_LOGIC_VECTOR(9 DOWNTO 0);
63
64
64 SUBTYPE Samples8 IS STD_LOGIC_VECTOR(7 DOWNTO 0);
65 SUBTYPE Samples8 IS STD_LOGIC_VECTOR(7 DOWNTO 0);
65
66
66 TYPE Samples24v IS ARRAY(NATURAL RANGE <>) OF Samples24;
67 TYPE Samples24v IS ARRAY(NATURAL RANGE <>) OF Samples24;
67
68
68 TYPE Samples16v IS ARRAY(NATURAL RANGE <>) OF Samples16;
69 TYPE Samples16v IS ARRAY(NATURAL RANGE <>) OF Samples16;
69
70
70 TYPE Samples15v IS ARRAY(NATURAL RANGE <>) OF Samples15;
71 TYPE Samples15v IS ARRAY(NATURAL RANGE <>) OF Samples15;
71
72
72 TYPE Samples14v IS ARRAY(NATURAL RANGE <>) OF Samples14;
73 TYPE Samples14v IS ARRAY(NATURAL RANGE <>) OF Samples14;
73
74
74 TYPE Samples12v IS ARRAY(NATURAL RANGE <>) OF Samples12;
75 TYPE Samples12v IS ARRAY(NATURAL RANGE <>) OF Samples12;
75
76
76 TYPE Samples10v IS ARRAY(NATURAL RANGE <>) OF Samples10;
77 TYPE Samples10v IS ARRAY(NATURAL RANGE <>) OF Samples10;
77
78
78 TYPE Samples8v IS ARRAY(NATURAL RANGE <>) OF Samples8;
79 TYPE Samples8v IS ARRAY(NATURAL RANGE <>) OF Samples8;
79
80
80 COMPONENT AD7688_drvr
81 COMPONENT AD7688_drvr
81 GENERIC (
82 GENERIC (
82 ChanelCount : INTEGER;
83 ChanelCount : INTEGER;
83 ncycle_cnv_high : INTEGER := 79;
84 ncycle_cnv_high : INTEGER := 79;
84 ncycle_cnv : INTEGER := 500);
85 ncycle_cnv : INTEGER := 500);
85 PORT (
86 PORT (
86 cnv_clk : IN STD_LOGIC;
87 cnv_clk : IN STD_LOGIC;
87 cnv_rstn : IN STD_LOGIC;
88 cnv_rstn : IN STD_LOGIC;
88 cnv_run : IN STD_LOGIC;
89 cnv_run : IN STD_LOGIC;
89 cnv : OUT STD_LOGIC;
90 cnv : OUT STD_LOGIC;
90 clk : IN STD_LOGIC;
91 clk : IN STD_LOGIC;
91 rstn : IN STD_LOGIC;
92 rstn : IN STD_LOGIC;
92 sck : OUT STD_LOGIC;
93 sck : OUT STD_LOGIC;
93 sdo : IN STD_LOGIC_VECTOR(ChanelCount-1 DOWNTO 0);
94 sdo : IN STD_LOGIC_VECTOR(ChanelCount-1 DOWNTO 0);
94 sample : OUT Samples(ChanelCount-1 DOWNTO 0);
95 sample : OUT Samples(ChanelCount-1 DOWNTO 0);
95 sample_val : OUT STD_LOGIC);
96 sample_val : OUT STD_LOGIC);
96 END COMPONENT;
97 END COMPONENT;
97
98
98 COMPONENT RHF1401_drvr IS
99 COMPONENT RHF1401_drvr IS
99 GENERIC(
100 GENERIC(
100 ChanelCount : INTEGER := 8);
101 ChanelCount : INTEGER := 8);
101 PORT (
102 PORT (
102 cnv_clk : IN STD_LOGIC;
103 cnv_clk : IN STD_LOGIC;
103 clk : IN STD_LOGIC;
104 clk : IN STD_LOGIC;
104 rstn : IN STD_LOGIC;
105 rstn : IN STD_LOGIC;
105 ADC_data : IN Samples14;
106 ADC_data : IN Samples14;
106 --ADC_smpclk : OUT STD_LOGIC;
107 --ADC_smpclk : OUT STD_LOGIC;
107 ADC_nOE : OUT STD_LOGIC_VECTOR(ChanelCount-1 DOWNTO 0);
108 ADC_nOE : OUT STD_LOGIC_VECTOR(ChanelCount-1 DOWNTO 0);
108 sample : OUT Samples14v(ChanelCount-1 DOWNTO 0);
109 sample : OUT Samples14v(ChanelCount-1 DOWNTO 0);
109 sample_val : OUT STD_LOGIC
110 sample_val : OUT STD_LOGIC
110 );
111 );
111 END COMPONENT;
112 END COMPONENT;
112
113
113 COMPONENT top_ad_conv_RHF1401
114 COMPONENT top_ad_conv_RHF1401
114 GENERIC (
115 GENERIC (
115 ChanelCount : INTEGER;
116 ChanelCount : INTEGER;
116 ncycle_cnv_high : INTEGER := 79;
117 ncycle_cnv_high : INTEGER := 79;
117 ncycle_cnv : INTEGER := 500);
118 ncycle_cnv : INTEGER := 500);
118 PORT (
119 PORT (
119 cnv_clk : IN STD_LOGIC;
120 cnv_clk : IN STD_LOGIC;
120 cnv_rstn : IN STD_LOGIC;
121 cnv_rstn : IN STD_LOGIC;
121 cnv : OUT STD_LOGIC;
122 cnv : OUT STD_LOGIC;
122 clk : IN STD_LOGIC;
123 clk : IN STD_LOGIC;
123 rstn : IN STD_LOGIC;
124 rstn : IN STD_LOGIC;
124 ADC_data : IN Samples14;
125 ADC_data : IN Samples14;
125 ADC_nOE : OUT STD_LOGIC_VECTOR(ChanelCount-1 DOWNTO 0);
126 ADC_nOE : OUT STD_LOGIC_VECTOR(ChanelCount-1 DOWNTO 0);
126 sample : OUT Samples14v(ChanelCount-1 DOWNTO 0);
127 sample : OUT Samples14v(ChanelCount-1 DOWNTO 0);
127 sample_val : OUT STD_LOGIC);
128 sample_val : OUT STD_LOGIC);
128 END COMPONENT;
129 END COMPONENT;
129
130
130
131
131 COMPONENT AD7688_drvr_sync
132 COMPONENT AD7688_drvr_sync
132 GENERIC (
133 GENERIC (
133 ChanelCount : INTEGER;
134 ChanelCount : INTEGER;
134 ncycle_cnv_high : INTEGER;
135 ncycle_cnv_high : INTEGER;
135 ncycle_cnv : INTEGER);
136 ncycle_cnv : INTEGER);
136 PORT (
137 PORT (
137 cnv_clk : IN STD_LOGIC;
138 cnv_clk : IN STD_LOGIC;
138 cnv_rstn : IN STD_LOGIC;
139 cnv_rstn : IN STD_LOGIC;
139 cnv_run : IN STD_LOGIC;
140 cnv_run : IN STD_LOGIC;
140 cnv : OUT STD_LOGIC;
141 cnv : OUT STD_LOGIC;
141 sck : OUT STD_LOGIC;
142 sck : OUT STD_LOGIC;
142 sdo : IN STD_LOGIC_VECTOR(ChanelCount-1 DOWNTO 0);
143 sdo : IN STD_LOGIC_VECTOR(ChanelCount-1 DOWNTO 0);
143 sample : OUT Samples(ChanelCount-1 DOWNTO 0);
144 sample : OUT Samples(ChanelCount-1 DOWNTO 0);
144 sample_val : OUT STD_LOGIC);
145 sample_val : OUT STD_LOGIC);
145 END COMPONENT;
146 END COMPONENT;
146
147
147 COMPONENT TestModule_RHF1401
148 COMPONENT TestModule_RHF1401
148 GENERIC (
149 GENERIC (
149 freq : INTEGER;
150 freq : INTEGER;
150 amplitude : INTEGER;
151 amplitude : INTEGER;
151 impulsion : INTEGER);
152 impulsion : INTEGER);
152 PORT (
153 PORT (
153 ADC_smpclk : IN STD_LOGIC;
154 ADC_smpclk : IN STD_LOGIC;
154 ADC_OEB_bar : IN STD_LOGIC;
155 ADC_OEB_bar : IN STD_LOGIC;
155 ADC_data : OUT STD_LOGIC_VECTOR(13 DOWNTO 0));
156 ADC_data : OUT STD_LOGIC_VECTOR(13 DOWNTO 0));
156 END COMPONENT;
157 END COMPONENT;
157
158
158 --COMPONENT AD7688_drvr IS
159 --COMPONENT AD7688_drvr IS
159 -- GENERIC(ChanelCount : INTEGER;
160 -- GENERIC(ChanelCount : INTEGER;
160 -- clkkHz : INTEGER);
161 -- clkkHz : INTEGER);
161 -- PORT (clk : IN STD_LOGIC;
162 -- PORT (clk : IN STD_LOGIC;
162 -- rstn : IN STD_LOGIC;
163 -- rstn : IN STD_LOGIC;
163 -- enable : IN STD_LOGIC;
164 -- enable : IN STD_LOGIC;
164 -- smplClk : IN STD_LOGIC;
165 -- smplClk : IN STD_LOGIC;
165 -- DataReady : OUT STD_LOGIC;
166 -- DataReady : OUT STD_LOGIC;
166 -- smpout : OUT Samples_out(ChanelCount-1 DOWNTO 0);
167 -- smpout : OUT Samples_out(ChanelCount-1 DOWNTO 0);
167 -- AD_in : IN AD7688_in(ChanelCount-1 DOWNTO 0);
168 -- AD_in : IN AD7688_in(ChanelCount-1 DOWNTO 0);
168 -- AD_out : OUT AD7688_out);
169 -- AD_out : OUT AD7688_out);
169 --END COMPONENT;
170 --END COMPONENT;
170
171
171
172
172 --COMPONENT AD7688_spi_if IS
173 --COMPONENT AD7688_spi_if IS
173 -- GENERIC(ChanelCount : INTEGER);
174 -- GENERIC(ChanelCount : INTEGER);
174 -- PORT(clk : IN STD_LOGIC;
175 -- PORT(clk : IN STD_LOGIC;
175 -- reset : IN STD_LOGIC;
176 -- reset : IN STD_LOGIC;
176 -- cnv : IN STD_LOGIC;
177 -- cnv : IN STD_LOGIC;
177 -- DataReady : OUT STD_LOGIC;
178 -- DataReady : OUT STD_LOGIC;
178 -- sdi : IN AD7688_in(ChanelCount-1 DOWNTO 0);
179 -- sdi : IN AD7688_in(ChanelCount-1 DOWNTO 0);
179 -- smpout : OUT Samples_out(ChanelCount-1 DOWNTO 0)
180 -- smpout : OUT Samples_out(ChanelCount-1 DOWNTO 0)
180 -- );
181 -- );
181 --END COMPONENT;
182 --END COMPONENT;
182
183
183
184
184 --COMPONENT lpp_apb_ad_conv
185 --COMPONENT lpp_apb_ad_conv
185 -- GENERIC(
186 -- GENERIC(
186 -- pindex : INTEGER := 0;
187 -- pindex : INTEGER := 0;
187 -- paddr : INTEGER := 0;
188 -- paddr : INTEGER := 0;
188 -- pmask : INTEGER := 16#fff#;
189 -- pmask : INTEGER := 16#fff#;
189 -- pirq : INTEGER := 0;
190 -- pirq : INTEGER := 0;
190 -- abits : INTEGER := 8;
191 -- abits : INTEGER := 8;
191 -- ChanelCount : INTEGER := 1;
192 -- ChanelCount : INTEGER := 1;
192 -- clkkHz : INTEGER := 50000;
193 -- clkkHz : INTEGER := 50000;
193 -- smpClkHz : INTEGER := 100;
194 -- smpClkHz : INTEGER := 100;
194 -- ADCref : INTEGER := AD7688);
195 -- ADCref : INTEGER := AD7688);
195 -- PORT (
196 -- PORT (
196 -- clk : IN STD_LOGIC;
197 -- clk : IN STD_LOGIC;
197 -- reset : IN STD_LOGIC;
198 -- reset : IN STD_LOGIC;
198 -- apbi : IN apb_slv_in_type;
199 -- apbi : IN apb_slv_in_type;
199 -- apbo : OUT apb_slv_out_type;
200 -- apbo : OUT apb_slv_out_type;
200 -- AD_in : IN AD7688_in(ChanelCount-1 DOWNTO 0);
201 -- AD_in : IN AD7688_in(ChanelCount-1 DOWNTO 0);
201 -- AD_out : OUT AD7688_out);
202 -- AD_out : OUT AD7688_out);
202 --END COMPONENT;
203 --END COMPONENT;
203
204
204 --COMPONENT ADS7886_drvr IS
205 --COMPONENT ADS7886_drvr IS
205 -- GENERIC(ChanelCount : INTEGER;
206 -- GENERIC(ChanelCount : INTEGER;
206 -- clkkHz : INTEGER);
207 -- clkkHz : INTEGER);
207 -- PORT (
208 -- PORT (
208 -- clk : IN STD_LOGIC;
209 -- clk : IN STD_LOGIC;
209 -- reset : IN STD_LOGIC;
210 -- reset : IN STD_LOGIC;
210 -- smplClk : IN STD_LOGIC;
211 -- smplClk : IN STD_LOGIC;
211 -- DataReady : OUT STD_LOGIC;
212 -- DataReady : OUT STD_LOGIC;
212 -- smpout : OUT Samples_out(ChanelCount-1 DOWNTO 0);
213 -- smpout : OUT Samples_out(ChanelCount-1 DOWNTO 0);
213 -- AD_in : IN AD7688_in(ChanelCount-1 DOWNTO 0);
214 -- AD_in : IN AD7688_in(ChanelCount-1 DOWNTO 0);
214 -- AD_out : OUT AD7688_out
215 -- AD_out : OUT AD7688_out
215 -- );
216 -- );
216 --END COMPONENT;
217 --END COMPONENT;
217
218
218 --COMPONENT WriteGen_ADC IS
219 --COMPONENT WriteGen_ADC IS
219 -- PORT(
220 -- PORT(
220 -- clk : IN STD_LOGIC;
221 -- clk : IN STD_LOGIC;
221 -- rstn : IN STD_LOGIC;
222 -- rstn : IN STD_LOGIC;
222 -- SmplCLK : IN STD_LOGIC;
223 -- SmplCLK : IN STD_LOGIC;
223 -- DataReady : IN STD_LOGIC;
224 -- DataReady : IN STD_LOGIC;
224 -- Full : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
225 -- Full : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
225 -- ReUse : OUT STD_LOGIC_VECTOR(4 DOWNTO 0);
226 -- ReUse : OUT STD_LOGIC_VECTOR(4 DOWNTO 0);
226 -- Write : OUT STD_LOGIC_VECTOR(4 DOWNTO 0)
227 -- Write : OUT STD_LOGIC_VECTOR(4 DOWNTO 0)
227 -- );
228 -- );
228 --END COMPONENT;
229 --END COMPONENT;
229
230
230
231
231 --===========================================================|
232 --===========================================================|
232 --======================= ADS 127X =========================|
233 --======================= ADS 127X =========================|
233 --===========================================================|
234 --===========================================================|
234
235
235 TYPE ADS127X_FORMAT_Type IS ARRAY(2 DOWNTO 0) OF STD_LOGIC;
236 TYPE ADS127X_FORMAT_Type IS ARRAY(2 DOWNTO 0) OF STD_LOGIC;
236 CONSTANT ADS127X_SPI_FORMAT : ADS127X_FORMAT_Type := "010";
237 CONSTANT ADS127X_SPI_FORMAT : ADS127X_FORMAT_Type := "010";
237 CONSTANT ADS127X_FSYNC_FORMAT : ADS127X_FORMAT_Type := "101";
238 CONSTANT ADS127X_FSYNC_FORMAT : ADS127X_FORMAT_Type := "101";
238
239
239 TYPE ADS127X_MODE_Type IS ARRAY(1 DOWNTO 0) OF STD_LOGIC;
240 TYPE ADS127X_MODE_Type IS ARRAY(1 DOWNTO 0) OF STD_LOGIC;
240 CONSTANT ADS127X_MODE_low_power : ADS127X_MODE_Type := "10";
241 CONSTANT ADS127X_MODE_low_power : ADS127X_MODE_Type := "10";
241 CONSTANT ADS127X_MODE_low_speed : ADS127X_MODE_Type := "11";
242 CONSTANT ADS127X_MODE_low_speed : ADS127X_MODE_Type := "11";
242 CONSTANT ADS127X_MODE_high_resolution : ADS127X_MODE_Type := "01";
243 CONSTANT ADS127X_MODE_high_resolution : ADS127X_MODE_Type := "01";
243
244
244 TYPE ADS127X_config IS
245 TYPE ADS127X_config IS
245 RECORD
246 RECORD
246 SYNC : STD_LOGIC;
247 SYNC : STD_LOGIC;
247 CLKDIV : STD_LOGIC;
248 CLKDIV : STD_LOGIC;
248 FORMAT : ADS127X_FORMAT_Type;
249 FORMAT : ADS127X_FORMAT_Type;
249 MODE : ADS127X_MODE_Type;
250 MODE : ADS127X_MODE_Type;
250 END RECORD;
251 END RECORD;
251
252
252 COMPONENT ADS1274_DRIVER IS
253 COMPONENT ADS1274_DRIVER IS
253 GENERIC(modeCfg : ADS127X_MODE_Type := ADS127X_MODE_low_power; formatCfg : ADS127X_FORMAT_Type := ADS127X_FSYNC_FORMAT);
254 GENERIC(modeCfg : ADS127X_MODE_Type := ADS127X_MODE_low_power; formatCfg : ADS127X_FORMAT_Type := ADS127X_FSYNC_FORMAT);
254 PORT(
255 PORT(
255 Clk : IN STD_LOGIC;
256 Clk : IN STD_LOGIC;
256 reset : IN STD_LOGIC;
257 reset : IN STD_LOGIC;
257 SpiClk : OUT STD_LOGIC;
258 SpiClk : OUT STD_LOGIC;
258 DIN : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
259 DIN : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
259 Ready : IN STD_LOGIC;
260 Ready : IN STD_LOGIC;
260 Format : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
261 Format : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
261 Mode : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
262 Mode : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
262 ClkDiv : OUT STD_LOGIC;
263 ClkDiv : OUT STD_LOGIC;
263 PWDOWN : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
264 PWDOWN : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
264 SmplClk : IN STD_LOGIC;
265 SmplClk : IN STD_LOGIC;
265 OUT0 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
266 OUT0 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
266 OUT1 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
267 OUT1 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
267 OUT2 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
268 OUT2 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
268 OUT3 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
269 OUT3 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
269 FSynch : OUT STD_LOGIC;
270 FSynch : OUT STD_LOGIC;
270 test : OUT STD_LOGIC
271 test : OUT STD_LOGIC
271 );
272 );
272 END COMPONENT;
273 END COMPONENT;
273
274
274 -- todo clean file
275 -- todo clean file
275 COMPONENT DUAL_ADS1278_DRIVER IS
276 COMPONENT DUAL_ADS1278_DRIVER IS
276 PORT(
277 PORT(
277 Clk : IN STD_LOGIC;
278 Clk : IN STD_LOGIC;
278 reset : IN STD_LOGIC;
279 reset : IN STD_LOGIC;
279 SpiClk : OUT STD_LOGIC;
280 SpiClk : OUT STD_LOGIC;
280 DIN : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
281 DIN : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
281 SmplClk : IN STD_LOGIC;
282 SmplClk : IN STD_LOGIC;
282 OUT00 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
283 OUT00 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
283 OUT01 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
284 OUT01 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
284 OUT02 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
285 OUT02 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
285 OUT03 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
286 OUT03 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
286 OUT04 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
287 OUT04 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
287 OUT05 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
288 OUT05 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
288 OUT06 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
289 OUT06 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
289 OUT07 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
290 OUT07 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
290 OUT10 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
291 OUT10 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
291 OUT11 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
292 OUT11 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
292 OUT12 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
293 OUT12 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
293 OUT13 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
294 OUT13 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
294 OUT14 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
295 OUT14 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
295 OUT15 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
296 OUT15 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
296 OUT16 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
297 OUT16 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
297 OUT17 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
298 OUT17 : OUT STD_LOGIC_VECTOR(23 DOWNTO 0);
298 FSynch : OUT STD_LOGIC
299 FSynch : OUT STD_LOGIC
299 );
300 );
300 END COMPONENT;
301 END COMPONENT;
301
302
302 --===========================================================|
303 --===========================================================|
303 -- DRIVER ADS7886
304 -- DRIVER ADS7886
304 --===========================================================|
305 --===========================================================|
305 COMPONENT top_ad_conv_ADS7886_v2 IS
306 COMPONENT top_ad_conv_ADS7886_v2 IS
306 GENERIC(
307 GENERIC(
307 ChannelCount : INTEGER := 8;
308 ChannelCount : INTEGER := 8;
308 SampleNbBits : INTEGER := 14;
309 SampleNbBits : INTEGER := 14;
309 ncycle_cnv_high : INTEGER := 40; -- at least 32 cycles
310 ncycle_cnv_high : INTEGER := 40; -- at least 32 cycles
310 ncycle_cnv : INTEGER := 500);
311 ncycle_cnv : INTEGER := 500);
311 PORT (
312 PORT (
312 -- CONV
313 -- CONV
313 cnv_clk : IN STD_LOGIC;
314 cnv_clk : IN STD_LOGIC;
314 cnv_rstn : IN STD_LOGIC;
315 cnv_rstn : IN STD_LOGIC;
315 cnv : OUT STD_LOGIC;
316 cnv : OUT STD_LOGIC;
316 -- DATA
317 -- DATA
317 clk : IN STD_LOGIC;
318 clk : IN STD_LOGIC;
318 rstn : IN STD_LOGIC;
319 rstn : IN STD_LOGIC;
319 sck : OUT STD_LOGIC;
320 sck : OUT STD_LOGIC;
320 sdo : IN STD_LOGIC_VECTOR(ChannelCount-1 DOWNTO 0);
321 sdo : IN STD_LOGIC_VECTOR(ChannelCount-1 DOWNTO 0);
321 -- SAMPLE
322 -- SAMPLE
322 sample : OUT Samples14v(ChannelCount-1 DOWNTO 0);
323 sample : OUT Samples14v(ChannelCount-1 DOWNTO 0);
323 sample_val : OUT STD_LOGIC
324 sample_val : OUT STD_LOGIC
324 );
325 );
325 END COMPONENT;
326 END COMPONENT;
326
327
327 COMPONENT ADS7886_drvr_v2 IS
328 COMPONENT ADS7886_drvr_v2 IS
328 GENERIC(
329 GENERIC(
329 ChannelCount : INTEGER := 8;
330 ChannelCount : INTEGER := 8;
330 NbBitsSamples : INTEGER := 16);
331 NbBitsSamples : INTEGER := 16);
331 PORT (
332 PORT (
332 -- CONV --
333 -- CONV --
333 cnv_clk : IN STD_LOGIC;
334 cnv_clk : IN STD_LOGIC;
334 cnv_rstn : IN STD_LOGIC;
335 cnv_rstn : IN STD_LOGIC;
335 -- DATA --
336 -- DATA --
336 clk : IN STD_LOGIC;
337 clk : IN STD_LOGIC;
337 rstn : IN STD_LOGIC;
338 rstn : IN STD_LOGIC;
338 sck : OUT STD_LOGIC;
339 sck : OUT STD_LOGIC;
339 sdo : IN STD_LOGIC_VECTOR(ChannelCount-1 DOWNTO 0);
340 sdo : IN STD_LOGIC_VECTOR(ChannelCount-1 DOWNTO 0);
340 -- SAMPLE --
341 -- SAMPLE --
341 sample : OUT Samples(ChannelCount-1 DOWNTO 0);
342 sample : OUT Samples(ChannelCount-1 DOWNTO 0);
342 sample_val : OUT STD_LOGIC
343 sample_val : OUT STD_LOGIC
343 );
344 );
344 END COMPONENT;
345 END COMPONENT;
345
346
346 COMPONENT top_ad_conv_RHF1401_withFilter
347 COMPONENT top_ad_conv_RHF1401_withFilter
347 GENERIC (
348 GENERIC (
348 ChanelCount : INTEGER;
349 ChanelCount : INTEGER;
349 ncycle_cnv_high : INTEGER;
350 ncycle_cnv_high : INTEGER;
350 ncycle_cnv : INTEGER);
351 ncycle_cnv : INTEGER);
351 PORT (
352 PORT (
352 cnv_clk : IN STD_LOGIC;
353 cnv_clk : IN STD_LOGIC;
353 cnv_rstn : IN STD_LOGIC;
354 cnv_rstn : IN STD_LOGIC;
354 cnv : OUT STD_LOGIC;
355 cnv : OUT STD_LOGIC;
355 clk : IN STD_LOGIC;
356 clk : IN STD_LOGIC;
356 rstn : IN STD_LOGIC;
357 rstn : IN STD_LOGIC;
357 ADC_data : IN Samples14;
358 ADC_data : IN Samples14;
358 ADC_nOE : OUT STD_LOGIC_VECTOR(ChanelCount-1 DOWNTO 0);
359 ADC_nOE : OUT STD_LOGIC_VECTOR(ChanelCount-1 DOWNTO 0);
359 sample : OUT Samples14v(ChanelCount-1 DOWNTO 0);
360 sample : OUT Samples14v(ChanelCount-1 DOWNTO 0);
360 sample_val : OUT STD_LOGIC);
361 sample_val : OUT STD_LOGIC);
361 END COMPONENT;
362 END COMPONENT;
362
363
363
364
364 END lpp_ad_conv;
365 END lpp_ad_conv;
365
366
366
367
367
368
368
369
369
370
370
371
371
372
372
373
@@ -1,509 +1,509
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 END lpp_lfr;
63 END lpp_lfr;
64
64
65 ARCHITECTURE beh OF lpp_lfr IS
65 ARCHITECTURE beh OF lpp_lfr IS
66 SIGNAL sample_s : Samples(7 DOWNTO 0);
66 SIGNAL sample_s : Samples(7 DOWNTO 0);
67 --
67 --
68 SIGNAL data_shaping_SP0 : STD_LOGIC;
68 SIGNAL data_shaping_SP0 : STD_LOGIC;
69 SIGNAL data_shaping_SP1 : STD_LOGIC;
69 SIGNAL data_shaping_SP1 : STD_LOGIC;
70 SIGNAL data_shaping_R0 : STD_LOGIC;
70 SIGNAL data_shaping_R0 : STD_LOGIC;
71 SIGNAL data_shaping_R1 : STD_LOGIC;
71 SIGNAL data_shaping_R1 : STD_LOGIC;
72 SIGNAL data_shaping_R2 : STD_LOGIC;
72 SIGNAL data_shaping_R2 : STD_LOGIC;
73 --
73 --
74 SIGNAL sample_f0_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
74 SIGNAL sample_f0_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
75 SIGNAL sample_f1_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
75 SIGNAL sample_f1_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
76 SIGNAL sample_f2_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
76 SIGNAL sample_f2_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
77 --
77 --
78 SIGNAL sample_f0_val : STD_LOGIC;
78 SIGNAL sample_f0_val : STD_LOGIC;
79 SIGNAL sample_f1_val : STD_LOGIC;
79 SIGNAL sample_f1_val : STD_LOGIC;
80 SIGNAL sample_f2_val : STD_LOGIC;
80 SIGNAL sample_f2_val : STD_LOGIC;
81 SIGNAL sample_f3_val : STD_LOGIC;
81 SIGNAL sample_f3_val : STD_LOGIC;
82 --
82 --
83 SIGNAL sample_f0_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
83 SIGNAL sample_f0_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
84 SIGNAL sample_f1_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
84 SIGNAL sample_f1_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
85 SIGNAL sample_f2_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
85 SIGNAL sample_f2_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
86 SIGNAL sample_f3_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
86 SIGNAL sample_f3_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
87 --
87 --
88 SIGNAL sample_f0_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
88 SIGNAL sample_f0_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
89 SIGNAL sample_f1_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
89 SIGNAL sample_f1_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
90 SIGNAL sample_f2_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
90 SIGNAL sample_f2_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
91
91
92 -- SM
92 -- SM
93 SIGNAL ready_matrix_f0 : STD_LOGIC;
93 SIGNAL ready_matrix_f0 : STD_LOGIC;
94 SIGNAL ready_matrix_f0_1 : STD_LOGIC;
94 -- SIGNAL ready_matrix_f0_1 : STD_LOGIC;
95 SIGNAL ready_matrix_f1 : STD_LOGIC;
95 SIGNAL ready_matrix_f1 : STD_LOGIC;
96 SIGNAL ready_matrix_f2 : STD_LOGIC;
96 SIGNAL ready_matrix_f2 : STD_LOGIC;
97 SIGNAL status_ready_matrix_f0 : STD_LOGIC;
97 SIGNAL status_ready_matrix_f0 : STD_LOGIC;
98 SIGNAL status_ready_matrix_f0_1 : STD_LOGIC;
98 -- SIGNAL status_ready_matrix_f0_1 : STD_LOGIC;
99 SIGNAL status_ready_matrix_f1 : STD_LOGIC;
99 SIGNAL status_ready_matrix_f1 : STD_LOGIC;
100 SIGNAL status_ready_matrix_f2 : STD_LOGIC;
100 SIGNAL status_ready_matrix_f2 : STD_LOGIC;
101 SIGNAL addr_matrix_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
101 SIGNAL addr_matrix_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
102 SIGNAL addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
102 SIGNAL addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
103 SIGNAL addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
103 SIGNAL addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
104 SIGNAL length_matrix_f0 : STD_LOGIC_VECTOR(25 DOWNTO 0);
104 SIGNAL length_matrix_f0 : STD_LOGIC_VECTOR(25 DOWNTO 0);
105 SIGNAL length_matrix_f1 : STD_LOGIC_VECTOR(25 DOWNTO 0);
105 SIGNAL length_matrix_f1 : STD_LOGIC_VECTOR(25 DOWNTO 0);
106 SIGNAL length_matrix_f2 : STD_LOGIC_VECTOR(25 DOWNTO 0);
106 SIGNAL length_matrix_f2 : STD_LOGIC_VECTOR(25 DOWNTO 0);
107
107
108 -- WFP
108 -- WFP
109 SIGNAL status_new_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
109 SIGNAL status_new_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
110 SIGNAL delta_snapshot : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
110 SIGNAL delta_snapshot : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
111 SIGNAL delta_f0 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
111 SIGNAL delta_f0 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
112 SIGNAL delta_f0_2 : STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
112 SIGNAL delta_f0_2 : STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
113 SIGNAL delta_f1 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
113 SIGNAL delta_f1 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
114 SIGNAL delta_f2 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
114 SIGNAL delta_f2 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
115
115
116 SIGNAL nb_data_by_buffer : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
116 SIGNAL nb_data_by_buffer : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
117 SIGNAL nb_snapshot_param : STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
117 SIGNAL nb_snapshot_param : STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
118 SIGNAL enable_f0 : STD_LOGIC;
118 SIGNAL enable_f0 : STD_LOGIC;
119 SIGNAL enable_f1 : STD_LOGIC;
119 SIGNAL enable_f1 : STD_LOGIC;
120 SIGNAL enable_f2 : STD_LOGIC;
120 SIGNAL enable_f2 : STD_LOGIC;
121 SIGNAL enable_f3 : STD_LOGIC;
121 SIGNAL enable_f3 : STD_LOGIC;
122 SIGNAL burst_f0 : STD_LOGIC;
122 SIGNAL burst_f0 : STD_LOGIC;
123 SIGNAL burst_f1 : STD_LOGIC;
123 SIGNAL burst_f1 : STD_LOGIC;
124 SIGNAL burst_f2 : STD_LOGIC;
124 SIGNAL burst_f2 : STD_LOGIC;
125
125
126 --SIGNAL run : STD_LOGIC;
126 --SIGNAL run : STD_LOGIC;
127 SIGNAL start_date : STD_LOGIC_VECTOR(30 DOWNTO 0);
127 SIGNAL start_date : STD_LOGIC_VECTOR(30 DOWNTO 0);
128
128
129 -----------------------------------------------------------------------------
129 -----------------------------------------------------------------------------
130 --
130 --
131 -----------------------------------------------------------------------------
131 -----------------------------------------------------------------------------
132 SIGNAL data_f0_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
132 -- SIGNAL data_f0_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
133 SIGNAL data_f0_data_out_valid_s : STD_LOGIC;
133 -- SIGNAL data_f0_data_out_valid_s : STD_LOGIC;
134 SIGNAL data_f0_data_out_valid_burst_s : STD_LOGIC;
134 -- SIGNAL data_f0_data_out_valid_burst_s : STD_LOGIC;
135 --f1
135 --f1
136 SIGNAL data_f1_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
136 -- SIGNAL data_f1_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
137 SIGNAL data_f1_data_out_valid_s : STD_LOGIC;
137 -- SIGNAL data_f1_data_out_valid_s : STD_LOGIC;
138 SIGNAL data_f1_data_out_valid_burst_s : STD_LOGIC;
138 -- SIGNAL data_f1_data_out_valid_burst_s : STD_LOGIC;
139 --f2
139 --f2
140 SIGNAL data_f2_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
140 -- SIGNAL data_f2_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
141 SIGNAL data_f2_data_out_valid_s : STD_LOGIC;
141 -- SIGNAL data_f2_data_out_valid_s : STD_LOGIC;
142 SIGNAL data_f2_data_out_valid_burst_s : STD_LOGIC;
142 -- SIGNAL data_f2_data_out_valid_burst_s : STD_LOGIC;
143 --f3
143 --f3
144 SIGNAL data_f3_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
144 -- SIGNAL data_f3_addr_out_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
145 SIGNAL data_f3_data_out_valid_s : STD_LOGIC;
145 -- SIGNAL data_f3_data_out_valid_s : STD_LOGIC;
146 SIGNAL data_f3_data_out_valid_burst_s : STD_LOGIC;
146 -- SIGNAL data_f3_data_out_valid_burst_s : STD_LOGIC;
147
147
148 SIGNAL wfp_status_buffer_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
148 SIGNAL wfp_status_buffer_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
149 SIGNAL wfp_addr_buffer : STD_LOGIC_VECTOR(32*4 DOWNTO 0);
149 SIGNAL wfp_addr_buffer : STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
150 SIGNAL wfp_length_buffer : STD_LOGIC_VECTOR(25 DOWNTO 0);
150 SIGNAL wfp_length_buffer : STD_LOGIC_VECTOR(25 DOWNTO 0);
151 SIGNAL wfp_ready_buffer : STD_LOGIC_VECTOR(3 DOWNTO 0);
151 SIGNAL wfp_ready_buffer : STD_LOGIC_VECTOR(3 DOWNTO 0);
152 SIGNAL wfp_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
152 SIGNAL wfp_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
153 SIGNAL wfp_error_buffer_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
153 SIGNAL wfp_error_buffer_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
154 -----------------------------------------------------------------------------
154 -----------------------------------------------------------------------------
155 -- DMA RR
155 -- DMA RR
156 -----------------------------------------------------------------------------
156 -----------------------------------------------------------------------------
157 SIGNAL dma_sel_valid : STD_LOGIC;
157 -- SIGNAL dma_sel_valid : STD_LOGIC;
158 SIGNAL dma_rr_valid : STD_LOGIC_VECTOR(3 DOWNTO 0);
158 -- SIGNAL dma_rr_valid : STD_LOGIC_VECTOR(3 DOWNTO 0);
159 SIGNAL dma_rr_grant_s : STD_LOGIC_VECTOR(3 DOWNTO 0);
159 -- SIGNAL dma_rr_grant_s : STD_LOGIC_VECTOR(3 DOWNTO 0);
160 SIGNAL dma_rr_grant_ms : STD_LOGIC_VECTOR(3 DOWNTO 0);
160 -- SIGNAL dma_rr_grant_ms : STD_LOGIC_VECTOR(3 DOWNTO 0);
161 SIGNAL dma_rr_valid_ms : STD_LOGIC_VECTOR(3 DOWNTO 0);
161 -- SIGNAL dma_rr_valid_ms : STD_LOGIC_VECTOR(3 DOWNTO 0);
162
162
163 SIGNAL dma_rr_grant : STD_LOGIC_VECTOR(4 DOWNTO 0);
163 -- SIGNAL dma_rr_grant : STD_LOGIC_VECTOR(4 DOWNTO 0);
164 SIGNAL dma_sel : STD_LOGIC_VECTOR(4 DOWNTO 0);
164 -- SIGNAL dma_sel : STD_LOGIC_VECTOR(4 DOWNTO 0);
165
165
166 -----------------------------------------------------------------------------
166 -----------------------------------------------------------------------------
167 -- DMA_REG
167 -- DMA_REG
168 -----------------------------------------------------------------------------
168 -----------------------------------------------------------------------------
169 SIGNAL ongoing_reg : STD_LOGIC;
169 -- SIGNAL ongoing_reg : STD_LOGIC;
170 SIGNAL dma_sel_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
170 -- SIGNAL dma_sel_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
171 SIGNAL dma_send_reg : STD_LOGIC;
171 -- SIGNAL dma_send_reg : STD_LOGIC;
172 SIGNAL dma_valid_burst_reg : STD_LOGIC; -- (1 => BURST , 0 => SINGLE)
172 -- SIGNAL dma_valid_burst_reg : STD_LOGIC; -- (1 => BURST , 0 => SINGLE)
173 SIGNAL dma_address_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
173 -- SIGNAL dma_address_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
174 SIGNAL dma_data_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
174 -- SIGNAL dma_data_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
175
175
176
176
177 -----------------------------------------------------------------------------
177 -----------------------------------------------------------------------------
178 -- DMA
178 -- DMA
179 -----------------------------------------------------------------------------
179 -----------------------------------------------------------------------------
180 SIGNAL dma_send : STD_LOGIC;
180 -- SIGNAL dma_send : STD_LOGIC;
181 SIGNAL dma_valid_burst : STD_LOGIC; -- (1 => BURST , 0 => SINGLE)
181 -- SIGNAL dma_valid_burst : STD_LOGIC; -- (1 => BURST , 0 => SINGLE)
182 SIGNAL dma_done : STD_LOGIC;
182 -- SIGNAL dma_done : STD_LOGIC;
183 SIGNAL dma_ren : STD_LOGIC;
183 -- SIGNAL dma_ren : STD_LOGIC;
184 SIGNAL dma_address : STD_LOGIC_VECTOR(31 DOWNTO 0);
184 -- SIGNAL dma_address : STD_LOGIC_VECTOR(31 DOWNTO 0);
185 SIGNAL dma_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
185 -- SIGNAL dma_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
186 SIGNAL dma_data_2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
186 -- SIGNAL dma_data_2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
187
187
188 -----------------------------------------------------------------------------
188 -----------------------------------------------------------------------------
189 -- MS
189 -- MS
190 -----------------------------------------------------------------------------
190 -----------------------------------------------------------------------------
191
191
192 SIGNAL data_ms_addr : STD_LOGIC_VECTOR(31 DOWNTO 0);
192 -- SIGNAL data_ms_addr : STD_LOGIC_VECTOR(31 DOWNTO 0);
193 SIGNAL data_ms_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
193 -- SIGNAL data_ms_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
194 SIGNAL data_ms_valid : STD_LOGIC;
194 -- SIGNAL data_ms_valid : STD_LOGIC;
195 SIGNAL data_ms_valid_burst : STD_LOGIC;
195 -- SIGNAL data_ms_valid_burst : STD_LOGIC;
196 SIGNAL data_ms_ren : STD_LOGIC;
196 -- SIGNAL data_ms_ren : STD_LOGIC;
197 SIGNAL data_ms_done : STD_LOGIC;
197 -- SIGNAL data_ms_done : STD_LOGIC;
198 SIGNAL dma_ms_ongoing : STD_LOGIC;
198 -- SIGNAL dma_ms_ongoing : STD_LOGIC;
199
199
200 -- SIGNAL run_ms : STD_LOGIC;
200 -- SIGNAL run_ms : STD_LOGIC;
201 SIGNAL ms_softandhard_rstn : STD_LOGIC;
201 -- SIGNAL ms_softandhard_rstn : STD_LOGIC;
202
202
203 SIGNAL matrix_time_f0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
203 SIGNAL matrix_time_f0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
204 -- SIGNAL matrix_time_f0_1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
204 -- SIGNAL matrix_time_f0_1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
205 SIGNAL matrix_time_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
205 SIGNAL matrix_time_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
206 SIGNAL matrix_time_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
206 SIGNAL matrix_time_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
207
207
208
208
209 SIGNAL error_buffer_full : STD_LOGIC;
209 SIGNAL error_buffer_full : STD_LOGIC;
210 SIGNAL error_input_fifo_write : STD_LOGIC_VECTOR(2 DOWNTO 0);
210 SIGNAL error_input_fifo_write : STD_LOGIC_VECTOR(2 DOWNTO 0);
211
211
212 -- SIGNAL debug_ms : STD_LOGIC_VECTOR(31 DOWNTO 0);
212 -- SIGNAL debug_ms : STD_LOGIC_VECTOR(31 DOWNTO 0);
213 SIGNAL debug_signal : STD_LOGIC_VECTOR(31 DOWNTO 0);
213 -- SIGNAL debug_signal : STD_LOGIC_VECTOR(31 DOWNTO 0);
214
214
215 -----------------------------------------------------------------------------
215 -----------------------------------------------------------------------------
216 SIGNAL dma_fifo_burst_valid : STD_LOGIC_VECTOR(4 DOWNTO 0);
216 SIGNAL dma_fifo_burst_valid : STD_LOGIC_VECTOR(4 DOWNTO 0);
217 SIGNAL dma_fifo_data : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
217 SIGNAL dma_fifo_data : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
218 SIGNAL dma_fifo_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
218 SIGNAL dma_fifo_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
219 SIGNAL dma_buffer_new : STD_LOGIC_VECTOR(4 DOWNTO 0);
219 SIGNAL dma_buffer_new : STD_LOGIC_VECTOR(4 DOWNTO 0);
220 SIGNAL dma_buffer_addr : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
220 SIGNAL dma_buffer_addr : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
221 SIGNAL dma_buffer_length : STD_LOGIC_VECTOR(26*5-1 DOWNTO 0);
221 SIGNAL dma_buffer_length : STD_LOGIC_VECTOR(26*5-1 DOWNTO 0);
222 SIGNAL dma_buffer_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
222 SIGNAL dma_buffer_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
223 SIGNAL dma_buffer_full_err : STD_LOGIC_VECTOR(4 DOWNTO 0);
223 SIGNAL dma_buffer_full_err : STD_LOGIC_VECTOR(4 DOWNTO 0);
224 SIGNAL dma_grant_error : STD_LOGIC;
224 SIGNAL dma_grant_error : STD_LOGIC;
225
225
226 -----------------------------------------------------------------------------
226 -----------------------------------------------------------------------------
227 -- SIGNAL run_dma : STD_LOGIC;
227 -- SIGNAL run_dma : STD_LOGIC;
228 BEGIN
228 BEGIN
229
229
230 sample_s(4 DOWNTO 0) <= sample_E(4 DOWNTO 0);
230 sample_s(4 DOWNTO 0) <= sample_E(4 DOWNTO 0);
231 sample_s(7 DOWNTO 5) <= sample_B(2 DOWNTO 0);
231 sample_s(7 DOWNTO 5) <= sample_B(2 DOWNTO 0);
232
232
233 --all_channel : FOR i IN 7 DOWNTO 0 GENERATE
233 --all_channel : FOR i IN 7 DOWNTO 0 GENERATE
234 -- sample_s(i) <= sample(i)(13) & sample(i)(13) & sample(i);
234 -- sample_s(i) <= sample(i)(13) & sample(i)(13) & sample(i);
235 --END GENERATE all_channel;
235 --END GENERATE all_channel;
236
236
237 -----------------------------------------------------------------------------
237 -----------------------------------------------------------------------------
238 lpp_lfr_filter_1 : lpp_lfr_filter
238 lpp_lfr_filter_1 : lpp_lfr_filter
239 GENERIC MAP (
239 GENERIC MAP (
240 Mem_use => Mem_use)
240 Mem_use => Mem_use)
241 PORT MAP (
241 PORT MAP (
242 sample => sample_s,
242 sample => sample_s,
243 sample_val => sample_val,
243 sample_val => sample_val,
244 clk => clk,
244 clk => clk,
245 rstn => rstn,
245 rstn => rstn,
246 data_shaping_SP0 => data_shaping_SP0,
246 data_shaping_SP0 => data_shaping_SP0,
247 data_shaping_SP1 => data_shaping_SP1,
247 data_shaping_SP1 => data_shaping_SP1,
248 data_shaping_R0 => data_shaping_R0,
248 data_shaping_R0 => data_shaping_R0,
249 data_shaping_R1 => data_shaping_R1,
249 data_shaping_R1 => data_shaping_R1,
250 data_shaping_R2 => data_shaping_R2,
250 data_shaping_R2 => data_shaping_R2,
251 sample_f0_val => sample_f0_val,
251 sample_f0_val => sample_f0_val,
252 sample_f1_val => sample_f1_val,
252 sample_f1_val => sample_f1_val,
253 sample_f2_val => sample_f2_val,
253 sample_f2_val => sample_f2_val,
254 sample_f3_val => sample_f3_val,
254 sample_f3_val => sample_f3_val,
255 sample_f0_wdata => sample_f0_data,
255 sample_f0_wdata => sample_f0_data,
256 sample_f1_wdata => sample_f1_data,
256 sample_f1_wdata => sample_f1_data,
257 sample_f2_wdata => sample_f2_data,
257 sample_f2_wdata => sample_f2_data,
258 sample_f3_wdata => sample_f3_data);
258 sample_f3_wdata => sample_f3_data);
259
259
260 -----------------------------------------------------------------------------
260 -----------------------------------------------------------------------------
261 lpp_lfr_apbreg_1 : lpp_lfr_apbreg
261 lpp_lfr_apbreg_1 : lpp_lfr_apbreg
262 GENERIC MAP (
262 GENERIC MAP (
263 nb_data_by_buffer_size => nb_data_by_buffer_size,
263 nb_data_by_buffer_size => nb_data_by_buffer_size,
264 -- nb_word_by_buffer_size => nb_word_by_buffer_size, -- TODO
264 -- nb_word_by_buffer_size => nb_word_by_buffer_size, -- TODO
265 nb_snapshot_param_size => nb_snapshot_param_size,
265 nb_snapshot_param_size => nb_snapshot_param_size,
266 delta_vector_size => delta_vector_size,
266 delta_vector_size => delta_vector_size,
267 delta_vector_size_f0_2 => delta_vector_size_f0_2,
267 delta_vector_size_f0_2 => delta_vector_size_f0_2,
268 pindex => pindex,
268 pindex => pindex,
269 paddr => paddr,
269 paddr => paddr,
270 pmask => pmask,
270 pmask => pmask,
271 pirq_ms => pirq_ms,
271 pirq_ms => pirq_ms,
272 pirq_wfp => pirq_wfp,
272 pirq_wfp => pirq_wfp,
273 top_lfr_version => top_lfr_version)
273 top_lfr_version => top_lfr_version)
274 PORT MAP (
274 PORT MAP (
275 HCLK => clk,
275 HCLK => clk,
276 HRESETn => rstn,
276 HRESETn => rstn,
277 apbi => apbi,
277 apbi => apbi,
278 apbo => apbo,
278 apbo => apbo,
279
279
280 run_ms => OPEN,--run_ms,
280 run_ms => OPEN,--run_ms,
281
281
282 ready_matrix_f0 => ready_matrix_f0,
282 ready_matrix_f0 => ready_matrix_f0,
283 ready_matrix_f1 => ready_matrix_f1,
283 ready_matrix_f1 => ready_matrix_f1,
284 ready_matrix_f2 => ready_matrix_f2,
284 ready_matrix_f2 => ready_matrix_f2,
285 error_buffer_full => error_buffer_full, -- TODO
285 error_buffer_full => error_buffer_full, -- TODO
286 error_input_fifo_write => error_input_fifo_write, -- TODO
286 error_input_fifo_write => error_input_fifo_write, -- TODO
287 status_ready_matrix_f0 => status_ready_matrix_f0,
287 status_ready_matrix_f0 => status_ready_matrix_f0,
288 status_ready_matrix_f1 => status_ready_matrix_f1,
288 status_ready_matrix_f1 => status_ready_matrix_f1,
289 status_ready_matrix_f2 => status_ready_matrix_f2,
289 status_ready_matrix_f2 => status_ready_matrix_f2,
290
290
291 matrix_time_f0 => matrix_time_f0,
291 matrix_time_f0 => matrix_time_f0,
292 matrix_time_f1 => matrix_time_f1,
292 matrix_time_f1 => matrix_time_f1,
293 matrix_time_f2 => matrix_time_f2,
293 matrix_time_f2 => matrix_time_f2,
294
294
295 addr_matrix_f0 => addr_matrix_f0,
295 addr_matrix_f0 => addr_matrix_f0,
296 addr_matrix_f1 => addr_matrix_f1,
296 addr_matrix_f1 => addr_matrix_f1,
297 addr_matrix_f2 => addr_matrix_f2,
297 addr_matrix_f2 => addr_matrix_f2,
298
298
299 length_matrix_f0 => length_matrix_f0,
299 length_matrix_f0 => length_matrix_f0,
300 length_matrix_f1 => length_matrix_f1,
300 length_matrix_f1 => length_matrix_f1,
301 length_matrix_f2 => length_matrix_f2,
301 length_matrix_f2 => length_matrix_f2,
302 -------------------------------------------------------------------------
302 -------------------------------------------------------------------------
303 --status_full => status_full, -- TODo
303 --status_full => status_full, -- TODo
304 --status_full_ack => status_full_ack, -- TODo
304 --status_full_ack => status_full_ack, -- TODo
305 --status_full_err => status_full_err, -- TODo
305 --status_full_err => status_full_err, -- TODo
306 status_new_err => status_new_err,
306 status_new_err => status_new_err,
307 data_shaping_BW => data_shaping_BW,
307 data_shaping_BW => data_shaping_BW,
308 data_shaping_SP0 => data_shaping_SP0,
308 data_shaping_SP0 => data_shaping_SP0,
309 data_shaping_SP1 => data_shaping_SP1,
309 data_shaping_SP1 => data_shaping_SP1,
310 data_shaping_R0 => data_shaping_R0,
310 data_shaping_R0 => data_shaping_R0,
311 data_shaping_R1 => data_shaping_R1,
311 data_shaping_R1 => data_shaping_R1,
312 data_shaping_R2 => data_shaping_R2,
312 data_shaping_R2 => data_shaping_R2,
313 delta_snapshot => delta_snapshot,
313 delta_snapshot => delta_snapshot,
314 delta_f0 => delta_f0,
314 delta_f0 => delta_f0,
315 delta_f0_2 => delta_f0_2,
315 delta_f0_2 => delta_f0_2,
316 delta_f1 => delta_f1,
316 delta_f1 => delta_f1,
317 delta_f2 => delta_f2,
317 delta_f2 => delta_f2,
318 nb_data_by_buffer => nb_data_by_buffer,
318 nb_data_by_buffer => nb_data_by_buffer,
319 -- nb_word_by_buffer => nb_word_by_buffer, -- TODO
319 -- nb_word_by_buffer => nb_word_by_buffer, -- TODO
320 nb_snapshot_param => nb_snapshot_param,
320 nb_snapshot_param => nb_snapshot_param,
321 enable_f0 => enable_f0,
321 enable_f0 => enable_f0,
322 enable_f1 => enable_f1,
322 enable_f1 => enable_f1,
323 enable_f2 => enable_f2,
323 enable_f2 => enable_f2,
324 enable_f3 => enable_f3,
324 enable_f3 => enable_f3,
325 burst_f0 => burst_f0,
325 burst_f0 => burst_f0,
326 burst_f1 => burst_f1,
326 burst_f1 => burst_f1,
327 burst_f2 => burst_f2,
327 burst_f2 => burst_f2,
328 run => OPEN, --run,
328 run => OPEN, --run,
329 start_date => start_date,
329 start_date => start_date,
330 -- debug_signal => debug_signal,
330 -- debug_signal => debug_signal,
331 wfp_status_buffer_ready => wfp_status_buffer_ready,-- TODO
331 wfp_status_buffer_ready => wfp_status_buffer_ready,-- TODO
332 wfp_addr_buffer => wfp_addr_buffer,-- TODO
332 wfp_addr_buffer => wfp_addr_buffer,-- TODO
333 wfp_length_buffer => wfp_length_buffer,-- TODO
333 wfp_length_buffer => wfp_length_buffer,-- TODO
334
334
335 wfp_ready_buffer => wfp_ready_buffer,-- TODO
335 wfp_ready_buffer => wfp_ready_buffer,-- TODO
336 wfp_buffer_time => wfp_buffer_time,-- TODO
336 wfp_buffer_time => wfp_buffer_time,-- TODO
337 wfp_error_buffer_full => wfp_error_buffer_full -- TODO
337 wfp_error_buffer_full => wfp_error_buffer_full -- TODO
338 );
338 );
339
339
340 -----------------------------------------------------------------------------
340 -----------------------------------------------------------------------------
341 -----------------------------------------------------------------------------
341 -----------------------------------------------------------------------------
342 lpp_waveform_1 : lpp_waveform
342 lpp_waveform_1 : lpp_waveform
343 GENERIC MAP (
343 GENERIC MAP (
344 tech => inferred,
344 tech => inferred,
345 data_size => 6*16,
345 data_size => 6*16,
346 nb_data_by_buffer_size => nb_data_by_buffer_size,
346 nb_data_by_buffer_size => nb_data_by_buffer_size,
347 nb_snapshot_param_size => nb_snapshot_param_size,
347 nb_snapshot_param_size => nb_snapshot_param_size,
348 delta_vector_size => delta_vector_size,
348 delta_vector_size => delta_vector_size,
349 delta_vector_size_f0_2 => delta_vector_size_f0_2
349 delta_vector_size_f0_2 => delta_vector_size_f0_2
350 )
350 )
351 PORT MAP (
351 PORT MAP (
352 clk => clk,
352 clk => clk,
353 rstn => rstn,
353 rstn => rstn,
354
354
355 reg_run => '1',--run,
355 reg_run => '1',--run,
356 reg_start_date => start_date,
356 reg_start_date => start_date,
357 reg_delta_snapshot => delta_snapshot,
357 reg_delta_snapshot => delta_snapshot,
358 reg_delta_f0 => delta_f0,
358 reg_delta_f0 => delta_f0,
359 reg_delta_f0_2 => delta_f0_2,
359 reg_delta_f0_2 => delta_f0_2,
360 reg_delta_f1 => delta_f1,
360 reg_delta_f1 => delta_f1,
361 reg_delta_f2 => delta_f2,
361 reg_delta_f2 => delta_f2,
362
362
363 enable_f0 => enable_f0,
363 enable_f0 => enable_f0,
364 enable_f1 => enable_f1,
364 enable_f1 => enable_f1,
365 enable_f2 => enable_f2,
365 enable_f2 => enable_f2,
366 enable_f3 => enable_f3,
366 enable_f3 => enable_f3,
367 burst_f0 => burst_f0,
367 burst_f0 => burst_f0,
368 burst_f1 => burst_f1,
368 burst_f1 => burst_f1,
369 burst_f2 => burst_f2,
369 burst_f2 => burst_f2,
370
370
371 nb_data_by_buffer => nb_data_by_buffer,
371 nb_data_by_buffer => nb_data_by_buffer,
372 nb_snapshot_param => nb_snapshot_param,
372 nb_snapshot_param => nb_snapshot_param,
373 status_new_err => status_new_err,
373 status_new_err => status_new_err,
374
374
375 status_buffer_ready => wfp_status_buffer_ready,
375 status_buffer_ready => wfp_status_buffer_ready,
376 addr_buffer => wfp_addr_buffer,
376 addr_buffer => wfp_addr_buffer,
377 length_buffer => wfp_length_buffer,
377 length_buffer => wfp_length_buffer,
378 ready_buffer => wfp_ready_buffer,
378 ready_buffer => wfp_ready_buffer,
379 buffer_time => wfp_buffer_time,
379 buffer_time => wfp_buffer_time,
380 error_buffer_full => wfp_error_buffer_full,
380 error_buffer_full => wfp_error_buffer_full,
381
381
382 coarse_time => coarse_time,
382 coarse_time => coarse_time,
383 fine_time => fine_time,
383 fine_time => fine_time,
384
384
385 --f0
385 --f0
386 data_f0_in_valid => sample_f0_val,
386 data_f0_in_valid => sample_f0_val,
387 data_f0_in => sample_f0_data,
387 data_f0_in => sample_f0_data,
388 --f1
388 --f1
389 data_f1_in_valid => sample_f1_val,
389 data_f1_in_valid => sample_f1_val,
390 data_f1_in => sample_f1_data,
390 data_f1_in => sample_f1_data,
391 --f2
391 --f2
392 data_f2_in_valid => sample_f2_val,
392 data_f2_in_valid => sample_f2_val,
393 data_f2_in => sample_f2_data,
393 data_f2_in => sample_f2_data,
394 --f3
394 --f3
395 data_f3_in_valid => sample_f3_val,
395 data_f3_in_valid => sample_f3_val,
396 data_f3_in => sample_f3_data,
396 data_f3_in => sample_f3_data,
397 -- OUTPUT -- DMA interface
397 -- OUTPUT -- DMA interface
398
398
399 dma_fifo_valid_burst => dma_fifo_burst_valid(3 DOWNTO 0),
399 dma_fifo_valid_burst => dma_fifo_burst_valid(3 DOWNTO 0),
400 dma_fifo_data => dma_fifo_data(32*4-1 DOWNTO 0),
400 dma_fifo_data => dma_fifo_data(32*4-1 DOWNTO 0),
401 dma_fifo_ren => dma_fifo_ren(3 DOWNTO 0),
401 dma_fifo_ren => dma_fifo_ren(3 DOWNTO 0),
402 dma_buffer_new => dma_buffer_new(3 DOWNTO 0),
402 dma_buffer_new => dma_buffer_new(3 DOWNTO 0),
403 dma_buffer_addr => dma_buffer_addr(32*4-1 DOWNTO 0),
403 dma_buffer_addr => dma_buffer_addr(32*4-1 DOWNTO 0),
404 dma_buffer_length => dma_buffer_length(26*4-1 DOWNTO 0),
404 dma_buffer_length => dma_buffer_length(26*4-1 DOWNTO 0),
405 dma_buffer_full => dma_buffer_full(3 DOWNTO 0),
405 dma_buffer_full => dma_buffer_full(3 DOWNTO 0),
406 dma_buffer_full_err => dma_buffer_full_err(3 DOWNTO 0)
406 dma_buffer_full_err => dma_buffer_full_err(3 DOWNTO 0)
407
407
408 );
408 );
409
409
410 -----------------------------------------------------------------------------
410 -----------------------------------------------------------------------------
411 -- Matrix Spectral
411 -- Matrix Spectral
412 -----------------------------------------------------------------------------
412 -----------------------------------------------------------------------------
413 sample_f0_wen <= NOT(sample_f0_val) & NOT(sample_f0_val) & NOT(sample_f0_val) &
413 sample_f0_wen <= NOT(sample_f0_val) & NOT(sample_f0_val) & NOT(sample_f0_val) &
414 NOT(sample_f0_val) & NOT(sample_f0_val);
414 NOT(sample_f0_val) & NOT(sample_f0_val);
415 sample_f1_wen <= NOT(sample_f1_val) & NOT(sample_f1_val) & NOT(sample_f1_val) &
415 sample_f1_wen <= NOT(sample_f1_val) & NOT(sample_f1_val) & NOT(sample_f1_val) &
416 NOT(sample_f1_val) & NOT(sample_f1_val);
416 NOT(sample_f1_val) & NOT(sample_f1_val);
417 sample_f2_wen <= NOT(sample_f2_val) & NOT(sample_f2_val) & NOT(sample_f2_val) &
417 sample_f2_wen <= NOT(sample_f2_val) & NOT(sample_f2_val) & NOT(sample_f2_val) &
418 NOT(sample_f2_val) & NOT(sample_f2_val);
418 NOT(sample_f2_val) & NOT(sample_f2_val);
419
419
420 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)
420 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)
421 sample_f1_wdata <= sample_f1_data((3*16)-1 DOWNTO (1*16)) & sample_f1_data((6*16)-1 DOWNTO (3*16));
421 sample_f1_wdata <= sample_f1_data((3*16)-1 DOWNTO (1*16)) & sample_f1_data((6*16)-1 DOWNTO (3*16));
422 sample_f2_wdata <= sample_f2_data((3*16)-1 DOWNTO (1*16)) & sample_f2_data((6*16)-1 DOWNTO (3*16));
422 sample_f2_wdata <= sample_f2_data((3*16)-1 DOWNTO (1*16)) & sample_f2_data((6*16)-1 DOWNTO (3*16));
423
423
424 -------------------------------------------------------------------------------
424 -------------------------------------------------------------------------------
425
425
426 --ms_softandhard_rstn <= rstn AND run_ms AND run;
426 --ms_softandhard_rstn <= rstn AND run_ms AND run;
427
427
428 -----------------------------------------------------------------------------
428 -----------------------------------------------------------------------------
429 lpp_lfr_ms_1 : lpp_lfr_ms
429 lpp_lfr_ms_1 : lpp_lfr_ms
430 GENERIC MAP (
430 GENERIC MAP (
431 Mem_use => Mem_use)
431 Mem_use => Mem_use)
432 PORT MAP (
432 PORT MAP (
433 clk => clk,
433 clk => clk,
434 --rstn => ms_softandhard_rstn, --rstn,
434 --rstn => ms_softandhard_rstn, --rstn,
435 rstn => rstn,
435 rstn => rstn,
436
436
437 run => '1',--run_ms,
437 run => '1',--run_ms,
438
438
439 start_date => start_date,
439 start_date => start_date,
440
440
441 coarse_time => coarse_time,
441 coarse_time => coarse_time,
442 fine_time => fine_time,
442 fine_time => fine_time,
443
443
444 sample_f0_wen => sample_f0_wen,
444 sample_f0_wen => sample_f0_wen,
445 sample_f0_wdata => sample_f0_wdata,
445 sample_f0_wdata => sample_f0_wdata,
446 sample_f1_wen => sample_f1_wen,
446 sample_f1_wen => sample_f1_wen,
447 sample_f1_wdata => sample_f1_wdata,
447 sample_f1_wdata => sample_f1_wdata,
448 sample_f2_wen => sample_f2_wen,
448 sample_f2_wen => sample_f2_wen,
449 sample_f2_wdata => sample_f2_wdata,
449 sample_f2_wdata => sample_f2_wdata,
450
450
451 --DMA
451 --DMA
452 dma_fifo_burst_valid => dma_fifo_burst_valid(4), -- OUT
452 dma_fifo_burst_valid => dma_fifo_burst_valid(4), -- OUT
453 dma_fifo_data => dma_fifo_data((4+1)*32-1 DOWNTO 4*32), -- OUT
453 dma_fifo_data => dma_fifo_data((4+1)*32-1 DOWNTO 4*32), -- OUT
454 dma_fifo_ren => dma_fifo_ren(4), -- IN
454 dma_fifo_ren => dma_fifo_ren(4), -- IN
455 dma_buffer_new => dma_buffer_new(4), -- OUT
455 dma_buffer_new => dma_buffer_new(4), -- OUT
456 dma_buffer_addr => dma_buffer_addr((4+1)*32-1 DOWNTO 4*32), -- OUT
456 dma_buffer_addr => dma_buffer_addr((4+1)*32-1 DOWNTO 4*32), -- OUT
457 dma_buffer_length => dma_buffer_length((4+1)*26-1 DOWNTO 4*26), -- OUT
457 dma_buffer_length => dma_buffer_length((4+1)*26-1 DOWNTO 4*26), -- OUT
458 dma_buffer_full => dma_buffer_full(4), -- IN
458 dma_buffer_full => dma_buffer_full(4), -- IN
459 dma_buffer_full_err => dma_buffer_full_err(4), -- IN
459 dma_buffer_full_err => dma_buffer_full_err(4), -- IN
460
460
461
461
462
462
463 --REG
463 --REG
464 ready_matrix_f0 => ready_matrix_f0,
464 ready_matrix_f0 => ready_matrix_f0,
465 ready_matrix_f1 => ready_matrix_f1,
465 ready_matrix_f1 => ready_matrix_f1,
466 ready_matrix_f2 => ready_matrix_f2,
466 ready_matrix_f2 => ready_matrix_f2,
467 error_buffer_full => error_buffer_full,
467 error_buffer_full => error_buffer_full,
468 error_input_fifo_write => error_input_fifo_write,
468 error_input_fifo_write => error_input_fifo_write,
469
469
470 status_ready_matrix_f0 => status_ready_matrix_f0,
470 status_ready_matrix_f0 => status_ready_matrix_f0,
471 status_ready_matrix_f1 => status_ready_matrix_f1,
471 status_ready_matrix_f1 => status_ready_matrix_f1,
472 status_ready_matrix_f2 => status_ready_matrix_f2,
472 status_ready_matrix_f2 => status_ready_matrix_f2,
473 addr_matrix_f0 => addr_matrix_f0,
473 addr_matrix_f0 => addr_matrix_f0,
474 addr_matrix_f1 => addr_matrix_f1,
474 addr_matrix_f1 => addr_matrix_f1,
475 addr_matrix_f2 => addr_matrix_f2,
475 addr_matrix_f2 => addr_matrix_f2,
476
476
477 length_matrix_f0 => length_matrix_f0,
477 length_matrix_f0 => length_matrix_f0,
478 length_matrix_f1 => length_matrix_f1,
478 length_matrix_f1 => length_matrix_f1,
479 length_matrix_f2 => length_matrix_f2,
479 length_matrix_f2 => length_matrix_f2,
480
480
481 matrix_time_f0 => matrix_time_f0,
481 matrix_time_f0 => matrix_time_f0,
482 matrix_time_f1 => matrix_time_f1,
482 matrix_time_f1 => matrix_time_f1,
483 matrix_time_f2 => matrix_time_f2);
483 matrix_time_f2 => matrix_time_f2);
484
484
485 -----------------------------------------------------------------------------
485 -----------------------------------------------------------------------------
486 --run_dma <= run_ms OR run;
486 --run_dma <= run_ms OR run;
487
487
488 DMA_SubSystem_1 : DMA_SubSystem
488 DMA_SubSystem_1 : DMA_SubSystem
489 GENERIC MAP (
489 GENERIC MAP (
490 hindex => hindex)
490 hindex => hindex)
491 PORT MAP (
491 PORT MAP (
492 clk => clk,
492 clk => clk,
493 rstn => rstn,
493 rstn => rstn,
494 run => '1',--run_dma,
494 run => '1',--run_dma,
495 ahbi => ahbi,
495 ahbi => ahbi,
496 ahbo => ahbo,
496 ahbo => ahbo,
497
497
498 fifo_burst_valid => dma_fifo_burst_valid, --fifo_burst_valid,
498 fifo_burst_valid => dma_fifo_burst_valid, --fifo_burst_valid,
499 fifo_data => dma_fifo_data, --fifo_data,
499 fifo_data => dma_fifo_data, --fifo_data,
500 fifo_ren => dma_fifo_ren, --fifo_ren,
500 fifo_ren => dma_fifo_ren, --fifo_ren,
501
501
502 buffer_new => dma_buffer_new, --buffer_new,
502 buffer_new => dma_buffer_new, --buffer_new,
503 buffer_addr => dma_buffer_addr, --buffer_addr,
503 buffer_addr => dma_buffer_addr, --buffer_addr,
504 buffer_length => dma_buffer_length, --buffer_length,
504 buffer_length => dma_buffer_length, --buffer_length,
505 buffer_full => dma_buffer_full, --buffer_full,
505 buffer_full => dma_buffer_full, --buffer_full,
506 buffer_full_err => dma_buffer_full_err, --buffer_full_err,
506 buffer_full_err => dma_buffer_full_err, --buffer_full_err,
507 grant_error => dma_grant_error); --grant_error);
507 grant_error => dma_grant_error); --grant_error);
508
508
509 END beh;
509 END beh;
@@ -1,781 +1,781
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
31
32 LIBRARY lpp;
32 LIBRARY lpp;
33 USE lpp.lpp_lfr_pkg.ALL;
33 USE lpp.lpp_lfr_pkg.ALL;
34 USE lpp.apb_devices_list.ALL;
34 USE lpp.apb_devices_list.ALL;
35 USE lpp.lpp_memory.ALL;
35 USE lpp.lpp_memory.ALL;
36 USE lpp.lpp_lfr_apbreg_pkg.ALL;
36 USE lpp.lpp_lfr_apbreg_pkg.ALL;
37
37
38 LIBRARY techmap;
38 LIBRARY techmap;
39 USE techmap.gencomp.ALL;
39 USE techmap.gencomp.ALL;
40
40
41 ENTITY lpp_lfr_apbreg IS
41 ENTITY lpp_lfr_apbreg IS
42 GENERIC (
42 GENERIC (
43 nb_data_by_buffer_size : INTEGER := 11;
43 nb_data_by_buffer_size : INTEGER := 11;
44 nb_snapshot_param_size : INTEGER := 11;
44 nb_snapshot_param_size : INTEGER := 11;
45 delta_vector_size : INTEGER := 20;
45 delta_vector_size : INTEGER := 20;
46 delta_vector_size_f0_2 : INTEGER := 3;
46 delta_vector_size_f0_2 : INTEGER := 3;
47
47
48 pindex : INTEGER := 4;
48 pindex : INTEGER := 4;
49 paddr : INTEGER := 4;
49 paddr : INTEGER := 4;
50 pmask : INTEGER := 16#fff#;
50 pmask : INTEGER := 16#fff#;
51 pirq_ms : INTEGER := 0;
51 pirq_ms : INTEGER := 0;
52 pirq_wfp : INTEGER := 1;
52 pirq_wfp : INTEGER := 1;
53 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0) := X"000000");
53 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0) := X"000000");
54 PORT (
54 PORT (
55 -- AMBA AHB system signals
55 -- AMBA AHB system signals
56 HCLK : IN STD_ULOGIC;
56 HCLK : IN STD_ULOGIC;
57 HRESETn : IN STD_ULOGIC;
57 HRESETn : IN STD_ULOGIC;
58
58
59 -- AMBA APB Slave Interface
59 -- AMBA APB Slave Interface
60 apbi : IN apb_slv_in_type;
60 apbi : IN apb_slv_in_type;
61 apbo : OUT apb_slv_out_type;
61 apbo : OUT apb_slv_out_type;
62
62
63 ---------------------------------------------------------------------------
63 ---------------------------------------------------------------------------
64 -- Spectral Matrix Reg
64 -- Spectral Matrix Reg
65 run_ms : OUT STD_LOGIC;
65 run_ms : OUT STD_LOGIC;
66 -- IN
66 -- IN
67 ready_matrix_f0 : IN STD_LOGIC;
67 ready_matrix_f0 : IN STD_LOGIC;
68 ready_matrix_f1 : IN STD_LOGIC;
68 ready_matrix_f1 : IN STD_LOGIC;
69 ready_matrix_f2 : IN STD_LOGIC;
69 ready_matrix_f2 : IN STD_LOGIC;
70
70
71 -- error_bad_component_error : IN STD_LOGIC;
71 -- error_bad_component_error : IN STD_LOGIC;
72 error_buffer_full : IN STD_LOGIC; -- TODO
72 error_buffer_full : IN STD_LOGIC; -- TODO
73 error_input_fifo_write : IN STD_LOGIC_VECTOR(2 DOWNTO 0); -- TODO
73 error_input_fifo_write : IN STD_LOGIC_VECTOR(2 DOWNTO 0); -- TODO
74
74
75 -- debug_reg : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
75 -- debug_reg : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
76
76
77 -- OUT
77 -- OUT
78 status_ready_matrix_f0 : OUT STD_LOGIC;
78 status_ready_matrix_f0 : OUT STD_LOGIC;
79 status_ready_matrix_f1 : OUT STD_LOGIC;
79 status_ready_matrix_f1 : OUT STD_LOGIC;
80 status_ready_matrix_f2 : OUT STD_LOGIC;
80 status_ready_matrix_f2 : OUT STD_LOGIC;
81
81
82 --config_active_interruption_onNewMatrix : OUT STD_LOGIC;
82 --config_active_interruption_onNewMatrix : OUT STD_LOGIC;
83 --config_active_interruption_onError : OUT STD_LOGIC;
83 --config_active_interruption_onError : OUT STD_LOGIC;
84
84
85 addr_matrix_f0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
85 addr_matrix_f0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
86 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
86 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
87 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
87 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
88
88
89 length_matrix_f0 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
89 length_matrix_f0 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
90 length_matrix_f1 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
90 length_matrix_f1 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
91 length_matrix_f2 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
91 length_matrix_f2 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
92
92
93 matrix_time_f0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
93 matrix_time_f0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
94 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
94 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
95 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
95 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
96
96
97 ---------------------------------------------------------------------------
97 ---------------------------------------------------------------------------
98 ---------------------------------------------------------------------------
98 ---------------------------------------------------------------------------
99 -- WaveForm picker Reg
99 -- WaveForm picker Reg
100 --status_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
100 --status_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
101 --status_full_ack : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
101 --status_full_ack : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
102 --status_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
102 --status_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
103 status_new_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
103 status_new_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
104
104
105 -- OUT
105 -- OUT
106 data_shaping_BW : OUT STD_LOGIC;
106 data_shaping_BW : OUT STD_LOGIC;
107 data_shaping_SP0 : OUT STD_LOGIC;
107 data_shaping_SP0 : OUT STD_LOGIC;
108 data_shaping_SP1 : OUT STD_LOGIC;
108 data_shaping_SP1 : OUT STD_LOGIC;
109 data_shaping_R0 : OUT STD_LOGIC;
109 data_shaping_R0 : OUT STD_LOGIC;
110 data_shaping_R1 : OUT STD_LOGIC;
110 data_shaping_R1 : OUT STD_LOGIC;
111 data_shaping_R2 : OUT STD_LOGIC;
111 data_shaping_R2 : OUT STD_LOGIC;
112
112
113 delta_snapshot : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
113 delta_snapshot : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
114 delta_f0 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
114 delta_f0 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
115 delta_f0_2 : OUT STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
115 delta_f0_2 : OUT STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
116 delta_f1 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
116 delta_f1 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
117 delta_f2 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
117 delta_f2 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
118 nb_data_by_buffer : OUT STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
118 nb_data_by_buffer : OUT STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
119 --nb_word_by_buffer : OUT STD_LOGIC_VECTOR(nb_word_by_buffer_size-1 DOWNTO 0);
119 --nb_word_by_buffer : OUT STD_LOGIC_VECTOR(nb_word_by_buffer_size-1 DOWNTO 0);
120 nb_snapshot_param : OUT STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
120 nb_snapshot_param : OUT STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
121
121
122 enable_f0 : OUT STD_LOGIC;
122 enable_f0 : OUT STD_LOGIC;
123 enable_f1 : OUT STD_LOGIC;
123 enable_f1 : OUT STD_LOGIC;
124 enable_f2 : OUT STD_LOGIC;
124 enable_f2 : OUT STD_LOGIC;
125 enable_f3 : OUT STD_LOGIC;
125 enable_f3 : OUT STD_LOGIC;
126
126
127 burst_f0 : OUT STD_LOGIC;
127 burst_f0 : OUT STD_LOGIC;
128 burst_f1 : OUT STD_LOGIC;
128 burst_f1 : OUT STD_LOGIC;
129 burst_f2 : OUT STD_LOGIC;
129 burst_f2 : OUT STD_LOGIC;
130
130
131 run : OUT STD_LOGIC;
131 run : OUT STD_LOGIC;
132
132
133 start_date : OUT STD_LOGIC_VECTOR(30 DOWNTO 0);
133 start_date : OUT STD_LOGIC_VECTOR(30 DOWNTO 0);
134
134
135 wfp_status_buffer_ready : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
135 wfp_status_buffer_ready : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
136 wfp_addr_buffer : OUT STD_LOGIC_VECTOR(32*4 DOWNTO 0);
136 wfp_addr_buffer : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
137 wfp_length_buffer : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
137 wfp_length_buffer : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
138 wfp_ready_buffer : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
138 wfp_ready_buffer : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
139 wfp_buffer_time : IN STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
139 wfp_buffer_time : IN STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
140 wfp_error_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0)
140 wfp_error_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0)
141
141
142 );
142 );
143
143
144 END lpp_lfr_apbreg;
144 END lpp_lfr_apbreg;
145
145
146 ARCHITECTURE beh OF lpp_lfr_apbreg IS
146 ARCHITECTURE beh OF lpp_lfr_apbreg IS
147
147
148 CONSTANT REVISION : INTEGER := 1;
148 CONSTANT REVISION : INTEGER := 1;
149
149
150 CONSTANT pconfig : apb_config_type := (
150 CONSTANT pconfig : apb_config_type := (
151 0 => ahb_device_reg (lpp.apb_devices_list.VENDOR_LPP, lpp.apb_devices_list.LPP_LFR, 0, REVISION, pirq_wfp),
151 0 => ahb_device_reg (lpp.apb_devices_list.VENDOR_LPP, lpp.apb_devices_list.LPP_LFR, 0, REVISION, pirq_wfp),
152 1 => apb_iobar(paddr, pmask));
152 1 => apb_iobar(paddr, pmask));
153
153
154 --CONSTANT pconfig : apb_config_type := (
154 --CONSTANT pconfig : apb_config_type := (
155 -- 0 => ahb_device_reg (16#19#, 16#19#, 0, REVISION, pirq_wfp),
155 -- 0 => ahb_device_reg (16#19#, 16#19#, 0, REVISION, pirq_wfp),
156 -- 1 => apb_iobar(paddr, pmask));
156 -- 1 => apb_iobar(paddr, pmask));
157
157
158 TYPE lpp_SpectralMatrix_regs IS RECORD
158 TYPE lpp_SpectralMatrix_regs IS RECORD
159 config_active_interruption_onNewMatrix : STD_LOGIC;
159 config_active_interruption_onNewMatrix : STD_LOGIC;
160 config_active_interruption_onError : STD_LOGIC;
160 config_active_interruption_onError : STD_LOGIC;
161 config_ms_run : STD_LOGIC;
161 config_ms_run : STD_LOGIC;
162 status_ready_matrix_f0_0 : STD_LOGIC;
162 status_ready_matrix_f0_0 : STD_LOGIC;
163 status_ready_matrix_f1_0 : STD_LOGIC;
163 status_ready_matrix_f1_0 : STD_LOGIC;
164 status_ready_matrix_f2_0 : STD_LOGIC;
164 status_ready_matrix_f2_0 : STD_LOGIC;
165 status_ready_matrix_f0_1 : STD_LOGIC;
165 status_ready_matrix_f0_1 : STD_LOGIC;
166 status_ready_matrix_f1_1 : STD_LOGIC;
166 status_ready_matrix_f1_1 : STD_LOGIC;
167 status_ready_matrix_f2_1 : STD_LOGIC;
167 status_ready_matrix_f2_1 : STD_LOGIC;
168 -- status_error_bad_component_error : STD_LOGIC;
168 -- status_error_bad_component_error : STD_LOGIC;
169 status_error_buffer_full : STD_LOGIC;
169 status_error_buffer_full : STD_LOGIC;
170 status_error_input_fifo_write : STD_LOGIC_VECTOR(2 DOWNTO 0);
170 status_error_input_fifo_write : STD_LOGIC_VECTOR(2 DOWNTO 0);
171
171
172 addr_matrix_f0_0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
172 addr_matrix_f0_0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
173 addr_matrix_f0_1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
173 addr_matrix_f0_1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
174 addr_matrix_f1_0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
174 addr_matrix_f1_0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
175 addr_matrix_f1_1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
175 addr_matrix_f1_1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
176 addr_matrix_f2_0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
176 addr_matrix_f2_0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
177 addr_matrix_f2_1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
177 addr_matrix_f2_1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
178
178
179 length_matrix : STD_LOGIC_VECTOR(25 DOWNTO 0);
179 length_matrix : STD_LOGIC_VECTOR(25 DOWNTO 0);
180
180
181 time_matrix_f0_0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
181 time_matrix_f0_0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
182 time_matrix_f0_1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
182 time_matrix_f0_1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
183 time_matrix_f1_0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
183 time_matrix_f1_0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
184 time_matrix_f1_1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
184 time_matrix_f1_1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
185 time_matrix_f2_0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
185 time_matrix_f2_0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
186 time_matrix_f2_1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
186 time_matrix_f2_1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
187 END RECORD;
187 END RECORD;
188 SIGNAL reg_sp : lpp_SpectralMatrix_regs;
188 SIGNAL reg_sp : lpp_SpectralMatrix_regs;
189
189
190 TYPE lpp_WaveformPicker_regs IS RECORD
190 TYPE lpp_WaveformPicker_regs IS RECORD
191 -- status_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
191 -- status_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
192 -- status_full_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
192 -- status_full_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
193 status_new_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
193 status_new_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
194 data_shaping_BW : STD_LOGIC;
194 data_shaping_BW : STD_LOGIC;
195 data_shaping_SP0 : STD_LOGIC;
195 data_shaping_SP0 : STD_LOGIC;
196 data_shaping_SP1 : STD_LOGIC;
196 data_shaping_SP1 : STD_LOGIC;
197 data_shaping_R0 : STD_LOGIC;
197 data_shaping_R0 : STD_LOGIC;
198 data_shaping_R1 : STD_LOGIC;
198 data_shaping_R1 : STD_LOGIC;
199 data_shaping_R2 : STD_LOGIC;
199 data_shaping_R2 : STD_LOGIC;
200 delta_snapshot : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
200 delta_snapshot : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
201 delta_f0 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
201 delta_f0 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
202 delta_f0_2 : STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
202 delta_f0_2 : STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
203 delta_f1 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
203 delta_f1 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
204 delta_f2 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
204 delta_f2 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
205 nb_data_by_buffer : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
205 nb_data_by_buffer : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
206 -- nb_word_by_buffer : STD_LOGIC_VECTOR(nb_word_by_buffer_size-1 DOWNTO 0);
206 -- nb_word_by_buffer : STD_LOGIC_VECTOR(nb_word_by_buffer_size-1 DOWNTO 0);
207 nb_snapshot_param : STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
207 nb_snapshot_param : STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
208 enable_f0 : STD_LOGIC;
208 enable_f0 : STD_LOGIC;
209 enable_f1 : STD_LOGIC;
209 enable_f1 : STD_LOGIC;
210 enable_f2 : STD_LOGIC;
210 enable_f2 : STD_LOGIC;
211 enable_f3 : STD_LOGIC;
211 enable_f3 : STD_LOGIC;
212 burst_f0 : STD_LOGIC;
212 burst_f0 : STD_LOGIC;
213 burst_f1 : STD_LOGIC;
213 burst_f1 : STD_LOGIC;
214 burst_f2 : STD_LOGIC;
214 burst_f2 : STD_LOGIC;
215 run : STD_LOGIC;
215 run : STD_LOGIC;
216 status_ready_buffer_f : STD_LOGIC_VECTOR(4*2-1 DOWNTO 0);
216 status_ready_buffer_f : STD_LOGIC_VECTOR(4*2-1 DOWNTO 0);
217 addr_buffer_f : STD_LOGIC_VECTOR(4*2*32-1 DOWNTO 0);
217 addr_buffer_f : STD_LOGIC_VECTOR(4*2*32-1 DOWNTO 0);
218 time_buffer_f : STD_LOGIC_VECTOR(4*2*48-1 DOWNTO 0);
218 time_buffer_f : STD_LOGIC_VECTOR(4*2*48-1 DOWNTO 0);
219 length_buffer : STD_LOGIC_VECTOR(25 DOWNTO 0);
219 length_buffer : STD_LOGIC_VECTOR(25 DOWNTO 0);
220 error_buffer_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
220 error_buffer_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
221 start_date : STD_LOGIC_VECTOR(30 DOWNTO 0);
221 start_date : STD_LOGIC_VECTOR(30 DOWNTO 0);
222 END RECORD;
222 END RECORD;
223 SIGNAL reg_wp : lpp_WaveformPicker_regs;
223 SIGNAL reg_wp : lpp_WaveformPicker_regs;
224
224
225 SIGNAL prdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
225 SIGNAL prdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
226
226
227 -----------------------------------------------------------------------------
227 -----------------------------------------------------------------------------
228 -- IRQ
228 -- IRQ
229 -----------------------------------------------------------------------------
229 -----------------------------------------------------------------------------
230 CONSTANT IRQ_WFP_SIZE : INTEGER := 12;
230 CONSTANT IRQ_WFP_SIZE : INTEGER := 12;
231 SIGNAL irq_wfp_ZERO : STD_LOGIC_VECTOR(IRQ_WFP_SIZE-1 DOWNTO 0);
231 SIGNAL irq_wfp_ZERO : STD_LOGIC_VECTOR(IRQ_WFP_SIZE-1 DOWNTO 0);
232 SIGNAL irq_wfp_reg_s : STD_LOGIC_VECTOR(IRQ_WFP_SIZE-1 DOWNTO 0);
232 SIGNAL irq_wfp_reg_s : STD_LOGIC_VECTOR(IRQ_WFP_SIZE-1 DOWNTO 0);
233 SIGNAL irq_wfp_reg : STD_LOGIC_VECTOR(IRQ_WFP_SIZE-1 DOWNTO 0);
233 SIGNAL irq_wfp_reg : STD_LOGIC_VECTOR(IRQ_WFP_SIZE-1 DOWNTO 0);
234 SIGNAL irq_wfp : STD_LOGIC_VECTOR(IRQ_WFP_SIZE-1 DOWNTO 0);
234 SIGNAL irq_wfp : STD_LOGIC_VECTOR(IRQ_WFP_SIZE-1 DOWNTO 0);
235 SIGNAL ored_irq_wfp : STD_LOGIC;
235 SIGNAL ored_irq_wfp : STD_LOGIC;
236
236
237 -----------------------------------------------------------------------------
237 -----------------------------------------------------------------------------
238 --
238 --
239 -----------------------------------------------------------------------------
239 -----------------------------------------------------------------------------
240 SIGNAL reg0_ready_matrix_f0 : STD_LOGIC;
240 SIGNAL reg0_ready_matrix_f0 : STD_LOGIC;
241 SIGNAL reg0_addr_matrix_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
241 -- SIGNAL reg0_addr_matrix_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
242 SIGNAL reg0_matrix_time_f0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
242 -- SIGNAL reg0_matrix_time_f0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
243
243
244 SIGNAL reg1_ready_matrix_f0 : STD_LOGIC;
244 SIGNAL reg1_ready_matrix_f0 : STD_LOGIC;
245 SIGNAL reg1_addr_matrix_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
245 -- SIGNAL reg1_addr_matrix_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
246 SIGNAL reg1_matrix_time_f0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
246 -- SIGNAL reg1_matrix_time_f0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
247
247
248 SIGNAL reg0_ready_matrix_f1 : STD_LOGIC;
248 SIGNAL reg0_ready_matrix_f1 : STD_LOGIC;
249 SIGNAL reg0_addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
249 -- SIGNAL reg0_addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
250 SIGNAL reg0_matrix_time_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
250 -- SIGNAL reg0_matrix_time_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
251
251
252 SIGNAL reg1_ready_matrix_f1 : STD_LOGIC;
252 SIGNAL reg1_ready_matrix_f1 : STD_LOGIC;
253 SIGNAL reg1_addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
253 -- SIGNAL reg1_addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
254 SIGNAL reg1_matrix_time_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
254 -- SIGNAL reg1_matrix_time_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
255
255
256 SIGNAL reg0_ready_matrix_f2 : STD_LOGIC;
256 SIGNAL reg0_ready_matrix_f2 : STD_LOGIC;
257 SIGNAL reg0_addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
257 -- SIGNAL reg0_addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
258 SIGNAL reg0_matrix_time_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
258 -- SIGNAL reg0_matrix_time_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
259
259
260 SIGNAL reg1_ready_matrix_f2 : STD_LOGIC;
260 SIGNAL reg1_ready_matrix_f2 : STD_LOGIC;
261 SIGNAL reg1_addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
261 -- SIGNAL reg1_addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
262 SIGNAL reg1_matrix_time_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
262 -- SIGNAL reg1_matrix_time_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
263 SIGNAL apbo_irq_ms : STD_LOGIC;
263 SIGNAL apbo_irq_ms : STD_LOGIC;
264 SIGNAL apbo_irq_wfp : STD_LOGIC;
264 SIGNAL apbo_irq_wfp : STD_LOGIC;
265 -----------------------------------------------------------------------------
265 -----------------------------------------------------------------------------
266 SIGNAL reg_ready_buffer_f : STD_LOGIC_VECTOR( 2*4-1 DOWNTO 0);
266 SIGNAL reg_ready_buffer_f : STD_LOGIC_VECTOR( 2*4-1 DOWNTO 0);
267
267
268 SIGNAL pirq_temp : STD_LOGIC_VECTOR(31 DOWNTO 0);
268 SIGNAL pirq_temp : STD_LOGIC_VECTOR(31 DOWNTO 0);
269
269
270 BEGIN -- beh
270 BEGIN -- beh
271
271
272 -- status_ready_matrix_f0 <= reg_sp.status_ready_matrix_f0;
272 -- status_ready_matrix_f0 <= reg_sp.status_ready_matrix_f0;
273 -- status_ready_matrix_f1 <= reg_sp.status_ready_matrix_f1;
273 -- status_ready_matrix_f1 <= reg_sp.status_ready_matrix_f1;
274 -- status_ready_matrix_f2 <= reg_sp.status_ready_matrix_f2;
274 -- status_ready_matrix_f2 <= reg_sp.status_ready_matrix_f2;
275
275
276 -- config_active_interruption_onNewMatrix <= reg_sp.config_active_interruption_onNewMatrix;
276 -- config_active_interruption_onNewMatrix <= reg_sp.config_active_interruption_onNewMatrix;
277 -- config_active_interruption_onError <= reg_sp.config_active_interruption_onError;
277 -- config_active_interruption_onError <= reg_sp.config_active_interruption_onError;
278
278
279
279
280 -- addr_matrix_f0 <= reg_sp.addr_matrix_f0;
280 -- addr_matrix_f0 <= reg_sp.addr_matrix_f0;
281 -- addr_matrix_f1 <= reg_sp.addr_matrix_f1;
281 -- addr_matrix_f1 <= reg_sp.addr_matrix_f1;
282 -- addr_matrix_f2 <= reg_sp.addr_matrix_f2;
282 -- addr_matrix_f2 <= reg_sp.addr_matrix_f2;
283
283
284
284
285 data_shaping_BW <= NOT reg_wp.data_shaping_BW;
285 data_shaping_BW <= NOT reg_wp.data_shaping_BW;
286 data_shaping_SP0 <= reg_wp.data_shaping_SP0;
286 data_shaping_SP0 <= reg_wp.data_shaping_SP0;
287 data_shaping_SP1 <= reg_wp.data_shaping_SP1;
287 data_shaping_SP1 <= reg_wp.data_shaping_SP1;
288 data_shaping_R0 <= reg_wp.data_shaping_R0;
288 data_shaping_R0 <= reg_wp.data_shaping_R0;
289 data_shaping_R1 <= reg_wp.data_shaping_R1;
289 data_shaping_R1 <= reg_wp.data_shaping_R1;
290 data_shaping_R2 <= reg_wp.data_shaping_R2;
290 data_shaping_R2 <= reg_wp.data_shaping_R2;
291
291
292 delta_snapshot <= reg_wp.delta_snapshot;
292 delta_snapshot <= reg_wp.delta_snapshot;
293 delta_f0 <= reg_wp.delta_f0;
293 delta_f0 <= reg_wp.delta_f0;
294 delta_f0_2 <= reg_wp.delta_f0_2;
294 delta_f0_2 <= reg_wp.delta_f0_2;
295 delta_f1 <= reg_wp.delta_f1;
295 delta_f1 <= reg_wp.delta_f1;
296 delta_f2 <= reg_wp.delta_f2;
296 delta_f2 <= reg_wp.delta_f2;
297 nb_data_by_buffer <= reg_wp.nb_data_by_buffer;
297 nb_data_by_buffer <= reg_wp.nb_data_by_buffer;
298 nb_snapshot_param <= reg_wp.nb_snapshot_param;
298 nb_snapshot_param <= reg_wp.nb_snapshot_param;
299
299
300 enable_f0 <= reg_wp.enable_f0;
300 enable_f0 <= reg_wp.enable_f0;
301 enable_f1 <= reg_wp.enable_f1;
301 enable_f1 <= reg_wp.enable_f1;
302 enable_f2 <= reg_wp.enable_f2;
302 enable_f2 <= reg_wp.enable_f2;
303 enable_f3 <= reg_wp.enable_f3;
303 enable_f3 <= reg_wp.enable_f3;
304
304
305 burst_f0 <= reg_wp.burst_f0;
305 burst_f0 <= reg_wp.burst_f0;
306 burst_f1 <= reg_wp.burst_f1;
306 burst_f1 <= reg_wp.burst_f1;
307 burst_f2 <= reg_wp.burst_f2;
307 burst_f2 <= reg_wp.burst_f2;
308
308
309 run <= reg_wp.run;
309 run <= reg_wp.run;
310
310
311 --addr_data_f0 <= reg_wp.addr_data_f0;
311 --addr_data_f0 <= reg_wp.addr_data_f0;
312 --addr_data_f1 <= reg_wp.addr_data_f1;
312 --addr_data_f1 <= reg_wp.addr_data_f1;
313 --addr_data_f2 <= reg_wp.addr_data_f2;
313 --addr_data_f2 <= reg_wp.addr_data_f2;
314 --addr_data_f3 <= reg_wp.addr_data_f3;
314 --addr_data_f3 <= reg_wp.addr_data_f3;
315
315
316 start_date <= reg_wp.start_date;
316 start_date <= reg_wp.start_date;
317
317
318 length_matrix_f0 <= reg_sp.length_matrix;
318 length_matrix_f0 <= reg_sp.length_matrix;
319 length_matrix_f1 <= reg_sp.length_matrix;
319 length_matrix_f1 <= reg_sp.length_matrix;
320 length_matrix_f2 <= reg_sp.length_matrix;
320 length_matrix_f2 <= reg_sp.length_matrix;
321 wfp_length_buffer <= reg_wp.length_buffer;
321 wfp_length_buffer <= reg_wp.length_buffer;
322
322
323
323
324 lpp_lfr_apbreg : PROCESS (HCLK, HRESETn)
324 lpp_lfr_apbreg : PROCESS (HCLK, HRESETn)
325 VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2);
325 VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2);
326 BEGIN -- PROCESS lpp_dma_top
326 BEGIN -- PROCESS lpp_dma_top
327 IF HRESETn = '0' THEN -- asynchronous reset (active low)
327 IF HRESETn = '0' THEN -- asynchronous reset (active low)
328 reg_sp.config_active_interruption_onNewMatrix <= '0';
328 reg_sp.config_active_interruption_onNewMatrix <= '0';
329 reg_sp.config_active_interruption_onError <= '0';
329 reg_sp.config_active_interruption_onError <= '0';
330 reg_sp.config_ms_run <= '0';
330 reg_sp.config_ms_run <= '0';
331 reg_sp.status_ready_matrix_f0_0 <= '0';
331 reg_sp.status_ready_matrix_f0_0 <= '0';
332 reg_sp.status_ready_matrix_f1_0 <= '0';
332 reg_sp.status_ready_matrix_f1_0 <= '0';
333 reg_sp.status_ready_matrix_f2_0 <= '0';
333 reg_sp.status_ready_matrix_f2_0 <= '0';
334 reg_sp.status_ready_matrix_f0_1 <= '0';
334 reg_sp.status_ready_matrix_f0_1 <= '0';
335 reg_sp.status_ready_matrix_f1_1 <= '0';
335 reg_sp.status_ready_matrix_f1_1 <= '0';
336 reg_sp.status_ready_matrix_f2_1 <= '0';
336 reg_sp.status_ready_matrix_f2_1 <= '0';
337 reg_sp.status_error_buffer_full <= '0';
337 reg_sp.status_error_buffer_full <= '0';
338 reg_sp.status_error_input_fifo_write <= (OTHERS => '0');
338 reg_sp.status_error_input_fifo_write <= (OTHERS => '0');
339
339
340 reg_sp.addr_matrix_f0_0 <= (OTHERS => '0');
340 reg_sp.addr_matrix_f0_0 <= (OTHERS => '0');
341 reg_sp.addr_matrix_f1_0 <= (OTHERS => '0');
341 reg_sp.addr_matrix_f1_0 <= (OTHERS => '0');
342 reg_sp.addr_matrix_f2_0 <= (OTHERS => '0');
342 reg_sp.addr_matrix_f2_0 <= (OTHERS => '0');
343
343
344 reg_sp.addr_matrix_f0_1 <= (OTHERS => '0');
344 reg_sp.addr_matrix_f0_1 <= (OTHERS => '0');
345 reg_sp.addr_matrix_f1_1 <= (OTHERS => '0');
345 reg_sp.addr_matrix_f1_1 <= (OTHERS => '0');
346 reg_sp.addr_matrix_f2_1 <= (OTHERS => '0');
346 reg_sp.addr_matrix_f2_1 <= (OTHERS => '0');
347
347
348 reg_sp.length_matrix <= (OTHERS => '0');
348 reg_sp.length_matrix <= (OTHERS => '0');
349
349
350 -- reg_sp.time_matrix_f0_0 <= (OTHERS => '0'); -- ok
350 -- reg_sp.time_matrix_f0_0 <= (OTHERS => '0'); -- ok
351 -- reg_sp.time_matrix_f1_0 <= (OTHERS => '0'); -- ok
351 -- reg_sp.time_matrix_f1_0 <= (OTHERS => '0'); -- ok
352 -- reg_sp.time_matrix_f2_0 <= (OTHERS => '0'); -- ok
352 -- reg_sp.time_matrix_f2_0 <= (OTHERS => '0'); -- ok
353
353
354 -- reg_sp.time_matrix_f0_1 <= (OTHERS => '0'); -- ok
354 -- reg_sp.time_matrix_f0_1 <= (OTHERS => '0'); -- ok
355 --reg_sp.time_matrix_f1_1 <= (OTHERS => '0'); -- ok
355 --reg_sp.time_matrix_f1_1 <= (OTHERS => '0'); -- ok
356 -- reg_sp.time_matrix_f2_1 <= (OTHERS => '0'); -- ok
356 -- reg_sp.time_matrix_f2_1 <= (OTHERS => '0'); -- ok
357
357
358 prdata <= (OTHERS => '0');
358 prdata <= (OTHERS => '0');
359
359
360
360
361 apbo_irq_ms <= '0';
361 apbo_irq_ms <= '0';
362 apbo_irq_wfp <= '0';
362 apbo_irq_wfp <= '0';
363
363
364
364
365 -- status_full_ack <= (OTHERS => '0');
365 -- status_full_ack <= (OTHERS => '0');
366
366
367 reg_wp.data_shaping_BW <= '0';
367 reg_wp.data_shaping_BW <= '0';
368 reg_wp.data_shaping_SP0 <= '0';
368 reg_wp.data_shaping_SP0 <= '0';
369 reg_wp.data_shaping_SP1 <= '0';
369 reg_wp.data_shaping_SP1 <= '0';
370 reg_wp.data_shaping_R0 <= '0';
370 reg_wp.data_shaping_R0 <= '0';
371 reg_wp.data_shaping_R1 <= '0';
371 reg_wp.data_shaping_R1 <= '0';
372 reg_wp.data_shaping_R2 <= '0';
372 reg_wp.data_shaping_R2 <= '0';
373 reg_wp.enable_f0 <= '0';
373 reg_wp.enable_f0 <= '0';
374 reg_wp.enable_f1 <= '0';
374 reg_wp.enable_f1 <= '0';
375 reg_wp.enable_f2 <= '0';
375 reg_wp.enable_f2 <= '0';
376 reg_wp.enable_f3 <= '0';
376 reg_wp.enable_f3 <= '0';
377 reg_wp.burst_f0 <= '0';
377 reg_wp.burst_f0 <= '0';
378 reg_wp.burst_f1 <= '0';
378 reg_wp.burst_f1 <= '0';
379 reg_wp.burst_f2 <= '0';
379 reg_wp.burst_f2 <= '0';
380 reg_wp.run <= '0';
380 reg_wp.run <= '0';
381 -- reg_wp.status_full <= (OTHERS => '0');
381 -- reg_wp.status_full <= (OTHERS => '0');
382 -- reg_wp.status_full_err <= (OTHERS => '0');
382 -- reg_wp.status_full_err <= (OTHERS => '0');
383 reg_wp.status_new_err <= (OTHERS => '0');
383 reg_wp.status_new_err <= (OTHERS => '0');
384 reg_wp.error_buffer_full <= (OTHERS => '0');
384 reg_wp.error_buffer_full <= (OTHERS => '0');
385 reg_wp.delta_snapshot <= (OTHERS => '0');
385 reg_wp.delta_snapshot <= (OTHERS => '0');
386 reg_wp.delta_f0 <= (OTHERS => '0');
386 reg_wp.delta_f0 <= (OTHERS => '0');
387 reg_wp.delta_f0_2 <= (OTHERS => '0');
387 reg_wp.delta_f0_2 <= (OTHERS => '0');
388 reg_wp.delta_f1 <= (OTHERS => '0');
388 reg_wp.delta_f1 <= (OTHERS => '0');
389 reg_wp.delta_f2 <= (OTHERS => '0');
389 reg_wp.delta_f2 <= (OTHERS => '0');
390 reg_wp.nb_data_by_buffer <= (OTHERS => '0');
390 reg_wp.nb_data_by_buffer <= (OTHERS => '0');
391 reg_wp.nb_snapshot_param <= (OTHERS => '0');
391 reg_wp.nb_snapshot_param <= (OTHERS => '0');
392 reg_wp.start_date <= (OTHERS => '1');
392 reg_wp.start_date <= (OTHERS => '1');
393
393
394 reg_wp.status_ready_buffer_f <= (OTHERS => '0');
394 reg_wp.status_ready_buffer_f <= (OTHERS => '0');
395 reg_wp.length_buffer <= (OTHERS => '0');
395 reg_wp.length_buffer <= (OTHERS => '0');
396
396
397 pirq_temp <= (OTHERS => '0');
397 pirq_temp <= (OTHERS => '0');
398
398
399 reg_wp.addr_buffer_f <= (OTHERS => '0');
399 reg_wp.addr_buffer_f <= (OTHERS => '0');
400
400
401 ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge
401 ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge
402
402
403 -- status_full_ack <= (OTHERS => '0');
403 -- status_full_ack <= (OTHERS => '0');
404
404
405 reg_sp.status_ready_matrix_f0_0 <= reg_sp.status_ready_matrix_f0_0 OR reg0_ready_matrix_f0;
405 reg_sp.status_ready_matrix_f0_0 <= reg_sp.status_ready_matrix_f0_0 OR reg0_ready_matrix_f0;
406 reg_sp.status_ready_matrix_f1_0 <= reg_sp.status_ready_matrix_f1_0 OR reg0_ready_matrix_f1;
406 reg_sp.status_ready_matrix_f1_0 <= reg_sp.status_ready_matrix_f1_0 OR reg0_ready_matrix_f1;
407 reg_sp.status_ready_matrix_f2_0 <= reg_sp.status_ready_matrix_f2_0 OR reg0_ready_matrix_f2;
407 reg_sp.status_ready_matrix_f2_0 <= reg_sp.status_ready_matrix_f2_0 OR reg0_ready_matrix_f2;
408
408
409 reg_sp.status_ready_matrix_f0_1 <= reg_sp.status_ready_matrix_f0_1 OR reg1_ready_matrix_f0;
409 reg_sp.status_ready_matrix_f0_1 <= reg_sp.status_ready_matrix_f0_1 OR reg1_ready_matrix_f0;
410 reg_sp.status_ready_matrix_f1_1 <= reg_sp.status_ready_matrix_f1_1 OR reg1_ready_matrix_f1;
410 reg_sp.status_ready_matrix_f1_1 <= reg_sp.status_ready_matrix_f1_1 OR reg1_ready_matrix_f1;
411 reg_sp.status_ready_matrix_f2_1 <= reg_sp.status_ready_matrix_f2_1 OR reg1_ready_matrix_f2;
411 reg_sp.status_ready_matrix_f2_1 <= reg_sp.status_ready_matrix_f2_1 OR reg1_ready_matrix_f2;
412
412
413 all_status_ready_buffer_bit: FOR I IN 4*2-1 DOWNTO 0 LOOP
413 all_status_ready_buffer_bit: FOR I IN 4*2-1 DOWNTO 0 LOOP
414 reg_wp.status_ready_buffer_f(I) <= reg_wp.status_ready_buffer_f(I) OR reg_ready_buffer_f(I);
414 reg_wp.status_ready_buffer_f(I) <= reg_wp.status_ready_buffer_f(I) OR reg_ready_buffer_f(I);
415 END LOOP all_status_ready_buffer_bit;
415 END LOOP all_status_ready_buffer_bit;
416
416
417
417
418 reg_sp.status_error_buffer_full <= reg_sp.status_error_buffer_full OR error_buffer_full;
418 reg_sp.status_error_buffer_full <= reg_sp.status_error_buffer_full OR error_buffer_full;
419 reg_sp.status_error_input_fifo_write(0) <= reg_sp.status_error_input_fifo_write(0) OR error_input_fifo_write(0);
419 reg_sp.status_error_input_fifo_write(0) <= reg_sp.status_error_input_fifo_write(0) OR error_input_fifo_write(0);
420 reg_sp.status_error_input_fifo_write(1) <= reg_sp.status_error_input_fifo_write(1) OR error_input_fifo_write(1);
420 reg_sp.status_error_input_fifo_write(1) <= reg_sp.status_error_input_fifo_write(1) OR error_input_fifo_write(1);
421 reg_sp.status_error_input_fifo_write(2) <= reg_sp.status_error_input_fifo_write(2) OR error_input_fifo_write(2);
421 reg_sp.status_error_input_fifo_write(2) <= reg_sp.status_error_input_fifo_write(2) OR error_input_fifo_write(2);
422
422
423
423
424
424
425 all_status : FOR I IN 3 DOWNTO 0 LOOP
425 all_status : FOR I IN 3 DOWNTO 0 LOOP
426 reg_wp.error_buffer_full(I) <= reg_wp.error_buffer_full(I) OR wfp_error_buffer_full(I);
426 reg_wp.error_buffer_full(I) <= reg_wp.error_buffer_full(I) OR wfp_error_buffer_full(I);
427 reg_wp.status_new_err(I) <= reg_wp.status_new_err(I) OR status_new_err(I);
427 reg_wp.status_new_err(I) <= reg_wp.status_new_err(I) OR status_new_err(I);
428 END LOOP all_status;
428 END LOOP all_status;
429
429
430 paddr := "000000";
430 paddr := "000000";
431 paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2);
431 paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2);
432 prdata <= (OTHERS => '0');
432 prdata <= (OTHERS => '0');
433 IF apbi.psel(pindex) = '1' THEN
433 IF apbi.psel(pindex) = '1' THEN
434 -- APB DMA READ --
434 -- APB DMA READ --
435 CASE paddr(7 DOWNTO 2) IS
435 CASE paddr(7 DOWNTO 2) IS
436
436
437 WHEN ADDR_LFR_SM_CONFIG =>
437 WHEN ADDR_LFR_SM_CONFIG =>
438 prdata(0) <= reg_sp.config_active_interruption_onNewMatrix;
438 prdata(0) <= reg_sp.config_active_interruption_onNewMatrix;
439 prdata(1) <= reg_sp.config_active_interruption_onError;
439 prdata(1) <= reg_sp.config_active_interruption_onError;
440 prdata(2) <= reg_sp.config_ms_run;
440 prdata(2) <= reg_sp.config_ms_run;
441
441
442 WHEN ADDR_LFR_SM_STATUS =>
442 WHEN ADDR_LFR_SM_STATUS =>
443 prdata(0) <= reg_sp.status_ready_matrix_f0_0;
443 prdata(0) <= reg_sp.status_ready_matrix_f0_0;
444 prdata(1) <= reg_sp.status_ready_matrix_f0_1;
444 prdata(1) <= reg_sp.status_ready_matrix_f0_1;
445 prdata(2) <= reg_sp.status_ready_matrix_f1_0;
445 prdata(2) <= reg_sp.status_ready_matrix_f1_0;
446 prdata(3) <= reg_sp.status_ready_matrix_f1_1;
446 prdata(3) <= reg_sp.status_ready_matrix_f1_1;
447 prdata(4) <= reg_sp.status_ready_matrix_f2_0;
447 prdata(4) <= reg_sp.status_ready_matrix_f2_0;
448 prdata(5) <= reg_sp.status_ready_matrix_f2_1;
448 prdata(5) <= reg_sp.status_ready_matrix_f2_1;
449 -- prdata(6) <= reg_sp.status_error_bad_component_error;
449 -- prdata(6) <= reg_sp.status_error_bad_component_error;
450 prdata(7) <= reg_sp.status_error_buffer_full;
450 prdata(7) <= reg_sp.status_error_buffer_full;
451 prdata(8) <= reg_sp.status_error_input_fifo_write(0);
451 prdata(8) <= reg_sp.status_error_input_fifo_write(0);
452 prdata(9) <= reg_sp.status_error_input_fifo_write(1);
452 prdata(9) <= reg_sp.status_error_input_fifo_write(1);
453 prdata(10) <= reg_sp.status_error_input_fifo_write(2);
453 prdata(10) <= reg_sp.status_error_input_fifo_write(2);
454
454
455 WHEN ADDR_LFR_SM_F0_0_ADDR => prdata <= reg_sp.addr_matrix_f0_0;
455 WHEN ADDR_LFR_SM_F0_0_ADDR => prdata <= reg_sp.addr_matrix_f0_0;
456 WHEN ADDR_LFR_SM_F0_1_ADDR => prdata <= reg_sp.addr_matrix_f0_1;
456 WHEN ADDR_LFR_SM_F0_1_ADDR => prdata <= reg_sp.addr_matrix_f0_1;
457 WHEN ADDR_LFR_SM_F1_0_ADDR => prdata <= reg_sp.addr_matrix_f1_0;
457 WHEN ADDR_LFR_SM_F1_0_ADDR => prdata <= reg_sp.addr_matrix_f1_0;
458 WHEN ADDR_LFR_SM_F1_1_ADDR => prdata <= reg_sp.addr_matrix_f1_1;
458 WHEN ADDR_LFR_SM_F1_1_ADDR => prdata <= reg_sp.addr_matrix_f1_1;
459 WHEN ADDR_LFR_SM_F2_0_ADDR => prdata <= reg_sp.addr_matrix_f2_0;
459 WHEN ADDR_LFR_SM_F2_0_ADDR => prdata <= reg_sp.addr_matrix_f2_0;
460 WHEN ADDR_LFR_SM_F2_1_ADDR => prdata <= reg_sp.addr_matrix_f2_1;
460 WHEN ADDR_LFR_SM_F2_1_ADDR => prdata <= reg_sp.addr_matrix_f2_1;
461 WHEN ADDR_LFR_SM_F0_0_TIME_COARSE => prdata <= reg_sp.time_matrix_f0_0(47 DOWNTO 16);
461 WHEN ADDR_LFR_SM_F0_0_TIME_COARSE => prdata <= reg_sp.time_matrix_f0_0(47 DOWNTO 16);
462 WHEN ADDR_LFR_SM_F0_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f0_0(15 DOWNTO 0);
462 WHEN ADDR_LFR_SM_F0_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f0_0(15 DOWNTO 0);
463 WHEN ADDR_LFR_SM_F0_1_TIME_COARSE => prdata <= reg_sp.time_matrix_f0_1(47 DOWNTO 16);
463 WHEN ADDR_LFR_SM_F0_1_TIME_COARSE => prdata <= reg_sp.time_matrix_f0_1(47 DOWNTO 16);
464 WHEN ADDR_LFR_SM_F0_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f0_1(15 DOWNTO 0);
464 WHEN ADDR_LFR_SM_F0_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f0_1(15 DOWNTO 0);
465 WHEN ADDR_LFR_SM_F1_0_TIME_COARSE => prdata <= reg_sp.time_matrix_f1_0(47 DOWNTO 16);
465 WHEN ADDR_LFR_SM_F1_0_TIME_COARSE => prdata <= reg_sp.time_matrix_f1_0(47 DOWNTO 16);
466 WHEN ADDR_LFR_SM_F1_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f1_0(15 DOWNTO 0);
466 WHEN ADDR_LFR_SM_F1_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f1_0(15 DOWNTO 0);
467 WHEN ADDR_LFR_SM_F1_1_TIME_COARSE => prdata <= reg_sp.time_matrix_f1_1(47 DOWNTO 16);
467 WHEN ADDR_LFR_SM_F1_1_TIME_COARSE => prdata <= reg_sp.time_matrix_f1_1(47 DOWNTO 16);
468 WHEN ADDR_LFR_SM_F1_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f1_1(15 DOWNTO 0);
468 WHEN ADDR_LFR_SM_F1_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f1_1(15 DOWNTO 0);
469 WHEN ADDR_LFR_SM_F2_0_TIME_COARSE => prdata <= reg_sp.time_matrix_f2_0(47 DOWNTO 16);
469 WHEN ADDR_LFR_SM_F2_0_TIME_COARSE => prdata <= reg_sp.time_matrix_f2_0(47 DOWNTO 16);
470 WHEN ADDR_LFR_SM_F2_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f2_0(15 DOWNTO 0);
470 WHEN ADDR_LFR_SM_F2_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f2_0(15 DOWNTO 0);
471 WHEN ADDR_LFR_SM_F2_1_TIME_COARSE => prdata <= reg_sp.time_matrix_f2_1(47 DOWNTO 16);
471 WHEN ADDR_LFR_SM_F2_1_TIME_COARSE => prdata <= reg_sp.time_matrix_f2_1(47 DOWNTO 16);
472 WHEN ADDR_LFR_SM_F2_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f2_1(15 DOWNTO 0);
472 WHEN ADDR_LFR_SM_F2_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_sp.time_matrix_f2_1(15 DOWNTO 0);
473 WHEN ADDR_LFR_SM_LENGTH => prdata(25 DOWNTO 0) <= reg_sp.length_matrix;
473 WHEN ADDR_LFR_SM_LENGTH => prdata(25 DOWNTO 0) <= reg_sp.length_matrix;
474 ---------------------------------------------------------------------
474 ---------------------------------------------------------------------
475 WHEN ADDR_LFR_WP_DATASHAPING =>
475 WHEN ADDR_LFR_WP_DATASHAPING =>
476 prdata(0) <= reg_wp.data_shaping_BW;
476 prdata(0) <= reg_wp.data_shaping_BW;
477 prdata(1) <= reg_wp.data_shaping_SP0;
477 prdata(1) <= reg_wp.data_shaping_SP0;
478 prdata(2) <= reg_wp.data_shaping_SP1;
478 prdata(2) <= reg_wp.data_shaping_SP1;
479 prdata(3) <= reg_wp.data_shaping_R0;
479 prdata(3) <= reg_wp.data_shaping_R0;
480 prdata(4) <= reg_wp.data_shaping_R1;
480 prdata(4) <= reg_wp.data_shaping_R1;
481 prdata(5) <= reg_wp.data_shaping_R2;
481 prdata(5) <= reg_wp.data_shaping_R2;
482 WHEN ADDR_LFR_WP_CONTROL =>
482 WHEN ADDR_LFR_WP_CONTROL =>
483 prdata(0) <= reg_wp.enable_f0;
483 prdata(0) <= reg_wp.enable_f0;
484 prdata(1) <= reg_wp.enable_f1;
484 prdata(1) <= reg_wp.enable_f1;
485 prdata(2) <= reg_wp.enable_f2;
485 prdata(2) <= reg_wp.enable_f2;
486 prdata(3) <= reg_wp.enable_f3;
486 prdata(3) <= reg_wp.enable_f3;
487 prdata(4) <= reg_wp.burst_f0;
487 prdata(4) <= reg_wp.burst_f0;
488 prdata(5) <= reg_wp.burst_f1;
488 prdata(5) <= reg_wp.burst_f1;
489 prdata(6) <= reg_wp.burst_f2;
489 prdata(6) <= reg_wp.burst_f2;
490 prdata(7) <= reg_wp.run;
490 prdata(7) <= reg_wp.run;
491 WHEN ADDR_LFR_WP_F0_0_ADDR => prdata <= reg_wp.addr_buffer_f(32*1-1 DOWNTO 32*0);--0
491 WHEN ADDR_LFR_WP_F0_0_ADDR => prdata <= reg_wp.addr_buffer_f(32*1-1 DOWNTO 32*0);--0
492 WHEN ADDR_LFR_WP_F0_1_ADDR => prdata <= reg_wp.addr_buffer_f(32*2-1 DOWNTO 32*1);
492 WHEN ADDR_LFR_WP_F0_1_ADDR => prdata <= reg_wp.addr_buffer_f(32*2-1 DOWNTO 32*1);
493 WHEN ADDR_LFR_WP_F1_0_ADDR => prdata <= reg_wp.addr_buffer_f(32*3-1 DOWNTO 32*2);--1
493 WHEN ADDR_LFR_WP_F1_0_ADDR => prdata <= reg_wp.addr_buffer_f(32*3-1 DOWNTO 32*2);--1
494 WHEN ADDR_LFR_WP_F1_1_ADDR => prdata <= reg_wp.addr_buffer_f(32*4-1 DOWNTO 32*3);
494 WHEN ADDR_LFR_WP_F1_1_ADDR => prdata <= reg_wp.addr_buffer_f(32*4-1 DOWNTO 32*3);
495 WHEN ADDR_LFR_WP_F2_0_ADDR => prdata <= reg_wp.addr_buffer_f(32*5-1 DOWNTO 32*4);--2
495 WHEN ADDR_LFR_WP_F2_0_ADDR => prdata <= reg_wp.addr_buffer_f(32*5-1 DOWNTO 32*4);--2
496 WHEN ADDR_LFR_WP_F2_1_ADDR => prdata <= reg_wp.addr_buffer_f(32*6-1 DOWNTO 32*5);
496 WHEN ADDR_LFR_WP_F2_1_ADDR => prdata <= reg_wp.addr_buffer_f(32*6-1 DOWNTO 32*5);
497 WHEN ADDR_LFR_WP_F3_0_ADDR => prdata <= reg_wp.addr_buffer_f(32*7-1 DOWNTO 32*6);--3
497 WHEN ADDR_LFR_WP_F3_0_ADDR => prdata <= reg_wp.addr_buffer_f(32*7-1 DOWNTO 32*6);--3
498 WHEN ADDR_LFR_WP_F3_1_ADDR => prdata <= reg_wp.addr_buffer_f(32*8-1 DOWNTO 32*7);
498 WHEN ADDR_LFR_WP_F3_1_ADDR => prdata <= reg_wp.addr_buffer_f(32*8-1 DOWNTO 32*7);
499
499
500 WHEN ADDR_LFR_WP_STATUS =>
500 WHEN ADDR_LFR_WP_STATUS =>
501 prdata(7 DOWNTO 0) <= reg_wp.status_ready_buffer_f;
501 prdata(7 DOWNTO 0) <= reg_wp.status_ready_buffer_f;
502 prdata(11 DOWNTO 8) <= reg_wp.error_buffer_full;
502 prdata(11 DOWNTO 8) <= reg_wp.error_buffer_full;
503 prdata(15 DOWNTO 12) <= reg_wp.status_new_err;
503 prdata(15 DOWNTO 12) <= reg_wp.status_new_err;
504
504
505 WHEN ADDR_LFR_WP_DELTASNAPSHOT => prdata(delta_vector_size-1 DOWNTO 0) <= reg_wp.delta_snapshot;
505 WHEN ADDR_LFR_WP_DELTASNAPSHOT => prdata(delta_vector_size-1 DOWNTO 0) <= reg_wp.delta_snapshot;
506 WHEN ADDR_LFR_WP_DELTA_F0 => prdata(delta_vector_size-1 DOWNTO 0) <= reg_wp.delta_f0;
506 WHEN ADDR_LFR_WP_DELTA_F0 => prdata(delta_vector_size-1 DOWNTO 0) <= reg_wp.delta_f0;
507 WHEN ADDR_LFR_WP_DELTA_F0_2 => prdata(delta_vector_size_f0_2-1 DOWNTO 0) <= reg_wp.delta_f0_2;
507 WHEN ADDR_LFR_WP_DELTA_F0_2 => prdata(delta_vector_size_f0_2-1 DOWNTO 0) <= reg_wp.delta_f0_2;
508 WHEN ADDR_LFR_WP_DELTA_F1 => prdata(delta_vector_size-1 DOWNTO 0) <= reg_wp.delta_f1;
508 WHEN ADDR_LFR_WP_DELTA_F1 => prdata(delta_vector_size-1 DOWNTO 0) <= reg_wp.delta_f1;
509 WHEN ADDR_LFR_WP_DELTA_F2 => prdata(delta_vector_size-1 DOWNTO 0) <= reg_wp.delta_f2;
509 WHEN ADDR_LFR_WP_DELTA_F2 => prdata(delta_vector_size-1 DOWNTO 0) <= reg_wp.delta_f2;
510 WHEN ADDR_LFR_WP_DATA_IN_BUFFER => prdata(nb_data_by_buffer_size-1 DOWNTO 0) <= reg_wp.nb_data_by_buffer;
510 WHEN ADDR_LFR_WP_DATA_IN_BUFFER => prdata(nb_data_by_buffer_size-1 DOWNTO 0) <= reg_wp.nb_data_by_buffer;
511 WHEN ADDR_LFR_WP_NBSNAPSHOT => prdata(nb_snapshot_param_size-1 DOWNTO 0) <= reg_wp.nb_snapshot_param;
511 WHEN ADDR_LFR_WP_NBSNAPSHOT => prdata(nb_snapshot_param_size-1 DOWNTO 0) <= reg_wp.nb_snapshot_param;
512 WHEN ADDR_LFR_WP_START_DATE => prdata(30 DOWNTO 0) <= reg_wp.start_date;
512 WHEN ADDR_LFR_WP_START_DATE => prdata(30 DOWNTO 0) <= reg_wp.start_date;
513
513
514 WHEN ADDR_LFR_WP_F0_0_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*0 + 31 DOWNTO 48*0);
514 WHEN ADDR_LFR_WP_F0_0_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*0 + 31 DOWNTO 48*0);
515 WHEN ADDR_LFR_WP_F0_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*0 + 47 DOWNTO 48*0 + 32);
515 WHEN ADDR_LFR_WP_F0_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*0 + 47 DOWNTO 48*0 + 32);
516 WHEN ADDR_LFR_WP_F0_1_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*1 + 31 DOWNTO 48*1);
516 WHEN ADDR_LFR_WP_F0_1_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*1 + 31 DOWNTO 48*1);
517 WHEN ADDR_LFR_WP_F0_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*1 + 47 DOWNTO 48*1 + 32);
517 WHEN ADDR_LFR_WP_F0_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*1 + 47 DOWNTO 48*1 + 32);
518
518
519 WHEN ADDR_LFR_WP_F1_0_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*2 + 31 DOWNTO 48*2);
519 WHEN ADDR_LFR_WP_F1_0_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*2 + 31 DOWNTO 48*2);
520 WHEN ADDR_LFR_WP_F1_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*2 + 47 DOWNTO 48*2 + 32);
520 WHEN ADDR_LFR_WP_F1_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*2 + 47 DOWNTO 48*2 + 32);
521 WHEN ADDR_LFR_WP_F1_1_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*3 + 31 DOWNTO 48*3);
521 WHEN ADDR_LFR_WP_F1_1_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*3 + 31 DOWNTO 48*3);
522 WHEN ADDR_LFR_WP_F1_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*3 + 47 DOWNTO 48*3 + 32);
522 WHEN ADDR_LFR_WP_F1_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*3 + 47 DOWNTO 48*3 + 32);
523
523
524 WHEN ADDR_LFR_WP_F2_0_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*4 + 31 DOWNTO 48*4);
524 WHEN ADDR_LFR_WP_F2_0_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*4 + 31 DOWNTO 48*4);
525 WHEN ADDR_LFR_WP_F2_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*4 + 47 DOWNTO 48*4 + 32);
525 WHEN ADDR_LFR_WP_F2_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*4 + 47 DOWNTO 48*4 + 32);
526 WHEN ADDR_LFR_WP_F2_1_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*5 + 31 DOWNTO 48*5);
526 WHEN ADDR_LFR_WP_F2_1_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*5 + 31 DOWNTO 48*5);
527 WHEN ADDR_LFR_WP_F2_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*5 + 47 DOWNTO 48*5 + 32);
527 WHEN ADDR_LFR_WP_F2_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*5 + 47 DOWNTO 48*5 + 32);
528
528
529 WHEN ADDR_LFR_WP_F3_0_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*6 + 31 DOWNTO 48*6);
529 WHEN ADDR_LFR_WP_F3_0_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*6 + 31 DOWNTO 48*6);
530 WHEN ADDR_LFR_WP_F3_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*6 + 47 DOWNTO 48*6 + 32);
530 WHEN ADDR_LFR_WP_F3_0_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*6 + 47 DOWNTO 48*6 + 32);
531 WHEN ADDR_LFR_WP_F3_1_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*7 + 31 DOWNTO 48*7);
531 WHEN ADDR_LFR_WP_F3_1_TIME_COARSE => prdata(31 DOWNTO 0) <= reg_wp.time_buffer_f(48*7 + 31 DOWNTO 48*7);
532 WHEN ADDR_LFR_WP_F3_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*7 + 47 DOWNTO 48*7 + 32);
532 WHEN ADDR_LFR_WP_F3_1_TIME_FINE => prdata(15 DOWNTO 0) <= reg_wp.time_buffer_f(48*7 + 47 DOWNTO 48*7 + 32);
533
533
534 WHEN ADDR_LFR_WP_LENGTH => prdata(25 DOWNTO 0) <= reg_wp.length_buffer;
534 WHEN ADDR_LFR_WP_LENGTH => prdata(25 DOWNTO 0) <= reg_wp.length_buffer;
535 ---------------------------------------------------------------------
535 ---------------------------------------------------------------------
536 WHEN ADDR_LFR_VERSION => prdata(23 DOWNTO 0) <= top_lfr_version(23 DOWNTO 0);
536 WHEN ADDR_LFR_VERSION => prdata(23 DOWNTO 0) <= top_lfr_version(23 DOWNTO 0);
537 WHEN OTHERS => NULL;
537 WHEN OTHERS => NULL;
538
538
539 END CASE;
539 END CASE;
540 IF (apbi.pwrite AND apbi.penable) = '1' THEN
540 IF (apbi.pwrite AND apbi.penable) = '1' THEN
541 -- APB DMA WRITE --
541 -- APB DMA WRITE --
542 CASE paddr(7 DOWNTO 2) IS
542 CASE paddr(7 DOWNTO 2) IS
543 --
543 --
544 WHEN ADDR_LFR_SM_CONFIG =>
544 WHEN ADDR_LFR_SM_CONFIG =>
545 reg_sp.config_active_interruption_onNewMatrix <= apbi.pwdata(0);
545 reg_sp.config_active_interruption_onNewMatrix <= apbi.pwdata(0);
546 reg_sp.config_active_interruption_onError <= apbi.pwdata(1);
546 reg_sp.config_active_interruption_onError <= apbi.pwdata(1);
547 reg_sp.config_ms_run <= apbi.pwdata(2);
547 reg_sp.config_ms_run <= apbi.pwdata(2);
548
548
549 WHEN ADDR_LFR_SM_STATUS =>
549 WHEN ADDR_LFR_SM_STATUS =>
550 reg_sp.status_ready_matrix_f0_0 <= ((NOT apbi.pwdata(0) ) AND reg_sp.status_ready_matrix_f0_0 ) OR reg0_ready_matrix_f0;
550 reg_sp.status_ready_matrix_f0_0 <= ((NOT apbi.pwdata(0) ) AND reg_sp.status_ready_matrix_f0_0 ) OR reg0_ready_matrix_f0;
551 reg_sp.status_ready_matrix_f0_1 <= ((NOT apbi.pwdata(1) ) AND reg_sp.status_ready_matrix_f0_1 ) OR reg1_ready_matrix_f0;
551 reg_sp.status_ready_matrix_f0_1 <= ((NOT apbi.pwdata(1) ) AND reg_sp.status_ready_matrix_f0_1 ) OR reg1_ready_matrix_f0;
552 reg_sp.status_ready_matrix_f1_0 <= ((NOT apbi.pwdata(2) ) AND reg_sp.status_ready_matrix_f1_0 ) OR reg0_ready_matrix_f1;
552 reg_sp.status_ready_matrix_f1_0 <= ((NOT apbi.pwdata(2) ) AND reg_sp.status_ready_matrix_f1_0 ) OR reg0_ready_matrix_f1;
553 reg_sp.status_ready_matrix_f1_1 <= ((NOT apbi.pwdata(3) ) AND reg_sp.status_ready_matrix_f1_1 ) OR reg1_ready_matrix_f1;
553 reg_sp.status_ready_matrix_f1_1 <= ((NOT apbi.pwdata(3) ) AND reg_sp.status_ready_matrix_f1_1 ) OR reg1_ready_matrix_f1;
554 reg_sp.status_ready_matrix_f2_0 <= ((NOT apbi.pwdata(4) ) AND reg_sp.status_ready_matrix_f2_0 ) OR reg0_ready_matrix_f2;
554 reg_sp.status_ready_matrix_f2_0 <= ((NOT apbi.pwdata(4) ) AND reg_sp.status_ready_matrix_f2_0 ) OR reg0_ready_matrix_f2;
555 reg_sp.status_ready_matrix_f2_1 <= ((NOT apbi.pwdata(5) ) AND reg_sp.status_ready_matrix_f2_1 ) OR reg1_ready_matrix_f2;
555 reg_sp.status_ready_matrix_f2_1 <= ((NOT apbi.pwdata(5) ) AND reg_sp.status_ready_matrix_f2_1 ) OR reg1_ready_matrix_f2;
556 reg_sp.status_error_buffer_full <= ((NOT apbi.pwdata(7) ) AND reg_sp.status_error_buffer_full ) OR error_buffer_full;
556 reg_sp.status_error_buffer_full <= ((NOT apbi.pwdata(7) ) AND reg_sp.status_error_buffer_full ) OR error_buffer_full;
557 reg_sp.status_error_input_fifo_write(0) <= ((NOT apbi.pwdata(8) ) AND reg_sp.status_error_input_fifo_write(0)) OR error_input_fifo_write(0);
557 reg_sp.status_error_input_fifo_write(0) <= ((NOT apbi.pwdata(8) ) AND reg_sp.status_error_input_fifo_write(0)) OR error_input_fifo_write(0);
558 reg_sp.status_error_input_fifo_write(1) <= ((NOT apbi.pwdata(9) ) AND reg_sp.status_error_input_fifo_write(1)) OR error_input_fifo_write(1);
558 reg_sp.status_error_input_fifo_write(1) <= ((NOT apbi.pwdata(9) ) AND reg_sp.status_error_input_fifo_write(1)) OR error_input_fifo_write(1);
559 reg_sp.status_error_input_fifo_write(2) <= ((NOT apbi.pwdata(10)) AND reg_sp.status_error_input_fifo_write(2)) OR error_input_fifo_write(2);
559 reg_sp.status_error_input_fifo_write(2) <= ((NOT apbi.pwdata(10)) AND reg_sp.status_error_input_fifo_write(2)) OR error_input_fifo_write(2);
560 WHEN ADDR_LFR_SM_F0_0_ADDR => reg_sp.addr_matrix_f0_0 <= apbi.pwdata;
560 WHEN ADDR_LFR_SM_F0_0_ADDR => reg_sp.addr_matrix_f0_0 <= apbi.pwdata;
561 WHEN ADDR_LFR_SM_F0_1_ADDR => reg_sp.addr_matrix_f0_1 <= apbi.pwdata;
561 WHEN ADDR_LFR_SM_F0_1_ADDR => reg_sp.addr_matrix_f0_1 <= apbi.pwdata;
562 WHEN ADDR_LFR_SM_F1_0_ADDR => reg_sp.addr_matrix_f1_0 <= apbi.pwdata;
562 WHEN ADDR_LFR_SM_F1_0_ADDR => reg_sp.addr_matrix_f1_0 <= apbi.pwdata;
563 WHEN ADDR_LFR_SM_F1_1_ADDR => reg_sp.addr_matrix_f1_1 <= apbi.pwdata;
563 WHEN ADDR_LFR_SM_F1_1_ADDR => reg_sp.addr_matrix_f1_1 <= apbi.pwdata;
564 WHEN ADDR_LFR_SM_F2_0_ADDR => reg_sp.addr_matrix_f2_0 <= apbi.pwdata;
564 WHEN ADDR_LFR_SM_F2_0_ADDR => reg_sp.addr_matrix_f2_0 <= apbi.pwdata;
565 WHEN ADDR_LFR_SM_F2_1_ADDR => reg_sp.addr_matrix_f2_1 <= apbi.pwdata;
565 WHEN ADDR_LFR_SM_F2_1_ADDR => reg_sp.addr_matrix_f2_1 <= apbi.pwdata;
566
566
567 WHEN ADDR_LFR_SM_LENGTH => reg_sp.length_matrix <= apbi.pwdata(25 DOWNTO 0);
567 WHEN ADDR_LFR_SM_LENGTH => reg_sp.length_matrix <= apbi.pwdata(25 DOWNTO 0);
568 ---------------------------------------------------------------------
568 ---------------------------------------------------------------------
569 WHEN ADDR_LFR_WP_DATASHAPING =>
569 WHEN ADDR_LFR_WP_DATASHAPING =>
570 reg_wp.data_shaping_BW <= apbi.pwdata(0);
570 reg_wp.data_shaping_BW <= apbi.pwdata(0);
571 reg_wp.data_shaping_SP0 <= apbi.pwdata(1);
571 reg_wp.data_shaping_SP0 <= apbi.pwdata(1);
572 reg_wp.data_shaping_SP1 <= apbi.pwdata(2);
572 reg_wp.data_shaping_SP1 <= apbi.pwdata(2);
573 reg_wp.data_shaping_R0 <= apbi.pwdata(3);
573 reg_wp.data_shaping_R0 <= apbi.pwdata(3);
574 reg_wp.data_shaping_R1 <= apbi.pwdata(4);
574 reg_wp.data_shaping_R1 <= apbi.pwdata(4);
575 reg_wp.data_shaping_R2 <= apbi.pwdata(5);
575 reg_wp.data_shaping_R2 <= apbi.pwdata(5);
576 WHEN ADDR_LFR_WP_CONTROL =>
576 WHEN ADDR_LFR_WP_CONTROL =>
577 reg_wp.enable_f0 <= apbi.pwdata(0);
577 reg_wp.enable_f0 <= apbi.pwdata(0);
578 reg_wp.enable_f1 <= apbi.pwdata(1);
578 reg_wp.enable_f1 <= apbi.pwdata(1);
579 reg_wp.enable_f2 <= apbi.pwdata(2);
579 reg_wp.enable_f2 <= apbi.pwdata(2);
580 reg_wp.enable_f3 <= apbi.pwdata(3);
580 reg_wp.enable_f3 <= apbi.pwdata(3);
581 reg_wp.burst_f0 <= apbi.pwdata(4);
581 reg_wp.burst_f0 <= apbi.pwdata(4);
582 reg_wp.burst_f1 <= apbi.pwdata(5);
582 reg_wp.burst_f1 <= apbi.pwdata(5);
583 reg_wp.burst_f2 <= apbi.pwdata(6);
583 reg_wp.burst_f2 <= apbi.pwdata(6);
584 reg_wp.run <= apbi.pwdata(7);
584 reg_wp.run <= apbi.pwdata(7);
585 WHEN ADDR_LFR_WP_F0_0_ADDR => reg_wp.addr_buffer_f(32*1-1 DOWNTO 32*0) <= apbi.pwdata;
585 WHEN ADDR_LFR_WP_F0_0_ADDR => reg_wp.addr_buffer_f(32*1-1 DOWNTO 32*0) <= apbi.pwdata;
586 WHEN ADDR_LFR_WP_F0_1_ADDR => reg_wp.addr_buffer_f(32*2-1 DOWNTO 32*1) <= apbi.pwdata;
586 WHEN ADDR_LFR_WP_F0_1_ADDR => reg_wp.addr_buffer_f(32*2-1 DOWNTO 32*1) <= apbi.pwdata;
587 WHEN ADDR_LFR_WP_F1_0_ADDR => reg_wp.addr_buffer_f(32*3-1 DOWNTO 32*2) <= apbi.pwdata;
587 WHEN ADDR_LFR_WP_F1_0_ADDR => reg_wp.addr_buffer_f(32*3-1 DOWNTO 32*2) <= apbi.pwdata;
588 WHEN ADDR_LFR_WP_F1_1_ADDR => reg_wp.addr_buffer_f(32*4-1 DOWNTO 32*3) <= apbi.pwdata;
588 WHEN ADDR_LFR_WP_F1_1_ADDR => reg_wp.addr_buffer_f(32*4-1 DOWNTO 32*3) <= apbi.pwdata;
589 WHEN ADDR_LFR_WP_F2_0_ADDR => reg_wp.addr_buffer_f(32*5-1 DOWNTO 32*4) <= apbi.pwdata;
589 WHEN ADDR_LFR_WP_F2_0_ADDR => reg_wp.addr_buffer_f(32*5-1 DOWNTO 32*4) <= apbi.pwdata;
590 WHEN ADDR_LFR_WP_F2_1_ADDR => reg_wp.addr_buffer_f(32*6-1 DOWNTO 32*5) <= apbi.pwdata;
590 WHEN ADDR_LFR_WP_F2_1_ADDR => reg_wp.addr_buffer_f(32*6-1 DOWNTO 32*5) <= apbi.pwdata;
591 WHEN ADDR_LFR_WP_F3_0_ADDR => reg_wp.addr_buffer_f(32*7-1 DOWNTO 32*6) <= apbi.pwdata;
591 WHEN ADDR_LFR_WP_F3_0_ADDR => reg_wp.addr_buffer_f(32*7-1 DOWNTO 32*6) <= apbi.pwdata;
592 WHEN ADDR_LFR_WP_F3_1_ADDR => reg_wp.addr_buffer_f(32*8-1 DOWNTO 32*7) <= apbi.pwdata;
592 WHEN ADDR_LFR_WP_F3_1_ADDR => reg_wp.addr_buffer_f(32*8-1 DOWNTO 32*7) <= apbi.pwdata;
593 WHEN ADDR_LFR_WP_STATUS =>
593 WHEN ADDR_LFR_WP_STATUS =>
594 all_reg_wp_status_bit: FOR I IN 3 DOWNTO 0 LOOP
594 all_reg_wp_status_bit: FOR I IN 3 DOWNTO 0 LOOP
595 reg_wp.status_ready_buffer_f(I*2) <= ((NOT apbi.pwdata(I*2) ) AND reg_wp.status_ready_buffer_f(I*2) ) OR reg_ready_buffer_f(I*2);
595 reg_wp.status_ready_buffer_f(I*2) <= ((NOT apbi.pwdata(I*2) ) AND reg_wp.status_ready_buffer_f(I*2) ) OR reg_ready_buffer_f(I*2);
596 reg_wp.status_ready_buffer_f(I*2+1) <= ((NOT apbi.pwdata(I*2+1)) AND reg_wp.status_ready_buffer_f(I*2+1)) OR reg_ready_buffer_f(I*2+1);
596 reg_wp.status_ready_buffer_f(I*2+1) <= ((NOT apbi.pwdata(I*2+1)) AND reg_wp.status_ready_buffer_f(I*2+1)) OR reg_ready_buffer_f(I*2+1);
597 reg_wp.error_buffer_full(I) <= ((NOT apbi.pwdata(I+8) ) AND reg_wp.error_buffer_full(I) ) OR wfp_error_buffer_full(I);
597 reg_wp.error_buffer_full(I) <= ((NOT apbi.pwdata(I+8) ) AND reg_wp.error_buffer_full(I) ) OR wfp_error_buffer_full(I);
598 reg_wp.status_new_err(I) <= ((NOT apbi.pwdata(I+12) ) AND reg_wp.status_new_err(I) ) OR status_new_err(I);
598 reg_wp.status_new_err(I) <= ((NOT apbi.pwdata(I+12) ) AND reg_wp.status_new_err(I) ) OR status_new_err(I);
599 END LOOP all_reg_wp_status_bit;
599 END LOOP all_reg_wp_status_bit;
600
600
601 WHEN ADDR_LFR_WP_DELTASNAPSHOT => reg_wp.delta_snapshot <= apbi.pwdata(delta_vector_size-1 DOWNTO 0);
601 WHEN ADDR_LFR_WP_DELTASNAPSHOT => reg_wp.delta_snapshot <= apbi.pwdata(delta_vector_size-1 DOWNTO 0);
602 WHEN ADDR_LFR_WP_DELTA_F0 => reg_wp.delta_f0 <= apbi.pwdata(delta_vector_size-1 DOWNTO 0);
602 WHEN ADDR_LFR_WP_DELTA_F0 => reg_wp.delta_f0 <= apbi.pwdata(delta_vector_size-1 DOWNTO 0);
603 WHEN ADDR_LFR_WP_DELTA_F0_2 => reg_wp.delta_f0_2 <= apbi.pwdata(delta_vector_size_f0_2-1 DOWNTO 0);
603 WHEN ADDR_LFR_WP_DELTA_F0_2 => reg_wp.delta_f0_2 <= apbi.pwdata(delta_vector_size_f0_2-1 DOWNTO 0);
604 WHEN ADDR_LFR_WP_DELTA_F1 => reg_wp.delta_f1 <= apbi.pwdata(delta_vector_size-1 DOWNTO 0);
604 WHEN ADDR_LFR_WP_DELTA_F1 => reg_wp.delta_f1 <= apbi.pwdata(delta_vector_size-1 DOWNTO 0);
605 WHEN ADDR_LFR_WP_DELTA_F2 => reg_wp.delta_f2 <= apbi.pwdata(delta_vector_size-1 DOWNTO 0);
605 WHEN ADDR_LFR_WP_DELTA_F2 => reg_wp.delta_f2 <= apbi.pwdata(delta_vector_size-1 DOWNTO 0);
606 WHEN ADDR_LFR_WP_DATA_IN_BUFFER => reg_wp.nb_data_by_buffer <= apbi.pwdata(nb_data_by_buffer_size-1 DOWNTO 0);
606 WHEN ADDR_LFR_WP_DATA_IN_BUFFER => reg_wp.nb_data_by_buffer <= apbi.pwdata(nb_data_by_buffer_size-1 DOWNTO 0);
607 WHEN ADDR_LFR_WP_NBSNAPSHOT => reg_wp.nb_snapshot_param <= apbi.pwdata(nb_snapshot_param_size-1 DOWNTO 0);
607 WHEN ADDR_LFR_WP_NBSNAPSHOT => reg_wp.nb_snapshot_param <= apbi.pwdata(nb_snapshot_param_size-1 DOWNTO 0);
608 WHEN ADDR_LFR_WP_START_DATE => reg_wp.start_date <= apbi.pwdata(30 DOWNTO 0);
608 WHEN ADDR_LFR_WP_START_DATE => reg_wp.start_date <= apbi.pwdata(30 DOWNTO 0);
609
609
610 WHEN ADDR_LFR_WP_LENGTH => reg_wp.length_buffer <= apbi.pwdata(25 DOWNTO 0);
610 WHEN ADDR_LFR_WP_LENGTH => reg_wp.length_buffer <= apbi.pwdata(25 DOWNTO 0);
611
611
612 WHEN OTHERS => NULL;
612 WHEN OTHERS => NULL;
613 END CASE;
613 END CASE;
614 END IF;
614 END IF;
615 END IF;
615 END IF;
616 --apbo.pirq(pirq_ms) <=
616 --apbo.pirq(pirq_ms) <=
617 pirq_temp( pirq_ms) <= apbo_irq_ms;
617 pirq_temp( pirq_ms) <= apbo_irq_ms;
618 pirq_temp(pirq_wfp) <= apbo_irq_wfp;
618 pirq_temp(pirq_wfp) <= apbo_irq_wfp;
619 apbo_irq_ms <= ((reg_sp.config_active_interruption_onNewMatrix AND (ready_matrix_f0 OR
619 apbo_irq_ms <= ((reg_sp.config_active_interruption_onNewMatrix AND (ready_matrix_f0 OR
620 ready_matrix_f1 OR
620 ready_matrix_f1 OR
621 ready_matrix_f2)
621 ready_matrix_f2)
622 )
622 )
623 OR
623 OR
624 (reg_sp.config_active_interruption_onError AND (
624 (reg_sp.config_active_interruption_onError AND (
625 -- error_bad_component_error OR
625 -- error_bad_component_error OR
626 error_buffer_full
626 error_buffer_full
627 OR error_input_fifo_write(0)
627 OR error_input_fifo_write(0)
628 OR error_input_fifo_write(1)
628 OR error_input_fifo_write(1)
629 OR error_input_fifo_write(2))
629 OR error_input_fifo_write(2))
630 ));
630 ));
631 -- apbo.pirq(pirq_wfp)
631 -- apbo.pirq(pirq_wfp)
632 apbo_irq_wfp<= ored_irq_wfp;
632 apbo_irq_wfp<= ored_irq_wfp;
633
633
634 END IF;
634 END IF;
635 END PROCESS lpp_lfr_apbreg;
635 END PROCESS lpp_lfr_apbreg;
636
636
637 apbo.pirq <= pirq_temp;
637 apbo.pirq <= pirq_temp;
638
638
639
639
640 --all_irq: FOR I IN 31 DOWNTO 0 GENERATE
640 --all_irq: FOR I IN 31 DOWNTO 0 GENERATE
641 -- IRQ_is_PIRQ_MS: IF I = pirq_ms GENERATE
641 -- IRQ_is_PIRQ_MS: IF I = pirq_ms GENERATE
642 -- apbo.pirq(I) <= apbo_irq_ms;
642 -- apbo.pirq(I) <= apbo_irq_ms;
643 -- END GENERATE IRQ_is_PIRQ_MS;
643 -- END GENERATE IRQ_is_PIRQ_MS;
644 -- IRQ_is_PIRQ_WFP: IF I = pirq_wfp GENERATE
644 -- IRQ_is_PIRQ_WFP: IF I = pirq_wfp GENERATE
645 -- apbo.pirq(I) <= apbo_irq_wfp;
645 -- apbo.pirq(I) <= apbo_irq_wfp;
646 -- END GENERATE IRQ_is_PIRQ_WFP;
646 -- END GENERATE IRQ_is_PIRQ_WFP;
647 -- IRQ_OTHERS: IF I /= pirq_ms AND pirq_wfp /= pirq_wfp GENERATE
647 -- IRQ_OTHERS: IF I /= pirq_ms AND pirq_wfp /= pirq_wfp GENERATE
648 -- apbo.pirq(I) <= '0';
648 -- apbo.pirq(I) <= '0';
649 -- END GENERATE IRQ_OTHERS;
649 -- END GENERATE IRQ_OTHERS;
650
650
651 --END GENERATE all_irq;
651 --END GENERATE all_irq;
652
652
653
653
654
654
655 apbo.pindex <= pindex;
655 apbo.pindex <= pindex;
656 apbo.pconfig <= pconfig;
656 apbo.pconfig <= pconfig;
657 apbo.prdata <= prdata;
657 apbo.prdata <= prdata;
658
658
659 -----------------------------------------------------------------------------
659 -----------------------------------------------------------------------------
660 -- IRQ
660 -- IRQ
661 -----------------------------------------------------------------------------
661 -----------------------------------------------------------------------------
662 irq_wfp_reg_s <= wfp_ready_buffer & wfp_error_buffer_full & status_new_err;
662 irq_wfp_reg_s <= wfp_ready_buffer & wfp_error_buffer_full & status_new_err;
663
663
664 PROCESS (HCLK, HRESETn)
664 PROCESS (HCLK, HRESETn)
665 BEGIN -- PROCESS
665 BEGIN -- PROCESS
666 IF HRESETn = '0' THEN -- asynchronous reset (active low)
666 IF HRESETn = '0' THEN -- asynchronous reset (active low)
667 irq_wfp_reg <= (OTHERS => '0');
667 irq_wfp_reg <= (OTHERS => '0');
668 ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge
668 ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge
669 irq_wfp_reg <= irq_wfp_reg_s;
669 irq_wfp_reg <= irq_wfp_reg_s;
670 END IF;
670 END IF;
671 END PROCESS;
671 END PROCESS;
672
672
673 all_irq_wfp : FOR I IN IRQ_WFP_SIZE-1 DOWNTO 0 GENERATE
673 all_irq_wfp : FOR I IN IRQ_WFP_SIZE-1 DOWNTO 0 GENERATE
674 irq_wfp(I) <= (NOT irq_wfp_reg(I)) AND irq_wfp_reg_s(I);
674 irq_wfp(I) <= (NOT irq_wfp_reg(I)) AND irq_wfp_reg_s(I);
675 END GENERATE all_irq_wfp;
675 END GENERATE all_irq_wfp;
676
676
677 irq_wfp_ZERO <= (OTHERS => '0');
677 irq_wfp_ZERO <= (OTHERS => '0');
678 ored_irq_wfp <= '0' WHEN irq_wfp = irq_wfp_ZERO ELSE '1';
678 ored_irq_wfp <= '0' WHEN irq_wfp = irq_wfp_ZERO ELSE '1';
679
679
680 run_ms <= reg_sp.config_ms_run;
680 run_ms <= reg_sp.config_ms_run;
681
681
682 -----------------------------------------------------------------------------
682 -----------------------------------------------------------------------------
683 --
683 --
684 -----------------------------------------------------------------------------
684 -----------------------------------------------------------------------------
685 lpp_apbreg_ms_pointer_f0 : lpp_apbreg_ms_pointer
685 lpp_apbreg_ms_pointer_f0 : lpp_apbreg_ms_pointer
686 PORT MAP (
686 PORT MAP (
687 clk => HCLK,
687 clk => HCLK,
688 rstn => HRESETn,
688 rstn => HRESETn,
689
689
690 run => '1',--reg_sp.config_ms_run,
690 run => '1',--reg_sp.config_ms_run,
691
691
692 reg0_status_ready_matrix => reg_sp.status_ready_matrix_f0_0,
692 reg0_status_ready_matrix => reg_sp.status_ready_matrix_f0_0,
693 reg0_ready_matrix => reg0_ready_matrix_f0,
693 reg0_ready_matrix => reg0_ready_matrix_f0,
694 reg0_addr_matrix => reg_sp.addr_matrix_f0_0, --reg0_addr_matrix_f0,
694 reg0_addr_matrix => reg_sp.addr_matrix_f0_0, --reg0_addr_matrix_f0,
695 reg0_matrix_time => reg_sp.time_matrix_f0_0, --reg0_matrix_time_f0,
695 reg0_matrix_time => reg_sp.time_matrix_f0_0, --reg0_matrix_time_f0,
696
696
697 reg1_status_ready_matrix => reg_sp.status_ready_matrix_f0_1,
697 reg1_status_ready_matrix => reg_sp.status_ready_matrix_f0_1,
698 reg1_ready_matrix => reg1_ready_matrix_f0,
698 reg1_ready_matrix => reg1_ready_matrix_f0,
699 reg1_addr_matrix => reg_sp.addr_matrix_f0_1, --reg1_addr_matrix_f0,
699 reg1_addr_matrix => reg_sp.addr_matrix_f0_1, --reg1_addr_matrix_f0,
700 reg1_matrix_time => reg_sp.time_matrix_f0_1, --reg1_matrix_time_f0,
700 reg1_matrix_time => reg_sp.time_matrix_f0_1, --reg1_matrix_time_f0,
701
701
702 ready_matrix => ready_matrix_f0,
702 ready_matrix => ready_matrix_f0,
703 status_ready_matrix => status_ready_matrix_f0,
703 status_ready_matrix => status_ready_matrix_f0,
704 addr_matrix => addr_matrix_f0,
704 addr_matrix => addr_matrix_f0,
705 matrix_time => matrix_time_f0);
705 matrix_time => matrix_time_f0);
706
706
707 lpp_apbreg_ms_pointer_f1 : lpp_apbreg_ms_pointer
707 lpp_apbreg_ms_pointer_f1 : lpp_apbreg_ms_pointer
708 PORT MAP (
708 PORT MAP (
709 clk => HCLK,
709 clk => HCLK,
710 rstn => HRESETn,
710 rstn => HRESETn,
711
711
712 run => '1',--reg_sp.config_ms_run,
712 run => '1',--reg_sp.config_ms_run,
713
713
714 reg0_status_ready_matrix => reg_sp.status_ready_matrix_f1_0,
714 reg0_status_ready_matrix => reg_sp.status_ready_matrix_f1_0,
715 reg0_ready_matrix => reg0_ready_matrix_f1,
715 reg0_ready_matrix => reg0_ready_matrix_f1,
716 reg0_addr_matrix => reg_sp.addr_matrix_f1_0, --reg0_addr_matrix_f1,
716 reg0_addr_matrix => reg_sp.addr_matrix_f1_0, --reg0_addr_matrix_f1,
717 reg0_matrix_time => reg_sp.time_matrix_f1_0, --reg0_matrix_time_f1,
717 reg0_matrix_time => reg_sp.time_matrix_f1_0, --reg0_matrix_time_f1,
718
718
719 reg1_status_ready_matrix => reg_sp.status_ready_matrix_f1_1,
719 reg1_status_ready_matrix => reg_sp.status_ready_matrix_f1_1,
720 reg1_ready_matrix => reg1_ready_matrix_f1,
720 reg1_ready_matrix => reg1_ready_matrix_f1,
721 reg1_addr_matrix => reg_sp.addr_matrix_f1_1, --reg1_addr_matrix_f1,
721 reg1_addr_matrix => reg_sp.addr_matrix_f1_1, --reg1_addr_matrix_f1,
722 reg1_matrix_time => reg_sp.time_matrix_f1_1, --reg1_matrix_time_f1,
722 reg1_matrix_time => reg_sp.time_matrix_f1_1, --reg1_matrix_time_f1,
723
723
724 ready_matrix => ready_matrix_f1,
724 ready_matrix => ready_matrix_f1,
725 status_ready_matrix => status_ready_matrix_f1,
725 status_ready_matrix => status_ready_matrix_f1,
726 addr_matrix => addr_matrix_f1,
726 addr_matrix => addr_matrix_f1,
727 matrix_time => matrix_time_f1);
727 matrix_time => matrix_time_f1);
728
728
729 lpp_apbreg_ms_pointer_f2 : lpp_apbreg_ms_pointer
729 lpp_apbreg_ms_pointer_f2 : lpp_apbreg_ms_pointer
730 PORT MAP (
730 PORT MAP (
731 clk => HCLK,
731 clk => HCLK,
732 rstn => HRESETn,
732 rstn => HRESETn,
733
733
734 run => '1',--reg_sp.config_ms_run,
734 run => '1',--reg_sp.config_ms_run,
735
735
736 reg0_status_ready_matrix => reg_sp.status_ready_matrix_f2_0,
736 reg0_status_ready_matrix => reg_sp.status_ready_matrix_f2_0,
737 reg0_ready_matrix => reg0_ready_matrix_f2,
737 reg0_ready_matrix => reg0_ready_matrix_f2,
738 reg0_addr_matrix => reg_sp.addr_matrix_f2_0, --reg0_addr_matrix_f2,
738 reg0_addr_matrix => reg_sp.addr_matrix_f2_0, --reg0_addr_matrix_f2,
739 reg0_matrix_time => reg_sp.time_matrix_f2_0, --reg0_matrix_time_f2,
739 reg0_matrix_time => reg_sp.time_matrix_f2_0, --reg0_matrix_time_f2,
740
740
741 reg1_status_ready_matrix => reg_sp.status_ready_matrix_f2_1,
741 reg1_status_ready_matrix => reg_sp.status_ready_matrix_f2_1,
742 reg1_ready_matrix => reg1_ready_matrix_f2,
742 reg1_ready_matrix => reg1_ready_matrix_f2,
743 reg1_addr_matrix => reg_sp.addr_matrix_f2_1, --reg1_addr_matrix_f2,
743 reg1_addr_matrix => reg_sp.addr_matrix_f2_1, --reg1_addr_matrix_f2,
744 reg1_matrix_time => reg_sp.time_matrix_f2_1, --reg1_matrix_time_f2,
744 reg1_matrix_time => reg_sp.time_matrix_f2_1, --reg1_matrix_time_f2,
745
745
746 ready_matrix => ready_matrix_f2,
746 ready_matrix => ready_matrix_f2,
747 status_ready_matrix => status_ready_matrix_f2,
747 status_ready_matrix => status_ready_matrix_f2,
748 addr_matrix => addr_matrix_f2,
748 addr_matrix => addr_matrix_f2,
749 matrix_time => matrix_time_f2);
749 matrix_time => matrix_time_f2);
750
750
751 -----------------------------------------------------------------------------
751 -----------------------------------------------------------------------------
752 all_wfp_pointer: FOR I IN 3 DOWNTO 0 GENERATE
752 all_wfp_pointer: FOR I IN 3 DOWNTO 0 GENERATE
753 lpp_apbreg_wfp_pointer_fi : lpp_apbreg_ms_pointer
753 lpp_apbreg_wfp_pointer_fi : lpp_apbreg_ms_pointer
754 PORT MAP (
754 PORT MAP (
755 clk => HCLK,
755 clk => HCLK,
756 rstn => HRESETn,
756 rstn => HRESETn,
757
757
758 run => '1',--reg_wp.run,
758 run => '1',--reg_wp.run,
759
759
760 reg0_status_ready_matrix => reg_wp.status_ready_buffer_f(2*I),
760 reg0_status_ready_matrix => reg_wp.status_ready_buffer_f(2*I),
761 reg0_ready_matrix => reg_ready_buffer_f(2*I),
761 reg0_ready_matrix => reg_ready_buffer_f(2*I),
762 reg0_addr_matrix => reg_wp.addr_buffer_f((2*I+1)*32-1 DOWNTO (2*I)*32),
762 reg0_addr_matrix => reg_wp.addr_buffer_f((2*I+1)*32-1 DOWNTO (2*I)*32),
763 reg0_matrix_time => reg_wp.time_buffer_f((2*I+1)*48-1 DOWNTO (2*I)*48),
763 reg0_matrix_time => reg_wp.time_buffer_f((2*I+1)*48-1 DOWNTO (2*I)*48),
764
764
765 reg1_status_ready_matrix => reg_wp.status_ready_buffer_f(2*I+1),
765 reg1_status_ready_matrix => reg_wp.status_ready_buffer_f(2*I+1),
766 reg1_ready_matrix => reg_ready_buffer_f(2*I+1),
766 reg1_ready_matrix => reg_ready_buffer_f(2*I+1),
767 reg1_addr_matrix => reg_wp.addr_buffer_f((2*I+2)*32-1 DOWNTO (2*I+1)*32),
767 reg1_addr_matrix => reg_wp.addr_buffer_f((2*I+2)*32-1 DOWNTO (2*I+1)*32),
768 reg1_matrix_time => reg_wp.time_buffer_f((2*I+2)*48-1 DOWNTO (2*I+1)*48),
768 reg1_matrix_time => reg_wp.time_buffer_f((2*I+2)*48-1 DOWNTO (2*I+1)*48),
769
769
770 ready_matrix => wfp_ready_buffer(I),
770 ready_matrix => wfp_ready_buffer(I),
771 status_ready_matrix => wfp_status_buffer_ready(I),
771 status_ready_matrix => wfp_status_buffer_ready(I),
772 addr_matrix => wfp_addr_buffer((I+1)*32-1 DOWNTO I*32),
772 addr_matrix => wfp_addr_buffer((I+1)*32-1 DOWNTO I*32),
773 matrix_time => wfp_buffer_time((I+1)*48-1 DOWNTO I*48)
773 matrix_time => wfp_buffer_time((I+1)*48-1 DOWNTO I*48)
774 );
774 );
775
775
776 END GENERATE all_wfp_pointer;
776 END GENERATE all_wfp_pointer;
777 -----------------------------------------------------------------------------
777 -----------------------------------------------------------------------------
778
778
779 END beh;
779 END beh;
780
780
781 -------------------------------------------------------------------------------
781 ------------------------------------------------------------------------------- No newline at end of file
@@ -1,1174 +1,1207
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 -- TIME
32 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- todo
32 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- todo
33 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
33 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
34 --
34 --
35 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
35 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
36 sample_f0_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
36 sample_f0_wdata : IN STD_LOGIC_VECTOR((5*16)-1 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 --
40 --
41 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
41 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
42 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
42 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
43
43
44 ---------------------------------------------------------------------------
44 ---------------------------------------------------------------------------
45 -- DMA
45 -- DMA
46 ---------------------------------------------------------------------------
46 ---------------------------------------------------------------------------
47 dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
47 dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
48 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
48 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
49 dma_fifo_ren : IN STD_LOGIC; --TODO
49 dma_fifo_ren : IN STD_LOGIC; --TODO
50 dma_buffer_new : OUT STD_LOGIC; --TODOx
50 dma_buffer_new : OUT STD_LOGIC; --TODOx
51 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
51 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
52 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
52 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
53 dma_buffer_full : IN STD_LOGIC; --TODO
53 dma_buffer_full : IN STD_LOGIC; --TODO
54 dma_buffer_full_err : IN STD_LOGIC; --TODO
54 dma_buffer_full_err : IN STD_LOGIC; --TODO
55
55
56 -- Reg out
56 -- Reg out
57 ready_matrix_f0 : OUT STD_LOGIC; -- TODO
57 ready_matrix_f0 : OUT STD_LOGIC; -- TODO
58 ready_matrix_f1 : OUT STD_LOGIC; -- TODO
58 ready_matrix_f1 : OUT STD_LOGIC; -- TODO
59 ready_matrix_f2 : OUT STD_LOGIC; -- TODO
59 ready_matrix_f2 : OUT STD_LOGIC; -- TODO
60 -- error_bad_component_error : OUT STD_LOGIC; -- TODO
60 -- error_bad_component_error : OUT STD_LOGIC; -- TODO
61 error_buffer_full : OUT STD_LOGIC; -- TODO
61 error_buffer_full : OUT STD_LOGIC; -- TODO
62 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
62 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
63
63
64 -- Reg In
64 -- Reg In
65 status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
65 status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
66 status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
66 status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
67 status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
67 status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
68
68
69 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
69 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
70 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
70 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
71 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
71 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
72
72
73 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
73 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
74 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
74 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
75 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
75 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
76
76
77 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
77 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
78 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
78 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
79 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0) -- TODO
79 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0) -- TODO
80
80
81 );
81 );
82 END;
82 END;
83
83
84 ARCHITECTURE Behavioral OF lpp_lfr_ms IS
84 ARCHITECTURE Behavioral OF lpp_lfr_ms IS
85
85
86 SIGNAL sample_f0_A_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
86 SIGNAL sample_f0_A_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
87 SIGNAL sample_f0_A_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
87 SIGNAL sample_f0_A_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
88 SIGNAL sample_f0_A_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
88 SIGNAL sample_f0_A_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
89 SIGNAL sample_f0_A_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
89 SIGNAL sample_f0_A_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
90 SIGNAL sample_f0_A_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
90 SIGNAL sample_f0_A_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
91
91
92 SIGNAL sample_f0_B_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
92 SIGNAL sample_f0_B_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
93 SIGNAL sample_f0_B_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
93 SIGNAL sample_f0_B_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
94 SIGNAL sample_f0_B_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
94 SIGNAL sample_f0_B_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
95 SIGNAL sample_f0_B_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
95 SIGNAL sample_f0_B_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
96 SIGNAL sample_f0_B_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
96 SIGNAL sample_f0_B_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
97
97
98 SIGNAL sample_f1_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
98 SIGNAL sample_f1_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
99 SIGNAL sample_f1_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
99 SIGNAL sample_f1_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
100 SIGNAL sample_f1_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
100 SIGNAL sample_f1_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
101 SIGNAL sample_f1_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
101 SIGNAL sample_f1_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
102
102
103 SIGNAL sample_f1_almost_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
103 SIGNAL sample_f1_almost_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
104
104
105 SIGNAL sample_f2_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
105 SIGNAL sample_f2_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
106 SIGNAL sample_f2_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
106 SIGNAL sample_f2_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
107 SIGNAL sample_f2_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
107 SIGNAL sample_f2_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
108 SIGNAL sample_f2_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
108 SIGNAL sample_f2_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
109
109
110 SIGNAL error_wen_f0 : STD_LOGIC;
110 SIGNAL error_wen_f0 : STD_LOGIC;
111 SIGNAL error_wen_f1 : STD_LOGIC;
111 SIGNAL error_wen_f1 : STD_LOGIC;
112 SIGNAL error_wen_f2 : STD_LOGIC;
112 SIGNAL error_wen_f2 : STD_LOGIC;
113
113
114 SIGNAL one_sample_f1_full : STD_LOGIC;
114 SIGNAL one_sample_f1_full : STD_LOGIC;
115 SIGNAL one_sample_f1_wen : STD_LOGIC;
115 SIGNAL one_sample_f1_wen : STD_LOGIC;
116 SIGNAL one_sample_f2_full : STD_LOGIC;
116 SIGNAL one_sample_f2_full : STD_LOGIC;
117 SIGNAL one_sample_f2_wen : STD_LOGIC;
117 SIGNAL one_sample_f2_wen : STD_LOGIC;
118
118
119 -----------------------------------------------------------------------------
119 -----------------------------------------------------------------------------
120 -- FSM / SWITCH SELECT CHANNEL
120 -- FSM / SWITCH SELECT CHANNEL
121 -----------------------------------------------------------------------------
121 -----------------------------------------------------------------------------
122 TYPE fsm_select_channel IS (IDLE, SWITCH_F0_A, SWITCH_F0_B, SWITCH_F1, SWITCH_F2);
122 TYPE fsm_select_channel IS (IDLE, SWITCH_F0_A, SWITCH_F0_B, SWITCH_F1, SWITCH_F2);
123 SIGNAL state_fsm_select_channel : fsm_select_channel;
123 SIGNAL state_fsm_select_channel : fsm_select_channel;
124 SIGNAL pre_state_fsm_select_channel : fsm_select_channel;
124 -- SIGNAL pre_state_fsm_select_channel : fsm_select_channel;
125
125 SIGNAL select_channel : STD_LOGIC_VECTOR(1 DOWNTO 0);
126 SIGNAL select_channel_reg : STD_LOGIC_VECTOR(1 DOWNTO 0);
127
126 SIGNAL sample_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
128 SIGNAL sample_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
127 SIGNAL sample_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
129 SIGNAL sample_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
128 SIGNAL sample_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
130 SIGNAL sample_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
129 SIGNAL sample_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
131 SIGNAL sample_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
130
132
131 -----------------------------------------------------------------------------
133 -----------------------------------------------------------------------------
132 -- FSM LOAD FFT
134 -- FSM LOAD FFT
133 -----------------------------------------------------------------------------
135 -----------------------------------------------------------------------------
134 TYPE fsm_load_FFT IS (IDLE, FIFO_1, FIFO_2, FIFO_3, FIFO_4, FIFO_5);
136 TYPE fsm_load_FFT IS (IDLE, FIFO_1, FIFO_2, FIFO_3, FIFO_4, FIFO_5);
135 SIGNAL state_fsm_load_FFT : fsm_load_FFT;
137 SIGNAL state_fsm_load_FFT : fsm_load_FFT;
136 SIGNAL next_state_fsm_load_FFT : fsm_load_FFT;
138 -- SIGNAL next_state_fsm_load_FFT : fsm_load_FFT;
139 SIGNAL select_fifo : STD_LOGIC_VECTOR(2 DOWNTO 0);
140 SIGNAL select_fifo_reg : STD_LOGIC_VECTOR(2 DOWNTO 0);
137
141
138 SIGNAL sample_ren_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
142 SIGNAL sample_ren_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
139 SIGNAL sample_load : STD_LOGIC;
143 SIGNAL sample_load : STD_LOGIC;
140 SIGNAL sample_valid : STD_LOGIC;
144 SIGNAL sample_valid : STD_LOGIC;
141 SIGNAL sample_valid_r : STD_LOGIC;
145 SIGNAL sample_valid_r : STD_LOGIC;
142 SIGNAL sample_data : STD_LOGIC_VECTOR(15 DOWNTO 0);
146 SIGNAL sample_data : STD_LOGIC_VECTOR(15 DOWNTO 0);
143
147
144
148
145 -----------------------------------------------------------------------------
149 -----------------------------------------------------------------------------
146 -- FFT
150 -- FFT
147 -----------------------------------------------------------------------------
151 -----------------------------------------------------------------------------
148 SIGNAL fft_read : STD_LOGIC;
152 SIGNAL fft_read : STD_LOGIC;
149 SIGNAL fft_pong : STD_LOGIC;
153 SIGNAL fft_pong : STD_LOGIC;
150 SIGNAL fft_data_im : STD_LOGIC_VECTOR(15 DOWNTO 0);
154 SIGNAL fft_data_im : STD_LOGIC_VECTOR(15 DOWNTO 0);
151 SIGNAL fft_data_re : STD_LOGIC_VECTOR(15 DOWNTO 0);
155 SIGNAL fft_data_re : STD_LOGIC_VECTOR(15 DOWNTO 0);
152 SIGNAL fft_data_valid : STD_LOGIC;
156 SIGNAL fft_data_valid : STD_LOGIC;
153 SIGNAL fft_ready : STD_LOGIC;
157 SIGNAL fft_ready : STD_LOGIC;
154 -----------------------------------------------------------------------------
158 -----------------------------------------------------------------------------
155 -- SIGNAL fft_linker_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
159 -- SIGNAL fft_linker_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
156 -----------------------------------------------------------------------------
160 -----------------------------------------------------------------------------
157 TYPE fsm_load_MS_memory IS (IDLE, LOAD_FIFO, TRASH_FFT);
161 TYPE fsm_load_MS_memory IS (IDLE, LOAD_FIFO, TRASH_FFT);
158 SIGNAL state_fsm_load_MS_memory : fsm_load_MS_memory;
162 SIGNAL state_fsm_load_MS_memory : fsm_load_MS_memory;
159 SIGNAL current_fifo_load : STD_LOGIC_VECTOR(4 DOWNTO 0);
163 SIGNAL current_fifo_load : STD_LOGIC_VECTOR(4 DOWNTO 0);
160 SIGNAL current_fifo_empty : STD_LOGIC;
164 SIGNAL current_fifo_empty : STD_LOGIC;
161 SIGNAL current_fifo_locked : STD_LOGIC;
165 SIGNAL current_fifo_locked : STD_LOGIC;
162 SIGNAL current_fifo_full : STD_LOGIC;
166 SIGNAL current_fifo_full : STD_LOGIC;
163 SIGNAL MEM_IN_SM_locked : STD_LOGIC_VECTOR(4 DOWNTO 0);
167 SIGNAL MEM_IN_SM_locked : STD_LOGIC_VECTOR(4 DOWNTO 0);
164
168
165 -----------------------------------------------------------------------------
169 -----------------------------------------------------------------------------
166 SIGNAL MEM_IN_SM_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
170 SIGNAL MEM_IN_SM_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
167 SIGNAL MEM_IN_SM_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
171 SIGNAL MEM_IN_SM_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
168 SIGNAL MEM_IN_SM_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
172 SIGNAL MEM_IN_SM_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
169 SIGNAL MEM_IN_SM_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
173 SIGNAL MEM_IN_SM_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
170 SIGNAL MEM_IN_SM_wData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
174 SIGNAL MEM_IN_SM_wData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
171 SIGNAL MEM_IN_SM_rData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
175 SIGNAL MEM_IN_SM_rData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
172 SIGNAL MEM_IN_SM_Full : STD_LOGIC_VECTOR(4 DOWNTO 0);
176 SIGNAL MEM_IN_SM_Full : STD_LOGIC_VECTOR(4 DOWNTO 0);
173 SIGNAL MEM_IN_SM_Empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
177 SIGNAL MEM_IN_SM_Empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
174 -----------------------------------------------------------------------------
178 -----------------------------------------------------------------------------
175 SIGNAL SM_in_data : STD_LOGIC_VECTOR(32*2-1 DOWNTO 0);
179 SIGNAL SM_in_data : STD_LOGIC_VECTOR(32*2-1 DOWNTO 0);
176 SIGNAL SM_in_ren : STD_LOGIC_VECTOR(1 DOWNTO 0);
180 SIGNAL SM_in_ren : STD_LOGIC_VECTOR(1 DOWNTO 0);
177 SIGNAL SM_in_empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
181 SIGNAL SM_in_empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
178
182
179 SIGNAL SM_correlation_start : STD_LOGIC;
183 SIGNAL SM_correlation_start : STD_LOGIC;
180 SIGNAL SM_correlation_auto : STD_LOGIC;
184 SIGNAL SM_correlation_auto : STD_LOGIC;
181 SIGNAL SM_correlation_done : STD_LOGIC;
185 SIGNAL SM_correlation_done : STD_LOGIC;
182 SIGNAL SM_correlation_done_reg1 : STD_LOGIC;
186 SIGNAL SM_correlation_done_reg1 : STD_LOGIC;
183 SIGNAL SM_correlation_done_reg2 : STD_LOGIC;
187 SIGNAL SM_correlation_done_reg2 : STD_LOGIC;
184 SIGNAL SM_correlation_done_reg3 : STD_LOGIC;
188 SIGNAL SM_correlation_done_reg3 : STD_LOGIC;
185 SIGNAL SM_correlation_begin : STD_LOGIC;
189 SIGNAL SM_correlation_begin : STD_LOGIC;
186
190
187 SIGNAL MEM_OUT_SM_Full_s : STD_LOGIC;
191 SIGNAL MEM_OUT_SM_Full_s : STD_LOGIC;
188 SIGNAL MEM_OUT_SM_Data_in_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
192 SIGNAL MEM_OUT_SM_Data_in_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
189 SIGNAL MEM_OUT_SM_Write_s : STD_LOGIC;
193 SIGNAL MEM_OUT_SM_Write_s : STD_LOGIC;
190
194
191 SIGNAL current_matrix_write : STD_LOGIC;
195 SIGNAL current_matrix_write : STD_LOGIC;
192 SIGNAL current_matrix_wait_empty : STD_LOGIC;
196 SIGNAL current_matrix_wait_empty : STD_LOGIC;
193 -----------------------------------------------------------------------------
197 -----------------------------------------------------------------------------
194 SIGNAL fifo_0_ready : STD_LOGIC;
198 SIGNAL fifo_0_ready : STD_LOGIC;
195 SIGNAL fifo_1_ready : STD_LOGIC;
199 SIGNAL fifo_1_ready : STD_LOGIC;
196 SIGNAL fifo_ongoing : STD_LOGIC;
200 SIGNAL fifo_ongoing : STD_LOGIC;
197
201
198 SIGNAL FSM_DMA_fifo_ren : STD_LOGIC;
202 SIGNAL FSM_DMA_fifo_ren : STD_LOGIC;
199 SIGNAL FSM_DMA_fifo_empty : STD_LOGIC;
203 SIGNAL FSM_DMA_fifo_empty : STD_LOGIC;
200 SIGNAL FSM_DMA_fifo_empty_threshold : STD_LOGIC;
204 SIGNAL FSM_DMA_fifo_empty_threshold : STD_LOGIC;
201 SIGNAL FSM_DMA_fifo_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
205 SIGNAL FSM_DMA_fifo_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
202 SIGNAL FSM_DMA_fifo_status : STD_LOGIC_VECTOR(53 DOWNTO 0);
206 SIGNAL FSM_DMA_fifo_status : STD_LOGIC_VECTOR(53 DOWNTO 4);
203 -----------------------------------------------------------------------------
207 -----------------------------------------------------------------------------
204 SIGNAL MEM_OUT_SM_Write : STD_LOGIC_VECTOR(1 DOWNTO 0);
208 SIGNAL MEM_OUT_SM_Write : STD_LOGIC_VECTOR(1 DOWNTO 0);
205 SIGNAL MEM_OUT_SM_Read : STD_LOGIC_VECTOR(1 DOWNTO 0);
209 SIGNAL MEM_OUT_SM_Read : STD_LOGIC_VECTOR(1 DOWNTO 0);
206 SIGNAL MEM_OUT_SM_Data_in : STD_LOGIC_VECTOR(63 DOWNTO 0);
210 SIGNAL MEM_OUT_SM_Data_in : STD_LOGIC_VECTOR(63 DOWNTO 0);
207 SIGNAL MEM_OUT_SM_Data_out : STD_LOGIC_VECTOR(63 DOWNTO 0);
211 SIGNAL MEM_OUT_SM_Data_out : STD_LOGIC_VECTOR(63 DOWNTO 0);
208 SIGNAL MEM_OUT_SM_Full : STD_LOGIC_VECTOR(1 DOWNTO 0);
212 SIGNAL MEM_OUT_SM_Full : STD_LOGIC_VECTOR(1 DOWNTO 0);
209 SIGNAL MEM_OUT_SM_Empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
213 SIGNAL MEM_OUT_SM_Empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
210 SIGNAL MEM_OUT_SM_Empty_Threshold : STD_LOGIC_VECTOR(1 DOWNTO 0);
214 SIGNAL MEM_OUT_SM_Empty_Threshold : STD_LOGIC_VECTOR(1 DOWNTO 0);
211
215
212 -----------------------------------------------------------------------------
216 -----------------------------------------------------------------------------
213 -- TIME REG & INFOs
217 -- TIME REG & INFOs
214 -----------------------------------------------------------------------------
218 -----------------------------------------------------------------------------
215 SIGNAL all_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
219 SIGNAL all_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
216
220
217 SIGNAL f_empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
221 SIGNAL f_empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
218 SIGNAL f_empty_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
222 SIGNAL f_empty_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
219 SIGNAL time_update_f : STD_LOGIC_VECTOR(3 DOWNTO 0);
223 SIGNAL time_update_f : STD_LOGIC_VECTOR(3 DOWNTO 0);
220 SIGNAL time_reg_f : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
224 SIGNAL time_reg_f : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
221
225
222 SIGNAL time_reg_f0_A : STD_LOGIC_VECTOR(47 DOWNTO 0);
226 SIGNAL time_reg_f0_A : STD_LOGIC_VECTOR(47 DOWNTO 0);
223 SIGNAL time_reg_f0_B : STD_LOGIC_VECTOR(47 DOWNTO 0);
227 SIGNAL time_reg_f0_B : STD_LOGIC_VECTOR(47 DOWNTO 0);
224 SIGNAL time_reg_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
228 SIGNAL time_reg_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
225 SIGNAL time_reg_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
229 SIGNAL time_reg_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
226
230
227 --SIGNAL time_update_f0_A : STD_LOGIC;
231 --SIGNAL time_update_f0_A : STD_LOGIC;
228 --SIGNAL time_update_f0_B : STD_LOGIC;
232 --SIGNAL time_update_f0_B : STD_LOGIC;
229 --SIGNAL time_update_f1 : STD_LOGIC;
233 --SIGNAL time_update_f1 : STD_LOGIC;
230 --SIGNAL time_update_f2 : STD_LOGIC;
234 --SIGNAL time_update_f2 : STD_LOGIC;
231 --
235 --
232 SIGNAL status_channel : STD_LOGIC_VECTOR(49 DOWNTO 0);
236 SIGNAL status_channel : STD_LOGIC_VECTOR(49 DOWNTO 0);
233 SIGNAL status_MS_input : STD_LOGIC_VECTOR(49 DOWNTO 0);
237 SIGNAL status_MS_input : STD_LOGIC_VECTOR(49 DOWNTO 0);
234 SIGNAL status_component : STD_LOGIC_VECTOR(53 DOWNTO 0);
238 SIGNAL status_component : STD_LOGIC_VECTOR(53 DOWNTO 0);
235
239
236 SIGNAL status_component_fifo_0 : STD_LOGIC_VECTOR(53 DOWNTO 0);
240 SIGNAL status_component_fifo_0 : STD_LOGIC_VECTOR(53 DOWNTO 4);
237 SIGNAL status_component_fifo_1 : STD_LOGIC_VECTOR(53 DOWNTO 0);
241 SIGNAL status_component_fifo_1 : STD_LOGIC_VECTOR(53 DOWNTO 4);
238 SIGNAL status_component_fifo_0_end : STD_LOGIC;
242 SIGNAL status_component_fifo_0_end : STD_LOGIC;
239 SIGNAL status_component_fifo_1_end : STD_LOGIC;
243 SIGNAL status_component_fifo_1_end : STD_LOGIC;
240 -----------------------------------------------------------------------------
244 -----------------------------------------------------------------------------
241 SIGNAL fft_ongoing_counter : STD_LOGIC;--_VECTOR(1 DOWNTO 0);
245 SIGNAL fft_ongoing_counter : STD_LOGIC;--_VECTOR(1 DOWNTO 0);
242
246
243 SIGNAL fft_ready_reg : STD_LOGIC;
247 SIGNAL fft_ready_reg : STD_LOGIC;
244 SIGNAL fft_ready_rising_down : STD_LOGIC;
248 SIGNAL fft_ready_rising_down : STD_LOGIC;
245
249
246 SIGNAL sample_load_reg : STD_LOGIC;
250 SIGNAL sample_load_reg : STD_LOGIC;
247 SIGNAL sample_load_rising_down : STD_LOGIC;
251 SIGNAL sample_load_rising_down : STD_LOGIC;
248
252
249 -----------------------------------------------------------------------------
253 -----------------------------------------------------------------------------
250 SIGNAL sample_f1_wen_head : STD_LOGIC_VECTOR(4 DOWNTO 0);
254 SIGNAL sample_f1_wen_head : STD_LOGIC_VECTOR(4 DOWNTO 0);
251 SIGNAL sample_f1_wen_head_in : STD_LOGIC;
255 SIGNAL sample_f1_wen_head_in : STD_LOGIC;
252 SIGNAL sample_f1_wen_head_out : STD_LOGIC;
256 SIGNAL sample_f1_wen_head_out : STD_LOGIC;
253 SIGNAL sample_f1_full_head_in : STD_LOGIC;
257 SIGNAL sample_f1_full_head_in : STD_LOGIC;
254 SIGNAL sample_f1_full_head_out : STD_LOGIC;
258 SIGNAL sample_f1_full_head_out : STD_LOGIC;
255 SIGNAL sample_f1_empty_head_in : STD_LOGIC;
259 SIGNAL sample_f1_empty_head_in : STD_LOGIC;
256
260
257 SIGNAL sample_f1_wdata_head : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
261 SIGNAL sample_f1_wdata_head : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
258 -----------------------------------------------------------------------------
262 -----------------------------------------------------------------------------
259 SIGNAL sample_f0_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
263 SIGNAL sample_f0_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
260 SIGNAL sample_f1_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
264 SIGNAL sample_f1_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
261 SIGNAL sample_f2_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
265 SIGNAL sample_f2_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
262 SIGNAL ongoing : STD_LOGIC;
266 SIGNAL ongoing : STD_LOGIC;
263
267
264 BEGIN
268 BEGIN
265
269
266 PROCESS (clk, rstn)
270 PROCESS (clk, rstn)
267 BEGIN -- PROCESS
271 BEGIN -- PROCESS
268 IF rstn = '0' THEN -- asynchronous reset (active low)
272 IF rstn = '0' THEN -- asynchronous reset (active low)
269 sample_f0_wen_s <= (OTHERS => '1');
273 sample_f0_wen_s <= (OTHERS => '1');
270 sample_f1_wen_s <= (OTHERS => '1');
274 sample_f1_wen_s <= (OTHERS => '1');
271 sample_f2_wen_s <= (OTHERS => '1');
275 sample_f2_wen_s <= (OTHERS => '1');
272 ongoing <= '0';
276 ongoing <= '0';
273 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
277 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
274 IF ongoing = '1' THEN
278 IF ongoing = '1' THEN
275 sample_f0_wen_s <= sample_f0_wen;
279 sample_f0_wen_s <= sample_f0_wen;
276 sample_f1_wen_s <= sample_f1_wen;
280 sample_f1_wen_s <= sample_f1_wen;
277 sample_f2_wen_s <= sample_f2_wen;
281 sample_f2_wen_s <= sample_f2_wen;
278 ELSE
282 ELSE
279 IF start_date = coarse_time(30 DOWNTO 0) THEN
283 IF start_date = coarse_time(30 DOWNTO 0) THEN
280 ongoing <= '1';
284 ongoing <= '1';
281 END IF;
285 END IF;
282 sample_f0_wen_s <= (OTHERS => '1');
286 sample_f0_wen_s <= (OTHERS => '1');
283 sample_f1_wen_s <= (OTHERS => '1');
287 sample_f1_wen_s <= (OTHERS => '1');
284 sample_f2_wen_s <= (OTHERS => '1');
288 sample_f2_wen_s <= (OTHERS => '1');
285 END IF;
289 END IF;
286 END IF;
290 END IF;
287 END PROCESS;
291 END PROCESS;
288
292
289
293
290 error_input_fifo_write <= error_wen_f2 & error_wen_f1 & error_wen_f0;
294 error_input_fifo_write <= error_wen_f2 & error_wen_f1 & error_wen_f0;
291
295
292
296
293 switch_f0_inst : spectral_matrix_switch_f0
297 switch_f0_inst : spectral_matrix_switch_f0
294 PORT MAP (
298 PORT MAP (
295 clk => clk,
299 clk => clk,
296 rstn => rstn,
300 rstn => rstn,
297
301
298 sample_wen => sample_f0_wen_s,
302 sample_wen => sample_f0_wen_s,
299
303
300 fifo_A_empty => sample_f0_A_empty,
304 fifo_A_empty => sample_f0_A_empty,
301 fifo_A_full => sample_f0_A_full,
305 fifo_A_full => sample_f0_A_full,
302 fifo_A_wen => sample_f0_A_wen,
306 fifo_A_wen => sample_f0_A_wen,
303
307
304 fifo_B_empty => sample_f0_B_empty,
308 fifo_B_empty => sample_f0_B_empty,
305 fifo_B_full => sample_f0_B_full,
309 fifo_B_full => sample_f0_B_full,
306 fifo_B_wen => sample_f0_B_wen,
310 fifo_B_wen => sample_f0_B_wen,
307
311
308 error_wen => error_wen_f0); -- TODO
312 error_wen => error_wen_f0); -- TODO
309
313
310 -----------------------------------------------------------------------------
314 -----------------------------------------------------------------------------
311 -- FIFO IN
315 -- FIFO IN
312 -----------------------------------------------------------------------------
316 -----------------------------------------------------------------------------
313 lppFIFOxN_f0_a : lppFIFOxN
317 lppFIFOxN_f0_a : lppFIFOxN
314 GENERIC MAP (
318 GENERIC MAP (
315 tech => 0,
319 tech => 0,
316 Mem_use => Mem_use,
320 Mem_use => Mem_use,
317 Data_sz => 16,
321 Data_sz => 16,
318 Addr_sz => 8,
322 Addr_sz => 8,
319 FifoCnt => 5)
323 FifoCnt => 5)
320 PORT MAP (
324 PORT MAP (
321 clk => clk,
325 clk => clk,
322 rstn => rstn,
326 rstn => rstn,
323
327
324 ReUse => (OTHERS => '0'),
328 ReUse => (OTHERS => '0'),
325
329
326 run => (OTHERS => '1'),
330 run => (OTHERS => '1'),
327
331
328 wen => sample_f0_A_wen,
332 wen => sample_f0_A_wen,
329 wdata => sample_f0_wdata,
333 wdata => sample_f0_wdata,
330
334
331 ren => sample_f0_A_ren,
335 ren => sample_f0_A_ren,
332 rdata => sample_f0_A_rdata,
336 rdata => sample_f0_A_rdata,
333
337
334 empty => sample_f0_A_empty,
338 empty => sample_f0_A_empty,
335 full => sample_f0_A_full,
339 full => sample_f0_A_full,
336 almost_full => OPEN);
340 almost_full => OPEN);
337
341
338 lppFIFOxN_f0_b : lppFIFOxN
342 lppFIFOxN_f0_b : lppFIFOxN
339 GENERIC MAP (
343 GENERIC MAP (
340 tech => 0,
344 tech => 0,
341 Mem_use => Mem_use,
345 Mem_use => Mem_use,
342 Data_sz => 16,
346 Data_sz => 16,
343 Addr_sz => 8,
347 Addr_sz => 8,
344 FifoCnt => 5)
348 FifoCnt => 5)
345 PORT MAP (
349 PORT MAP (
346 clk => clk,
350 clk => clk,
347 rstn => rstn,
351 rstn => rstn,
348
352
349 ReUse => (OTHERS => '0'),
353 ReUse => (OTHERS => '0'),
350 run => (OTHERS => '1'),
354 run => (OTHERS => '1'),
351
355
352 wen => sample_f0_B_wen,
356 wen => sample_f0_B_wen,
353 wdata => sample_f0_wdata,
357 wdata => sample_f0_wdata,
354 ren => sample_f0_B_ren,
358 ren => sample_f0_B_ren,
355 rdata => sample_f0_B_rdata,
359 rdata => sample_f0_B_rdata,
356 empty => sample_f0_B_empty,
360 empty => sample_f0_B_empty,
357 full => sample_f0_B_full,
361 full => sample_f0_B_full,
358 almost_full => OPEN);
362 almost_full => OPEN);
359
363
360 -----------------------------------------------------------------------------
364 -----------------------------------------------------------------------------
361 -- sample_f1_wen in
365 -- sample_f1_wen in
362 -- sample_f1_wdata in
366 -- sample_f1_wdata in
363 -- sample_f1_full OUT
367 -- sample_f1_full OUT
364
368
365 sample_f1_wen_head_in <= '0' WHEN sample_f1_wen_s = "00000" ELSE '1';
369 sample_f1_wen_head_in <= '0' WHEN sample_f1_wen_s = "00000" ELSE '1';
366 sample_f1_full_head_in <= '0' WHEN sample_f1_full = "00000" ELSE '1';
370 sample_f1_full_head_in <= '0' WHEN sample_f1_full = "00000" ELSE '1';
367 sample_f1_empty_head_in <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
371 sample_f1_empty_head_in <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
368
372
369 lpp_lfr_ms_reg_head_1:lpp_lfr_ms_reg_head
373 lpp_lfr_ms_reg_head_1:lpp_lfr_ms_reg_head
370 PORT MAP (
374 PORT MAP (
371 clk => clk,
375 clk => clk,
372 rstn => rstn,
376 rstn => rstn,
373 in_wen => sample_f1_wen_head_in,
377 in_wen => sample_f1_wen_head_in,
374 in_data => sample_f1_wdata,
378 in_data => sample_f1_wdata,
375 in_full => sample_f1_full_head_in,
379 in_full => sample_f1_full_head_in,
376 in_empty => sample_f1_empty_head_in,
380 in_empty => sample_f1_empty_head_in,
377 out_wen => sample_f1_wen_head_out,
381 out_wen => sample_f1_wen_head_out,
378 out_data => sample_f1_wdata_head,
382 out_data => sample_f1_wdata_head,
379 out_full => sample_f1_full_head_out);
383 out_full => sample_f1_full_head_out);
380
384
381 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;
385 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;
382
386
383
387
384 lppFIFOxN_f1 : lppFIFOxN
388 lppFIFOxN_f1 : lppFIFOxN
385 GENERIC MAP (
389 GENERIC MAP (
386 tech => 0,
390 tech => 0,
387 Mem_use => Mem_use,
391 Mem_use => Mem_use,
388 Data_sz => 16,
392 Data_sz => 16,
389 Addr_sz => 8,
393 Addr_sz => 8,
390 FifoCnt => 5)
394 FifoCnt => 5)
391 PORT MAP (
395 PORT MAP (
392 clk => clk,
396 clk => clk,
393 rstn => rstn,
397 rstn => rstn,
394
398
395 ReUse => (OTHERS => '0'),
399 ReUse => (OTHERS => '0'),
396 run => (OTHERS => '1'),
400 run => (OTHERS => '1'),
397
401
398 wen => sample_f1_wen_head,
402 wen => sample_f1_wen_head,
399 wdata => sample_f1_wdata_head,
403 wdata => sample_f1_wdata_head,
400 ren => sample_f1_ren,
404 ren => sample_f1_ren,
401 rdata => sample_f1_rdata,
405 rdata => sample_f1_rdata,
402 empty => sample_f1_empty,
406 empty => sample_f1_empty,
403 full => sample_f1_full,
407 full => sample_f1_full,
404 almost_full => sample_f1_almost_full);
408 almost_full => sample_f1_almost_full);
405
409
406
410
407 one_sample_f1_wen <= '0' WHEN sample_f1_wen_s = "11111" ELSE '1';
411 one_sample_f1_wen <= '0' WHEN sample_f1_wen_s = "11111" ELSE '1';
408
412
409 PROCESS (clk, rstn)
413 PROCESS (clk, rstn)
410 BEGIN -- PROCESS
414 BEGIN -- PROCESS
411 IF rstn = '0' THEN -- asynchronous reset (active low)
415 IF rstn = '0' THEN -- asynchronous reset (active low)
412 one_sample_f1_full <= '0';
416 one_sample_f1_full <= '0';
413 error_wen_f1 <= '0';
417 error_wen_f1 <= '0';
414 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
418 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
415 IF sample_f1_full_head_out = '0' THEN
419 IF sample_f1_full_head_out = '0' THEN
416 one_sample_f1_full <= '0';
420 one_sample_f1_full <= '0';
417 ELSE
421 ELSE
418 one_sample_f1_full <= '1';
422 one_sample_f1_full <= '1';
419 END IF;
423 END IF;
420 error_wen_f1 <= one_sample_f1_wen AND one_sample_f1_full;
424 error_wen_f1 <= one_sample_f1_wen AND one_sample_f1_full;
421 END IF;
425 END IF;
422 END PROCESS;
426 END PROCESS;
423
427
424 -----------------------------------------------------------------------------
428 -----------------------------------------------------------------------------
425
429
426
430
427 lppFIFOxN_f2 : lppFIFOxN
431 lppFIFOxN_f2 : lppFIFOxN
428 GENERIC MAP (
432 GENERIC MAP (
429 tech => 0,
433 tech => 0,
430 Mem_use => Mem_use,
434 Mem_use => Mem_use,
431 Data_sz => 16,
435 Data_sz => 16,
432 Addr_sz => 8,
436 Addr_sz => 8,
433 FifoCnt => 5)
437 FifoCnt => 5)
434 PORT MAP (
438 PORT MAP (
435 clk => clk,
439 clk => clk,
436 rstn => rstn,
440 rstn => rstn,
437
441
438 ReUse => (OTHERS => '0'),
442 ReUse => (OTHERS => '0'),
439 run => (OTHERS => '1'),
443 run => (OTHERS => '1'),
440
444
441 wen => sample_f2_wen,
445 wen => sample_f2_wen,
442 wdata => sample_f2_wdata,
446 wdata => sample_f2_wdata,
443 ren => sample_f2_ren,
447 ren => sample_f2_ren,
444 rdata => sample_f2_rdata,
448 rdata => sample_f2_rdata,
445 empty => sample_f2_empty,
449 empty => sample_f2_empty,
446 full => sample_f2_full,
450 full => sample_f2_full,
447 almost_full => OPEN);
451 almost_full => OPEN);
448
452
449
453
450 one_sample_f2_wen <= '0' WHEN sample_f2_wen_s = "11111" ELSE '1';
454 one_sample_f2_wen <= '0' WHEN sample_f2_wen_s = "11111" ELSE '1';
451
455
452 PROCESS (clk, rstn)
456 PROCESS (clk, rstn)
453 BEGIN -- PROCESS
457 BEGIN -- PROCESS
454 IF rstn = '0' THEN -- asynchronous reset (active low)
458 IF rstn = '0' THEN -- asynchronous reset (active low)
455 one_sample_f2_full <= '0';
459 one_sample_f2_full <= '0';
456 error_wen_f2 <= '0';
460 error_wen_f2 <= '0';
457 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
461 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
458 IF sample_f2_full = "00000" THEN
462 IF sample_f2_full = "00000" THEN
459 one_sample_f2_full <= '0';
463 one_sample_f2_full <= '0';
460 ELSE
464 ELSE
461 one_sample_f2_full <= '1';
465 one_sample_f2_full <= '1';
462 END IF;
466 END IF;
463 error_wen_f2 <= one_sample_f2_wen AND one_sample_f2_full;
467 error_wen_f2 <= one_sample_f2_wen AND one_sample_f2_full;
464 END IF;
468 END IF;
465 END PROCESS;
469 END PROCESS;
466
470
467 -----------------------------------------------------------------------------
471 -----------------------------------------------------------------------------
468 -- FSM SELECT CHANNEL
472 -- FSM SELECT CHANNEL
469 -----------------------------------------------------------------------------
473 -----------------------------------------------------------------------------
470 PROCESS (clk, rstn)
474 PROCESS (clk, rstn)
471 BEGIN
475 BEGIN
472 IF rstn = '0' THEN
476 IF rstn = '0' THEN
473 state_fsm_select_channel <= IDLE;
477 state_fsm_select_channel <= IDLE;
478 select_channel <= (OTHERS => '0');
474 ELSIF clk'EVENT AND clk = '1' THEN
479 ELSIF clk'EVENT AND clk = '1' THEN
475 CASE state_fsm_select_channel IS
480 CASE state_fsm_select_channel IS
476 WHEN IDLE =>
481 WHEN IDLE =>
477 IF sample_f1_full = "11111" THEN
482 IF sample_f1_full = "11111" THEN
478 state_fsm_select_channel <= SWITCH_F1;
483 state_fsm_select_channel <= SWITCH_F1;
484 select_channel <= "10";
479 ELSIF sample_f1_almost_full = "00000" THEN
485 ELSIF sample_f1_almost_full = "00000" THEN
480 IF sample_f0_A_full = "11111" THEN
486 IF sample_f0_A_full = "11111" THEN
481 state_fsm_select_channel <= SWITCH_F0_A;
487 state_fsm_select_channel <= SWITCH_F0_A;
488 select_channel <= "00";
482 ELSIF sample_f0_B_full = "11111" THEN
489 ELSIF sample_f0_B_full = "11111" THEN
483 state_fsm_select_channel <= SWITCH_F0_B;
490 state_fsm_select_channel <= SWITCH_F0_B;
491 select_channel <= "01";
484 ELSIF sample_f2_full = "11111" THEN
492 ELSIF sample_f2_full = "11111" THEN
485 state_fsm_select_channel <= SWITCH_F2;
493 state_fsm_select_channel <= SWITCH_F2;
494 select_channel <= "11";
486 END IF;
495 END IF;
487 END IF;
496 END IF;
488
497
489 WHEN SWITCH_F0_A =>
498 WHEN SWITCH_F0_A =>
490 IF sample_f0_A_empty = "11111" THEN
499 IF sample_f0_A_empty = "11111" THEN
491 state_fsm_select_channel <= IDLE;
500 state_fsm_select_channel <= IDLE;
501 select_channel <= (OTHERS => '0');
492 END IF;
502 END IF;
493 WHEN SWITCH_F0_B =>
503 WHEN SWITCH_F0_B =>
494 IF sample_f0_B_empty = "11111" THEN
504 IF sample_f0_B_empty = "11111" THEN
495 state_fsm_select_channel <= IDLE;
505 state_fsm_select_channel <= IDLE;
506 select_channel <= (OTHERS => '0');
496 END IF;
507 END IF;
497 WHEN SWITCH_F1 =>
508 WHEN SWITCH_F1 =>
498 IF sample_f1_empty = "11111" THEN
509 IF sample_f1_empty = "11111" THEN
499 state_fsm_select_channel <= IDLE;
510 state_fsm_select_channel <= IDLE;
511 select_channel <= (OTHERS => '0');
500 END IF;
512 END IF;
501 WHEN SWITCH_F2 =>
513 WHEN SWITCH_F2 =>
502 IF sample_f2_empty = "11111" THEN
514 IF sample_f2_empty = "11111" THEN
503 state_fsm_select_channel <= IDLE;
515 state_fsm_select_channel <= IDLE;
516 select_channel <= (OTHERS => '0');
504 END IF;
517 END IF;
505 WHEN OTHERS => NULL;
518 WHEN OTHERS => NULL;
506 END CASE;
519 END CASE;
507
520
508 END IF;
521 END IF;
509 END PROCESS;
522 END PROCESS;
510
523
511 PROCESS (clk, rstn)
524 PROCESS (clk, rstn)
512 BEGIN
525 BEGIN
513 IF rstn = '0' THEN
526 IF rstn = '0' THEN
514 pre_state_fsm_select_channel <= IDLE;
527 select_channel_reg <= (OTHERS => '0');
528 --pre_state_fsm_select_channel <= IDLE;
515 ELSIF clk'EVENT AND clk = '1' THEN
529 ELSIF clk'EVENT AND clk = '1' THEN
516 pre_state_fsm_select_channel <= state_fsm_select_channel;
530 select_channel_reg <= select_channel;
531 --pre_state_fsm_select_channel <= state_fsm_select_channel;
517 END IF;
532 END IF;
518 END PROCESS;
533 END PROCESS;
519
534
520
535
521 -----------------------------------------------------------------------------
536 -----------------------------------------------------------------------------
522 -- SWITCH SELECT CHANNEL
537 -- SWITCH SELECT CHANNEL
523 -----------------------------------------------------------------------------
538 -----------------------------------------------------------------------------
524 sample_empty <= sample_f0_A_empty WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
539 sample_empty <= sample_f0_A_empty WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
525 sample_f0_B_empty WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
540 sample_f0_B_empty WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
526 sample_f1_empty WHEN state_fsm_select_channel = SWITCH_F1 ELSE
541 sample_f1_empty WHEN state_fsm_select_channel = SWITCH_F1 ELSE
527 sample_f2_empty WHEN state_fsm_select_channel = SWITCH_F2 ELSE
542 sample_f2_empty WHEN state_fsm_select_channel = SWITCH_F2 ELSE
528 (OTHERS => '1');
543 (OTHERS => '1');
529
544
530 sample_full <= sample_f0_A_full WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
545 sample_full <= sample_f0_A_full WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
531 sample_f0_B_full WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
546 sample_f0_B_full WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
532 sample_f1_full WHEN state_fsm_select_channel = SWITCH_F1 ELSE
547 sample_f1_full WHEN state_fsm_select_channel = SWITCH_F1 ELSE
533 sample_f2_full WHEN state_fsm_select_channel = SWITCH_F2 ELSE
548 sample_f2_full WHEN state_fsm_select_channel = SWITCH_F2 ELSE
534 (OTHERS => '0');
549 (OTHERS => '0');
535
550
536 sample_rdata <= sample_f0_A_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_A ELSE
551 --sample_rdata <= sample_f0_A_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_A ELSE
537 sample_f0_B_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_B ELSE
552 -- sample_f0_B_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_B ELSE
538 sample_f1_rdata WHEN pre_state_fsm_select_channel = SWITCH_F1 ELSE
553 -- sample_f1_rdata WHEN pre_state_fsm_select_channel = SWITCH_F1 ELSE
554 -- sample_f2_rdata; -- WHEN state_fsm_select_channel = SWITCH_F2 ELSE
555 sample_rdata <= sample_f0_A_rdata WHEN select_channel_reg = "00" ELSE
556 sample_f0_B_rdata WHEN select_channel_reg = "01" ELSE
557 sample_f1_rdata WHEN select_channel_reg = "10" ELSE
539 sample_f2_rdata; -- WHEN state_fsm_select_channel = SWITCH_F2 ELSE
558 sample_f2_rdata; -- WHEN state_fsm_select_channel = SWITCH_F2 ELSE
540
559
541
560
542 sample_f0_A_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_A ELSE (OTHERS => '1');
561 sample_f0_A_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_A ELSE (OTHERS => '1');
543 sample_f0_B_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_B ELSE (OTHERS => '1');
562 sample_f0_B_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_B ELSE (OTHERS => '1');
544 sample_f1_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F1 ELSE (OTHERS => '1');
563 sample_f1_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F1 ELSE (OTHERS => '1');
545 sample_f2_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F2 ELSE (OTHERS => '1');
564 sample_f2_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F2 ELSE (OTHERS => '1');
546
565
547
566
548 status_channel <= time_reg_f0_A & "00" WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
567 status_channel <= time_reg_f0_A & "00" WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
549 time_reg_f0_B & "00" WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
568 time_reg_f0_B & "00" WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
550 time_reg_f1 & "01" WHEN state_fsm_select_channel = SWITCH_F1 ELSE
569 time_reg_f1 & "01" WHEN state_fsm_select_channel = SWITCH_F1 ELSE
551 time_reg_f2 & "10"; -- WHEN state_fsm_select_channel = SWITCH_F2
570 time_reg_f2 & "10"; -- WHEN state_fsm_select_channel = SWITCH_F2
552
571
553 -----------------------------------------------------------------------------
572 -----------------------------------------------------------------------------
554 -- FSM LOAD FFT
573 -- FSM LOAD FFT
555 -----------------------------------------------------------------------------
574 -----------------------------------------------------------------------------
556
575
557 sample_ren <= (OTHERS => '1') WHEN fft_ongoing_counter = '1' ELSE
576 sample_ren <= (OTHERS => '1') WHEN fft_ongoing_counter = '1' ELSE
558 sample_ren_s WHEN sample_load = '1' ELSE
577 sample_ren_s WHEN sample_load = '1' ELSE
559 (OTHERS => '1');
578 (OTHERS => '1');
560
579
561 PROCESS (clk, rstn)
580 PROCESS (clk, rstn)
562 BEGIN
581 BEGIN
563 IF rstn = '0' THEN
582 IF rstn = '0' THEN
564 sample_ren_s <= (OTHERS => '1');
583 sample_ren_s <= (OTHERS => '1');
565 state_fsm_load_FFT <= IDLE;
584 state_fsm_load_FFT <= IDLE;
566 status_MS_input <= (OTHERS => '0');
585 status_MS_input <= (OTHERS => '0');
586 select_fifo <= "000";
567 --next_state_fsm_load_FFT <= IDLE;
587 --next_state_fsm_load_FFT <= IDLE;
568 --sample_valid <= '0';
588 --sample_valid <= '0';
569 ELSIF clk'EVENT AND clk = '1' THEN
589 ELSIF clk'EVENT AND clk = '1' THEN
570 CASE state_fsm_load_FFT IS
590 CASE state_fsm_load_FFT IS
571 WHEN IDLE =>
591 WHEN IDLE =>
572 --sample_valid <= '0';
592 --sample_valid <= '0';
573 sample_ren_s <= (OTHERS => '1');
593 sample_ren_s <= (OTHERS => '1');
574 IF sample_full = "11111" AND sample_load = '1' THEN
594 IF sample_full = "11111" AND sample_load = '1' THEN
575 state_fsm_load_FFT <= FIFO_1;
595 state_fsm_load_FFT <= FIFO_1;
576 status_MS_input <= status_channel;
596 status_MS_input <= status_channel;
597 select_fifo <= "000";
577 END IF;
598 END IF;
578
599
579 WHEN FIFO_1 =>
600 WHEN FIFO_1 =>
580 sample_ren_s <= "1111" & NOT(sample_load);
601 sample_ren_s <= "1111" & NOT(sample_load);
581 IF sample_empty(0) = '1' THEN
602 IF sample_empty(0) = '1' THEN
582 sample_ren_s <= (OTHERS => '1');
603 sample_ren_s <= (OTHERS => '1');
583 state_fsm_load_FFT <= FIFO_2;
604 state_fsm_load_FFT <= FIFO_2;
605 select_fifo <= "001";
584 END IF;
606 END IF;
585
607
586 WHEN FIFO_2 =>
608 WHEN FIFO_2 =>
587 sample_ren_s <= "111" & NOT(sample_load) & '1';
609 sample_ren_s <= "111" & NOT(sample_load) & '1';
588 IF sample_empty(1) = '1' THEN
610 IF sample_empty(1) = '1' THEN
589 sample_ren_s <= (OTHERS => '1');
611 sample_ren_s <= (OTHERS => '1');
590 state_fsm_load_FFT <= FIFO_3;
612 state_fsm_load_FFT <= FIFO_3;
613 select_fifo <= "010";
591 END IF;
614 END IF;
592
615
593 WHEN FIFO_3 =>
616 WHEN FIFO_3 =>
594 sample_ren_s <= "11" & NOT(sample_load) & "11";
617 sample_ren_s <= "11" & NOT(sample_load) & "11";
595 IF sample_empty(2) = '1' THEN
618 IF sample_empty(2) = '1' THEN
596 sample_ren_s <= (OTHERS => '1');
619 sample_ren_s <= (OTHERS => '1');
597 state_fsm_load_FFT <= FIFO_4;
620 state_fsm_load_FFT <= FIFO_4;
621 select_fifo <= "011";
598 END IF;
622 END IF;
599
623
600 WHEN FIFO_4 =>
624 WHEN FIFO_4 =>
601 sample_ren_s <= '1' & NOT(sample_load) & "111";
625 sample_ren_s <= '1' & NOT(sample_load) & "111";
602 IF sample_empty(3) = '1' THEN
626 IF sample_empty(3) = '1' THEN
603 sample_ren_s <= (OTHERS => '1');
627 sample_ren_s <= (OTHERS => '1');
604 state_fsm_load_FFT <= FIFO_5;
628 state_fsm_load_FFT <= FIFO_5;
629 select_fifo <= "100";
605 END IF;
630 END IF;
606
631
607 WHEN FIFO_5 =>
632 WHEN FIFO_5 =>
608 sample_ren_s <= NOT(sample_load) & "1111";
633 sample_ren_s <= NOT(sample_load) & "1111";
609 IF sample_empty(4) = '1' THEN
634 IF sample_empty(4) = '1' THEN
610 sample_ren_s <= (OTHERS => '1');
635 sample_ren_s <= (OTHERS => '1');
611 state_fsm_load_FFT <= IDLE;
636 state_fsm_load_FFT <= IDLE;
637 select_fifo <= "000";
612 END IF;
638 END IF;
613 WHEN OTHERS => NULL;
639 WHEN OTHERS => NULL;
614 END CASE;
640 END CASE;
615 END IF;
641 END IF;
616 END PROCESS;
642 END PROCESS;
617
643
618 PROCESS (clk, rstn)
644 PROCESS (clk, rstn)
619 BEGIN
645 BEGIN
620 IF rstn = '0' THEN
646 IF rstn = '0' THEN
621 sample_valid_r <= '0';
647 sample_valid_r <= '0';
622 next_state_fsm_load_FFT <= IDLE;
648 select_fifo_reg <= (OTHERS => '0');
649 --next_state_fsm_load_FFT <= IDLE;
623 ELSIF clk'EVENT AND clk = '1' THEN
650 ELSIF clk'EVENT AND clk = '1' THEN
624 next_state_fsm_load_FFT <= state_fsm_load_FFT;
651 select_fifo_reg <= select_fifo;
652 --next_state_fsm_load_FFT <= state_fsm_load_FFT;
625 IF sample_ren_s = "11111" THEN
653 IF sample_ren_s = "11111" THEN
626 sample_valid_r <= '0';
654 sample_valid_r <= '0';
627 ELSE
655 ELSE
628 sample_valid_r <= '1';
656 sample_valid_r <= '1';
629 END IF;
657 END IF;
630 END IF;
658 END IF;
631 END PROCESS;
659 END PROCESS;
632
660
633 sample_valid <= '0' WHEN fft_ongoing_counter = '1' ELSE sample_valid_r AND sample_load;
661 sample_valid <= '0' WHEN fft_ongoing_counter = '1' ELSE sample_valid_r AND sample_load;
634
662
635 sample_data <= sample_rdata(16*1-1 DOWNTO 16*0) WHEN next_state_fsm_load_FFT = FIFO_1 ELSE
663 --sample_data <= sample_rdata(16*1-1 DOWNTO 16*0) WHEN next_state_fsm_load_FFT = FIFO_1 ELSE
636 sample_rdata(16*2-1 DOWNTO 16*1) WHEN next_state_fsm_load_FFT = FIFO_2 ELSE
664 -- sample_rdata(16*2-1 DOWNTO 16*1) WHEN next_state_fsm_load_FFT = FIFO_2 ELSE
637 sample_rdata(16*3-1 DOWNTO 16*2) WHEN next_state_fsm_load_FFT = FIFO_3 ELSE
665 -- sample_rdata(16*3-1 DOWNTO 16*2) WHEN next_state_fsm_load_FFT = FIFO_3 ELSE
638 sample_rdata(16*4-1 DOWNTO 16*3) WHEN next_state_fsm_load_FFT = FIFO_4 ELSE
666 -- sample_rdata(16*4-1 DOWNTO 16*3) WHEN next_state_fsm_load_FFT = FIFO_4 ELSE
667 -- sample_rdata(16*5-1 DOWNTO 16*4); --WHEN next_state_fsm_load_FFT = FIFO_5 ELSE
668 sample_data <= sample_rdata(16*1-1 DOWNTO 16*0) WHEN select_fifo_reg = "000" ELSE
669 sample_rdata(16*2-1 DOWNTO 16*1) WHEN select_fifo_reg = "001" ELSE
670 sample_rdata(16*3-1 DOWNTO 16*2) WHEN select_fifo_reg = "010" ELSE
671 sample_rdata(16*4-1 DOWNTO 16*3) WHEN select_fifo_reg = "011" ELSE
639 sample_rdata(16*5-1 DOWNTO 16*4); --WHEN next_state_fsm_load_FFT = FIFO_5 ELSE
672 sample_rdata(16*5-1 DOWNTO 16*4); --WHEN next_state_fsm_load_FFT = FIFO_5 ELSE
640
673
641 -----------------------------------------------------------------------------
674 -----------------------------------------------------------------------------
642 -- FFT
675 -- FFT
643 -----------------------------------------------------------------------------
676 -----------------------------------------------------------------------------
644 lpp_lfr_ms_FFT_1 : lpp_lfr_ms_FFT
677 lpp_lfr_ms_FFT_1 : lpp_lfr_ms_FFT
645 PORT MAP (
678 PORT MAP (
646 clk => clk,
679 clk => clk,
647 rstn => rstn,
680 rstn => rstn,
648 sample_valid => sample_valid,
681 sample_valid => sample_valid,
649 fft_read => fft_read,
682 fft_read => fft_read,
650 sample_data => sample_data,
683 sample_data => sample_data,
651 sample_load => sample_load,
684 sample_load => sample_load,
652 fft_pong => fft_pong,
685 fft_pong => fft_pong,
653 fft_data_im => fft_data_im,
686 fft_data_im => fft_data_im,
654 fft_data_re => fft_data_re,
687 fft_data_re => fft_data_re,
655 fft_data_valid => fft_data_valid,
688 fft_data_valid => fft_data_valid,
656 fft_ready => fft_ready);
689 fft_ready => fft_ready);
657
690
658 -----------------------------------------------------------------------------
691 -----------------------------------------------------------------------------
659 fft_ready_rising_down <= fft_ready_reg AND NOT fft_ready;
692 fft_ready_rising_down <= fft_ready_reg AND NOT fft_ready;
660 sample_load_rising_down <= sample_load_reg AND NOT sample_load;
693 sample_load_rising_down <= sample_load_reg AND NOT sample_load;
661
694
662 PROCESS (clk, rstn)
695 PROCESS (clk, rstn)
663 BEGIN
696 BEGIN
664 IF rstn = '0' THEN
697 IF rstn = '0' THEN
665 fft_ready_reg <= '0';
698 fft_ready_reg <= '0';
666 sample_load_reg <= '0';
699 sample_load_reg <= '0';
667
700
668 fft_ongoing_counter <= '0';
701 fft_ongoing_counter <= '0';
669 ELSIF clk'event AND clk = '1' THEN
702 ELSIF clk'event AND clk = '1' THEN
670 fft_ready_reg <= fft_ready;
703 fft_ready_reg <= fft_ready;
671 sample_load_reg <= sample_load;
704 sample_load_reg <= sample_load;
672
705
673 IF fft_ready_rising_down = '1' AND sample_load_rising_down = '0' THEN
706 IF fft_ready_rising_down = '1' AND sample_load_rising_down = '0' THEN
674 fft_ongoing_counter <= '0';
707 fft_ongoing_counter <= '0';
675
708
676 -- CASE fft_ongoing_counter IS
709 -- CASE fft_ongoing_counter IS
677 -- WHEN "01" => fft_ongoing_counter <= "00";
710 -- WHEN "01" => fft_ongoing_counter <= "00";
678 ---- WHEN "10" => fft_ongoing_counter <= "01";
711 ---- WHEN "10" => fft_ongoing_counter <= "01";
679 -- WHEN OTHERS => NULL;
712 -- WHEN OTHERS => NULL;
680 -- END CASE;
713 -- END CASE;
681 ELSIF fft_ready_rising_down = '0' AND sample_load_rising_down = '1' THEN
714 ELSIF fft_ready_rising_down = '0' AND sample_load_rising_down = '1' THEN
682 fft_ongoing_counter <= '1';
715 fft_ongoing_counter <= '1';
683 -- CASE fft_ongoing_counter IS
716 -- CASE fft_ongoing_counter IS
684 -- WHEN "00" => fft_ongoing_counter <= "01";
717 -- WHEN "00" => fft_ongoing_counter <= "01";
685 ---- WHEN "01" => fft_ongoing_counter <= "10";
718 ---- WHEN "01" => fft_ongoing_counter <= "10";
686 -- WHEN OTHERS => NULL;
719 -- WHEN OTHERS => NULL;
687 -- END CASE;
720 -- END CASE;
688 END IF;
721 END IF;
689
722
690 END IF;
723 END IF;
691 END PROCESS;
724 END PROCESS;
692
725
693 -----------------------------------------------------------------------------
726 -----------------------------------------------------------------------------
694 PROCESS (clk, rstn)
727 PROCESS (clk, rstn)
695 BEGIN
728 BEGIN
696 IF rstn = '0' THEN
729 IF rstn = '0' THEN
697 state_fsm_load_MS_memory <= IDLE;
730 state_fsm_load_MS_memory <= IDLE;
698 current_fifo_load <= "00001";
731 current_fifo_load <= "00001";
699 ELSIF clk'EVENT AND clk = '1' THEN
732 ELSIF clk'EVENT AND clk = '1' THEN
700 CASE state_fsm_load_MS_memory IS
733 CASE state_fsm_load_MS_memory IS
701 WHEN IDLE =>
734 WHEN IDLE =>
702 IF current_fifo_empty = '1' AND fft_ready = '1' AND current_fifo_locked = '0' THEN
735 IF current_fifo_empty = '1' AND fft_ready = '1' AND current_fifo_locked = '0' THEN
703 state_fsm_load_MS_memory <= LOAD_FIFO;
736 state_fsm_load_MS_memory <= LOAD_FIFO;
704 END IF;
737 END IF;
705 WHEN LOAD_FIFO =>
738 WHEN LOAD_FIFO =>
706 IF current_fifo_full = '1' THEN
739 IF current_fifo_full = '1' THEN
707 state_fsm_load_MS_memory <= TRASH_FFT;
740 state_fsm_load_MS_memory <= TRASH_FFT;
708 END IF;
741 END IF;
709 WHEN TRASH_FFT =>
742 WHEN TRASH_FFT =>
710 IF fft_ready = '0' THEN
743 IF fft_ready = '0' THEN
711 state_fsm_load_MS_memory <= IDLE;
744 state_fsm_load_MS_memory <= IDLE;
712 current_fifo_load <= current_fifo_load(3 DOWNTO 0) & current_fifo_load(4);
745 current_fifo_load <= current_fifo_load(3 DOWNTO 0) & current_fifo_load(4);
713 END IF;
746 END IF;
714 WHEN OTHERS => NULL;
747 WHEN OTHERS => NULL;
715 END CASE;
748 END CASE;
716
749
717 END IF;
750 END IF;
718 END PROCESS;
751 END PROCESS;
719
752
720 current_fifo_empty <= MEM_IN_SM_Empty(0) WHEN current_fifo_load(0) = '1' ELSE
753 current_fifo_empty <= MEM_IN_SM_Empty(0) WHEN current_fifo_load(0) = '1' ELSE
721 MEM_IN_SM_Empty(1) WHEN current_fifo_load(1) = '1' ELSE
754 MEM_IN_SM_Empty(1) WHEN current_fifo_load(1) = '1' ELSE
722 MEM_IN_SM_Empty(2) WHEN current_fifo_load(2) = '1' ELSE
755 MEM_IN_SM_Empty(2) WHEN current_fifo_load(2) = '1' ELSE
723 MEM_IN_SM_Empty(3) WHEN current_fifo_load(3) = '1' ELSE
756 MEM_IN_SM_Empty(3) WHEN current_fifo_load(3) = '1' ELSE
724 MEM_IN_SM_Empty(4); -- WHEN current_fifo_load(3) = '1' ELSE
757 MEM_IN_SM_Empty(4); -- WHEN current_fifo_load(3) = '1' ELSE
725
758
726 current_fifo_full <= MEM_IN_SM_Full(0) WHEN current_fifo_load(0) = '1' ELSE
759 current_fifo_full <= MEM_IN_SM_Full(0) WHEN current_fifo_load(0) = '1' ELSE
727 MEM_IN_SM_Full(1) WHEN current_fifo_load(1) = '1' ELSE
760 MEM_IN_SM_Full(1) WHEN current_fifo_load(1) = '1' ELSE
728 MEM_IN_SM_Full(2) WHEN current_fifo_load(2) = '1' ELSE
761 MEM_IN_SM_Full(2) WHEN current_fifo_load(2) = '1' ELSE
729 MEM_IN_SM_Full(3) WHEN current_fifo_load(3) = '1' ELSE
762 MEM_IN_SM_Full(3) WHEN current_fifo_load(3) = '1' ELSE
730 MEM_IN_SM_Full(4); -- WHEN current_fifo_load(3) = '1' ELSE
763 MEM_IN_SM_Full(4); -- WHEN current_fifo_load(3) = '1' ELSE
731
764
732 current_fifo_locked <= MEM_IN_SM_locked(0) WHEN current_fifo_load(0) = '1' ELSE
765 current_fifo_locked <= MEM_IN_SM_locked(0) WHEN current_fifo_load(0) = '1' ELSE
733 MEM_IN_SM_locked(1) WHEN current_fifo_load(1) = '1' ELSE
766 MEM_IN_SM_locked(1) WHEN current_fifo_load(1) = '1' ELSE
734 MEM_IN_SM_locked(2) WHEN current_fifo_load(2) = '1' ELSE
767 MEM_IN_SM_locked(2) WHEN current_fifo_load(2) = '1' ELSE
735 MEM_IN_SM_locked(3) WHEN current_fifo_load(3) = '1' ELSE
768 MEM_IN_SM_locked(3) WHEN current_fifo_load(3) = '1' ELSE
736 MEM_IN_SM_locked(4); -- WHEN current_fifo_load(3) = '1' ELSE
769 MEM_IN_SM_locked(4); -- WHEN current_fifo_load(3) = '1' ELSE
737
770
738 fft_read <= '0' WHEN state_fsm_load_MS_memory = IDLE ELSE '1';
771 fft_read <= '0' WHEN state_fsm_load_MS_memory = IDLE ELSE '1';
739
772
740 all_fifo : FOR I IN 4 DOWNTO 0 GENERATE
773 all_fifo : FOR I IN 4 DOWNTO 0 GENERATE
741 MEM_IN_SM_wen_s(I) <= '0' WHEN fft_data_valid = '1'
774 MEM_IN_SM_wen_s(I) <= '0' WHEN fft_data_valid = '1'
742 AND state_fsm_load_MS_memory = LOAD_FIFO
775 AND state_fsm_load_MS_memory = LOAD_FIFO
743 AND current_fifo_load(I) = '1'
776 AND current_fifo_load(I) = '1'
744 ELSE '1';
777 ELSE '1';
745 END GENERATE all_fifo;
778 END GENERATE all_fifo;
746
779
747 PROCESS (clk, rstn)
780 PROCESS (clk, rstn)
748 BEGIN
781 BEGIN
749 IF rstn = '0' THEN
782 IF rstn = '0' THEN
750 MEM_IN_SM_wen <= (OTHERS => '1');
783 MEM_IN_SM_wen <= (OTHERS => '1');
751 ELSIF clk'EVENT AND clk = '1' THEN
784 ELSIF clk'EVENT AND clk = '1' THEN
752 MEM_IN_SM_wen <= MEM_IN_SM_wen_s;
785 MEM_IN_SM_wen <= MEM_IN_SM_wen_s;
753 END IF;
786 END IF;
754 END PROCESS;
787 END PROCESS;
755
788
756 MEM_IN_SM_wData <= (fft_data_im & fft_data_re) &
789 MEM_IN_SM_wData <= (fft_data_im & fft_data_re) &
757 (fft_data_im & fft_data_re) &
790 (fft_data_im & fft_data_re) &
758 (fft_data_im & fft_data_re) &
791 (fft_data_im & fft_data_re) &
759 (fft_data_im & fft_data_re) &
792 (fft_data_im & fft_data_re) &
760 (fft_data_im & fft_data_re);
793 (fft_data_im & fft_data_re);
761 -----------------------------------------------------------------------------
794 -----------------------------------------------------------------------------
762
795
763
796
764 -----------------------------------------------------------------------------
797 -----------------------------------------------------------------------------
765 Mem_In_SpectralMatrix : lppFIFOxN
798 Mem_In_SpectralMatrix : lppFIFOxN
766 GENERIC MAP (
799 GENERIC MAP (
767 tech => 0,
800 tech => 0,
768 Mem_use => Mem_use,
801 Mem_use => Mem_use,
769 Data_sz => 32, --16,
802 Data_sz => 32, --16,
770 Addr_sz => 7, --8
803 Addr_sz => 7, --8
771 FifoCnt => 5)
804 FifoCnt => 5)
772 PORT MAP (
805 PORT MAP (
773 clk => clk,
806 clk => clk,
774 rstn => rstn,
807 rstn => rstn,
775
808
776 ReUse => MEM_IN_SM_ReUse,
809 ReUse => MEM_IN_SM_ReUse,
777 run => (OTHERS => '1'),
810 run => (OTHERS => '1'),
778
811
779 wen => MEM_IN_SM_wen,
812 wen => MEM_IN_SM_wen,
780 wdata => MEM_IN_SM_wData,
813 wdata => MEM_IN_SM_wData,
781
814
782 ren => MEM_IN_SM_ren,
815 ren => MEM_IN_SM_ren,
783 rdata => MEM_IN_SM_rData,
816 rdata => MEM_IN_SM_rData,
784 full => MEM_IN_SM_Full,
817 full => MEM_IN_SM_Full,
785 empty => MEM_IN_SM_Empty,
818 empty => MEM_IN_SM_Empty,
786 almost_full => OPEN);
819 almost_full => OPEN);
787
820
788
821
789 -----------------------------------------------------------------------------
822 -----------------------------------------------------------------------------
790 MS_control_1 : MS_control
823 MS_control_1 : MS_control
791 PORT MAP (
824 PORT MAP (
792 clk => clk,
825 clk => clk,
793 rstn => rstn,
826 rstn => rstn,
794
827
795 current_status_ms => status_MS_input,
828 current_status_ms => status_MS_input,
796
829
797 fifo_in_lock => MEM_IN_SM_locked,
830 fifo_in_lock => MEM_IN_SM_locked,
798 fifo_in_data => MEM_IN_SM_rdata,
831 fifo_in_data => MEM_IN_SM_rdata,
799 fifo_in_full => MEM_IN_SM_Full,
832 fifo_in_full => MEM_IN_SM_Full,
800 fifo_in_empty => MEM_IN_SM_Empty,
833 fifo_in_empty => MEM_IN_SM_Empty,
801 fifo_in_ren => MEM_IN_SM_ren,
834 fifo_in_ren => MEM_IN_SM_ren,
802 fifo_in_reuse => MEM_IN_SM_ReUse,
835 fifo_in_reuse => MEM_IN_SM_ReUse,
803
836
804 fifo_out_data => SM_in_data,
837 fifo_out_data => SM_in_data,
805 fifo_out_ren => SM_in_ren,
838 fifo_out_ren => SM_in_ren,
806 fifo_out_empty => SM_in_empty,
839 fifo_out_empty => SM_in_empty,
807
840
808 current_status_component => status_component,
841 current_status_component => status_component,
809
842
810 correlation_start => SM_correlation_start,
843 correlation_start => SM_correlation_start,
811 correlation_auto => SM_correlation_auto,
844 correlation_auto => SM_correlation_auto,
812 correlation_done => SM_correlation_done);
845 correlation_done => SM_correlation_done);
813
846
814
847
815 MS_calculation_1 : MS_calculation
848 MS_calculation_1 : MS_calculation
816 PORT MAP (
849 PORT MAP (
817 clk => clk,
850 clk => clk,
818 rstn => rstn,
851 rstn => rstn,
819
852
820 fifo_in_data => SM_in_data,
853 fifo_in_data => SM_in_data,
821 fifo_in_ren => SM_in_ren,
854 fifo_in_ren => SM_in_ren,
822 fifo_in_empty => SM_in_empty,
855 fifo_in_empty => SM_in_empty,
823
856
824 fifo_out_data => MEM_OUT_SM_Data_in_s, -- TODO
857 fifo_out_data => MEM_OUT_SM_Data_in_s, -- TODO
825 fifo_out_wen => MEM_OUT_SM_Write_s, -- TODO
858 fifo_out_wen => MEM_OUT_SM_Write_s, -- TODO
826 fifo_out_full => MEM_OUT_SM_Full_s, -- TODO
859 fifo_out_full => MEM_OUT_SM_Full_s, -- TODO
827
860
828 correlation_start => SM_correlation_start,
861 correlation_start => SM_correlation_start,
829 correlation_auto => SM_correlation_auto,
862 correlation_auto => SM_correlation_auto,
830 correlation_begin => SM_correlation_begin,
863 correlation_begin => SM_correlation_begin,
831 correlation_done => SM_correlation_done);
864 correlation_done => SM_correlation_done);
832
865
833 -----------------------------------------------------------------------------
866 -----------------------------------------------------------------------------
834 PROCESS (clk, rstn)
867 PROCESS (clk, rstn)
835 BEGIN -- PROCESS
868 BEGIN -- PROCESS
836 IF rstn = '0' THEN -- asynchronous reset (active low)
869 IF rstn = '0' THEN -- asynchronous reset (active low)
837 current_matrix_write <= '0';
870 current_matrix_write <= '0';
838 current_matrix_wait_empty <= '1';
871 current_matrix_wait_empty <= '1';
839 status_component_fifo_0 <= (OTHERS => '0');
872 status_component_fifo_0 <= (OTHERS => '0');
840 status_component_fifo_1 <= (OTHERS => '0');
873 status_component_fifo_1 <= (OTHERS => '0');
841 status_component_fifo_0_end <= '0';
874 status_component_fifo_0_end <= '0';
842 status_component_fifo_1_end <= '0';
875 status_component_fifo_1_end <= '0';
843 SM_correlation_done_reg1 <= '0';
876 SM_correlation_done_reg1 <= '0';
844 SM_correlation_done_reg2 <= '0';
877 SM_correlation_done_reg2 <= '0';
845 SM_correlation_done_reg3 <= '0';
878 SM_correlation_done_reg3 <= '0';
846
879
847 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
880 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
848 SM_correlation_done_reg1 <= SM_correlation_done;
881 SM_correlation_done_reg1 <= SM_correlation_done;
849 SM_correlation_done_reg2 <= SM_correlation_done_reg1;
882 SM_correlation_done_reg2 <= SM_correlation_done_reg1;
850 SM_correlation_done_reg3 <= SM_correlation_done_reg2;
883 SM_correlation_done_reg3 <= SM_correlation_done_reg2;
851 status_component_fifo_0_end <= '0';
884 status_component_fifo_0_end <= '0';
852 status_component_fifo_1_end <= '0';
885 status_component_fifo_1_end <= '0';
853 IF SM_correlation_begin = '1' THEN
886 IF SM_correlation_begin = '1' THEN
854 IF current_matrix_write = '0' THEN
887 IF current_matrix_write = '0' THEN
855 status_component_fifo_0 <= status_component;
888 status_component_fifo_0 <= status_component(53 DOWNTO 4);
856 ELSE
889 ELSE
857 status_component_fifo_1 <= status_component;
890 status_component_fifo_1 <= status_component(53 DOWNTO 4);
858 END IF;
891 END IF;
859 END IF;
892 END IF;
860
893
861 IF SM_correlation_done_reg3 = '1' THEN
894 IF SM_correlation_done_reg3 = '1' THEN
862 IF current_matrix_write = '0' THEN
895 IF current_matrix_write = '0' THEN
863 status_component_fifo_0_end <= '1';
896 status_component_fifo_0_end <= '1';
864 ELSE
897 ELSE
865 status_component_fifo_1_end <= '1';
898 status_component_fifo_1_end <= '1';
866 END IF;
899 END IF;
867 current_matrix_wait_empty <= '1';
900 current_matrix_wait_empty <= '1';
868 current_matrix_write <= NOT current_matrix_write;
901 current_matrix_write <= NOT current_matrix_write;
869 END IF;
902 END IF;
870
903
871 IF current_matrix_wait_empty <= '1' THEN
904 IF current_matrix_wait_empty <= '1' THEN
872 IF current_matrix_write = '0' THEN
905 IF current_matrix_write = '0' THEN
873 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(0);
906 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(0);
874 ELSE
907 ELSE
875 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(1);
908 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(1);
876 END IF;
909 END IF;
877 END IF;
910 END IF;
878
911
879 END IF;
912 END IF;
880 END PROCESS;
913 END PROCESS;
881
914
882 MEM_OUT_SM_Full_s <= '1' WHEN SM_correlation_done = '1' ELSE
915 MEM_OUT_SM_Full_s <= '1' WHEN SM_correlation_done = '1' ELSE
883 '1' WHEN SM_correlation_done_reg1 = '1' ELSE
916 '1' WHEN SM_correlation_done_reg1 = '1' ELSE
884 '1' WHEN SM_correlation_done_reg2 = '1' ELSE
917 '1' WHEN SM_correlation_done_reg2 = '1' ELSE
885 '1' WHEN SM_correlation_done_reg3 = '1' ELSE
918 '1' WHEN SM_correlation_done_reg3 = '1' ELSE
886 '1' WHEN current_matrix_wait_empty = '1' ELSE
919 '1' WHEN current_matrix_wait_empty = '1' ELSE
887 MEM_OUT_SM_Full(0) WHEN current_matrix_write = '0' ELSE
920 MEM_OUT_SM_Full(0) WHEN current_matrix_write = '0' ELSE
888 MEM_OUT_SM_Full(1);
921 MEM_OUT_SM_Full(1);
889
922
890 MEM_OUT_SM_Write(0) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '0' ELSE '1';
923 MEM_OUT_SM_Write(0) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '0' ELSE '1';
891 MEM_OUT_SM_Write(1) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '1' ELSE '1';
924 MEM_OUT_SM_Write(1) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '1' ELSE '1';
892
925
893 MEM_OUT_SM_Data_in <= MEM_OUT_SM_Data_in_s & MEM_OUT_SM_Data_in_s;
926 MEM_OUT_SM_Data_in <= MEM_OUT_SM_Data_in_s & MEM_OUT_SM_Data_in_s;
894 -----------------------------------------------------------------------------
927 -----------------------------------------------------------------------------
895
928
896 --Mem_Out_SpectralMatrix : lppFIFOxN
929 --Mem_Out_SpectralMatrix : lppFIFOxN
897 -- GENERIC MAP (
930 -- GENERIC MAP (
898 -- tech => 0,
931 -- tech => 0,
899 -- Mem_use => Mem_use,
932 -- Mem_use => Mem_use,
900 -- Data_sz => 32,
933 -- Data_sz => 32,
901 -- Addr_sz => 8,
934 -- Addr_sz => 8,
902 -- FifoCnt => 2)
935 -- FifoCnt => 2)
903 -- PORT MAP (
936 -- PORT MAP (
904 -- clk => clk,
937 -- clk => clk,
905 -- rstn => rstn,
938 -- rstn => rstn,
906
939
907 -- ReUse => (OTHERS => '0'),
940 -- ReUse => (OTHERS => '0'),
908 -- run => (OTHERS => '1'),
941 -- run => (OTHERS => '1'),
909
942
910 -- wen => MEM_OUT_SM_Write,
943 -- wen => MEM_OUT_SM_Write,
911 -- wdata => MEM_OUT_SM_Data_in,
944 -- wdata => MEM_OUT_SM_Data_in,
912
945
913 -- ren => MEM_OUT_SM_Read,
946 -- ren => MEM_OUT_SM_Read,
914 -- rdata => MEM_OUT_SM_Data_out,
947 -- rdata => MEM_OUT_SM_Data_out,
915
948
916 -- full => MEM_OUT_SM_Full,
949 -- full => MEM_OUT_SM_Full,
917 -- empty => MEM_OUT_SM_Empty,
950 -- empty => MEM_OUT_SM_Empty,
918 -- almost_full => OPEN);
951 -- almost_full => OPEN);
919
952
920
953
921 all_Mem_Out_SpectralMatrix: FOR I IN 1 DOWNTO 0 GENERATE
954 all_Mem_Out_SpectralMatrix: FOR I IN 1 DOWNTO 0 GENERATE
922 Mem_Out_SpectralMatrix_I: lpp_fifo
955 Mem_Out_SpectralMatrix_I: lpp_fifo
923 GENERIC MAP (
956 GENERIC MAP (
924 tech => 0,
957 tech => 0,
925 Mem_use => Mem_use,
958 Mem_use => Mem_use,
926 EMPTY_THRESHOLD_LIMIT => 15,
959 EMPTY_THRESHOLD_LIMIT => 15,
927 FULL_THRESHOLD_LIMIT => 1,
960 FULL_THRESHOLD_LIMIT => 1,
928 DataSz => 32,
961 DataSz => 32,
929 AddrSz => 8)
962 AddrSz => 8)
930 PORT MAP (
963 PORT MAP (
931 clk => clk,
964 clk => clk,
932 rstn => rstn,
965 rstn => rstn,
933 reUse => '0',
966 reUse => '0',
934 run => run,
967 run => run,
935
968
936 ren => MEM_OUT_SM_Read(I),
969 ren => MEM_OUT_SM_Read(I),
937 rdata => MEM_OUT_SM_Data_out(32*(I+1)-1 DOWNTO 32*i),
970 rdata => MEM_OUT_SM_Data_out(32*(I+1)-1 DOWNTO 32*i),
938
971
939 wen => MEM_OUT_SM_Write(I),
972 wen => MEM_OUT_SM_Write(I),
940 wdata => MEM_OUT_SM_Data_in(32*(I+1)-1 DOWNTO 32*i),
973 wdata => MEM_OUT_SM_Data_in(32*(I+1)-1 DOWNTO 32*i),
941
974
942 empty => MEM_OUT_SM_Empty(I),
975 empty => MEM_OUT_SM_Empty(I),
943 full => MEM_OUT_SM_Full(I),
976 full => MEM_OUT_SM_Full(I),
944 full_almost => OPEN,
977 full_almost => OPEN,
945 empty_threshold => MEM_OUT_SM_Empty_Threshold(I),
978 empty_threshold => MEM_OUT_SM_Empty_Threshold(I),
946
979
947 full_threshold => OPEN);
980 full_threshold => OPEN);
948
981
949 END GENERATE all_Mem_Out_SpectralMatrix;
982 END GENERATE all_Mem_Out_SpectralMatrix;
950
983
951 -----------------------------------------------------------------------------
984 -----------------------------------------------------------------------------
952 -- MEM_OUT_SM_Read <= "00";
985 -- MEM_OUT_SM_Read <= "00";
953 PROCESS (clk, rstn)
986 PROCESS (clk, rstn)
954 BEGIN
987 BEGIN
955 IF rstn = '0' THEN
988 IF rstn = '0' THEN
956 fifo_0_ready <= '0';
989 fifo_0_ready <= '0';
957 fifo_1_ready <= '0';
990 fifo_1_ready <= '0';
958 fifo_ongoing <= '0';
991 fifo_ongoing <= '0';
959 ELSIF clk'EVENT AND clk = '1' THEN
992 ELSIF clk'EVENT AND clk = '1' THEN
960 IF fifo_0_ready = '1' AND MEM_OUT_SM_Empty(0) = '1' THEN
993 IF fifo_0_ready = '1' AND MEM_OUT_SM_Empty(0) = '1' THEN
961 fifo_ongoing <= '1';
994 fifo_ongoing <= '1';
962 fifo_0_ready <= '0';
995 fifo_0_ready <= '0';
963 ELSIF status_component_fifo_0_end = '1' THEN
996 ELSIF status_component_fifo_0_end = '1' THEN
964 fifo_0_ready <= '1';
997 fifo_0_ready <= '1';
965 END IF;
998 END IF;
966
999
967 IF fifo_1_ready = '1' AND MEM_OUT_SM_Empty(1) = '1' THEN
1000 IF fifo_1_ready = '1' AND MEM_OUT_SM_Empty(1) = '1' THEN
968 fifo_ongoing <= '0';
1001 fifo_ongoing <= '0';
969 fifo_1_ready <= '0';
1002 fifo_1_ready <= '0';
970 ELSIF status_component_fifo_1_end = '1' THEN
1003 ELSIF status_component_fifo_1_end = '1' THEN
971 fifo_1_ready <= '1';
1004 fifo_1_ready <= '1';
972 END IF;
1005 END IF;
973
1006
974 END IF;
1007 END IF;
975 END PROCESS;
1008 END PROCESS;
976
1009
977 MEM_OUT_SM_Read(0) <= '1' WHEN fifo_ongoing = '1' ELSE
1010 MEM_OUT_SM_Read(0) <= '1' WHEN fifo_ongoing = '1' ELSE
978 '1' WHEN fifo_0_ready = '0' ELSE
1011 '1' WHEN fifo_0_ready = '0' ELSE
979 FSM_DMA_fifo_ren;
1012 FSM_DMA_fifo_ren;
980
1013
981 MEM_OUT_SM_Read(1) <= '1' WHEN fifo_ongoing = '0' ELSE
1014 MEM_OUT_SM_Read(1) <= '1' WHEN fifo_ongoing = '0' ELSE
982 '1' WHEN fifo_1_ready = '0' ELSE
1015 '1' WHEN fifo_1_ready = '0' ELSE
983 FSM_DMA_fifo_ren;
1016 FSM_DMA_fifo_ren;
984
1017
985 FSM_DMA_fifo_empty <= MEM_OUT_SM_Empty(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
1018 FSM_DMA_fifo_empty <= MEM_OUT_SM_Empty(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
986 MEM_OUT_SM_Empty(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
1019 MEM_OUT_SM_Empty(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
987 '1';
1020 '1';
988
1021
989 FSM_DMA_fifo_status <= status_component_fifo_0 WHEN fifo_ongoing = '0' ELSE
1022 FSM_DMA_fifo_status <= status_component_fifo_0 WHEN fifo_ongoing = '0' ELSE
990 status_component_fifo_1;
1023 status_component_fifo_1;
991
1024
992 FSM_DMA_fifo_data <= MEM_OUT_SM_Data_out(31 DOWNTO 0) WHEN fifo_ongoing = '0' ELSE
1025 FSM_DMA_fifo_data <= MEM_OUT_SM_Data_out(31 DOWNTO 0) WHEN fifo_ongoing = '0' ELSE
993 MEM_OUT_SM_Data_out(63 DOWNTO 32);
1026 MEM_OUT_SM_Data_out(63 DOWNTO 32);
994
1027
995
1028
996 FSM_DMA_fifo_empty_threshold <= MEM_OUT_SM_Empty_Threshold(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
1029 FSM_DMA_fifo_empty_threshold <= MEM_OUT_SM_Empty_Threshold(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
997 MEM_OUT_SM_Empty_Threshold(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
1030 MEM_OUT_SM_Empty_Threshold(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
998 '1';
1031 '1';
999
1032
1000 -----------------------------------------------------------------------------
1033 -----------------------------------------------------------------------------
1001 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4), --IN
1034 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4), --IN
1002 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0), --IN
1035 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0), --IN
1003 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6), --IN
1036 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6), --IN
1004 -- fifo_data => FSM_DMA_fifo_data, --IN
1037 -- fifo_data => FSM_DMA_fifo_data, --IN
1005 -- fifo_empty => FSM_DMA_fifo_empty, --IN
1038 -- fifo_empty => FSM_DMA_fifo_empty, --IN
1006 -- fifo_empty_threshold => FSM_DMA_fifo_empty_threshold, --IN
1039 -- fifo_empty_threshold => FSM_DMA_fifo_empty_threshold, --IN
1007 -- fifo_ren => FSM_DMA_fifo_ren, --OUT
1040 -- fifo_ren => FSM_DMA_fifo_ren, --OUT
1008
1041
1009
1042
1010 lpp_lfr_ms_fsmdma_1: lpp_lfr_ms_fsmdma
1043 lpp_lfr_ms_fsmdma_1: lpp_lfr_ms_fsmdma
1011 PORT MAP (
1044 PORT MAP (
1012 clk => clk,
1045 clk => clk,
1013 rstn => rstn,
1046 rstn => rstn,
1014 run => run,
1047 run => run,
1015
1048
1016 fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1049 fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1017 fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1050 fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1018 fifo_data => FSM_DMA_fifo_data,
1051 fifo_data => FSM_DMA_fifo_data,
1019 fifo_empty => FSM_DMA_fifo_empty,
1052 fifo_empty => FSM_DMA_fifo_empty,
1020 fifo_empty_threshold => FSM_DMA_fifo_empty_threshold,
1053 fifo_empty_threshold => FSM_DMA_fifo_empty_threshold,
1021 fifo_ren => FSM_DMA_fifo_ren,
1054 fifo_ren => FSM_DMA_fifo_ren,
1022
1055
1023 dma_fifo_valid_burst => dma_fifo_burst_valid,
1056 dma_fifo_valid_burst => dma_fifo_burst_valid,
1024 dma_fifo_data => dma_fifo_data,
1057 dma_fifo_data => dma_fifo_data,
1025 dma_fifo_ren => dma_fifo_ren,
1058 dma_fifo_ren => dma_fifo_ren,
1026 dma_buffer_new => dma_buffer_new,
1059 dma_buffer_new => dma_buffer_new,
1027 dma_buffer_addr => dma_buffer_addr,
1060 dma_buffer_addr => dma_buffer_addr,
1028 dma_buffer_length => dma_buffer_length,
1061 dma_buffer_length => dma_buffer_length,
1029 dma_buffer_full => dma_buffer_full,
1062 dma_buffer_full => dma_buffer_full,
1030 dma_buffer_full_err => dma_buffer_full_err,
1063 dma_buffer_full_err => dma_buffer_full_err,
1031
1064
1032 status_ready_matrix_f0 => status_ready_matrix_f0,
1065 status_ready_matrix_f0 => status_ready_matrix_f0,
1033 status_ready_matrix_f1 => status_ready_matrix_f1,
1066 status_ready_matrix_f1 => status_ready_matrix_f1,
1034 status_ready_matrix_f2 => status_ready_matrix_f2,
1067 status_ready_matrix_f2 => status_ready_matrix_f2,
1035 addr_matrix_f0 => addr_matrix_f0,
1068 addr_matrix_f0 => addr_matrix_f0,
1036 addr_matrix_f1 => addr_matrix_f1,
1069 addr_matrix_f1 => addr_matrix_f1,
1037 addr_matrix_f2 => addr_matrix_f2,
1070 addr_matrix_f2 => addr_matrix_f2,
1038 length_matrix_f0 => length_matrix_f0,
1071 length_matrix_f0 => length_matrix_f0,
1039 length_matrix_f1 => length_matrix_f1,
1072 length_matrix_f1 => length_matrix_f1,
1040 length_matrix_f2 => length_matrix_f2,
1073 length_matrix_f2 => length_matrix_f2,
1041 ready_matrix_f0 => ready_matrix_f0,
1074 ready_matrix_f0 => ready_matrix_f0,
1042 ready_matrix_f1 => ready_matrix_f1,
1075 ready_matrix_f1 => ready_matrix_f1,
1043 ready_matrix_f2 => ready_matrix_f2,
1076 ready_matrix_f2 => ready_matrix_f2,
1044 matrix_time_f0 => matrix_time_f0,
1077 matrix_time_f0 => matrix_time_f0,
1045 matrix_time_f1 => matrix_time_f1,
1078 matrix_time_f1 => matrix_time_f1,
1046 matrix_time_f2 => matrix_time_f2,
1079 matrix_time_f2 => matrix_time_f2,
1047 error_buffer_full => error_buffer_full);
1080 error_buffer_full => error_buffer_full);
1048
1081
1049
1082
1050
1083
1051
1084
1052
1085
1053 --dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
1086 --dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
1054 --dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1087 --dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1055 --dma_fifo_ren : IN STD_LOGIC; --TODO
1088 --dma_fifo_ren : IN STD_LOGIC; --TODO
1056 --dma_buffer_new : OUT STD_LOGIC; --TODO
1089 --dma_buffer_new : OUT STD_LOGIC; --TODO
1057 --dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1090 --dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1058 --dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
1091 --dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
1059 --dma_buffer_full : IN STD_LOGIC; --TODO
1092 --dma_buffer_full : IN STD_LOGIC; --TODO
1060 --dma_buffer_full_err : IN STD_LOGIC; --TODO
1093 --dma_buffer_full_err : IN STD_LOGIC; --TODO
1061
1094
1062 ---- Reg out
1095 ---- Reg out
1063 --ready_matrix_f0 : OUT STD_LOGIC; -- TODO
1096 --ready_matrix_f0 : OUT STD_LOGIC; -- TODO
1064 --ready_matrix_f1 : OUT STD_LOGIC; -- TODO
1097 --ready_matrix_f1 : OUT STD_LOGIC; -- TODO
1065 --ready_matrix_f2 : OUT STD_LOGIC; -- TODO
1098 --ready_matrix_f2 : OUT STD_LOGIC; -- TODO
1066 --error_bad_component_error : OUT STD_LOGIC; -- TODO
1099 --error_bad_component_error : OUT STD_LOGIC; -- TODO
1067 --error_buffer_full : OUT STD_LOGIC; -- TODO
1100 --error_buffer_full : OUT STD_LOGIC; -- TODO
1068
1101
1069 ---- Reg In
1102 ---- Reg In
1070 --status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
1103 --status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
1071 --status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
1104 --status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
1072 --status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
1105 --status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
1073
1106
1074 --addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1107 --addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1075 --addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1108 --addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1076 --addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1109 --addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1077
1110
1078 --matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1111 --matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1079 --matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1112 --matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1080 --matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0) -- TODO
1113 --matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0) -- TODO
1081 -----------------------------------------------------------------------------
1114 -----------------------------------------------------------------------------
1082
1115
1083 -----------------------------------------------------------------------------
1116 -----------------------------------------------------------------------------
1084 --lpp_lfr_ms_fsmdma_1 : lpp_lfr_ms_fsmdma
1117 --lpp_lfr_ms_fsmdma_1 : lpp_lfr_ms_fsmdma
1085 -- PORT MAP (
1118 -- PORT MAP (
1086 -- HCLK => clk,
1119 -- HCLK => clk,
1087 -- HRESETn => rstn,
1120 -- HRESETn => rstn,
1088
1121
1089 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1122 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1090 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0),
1123 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0),
1091 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1124 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1092 -- fifo_data => FSM_DMA_fifo_data,
1125 -- fifo_data => FSM_DMA_fifo_data,
1093 -- fifo_empty => FSM_DMA_fifo_empty,
1126 -- fifo_empty => FSM_DMA_fifo_empty,
1094 -- fifo_ren => FSM_DMA_fifo_ren,
1127 -- fifo_ren => FSM_DMA_fifo_ren,
1095
1128
1096 -- dma_addr => dma_addr,
1129 -- dma_addr => dma_addr,
1097 -- dma_data => dma_data,
1130 -- dma_data => dma_data,
1098 -- dma_valid => dma_valid,
1131 -- dma_valid => dma_valid,
1099 -- dma_valid_burst => dma_valid_burst,
1132 -- dma_valid_burst => dma_valid_burst,
1100 -- dma_ren => dma_ren,
1133 -- dma_ren => dma_ren,
1101 -- dma_done => dma_done,
1134 -- dma_done => dma_done,
1102
1135
1103 -- ready_matrix_f0 => ready_matrix_f0,
1136 -- ready_matrix_f0 => ready_matrix_f0,
1104 -- ready_matrix_f1 => ready_matrix_f1,
1137 -- ready_matrix_f1 => ready_matrix_f1,
1105 -- ready_matrix_f2 => ready_matrix_f2,
1138 -- ready_matrix_f2 => ready_matrix_f2,
1106
1139
1107 -- error_bad_component_error => error_bad_component_error,
1140 -- error_bad_component_error => error_bad_component_error,
1108 -- error_buffer_full => error_buffer_full,
1141 -- error_buffer_full => error_buffer_full,
1109
1142
1110 -- debug_reg => debug_reg,
1143 -- debug_reg => debug_reg,
1111 -- status_ready_matrix_f0 => status_ready_matrix_f0,
1144 -- status_ready_matrix_f0 => status_ready_matrix_f0,
1112 -- status_ready_matrix_f1 => status_ready_matrix_f1,
1145 -- status_ready_matrix_f1 => status_ready_matrix_f1,
1113 -- status_ready_matrix_f2 => status_ready_matrix_f2,
1146 -- status_ready_matrix_f2 => status_ready_matrix_f2,
1114
1147
1115 -- config_active_interruption_onNewMatrix => config_active_interruption_onNewMatrix,
1148 -- config_active_interruption_onNewMatrix => config_active_interruption_onNewMatrix,
1116 -- config_active_interruption_onError => config_active_interruption_onError,
1149 -- config_active_interruption_onError => config_active_interruption_onError,
1117
1150
1118 -- addr_matrix_f0 => addr_matrix_f0,
1151 -- addr_matrix_f0 => addr_matrix_f0,
1119 -- addr_matrix_f1 => addr_matrix_f1,
1152 -- addr_matrix_f1 => addr_matrix_f1,
1120 -- addr_matrix_f2 => addr_matrix_f2,
1153 -- addr_matrix_f2 => addr_matrix_f2,
1121
1154
1122 -- matrix_time_f0 => matrix_time_f0,
1155 -- matrix_time_f0 => matrix_time_f0,
1123 -- matrix_time_f1 => matrix_time_f1,
1156 -- matrix_time_f1 => matrix_time_f1,
1124 -- matrix_time_f2 => matrix_time_f2
1157 -- matrix_time_f2 => matrix_time_f2
1125 -- );
1158 -- );
1126 -----------------------------------------------------------------------------
1159 -----------------------------------------------------------------------------
1127
1160
1128
1161
1129
1162
1130
1163
1131
1164
1132
1165
1133 -----------------------------------------------------------------------------
1166 -----------------------------------------------------------------------------
1134 -- TIME MANAGMENT
1167 -- TIME MANAGMENT
1135 -----------------------------------------------------------------------------
1168 -----------------------------------------------------------------------------
1136 all_time <= coarse_time & fine_time;
1169 all_time <= coarse_time & fine_time;
1137 --
1170 --
1138 f_empty(0) <= '1' WHEN sample_f0_A_empty = "11111" ELSE '0';
1171 f_empty(0) <= '1' WHEN sample_f0_A_empty = "11111" ELSE '0';
1139 f_empty(1) <= '1' WHEN sample_f0_B_empty = "11111" ELSE '0';
1172 f_empty(1) <= '1' WHEN sample_f0_B_empty = "11111" ELSE '0';
1140 f_empty(2) <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
1173 f_empty(2) <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
1141 f_empty(3) <= '1' WHEN sample_f2_empty = "11111" ELSE '0';
1174 f_empty(3) <= '1' WHEN sample_f2_empty = "11111" ELSE '0';
1142
1175
1143 all_time_reg: FOR I IN 0 TO 3 GENERATE
1176 all_time_reg: FOR I IN 0 TO 3 GENERATE
1144
1177
1145 PROCESS (clk, rstn)
1178 PROCESS (clk, rstn)
1146 BEGIN
1179 BEGIN
1147 IF rstn = '0' THEN
1180 IF rstn = '0' THEN
1148 f_empty_reg(I) <= '1';
1181 f_empty_reg(I) <= '1';
1149 ELSIF clk'event AND clk = '1' THEN
1182 ELSIF clk'event AND clk = '1' THEN
1150 f_empty_reg(I) <= f_empty(I);
1183 f_empty_reg(I) <= f_empty(I);
1151 END IF;
1184 END IF;
1152 END PROCESS;
1185 END PROCESS;
1153
1186
1154 time_update_f(I) <= '1' WHEN f_empty(I) = '0' AND f_empty_reg(I) = '1' ELSE '0';
1187 time_update_f(I) <= '1' WHEN f_empty(I) = '0' AND f_empty_reg(I) = '1' ELSE '0';
1155
1188
1156 s_m_t_m_f0_A : spectral_matrix_time_managment
1189 s_m_t_m_f0_A : spectral_matrix_time_managment
1157 PORT MAP (
1190 PORT MAP (
1158 clk => clk,
1191 clk => clk,
1159 rstn => rstn,
1192 rstn => rstn,
1160 time_in => all_time,
1193 time_in => all_time,
1161 update_1 => time_update_f(I),
1194 update_1 => time_update_f(I),
1162 time_out => time_reg_f((I+1)*48-1 DOWNTO I*48)
1195 time_out => time_reg_f((I+1)*48-1 DOWNTO I*48)
1163 );
1196 );
1164
1197
1165 END GENERATE all_time_reg;
1198 END GENERATE all_time_reg;
1166
1199
1167 time_reg_f0_A <= time_reg_f((0+1)*48-1 DOWNTO 0*48);
1200 time_reg_f0_A <= time_reg_f((0+1)*48-1 DOWNTO 0*48);
1168 time_reg_f0_B <= time_reg_f((1+1)*48-1 DOWNTO 1*48);
1201 time_reg_f0_B <= time_reg_f((1+1)*48-1 DOWNTO 1*48);
1169 time_reg_f1 <= time_reg_f((2+1)*48-1 DOWNTO 2*48);
1202 time_reg_f1 <= time_reg_f((2+1)*48-1 DOWNTO 2*48);
1170 time_reg_f2 <= time_reg_f((3+1)*48-1 DOWNTO 3*48);
1203 time_reg_f2 <= time_reg_f((3+1)*48-1 DOWNTO 3*48);
1171
1204
1172 -----------------------------------------------------------------------------
1205 -----------------------------------------------------------------------------
1173
1206
1174 END Behavioral;
1207 END Behavioral;
@@ -1,386 +1,386
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 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
80 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
80 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
81 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);
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_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
85 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
85 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
86 dma_fifo_burst_valid : OUT STD_LOGIC;
86 dma_fifo_burst_valid : OUT STD_LOGIC;
87 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
87 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
88 dma_fifo_ren : IN STD_LOGIC;
88 dma_fifo_ren : IN STD_LOGIC;
89 dma_buffer_new : OUT STD_LOGIC;
89 dma_buffer_new : OUT STD_LOGIC;
90 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
90 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
91 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
91 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
92 dma_buffer_full : IN STD_LOGIC;
92 dma_buffer_full : IN STD_LOGIC;
93 dma_buffer_full_err : IN STD_LOGIC;
93 dma_buffer_full_err : IN STD_LOGIC;
94 ready_matrix_f0 : OUT STD_LOGIC;
94 ready_matrix_f0 : OUT STD_LOGIC;
95 ready_matrix_f1 : OUT STD_LOGIC;
95 ready_matrix_f1 : OUT STD_LOGIC;
96 ready_matrix_f2 : OUT STD_LOGIC;
96 ready_matrix_f2 : OUT STD_LOGIC;
97 error_buffer_full : OUT STD_LOGIC;
97 error_buffer_full : OUT STD_LOGIC;
98 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
98 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
99 status_ready_matrix_f0 : IN STD_LOGIC;
99 status_ready_matrix_f0 : IN STD_LOGIC;
100 status_ready_matrix_f1 : IN STD_LOGIC;
100 status_ready_matrix_f1 : IN STD_LOGIC;
101 status_ready_matrix_f2 : IN STD_LOGIC;
101 status_ready_matrix_f2 : IN STD_LOGIC;
102 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
102 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
103 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
103 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
104 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
104 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
105 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
105 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
106 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
106 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
107 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
107 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
108 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
108 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
109 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
109 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
110 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0));
110 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0));
111 END COMPONENT;
111 END COMPONENT;
112
112
113 COMPONENT lpp_lfr_ms_fsmdma
113 COMPONENT lpp_lfr_ms_fsmdma
114 PORT (
114 PORT (
115 clk : IN STD_ULOGIC;
115 clk : IN STD_ULOGIC;
116 rstn : IN STD_ULOGIC;
116 rstn : IN STD_ULOGIC;
117 run : IN STD_LOGIC;
117 run : IN STD_LOGIC;
118 fifo_matrix_type : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
118 fifo_matrix_type : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
119 fifo_matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
119 fifo_matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
120 fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
120 fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
121 fifo_empty : IN STD_LOGIC;
121 fifo_empty : IN STD_LOGIC;
122 fifo_empty_threshold : IN STD_LOGIC;
122 fifo_empty_threshold : IN STD_LOGIC;
123 fifo_ren : OUT STD_LOGIC;
123 fifo_ren : OUT STD_LOGIC;
124 dma_fifo_valid_burst : OUT STD_LOGIC;
124 dma_fifo_valid_burst : OUT STD_LOGIC;
125 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
125 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
126 dma_fifo_ren : IN STD_LOGIC;
126 dma_fifo_ren : IN STD_LOGIC;
127 dma_buffer_new : OUT STD_LOGIC;
127 dma_buffer_new : OUT STD_LOGIC;
128 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
128 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
129 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
129 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
130 dma_buffer_full : IN STD_LOGIC;
130 dma_buffer_full : IN STD_LOGIC;
131 dma_buffer_full_err : IN STD_LOGIC;
131 dma_buffer_full_err : IN STD_LOGIC;
132 status_ready_matrix_f0 : IN STD_LOGIC;
132 status_ready_matrix_f0 : IN STD_LOGIC;
133 status_ready_matrix_f1 : IN STD_LOGIC;
133 status_ready_matrix_f1 : IN STD_LOGIC;
134 status_ready_matrix_f2 : IN STD_LOGIC;
134 status_ready_matrix_f2 : IN STD_LOGIC;
135 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
135 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
136 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
136 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
137 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
137 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
138 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
138 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
139 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
139 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
140 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
140 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
141 ready_matrix_f0 : OUT STD_LOGIC;
141 ready_matrix_f0 : OUT STD_LOGIC;
142 ready_matrix_f1 : OUT STD_LOGIC;
142 ready_matrix_f1 : OUT STD_LOGIC;
143 ready_matrix_f2 : OUT STD_LOGIC;
143 ready_matrix_f2 : OUT STD_LOGIC;
144 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
144 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
145 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
145 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
146 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
146 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
147 error_buffer_full : OUT STD_LOGIC);
147 error_buffer_full : OUT STD_LOGIC);
148 END COMPONENT;
148 END COMPONENT;
149
149
150 COMPONENT lpp_lfr_ms_FFT
150 COMPONENT lpp_lfr_ms_FFT
151 PORT (
151 PORT (
152 clk : IN STD_LOGIC;
152 clk : IN STD_LOGIC;
153 rstn : IN STD_LOGIC;
153 rstn : IN STD_LOGIC;
154 sample_valid : IN STD_LOGIC;
154 sample_valid : IN STD_LOGIC;
155 fft_read : IN STD_LOGIC;
155 fft_read : IN STD_LOGIC;
156 sample_data : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
156 sample_data : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
157 sample_load : OUT STD_LOGIC;
157 sample_load : OUT STD_LOGIC;
158 fft_pong : OUT STD_LOGIC;
158 fft_pong : OUT STD_LOGIC;
159 fft_data_im : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
159 fft_data_im : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
160 fft_data_re : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
160 fft_data_re : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
161 fft_data_valid : OUT STD_LOGIC;
161 fft_data_valid : OUT STD_LOGIC;
162 fft_ready : OUT STD_LOGIC);
162 fft_ready : OUT STD_LOGIC);
163 END COMPONENT;
163 END COMPONENT;
164
164
165 COMPONENT lpp_lfr_filter
165 COMPONENT lpp_lfr_filter
166 GENERIC (
166 GENERIC (
167 Mem_use : INTEGER);
167 Mem_use : INTEGER);
168 PORT (
168 PORT (
169 sample : IN Samples(7 DOWNTO 0);
169 sample : IN Samples(7 DOWNTO 0);
170 sample_val : IN STD_LOGIC;
170 sample_val : IN STD_LOGIC;
171 clk : IN STD_LOGIC;
171 clk : IN STD_LOGIC;
172 rstn : IN STD_LOGIC;
172 rstn : IN STD_LOGIC;
173 data_shaping_SP0 : IN STD_LOGIC;
173 data_shaping_SP0 : IN STD_LOGIC;
174 data_shaping_SP1 : IN STD_LOGIC;
174 data_shaping_SP1 : IN STD_LOGIC;
175 data_shaping_R0 : IN STD_LOGIC;
175 data_shaping_R0 : IN STD_LOGIC;
176 data_shaping_R1 : IN STD_LOGIC;
176 data_shaping_R1 : IN STD_LOGIC;
177 data_shaping_R2 : IN STD_LOGIC;
177 data_shaping_R2 : IN STD_LOGIC;
178 sample_f0_val : OUT STD_LOGIC;
178 sample_f0_val : OUT STD_LOGIC;
179 sample_f1_val : OUT STD_LOGIC;
179 sample_f1_val : OUT STD_LOGIC;
180 sample_f2_val : OUT STD_LOGIC;
180 sample_f2_val : OUT STD_LOGIC;
181 sample_f3_val : OUT STD_LOGIC;
181 sample_f3_val : OUT STD_LOGIC;
182 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
182 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
183 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
183 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
184 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
184 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
185 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0));
185 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0));
186 END COMPONENT;
186 END COMPONENT;
187
187
188 COMPONENT lpp_lfr
188 COMPONENT lpp_lfr
189 GENERIC (
189 GENERIC (
190 Mem_use : INTEGER;
190 Mem_use : INTEGER;
191 nb_data_by_buffer_size : INTEGER;
191 nb_data_by_buffer_size : INTEGER;
192 -- nb_word_by_buffer_size : INTEGER;
192 -- nb_word_by_buffer_size : INTEGER;
193 nb_snapshot_param_size : INTEGER;
193 nb_snapshot_param_size : INTEGER;
194 delta_vector_size : INTEGER;
194 delta_vector_size : INTEGER;
195 delta_vector_size_f0_2 : INTEGER;
195 delta_vector_size_f0_2 : INTEGER;
196 pindex : INTEGER;
196 pindex : INTEGER;
197 paddr : INTEGER;
197 paddr : INTEGER;
198 pmask : INTEGER;
198 pmask : INTEGER;
199 pirq_ms : INTEGER;
199 pirq_ms : INTEGER;
200 pirq_wfp : INTEGER;
200 pirq_wfp : INTEGER;
201 hindex : INTEGER;
201 hindex : INTEGER;
202 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0)
202 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0)
203 );
203 );
204 PORT (
204 PORT (
205 clk : IN STD_LOGIC;
205 clk : IN STD_LOGIC;
206 rstn : IN STD_LOGIC;
206 rstn : IN STD_LOGIC;
207 sample_B : IN Samples(2 DOWNTO 0);
207 sample_B : IN Samples(2 DOWNTO 0);
208 sample_E : IN Samples(4 DOWNTO 0);
208 sample_E : IN Samples(4 DOWNTO 0);
209 sample_val : IN STD_LOGIC;
209 sample_val : IN STD_LOGIC;
210 apbi : IN apb_slv_in_type;
210 apbi : IN apb_slv_in_type;
211 apbo : OUT apb_slv_out_type;
211 apbo : OUT apb_slv_out_type;
212 ahbi : IN AHB_Mst_In_Type;
212 ahbi : IN AHB_Mst_In_Type;
213 ahbo : OUT AHB_Mst_Out_Type;
213 ahbo : OUT AHB_Mst_Out_Type;
214 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
214 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
215 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
215 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
216 data_shaping_BW : OUT STD_LOGIC
216 data_shaping_BW : OUT STD_LOGIC
217 );
217 );
218 END COMPONENT;
218 END COMPONENT;
219
219
220 -----------------------------------------------------------------------------
220 -----------------------------------------------------------------------------
221 -- LPP_LFR with only WaveForm Picker (and without Spectral Matrix Sub System)
221 -- LPP_LFR with only WaveForm Picker (and without Spectral Matrix Sub System)
222 -----------------------------------------------------------------------------
222 -----------------------------------------------------------------------------
223 COMPONENT lpp_lfr_WFP_nMS
223 COMPONENT lpp_lfr_WFP_nMS
224 GENERIC (
224 GENERIC (
225 Mem_use : INTEGER;
225 Mem_use : INTEGER;
226 nb_data_by_buffer_size : INTEGER;
226 nb_data_by_buffer_size : INTEGER;
227 nb_word_by_buffer_size : INTEGER;
227 nb_word_by_buffer_size : INTEGER;
228 nb_snapshot_param_size : INTEGER;
228 nb_snapshot_param_size : INTEGER;
229 delta_vector_size : INTEGER;
229 delta_vector_size : INTEGER;
230 delta_vector_size_f0_2 : INTEGER;
230 delta_vector_size_f0_2 : INTEGER;
231 pindex : INTEGER;
231 pindex : INTEGER;
232 paddr : INTEGER;
232 paddr : INTEGER;
233 pmask : INTEGER;
233 pmask : INTEGER;
234 pirq_ms : INTEGER;
234 pirq_ms : INTEGER;
235 pirq_wfp : INTEGER;
235 pirq_wfp : INTEGER;
236 hindex : INTEGER;
236 hindex : INTEGER;
237 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
237 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
238 PORT (
238 PORT (
239 clk : IN STD_LOGIC;
239 clk : IN STD_LOGIC;
240 rstn : IN STD_LOGIC;
240 rstn : IN STD_LOGIC;
241 sample_B : IN Samples(2 DOWNTO 0);
241 sample_B : IN Samples(2 DOWNTO 0);
242 sample_E : IN Samples(4 DOWNTO 0);
242 sample_E : IN Samples(4 DOWNTO 0);
243 sample_val : IN STD_LOGIC;
243 sample_val : IN STD_LOGIC;
244 apbi : IN apb_slv_in_type;
244 apbi : IN apb_slv_in_type;
245 apbo : OUT apb_slv_out_type;
245 apbo : OUT apb_slv_out_type;
246 ahbi : IN AHB_Mst_In_Type;
246 ahbi : IN AHB_Mst_In_Type;
247 ahbo : OUT AHB_Mst_Out_Type;
247 ahbo : OUT AHB_Mst_Out_Type;
248 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
248 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
249 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
249 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
250 data_shaping_BW : OUT STD_LOGIC;
250 data_shaping_BW : OUT STD_LOGIC;
251 observation_reg : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
251 observation_reg : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
252 END COMPONENT;
252 END COMPONENT;
253 -----------------------------------------------------------------------------
253 -----------------------------------------------------------------------------
254
254
255 COMPONENT lpp_lfr_apbreg
255 COMPONENT lpp_lfr_apbreg
256 GENERIC (
256 GENERIC (
257 nb_data_by_buffer_size : INTEGER;
257 nb_data_by_buffer_size : INTEGER;
258 nb_snapshot_param_size : INTEGER;
258 nb_snapshot_param_size : INTEGER;
259 delta_vector_size : INTEGER;
259 delta_vector_size : INTEGER;
260 delta_vector_size_f0_2 : INTEGER;
260 delta_vector_size_f0_2 : INTEGER;
261 pindex : INTEGER;
261 pindex : INTEGER;
262 paddr : INTEGER;
262 paddr : INTEGER;
263 pmask : INTEGER;
263 pmask : INTEGER;
264 pirq_ms : INTEGER;
264 pirq_ms : INTEGER;
265 pirq_wfp : INTEGER;
265 pirq_wfp : INTEGER;
266 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
266 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
267 PORT (
267 PORT (
268 HCLK : IN STD_ULOGIC;
268 HCLK : IN STD_ULOGIC;
269 HRESETn : IN STD_ULOGIC;
269 HRESETn : IN STD_ULOGIC;
270 apbi : IN apb_slv_in_type;
270 apbi : IN apb_slv_in_type;
271 apbo : OUT apb_slv_out_type;
271 apbo : OUT apb_slv_out_type;
272 run_ms : OUT STD_LOGIC;
272 run_ms : OUT STD_LOGIC;
273 ready_matrix_f0 : IN STD_LOGIC;
273 ready_matrix_f0 : IN STD_LOGIC;
274 ready_matrix_f1 : IN STD_LOGIC;
274 ready_matrix_f1 : IN STD_LOGIC;
275 ready_matrix_f2 : IN STD_LOGIC;
275 ready_matrix_f2 : IN STD_LOGIC;
276 error_buffer_full : IN STD_LOGIC;
276 error_buffer_full : IN STD_LOGIC;
277 error_input_fifo_write : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
277 error_input_fifo_write : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
278 status_ready_matrix_f0 : OUT STD_LOGIC;
278 status_ready_matrix_f0 : OUT STD_LOGIC;
279 status_ready_matrix_f1 : OUT STD_LOGIC;
279 status_ready_matrix_f1 : OUT STD_LOGIC;
280 status_ready_matrix_f2 : OUT STD_LOGIC;
280 status_ready_matrix_f2 : OUT STD_LOGIC;
281 addr_matrix_f0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
281 addr_matrix_f0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
282 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
282 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
283 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
283 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
284 length_matrix_f0 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
284 length_matrix_f0 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
285 length_matrix_f1 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
285 length_matrix_f1 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
286 length_matrix_f2 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
286 length_matrix_f2 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
287 matrix_time_f0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
287 matrix_time_f0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
288 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
288 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
289 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
289 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
290 status_new_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
290 status_new_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
291 data_shaping_BW : OUT STD_LOGIC;
291 data_shaping_BW : OUT STD_LOGIC;
292 data_shaping_SP0 : OUT STD_LOGIC;
292 data_shaping_SP0 : OUT STD_LOGIC;
293 data_shaping_SP1 : OUT STD_LOGIC;
293 data_shaping_SP1 : OUT STD_LOGIC;
294 data_shaping_R0 : OUT STD_LOGIC;
294 data_shaping_R0 : OUT STD_LOGIC;
295 data_shaping_R1 : OUT STD_LOGIC;
295 data_shaping_R1 : OUT STD_LOGIC;
296 data_shaping_R2 : OUT STD_LOGIC;
296 data_shaping_R2 : OUT STD_LOGIC;
297 delta_snapshot : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
297 delta_snapshot : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
298 delta_f0 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
298 delta_f0 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
299 delta_f0_2 : OUT STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
299 delta_f0_2 : OUT STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
300 delta_f1 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
300 delta_f1 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
301 delta_f2 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
301 delta_f2 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
302 nb_data_by_buffer : OUT STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
302 nb_data_by_buffer : OUT STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
303 nb_snapshot_param : OUT STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
303 nb_snapshot_param : OUT STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
304 enable_f0 : OUT STD_LOGIC;
304 enable_f0 : OUT STD_LOGIC;
305 enable_f1 : OUT STD_LOGIC;
305 enable_f1 : OUT STD_LOGIC;
306 enable_f2 : OUT STD_LOGIC;
306 enable_f2 : OUT STD_LOGIC;
307 enable_f3 : OUT STD_LOGIC;
307 enable_f3 : OUT STD_LOGIC;
308 burst_f0 : OUT STD_LOGIC;
308 burst_f0 : OUT STD_LOGIC;
309 burst_f1 : OUT STD_LOGIC;
309 burst_f1 : OUT STD_LOGIC;
310 burst_f2 : OUT STD_LOGIC;
310 burst_f2 : OUT STD_LOGIC;
311 run : OUT STD_LOGIC;
311 run : OUT STD_LOGIC;
312 start_date : OUT STD_LOGIC_VECTOR(30 DOWNTO 0);
312 start_date : OUT STD_LOGIC_VECTOR(30 DOWNTO 0);
313 wfp_status_buffer_ready : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
313 wfp_status_buffer_ready : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
314 wfp_addr_buffer : OUT STD_LOGIC_VECTOR(32*4 DOWNTO 0);
314 wfp_addr_buffer : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
315 wfp_length_buffer : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
315 wfp_length_buffer : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
316 wfp_ready_buffer : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
316 wfp_ready_buffer : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
317 wfp_buffer_time : IN STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
317 wfp_buffer_time : IN STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
318 wfp_error_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0));
318 wfp_error_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0));
319 END COMPONENT;
319 END COMPONENT;
320
320
321 COMPONENT lpp_top_ms
321 COMPONENT lpp_top_ms
322 GENERIC (
322 GENERIC (
323 Mem_use : INTEGER;
323 Mem_use : INTEGER;
324 nb_burst_available_size : INTEGER;
324 nb_burst_available_size : INTEGER;
325 nb_snapshot_param_size : INTEGER;
325 nb_snapshot_param_size : INTEGER;
326 delta_snapshot_size : INTEGER;
326 delta_snapshot_size : INTEGER;
327 delta_f2_f0_size : INTEGER;
327 delta_f2_f0_size : INTEGER;
328 delta_f2_f1_size : INTEGER;
328 delta_f2_f1_size : INTEGER;
329 pindex : INTEGER;
329 pindex : INTEGER;
330 paddr : INTEGER;
330 paddr : INTEGER;
331 pmask : INTEGER;
331 pmask : INTEGER;
332 pirq_ms : INTEGER;
332 pirq_ms : INTEGER;
333 pirq_wfp : INTEGER;
333 pirq_wfp : INTEGER;
334 hindex_wfp : INTEGER;
334 hindex_wfp : INTEGER;
335 hindex_ms : INTEGER);
335 hindex_ms : INTEGER);
336 PORT (
336 PORT (
337 clk : IN STD_LOGIC;
337 clk : IN STD_LOGIC;
338 rstn : IN STD_LOGIC;
338 rstn : IN STD_LOGIC;
339 sample_B : IN Samples14v(2 DOWNTO 0);
339 sample_B : IN Samples14v(2 DOWNTO 0);
340 sample_E : IN Samples14v(4 DOWNTO 0);
340 sample_E : IN Samples14v(4 DOWNTO 0);
341 sample_val : IN STD_LOGIC;
341 sample_val : IN STD_LOGIC;
342 apbi : IN apb_slv_in_type;
342 apbi : IN apb_slv_in_type;
343 apbo : OUT apb_slv_out_type;
343 apbo : OUT apb_slv_out_type;
344 ahbi_ms : IN AHB_Mst_In_Type;
344 ahbi_ms : IN AHB_Mst_In_Type;
345 ahbo_ms : OUT AHB_Mst_Out_Type;
345 ahbo_ms : OUT AHB_Mst_Out_Type;
346 data_shaping_BW : OUT STD_LOGIC;
346 data_shaping_BW : OUT STD_LOGIC;
347 matrix_time_f0_0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
347 matrix_time_f0_0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
348 matrix_time_f0_1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
348 matrix_time_f0_1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
349 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
349 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
350 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0)
350 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0)
351 );
351 );
352 END COMPONENT;
352 END COMPONENT;
353
353
354 COMPONENT lpp_apbreg_ms_pointer
354 COMPONENT lpp_apbreg_ms_pointer
355 PORT (
355 PORT (
356 clk : IN STD_LOGIC;
356 clk : IN STD_LOGIC;
357 rstn : IN STD_LOGIC;
357 rstn : IN STD_LOGIC;
358 run : IN STD_LOGIC;
358 run : IN STD_LOGIC;
359 reg0_status_ready_matrix : IN STD_LOGIC;
359 reg0_status_ready_matrix : IN STD_LOGIC;
360 reg0_ready_matrix : OUT STD_LOGIC;
360 reg0_ready_matrix : OUT STD_LOGIC;
361 reg0_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
361 reg0_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
362 reg0_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
362 reg0_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
363 reg1_status_ready_matrix : IN STD_LOGIC;
363 reg1_status_ready_matrix : IN STD_LOGIC;
364 reg1_ready_matrix : OUT STD_LOGIC;
364 reg1_ready_matrix : OUT STD_LOGIC;
365 reg1_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
365 reg1_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
366 reg1_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
366 reg1_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
367 ready_matrix : IN STD_LOGIC;
367 ready_matrix : IN STD_LOGIC;
368 status_ready_matrix : OUT STD_LOGIC;
368 status_ready_matrix : OUT STD_LOGIC;
369 addr_matrix : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
369 addr_matrix : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
370 matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0));
370 matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0));
371 END COMPONENT;
371 END COMPONENT;
372
372
373 COMPONENT lpp_lfr_ms_reg_head
373 COMPONENT lpp_lfr_ms_reg_head
374 PORT (
374 PORT (
375 clk : IN STD_LOGIC;
375 clk : IN STD_LOGIC;
376 rstn : IN STD_LOGIC;
376 rstn : IN STD_LOGIC;
377 in_wen : IN STD_LOGIC;
377 in_wen : IN STD_LOGIC;
378 in_data : IN STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
378 in_data : IN STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
379 in_full : IN STD_LOGIC;
379 in_full : IN STD_LOGIC;
380 in_empty : IN STD_LOGIC;
380 in_empty : IN STD_LOGIC;
381 out_wen : OUT STD_LOGIC;
381 out_wen : OUT STD_LOGIC;
382 out_data : OUT STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
382 out_data : OUT STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
383 out_full : OUT STD_LOGIC);
383 out_full : OUT STD_LOGIC);
384 END COMPONENT;
384 END COMPONENT;
385
385
386 END lpp_lfr_pkg;
386 END lpp_lfr_pkg;
@@ -1,471 +1,471
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 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 --f1
102 --f1
103 data_f1_in_valid : IN STD_LOGIC;
103 data_f1_in_valid : IN STD_LOGIC;
104 data_f1_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
104 data_f1_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
105 --f2
105 --f2
106 data_f2_in_valid : IN STD_LOGIC;
106 data_f2_in_valid : IN STD_LOGIC;
107 data_f2_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
107 data_f2_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
108 --f3
108 --f3
109 data_f3_in_valid : IN STD_LOGIC;
109 data_f3_in_valid : IN STD_LOGIC;
110 data_f3_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
110 data_f3_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
111
111
112 ---------------------------------------------------------------------------
112 ---------------------------------------------------------------------------
113 -- DMA --------------------------------------------------------------------
113 -- DMA --------------------------------------------------------------------
114
114
115 dma_fifo_valid_burst : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
115 dma_fifo_valid_burst : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
116 dma_fifo_data : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
116 dma_fifo_data : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
117 dma_fifo_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
117 dma_fifo_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
118 dma_buffer_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
118 dma_buffer_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
119 dma_buffer_addr : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
119 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);
120 dma_buffer_length : OUT STD_LOGIC_VECTOR(26*4-1 DOWNTO 0);
121 dma_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
121 dma_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
122 dma_buffer_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0)
122 dma_buffer_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0)
123
123
124 );
124 );
125
125
126 END lpp_waveform;
126 END lpp_waveform;
127
127
128 ARCHITECTURE beh OF lpp_waveform IS
128 ARCHITECTURE beh OF lpp_waveform IS
129 SIGNAL start_snapshot_f0 : STD_LOGIC;
129 SIGNAL start_snapshot_f0 : STD_LOGIC;
130 SIGNAL start_snapshot_f1 : STD_LOGIC;
130 SIGNAL start_snapshot_f1 : STD_LOGIC;
131 SIGNAL start_snapshot_f2 : STD_LOGIC;
131 SIGNAL start_snapshot_f2 : STD_LOGIC;
132
132
133 SIGNAL data_f0_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
133 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);
134 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);
135 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);
136 SIGNAL data_f3_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
137
137
138 SIGNAL data_f0_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
138 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);
139 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);
140 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);
141 SIGNAL data_f3_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
142
142
143 SIGNAL data_f0_out_valid : STD_LOGIC;
143 SIGNAL data_f0_out_valid : STD_LOGIC;
144 SIGNAL data_f1_out_valid : STD_LOGIC;
144 SIGNAL data_f1_out_valid : STD_LOGIC;
145 SIGNAL data_f2_out_valid : STD_LOGIC;
145 SIGNAL data_f2_out_valid : STD_LOGIC;
146 SIGNAL data_f3_out_valid : STD_LOGIC;
146 SIGNAL data_f3_out_valid : STD_LOGIC;
147 SIGNAL nb_snapshot_param_more_one : STD_LOGIC_VECTOR(nb_snapshot_param_size DOWNTO 0);
147 SIGNAL nb_snapshot_param_more_one : STD_LOGIC_VECTOR(nb_snapshot_param_size DOWNTO 0);
148 --
148 --
149 SIGNAL valid_in : STD_LOGIC_VECTOR(3 DOWNTO 0);
149 SIGNAL valid_in : STD_LOGIC_VECTOR(3 DOWNTO 0);
150 SIGNAL valid_out : STD_LOGIC_VECTOR(3 DOWNTO 0);
150 SIGNAL valid_out : STD_LOGIC_VECTOR(3 DOWNTO 0);
151 SIGNAL valid_ack : STD_LOGIC_VECTOR(3 DOWNTO 0);
151 SIGNAL valid_ack : STD_LOGIC_VECTOR(3 DOWNTO 0);
152 SIGNAL time_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
152 SIGNAL time_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
153 SIGNAL data_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
153 SIGNAL data_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
154 SIGNAL ready_arb : STD_LOGIC_VECTOR(3 DOWNTO 0);
154 SIGNAL ready_arb : STD_LOGIC_VECTOR(3 DOWNTO 0);
155 SIGNAL data_wen : STD_LOGIC_VECTOR(3 DOWNTO 0);
155 SIGNAL data_wen : STD_LOGIC_VECTOR(3 DOWNTO 0);
156 SIGNAL time_wen : STD_LOGIC_VECTOR(3 DOWNTO 0);
156 SIGNAL time_wen : STD_LOGIC_VECTOR(3 DOWNTO 0);
157 SIGNAL wdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
157 SIGNAL wdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
158 SIGNAL full_almost : STD_LOGIC_VECTOR(3 DOWNTO 0);
158 SIGNAL full_almost : STD_LOGIC_VECTOR(3 DOWNTO 0);
159 SIGNAL full : STD_LOGIC_VECTOR(3 DOWNTO 0);
159 SIGNAL full : STD_LOGIC_VECTOR(3 DOWNTO 0);
160 SIGNAL empty_almost : STD_LOGIC_VECTOR(3 DOWNTO 0);
160 SIGNAL empty_almost : STD_LOGIC_VECTOR(3 DOWNTO 0);
161 SIGNAL empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
161 SIGNAL empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
162 --
162 --
163 SIGNAL data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
163 SIGNAL data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
164 SIGNAL time_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
164 SIGNAL time_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
165 SIGNAL rdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
165 SIGNAL rdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
166 SIGNAL enable : STD_LOGIC_VECTOR(3 DOWNTO 0);
166 SIGNAL enable : STD_LOGIC_VECTOR(3 DOWNTO 0);
167 --
167 --
168 SIGNAL run : STD_LOGIC;
168 SIGNAL run : STD_LOGIC;
169 --
169 --
170 TYPE TIME_VECTOR IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(47 DOWNTO 0);
170 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);
171 SIGNAL data_out : Data_Vector(3 DOWNTO 0, 95 DOWNTO 0);
172 SIGNAL time_out_2 : Data_Vector(3 DOWNTO 0, 47 DOWNTO 0);
172 SIGNAL time_out_2 : Data_Vector(3 DOWNTO 0, 47 DOWNTO 0);
173 SIGNAL time_out : TIME_VECTOR(3 DOWNTO 0);
173 SIGNAL time_out : TIME_VECTOR(3 DOWNTO 0);
174 SIGNAL time_out_debug : TIME_VECTOR(3 DOWNTO 0); -- TODO : debug
174 SIGNAL time_out_debug : TIME_VECTOR(3 DOWNTO 0); -- TODO : debug
175 SIGNAL time_reg1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
175 SIGNAL time_reg1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
176 SIGNAL time_reg2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
176 SIGNAL time_reg2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
177 --
177 --
178
178
179 SIGNAL s_empty_almost : STD_LOGIC_VECTOR(3 DOWNTO 0); --occupancy is lesser than 16 * 32b
179 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);
180 SIGNAL s_empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
181 SIGNAL s_data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
181 SIGNAL s_data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0);
182 -- SIGNAL s_rdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
182 -- SIGNAL s_rdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
183 SIGNAL s_rdata_v : STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
183 SIGNAL s_rdata_v : STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
184
184
185 --
185 --
186 SIGNAL arbiter_time_out : STD_LOGIC_VECTOR(47 DOWNTO 0);
186 SIGNAL arbiter_time_out : STD_LOGIC_VECTOR(47 DOWNTO 0);
187 SIGNAL arbiter_time_out_new : STD_LOGIC_VECTOR(3 DOWNTO 0);
187 SIGNAL arbiter_time_out_new : STD_LOGIC_VECTOR(3 DOWNTO 0);
188
188
189 SIGNAL fifo_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
189 SIGNAL fifo_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
190
190
191 BEGIN -- beh
191 BEGIN -- beh
192
192
193 -----------------------------------------------------------------------------
193 -----------------------------------------------------------------------------
194
194
195 lpp_waveform_snapshot_controler_1 : lpp_waveform_snapshot_controler
195 lpp_waveform_snapshot_controler_1 : lpp_waveform_snapshot_controler
196 GENERIC MAP (
196 GENERIC MAP (
197 delta_vector_size => delta_vector_size,
197 delta_vector_size => delta_vector_size,
198 delta_vector_size_f0_2 => delta_vector_size_f0_2
198 delta_vector_size_f0_2 => delta_vector_size_f0_2
199 )
199 )
200 PORT MAP (
200 PORT MAP (
201 clk => clk,
201 clk => clk,
202 rstn => rstn,
202 rstn => rstn,
203 reg_run => reg_run,
203 reg_run => reg_run,
204 reg_start_date => reg_start_date,
204 reg_start_date => reg_start_date,
205 reg_delta_snapshot => reg_delta_snapshot,
205 reg_delta_snapshot => reg_delta_snapshot,
206 reg_delta_f0 => reg_delta_f0,
206 reg_delta_f0 => reg_delta_f0,
207 reg_delta_f0_2 => reg_delta_f0_2,
207 reg_delta_f0_2 => reg_delta_f0_2,
208 reg_delta_f1 => reg_delta_f1,
208 reg_delta_f1 => reg_delta_f1,
209 reg_delta_f2 => reg_delta_f2,
209 reg_delta_f2 => reg_delta_f2,
210 coarse_time => coarse_time(30 DOWNTO 0),
210 coarse_time => coarse_time(30 DOWNTO 0),
211 data_f0_valid => data_f0_in_valid,
211 data_f0_valid => data_f0_in_valid,
212 data_f2_valid => data_f2_in_valid,
212 data_f2_valid => data_f2_in_valid,
213 start_snapshot_f0 => start_snapshot_f0,
213 start_snapshot_f0 => start_snapshot_f0,
214 start_snapshot_f1 => start_snapshot_f1,
214 start_snapshot_f1 => start_snapshot_f1,
215 start_snapshot_f2 => start_snapshot_f2,
215 start_snapshot_f2 => start_snapshot_f2,
216 wfp_on => run);
216 wfp_on => run);
217
217
218 lpp_waveform_snapshot_f0 : lpp_waveform_snapshot
218 lpp_waveform_snapshot_f0 : lpp_waveform_snapshot
219 GENERIC MAP (
219 GENERIC MAP (
220 data_size => data_size,
220 data_size => data_size,
221 nb_snapshot_param_size => nb_snapshot_param_size)
221 nb_snapshot_param_size => nb_snapshot_param_size)
222 PORT MAP (
222 PORT MAP (
223 clk => clk,
223 clk => clk,
224 rstn => rstn,
224 rstn => rstn,
225 run => run,
225 run => run,
226 enable => enable_f0,
226 enable => enable_f0,
227 burst_enable => burst_f0,
227 burst_enable => burst_f0,
228 nb_snapshot_param => nb_snapshot_param,
228 nb_snapshot_param => nb_snapshot_param,
229 start_snapshot => start_snapshot_f0,
229 start_snapshot => start_snapshot_f0,
230 data_in => data_f0_in,
230 data_in => data_f0_in,
231 data_in_valid => data_f0_in_valid,
231 data_in_valid => data_f0_in_valid,
232 data_out => data_f0_out,
232 data_out => data_f0_out,
233 data_out_valid => data_f0_out_valid);
233 data_out_valid => data_f0_out_valid);
234
234
235 nb_snapshot_param_more_one <= ('0' & nb_snapshot_param) ;--+ 1;
235 nb_snapshot_param_more_one <= ('0' & nb_snapshot_param) ;--+ 1;
236
236
237 lpp_waveform_snapshot_f1 : lpp_waveform_snapshot
237 lpp_waveform_snapshot_f1 : lpp_waveform_snapshot
238 GENERIC MAP (
238 GENERIC MAP (
239 data_size => data_size,
239 data_size => data_size,
240 nb_snapshot_param_size => nb_snapshot_param_size+1)
240 nb_snapshot_param_size => nb_snapshot_param_size+1)
241 PORT MAP (
241 PORT MAP (
242 clk => clk,
242 clk => clk,
243 rstn => rstn,
243 rstn => rstn,
244 run => run,
244 run => run,
245 enable => enable_f1,
245 enable => enable_f1,
246 burst_enable => burst_f1,
246 burst_enable => burst_f1,
247 nb_snapshot_param => nb_snapshot_param_more_one,
247 nb_snapshot_param => nb_snapshot_param_more_one,
248 start_snapshot => start_snapshot_f1,
248 start_snapshot => start_snapshot_f1,
249 data_in => data_f1_in,
249 data_in => data_f1_in,
250 data_in_valid => data_f1_in_valid,
250 data_in_valid => data_f1_in_valid,
251 data_out => data_f1_out,
251 data_out => data_f1_out,
252 data_out_valid => data_f1_out_valid);
252 data_out_valid => data_f1_out_valid);
253
253
254 lpp_waveform_snapshot_f2 : lpp_waveform_snapshot
254 lpp_waveform_snapshot_f2 : lpp_waveform_snapshot
255 GENERIC MAP (
255 GENERIC MAP (
256 data_size => data_size,
256 data_size => data_size,
257 nb_snapshot_param_size => nb_snapshot_param_size+1)
257 nb_snapshot_param_size => nb_snapshot_param_size+1)
258 PORT MAP (
258 PORT MAP (
259 clk => clk,
259 clk => clk,
260 rstn => rstn,
260 rstn => rstn,
261 run => run,
261 run => run,
262 enable => enable_f2,
262 enable => enable_f2,
263 burst_enable => burst_f2,
263 burst_enable => burst_f2,
264 nb_snapshot_param => nb_snapshot_param_more_one,
264 nb_snapshot_param => nb_snapshot_param_more_one,
265 start_snapshot => start_snapshot_f2,
265 start_snapshot => start_snapshot_f2,
266 data_in => data_f2_in,
266 data_in => data_f2_in,
267 data_in_valid => data_f2_in_valid,
267 data_in_valid => data_f2_in_valid,
268 data_out => data_f2_out,
268 data_out => data_f2_out,
269 data_out_valid => data_f2_out_valid);
269 data_out_valid => data_f2_out_valid);
270
270
271 lpp_waveform_burst_f3 : lpp_waveform_burst
271 lpp_waveform_burst_f3 : lpp_waveform_burst
272 GENERIC MAP (
272 GENERIC MAP (
273 data_size => data_size)
273 data_size => data_size)
274 PORT MAP (
274 PORT MAP (
275 clk => clk,
275 clk => clk,
276 rstn => rstn,
276 rstn => rstn,
277 run => run,
277 run => run,
278 enable => enable_f3,
278 enable => enable_f3,
279 data_in => data_f3_in,
279 data_in => data_f3_in,
280 data_in_valid => data_f3_in_valid,
280 data_in_valid => data_f3_in_valid,
281 data_out => data_f3_out,
281 data_out => data_f3_out,
282 data_out_valid => data_f3_out_valid);
282 data_out_valid => data_f3_out_valid);
283
283
284 -----------------------------------------------------------------------------
284 -----------------------------------------------------------------------------
285 -- DEBUG -- SNAPSHOT OUT
285 -- DEBUG -- SNAPSHOT OUT
286 --debug_f0_data_valid <= data_f0_out_valid;
286 --debug_f0_data_valid <= data_f0_out_valid;
287 --debug_f0_data <= data_f0_out;
287 --debug_f0_data <= data_f0_out;
288 --debug_f1_data_valid <= data_f1_out_valid;
288 --debug_f1_data_valid <= data_f1_out_valid;
289 --debug_f1_data <= data_f1_out;
289 --debug_f1_data <= data_f1_out;
290 --debug_f2_data_valid <= data_f2_out_valid;
290 --debug_f2_data_valid <= data_f2_out_valid;
291 --debug_f2_data <= data_f2_out;
291 --debug_f2_data <= data_f2_out;
292 --debug_f3_data_valid <= data_f3_out_valid;
292 --debug_f3_data_valid <= data_f3_out_valid;
293 --debug_f3_data <= data_f3_out;
293 --debug_f3_data <= data_f3_out;
294 -----------------------------------------------------------------------------
294 -----------------------------------------------------------------------------
295
295
296 PROCESS (clk, rstn)
296 PROCESS (clk, rstn)
297 BEGIN -- PROCESS
297 BEGIN -- PROCESS
298 IF rstn = '0' THEN -- asynchronous reset (active low)
298 IF rstn = '0' THEN -- asynchronous reset (active low)
299 time_reg1 <= (OTHERS => '0');
299 time_reg1 <= (OTHERS => '0');
300 time_reg2 <= (OTHERS => '0');
300 time_reg2 <= (OTHERS => '0');
301 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
301 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
302 time_reg1 <= fine_time & coarse_time;
302 time_reg1 <= fine_time & coarse_time;
303 time_reg2 <= time_reg1;
303 time_reg2 <= time_reg1;
304 END IF;
304 END IF;
305 END PROCESS;
305 END PROCESS;
306
306
307 valid_in <= data_f3_out_valid & data_f2_out_valid & data_f1_out_valid & data_f0_out_valid;
307 valid_in <= data_f3_out_valid & data_f2_out_valid & data_f1_out_valid & data_f0_out_valid;
308 all_input_valid : FOR i IN 3 DOWNTO 0 GENERATE
308 all_input_valid : FOR i IN 3 DOWNTO 0 GENERATE
309 lpp_waveform_dma_genvalid_I : lpp_waveform_dma_genvalid
309 lpp_waveform_dma_genvalid_I : lpp_waveform_dma_genvalid
310 PORT MAP (
310 PORT MAP (
311 HCLK => clk,
311 HCLK => clk,
312 HRESETn => rstn,
312 HRESETn => rstn,
313 run => run,
313 run => run,
314 valid_in => valid_in(I),
314 valid_in => valid_in(I),
315 ack_in => valid_ack(I),
315 ack_in => valid_ack(I),
316 time_in => time_reg2, -- Todo
316 time_in => time_reg2, -- Todo
317 valid_out => valid_out(I),
317 valid_out => valid_out(I),
318 time_out => time_out(I), -- Todo
318 time_out => time_out(I), -- Todo
319 error => status_new_err(I));
319 error => status_new_err(I));
320 END GENERATE all_input_valid;
320 END GENERATE all_input_valid;
321
321
322 data_f0_out_swap <= data_f0_out((16*5)-1 DOWNTO 16*4) &
322 data_f0_out_swap <= data_f0_out((16*5)-1 DOWNTO 16*4) &
323 data_f0_out((16*6)-1 DOWNTO 16*5) &
323 data_f0_out((16*6)-1 DOWNTO 16*5) &
324 data_f0_out((16*3)-1 DOWNTO 16*2) &
324 data_f0_out((16*3)-1 DOWNTO 16*2) &
325 data_f0_out((16*4)-1 DOWNTO 16*3) &
325 data_f0_out((16*4)-1 DOWNTO 16*3) &
326 data_f0_out((16*1)-1 DOWNTO 16*0) &
326 data_f0_out((16*1)-1 DOWNTO 16*0) &
327 data_f0_out((16*2)-1 DOWNTO 16*1) ;
327 data_f0_out((16*2)-1 DOWNTO 16*1) ;
328
328
329 data_f1_out_swap <= data_f1_out((16*5)-1 DOWNTO 16*4) &
329 data_f1_out_swap <= data_f1_out((16*5)-1 DOWNTO 16*4) &
330 data_f1_out((16*6)-1 DOWNTO 16*5) &
330 data_f1_out((16*6)-1 DOWNTO 16*5) &
331 data_f1_out((16*3)-1 DOWNTO 16*2) &
331 data_f1_out((16*3)-1 DOWNTO 16*2) &
332 data_f1_out((16*4)-1 DOWNTO 16*3) &
332 data_f1_out((16*4)-1 DOWNTO 16*3) &
333 data_f1_out((16*1)-1 DOWNTO 16*0) &
333 data_f1_out((16*1)-1 DOWNTO 16*0) &
334 data_f1_out((16*2)-1 DOWNTO 16*1) ;
334 data_f1_out((16*2)-1 DOWNTO 16*1) ;
335
335
336 data_f2_out_swap <= data_f2_out((16*5)-1 DOWNTO 16*4) &
336 data_f2_out_swap <= data_f2_out((16*5)-1 DOWNTO 16*4) &
337 data_f2_out((16*6)-1 DOWNTO 16*5) &
337 data_f2_out((16*6)-1 DOWNTO 16*5) &
338 data_f2_out((16*3)-1 DOWNTO 16*2) &
338 data_f2_out((16*3)-1 DOWNTO 16*2) &
339 data_f2_out((16*4)-1 DOWNTO 16*3) &
339 data_f2_out((16*4)-1 DOWNTO 16*3) &
340 data_f2_out((16*1)-1 DOWNTO 16*0) &
340 data_f2_out((16*1)-1 DOWNTO 16*0) &
341 data_f2_out((16*2)-1 DOWNTO 16*1) ;
341 data_f2_out((16*2)-1 DOWNTO 16*1) ;
342
342
343 data_f3_out_swap <= data_f3_out((16*5)-1 DOWNTO 16*4) &
343 data_f3_out_swap <= data_f3_out((16*5)-1 DOWNTO 16*4) &
344 data_f3_out((16*6)-1 DOWNTO 16*5) &
344 data_f3_out((16*6)-1 DOWNTO 16*5) &
345 data_f3_out((16*3)-1 DOWNTO 16*2) &
345 data_f3_out((16*3)-1 DOWNTO 16*2) &
346 data_f3_out((16*4)-1 DOWNTO 16*3) &
346 data_f3_out((16*4)-1 DOWNTO 16*3) &
347 data_f3_out((16*1)-1 DOWNTO 16*0) &
347 data_f3_out((16*1)-1 DOWNTO 16*0) &
348 data_f3_out((16*2)-1 DOWNTO 16*1) ;
348 data_f3_out((16*2)-1 DOWNTO 16*1) ;
349
349
350 all_bit_of_data_out : FOR I IN 95 DOWNTO 0 GENERATE
350 all_bit_of_data_out : FOR I IN 95 DOWNTO 0 GENERATE
351 data_out(0, I) <= data_f0_out_swap(I);
351 data_out(0, I) <= data_f0_out_swap(I);
352 data_out(1, I) <= data_f1_out_swap(I);
352 data_out(1, I) <= data_f1_out_swap(I);
353 data_out(2, I) <= data_f2_out_swap(I);
353 data_out(2, I) <= data_f2_out_swap(I);
354 data_out(3, I) <= data_f3_out_swap(I);
354 data_out(3, I) <= data_f3_out_swap(I);
355 END GENERATE all_bit_of_data_out;
355 END GENERATE all_bit_of_data_out;
356
356
357 -----------------------------------------------------------------------------
357 -----------------------------------------------------------------------------
358 -- TODO : debug
358 -- TODO : debug
359 -----------------------------------------------------------------------------
359 -----------------------------------------------------------------------------
360 all_bit_of_time_out : FOR I IN 47 DOWNTO 0 GENERATE
360 all_bit_of_time_out : FOR I IN 47 DOWNTO 0 GENERATE
361 all_sample_of_time_out : FOR J IN 3 DOWNTO 0 GENERATE
361 all_sample_of_time_out : FOR J IN 3 DOWNTO 0 GENERATE
362 time_out_2(J, I) <= time_out(J)(I);
362 time_out_2(J, I) <= time_out(J)(I);
363 END GENERATE all_sample_of_time_out;
363 END GENERATE all_sample_of_time_out;
364 END GENERATE all_bit_of_time_out;
364 END GENERATE all_bit_of_time_out;
365
365
366 lpp_waveform_fifo_arbiter_1 : lpp_waveform_fifo_arbiter
366 lpp_waveform_fifo_arbiter_1 : lpp_waveform_fifo_arbiter
367 GENERIC MAP (tech => tech,
367 GENERIC MAP (tech => tech,
368 nb_data_by_buffer_size => nb_data_by_buffer_size)
368 nb_data_by_buffer_size => nb_data_by_buffer_size)
369 PORT MAP (
369 PORT MAP (
370 clk => clk,
370 clk => clk,
371 rstn => rstn,
371 rstn => rstn,
372 run => run,
372 run => run,
373 nb_data_by_buffer => nb_data_by_buffer,
373 nb_data_by_buffer => nb_data_by_buffer,
374 data_in_valid => valid_out,
374 data_in_valid => valid_out,
375 data_in_ack => valid_ack,
375 data_in_ack => valid_ack,
376 data_in => data_out,
376 data_in => data_out,
377 time_in => time_out_2,
377 time_in => time_out_2,
378
378
379 data_out => wdata,
379 data_out => wdata,
380 data_out_wen => data_wen,
380 data_out_wen => data_wen,
381 full_almost => full_almost,
381 full_almost => full_almost,
382 full => full,
382 full => full,
383
383
384 time_out => arbiter_time_out,
384 time_out => arbiter_time_out,
385 time_out_new => arbiter_time_out_new
385 time_out_new => arbiter_time_out_new
386
386
387 );
387 );
388
388
389 -----------------------------------------------------------------------------
389 -----------------------------------------------------------------------------
390 -----------------------------------------------------------------------------
390 -----------------------------------------------------------------------------
391
391
392 generate_all_fifo: FOR I IN 0 TO 3 GENERATE
392 generate_all_fifo: FOR I IN 0 TO 3 GENERATE
393 lpp_fifo_1: lpp_fifo
393 lpp_fifo_1: lpp_fifo
394 GENERIC MAP (
394 GENERIC MAP (
395 tech => tech,
395 tech => tech,
396 Mem_use => use_RAM,
396 Mem_use => use_RAM,
397 EMPTY_THRESHOLD_LIMIT => 15,
397 EMPTY_THRESHOLD_LIMIT => 15,
398 FULL_THRESHOLD_LIMIT => 3,
398 FULL_THRESHOLD_LIMIT => 3,
399 DataSz => 32,
399 DataSz => 32,
400 AddrSz => 7)
400 AddrSz => 7)
401 PORT MAP (
401 PORT MAP (
402 clk => clk,
402 clk => clk,
403 rstn => rstn,
403 rstn => rstn,
404 reUse => '0',
404 reUse => '0',
405 run => run,
405 run => run,
406 ren => data_ren(I),
406 ren => data_ren(I),
407 rdata => s_rdata_v((I+1)*32-1 downto I*32),
407 rdata => s_rdata_v((I+1)*32-1 downto I*32),
408 wen => data_wen(I),
408 wen => data_wen(I),
409 wdata => wdata,
409 wdata => wdata,
410 empty => empty(I),
410 empty => empty(I),
411 full => full(I),
411 full => full(I),
412 full_almost => OPEN,
412 full_almost => OPEN,
413 empty_threshold => empty_almost(I),
413 empty_threshold => empty_almost(I),
414 full_threshold => full_almost(I) );
414 full_threshold => full_almost(I) );
415
415
416 END GENERATE generate_all_fifo;
416 END GENERATE generate_all_fifo;
417
417
418 -----------------------------------------------------------------------------
418 -----------------------------------------------------------------------------
419 --
419 --
420 -----------------------------------------------------------------------------
420 -----------------------------------------------------------------------------
421
421
422 all_channel: FOR I IN 3 DOWNTO 0 GENERATE
422 all_channel: FOR I IN 3 DOWNTO 0 GENERATE
423
423
424 PROCESS (clk, rstn)
424 PROCESS (clk, rstn)
425 BEGIN
425 BEGIN
426 IF rstn = '0' THEN
426 IF rstn = '0' THEN
427 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0');
427 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0');
428 ELSIF clk'event AND clk = '1' THEN
428 ELSIF clk'event AND clk = '1' THEN
429 IF run = '0' THEN
429 IF run = '0' THEN
430 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0');
430 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0');
431 ELSE
431 ELSE
432 IF arbiter_time_out_new(I) = '0' THEN
432 IF arbiter_time_out_new(I) = '0' THEN
433 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= arbiter_time_out;
433 fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= arbiter_time_out;
434 END IF;
434 END IF;
435 END IF;
435 END IF;
436 END IF;
436 END IF;
437 END PROCESS;
437 END PROCESS;
438
438
439 lpp_waveform_fsmdma_I: lpp_waveform_fsmdma
439 lpp_waveform_fsmdma_I: lpp_waveform_fsmdma
440 PORT MAP (
440 PORT MAP (
441 clk => clk,
441 clk => clk,
442 rstn => rstn,
442 rstn => rstn,
443 run => run,
443 run => run,
444
444
445 fifo_buffer_time => fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I),
445 fifo_buffer_time => fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I),
446
446
447 fifo_data => s_rdata_v(32*(I+1)-1 DOWNTO 32*I),
447 fifo_data => s_rdata_v(32*(I+1)-1 DOWNTO 32*I),
448 fifo_empty => empty(I),
448 fifo_empty => empty(I),
449 fifo_empty_threshold => empty_almost(I),
449 fifo_empty_threshold => empty_almost(I),
450 fifo_ren => data_ren(I),
450 fifo_ren => data_ren(I),
451
451
452 dma_fifo_valid_burst => dma_fifo_valid_burst(I),
452 dma_fifo_valid_burst => dma_fifo_valid_burst(I),
453 dma_fifo_data => dma_fifo_data(32*(I+1)-1 DOWNTO 32*I),
453 dma_fifo_data => dma_fifo_data(32*(I+1)-1 DOWNTO 32*I),
454 dma_fifo_ren => dma_fifo_ren(I),
454 dma_fifo_ren => dma_fifo_ren(I),
455 dma_buffer_new => dma_buffer_new(I),
455 dma_buffer_new => dma_buffer_new(I),
456 dma_buffer_addr => dma_buffer_addr(32*(I+1)-1 DOWNTO 32*I),
456 dma_buffer_addr => dma_buffer_addr(32*(I+1)-1 DOWNTO 32*I),
457 dma_buffer_length => dma_buffer_length(26*(I+1)-1 DOWNTO 26*I),
457 dma_buffer_length => dma_buffer_length(26*(I+1)-1 DOWNTO 26*I),
458 dma_buffer_full => dma_buffer_full(I),
458 dma_buffer_full => dma_buffer_full(I),
459 dma_buffer_full_err => dma_buffer_full_err(I),
459 dma_buffer_full_err => dma_buffer_full_err(I),
460
460
461 status_buffer_ready => status_buffer_ready(I), -- TODO
461 status_buffer_ready => status_buffer_ready(I), -- TODO
462 addr_buffer => addr_buffer(32*(I+1)-1 DOWNTO 32*I), -- TODO
462 addr_buffer => addr_buffer(32*(I+1)-1 DOWNTO 32*I), -- TODO
463 length_buffer => length_buffer,--(26*(I+1)-1 DOWNTO 26*I), -- TODO
463 length_buffer => length_buffer,--(26*(I+1)-1 DOWNTO 26*I), -- TODO
464 ready_buffer => ready_buffer(I), -- TODO
464 ready_buffer => ready_buffer(I), -- TODO
465 buffer_time => buffer_time(48*(I+1)-1 DOWNTO 48*I), -- TODO
465 buffer_time => buffer_time(48*(I+1)-1 DOWNTO 48*I), -- TODO
466 error_buffer_full => error_buffer_full(I)); -- TODO
466 error_buffer_full => error_buffer_full(I)); -- TODO
467
467
468 END GENERATE all_channel;
468 END GENERATE all_channel;
469
469
470
470
471 END beh;
471 END beh;
@@ -1,270 +1,269
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 - 2012, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2012, 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.std_logic_1164.ALL;
23 USE IEEE.std_logic_1164.ALL;
24 USE IEEE.numeric_std.ALL;
24 USE IEEE.numeric_std.ALL;
25
25
26 LIBRARY lpp;
26 LIBRARY lpp;
27 USE lpp.lpp_waveform_pkg.ALL;
27 USE lpp.lpp_waveform_pkg.ALL;
28 USE lpp.general_purpose.ALL;
28 USE lpp.general_purpose.ALL;
29
29
30 ENTITY lpp_waveform_fifo_arbiter IS
30 ENTITY lpp_waveform_fifo_arbiter IS
31 GENERIC(
31 GENERIC(
32 tech : INTEGER := 0;
32 tech : INTEGER := 0;
33 nb_data_by_buffer_size : INTEGER := 11
33 nb_data_by_buffer_size : INTEGER := 11
34 );
34 );
35 PORT(
35 PORT(
36 clk : IN STD_LOGIC;
36 clk : IN STD_LOGIC;
37 rstn : IN STD_LOGIC;
37 rstn : IN STD_LOGIC;
38 ---------------------------------------------------------------------------
38 ---------------------------------------------------------------------------
39 run : IN STD_LOGIC;
39 run : IN STD_LOGIC;
40 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size - 1 DOWNTO 0);
40 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size - 1 DOWNTO 0);
41 ---------------------------------------------------------------------------
41 ---------------------------------------------------------------------------
42 -- SNAPSHOT INTERFACE (INPUT)
42 -- SNAPSHOT INTERFACE (INPUT)
43 ---------------------------------------------------------------------------
43 ---------------------------------------------------------------------------
44 data_in_valid : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
44 data_in_valid : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
45 data_in_ack : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
45 data_in_ack : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
46 data_in : IN Data_Vector(3 DOWNTO 0, 95 DOWNTO 0);
46 data_in : IN Data_Vector(3 DOWNTO 0, 95 DOWNTO 0);
47
47
48 time_in : IN Data_Vector(3 DOWNTO 0, 47 DOWNTO 0);
48 time_in : IN Data_Vector(3 DOWNTO 0, 47 DOWNTO 0);
49
49
50 ---------------------------------------------------------------------------
50 ---------------------------------------------------------------------------
51 -- FIFO INTERFACE (OUTPUT)
51 -- FIFO INTERFACE (OUTPUT)
52 ---------------------------------------------------------------------------
52 ---------------------------------------------------------------------------
53 data_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
53 data_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
54 data_out_wen : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
54 data_out_wen : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
55 full_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
55 full_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
56 full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
56 full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
57
57
58 ---------------------------------------------------------------------------
58 ---------------------------------------------------------------------------
59 -- TIME INTERFACE (OUTPUT)
59 -- TIME INTERFACE (OUTPUT)
60 ---------------------------------------------------------------------------
60 ---------------------------------------------------------------------------
61 time_out : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
61 time_out : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
62 time_out_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
62 time_out_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
63
63
64 );
64 );
65 END ENTITY;
65 END ENTITY;
66
66
67
67
68 ARCHITECTURE ar_lpp_waveform_fifo_arbiter OF lpp_waveform_fifo_arbiter IS
68 ARCHITECTURE ar_lpp_waveform_fifo_arbiter OF lpp_waveform_fifo_arbiter IS
69 TYPE state_type_fifo_arbiter IS (IDLE,DATA1,DATA2,DATA3,LAST);
69 TYPE state_type_fifo_arbiter IS (IDLE,DATA1,DATA2,DATA3,LAST);
70 SIGNAL state : state_type_fifo_arbiter;
70 SIGNAL state : state_type_fifo_arbiter;
71
71
72 -----------------------------------------------------------------------------
72 -----------------------------------------------------------------------------
73 -- DATA MUX
73 -- DATA MUX
74 -----------------------------------------------------------------------------
74 -----------------------------------------------------------------------------
75 TYPE WORD_VECTOR IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(31 DOWNTO 0);
75 TYPE WORD_VECTOR IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(31 DOWNTO 0);
76 SIGNAL data_0 : WORD_VECTOR(3 DOWNTO 0);
76 SIGNAL data_0 : WORD_VECTOR(2 DOWNTO 0);
77 SIGNAL data_1 : WORD_VECTOR(3 DOWNTO 0);
77 SIGNAL data_1 : WORD_VECTOR(2 DOWNTO 0);
78 SIGNAL data_2 : WORD_VECTOR(3 DOWNTO 0);
78 SIGNAL data_2 : WORD_VECTOR(2 DOWNTO 0);
79 SIGNAL data_3 : WORD_VECTOR(3 DOWNTO 0);
79 SIGNAL data_3 : WORD_VECTOR(2 DOWNTO 0);
80 SIGNAL data_sel : WORD_VECTOR(3 DOWNTO 0);
80 SIGNAL data_sel : WORD_VECTOR(2 DOWNTO 0);
81
81
82 -----------------------------------------------------------------------------
82 -----------------------------------------------------------------------------
83 -- RR and SELECTION
83 -- RR and SELECTION
84 -----------------------------------------------------------------------------
84 -----------------------------------------------------------------------------
85 SIGNAL valid_in_rr : STD_LOGIC_VECTOR(3 DOWNTO 0);
85 SIGNAL valid_in_rr : STD_LOGIC_VECTOR(3 DOWNTO 0);
86 SIGNAL sel : STD_LOGIC_VECTOR(3 DOWNTO 0);
86 SIGNAL sel : STD_LOGIC_VECTOR(3 DOWNTO 0);
87 SIGNAL sel_s : STD_LOGIC_VECTOR(3 DOWNTO 0);
87 SIGNAL sel_s : STD_LOGIC_VECTOR(3 DOWNTO 0);
88 SIGNAL sel_reg : STD_LOGIC;
88 SIGNAL sel_reg : STD_LOGIC;
89 SIGNAL sel_ack : STD_LOGIC;
89 SIGNAL sel_ack : STD_LOGIC;
90 SIGNAL no_sel : STD_LOGIC;
90 SIGNAL no_sel : STD_LOGIC;
91
91
92 -----------------------------------------------------------------------------
92 -----------------------------------------------------------------------------
93 -- REG
93 -- REG
94 -----------------------------------------------------------------------------
94 -----------------------------------------------------------------------------
95 SIGNAL count_enable : STD_LOGIC;
95 SIGNAL count_enable : STD_LOGIC;
96 SIGNAL count : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
96 SIGNAL count : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
97 SIGNAL count_s : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
97 SIGNAL count_s : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
98
98
99 SIGNAL time_sel : STD_LOGIC_VECTOR(47 DOWNTO 0);
99 SIGNAL time_sel : STD_LOGIC_VECTOR(47 DOWNTO 0);
100
100
101 BEGIN
101 BEGIN
102
102
103 -----------------------------------------------------------------------------
103 -----------------------------------------------------------------------------
104 -- CONTROL
104 -- CONTROL
105 -----------------------------------------------------------------------------
105 -----------------------------------------------------------------------------
106 PROCESS (clk, rstn)
106 PROCESS (clk, rstn)
107 BEGIN -- PROCESS
107 BEGIN -- PROCESS
108 IF rstn = '0' THEN -- asynchronous reset (active low)
108 IF rstn = '0' THEN -- asynchronous reset (active low)
109 count_enable <= '0';
109 count_enable <= '0';
110 data_in_ack <= (OTHERS => '0');
110 data_in_ack <= (OTHERS => '0');
111 data_out_wen <= (OTHERS => '1');
111 data_out_wen <= (OTHERS => '1');
112 sel_ack <= '0';
112 sel_ack <= '0';
113 state <= IDLE;
113 state <= IDLE;
114 time_out <= (OTHERS => '0');
114 time_out <= (OTHERS => '0');
115 time_out_new <= (OTHERS => '0');
115 time_out_new <= (OTHERS => '0');
116 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
116 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
117 count_enable <= '0';
117 count_enable <= '0';
118 data_in_ack <= (OTHERS => '0');
118 data_in_ack <= (OTHERS => '0');
119 data_out_wen <= (OTHERS => '1');
119 data_out_wen <= (OTHERS => '1');
120 sel_ack <= '0';
120 sel_ack <= '0';
121 time_out_new <= (OTHERS => '0');
121 time_out_new <= (OTHERS => '0');
122 IF run = '0' THEN
122 IF run = '0' THEN
123 state <= IDLE;
123 state <= IDLE;
124 time_out <= (OTHERS => '0');
124 time_out <= (OTHERS => '0');
125 ELSE
125 ELSE
126 CASE state IS
126 CASE state IS
127 WHEN IDLE =>
127 WHEN IDLE =>
128 IF no_sel = '0' THEN
128 IF no_sel = '0' THEN
129 state <= DATA1;
129 state <= DATA1;
130 END IF;
130 END IF;
131 WHEN DATA1 =>
131 WHEN DATA1 =>
132 count_enable <= '1';
132 count_enable <= '1';
133 IF UNSIGNED(count) = 0 THEN
133 IF UNSIGNED(count) = 0 THEN
134 time_out <= time_sel;
134 time_out <= time_sel;
135 time_out_new <= sel;
135 time_out_new <= sel;
136 END IF;
136 END IF;
137 data_out_wen <= NOT sel;
137 data_out_wen <= NOT sel;
138 data_out <= data_sel(0);
138 data_out <= data_sel(0);
139 state <= DATA2;
139 state <= DATA2;
140 WHEN DATA2 =>
140 WHEN DATA2 =>
141 data_out_wen <= NOT sel;
141 data_out_wen <= NOT sel;
142 data_out <= data_sel(1);
142 data_out <= data_sel(1);
143 state <= DATA3;
143 state <= DATA3;
144 WHEN DATA3 =>
144 WHEN DATA3 =>
145 data_out_wen <= NOT sel;
145 data_out_wen <= NOT sel;
146 data_out <= data_sel(2);
146 data_out <= data_sel(2);
147 state <= LAST;
147 state <= LAST;
148 data_in_ack <= sel;
148 data_in_ack <= sel;
149 WHEN LAST =>
149 WHEN LAST =>
150 state <= IDLE;
150 state <= IDLE;
151 sel_ack <= '1';
151 sel_ack <= '1';
152
152
153 WHEN OTHERS => NULL;
153 WHEN OTHERS => NULL;
154 END CASE;
154 END CASE;
155 END IF;
155 END IF;
156 END IF;
156 END IF;
157 END PROCESS;
157 END PROCESS;
158 -----------------------------------------------------------------------------
158 -----------------------------------------------------------------------------
159
159
160 -----------------------------------------------------------------------------
160 -----------------------------------------------------------------------------
161 -- DATA MUX
161 -- DATA MUX
162 -----------------------------------------------------------------------------
162 -----------------------------------------------------------------------------
163
163
164 all_word: FOR J IN 2 DOWNTO 0 GENERATE
164 all_word: FOR J IN 2 DOWNTO 0 GENERATE
165 all_data_bit: FOR I IN 31 DOWNTO 0 GENERATE
165 all_data_bit: FOR I IN 31 DOWNTO 0 GENERATE
166 data_0(J)(I) <= data_in(0,I+32*J);
166 data_0(J)(I) <= data_in(0,I+32*J);
167 data_1(J)(I) <= data_in(1,I+32*J);
167 data_1(J)(I) <= data_in(1,I+32*J);
168 data_2(J)(I) <= data_in(2,I+32*J);
168 data_2(J)(I) <= data_in(2,I+32*J);
169 data_3(J)(I) <= data_in(3,I+32*J);
169 data_3(J)(I) <= data_in(3,I+32*J);
170 END GENERATE all_data_bit;
170 END GENERATE all_data_bit;
171 END GENERATE all_word;
171 END GENERATE all_word;
172
172
173 data_sel <= data_0 WHEN sel(0) = '1' ELSE
173 data_sel <= data_0 WHEN sel(0) = '1' ELSE
174 data_1 WHEN sel(1) = '1' ELSE
174 data_1 WHEN sel(1) = '1' ELSE
175 data_2 WHEN sel(2) = '1' ELSE
175 data_2 WHEN sel(2) = '1' ELSE
176 data_3;
176 data_3;
177
177
178 all_time_bit: FOR I IN 47 DOWNTO 0 GENERATE
178 all_time_bit: FOR I IN 47 DOWNTO 0 GENERATE
179
179
180 time_sel(I) <= time_in(0,I) WHEN sel(0) = '1' ELSE
180 time_sel(I) <= time_in(0,I) WHEN sel(0) = '1' ELSE
181 time_in(1,I) WHEN sel(1) = '1' ELSE
181 time_in(1,I) WHEN sel(1) = '1' ELSE
182 time_in(2,I) WHEN sel(2) = '1' ELSE
182 time_in(2,I) WHEN sel(2) = '1' ELSE
183 time_in(3,I);
183 time_in(3,I);
184 END GENERATE all_time_bit;
184 END GENERATE all_time_bit;
185
185
186
186
187 -----------------------------------------------------------------------------
187 -----------------------------------------------------------------------------
188 -- RR and SELECTION
188 -- RR and SELECTION
189 -----------------------------------------------------------------------------
189 -----------------------------------------------------------------------------
190 all_input_rr : FOR I IN 3 DOWNTO 0 GENERATE
190 all_input_rr : FOR I IN 3 DOWNTO 0 GENERATE
191 valid_in_rr(I) <= data_in_valid(I) AND NOT full_almost(I);
191 valid_in_rr(I) <= data_in_valid(I) AND NOT full_almost(I);
192 END GENERATE all_input_rr;
192 END GENERATE all_input_rr;
193
193
194 RR_Arbiter_4_1 : RR_Arbiter_4
194 RR_Arbiter_4_1 : RR_Arbiter_4
195 PORT MAP (
195 PORT MAP (
196 clk => clk,
196 clk => clk,
197 rstn => rstn,
197 rstn => rstn,
198 in_valid => valid_in_rr,
198 in_valid => valid_in_rr,
199 out_grant => sel_s);
199 out_grant => sel_s);
200
200
201 PROCESS (clk, rstn)
201 PROCESS (clk, rstn)
202 BEGIN -- PROCESS
202 BEGIN -- PROCESS
203 IF rstn = '0' THEN -- asynchronous reset (active low)
203 IF rstn = '0' THEN -- asynchronous reset (active low)
204 sel <= "0000";
204 sel <= "0000";
205 sel_reg <= '0';
205 sel_reg <= '0';
206 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
206 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
207 IF run = '0' THEN
207 IF run = '0' THEN
208 sel <= "0000";
208 sel <= "0000";
209 sel_reg <= '0';
209 sel_reg <= '0';
210 ELSE
210 ELSE
211 IF sel_reg = '0' OR sel_ack = '1' THEN
211 IF sel_reg = '0' OR sel_ack = '1' THEN
212 sel <= sel_s;
212 sel <= sel_s;
213 IF sel_s = "0000" THEN
213 IF sel_s = "0000" THEN
214 sel_reg <= '0';
214 sel_reg <= '0';
215 ELSE
215 ELSE
216 sel_reg <= '1';
216 sel_reg <= '1';
217 END IF;
217 END IF;
218 END IF;
218 END IF;
219 END IF;
219 END IF;
220 END IF;
220 END IF;
221 END PROCESS;
221 END PROCESS;
222
222
223 no_sel <= '1' WHEN sel = "0000" ELSE '0';
223 no_sel <= '1' WHEN sel = "0000" ELSE '0';
224
224
225 -----------------------------------------------------------------------------
225 -----------------------------------------------------------------------------
226 -- REG
226 -- REG
227 -----------------------------------------------------------------------------
227 -----------------------------------------------------------------------------
228 reg_count_i: lpp_waveform_fifo_arbiter_reg
228 reg_count_i: lpp_waveform_fifo_arbiter_reg
229 GENERIC MAP (
229 GENERIC MAP (
230 data_size => nb_data_by_buffer_size,
230 data_size => nb_data_by_buffer_size,
231 data_nb => 4)
231 data_nb => 4)
232 PORT MAP (
232 PORT MAP (
233 clk => clk,
233 clk => clk,
234 rstn => rstn,
234 rstn => rstn,
235 run => run,
235 run => run,
236 max_count => nb_data_by_buffer,
236 max_count => nb_data_by_buffer,
237 enable => count_enable,
237 enable => count_enable,
238 sel => sel,
238 sel => sel,
239 data => count,
239 data => count,
240 data_s => count_s);
240 data_s => count_s);
241
241
242
242
243
243
244
244
245 END ARCHITECTURE;
245 END ARCHITECTURE;
246
246
247
247
248
248
249
249
250
250
251
251
252
252
253
253
254
254
255
255
256
256
257
257
258
258
259
259
260
260
261
261
262
262
263
263
264
264
265
265
266
266
267
267
268
268
269
269
270
@@ -1,116 +1,115
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 - 2012, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2012, 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.std_logic_1164.ALL;
23 USE IEEE.std_logic_1164.ALL;
24 USE IEEE.numeric_std.ALL;
24 USE IEEE.numeric_std.ALL;
25
25
26 LIBRARY lpp;
26 LIBRARY lpp;
27 USE lpp.lpp_waveform_pkg.ALL;
27 USE lpp.lpp_waveform_pkg.ALL;
28 USE lpp.general_purpose.ALL;
28 USE lpp.general_purpose.ALL;
29
29
30 ENTITY lpp_waveform_fifo_arbiter_reg IS
30 ENTITY lpp_waveform_fifo_arbiter_reg IS
31 GENERIC(
31 GENERIC(
32 data_size : INTEGER;
32 data_size : INTEGER;
33 data_nb : INTEGER);
33 data_nb : INTEGER);
34 PORT(
34 PORT(
35 clk : IN STD_LOGIC;
35 clk : IN STD_LOGIC;
36 rstn : IN STD_LOGIC;
36 rstn : IN STD_LOGIC;
37 ---------------------------------------------------------------------------
37 ---------------------------------------------------------------------------
38 run : IN STD_LOGIC;
38 run : IN STD_LOGIC;
39
39
40 max_count : IN STD_LOGIC_VECTOR(data_size -1 DOWNTO 0);
40 max_count : IN STD_LOGIC_VECTOR(data_size -1 DOWNTO 0);
41
41
42 enable : IN STD_LOGIC;
42 enable : IN STD_LOGIC;
43 sel : IN STD_LOGIC_VECTOR(data_nb-1 DOWNTO 0);
43 sel : IN STD_LOGIC_VECTOR(data_nb-1 DOWNTO 0);
44
44
45 data : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
45 data : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
46 data_s : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0)
46 data_s : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0)
47 );
47 );
48 END ENTITY;
48 END ENTITY;
49
49
50
50
51 ARCHITECTURE ar_lpp_waveform_fifo_arbiter_reg OF lpp_waveform_fifo_arbiter_reg IS
51 ARCHITECTURE ar_lpp_waveform_fifo_arbiter_reg OF lpp_waveform_fifo_arbiter_reg IS
52
52
53 TYPE Counter_Vector IS ARRAY (NATURAL RANGE <>) OF INTEGER;
53 TYPE Counter_Vector IS ARRAY (NATURAL RANGE <>) OF INTEGER;
54 SIGNAL reg : Counter_Vector(data_nb-1 DOWNTO 0);
54 SIGNAL reg : Counter_Vector(data_nb-1 DOWNTO 0);
55
55
56 SIGNAL reg_sel : INTEGER := 0;
56 SIGNAL reg_sel : INTEGER := 0;
57 SIGNAL reg_sel_s : INTEGER := 0;
57 SIGNAL reg_sel_s : INTEGER := 0;
58
58
59 BEGIN
59 BEGIN
60
60
61 all_reg : FOR I IN data_nb-1 DOWNTO 0 GENERATE
61 all_reg : FOR I IN data_nb-1 DOWNTO 0 GENERATE
62 PROCESS (clk, rstn)
62 PROCESS (clk, rstn)
63 BEGIN -- PROCESS
63 BEGIN -- PROCESS
64 IF rstn = '0' THEN -- asynchronous reset (active low)
64 IF rstn = '0' THEN -- asynchronous reset (active low)
65 reg(I) <= 0;
65 reg(I) <= 0;
66 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
66 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
67 IF run = '0' THEN
67 IF run = '0' THEN
68 reg(I) <= 0;
68 reg(I) <= 0;
69 ELSE
69 ELSE
70 IF sel(I) = '1' THEN
70 IF sel(I) = '1' THEN
71 reg(I) <= reg_sel_s;
71 reg(I) <= reg_sel_s;
72 END IF;
72 END IF;
73 END IF;
73 END IF;
74 END IF;
74 END IF;
75 END PROCESS;
75 END PROCESS;
76 END GENERATE all_reg;
76 END GENERATE all_reg;
77
77
78 reg_sel <= reg(0) WHEN sel(0) = '1' ELSE
78 reg_sel <= reg(0) WHEN sel(0) = '1' ELSE
79 reg(1) WHEN sel(1) = '1' ELSE
79 reg(1) WHEN sel(1) = '1' ELSE
80 reg(2) WHEN sel(2) = '1' ELSE
80 reg(2) WHEN sel(2) = '1' ELSE
81 reg(3);
81 reg(3);
82
82
83 reg_sel_s <= reg_sel WHEN enable = '0' ELSE
83 reg_sel_s <= reg_sel WHEN enable = '0' ELSE
84 reg_sel + 1 WHEN reg_sel < UNSIGNED(max_count) ELSE
84 reg_sel + 1 WHEN reg_sel < UNSIGNED(max_count) ELSE
85 0;
85 0;
86
86
87 data <= STD_LOGIC_VECTOR(to_unsigned(reg_sel , data_size));
87 data <= STD_LOGIC_VECTOR(to_unsigned(reg_sel , data_size));
88 data_s <= STD_LOGIC_VECTOR(to_unsigned(reg_sel_s, data_size));
88 data_s <= STD_LOGIC_VECTOR(to_unsigned(reg_sel_s, data_size));
89
89
90 END ARCHITECTURE;
90 END ARCHITECTURE;
91
91
92
92
93
93
94
94
95
95
96
96
97
97
98
98
99
99
100
100
101
101
102
102
103
103
104
104
105
105
106
106
107
107
108
108
109
109
110
110
111
111
112
112
113
113
114
114
115
115
116
@@ -1,370 +1,370
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 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_f1_in_valid : IN STD_LOGIC;
141 data_f1_in_valid : IN STD_LOGIC;
142 data_f1_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
142 data_f1_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
143 data_f2_in_valid : IN STD_LOGIC;
143 data_f2_in_valid : IN STD_LOGIC;
144 data_f2_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
144 data_f2_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
145 data_f3_in_valid : IN STD_LOGIC;
145 data_f3_in_valid : IN STD_LOGIC;
146 data_f3_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
146 data_f3_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
147
147
148 dma_fifo_valid_burst : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
148 dma_fifo_valid_burst : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
149 dma_fifo_data : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
149 dma_fifo_data : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
150 dma_fifo_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
150 dma_fifo_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
151 dma_buffer_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
151 dma_buffer_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
152 dma_buffer_addr : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
152 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);
153 dma_buffer_length : OUT STD_LOGIC_VECTOR(26*4-1 DOWNTO 0);
154 dma_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
154 dma_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
155 dma_buffer_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0)
155 dma_buffer_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0)
156 );
156 );
157 END COMPONENT;
157 END COMPONENT;
158
158
159 COMPONENT lpp_waveform_dma_genvalid
159 COMPONENT lpp_waveform_dma_genvalid
160 PORT (
160 PORT (
161 HCLK : IN STD_LOGIC;
161 HCLK : IN STD_LOGIC;
162 HRESETn : IN STD_LOGIC;
162 HRESETn : IN STD_LOGIC;
163 run : IN STD_LOGIC;
163 run : IN STD_LOGIC;
164 valid_in : IN STD_LOGIC;
164 valid_in : IN STD_LOGIC;
165 ack_in : IN STD_LOGIC;
165 ack_in : IN STD_LOGIC;
166 time_in : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
166 time_in : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
167 valid_out : OUT STD_LOGIC;
167 valid_out : OUT STD_LOGIC;
168 time_out : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
168 time_out : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
169 error : OUT STD_LOGIC);
169 error : OUT STD_LOGIC);
170 END COMPONENT;
170 END COMPONENT;
171
171
172 -----------------------------------------------------------------------------
172 -----------------------------------------------------------------------------
173 -- FIFO
173 -- FIFO
174 -----------------------------------------------------------------------------
174 -----------------------------------------------------------------------------
175 COMPONENT lpp_waveform_fifo_ctrl
175 COMPONENT lpp_waveform_fifo_ctrl
176 GENERIC (
176 GENERIC (
177 offset : INTEGER;
177 offset : INTEGER;
178 length : INTEGER);
178 length : INTEGER);
179 PORT (
179 PORT (
180 clk : IN STD_LOGIC;
180 clk : IN STD_LOGIC;
181 rstn : IN STD_LOGIC;
181 rstn : IN STD_LOGIC;
182 run : IN STD_LOGIC;
182 run : IN STD_LOGIC;
183 ren : IN STD_LOGIC;
183 ren : IN STD_LOGIC;
184 wen : IN STD_LOGIC;
184 wen : IN STD_LOGIC;
185 mem_re : OUT STD_LOGIC;
185 mem_re : OUT STD_LOGIC;
186 mem_we : OUT STD_LOGIC;
186 mem_we : OUT STD_LOGIC;
187 mem_addr_ren : OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
187 mem_addr_ren : OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
188 mem_addr_wen : OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
188 mem_addr_wen : OUT STD_LOGIC_VECTOR(6 DOWNTO 0);
189 empty_almost : OUT STD_LOGIC;
189 empty_almost : OUT STD_LOGIC;
190 empty : OUT STD_LOGIC;
190 empty : OUT STD_LOGIC;
191 full_almost : OUT STD_LOGIC;
191 full_almost : OUT STD_LOGIC;
192 full : OUT STD_LOGIC);
192 full : OUT STD_LOGIC);
193 END COMPONENT;
193 END COMPONENT;
194
194
195 COMPONENT lpp_waveform_fifo_arbiter
195 COMPONENT lpp_waveform_fifo_arbiter
196 GENERIC (
196 GENERIC (
197 tech : INTEGER;
197 tech : INTEGER;
198 nb_data_by_buffer_size : INTEGER);
198 nb_data_by_buffer_size : INTEGER);
199 PORT (
199 PORT (
200 clk : IN STD_LOGIC;
200 clk : IN STD_LOGIC;
201 rstn : IN STD_LOGIC;
201 rstn : IN STD_LOGIC;
202 run : IN STD_LOGIC;
202 run : IN STD_LOGIC;
203 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size - 1 DOWNTO 0);
203 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);
204 data_in_valid : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
205 data_in_ack : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
205 data_in_ack : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
206 data_in : IN Data_Vector(3 DOWNTO 0, 95 DOWNTO 0);
206 data_in : IN Data_Vector(3 DOWNTO 0, 95 DOWNTO 0);
207 time_in : IN Data_Vector(3 DOWNTO 0, 47 DOWNTO 0);
207 time_in : IN Data_Vector(3 DOWNTO 0, 47 DOWNTO 0);
208 data_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
208 data_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
209 data_out_wen : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
209 data_out_wen : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
210 full_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
210 full_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
211 full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
211 full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
212 time_out : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
212 time_out : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
213 time_out_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
213 time_out_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0)
214 );
214 );
215 END COMPONENT;
215 END COMPONENT;
216
216
217 COMPONENT lpp_waveform_fifo
217 COMPONENT lpp_waveform_fifo
218 GENERIC (
218 GENERIC (
219 tech : INTEGER);
219 tech : INTEGER);
220 PORT (
220 PORT (
221 clk : IN STD_LOGIC;
221 clk : IN STD_LOGIC;
222 rstn : IN STD_LOGIC;
222 rstn : IN STD_LOGIC;
223 run : IN STD_LOGIC;
223 run : IN STD_LOGIC;
224 empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
224 empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
225 empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
225 empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
226 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
226 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
227 rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
227 rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
228 full_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
228 full_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
229 full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
229 full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
230 data_wen : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
230 data_wen : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
231 wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
231 wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
232 END COMPONENT;
232 END COMPONENT;
233
233
234 COMPONENT lpp_waveform_fifo_headreg
234 COMPONENT lpp_waveform_fifo_headreg
235 GENERIC (
235 GENERIC (
236 tech : INTEGER);
236 tech : INTEGER);
237 PORT (
237 PORT (
238 clk : IN STD_LOGIC;
238 clk : IN STD_LOGIC;
239 rstn : IN STD_LOGIC;
239 rstn : IN STD_LOGIC;
240 run : IN STD_LOGIC;
240 run : IN STD_LOGIC;
241 o_empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
241 o_empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
242 o_empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
242 o_empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
243 o_data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
243 o_data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
244 o_rdata_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
244 o_rdata_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
245 o_rdata_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
245 o_rdata_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
246 o_rdata_2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
246 o_rdata_2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
247 o_rdata_3 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
247 o_rdata_3 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
248 i_empty_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
248 i_empty_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
249 i_empty : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
249 i_empty : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
250 i_data_ren : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
250 i_data_ren : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
251 i_rdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
251 i_rdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
252 END COMPONENT;
252 END COMPONENT;
253
253
254 COMPONENT lpp_waveform_fifo_latencyCorrection
254 COMPONENT lpp_waveform_fifo_latencyCorrection
255 GENERIC (
255 GENERIC (
256 tech : INTEGER);
256 tech : INTEGER);
257 PORT (
257 PORT (
258 clk : IN STD_LOGIC;
258 clk : IN STD_LOGIC;
259 rstn : IN STD_LOGIC;
259 rstn : IN STD_LOGIC;
260 run : IN STD_LOGIC;
260 run : IN STD_LOGIC;
261 empty_almost : OUT STD_LOGIC;
261 empty_almost : OUT STD_LOGIC;
262 empty : OUT STD_LOGIC;
262 empty : OUT STD_LOGIC;
263 data_ren : IN STD_LOGIC;
263 data_ren : IN STD_LOGIC;
264 rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
264 rdata : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
265 empty_almost_fifo : IN STD_LOGIC;
265 empty_almost_fifo : IN STD_LOGIC;
266 empty_fifo : IN STD_LOGIC;
266 empty_fifo : IN STD_LOGIC;
267 data_ren_fifo : OUT STD_LOGIC;
267 data_ren_fifo : OUT STD_LOGIC;
268 rdata_fifo : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
268 rdata_fifo : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
269 END COMPONENT;
269 END COMPONENT;
270
270
271 COMPONENT lpp_waveform_fifo_withoutLatency
271 COMPONENT lpp_waveform_fifo_withoutLatency
272 GENERIC (
272 GENERIC (
273 tech : INTEGER);
273 tech : INTEGER);
274 PORT (
274 PORT (
275 clk : IN STD_LOGIC;
275 clk : IN STD_LOGIC;
276 rstn : IN STD_LOGIC;
276 rstn : IN STD_LOGIC;
277 run : IN STD_LOGIC;
277 run : IN STD_LOGIC;
278 empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
278 empty_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
279 empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
279 empty : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
280 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
280 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
281 rdata_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
281 rdata_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
282 rdata_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
282 rdata_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
283 rdata_2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
283 rdata_2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
284 rdata_3 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
284 rdata_3 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
285 full_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
285 full_almost : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
286 full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
286 full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
287 data_wen : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
287 data_wen : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
288 wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
288 wdata : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
289 END COMPONENT;
289 END COMPONENT;
290
290
291 -----------------------------------------------------------------------------
291 -----------------------------------------------------------------------------
292 -- GEN ADDRESS
292 -- GEN ADDRESS
293 -----------------------------------------------------------------------------
293 -----------------------------------------------------------------------------
294 COMPONENT lpp_waveform_genaddress
294 COMPONENT lpp_waveform_genaddress
295 GENERIC (
295 GENERIC (
296 nb_data_by_buffer_size : INTEGER);
296 nb_data_by_buffer_size : INTEGER);
297 PORT (
297 PORT (
298 clk : IN STD_LOGIC;
298 clk : IN STD_LOGIC;
299 rstn : IN STD_LOGIC;
299 rstn : IN STD_LOGIC;
300 run : IN STD_LOGIC;
300 run : IN STD_LOGIC;
301 nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
301 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);
302 addr_data_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
303 addr_data_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
303 addr_data_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
304 addr_data_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
304 addr_data_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
305 addr_data_f3 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
305 addr_data_f3 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
306 empty : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
306 empty : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
307 empty_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
307 empty_almost : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
308 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
308 data_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
309 status_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
309 status_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
310 status_full_ack : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
310 status_full_ack : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
311 status_full_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
311 status_full_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
312 data_f0_data_out_valid_burst : OUT STD_LOGIC;
312 data_f0_data_out_valid_burst : OUT STD_LOGIC;
313 data_f1_data_out_valid_burst : OUT STD_LOGIC;
313 data_f1_data_out_valid_burst : OUT STD_LOGIC;
314 data_f2_data_out_valid_burst : OUT STD_LOGIC;
314 data_f2_data_out_valid_burst : OUT STD_LOGIC;
315 data_f3_data_out_valid_burst : OUT STD_LOGIC;
315 data_f3_data_out_valid_burst : OUT STD_LOGIC;
316 data_f0_data_out_valid : OUT STD_LOGIC;
316 data_f0_data_out_valid : OUT STD_LOGIC;
317 data_f1_data_out_valid : OUT STD_LOGIC;
317 data_f1_data_out_valid : OUT STD_LOGIC;
318 data_f2_data_out_valid : OUT STD_LOGIC;
318 data_f2_data_out_valid : OUT STD_LOGIC;
319 data_f3_data_out_valid : OUT STD_LOGIC;
319 data_f3_data_out_valid : OUT STD_LOGIC;
320 data_f0_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
320 data_f0_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
321 data_f1_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
321 data_f1_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
322 data_f2_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
322 data_f2_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
323 data_f3_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
323 data_f3_addr_out : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
324 END COMPONENT;
324 END COMPONENT;
325
325
326 -----------------------------------------------------------------------------
326 -----------------------------------------------------------------------------
327 -- lpp_waveform_fifo_arbiter_reg
327 -- lpp_waveform_fifo_arbiter_reg
328 -----------------------------------------------------------------------------
328 -----------------------------------------------------------------------------
329 COMPONENT lpp_waveform_fifo_arbiter_reg
329 COMPONENT lpp_waveform_fifo_arbiter_reg
330 GENERIC (
330 GENERIC (
331 data_size : INTEGER;
331 data_size : INTEGER;
332 data_nb : INTEGER);
332 data_nb : INTEGER);
333 PORT (
333 PORT (
334 clk : IN STD_LOGIC;
334 clk : IN STD_LOGIC;
335 rstn : IN STD_LOGIC;
335 rstn : IN STD_LOGIC;
336 run : IN STD_LOGIC;
336 run : IN STD_LOGIC;
337 max_count : IN STD_LOGIC_VECTOR(data_size -1 DOWNTO 0);
337 max_count : IN STD_LOGIC_VECTOR(data_size -1 DOWNTO 0);
338 enable : IN STD_LOGIC;
338 enable : IN STD_LOGIC;
339 sel : IN STD_LOGIC_VECTOR(data_nb-1 DOWNTO 0);
339 sel : IN STD_LOGIC_VECTOR(data_nb-1 DOWNTO 0);
340 data : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
340 data : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0);
341 data_s : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0));
341 data_s : OUT STD_LOGIC_VECTOR(data_size-1 DOWNTO 0));
342 END COMPONENT;
342 END COMPONENT;
343
343
344 COMPONENT lpp_waveform_fsmdma
344 COMPONENT lpp_waveform_fsmdma
345 PORT (
345 PORT (
346 clk : IN STD_ULOGIC;
346 clk : IN STD_ULOGIC;
347 rstn : IN STD_ULOGIC;
347 rstn : IN STD_ULOGIC;
348 run : IN STD_LOGIC;
348 run : IN STD_LOGIC;
349 fifo_buffer_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
349 fifo_buffer_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
350 fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
350 fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
351 fifo_empty : IN STD_LOGIC;
351 fifo_empty : IN STD_LOGIC;
352 fifo_empty_threshold : IN STD_LOGIC;
352 fifo_empty_threshold : IN STD_LOGIC;
353 fifo_ren : OUT STD_LOGIC;
353 fifo_ren : OUT STD_LOGIC;
354 dma_fifo_valid_burst : OUT STD_LOGIC;
354 dma_fifo_valid_burst : OUT STD_LOGIC;
355 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
355 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
356 dma_fifo_ren : IN STD_LOGIC;
356 dma_fifo_ren : IN STD_LOGIC;
357 dma_buffer_new : OUT STD_LOGIC;
357 dma_buffer_new : OUT STD_LOGIC;
358 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
358 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
359 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
359 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
360 dma_buffer_full : IN STD_LOGIC;
360 dma_buffer_full : IN STD_LOGIC;
361 dma_buffer_full_err : IN STD_LOGIC;
361 dma_buffer_full_err : IN STD_LOGIC;
362 status_buffer_ready : IN STD_LOGIC;
362 status_buffer_ready : IN STD_LOGIC;
363 addr_buffer : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
363 addr_buffer : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
364 length_buffer : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
364 length_buffer : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
365 ready_buffer : OUT STD_LOGIC;
365 ready_buffer : OUT STD_LOGIC;
366 buffer_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
366 buffer_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
367 error_buffer_full : OUT STD_LOGIC);
367 error_buffer_full : OUT STD_LOGIC);
368 END COMPONENT;
368 END COMPONENT;
369
369
370 END lpp_waveform_pkg;
370 END lpp_waveform_pkg;
General Comments 0
You need to be logged in to leave comments. Login now