##// END OF EJS Templates
save x.1.85
pellion -
r619:b515d4c55e1d simu_with_Leon3
parent child
Show More
@@ -1,603 +1,605
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.sim.ALL;
31 USE gaisler.sim.ALL;
32 USE gaisler.memctrl.ALL;
32 USE gaisler.memctrl.ALL;
33 USE gaisler.leon3.ALL;
33 USE gaisler.leon3.ALL;
34 USE gaisler.uart.ALL;
34 USE gaisler.uart.ALL;
35 USE gaisler.misc.ALL;
35 USE gaisler.misc.ALL;
36 USE gaisler.spacewire.ALL;
36 USE gaisler.spacewire.ALL;
37 LIBRARY esa;
37 LIBRARY esa;
38 USE esa.memoryctrl.ALL;
38 USE esa.memoryctrl.ALL;
39 LIBRARY lpp;
39 LIBRARY lpp;
40 USE lpp.lpp_memory.ALL;
40 USE lpp.lpp_memory.ALL;
41 USE lpp.lpp_ad_conv.ALL;
41 USE lpp.lpp_ad_conv.ALL;
42 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
42 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
43 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
43 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
44 USE lpp.iir_filter.ALL;
44 USE lpp.iir_filter.ALL;
45 USE lpp.general_purpose.ALL;
45 USE lpp.general_purpose.ALL;
46 USE lpp.lpp_lfr_management.ALL;
46 USE lpp.lpp_lfr_management.ALL;
47 USE lpp.lpp_leon3_soc_pkg.ALL;
47 USE lpp.lpp_leon3_soc_pkg.ALL;
48 USE lpp.lpp_bootloader_pkg.ALL;
48 USE lpp.lpp_bootloader_pkg.ALL;
49
49
50 --library proasic3l;
50 --library proasic3l;
51 --use proasic3l.all;
51 --use proasic3l.all;
52
52
53 ENTITY LFR_EQM IS
53 ENTITY LFR_EQM IS
54 GENERIC (
54 GENERIC (
55 Mem_use : INTEGER := use_RAM;
55 Mem_use : INTEGER := use_RAM;
56 USE_BOOTLOADER : INTEGER := 0;
56 USE_BOOTLOADER : INTEGER := 0;
57 USE_ADCDRIVER : INTEGER := 1;
57 USE_ADCDRIVER : INTEGER := 1;
58 tech : INTEGER := apa3e;
58 tech : INTEGER := apa3e;
59 tech_leon : INTEGER := apa3e;
59 tech_leon : INTEGER := apa3e;
60 DEBUG_FORCE_DATA_DMA : INTEGER := 0;
60 DEBUG_FORCE_DATA_DMA : INTEGER := 0;
61 USE_DEBUG_VECTOR : INTEGER := 0
61 USE_DEBUG_VECTOR : INTEGER := 0
62 );
62 );
63
63
64 PORT (
64 PORT (
65 clk50MHz : IN STD_ULOGIC;
65 clk50MHz : IN STD_ULOGIC;
66 clk49_152MHz : IN STD_ULOGIC;
66 clk49_152MHz : IN STD_ULOGIC;
67 reset : IN STD_ULOGIC;
67 reset : IN STD_ULOGIC;
68
68
69 TAG : INOUT STD_LOGIC_VECTOR(9 DOWNTO 1);
69 TAG : INOUT STD_LOGIC_VECTOR(9 DOWNTO 1);
70
70
71 -- TAG --------------------------------------------------------------------
71 -- TAG --------------------------------------------------------------------
72 --TAG1 : IN STD_ULOGIC; -- DSU rx data
72 --TAG1 : IN STD_ULOGIC; -- DSU rx data
73 --TAG3 : OUT STD_ULOGIC; -- DSU tx data
73 --TAG3 : OUT STD_ULOGIC; -- DSU tx data
74 -- UART APB ---------------------------------------------------------------
74 -- UART APB ---------------------------------------------------------------
75 --TAG2 : IN STD_ULOGIC; -- UART1 rx data
75 --TAG2 : IN STD_ULOGIC; -- UART1 rx data
76 --TAG4 : OUT STD_ULOGIC; -- UART1 tx data
76 --TAG4 : OUT STD_ULOGIC; -- UART1 tx data
77 -- RAM --------------------------------------------------------------------
77 -- RAM --------------------------------------------------------------------
78 address : OUT STD_LOGIC_VECTOR(18 DOWNTO 0);
78 address : OUT STD_LOGIC_VECTOR(18 DOWNTO 0);
79 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
79 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
80
80
81 nSRAM_MBE : INOUT STD_LOGIC; -- new
81 nSRAM_MBE : INOUT STD_LOGIC; -- new
82 nSRAM_E1 : OUT STD_LOGIC; -- new
82 nSRAM_E1 : OUT STD_LOGIC; -- new
83 nSRAM_E2 : OUT STD_LOGIC; -- new
83 nSRAM_E2 : OUT STD_LOGIC; -- new
84 -- nSRAM_SCRUB : OUT STD_LOGIC; -- new
84 -- nSRAM_SCRUB : OUT STD_LOGIC; -- new
85 nSRAM_W : OUT STD_LOGIC; -- new
85 nSRAM_W : OUT STD_LOGIC; -- new
86 nSRAM_G : OUT STD_LOGIC; -- new
86 nSRAM_G : OUT STD_LOGIC; -- new
87 nSRAM_BUSY : IN STD_LOGIC; -- new
87 nSRAM_BUSY : IN STD_LOGIC; -- new
88 -- SPW --------------------------------------------------------------------
88 -- SPW --------------------------------------------------------------------
89 spw1_en : OUT STD_LOGIC; -- new
89 spw1_en : OUT STD_LOGIC; -- new
90 spw1_din : IN STD_LOGIC;
90 spw1_din : IN STD_LOGIC;
91 spw1_sin : IN STD_LOGIC;
91 spw1_sin : IN STD_LOGIC;
92 spw1_dout : OUT STD_LOGIC;
92 spw1_dout : OUT STD_LOGIC;
93 spw1_sout : OUT STD_LOGIC;
93 spw1_sout : OUT STD_LOGIC;
94 spw2_en : OUT STD_LOGIC; -- new
94 spw2_en : OUT STD_LOGIC; -- new
95 spw2_din : IN STD_LOGIC;
95 spw2_din : IN STD_LOGIC;
96 spw2_sin : IN STD_LOGIC;
96 spw2_sin : IN STD_LOGIC;
97 spw2_dout : OUT STD_LOGIC;
97 spw2_dout : OUT STD_LOGIC;
98 spw2_sout : OUT STD_LOGIC;
98 spw2_sout : OUT STD_LOGIC;
99 -- ADC --------------------------------------------------------------------
99 -- ADC --------------------------------------------------------------------
100 bias_fail_sw : OUT STD_LOGIC;
100 bias_fail_sw : OUT STD_LOGIC;
101 ADC_OEB_bar_CH : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
101 ADC_OEB_bar_CH : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
102 ADC_smpclk : OUT STD_LOGIC;
102 ADC_smpclk : OUT STD_LOGIC;
103 ADC_data : IN STD_LOGIC_VECTOR(13 DOWNTO 0);
103 ADC_data : IN STD_LOGIC_VECTOR(13 DOWNTO 0);
104 -- DAC --------------------------------------------------------------------
104 -- DAC --------------------------------------------------------------------
105 DAC_SDO : OUT STD_LOGIC;
105 DAC_SDO : OUT STD_LOGIC;
106 DAC_SCK : OUT STD_LOGIC;
106 DAC_SCK : OUT STD_LOGIC;
107 DAC_SYNC : OUT STD_LOGIC;
107 DAC_SYNC : OUT STD_LOGIC;
108 DAC_CAL_EN : OUT STD_LOGIC;
108 DAC_CAL_EN : OUT STD_LOGIC;
109 -- HK ---------------------------------------------------------------------
109 -- HK ---------------------------------------------------------------------
110 HK_smpclk : OUT STD_LOGIC;
110 HK_smpclk : OUT STD_LOGIC;
111 ADC_OEB_bar_HK : OUT STD_LOGIC;
111 ADC_OEB_bar_HK : OUT STD_LOGIC;
112 HK_SEL : OUT STD_LOGIC_VECTOR(1 DOWNTO 0)--;
112 HK_SEL : OUT STD_LOGIC_VECTOR(1 DOWNTO 0)--;
113 ---------------------------------------------------------------------------
113 ---------------------------------------------------------------------------
114 -- TAG8 : OUT STD_LOGIC
114 -- TAG8 : OUT STD_LOGIC
115 );
115 );
116
116
117 END LFR_EQM;
117 END LFR_EQM;
118
118
119
119
120 ARCHITECTURE beh OF LFR_EQM IS
120 ARCHITECTURE beh OF LFR_EQM IS
121
121
122 SIGNAL clk_25 : STD_LOGIC := '0';
122 SIGNAL clk_25 : STD_LOGIC := '0';
123 SIGNAL clk_24 : STD_LOGIC := '0';
123 SIGNAL clk_24 : STD_LOGIC := '0';
124 -----------------------------------------------------------------------------
124 -----------------------------------------------------------------------------
125 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
125 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
126 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
126 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
127
127
128 -- CONSTANTS
128 -- CONSTANTS
129 CONSTANT CFG_PADTECH : INTEGER := inferred;
129 CONSTANT CFG_PADTECH : INTEGER := inferred;
130 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
130 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
131 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
131 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
132 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
132 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
133
133
134 SIGNAL apbi_ext : apb_slv_in_type;
134 SIGNAL apbi_ext : apb_slv_in_type;
135 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5) := (OTHERS => apb_none);
135 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5) := (OTHERS => apb_none);
136 SIGNAL ahbi_s_ext : ahb_slv_in_type;
136 SIGNAL ahbi_s_ext : ahb_slv_in_type;
137 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3) := (OTHERS => ahbs_none);
137 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3) := (OTHERS => ahbs_none);
138 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
138 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
139 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1) := (OTHERS => ahbm_none);
139 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1) := (OTHERS => ahbm_none);
140
140
141 -- Spacewire signals
141 -- Spacewire signals
142 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
142 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
143 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
143 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
144 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
144 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
145 SIGNAL spw_rxtxclk : STD_ULOGIC;
145 SIGNAL spw_rxtxclk : STD_ULOGIC;
146 SIGNAL spw_rxclkn : STD_ULOGIC;
146 SIGNAL spw_rxclkn : STD_ULOGIC;
147 SIGNAL spw_clk : STD_LOGIC;
147 SIGNAL spw_clk : STD_LOGIC;
148 SIGNAL swni : grspw_in_type;
148 SIGNAL swni : grspw_in_type;
149 SIGNAL swno : grspw_out_type;
149 SIGNAL swno : grspw_out_type;
150
150
151 --GPIO
151 --GPIO
152 SIGNAL gpioi : gpio_in_type;
152 SIGNAL gpioi : gpio_in_type;
153 SIGNAL gpioo : gpio_out_type;
153 SIGNAL gpioo : gpio_out_type;
154
154
155 -- AD Converter ADS7886
155 -- AD Converter ADS7886
156 SIGNAL sample : Samples14v(8 DOWNTO 0);
156 SIGNAL sample : Samples14v(8 DOWNTO 0);
157 SIGNAL sample_s : Samples(8 DOWNTO 0);
157 SIGNAL sample_s : Samples(8 DOWNTO 0);
158 SIGNAL sample_val : STD_LOGIC;
158 SIGNAL sample_val : STD_LOGIC;
159 SIGNAL ADC_OEB_bar_CH_s : STD_LOGIC_VECTOR(8 DOWNTO 0);
159 SIGNAL ADC_OEB_bar_CH_s : STD_LOGIC_VECTOR(8 DOWNTO 0);
160
160
161 -----------------------------------------------------------------------------
161 -----------------------------------------------------------------------------
162 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
162 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
163
163
164 -----------------------------------------------------------------------------
164 -----------------------------------------------------------------------------
165 SIGNAL rstn_25 : STD_LOGIC;
165 SIGNAL rstn_25 : STD_LOGIC;
166 SIGNAL rstn_24 : STD_LOGIC;
166 SIGNAL rstn_24 : STD_LOGIC;
167
167
168 SIGNAL LFR_soft_rstn : STD_LOGIC;
168 SIGNAL LFR_soft_rstn : STD_LOGIC;
169 SIGNAL LFR_rstn : STD_LOGIC;
169 SIGNAL LFR_rstn : STD_LOGIC;
170
170
171 SIGNAL ADC_smpclk_s : STD_LOGIC;
171 SIGNAL ADC_smpclk_s : STD_LOGIC;
172
172
173 SIGNAL nSRAM_CE : STD_LOGIC_VECTOR(1 DOWNTO 0);
173 SIGNAL nSRAM_CE : STD_LOGIC_VECTOR(1 DOWNTO 0);
174
174
175 SIGNAL clk50MHz_int : STD_LOGIC := '0';
175 SIGNAL clk50MHz_int : STD_LOGIC := '0';
176 SIGNAL clk_25_int : STD_LOGIC := '0';
176 SIGNAL clk_25_int : STD_LOGIC := '0';
177
177
178 component clkint port(A : in std_ulogic; Y :out std_ulogic); end component;
178 component clkint port(A : in std_ulogic; Y :out std_ulogic); end component;
179
179
180 SIGNAL rstn_50 : STD_LOGIC;
180 SIGNAL rstn_50 : STD_LOGIC;
181 SIGNAL clk_lock : STD_LOGIC;
181 SIGNAL clk_lock : STD_LOGIC;
182 SIGNAL clk_busy_counter : STD_LOGIC_VECTOR(3 DOWNTO 0);
182 SIGNAL clk_busy_counter : STD_LOGIC_VECTOR(3 DOWNTO 0);
183 SIGNAL nSRAM_BUSY_reg : STD_LOGIC;
183 SIGNAL nSRAM_BUSY_reg : STD_LOGIC;
184
184
185 SIGNAL debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0);
185 SIGNAL debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0);
186 SIGNAL ahbrxd: STD_LOGIC;
186 SIGNAL ahbrxd: STD_LOGIC;
187 SIGNAL ahbtxd: STD_LOGIC;
187 SIGNAL ahbtxd: STD_LOGIC;
188 SIGNAL urxd1 : STD_LOGIC;
188 SIGNAL urxd1 : STD_LOGIC;
189 SIGNAL utxd1 : STD_LOGIC;
189 SIGNAL utxd1 : STD_LOGIC;
190 BEGIN -- beh
190 BEGIN -- beh
191
191
192 -----------------------------------------------------------------------------
192 -----------------------------------------------------------------------------
193 -- CLK_LOCK
193 -- CLK_LOCK
194 -----------------------------------------------------------------------------
194 -----------------------------------------------------------------------------
195 rst_gen_global : rstgen PORT MAP (reset, clk50MHz, '1', rstn_50, OPEN);
195 rst_gen_global : rstgen PORT MAP (reset, clk50MHz, '1', rstn_50, OPEN);
196
196
197 PROCESS (clk50MHz_int, rstn_50)
197 PROCESS (clk50MHz_int, rstn_50)
198 BEGIN -- PROCESS
198 BEGIN -- PROCESS
199 IF rstn_50 = '0' THEN -- asynchronous reset (active low)
199 IF rstn_50 = '0' THEN -- asynchronous reset (active low)
200 clk_lock <= '0';
200 clk_lock <= '0';
201 clk_busy_counter <= (OTHERS => '0');
201 clk_busy_counter <= (OTHERS => '0');
202 nSRAM_BUSY_reg <= '0';
202 nSRAM_BUSY_reg <= '0';
203 ELSIF clk50MHz_int'event AND clk50MHz_int = '1' THEN -- rising clock edge
203 ELSIF clk50MHz_int'event AND clk50MHz_int = '1' THEN -- rising clock edge
204 nSRAM_BUSY_reg <= nSRAM_BUSY;
204 nSRAM_BUSY_reg <= nSRAM_BUSY;
205 IF nSRAM_BUSY_reg = '1' AND nSRAM_BUSY = '0' THEN
205 IF nSRAM_BUSY_reg = '1' AND nSRAM_BUSY = '0' THEN
206 IF clk_busy_counter = "1111" THEN
206 IF clk_busy_counter = "1111" THEN
207 clk_lock <= '1';
207 clk_lock <= '1';
208 ELSE
208 ELSE
209 clk_busy_counter <= STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(clk_busy_counter))+1,4));
209 clk_busy_counter <= STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(clk_busy_counter))+1,4));
210 END IF;
210 END IF;
211 END IF;
211 END IF;
212 END IF;
212 END IF;
213 END PROCESS;
213 END PROCESS;
214
214
215 -----------------------------------------------------------------------------
215 -----------------------------------------------------------------------------
216 -- CLK
216 -- CLK
217 -----------------------------------------------------------------------------
217 -----------------------------------------------------------------------------
218 rst_domain25 : rstgen PORT MAP (reset, clk_25, clk_lock, rstn_25, OPEN);
218 rst_domain25 : rstgen PORT MAP (reset, clk_25, clk_lock, rstn_25, OPEN);
219 rst_domain24 : rstgen PORT MAP (reset, clk_24, clk_lock, rstn_24, OPEN);
219 rst_domain24 : rstgen PORT MAP (reset, clk_24, clk_lock, rstn_24, OPEN);
220
220
221 --clk_pad : clkint port map (A => clk50MHz, Y => clk50MHz_int );
221 --clk_pad : clkint port map (A => clk50MHz, Y => clk50MHz_int );
222 clk50MHz_int <= clk50MHz;
222 clk50MHz_int <= clk50MHz;
223
223
224 PROCESS(clk50MHz_int)
224 PROCESS(clk50MHz_int)
225 BEGIN
225 BEGIN
226 IF clk50MHz_int'EVENT AND clk50MHz_int = '1' THEN
226 IF clk50MHz_int'EVENT AND clk50MHz_int = '1' THEN
227 --clk_25_int <= NOT clk_25_int;
227 --clk_25_int <= NOT clk_25_int;
228 clk_25 <= NOT clk_25;
228 clk_25 <= NOT clk_25;
229 END IF;
229 END IF;
230 END PROCESS;
230 END PROCESS;
231 --clk_pad_25 : clkint port map (A => clk_25_int, Y => clk_25 );
231 --clk_pad_25 : clkint port map (A => clk_25_int, Y => clk_25 );
232
232
233 PROCESS(clk49_152MHz)
233 PROCESS(clk49_152MHz)
234 BEGIN
234 BEGIN
235 IF clk49_152MHz'EVENT AND clk49_152MHz = '1' THEN
235 IF clk49_152MHz'EVENT AND clk49_152MHz = '1' THEN
236 clk_24 <= NOT clk_24;
236 clk_24 <= NOT clk_24;
237 END IF;
237 END IF;
238 END PROCESS;
238 END PROCESS;
239 -- clk_49 <= clk49_152MHz;
239 -- clk_49 <= clk49_152MHz;
240
240
241 -----------------------------------------------------------------------------
241 -----------------------------------------------------------------------------
242 --
242 --
243 leon3_soc_1 : leon3_soc
243 leon3_soc_1 : leon3_soc
244 GENERIC MAP (
244 GENERIC MAP (
245 fabtech => tech_leon,
245 fabtech => tech_leon,
246 memtech => tech_leon,
246 memtech => tech_leon,
247 padtech => inferred,
247 padtech => inferred,
248 clktech => inferred,
248 clktech => inferred,
249 disas => 0,
249 disas => 0,
250 dbguart => 0,
250 dbguart => 0,
251 pclow => 2,
251 pclow => 2,
252 clk_freq => 25000,
252 clk_freq => 25000,
253 IS_RADHARD => 0,
253 IS_RADHARD => 0,
254 NB_CPU => 1,
254 NB_CPU => 1,
255 ENABLE_FPU => 1,
255 ENABLE_FPU => 1,
256 FPU_NETLIST => 0,
256 FPU_NETLIST => 0,
257 ENABLE_DSU => 1,
257 ENABLE_DSU => 1,
258 ENABLE_AHB_UART => 1,
258 ENABLE_AHB_UART => 1,
259 ENABLE_APB_UART => 1,
259 ENABLE_APB_UART => 1,
260 ENABLE_IRQMP => 1,
260 ENABLE_IRQMP => 1,
261 ENABLE_GPT => 1,
261 ENABLE_GPT => 1,
262 NB_AHB_MASTER => NB_AHB_MASTER,
262 NB_AHB_MASTER => NB_AHB_MASTER,
263 NB_AHB_SLAVE => NB_AHB_SLAVE,
263 NB_AHB_SLAVE => NB_AHB_SLAVE,
264 NB_APB_SLAVE => NB_APB_SLAVE,
264 NB_APB_SLAVE => NB_APB_SLAVE,
265 ADDRESS_SIZE => 19,
265 ADDRESS_SIZE => 19,
266 USES_IAP_MEMCTRLR => 1,
266 USES_IAP_MEMCTRLR => 1,
267 BYPASS_EDAC_MEMCTRLR => '0',
267 BYPASS_EDAC_MEMCTRLR => '0',
268 SRBANKSZ => 8)
268 SRBANKSZ => 8,
269 SLOW_TIMING_EMULATION => 0
270 )
269 PORT MAP (
271 PORT MAP (
270 clk => clk_25,
272 clk => clk_25,
271 reset => rstn_25,
273 reset => rstn_25,
272 errorn => OPEN,
274 errorn => OPEN,
273
275
274 ahbrxd => ahbrxd, -- INPUT
276 ahbrxd => ahbrxd, -- INPUT
275 ahbtxd => ahbtxd, -- OUTPUT
277 ahbtxd => ahbtxd, -- OUTPUT
276 urxd1 => urxd1, -- INPUT
278 urxd1 => urxd1, -- INPUT
277 utxd1 => utxd1, -- OUTPUT
279 utxd1 => utxd1, -- OUTPUT
278
280
279 address => address,
281 address => address,
280 data => data,
282 data => data,
281 nSRAM_BE0 => OPEN,
283 nSRAM_BE0 => OPEN,
282 nSRAM_BE1 => OPEN,
284 nSRAM_BE1 => OPEN,
283 nSRAM_BE2 => OPEN,
285 nSRAM_BE2 => OPEN,
284 nSRAM_BE3 => OPEN,
286 nSRAM_BE3 => OPEN,
285 nSRAM_WE => nSRAM_W,
287 nSRAM_WE => nSRAM_W,
286 nSRAM_CE => nSRAM_CE,
288 nSRAM_CE => nSRAM_CE,
287 nSRAM_OE => nSRAM_G,
289 nSRAM_OE => nSRAM_G,
288 nSRAM_READY => nSRAM_BUSY,
290 nSRAM_READY => nSRAM_BUSY,
289 SRAM_MBE => nSRAM_MBE,
291 SRAM_MBE => nSRAM_MBE,
290
292
291 apbi_ext => apbi_ext,
293 apbi_ext => apbi_ext,
292 apbo_ext => apbo_ext,
294 apbo_ext => apbo_ext,
293 ahbi_s_ext => ahbi_s_ext,
295 ahbi_s_ext => ahbi_s_ext,
294 ahbo_s_ext => ahbo_s_ext,
296 ahbo_s_ext => ahbo_s_ext,
295 ahbi_m_ext => ahbi_m_ext,
297 ahbi_m_ext => ahbi_m_ext,
296 ahbo_m_ext => ahbo_m_ext);
298 ahbo_m_ext => ahbo_m_ext);
297
299
298
300
299 nSRAM_E1 <= nSRAM_CE(0);
301 nSRAM_E1 <= nSRAM_CE(0);
300 nSRAM_E2 <= nSRAM_CE(1);
302 nSRAM_E2 <= nSRAM_CE(1);
301
303
302 -------------------------------------------------------------------------------
304 -------------------------------------------------------------------------------
303 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
305 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
304 -------------------------------------------------------------------------------
306 -------------------------------------------------------------------------------
305 apb_lfr_management_1 : apb_lfr_management
307 apb_lfr_management_1 : apb_lfr_management
306 GENERIC MAP (
308 GENERIC MAP (
307 tech => tech,
309 tech => tech,
308 pindex => 6,
310 pindex => 6,
309 paddr => 6,
311 paddr => 6,
310 pmask => 16#fff#,
312 pmask => 16#fff#,
311 --FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
313 --FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
312 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
314 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
313 PORT MAP (
315 PORT MAP (
314 clk25MHz => clk_25,
316 clk25MHz => clk_25,
315 resetn_25MHz => rstn_25, -- TODO
317 resetn_25MHz => rstn_25, -- TODO
316 --clk24_576MHz => clk_24, -- 49.152MHz/2
318 --clk24_576MHz => clk_24, -- 49.152MHz/2
317 --resetn_24_576MHz => rstn_24, -- TODO
319 --resetn_24_576MHz => rstn_24, -- TODO
318
320
319 grspw_tick => swno.tickout,
321 grspw_tick => swno.tickout,
320 apbi => apbi_ext,
322 apbi => apbi_ext,
321 apbo => apbo_ext(6),
323 apbo => apbo_ext(6),
322
324
323 HK_sample => sample_s(8),
325 HK_sample => sample_s(8),
324 HK_val => sample_val,
326 HK_val => sample_val,
325 HK_sel => HK_SEL,
327 HK_sel => HK_SEL,
326
328
327 DAC_SDO => DAC_SDO,
329 DAC_SDO => DAC_SDO,
328 DAC_SCK => DAC_SCK,
330 DAC_SCK => DAC_SCK,
329 DAC_SYNC => DAC_SYNC,
331 DAC_SYNC => DAC_SYNC,
330 DAC_CAL_EN => DAC_CAL_EN,
332 DAC_CAL_EN => DAC_CAL_EN,
331
333
332 coarse_time => coarse_time,
334 coarse_time => coarse_time,
333 fine_time => fine_time,
335 fine_time => fine_time,
334 LFR_soft_rstn => LFR_soft_rstn
336 LFR_soft_rstn => LFR_soft_rstn
335 );
337 );
336
338
337 -----------------------------------------------------------------------
339 -----------------------------------------------------------------------
338 --- SpaceWire --------------------------------------------------------
340 --- SpaceWire --------------------------------------------------------
339 -----------------------------------------------------------------------
341 -----------------------------------------------------------------------
340
342
341 ------------------------------------------------------------------------------
343 ------------------------------------------------------------------------------
342 -- \/\/\/\/ TODO : spacewire enable should be controled by the SPW IP \/\/\/\/
344 -- \/\/\/\/ TODO : spacewire enable should be controled by the SPW IP \/\/\/\/
343 ------------------------------------------------------------------------------
345 ------------------------------------------------------------------------------
344 spw1_en <= '1';
346 spw1_en <= '1';
345 spw2_en <= '1';
347 spw2_en <= '1';
346 ------------------------------------------------------------------------------
348 ------------------------------------------------------------------------------
347 -- /\/\/\/\ --------------------------------------------------------- /\/\/\/\
349 -- /\/\/\/\ --------------------------------------------------------- /\/\/\/\
348 ------------------------------------------------------------------------------
350 ------------------------------------------------------------------------------
349
351
350 --spw_clk <= clk50MHz;
352 --spw_clk <= clk50MHz;
351 --spw_rxtxclk <= spw_clk;
353 --spw_rxtxclk <= spw_clk;
352 --spw_rxclkn <= NOT spw_rxtxclk;
354 --spw_rxclkn <= NOT spw_rxtxclk;
353
355
354 -- PADS for SPW1
356 -- PADS for SPW1
355 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
357 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
356 PORT MAP (spw1_din, dtmp(0));
358 PORT MAP (spw1_din, dtmp(0));
357 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
359 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
358 PORT MAP (spw1_sin, stmp(0));
360 PORT MAP (spw1_sin, stmp(0));
359 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
361 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
360 PORT MAP (spw1_dout, swno.d(0));
362 PORT MAP (spw1_dout, swno.d(0));
361 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
363 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
362 PORT MAP (spw1_sout, swno.s(0));
364 PORT MAP (spw1_sout, swno.s(0));
363 -- PADS FOR SPW2
365 -- PADS FOR SPW2
364 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
366 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
365 PORT MAP (spw2_din, dtmp(1));
367 PORT MAP (spw2_din, dtmp(1));
366 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
368 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
367 PORT MAP (spw2_sin, stmp(1));
369 PORT MAP (spw2_sin, stmp(1));
368 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
370 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
369 PORT MAP (spw2_dout, swno.d(1));
371 PORT MAP (spw2_dout, swno.d(1));
370 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
372 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
371 PORT MAP (spw2_sout, swno.s(1));
373 PORT MAP (spw2_sout, swno.s(1));
372
374
373 -- GRSPW PHY
375 -- GRSPW PHY
374 --spw1_input: if CFG_SPW_GRSPW = 1 generate
376 --spw1_input: if CFG_SPW_GRSPW = 1 generate
375 spw_inputloop : FOR j IN 0 TO 1 GENERATE
377 spw_inputloop : FOR j IN 0 TO 1 GENERATE
376 spw_phy0 : grspw_phy
378 spw_phy0 : grspw_phy
377 GENERIC MAP(
379 GENERIC MAP(
378 tech => tech_leon,
380 tech => tech_leon,
379 rxclkbuftype => 1,
381 rxclkbuftype => 1,
380 scantest => 0)
382 scantest => 0)
381 PORT MAP(
383 PORT MAP(
382 rxrst => swno.rxrst,
384 rxrst => swno.rxrst,
383 di => dtmp(j),
385 di => dtmp(j),
384 si => stmp(j),
386 si => stmp(j),
385 rxclko => spw_rxclk(j),
387 rxclko => spw_rxclk(j),
386 do => swni.d(j),
388 do => swni.d(j),
387 ndo => swni.nd(j*5+4 DOWNTO j*5),
389 ndo => swni.nd(j*5+4 DOWNTO j*5),
388 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
390 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
389 END GENERATE spw_inputloop;
391 END GENERATE spw_inputloop;
390
392
391 -- SPW core
393 -- SPW core
392 sw0 : grspwm GENERIC MAP(
394 sw0 : grspwm GENERIC MAP(
393 tech => tech_leon,
395 tech => tech_leon,
394 hindex => 1,
396 hindex => 1,
395 pindex => 5,
397 pindex => 5,
396 paddr => 5,
398 paddr => 5,
397 pirq => 11,
399 pirq => 11,
398 sysfreq => 25000, -- CPU_FREQ
400 sysfreq => 25000, -- CPU_FREQ
399 rmap => 1,
401 rmap => 1,
400 rmapcrc => 1,
402 rmapcrc => 1,
401 fifosize1 => 16,
403 fifosize1 => 16,
402 fifosize2 => 16,
404 fifosize2 => 16,
403 rxclkbuftype => 1,
405 rxclkbuftype => 1,
404 rxunaligned => 0,
406 rxunaligned => 0,
405 rmapbufs => 4,
407 rmapbufs => 4,
406 ft => 0,
408 ft => 0,
407 netlist => 0,
409 netlist => 0,
408 ports => 2,
410 ports => 2,
409 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
411 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
410 memtech => tech_leon,
412 memtech => tech_leon,
411 destkey => 2,
413 destkey => 2,
412 spwcore => 1
414 spwcore => 1
413 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
415 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
414 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
416 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
415 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
417 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
416 )
418 )
417 PORT MAP(rstn_25, clk_25, spw_rxclk(0),
419 PORT MAP(rstn_25, clk_25, spw_rxclk(0),
418 spw_rxclk(1),
420 spw_rxclk(1),
419 clk50MHz_int,
421 clk50MHz_int,
420 clk50MHz_int,
422 clk50MHz_int,
421 -- spw_rxtxclk, spw_rxtxclk, spw_rxtxclk, spw_rxtxclk,
423 -- spw_rxtxclk, spw_rxtxclk, spw_rxtxclk, spw_rxtxclk,
422 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
424 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
423 swni, swno);
425 swni, swno);
424
426
425 swni.tickin <= '0';
427 swni.tickin <= '0';
426 swni.rmapen <= '1';
428 swni.rmapen <= '1';
427 swni.clkdiv10 <= "00000100"; -- 50 MHz / (4 + 1) = 10 MHz
429 swni.clkdiv10 <= "00000100"; -- 50 MHz / (4 + 1) = 10 MHz
428 swni.tickinraw <= '0';
430 swni.tickinraw <= '0';
429 swni.timein <= (OTHERS => '0');
431 swni.timein <= (OTHERS => '0');
430 swni.dcrstval <= (OTHERS => '0');
432 swni.dcrstval <= (OTHERS => '0');
431 swni.timerrstval <= (OTHERS => '0');
433 swni.timerrstval <= (OTHERS => '0');
432
434
433 -------------------------------------------------------------------------------
435 -------------------------------------------------------------------------------
434 -- LFR ------------------------------------------------------------------------
436 -- LFR ------------------------------------------------------------------------
435 -------------------------------------------------------------------------------
437 -------------------------------------------------------------------------------
436 LFR_rstn <= LFR_soft_rstn AND rstn_25;
438 LFR_rstn <= LFR_soft_rstn AND rstn_25;
437
439
438 lpp_lfr_1 : lpp_lfr
440 lpp_lfr_1 : lpp_lfr
439 GENERIC MAP (
441 GENERIC MAP (
440 Mem_use => Mem_use,
442 Mem_use => Mem_use,
441 tech => tech,
443 tech => tech,
442 nb_data_by_buffer_size => 32,
444 nb_data_by_buffer_size => 32,
443 --nb_word_by_buffer_size => 30,
445 --nb_word_by_buffer_size => 30,
444 nb_snapshot_param_size => 32,
446 nb_snapshot_param_size => 32,
445 delta_vector_size => 32,
447 delta_vector_size => 32,
446 delta_vector_size_f0_2 => 7, -- log2(96)
448 delta_vector_size_f0_2 => 7, -- log2(96)
447 pindex => 15,
449 pindex => 15,
448 paddr => 15,
450 paddr => 15,
449 pmask => 16#fff#,
451 pmask => 16#fff#,
450 pirq_ms => 6,
452 pirq_ms => 6,
451 pirq_wfp => 14,
453 pirq_wfp => 14,
452 hindex => 2,
454 hindex => 2,
453 top_lfr_version => X"020153", -- aa.bb.cc version
455 top_lfr_version => X"020153", -- aa.bb.cc version
454 -- AA : BOARD NUMBER
456 -- AA : BOARD NUMBER
455 -- 0 => MINI_LFR
457 -- 0 => MINI_LFR
456 -- 1 => EM
458 -- 1 => EM
457 -- 2 => EQM (with A3PE3000)
459 -- 2 => EQM (with A3PE3000)
458 DEBUG_FORCE_DATA_DMA => DEBUG_FORCE_DATA_DMA)
460 DEBUG_FORCE_DATA_DMA => DEBUG_FORCE_DATA_DMA)
459 PORT MAP (
461 PORT MAP (
460 clk => clk_25,
462 clk => clk_25,
461 rstn => LFR_rstn,
463 rstn => LFR_rstn,
462 sample_B => sample_s(2 DOWNTO 0),
464 sample_B => sample_s(2 DOWNTO 0),
463 sample_E => sample_s(7 DOWNTO 3),
465 sample_E => sample_s(7 DOWNTO 3),
464 sample_val => sample_val,
466 sample_val => sample_val,
465 apbi => apbi_ext,
467 apbi => apbi_ext,
466 apbo => apbo_ext(15),
468 apbo => apbo_ext(15),
467 ahbi => ahbi_m_ext,
469 ahbi => ahbi_m_ext,
468 ahbo => ahbo_m_ext(2),
470 ahbo => ahbo_m_ext(2),
469 coarse_time => coarse_time,
471 coarse_time => coarse_time,
470 fine_time => fine_time,
472 fine_time => fine_time,
471 data_shaping_BW => bias_fail_sw,
473 data_shaping_BW => bias_fail_sw,
472 debug_vector => debug_vector,
474 debug_vector => debug_vector,
473 debug_vector_ms => OPEN); --,
475 debug_vector_ms => OPEN); --,
474 --observation_vector_0 => OPEN,
476 --observation_vector_0 => OPEN,
475 --observation_vector_1 => OPEN,
477 --observation_vector_1 => OPEN,
476 --observation_reg => observation_reg);
478 --observation_reg => observation_reg);
477
479
478
480
479 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
481 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
480 sample_s(I) <= sample(I) & '0' & '0';
482 sample_s(I) <= sample(I) & '0' & '0';
481 END GENERATE all_sample;
483 END GENERATE all_sample;
482 sample_s(8) <= sample(8)(13) & sample(8)(13) & sample(8);
484 sample_s(8) <= sample(8)(13) & sample(8)(13) & sample(8);
483
485
484 -----------------------------------------------------------------------------
486 -----------------------------------------------------------------------------
485 --
487 --
486 -----------------------------------------------------------------------------
488 -----------------------------------------------------------------------------
487 USE_ADCDRIVER_true: IF USE_ADCDRIVER = 1 GENERATE
489 USE_ADCDRIVER_true: IF USE_ADCDRIVER = 1 GENERATE
488 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
490 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
489 GENERIC MAP (
491 GENERIC MAP (
490 ChanelCount => 9,
492 ChanelCount => 9,
491 ncycle_cnv_high => 12,
493 ncycle_cnv_high => 12,
492 ncycle_cnv => 25,
494 ncycle_cnv => 25,
493 FILTER_ENABLED => 16#FF#)
495 FILTER_ENABLED => 16#FF#)
494 PORT MAP (
496 PORT MAP (
495 cnv_clk => clk_24,
497 cnv_clk => clk_24,
496 cnv_rstn => rstn_24,
498 cnv_rstn => rstn_24,
497 cnv => ADC_smpclk_s,
499 cnv => ADC_smpclk_s,
498 clk => clk_25,
500 clk => clk_25,
499 rstn => rstn_25,
501 rstn => rstn_25,
500 ADC_data => ADC_data,
502 ADC_data => ADC_data,
501 ADC_nOE => ADC_OEB_bar_CH_s,
503 ADC_nOE => ADC_OEB_bar_CH_s,
502 sample => sample,
504 sample => sample,
503 sample_val => sample_val);
505 sample_val => sample_val);
504
506
505 END GENERATE USE_ADCDRIVER_true;
507 END GENERATE USE_ADCDRIVER_true;
506
508
507 USE_ADCDRIVER_false: IF USE_ADCDRIVER = 0 GENERATE
509 USE_ADCDRIVER_false: IF USE_ADCDRIVER = 0 GENERATE
508 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
510 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
509 GENERIC MAP (
511 GENERIC MAP (
510 ChanelCount => 9,
512 ChanelCount => 9,
511 ncycle_cnv_high => 25,
513 ncycle_cnv_high => 25,
512 ncycle_cnv => 50,
514 ncycle_cnv => 50,
513 FILTER_ENABLED => 16#FF#)
515 FILTER_ENABLED => 16#FF#)
514 PORT MAP (
516 PORT MAP (
515 cnv_clk => clk_24,
517 cnv_clk => clk_24,
516 cnv_rstn => rstn_24,
518 cnv_rstn => rstn_24,
517 cnv => ADC_smpclk_s,
519 cnv => ADC_smpclk_s,
518 clk => clk_25,
520 clk => clk_25,
519 rstn => rstn_25,
521 rstn => rstn_25,
520 ADC_data => ADC_data,
522 ADC_data => ADC_data,
521 ADC_nOE => OPEN,
523 ADC_nOE => OPEN,
522 sample => OPEN,
524 sample => OPEN,
523 sample_val => sample_val);
525 sample_val => sample_val);
524
526
525 ADC_OEB_bar_CH_s(8 DOWNTO 0) <= (OTHERS => '1');
527 ADC_OEB_bar_CH_s(8 DOWNTO 0) <= (OTHERS => '1');
526
528
527 all_sample: FOR I IN 8 DOWNTO 0 GENERATE
529 all_sample: FOR I IN 8 DOWNTO 0 GENERATE
528 ramp_generator_1: ramp_generator
530 ramp_generator_1: ramp_generator
529 GENERIC MAP (
531 GENERIC MAP (
530 DATA_SIZE => 14,
532 DATA_SIZE => 14,
531 VALUE_UNSIGNED_INIT => 2**I,
533 VALUE_UNSIGNED_INIT => 2**I,
532 VALUE_UNSIGNED_INCR => 0,
534 VALUE_UNSIGNED_INCR => 0,
533 VALUE_UNSIGNED_MASK => 16#3FFF#)
535 VALUE_UNSIGNED_MASK => 16#3FFF#)
534 PORT MAP (
536 PORT MAP (
535 clk => clk_25,
537 clk => clk_25,
536 rstn => rstn_25,
538 rstn => rstn_25,
537 new_data => sample_val,
539 new_data => sample_val,
538 output_data => sample(I) );
540 output_data => sample(I) );
539 END GENERATE all_sample;
541 END GENERATE all_sample;
540
542
541
543
542 END GENERATE USE_ADCDRIVER_false;
544 END GENERATE USE_ADCDRIVER_false;
543
545
544
546
545
547
546
548
547 ADC_OEB_bar_CH <= ADC_OEB_bar_CH_s(7 DOWNTO 0);
549 ADC_OEB_bar_CH <= ADC_OEB_bar_CH_s(7 DOWNTO 0);
548
550
549 ADC_smpclk <= ADC_smpclk_s;
551 ADC_smpclk <= ADC_smpclk_s;
550 HK_smpclk <= ADC_smpclk_s;
552 HK_smpclk <= ADC_smpclk_s;
551
553
552
554
553 -----------------------------------------------------------------------------
555 -----------------------------------------------------------------------------
554 -- HK
556 -- HK
555 -----------------------------------------------------------------------------
557 -----------------------------------------------------------------------------
556 ADC_OEB_bar_HK <= ADC_OEB_bar_CH_s(8);
558 ADC_OEB_bar_HK <= ADC_OEB_bar_CH_s(8);
557
559
558 -----------------------------------------------------------------------------
560 -----------------------------------------------------------------------------
559 --
561 --
560 -----------------------------------------------------------------------------
562 -----------------------------------------------------------------------------
561 inst_bootloader: IF USE_BOOTLOADER = 1 GENERATE
563 inst_bootloader: IF USE_BOOTLOADER = 1 GENERATE
562 lpp_bootloader_1: lpp_bootloader
564 lpp_bootloader_1: lpp_bootloader
563 GENERIC MAP (
565 GENERIC MAP (
564 pindex => 13,
566 pindex => 13,
565 paddr => 13,
567 paddr => 13,
566 pmask => 16#fff#,
568 pmask => 16#fff#,
567 hindex => 3,
569 hindex => 3,
568 haddr => 0,
570 haddr => 0,
569 hmask => 16#fff#)
571 hmask => 16#fff#)
570 PORT MAP (
572 PORT MAP (
571 HCLK => clk_25,
573 HCLK => clk_25,
572 HRESETn => rstn_25,
574 HRESETn => rstn_25,
573 apbi => apbi_ext,
575 apbi => apbi_ext,
574 apbo => apbo_ext(13),
576 apbo => apbo_ext(13),
575 ahbsi => ahbi_s_ext,
577 ahbsi => ahbi_s_ext,
576 ahbso => ahbo_s_ext(3));
578 ahbso => ahbo_s_ext(3));
577 END GENERATE inst_bootloader;
579 END GENERATE inst_bootloader;
578
580
579 -----------------------------------------------------------------------------
581 -----------------------------------------------------------------------------
580 --
582 --
581 -----------------------------------------------------------------------------
583 -----------------------------------------------------------------------------
582 USE_DEBUG_VECTOR_IF: IF USE_DEBUG_VECTOR = 1 GENERATE
584 USE_DEBUG_VECTOR_IF: IF USE_DEBUG_VECTOR = 1 GENERATE
583 PROCESS (clk_25, rstn_25)
585 PROCESS (clk_25, rstn_25)
584 BEGIN -- PROCESS
586 BEGIN -- PROCESS
585 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
587 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
586 TAG <= (OTHERS => '0');
588 TAG <= (OTHERS => '0');
587 ELSIF clk_25'event AND clk_25 = '1' THEN -- rising clock edge
589 ELSIF clk_25'event AND clk_25 = '1' THEN -- rising clock edge
588 TAG <= debug_vector(8 DOWNTO 2) & nSRAM_BUSY & debug_vector(0);
590 TAG <= debug_vector(8 DOWNTO 2) & nSRAM_BUSY & debug_vector(0);
589 END IF;
591 END IF;
590 END PROCESS;
592 END PROCESS;
591
593
592
594
593 END GENERATE USE_DEBUG_VECTOR_IF;
595 END GENERATE USE_DEBUG_VECTOR_IF;
594
596
595 USE_DEBUG_VECTOR_IF2: IF USE_DEBUG_VECTOR = 0 GENERATE
597 USE_DEBUG_VECTOR_IF2: IF USE_DEBUG_VECTOR = 0 GENERATE
596 ahbrxd <= TAG(1);
598 ahbrxd <= TAG(1);
597 TAG(3) <= ahbtxd;
599 TAG(3) <= ahbtxd;
598 urxd1 <= TAG(2);
600 urxd1 <= TAG(2);
599 TAG(4) <= utxd1;
601 TAG(4) <= utxd1;
600 TAG(8) <= nSRAM_BUSY;
602 TAG(8) <= nSRAM_BUSY;
601 END GENERATE USE_DEBUG_VECTOR_IF2;
603 END GENERATE USE_DEBUG_VECTOR_IF2;
602
604
603 END beh;
605 END beh;
@@ -1,488 +1,488
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -------------------------------------------------------------------------------
21 -------------------------------------------------------------------------------
22 LIBRARY IEEE;
22 LIBRARY IEEE;
23 USE IEEE.numeric_std.ALL;
23 USE IEEE.numeric_std.ALL;
24 USE IEEE.std_logic_1164.ALL;
24 USE IEEE.std_logic_1164.ALL;
25 LIBRARY grlib;
25 LIBRARY grlib;
26 USE grlib.amba.ALL;
26 USE grlib.amba.ALL;
27 USE grlib.stdlib.ALL;
27 USE grlib.stdlib.ALL;
28 LIBRARY techmap;
28 LIBRARY techmap;
29 USE techmap.gencomp.ALL;
29 USE techmap.gencomp.ALL;
30 LIBRARY gaisler;
30 LIBRARY gaisler;
31 USE gaisler.memctrl.ALL;
31 USE gaisler.memctrl.ALL;
32 USE gaisler.leon3.ALL;
32 USE gaisler.leon3.ALL;
33 USE gaisler.uart.ALL;
33 USE gaisler.uart.ALL;
34 USE gaisler.misc.ALL;
34 USE gaisler.misc.ALL;
35 USE gaisler.spacewire.ALL;
35 USE gaisler.spacewire.ALL;
36 LIBRARY esa;
36 LIBRARY esa;
37 USE esa.memoryctrl.ALL;
37 USE esa.memoryctrl.ALL;
38 LIBRARY lpp;
38 LIBRARY lpp;
39 USE lpp.lpp_memory.ALL;
39 USE lpp.lpp_memory.ALL;
40 USE lpp.lpp_ad_conv.ALL;
40 USE lpp.lpp_ad_conv.ALL;
41 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
41 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
42 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
42 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
43 USE lpp.iir_filter.ALL;
43 USE lpp.iir_filter.ALL;
44 USE lpp.general_purpose.ALL;
44 USE lpp.general_purpose.ALL;
45 USE lpp.lpp_lfr_management.ALL;
45 USE lpp.lpp_lfr_management.ALL;
46 USE lpp.lpp_leon3_soc_pkg.ALL;
46 USE lpp.lpp_leon3_soc_pkg.ALL;
47
47
48 ENTITY LFR_em IS
48 ENTITY LFR_em IS
49
49
50 PORT (
50 PORT (
51 clk100MHz : IN STD_ULOGIC;
51 clk100MHz : IN STD_ULOGIC;
52 clk49_152MHz : IN STD_ULOGIC;
52 clk49_152MHz : IN STD_ULOGIC;
53 reset : IN STD_ULOGIC;
53 reset : IN STD_ULOGIC;
54
54
55 -- TAG --------------------------------------------------------------------
55 -- TAG --------------------------------------------------------------------
56 TAG1 : IN STD_ULOGIC; -- DSU rx data
56 TAG1 : IN STD_ULOGIC; -- DSU rx data
57 TAG3 : OUT STD_ULOGIC; -- DSU tx data
57 TAG3 : OUT STD_ULOGIC; -- DSU tx data
58 -- UART APB ---------------------------------------------------------------
58 -- UART APB ---------------------------------------------------------------
59 TAG2 : IN STD_ULOGIC; -- UART1 rx data
59 TAG2 : IN STD_ULOGIC; -- UART1 rx data
60 TAG4 : OUT STD_ULOGIC; -- UART1 tx data
60 TAG4 : OUT STD_ULOGIC; -- UART1 tx data
61 -- RAM --------------------------------------------------------------------
61 -- RAM --------------------------------------------------------------------
62 address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
62 address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
63 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
63 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
64 nSRAM_BE0 : OUT STD_LOGIC;
64 nSRAM_BE0 : OUT STD_LOGIC;
65 nSRAM_BE1 : OUT STD_LOGIC;
65 nSRAM_BE1 : OUT STD_LOGIC;
66 nSRAM_BE2 : OUT STD_LOGIC;
66 nSRAM_BE2 : OUT STD_LOGIC;
67 nSRAM_BE3 : OUT STD_LOGIC;
67 nSRAM_BE3 : OUT STD_LOGIC;
68 nSRAM_WE : OUT STD_LOGIC;
68 nSRAM_WE : OUT STD_LOGIC;
69 nSRAM_CE : OUT STD_LOGIC;
69 nSRAM_CE : OUT STD_LOGIC;
70 nSRAM_OE : OUT STD_LOGIC;
70 nSRAM_OE : OUT STD_LOGIC;
71 -- SPW --------------------------------------------------------------------
71 -- SPW --------------------------------------------------------------------
72 spw1_din : IN STD_LOGIC;
72 spw1_din : IN STD_LOGIC;
73 spw1_sin : IN STD_LOGIC;
73 spw1_sin : IN STD_LOGIC;
74 spw1_dout : OUT STD_LOGIC;
74 spw1_dout : OUT STD_LOGIC;
75 spw1_sout : OUT STD_LOGIC;
75 spw1_sout : OUT STD_LOGIC;
76 spw2_din : IN STD_LOGIC;
76 spw2_din : IN STD_LOGIC;
77 spw2_sin : IN STD_LOGIC;
77 spw2_sin : IN STD_LOGIC;
78 spw2_dout : OUT STD_LOGIC;
78 spw2_dout : OUT STD_LOGIC;
79 spw2_sout : OUT STD_LOGIC;
79 spw2_sout : OUT STD_LOGIC;
80 -- ADC --------------------------------------------------------------------
80 -- ADC --------------------------------------------------------------------
81 bias_fail_sw : OUT STD_LOGIC;
81 bias_fail_sw : OUT STD_LOGIC;
82 ADC_OEB_bar_CH : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
82 ADC_OEB_bar_CH : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
83 ADC_smpclk : OUT STD_LOGIC;
83 ADC_smpclk : OUT STD_LOGIC;
84 ADC_data : IN STD_LOGIC_VECTOR(13 DOWNTO 0);
84 ADC_data : IN STD_LOGIC_VECTOR(13 DOWNTO 0);
85 -- DAC --------------------------------------------------------------------
85 -- DAC --------------------------------------------------------------------
86 DAC_SDO : OUT STD_LOGIC;
86 DAC_SDO : OUT STD_LOGIC;
87 DAC_SCK : OUT STD_LOGIC;
87 DAC_SCK : OUT STD_LOGIC;
88 DAC_SYNC : OUT STD_LOGIC;
88 DAC_SYNC : OUT STD_LOGIC;
89 DAC_CAL_EN : OUT STD_LOGIC;
89 DAC_CAL_EN : OUT STD_LOGIC;
90 -- HK ---------------------------------------------------------------------
90 -- HK ---------------------------------------------------------------------
91 HK_smpclk : OUT STD_LOGIC;
91 HK_smpclk : OUT STD_LOGIC;
92 ADC_OEB_bar_HK : OUT STD_LOGIC;
92 ADC_OEB_bar_HK : OUT STD_LOGIC;
93 HK_SEL : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
93 HK_SEL : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
94 ---------------------------------------------------------------------------
94 ---------------------------------------------------------------------------
95 TAG8 : OUT STD_LOGIC;
95 TAG8 : OUT STD_LOGIC;
96 led : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
96 led : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
97 );
97 );
98
98
99 END LFR_em;
99 END LFR_em;
100
100
101
101
102 ARCHITECTURE beh OF LFR_em IS
102 ARCHITECTURE beh OF LFR_em IS
103
103
104 --==========================================================================
104 --==========================================================================
105 -- USE_IAP_MEMCTRL allow to use the srctrle-0ws on MINILFR board
105 -- USE_IAP_MEMCTRL allow to use the srctrle-0ws on MINILFR board
106 -- when enabled, chip enable polarity should be reversed and bank size also
106 -- when enabled, chip enable polarity should be reversed and bank size also
107 -- MINILFR -> 1 bank of 4MBytes -> SRBANKSZ=9
107 -- MINILFR -> 1 bank of 4MBytes -> SRBANKSZ=9
108 -- LFR EQM & FM -> 2 banks of 2MBytes -> SRBANKSZ=8
108 -- LFR EQM & FM -> 2 banks of 2MBytes -> SRBANKSZ=8
109 --==========================================================================
109 --==========================================================================
110 CONSTANT USE_IAP_MEMCTRL : integer := 1;
110 CONSTANT USE_IAP_MEMCTRL : integer := 1;
111 --==========================================================================
111 --==========================================================================
112
112
113 SIGNAL clk_50_s : STD_LOGIC := '0';
113 SIGNAL clk_50_s : STD_LOGIC := '0';
114 SIGNAL clk_25 : STD_LOGIC := '0';
114 SIGNAL clk_25 : STD_LOGIC := '0';
115 SIGNAL clk_24 : STD_LOGIC := '0';
115 SIGNAL clk_24 : STD_LOGIC := '0';
116 -----------------------------------------------------------------------------
116 -----------------------------------------------------------------------------
117 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
117 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
118 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
118 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
119
119
120 -- CONSTANTS
120 -- CONSTANTS
121 CONSTANT CFG_PADTECH : INTEGER := inferred;
121 CONSTANT CFG_PADTECH : INTEGER := inferred;
122 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
122 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
123 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
123 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
124 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
124 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
125
125
126 SIGNAL apbi_ext : apb_slv_in_type;
126 SIGNAL apbi_ext : apb_slv_in_type;
127 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5) := (OTHERS => apb_none);
127 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5) := (OTHERS => apb_none);
128 SIGNAL ahbi_s_ext : ahb_slv_in_type;
128 SIGNAL ahbi_s_ext : ahb_slv_in_type;
129 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3) := (OTHERS => ahbs_none);
129 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3) := (OTHERS => ahbs_none);
130 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
130 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
131 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1) := (OTHERS => ahbm_none);
131 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1) := (OTHERS => ahbm_none);
132
132
133 -- Spacewire signals
133 -- Spacewire signals
134 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
134 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
135 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
135 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
136 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
136 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
137 SIGNAL spw_rxtxclk : STD_ULOGIC;
137 SIGNAL spw_rxtxclk : STD_ULOGIC;
138 SIGNAL spw_rxclkn : STD_ULOGIC;
138 SIGNAL spw_rxclkn : STD_ULOGIC;
139 SIGNAL spw_clk : STD_LOGIC;
139 SIGNAL spw_clk : STD_LOGIC;
140 SIGNAL swni : grspw_in_type;
140 SIGNAL swni : grspw_in_type;
141 SIGNAL swno : grspw_out_type;
141 SIGNAL swno : grspw_out_type;
142
142
143 --GPIO
143 --GPIO
144 SIGNAL gpioi : gpio_in_type;
144 SIGNAL gpioi : gpio_in_type;
145 SIGNAL gpioo : gpio_out_type;
145 SIGNAL gpioo : gpio_out_type;
146
146
147 -- AD Converter ADS7886
147 -- AD Converter ADS7886
148 SIGNAL sample : Samples14v(8 DOWNTO 0);
148 SIGNAL sample : Samples14v(8 DOWNTO 0);
149 SIGNAL sample_s : Samples(8 DOWNTO 0);
149 SIGNAL sample_s : Samples(8 DOWNTO 0);
150 SIGNAL sample_val : STD_LOGIC;
150 SIGNAL sample_val : STD_LOGIC;
151 SIGNAL ADC_OEB_bar_CH_s : STD_LOGIC_VECTOR(8 DOWNTO 0);
151 SIGNAL ADC_OEB_bar_CH_s : STD_LOGIC_VECTOR(8 DOWNTO 0);
152
152
153 -----------------------------------------------------------------------------
153 -----------------------------------------------------------------------------
154 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
154 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
155
155
156 -----------------------------------------------------------------------------
156 -----------------------------------------------------------------------------
157 SIGNAL rstn_25 : STD_LOGIC;
157 SIGNAL rstn_25 : STD_LOGIC;
158 SIGNAL rstn_24 : STD_LOGIC;
158 SIGNAL rstn_24 : STD_LOGIC;
159
159
160 SIGNAL LFR_soft_rstn : STD_LOGIC;
160 SIGNAL LFR_soft_rstn : STD_LOGIC;
161 SIGNAL LFR_rstn : STD_LOGIC;
161 SIGNAL LFR_rstn : STD_LOGIC;
162
162
163 SIGNAL ADC_smpclk_s : STD_LOGIC;
163 SIGNAL ADC_smpclk_s : STD_LOGIC;
164 ----------------------------------------------------------------------------
164 ----------------------------------------------------------------------------
165 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
165 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
166 SIGNAL nSRAM_READY : STD_LOGIC;
166 SIGNAL nSRAM_READY : STD_LOGIC;
167
167
168 BEGIN -- beh
168 BEGIN -- beh
169
169
170 -----------------------------------------------------------------------------
170 -----------------------------------------------------------------------------
171 -- CLK
171 -- CLK
172 -----------------------------------------------------------------------------
172 -----------------------------------------------------------------------------
173 rst_domain25 : rstgen PORT MAP (reset, clk_25, '1', rstn_25, OPEN);
173 rst_domain25 : rstgen PORT MAP (reset, clk_25, '1', rstn_25, OPEN);
174 rst_domain24 : rstgen PORT MAP (reset, clk_24, '1', rstn_24, OPEN);
174 rst_domain24 : rstgen PORT MAP (reset, clk_24, '1', rstn_24, OPEN);
175
175
176 PROCESS(clk100MHz)
176 PROCESS(clk100MHz)
177 BEGIN
177 BEGIN
178 IF clk100MHz'EVENT AND clk100MHz = '1' THEN
178 IF clk100MHz'EVENT AND clk100MHz = '1' THEN
179 clk_50_s <= NOT clk_50_s;
179 clk_50_s <= NOT clk_50_s;
180 END IF;
180 END IF;
181 END PROCESS;
181 END PROCESS;
182
182
183 PROCESS(clk_50_s)
183 PROCESS(clk_50_s)
184 BEGIN
184 BEGIN
185 IF clk_50_s'EVENT AND clk_50_s = '1' THEN
185 IF clk_50_s'EVENT AND clk_50_s = '1' THEN
186 clk_25 <= NOT clk_25;
186 clk_25 <= NOT clk_25;
187 END IF;
187 END IF;
188 END PROCESS;
188 END PROCESS;
189
189
190 PROCESS(clk49_152MHz)
190 PROCESS(clk49_152MHz)
191 BEGIN
191 BEGIN
192 IF clk49_152MHz'EVENT AND clk49_152MHz = '1' THEN
192 IF clk49_152MHz'EVENT AND clk49_152MHz = '1' THEN
193 clk_24 <= NOT clk_24;
193 clk_24 <= NOT clk_24;
194 END IF;
194 END IF;
195 END PROCESS;
195 END PROCESS;
196
196
197 -----------------------------------------------------------------------------
197 -----------------------------------------------------------------------------
198
198
199 PROCESS (clk_25, rstn_25)
199 PROCESS (clk_25, rstn_25)
200 BEGIN -- PROCESS
200 BEGIN -- PROCESS
201 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
201 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
202 led(0) <= '0';
202 led(0) <= '0';
203 led(1) <= '0';
203 led(1) <= '0';
204 led(2) <= '0';
204 led(2) <= '0';
205 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
205 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
206 led(0) <= '0';
206 led(0) <= '0';
207 led(1) <= '1';
207 led(1) <= '1';
208 led(2) <= '1';
208 led(2) <= '1';
209 END IF;
209 END IF;
210 END PROCESS;
210 END PROCESS;
211
211
212 --
212 --
213 leon3_soc_1 : leon3_soc
213 leon3_soc_1 : leon3_soc
214 GENERIC MAP (
214 GENERIC MAP (
215 fabtech => apa3e,
215 fabtech => apa3e,
216 memtech => apa3e,
216 memtech => apa3e,
217 padtech => inferred,
217 padtech => inferred,
218 clktech => inferred,
218 clktech => inferred,
219 disas => 0,
219 disas => 0,
220 dbguart => 0,
220 dbguart => 0,
221 pclow => 2,
221 pclow => 2,
222 clk_freq => 25000,
222 clk_freq => 25000,
223 IS_RADHARD => 0,
223 IS_RADHARD => 0,
224 NB_CPU => 1,
224 NB_CPU => 1,
225 ENABLE_FPU => 1,
225 ENABLE_FPU => 1,
226 FPU_NETLIST => 0,
226 FPU_NETLIST => 0,
227 ENABLE_DSU => 1,
227 ENABLE_DSU => 1,
228 ENABLE_AHB_UART => 1,
228 ENABLE_AHB_UART => 0,
229 ENABLE_APB_UART => 1,
229 ENABLE_APB_UART => 1,
230 ENABLE_IRQMP => 1,
230 ENABLE_IRQMP => 1,
231 ENABLE_GPT => 1,
231 ENABLE_GPT => 1,
232 NB_AHB_MASTER => NB_AHB_MASTER,
232 NB_AHB_MASTER => NB_AHB_MASTER,
233 NB_AHB_SLAVE => NB_AHB_SLAVE,
233 NB_AHB_SLAVE => NB_AHB_SLAVE,
234 NB_APB_SLAVE => NB_APB_SLAVE,
234 NB_APB_SLAVE => NB_APB_SLAVE,
235 ADDRESS_SIZE => 20,
235 ADDRESS_SIZE => 20,
236 USES_IAP_MEMCTRLR => USE_IAP_MEMCTRL,
236 USES_IAP_MEMCTRLR => USE_IAP_MEMCTRL,
237 BYPASS_EDAC_MEMCTRLR => '0',
237 BYPASS_EDAC_MEMCTRLR => '0',
238 SRBANKSZ => 9)
238 SRBANKSZ => 9)
239 PORT MAP (
239 PORT MAP (
240 clk => clk_25,
240 clk => clk_25,
241 reset => rstn_25,
241 reset => rstn_25,
242 errorn => OPEN,
242 errorn => OPEN,
243
243
244 ahbrxd => TAG1,
244 ahbrxd => TAG1,
245 ahbtxd => TAG3,
245 ahbtxd => TAG3,
246 urxd1 => TAG2,
246 urxd1 => TAG2,
247 utxd1 => TAG4,
247 utxd1 => TAG4,
248
248
249 address => address,
249 address => address,
250 data => data,
250 data => data,
251 nSRAM_BE0 => nSRAM_BE0,
251 nSRAM_BE0 => nSRAM_BE0,
252 nSRAM_BE1 => nSRAM_BE1,
252 nSRAM_BE1 => nSRAM_BE1,
253 nSRAM_BE2 => nSRAM_BE2,
253 nSRAM_BE2 => nSRAM_BE2,
254 nSRAM_BE3 => nSRAM_BE3,
254 nSRAM_BE3 => nSRAM_BE3,
255 nSRAM_WE => nSRAM_WE,
255 nSRAM_WE => nSRAM_WE,
256 nSRAM_CE => nSRAM_CE_s,
256 nSRAM_CE => nSRAM_CE_s,
257 nSRAM_OE => nSRAM_OE,
257 nSRAM_OE => nSRAM_OE,
258 nSRAM_READY => nSRAM_READY,
258 nSRAM_READY => nSRAM_READY,
259 SRAM_MBE => '0',
259 SRAM_MBE => '0',
260
260
261 apbi_ext => apbi_ext,
261 apbi_ext => apbi_ext,
262 apbo_ext => apbo_ext,
262 apbo_ext => apbo_ext,
263 ahbi_s_ext => ahbi_s_ext,
263 ahbi_s_ext => ahbi_s_ext,
264 ahbo_s_ext => ahbo_s_ext,
264 ahbo_s_ext => ahbo_s_ext,
265 ahbi_m_ext => ahbi_m_ext,
265 ahbi_m_ext => ahbi_m_ext,
266 ahbo_m_ext => ahbo_m_ext);
266 ahbo_m_ext => ahbo_m_ext);
267
267
268 PROCESS (clk_25, rstn_25)
268 PROCESS (clk_25, rstn_25)
269 BEGIN -- PROCESS
269 BEGIN -- PROCESS
270 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
270 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
271 nSRAM_READY <= '1';
271 nSRAM_READY <= '1';
272 ELSIF clk_25'event AND clk_25 = '1' THEN -- rising clock edge
272 ELSIF clk_25'event AND clk_25 = '1' THEN -- rising clock edge
273 nSRAM_READY <= '1';
273 nSRAM_READY <= '1';
274 END IF;
274 END IF;
275 END PROCESS;
275 END PROCESS;
276
276
277 IAP:if USE_IAP_MEMCTRL = 1 GENERATE
277 IAP:if USE_IAP_MEMCTRL = 1 GENERATE
278 nSRAM_CE <= not nSRAM_CE_s(0);
278 nSRAM_CE <= not nSRAM_CE_s(0);
279 END GENERATE;
279 END GENERATE;
280
280
281 NOIAP:if USE_IAP_MEMCTRL = 0 GENERATE
281 NOIAP:if USE_IAP_MEMCTRL = 0 GENERATE
282 nSRAM_CE <= nSRAM_CE_s(0);
282 nSRAM_CE <= nSRAM_CE_s(0);
283 END GENERATE;
283 END GENERATE;
284
284
285 -------------------------------------------------------------------------------
285 -------------------------------------------------------------------------------
286 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
286 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
287 -------------------------------------------------------------------------------
287 -------------------------------------------------------------------------------
288 apb_lfr_management_1 : apb_lfr_management
288 apb_lfr_management_1 : apb_lfr_management
289 GENERIC MAP (
289 GENERIC MAP (
290 tech => apa3e,
290 tech => apa3e,
291 pindex => 6,
291 pindex => 6,
292 paddr => 6,
292 paddr => 6,
293 pmask => 16#fff#,
293 pmask => 16#fff#,
294 -- FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
294 -- FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
295 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
295 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
296 PORT MAP (
296 PORT MAP (
297 clk25MHz => clk_25,
297 clk25MHz => clk_25,
298 resetn_25MHz => rstn_25, -- TODO
298 resetn_25MHz => rstn_25, -- TODO
299 -- clk24_576MHz => clk_24, -- 49.152MHz/2
299 -- clk24_576MHz => clk_24, -- 49.152MHz/2
300 -- resetn_24_576MHz => rstn_24, -- TODO
300 -- resetn_24_576MHz => rstn_24, -- TODO
301
301
302 grspw_tick => swno.tickout,
302 grspw_tick => swno.tickout,
303 apbi => apbi_ext,
303 apbi => apbi_ext,
304 apbo => apbo_ext(6),
304 apbo => apbo_ext(6),
305
305
306 HK_sample => sample_s(8),
306 HK_sample => sample_s(8),
307 HK_val => sample_val,
307 HK_val => sample_val,
308 HK_sel => HK_SEL,
308 HK_sel => HK_SEL,
309
309
310 DAC_SDO => DAC_SDO,
310 DAC_SDO => DAC_SDO,
311 DAC_SCK => DAC_SCK,
311 DAC_SCK => DAC_SCK,
312 DAC_SYNC => DAC_SYNC,
312 DAC_SYNC => DAC_SYNC,
313 DAC_CAL_EN => DAC_CAL_EN,
313 DAC_CAL_EN => DAC_CAL_EN,
314
314
315 coarse_time => coarse_time,
315 coarse_time => coarse_time,
316 fine_time => fine_time,
316 fine_time => fine_time,
317 LFR_soft_rstn => LFR_soft_rstn
317 LFR_soft_rstn => LFR_soft_rstn
318 );
318 );
319
319
320 -----------------------------------------------------------------------
320 -----------------------------------------------------------------------
321 --- SpaceWire --------------------------------------------------------
321 --- SpaceWire --------------------------------------------------------
322 -----------------------------------------------------------------------
322 -----------------------------------------------------------------------
323
323
324 -- SPW_EN <= '1';
324 -- SPW_EN <= '1';
325
325
326 spw_clk <= clk_50_s;
326 spw_clk <= clk_50_s;
327 spw_rxtxclk <= spw_clk;
327 spw_rxtxclk <= spw_clk;
328 spw_rxclkn <= NOT spw_rxtxclk;
328 spw_rxclkn <= NOT spw_rxtxclk;
329
329
330 -- PADS for SPW1
330 -- PADS for SPW1
331 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
331 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
332 PORT MAP (spw1_din, dtmp(0));
332 PORT MAP (spw1_din, dtmp(0));
333 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
333 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
334 PORT MAP (spw1_sin, stmp(0));
334 PORT MAP (spw1_sin, stmp(0));
335 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
335 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
336 PORT MAP (spw1_dout, swno.d(0));
336 PORT MAP (spw1_dout, swno.d(0));
337 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
337 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
338 PORT MAP (spw1_sout, swno.s(0));
338 PORT MAP (spw1_sout, swno.s(0));
339 -- PADS FOR SPW2
339 -- PADS FOR SPW2
340 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
340 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
341 PORT MAP (spw2_din, dtmp(1));
341 PORT MAP (spw2_din, dtmp(1));
342 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
342 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
343 PORT MAP (spw2_sin, stmp(1));
343 PORT MAP (spw2_sin, stmp(1));
344 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
344 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
345 PORT MAP (spw2_dout, swno.d(1));
345 PORT MAP (spw2_dout, swno.d(1));
346 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
346 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
347 PORT MAP (spw2_sout, swno.s(1));
347 PORT MAP (spw2_sout, swno.s(1));
348
348
349 -- GRSPW PHY
349 -- GRSPW PHY
350 --spw1_input: if CFG_SPW_GRSPW = 1 generate
350 --spw1_input: if CFG_SPW_GRSPW = 1 generate
351 spw_inputloop : FOR j IN 0 TO 1 GENERATE
351 spw_inputloop : FOR j IN 0 TO 1 GENERATE
352 spw_phy0 : grspw_phy
352 spw_phy0 : grspw_phy
353 GENERIC MAP(
353 GENERIC MAP(
354 tech => apa3e,
354 tech => apa3e,
355 rxclkbuftype => 1,
355 rxclkbuftype => 1,
356 scantest => 0)
356 scantest => 0)
357 PORT MAP(
357 PORT MAP(
358 rxrst => swno.rxrst,
358 rxrst => swno.rxrst,
359 di => dtmp(j),
359 di => dtmp(j),
360 si => stmp(j),
360 si => stmp(j),
361 rxclko => spw_rxclk(j),
361 rxclko => spw_rxclk(j),
362 do => swni.d(j),
362 do => swni.d(j),
363 ndo => swni.nd(j*5+4 DOWNTO j*5),
363 ndo => swni.nd(j*5+4 DOWNTO j*5),
364 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
364 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
365 END GENERATE spw_inputloop;
365 END GENERATE spw_inputloop;
366
366
367 -- SPW core
367 -- SPW core
368 sw0 : grspwm GENERIC MAP(
368 sw0 : grspwm GENERIC MAP(
369 tech => apa3e,
369 tech => apa3e,
370 hindex => 1,
370 hindex => 1,
371 pindex => 5,
371 pindex => 5,
372 paddr => 5,
372 paddr => 5,
373 pirq => 11,
373 pirq => 11,
374 sysfreq => 25000, -- CPU_FREQ
374 sysfreq => 25000, -- CPU_FREQ
375 rmap => 1,
375 rmap => 1,
376 rmapcrc => 1,
376 rmapcrc => 1,
377 fifosize1 => 16,
377 fifosize1 => 16,
378 fifosize2 => 16,
378 fifosize2 => 16,
379 rxclkbuftype => 1,
379 rxclkbuftype => 1,
380 rxunaligned => 0,
380 rxunaligned => 0,
381 rmapbufs => 4,
381 rmapbufs => 4,
382 ft => 0,
382 ft => 0,
383 netlist => 0,
383 netlist => 0,
384 ports => 2,
384 ports => 2,
385 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
385 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
386 memtech => apa3e,
386 memtech => apa3e,
387 destkey => 2,
387 destkey => 2,
388 spwcore => 1
388 spwcore => 1
389 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
389 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
390 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
390 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
391 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
391 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
392 )
392 )
393 PORT MAP(rstn_25, clk_25, spw_rxclk(0),
393 PORT MAP(rstn_25, clk_25, spw_rxclk(0),
394 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
394 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
395 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
395 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
396 swni, swno);
396 swni, swno);
397
397
398 swni.tickin <= '0';
398 swni.tickin <= '0';
399 swni.rmapen <= '1';
399 swni.rmapen <= '1';
400 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
400 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
401 swni.tickinraw <= '0';
401 swni.tickinraw <= '0';
402 swni.timein <= (OTHERS => '0');
402 swni.timein <= (OTHERS => '0');
403 swni.dcrstval <= (OTHERS => '0');
403 swni.dcrstval <= (OTHERS => '0');
404 swni.timerrstval <= (OTHERS => '0');
404 swni.timerrstval <= (OTHERS => '0');
405
405
406 -------------------------------------------------------------------------------
406 -------------------------------------------------------------------------------
407 -- LFR ------------------------------------------------------------------------
407 -- LFR ------------------------------------------------------------------------
408 -------------------------------------------------------------------------------
408 -------------------------------------------------------------------------------
409 LFR_rstn <= LFR_soft_rstn AND rstn_25;
409 LFR_rstn <= LFR_soft_rstn AND rstn_25;
410
410
411 lpp_lfr_1 : lpp_lfr
411 lpp_lfr_1 : lpp_lfr
412 GENERIC MAP (
412 GENERIC MAP (
413 Mem_use => use_RAM,
413 Mem_use => use_RAM,
414 tech => inferred,
414 tech => inferred,
415 nb_data_by_buffer_size => 32,
415 nb_data_by_buffer_size => 32,
416 --nb_word_by_buffer_size => 30,
416 --nb_word_by_buffer_size => 30,
417 nb_snapshot_param_size => 32,
417 nb_snapshot_param_size => 32,
418 delta_vector_size => 32,
418 delta_vector_size => 32,
419 delta_vector_size_f0_2 => 7, -- log2(96)
419 delta_vector_size_f0_2 => 7, -- log2(96)
420 pindex => 15,
420 pindex => 15,
421 paddr => 15,
421 paddr => 15,
422 pmask => 16#fff#,
422 pmask => 16#fff#,
423 pirq_ms => 6,
423 pirq_ms => 6,
424 pirq_wfp => 14,
424 pirq_wfp => 14,
425 hindex => 2,
425 hindex => 2,
426 top_lfr_version => X"010153", -- aa.bb.cc version
426 top_lfr_version => X"010153", -- aa.bb.cc version
427 -- AA : BOARD NUMBER
427 -- AA : BOARD NUMBER
428 -- 0 => MINI_LFR
428 -- 0 => MINI_LFR
429 -- 1 => EM
429 -- 1 => EM
430 DEBUG_FORCE_DATA_DMA => 0)
430 DEBUG_FORCE_DATA_DMA => 0)
431 PORT MAP (
431 PORT MAP (
432 clk => clk_25,
432 clk => clk_25,
433 rstn => LFR_rstn,
433 rstn => LFR_rstn,
434 sample_B => sample_s(2 DOWNTO 0),
434 sample_B => sample_s(2 DOWNTO 0),
435 sample_E => sample_s(7 DOWNTO 3),
435 sample_E => sample_s(7 DOWNTO 3),
436 sample_val => sample_val,
436 sample_val => sample_val,
437 apbi => apbi_ext,
437 apbi => apbi_ext,
438 apbo => apbo_ext(15),
438 apbo => apbo_ext(15),
439 ahbi => ahbi_m_ext,
439 ahbi => ahbi_m_ext,
440 ahbo => ahbo_m_ext(2),
440 ahbo => ahbo_m_ext(2),
441 coarse_time => coarse_time,
441 coarse_time => coarse_time,
442 fine_time => fine_time,
442 fine_time => fine_time,
443 data_shaping_BW => bias_fail_sw,
443 data_shaping_BW => bias_fail_sw,
444 debug_vector => OPEN,
444 debug_vector => OPEN,
445 debug_vector_ms => OPEN); --,
445 debug_vector_ms => OPEN); --,
446 --observation_vector_0 => OPEN,
446 --observation_vector_0 => OPEN,
447 --observation_vector_1 => OPEN,
447 --observation_vector_1 => OPEN,
448 --observation_reg => observation_reg);
448 --observation_reg => observation_reg);
449
449
450
450
451 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
451 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
452 sample_s(I) <= sample(I) & '0' & '0';
452 sample_s(I) <= sample(I) & '0' & '0';
453 END GENERATE all_sample;
453 END GENERATE all_sample;
454 sample_s(8) <= sample(8)(13) & sample(8)(13) & sample(8);
454 sample_s(8) <= sample(8)(13) & sample(8)(13) & sample(8);
455
455
456 -----------------------------------------------------------------------------
456 -----------------------------------------------------------------------------
457 --
457 --
458 -----------------------------------------------------------------------------
458 -----------------------------------------------------------------------------
459 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
459 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
460 GENERIC MAP (
460 GENERIC MAP (
461 ChanelCount => 9,
461 ChanelCount => 9,
462 ncycle_cnv_high => 12,
462 ncycle_cnv_high => 12,
463 ncycle_cnv => 25,
463 ncycle_cnv => 25,
464 FILTER_ENABLED => 16#FF#)
464 FILTER_ENABLED => 16#FF#)
465 PORT MAP (
465 PORT MAP (
466 cnv_clk => clk_24,
466 cnv_clk => clk_24,
467 cnv_rstn => rstn_24,
467 cnv_rstn => rstn_24,
468 cnv => ADC_smpclk_s,
468 cnv => ADC_smpclk_s,
469 clk => clk_25,
469 clk => clk_25,
470 rstn => rstn_25,
470 rstn => rstn_25,
471 ADC_data => ADC_data,
471 ADC_data => ADC_data,
472 ADC_nOE => ADC_OEB_bar_CH_s,
472 ADC_nOE => ADC_OEB_bar_CH_s,
473 sample => sample,
473 sample => sample,
474 sample_val => sample_val);
474 sample_val => sample_val);
475
475
476 ADC_OEB_bar_CH <= ADC_OEB_bar_CH_s(7 DOWNTO 0);
476 ADC_OEB_bar_CH <= ADC_OEB_bar_CH_s(7 DOWNTO 0);
477
477
478 ADC_smpclk <= ADC_smpclk_s;
478 ADC_smpclk <= ADC_smpclk_s;
479 HK_smpclk <= ADC_smpclk_s;
479 HK_smpclk <= ADC_smpclk_s;
480
480
481 TAG8 <= ADC_smpclk_s;
481 TAG8 <= ADC_smpclk_s;
482
482
483 -----------------------------------------------------------------------------
483 -----------------------------------------------------------------------------
484 -- HK
484 -- HK
485 -----------------------------------------------------------------------------
485 -----------------------------------------------------------------------------
486 ADC_OEB_bar_HK <= ADC_OEB_bar_CH_s(8);
486 ADC_OEB_bar_HK <= ADC_OEB_bar_CH_s(8);
487
487
488 END beh;
488 END beh;
@@ -1,58 +1,59
1 VHDLIB=../..
1 VHDLIB=../..
2 SCRIPTSDIR=$(VHDLIB)/scripts/
2 SCRIPTSDIR=$(VHDLIB)/scripts/
3 GRLIB := $(shell sh $(VHDLIB)/scripts/lpp_relpath.sh)
3 GRLIB := $(shell sh $(VHDLIB)/scripts/lpp_relpath.sh)
4 TOP=UT8ER1M32_test_board_top
4 TOP=UT8ER1M32_test_board_top
5 BOARD=UT8ER1M32-test-board
5 BOARD=UT8ER1M32-test-board
6 include $(VHDLIB)/boards/$(BOARD)/Makefile.inc
6 include $(VHDLIB)/boards/$(BOARD)/Makefile.inc
7 DEVICE=$(PART)-$(PACKAGE)$(SPEED)
7 DEVICE=$(PART)-$(PACKAGE)$(SPEED)
8 UCF=$(VHDLIB)/boards/$(BOARD)/$(TOP).ucf
8 UCF=$(VHDLIB)/boards/$(BOARD)/$(TOP).ucf
9 QSF=$(VHDLIB)/boards/$(BOARD)/$(TOP).qsf
9 QSF=$(VHDLIB)/boards/$(BOARD)/$(TOP).qsf
10 EFFORT=high
10 EFFORT=high
11 XSTOPT=
11 XSTOPT=
12 SYNPOPT="set_option -pipe 0; set_option -retiming 0; set_option -write_apr_constraint 0"
12 SYNPOPT="set_option -pipe 0; set_option -retiming 0; set_option -write_apr_constraint 0"
13 VHDLSYNFILES= UT8ER1M32-test-board_top.vhd
13 VHDLSYNFILES= UT8ER1M32-test-board_top.vhd
14
14
15 PDC=$(VHDLIB)/boards/$(BOARD)/default.pdc
15 PDC=$(VHDLIB)/boards/$(BOARD)/default.pdc
16 BITGEN=$(VHDLIB)/boards/$(BOARD)/default.ut
16 BITGEN=$(VHDLIB)/boards/$(BOARD)/default.ut
17 CLEAN=soft-clean
17 CLEAN=soft-clean
18
18
19 TECHLIBS = proasic3e
19 TECHLIBS = proasic3e
20
20
21 LIBSKIP = core1553bbc core1553brm core1553brt gr1553 corePCIF \
21 LIBSKIP = core1553bbc core1553brm core1553brt gr1553 corePCIF \
22 tmtc openchip hynix ihp gleichmann micron usbhc
22 tmtc openchip hynix ihp gleichmann micron usbhc
23
23
24 DIRSKIP = b1553 pcif leon2 leon2ft crypto satcan ddr usb ata i2c \
24 DIRSKIP = b1553 pcif leon2 leon2ft crypto satcan ddr usb ata i2c \
25 pci grusbhc haps slink ascs pwm coremp7 spi ac97 \
25 pci grusbhc haps slink ascs pwm coremp7 spi ac97 \
26 ./amba_lcd_16x2_ctrlr \
26 ./amba_lcd_16x2_ctrlr \
27 ./general_purpose/lpp_AMR \
27 ./general_purpose/lpp_AMR \
28 ./general_purpose/lpp_balise \
28 ./general_purpose/lpp_balise \
29 ./general_purpose/lpp_delay \
29 ./general_purpose/lpp_delay \
30 ./dsp/lpp_fft \
30 ./dsp/lpp_fft \
31 ./lpp_bootloader \
31 ./lpp_bootloader \
32 ./lpp_cna \
32 ./lpp_cna \
33 ./lpp_demux \
33 ./lpp_demux \
34 ./lpp_matrix \
34 ./lpp_matrix \
35 ./lpp_uart \
35 ./lpp_uart \
36 ./lpp_usb \
36 ./lpp_usb \
37 ./lpp_Header \
37 ./lpp_Header \
38 ./lpp_sim \
38 ./lpp_sim \
39 ./lpp_lfr_pkg \
39 ./lpp_lfr_pkg \
40 ./lpp_debug_lfr_pkg \
40 ./lpp_debug_lfr_pkg \
41 ./lpp_top_lfr
41 ./lpp_top_lfr \
42 ./lfr_management
42
43
43 FILESKIP =lpp_lfr_ms.vhd \
44 FILESKIP =lpp_lfr_ms.vhd \
44 i2cmst.vhd \
45 i2cmst.vhd \
45 APB_MULTI_DIODE.vhd \
46 APB_MULTI_DIODE.vhd \
46 APB_SIMPLE_DIODE.vhd \
47 APB_SIMPLE_DIODE.vhd \
47 Top_MatrixSpec.vhd \
48 Top_MatrixSpec.vhd \
48 APB_FFT.vhd \
49 APB_FFT.vhd \
49 async_1Mx16.vhd \
50 async_1Mx16.vhd \
50 CY7C1061DV33.vhd
51 CY7C1061DV33.vhd
51
52
52
53
53
54
54 include $(GRLIB)/bin/Makefile
55 include $(GRLIB)/bin/Makefile
55 include $(GRLIB)/software/leon3/Makefile
56 include $(GRLIB)/software/leon3/Makefile
56
57
57 ################## project specific targets ##########################
58 ################## project specific targets ##########################
58
59
@@ -1,199 +1,231
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; -- PLE
35 USE gaisler.spacewire.ALL; -- PLE
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;
41 USE lpp.lpp_lfr_pkg.ALL;
42 USE lpp.iir_filter.ALL;
42 USE lpp.iir_filter.ALL;
43 USE lpp.general_purpose.ALL;
43 USE lpp.general_purpose.ALL;
44 USE lpp.lpp_lfr_time_management.ALL;
44 USE lpp.lpp_lfr_time_management.ALL;
45 USE lpp.lpp_leon3_soc_pkg.ALL;
45 USE lpp.lpp_leon3_soc_pkg.ALL;
46
46
47 ENTITY UT8ER1M32_test_board_top IS
47 ENTITY UT8ER1M32_test_board_top IS
48
48
49 PORT (
49 PORT (
50 clk_50 : IN STD_LOGIC;
50 clk_50 : IN STD_LOGIC;
51 clk_49 : IN STD_LOGIC;
51 clk_49 : IN STD_LOGIC;
52 reset : IN STD_LOGIC;
52 reset : IN STD_LOGIC;
53 --BPs
53 --BPs
54 BP0 : IN STD_LOGIC;
54 BP0 : IN STD_LOGIC;
55 BP1 : IN STD_LOGIC;
55 BP1 : IN STD_LOGIC;
56 --LEDs
56 --LEDs
57 LED0 : OUT STD_LOGIC;
57 LED0 : OUT STD_LOGIC;
58 LED1 : OUT STD_LOGIC;
58 LED1 : OUT STD_LOGIC;
59 LED2 : OUT STD_LOGIC;
59 LED2 : OUT STD_LOGIC;
60 --UARTs
60 --UARTs
61 TXD1 : IN STD_LOGIC;
61 TXD1 : IN STD_LOGIC;
62 RXD1 : OUT STD_LOGIC;
62 RXD1 : OUT STD_LOGIC;
63 nCTS1 : OUT STD_LOGIC;
63 nCTS1 : OUT STD_LOGIC;
64 nRTS1 : IN STD_LOGIC;
64 nRTS1 : IN STD_LOGIC;
65
65
66 TXD2 : IN STD_LOGIC;
66 TXD2 : IN STD_LOGIC;
67 RXD2 : OUT STD_LOGIC;
67 RXD2 : OUT STD_LOGIC;
68
68
69 -- SRAM
69 -- SRAM
70 SRAM_nWE : OUT STD_LOGIC;
70 SRAM_nWE : OUT STD_LOGIC;
71 SRAM_nCE1 : OUT STD_LOGIC;
71 SRAM_nCE1 : OUT STD_LOGIC;
72 SRAM_nCE2 : OUT STD_LOGIC;
72 SRAM_nCE2 : OUT STD_LOGIC;
73 SRAM_nOE : OUT STD_LOGIC;
73 SRAM_nOE : OUT STD_LOGIC;
74 SRAM_MBE : INOUT STD_LOGIC;
74 SRAM_MBE : INOUT STD_LOGIC;
75 SRAM_nBUSY : IN STD_LOGIC;
75 SRAM_nBUSY : IN STD_LOGIC;
76 --SRAM_nSCRUB : IN STD_LOGIC;
76 --SRAM_nSCRUB : IN STD_LOGIC;
77 SRAM_A : OUT STD_LOGIC_VECTOR(18 DOWNTO 0);
77 SRAM_A : OUT STD_LOGIC_VECTOR(18 DOWNTO 0);
78 SRAM_DQ : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0)
78 SRAM_DQ : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0)
79 );
79 );
80
80
81 END UT8ER1M32_test_board_top;
81 END UT8ER1M32_test_board_top;
82
82
83
83
84 ARCHITECTURE beh OF UT8ER1M32_test_board_top IS
84 ARCHITECTURE beh OF UT8ER1M32_test_board_top IS
85 SIGNAL clk_25 : STD_LOGIC := '0';
85 SIGNAL clk_25 : STD_LOGIC := '0';
86 -----------------------------------------------------------------------------
86 -----------------------------------------------------------------------------
87 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
87 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
88 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
88 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
89 --
89 --
90 SIGNAL errorn : STD_LOGIC;
90 SIGNAL errorn : STD_LOGIC;
91 -- UART AHB ---------------------------------------------------------------
91 -- UART AHB ---------------------------------------------------------------
92 SIGNAL ahbrxd : STD_ULOGIC; -- DSU rx data
92 SIGNAL ahbrxd : STD_ULOGIC; -- DSU rx data
93 SIGNAL ahbtxd : STD_ULOGIC; -- DSU tx data
93 SIGNAL ahbtxd : STD_ULOGIC; -- DSU tx data
94
94
95 -- UART APB ---------------------------------------------------------------
95 -- UART APB ---------------------------------------------------------------
96 SIGNAL urxd1 : STD_ULOGIC; -- UART1 rx data
96 SIGNAL urxd1 : STD_ULOGIC; -- UART1 rx data
97 SIGNAL utxd1 : STD_ULOGIC; -- UART1 tx data
97 SIGNAL utxd1 : STD_ULOGIC; -- UART1 tx data
98 --
98 --
99 SIGNAL I00_s : STD_LOGIC;
99 SIGNAL I00_s : STD_LOGIC;
100 --
100 --
101 CONSTANT NB_APB_SLAVE : INTEGER := 1;
101 CONSTANT NB_APB_SLAVE : INTEGER := 1;
102 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
102 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
103 CONSTANT NB_AHB_MASTER : INTEGER := 1;
103 CONSTANT NB_AHB_MASTER : INTEGER := 1;
104
104
105 SIGNAL apbi_ext : apb_slv_in_type;
105 SIGNAL apbi_ext : apb_slv_in_type;
106 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5):= (OTHERS => apb_none);
106 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5):= (OTHERS => apb_none);
107 SIGNAL ahbi_s_ext : ahb_slv_in_type;
107 SIGNAL ahbi_s_ext : ahb_slv_in_type;
108 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3):= (OTHERS => ahbs_none);
108 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3):= (OTHERS => ahbs_none);
109 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
109 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
110 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1):= (OTHERS => ahbm_none);
110 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1):= (OTHERS => ahbm_none);
111 --SRAM-----------------------------------------------------------------------
111 --SRAM-----------------------------------------------------------------------
112 SIGNAL SRAM_CE : STD_LOGIC_VECTOR(1 downto 0);
112 SIGNAL SRAM_CE : STD_LOGIC_VECTOR(1 downto 0);
113
114
115 SIGNAL rstn_25 : STD_LOGIC;
116 SIGNAL rstn_50 : STD_LOGIC;
117 SIGNAL rstn_49 : STD_LOGIC;
118
119 SIGNAL clk_lock : STD_LOGIC;
120 SIGNAL clk_busy_counter : STD_LOGIC_VECTOR(3 DOWNTO 0);
121 SIGNAL nSRAM_BUSY_reg : STD_LOGIC;
113
122
114 BEGIN -- beh
123 BEGIN -- beh
115
124
125 rst_gen_global : rstgen PORT MAP (reset, clk_50, '1', rstn_50, OPEN);
126
127 PROCESS (clk_50, rstn_50)
128 BEGIN -- PROCESS
129 IF rstn_50 = '0' THEN -- asynchronous reset (active low)
130 clk_lock <= '0';
131 clk_busy_counter <= (OTHERS => '0');
132 nSRAM_BUSY_reg <= '0';
133 ELSIF clk_50'event AND clk_50 = '1' THEN -- rising clock edge
134 nSRAM_BUSY_reg <= SRAM_nBUSY;
135 IF nSRAM_BUSY_reg = '1' AND SRAM_nBUSY = '0' THEN
136 IF clk_busy_counter = "1111" THEN
137 clk_lock <= '1';
138 ELSE
139 clk_busy_counter <= STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(clk_busy_counter))+1,4));
140 END IF;
141 END IF;
142 END IF;
143 END PROCESS;
144
145 rst_domain25 : rstgen PORT MAP (reset, clk_25, clk_lock, rstn_25, OPEN);
116 -----------------------------------------------------------------------------
146 -----------------------------------------------------------------------------
117 -- CLK
147 -- CLK
118 -----------------------------------------------------------------------------
148 -----------------------------------------------------------------------------
119
120
121 PROCESS(clk_50)
149 PROCESS(clk_50)
122 BEGIN
150 BEGIN
123 IF clk_50'EVENT AND clk_50 = '1' THEN
151 IF clk_50'EVENT AND clk_50 = '1' THEN
124 clk_25 <= NOT clk_25;
152 clk_25 <= NOT clk_25;
125 END IF;
153 END IF;
126 END PROCESS;
154 END PROCESS;
127
155
128 -----------------------------------------------------------------------------
156 -----------------------------------------------------------------------------
129
157 PROCESS (clk_49, rstn_49)
130
131 PROCESS (clk_49, reset)
132 BEGIN -- PROCESS
158 BEGIN -- PROCESS
133 IF reset = '0' THEN -- asynchronous reset (active low)
159 IF rstn_49 = '0' THEN -- asynchronous reset (active low)
134 I00_s <= '0';
160 I00_s <= '0';
135 ELSIF clk_49'event AND clk_49 = '1' THEN -- rising clock edge
161 ELSIF clk_49'event AND clk_49 = '1' THEN -- rising clock edge
136 I00_s <= NOT I00_s;
162 I00_s <= NOT I00_s;
137 END IF;
163 END IF;
138 END PROCESS;
164 END PROCESS;
139
165
140 nCTS1 <= '1';
166 nCTS1 <= '1';
141
167
142 SRAM_nCE1 <= SRAM_CE(0);
168 SRAM_nCE1 <= SRAM_CE(0);
143 SRAM_nCE2 <= SRAM_CE(1);
169 SRAM_nCE2 <= SRAM_CE(1);
144
170
145
171
146
147 leon3_soc_1 : leon3_soc
172 leon3_soc_1 : leon3_soc
148 GENERIC MAP (
173 GENERIC MAP (
149 fabtech => apa3e,
174 fabtech => apa3e,
150 memtech => apa3e,
175 memtech => apa3e,
151 padtech => inferred,
176 padtech => inferred,
152 clktech => inferred,
177 clktech => inferred,
153 disas => 0,
178 disas => 0,
154 dbguart => 0,
179 dbguart => 0,
155 pclow => 2,
180 pclow => 2,
156 clk_freq => 25000,
181 clk_freq => 25000,
157 NB_CPU => 1,
182 NB_CPU => 1,
158 ENABLE_FPU => 0,
183 ENABLE_FPU => 0,
159 FPU_NETLIST => 0,
184 FPU_NETLIST => 0,
160 ENABLE_DSU => 1,
185 ENABLE_DSU => 1,
161 ENABLE_AHB_UART => 1,
186 ENABLE_AHB_UART => 1,
162 ENABLE_APB_UART => 1,
187 ENABLE_APB_UART => 1,
163 ENABLE_IRQMP => 1,
188 ENABLE_IRQMP => 1,
164 ENABLE_GPT => 1,
189 ENABLE_GPT => 1,
165 NB_AHB_MASTER => NB_AHB_MASTER,
190 NB_AHB_MASTER => NB_AHB_MASTER,
166 NB_AHB_SLAVE => NB_AHB_SLAVE,
191 NB_AHB_SLAVE => NB_AHB_SLAVE,
167 NB_APB_SLAVE => NB_APB_SLAVE,
192 NB_APB_SLAVE => NB_APB_SLAVE,
168 ADDRESS_SIZE => 19,
193 ADDRESS_SIZE => 19,
169 USES_IAP_MEMCTRLR => 1)
194 USES_IAP_MEMCTRLR => 1,
195 BYPASS_EDAC_MEMCTRLR => '0',
196 SRBANKSZ => 8,
197 SLOW_TIMING_EMULATION => 1
198 )
170 PORT MAP (
199 PORT MAP (
171 clk => clk_25,
200 clk => clk_25,
172 reset => reset,
201 reset => rstn_25,
173 errorn => errorn,
202 errorn => errorn,
174 ahbrxd => TXD1,
203 ahbrxd => TXD1,
175 ahbtxd => RXD1,
204 ahbtxd => RXD1,
176 urxd1 => TXD2,
205 urxd1 => TXD2,
177 utxd1 => RXD2,
206 utxd1 => RXD2,
207
178 address => SRAM_A,
208 address => SRAM_A,
179 data => SRAM_DQ,
209 data => SRAM_DQ,
180 nSRAM_BE0 => LED0,
210 nSRAM_BE0 => LED0,
181 nSRAM_BE1 => LED1,
211 nSRAM_BE1 => LED1,
182 nSRAM_BE2 => LED2,
212 nSRAM_BE2 => LED2,
183 nSRAM_BE3 => open,
213 nSRAM_BE3 => open,
184 nSRAM_WE => SRAM_nWE,
214 nSRAM_WE => SRAM_nWE,
185 nSRAM_CE => SRAM_CE,
215 nSRAM_CE => SRAM_CE,
186 nSRAM_OE => SRAM_nOE,
216 nSRAM_OE => SRAM_nOE,
187 nSRAM_READY => SRAM_nBUSY,
217 nSRAM_READY => SRAM_nBUSY,
188 SRAM_MBE => SRAM_MBE,
218 SRAM_MBE => SRAM_MBE,
189
219
190 apbi_ext => apbi_ext,
220 apbi_ext => apbi_ext,
191 apbo_ext => apbo_ext,
221 apbo_ext => apbo_ext,
192 ahbi_s_ext => ahbi_s_ext,
222 ahbi_s_ext => ahbi_s_ext,
193 ahbo_s_ext => ahbo_s_ext,
223 ahbo_s_ext => ahbo_s_ext,
194 ahbi_m_ext => ahbi_m_ext,
224 ahbi_m_ext => ahbi_m_ext,
195 ahbo_m_ext => ahbo_m_ext);
225 ahbo_m_ext => ahbo_m_ext);
226
227
196
228
197
229
198
230 END beh;
199 END beh; No newline at end of file
231
@@ -1,572 +1,593
1 -----------------------------------------------------------------------------
1 -----------------------------------------------------------------------------
2 -- LEON3 Demonstration design
2 -- LEON3 Demonstration design
3 -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research
3 -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research
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 2 of the License, or
7 -- the Free Software Foundation; either version 2 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
19
20
20
21 LIBRARY ieee;
21 LIBRARY ieee;
22 USE ieee.std_logic_1164.ALL;
22 USE ieee.std_logic_1164.ALL;
23 LIBRARY grlib;
23 LIBRARY grlib;
24 USE grlib.amba.ALL;
24 USE grlib.amba.ALL;
25 USE grlib.stdlib.ALL;
25 USE grlib.stdlib.ALL;
26 LIBRARY techmap;
26 LIBRARY techmap;
27 USE techmap.gencomp.ALL;
27 USE techmap.gencomp.ALL;
28 LIBRARY gaisler;
28 LIBRARY gaisler;
29 USE gaisler.memctrl.ALL;
29 USE gaisler.memctrl.ALL;
30 USE gaisler.leon3.ALL;
30 USE gaisler.leon3.ALL;
31 USE gaisler.uart.ALL;
31 USE gaisler.uart.ALL;
32 USE gaisler.misc.ALL;
32 USE gaisler.misc.ALL;
33 USE gaisler.spacewire.ALL; -- PLE
33 USE gaisler.spacewire.ALL; -- PLE
34 LIBRARY esa;
34 LIBRARY esa;
35 USE esa.memoryctrl.ALL;
35 USE esa.memoryctrl.ALL;
36 LIBRARY lpp;
36 LIBRARY lpp;
37 USE lpp.lpp_memory.ALL;
37 USE lpp.lpp_memory.ALL;
38 USE lpp.lpp_ad_conv.ALL;
38 USE lpp.lpp_ad_conv.ALL;
39 USE lpp.lpp_lfr_pkg.ALL;
39 USE lpp.lpp_lfr_pkg.ALL;
40 USE lpp.iir_filter.ALL;
40 USE lpp.iir_filter.ALL;
41 USE lpp.general_purpose.ALL;
41 USE lpp.general_purpose.ALL;
42 USE lpp.lpp_leon3_soc_pkg.ALL;
42 USE lpp.lpp_leon3_soc_pkg.ALL;
43 LIBRARY iap;
43 LIBRARY iap;
44 USE iap.memctrl.ALL;
44 USE iap.memctrl.ALL;
45
45
46
46
47 ENTITY leon3_soc IS
47 ENTITY leon3_soc IS
48 GENERIC (
48 GENERIC (
49 fabtech : INTEGER := axcel;--apa3e;
49 fabtech : INTEGER := axcel;--apa3e;
50 memtech : INTEGER := axcel;--apa3e;
50 memtech : INTEGER := axcel;--apa3e;
51 padtech : INTEGER := inferred;
51 padtech : INTEGER := inferred;
52 clktech : INTEGER := inferred;
52 clktech : INTEGER := inferred;
53 disas : INTEGER := 0; -- Enable disassembly to console
53 disas : INTEGER := 0; -- Enable disassembly to console
54 dbguart : INTEGER := 0; -- Print UART on console
54 dbguart : INTEGER := 0; -- Print UART on console
55 pclow : INTEGER := 2;
55 pclow : INTEGER := 2;
56 --
56 --
57 clk_freq : INTEGER := 25000; --kHz
57 clk_freq : INTEGER := 25000; --kHz
58 --
58 --
59 IS_RADHARD : INTEGER := 1;
59 IS_RADHARD : INTEGER := 1;
60 --
60 --
61 NB_CPU : INTEGER := 1;
61 NB_CPU : INTEGER := 1;
62 ENABLE_FPU : INTEGER := 1;
62 ENABLE_FPU : INTEGER := 1;
63 FPU_NETLIST : INTEGER := 0;
63 FPU_NETLIST : INTEGER := 0;
64 ENABLE_DSU : INTEGER := 1;
64 ENABLE_DSU : INTEGER := 1;
65 ENABLE_AHB_UART : INTEGER := 1;
65 ENABLE_AHB_UART : INTEGER := 1;
66 ENABLE_APB_UART : INTEGER := 1;
66 ENABLE_APB_UART : INTEGER := 1;
67 ENABLE_IRQMP : INTEGER := 1;
67 ENABLE_IRQMP : INTEGER := 1;
68 ENABLE_GPT : INTEGER := 1;
68 ENABLE_GPT : INTEGER := 1;
69 --
69 --
70 NB_AHB_MASTER : INTEGER := 1;
70 NB_AHB_MASTER : INTEGER := 1;
71 NB_AHB_SLAVE : INTEGER := 1;
71 NB_AHB_SLAVE : INTEGER := 1;
72 NB_APB_SLAVE : INTEGER := 1;
72 NB_APB_SLAVE : INTEGER := 1;
73 --
73 --
74 ADDRESS_SIZE : INTEGER := 19;
74 ADDRESS_SIZE : INTEGER := 19;
75 USES_IAP_MEMCTRLR : INTEGER := 1;
75 USES_IAP_MEMCTRLR : INTEGER := 1;
76 BYPASS_EDAC_MEMCTRLR : STD_LOGIC := '0';
76 BYPASS_EDAC_MEMCTRLR : STD_LOGIC := '0';
77 SRBANKSZ : INTEGER := 8
77 SRBANKSZ : INTEGER := 8;
78 SLOW_TIMING_EMULATION : integer := 0
78
79
79 );
80 );
80 PORT (
81 PORT (
81 clk : IN STD_ULOGIC;
82 clk : IN STD_ULOGIC;
82 reset : IN STD_ULOGIC;
83 reset : IN STD_ULOGIC;
83
84
84 errorn : OUT STD_ULOGIC;
85 errorn : OUT STD_ULOGIC;
85
86
86 -- UART AHB ---------------------------------------------------------------
87 -- UART AHB ---------------------------------------------------------------
87 ahbrxd : IN STD_ULOGIC; -- DSU rx data
88 ahbrxd : IN STD_ULOGIC; -- DSU rx data
88 ahbtxd : OUT STD_ULOGIC; -- DSU tx data
89 ahbtxd : OUT STD_ULOGIC; -- DSU tx data
89
90
90 -- UART APB ---------------------------------------------------------------
91 -- UART APB ---------------------------------------------------------------
91 urxd1 : IN STD_ULOGIC; -- UART1 rx data
92 urxd1 : IN STD_ULOGIC; -- UART1 rx data
92 utxd1 : OUT STD_ULOGIC; -- UART1 tx data
93 utxd1 : OUT STD_ULOGIC; -- UART1 tx data
93
94
94 -- RAM --------------------------------------------------------------------
95 -- RAM --------------------------------------------------------------------
95 address : OUT STD_LOGIC_VECTOR(ADDRESS_SIZE-1 DOWNTO 0);
96 address : OUT STD_LOGIC_VECTOR(ADDRESS_SIZE-1 DOWNTO 0);
96 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
97 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
97 nSRAM_BE0 : OUT STD_LOGIC;
98 nSRAM_BE0 : OUT STD_LOGIC;
98 nSRAM_BE1 : OUT STD_LOGIC;
99 nSRAM_BE1 : OUT STD_LOGIC;
99 nSRAM_BE2 : OUT STD_LOGIC;
100 nSRAM_BE2 : OUT STD_LOGIC;
100 nSRAM_BE3 : OUT STD_LOGIC;
101 nSRAM_BE3 : OUT STD_LOGIC;
101 nSRAM_WE : OUT STD_LOGIC;
102 nSRAM_WE : OUT STD_LOGIC;
102 nSRAM_CE : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
103 nSRAM_CE : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
103 nSRAM_OE : OUT STD_LOGIC;
104 nSRAM_OE : OUT STD_LOGIC;
104 nSRAM_READY : IN STD_LOGIC;
105 nSRAM_READY : IN STD_LOGIC;
105 SRAM_MBE : INOUT STD_LOGIC;
106 SRAM_MBE : INOUT STD_LOGIC;
106 -- APB --------------------------------------------------------------------
107 -- APB --------------------------------------------------------------------
107 apbi_ext : OUT apb_slv_in_type;
108 apbi_ext : OUT apb_slv_in_type;
108 apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
109 apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
109 -- AHB_Slave --------------------------------------------------------------
110 -- AHB_Slave --------------------------------------------------------------
110 ahbi_s_ext : OUT ahb_slv_in_type;
111 ahbi_s_ext : OUT ahb_slv_in_type;
111 ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
112 ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
112 -- AHB_Master -------------------------------------------------------------
113 -- AHB_Master -------------------------------------------------------------
113 ahbi_m_ext : OUT AHB_Mst_In_Type;
114 ahbi_m_ext : OUT AHB_Mst_In_Type;
114 ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU)
115 ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU)
115
116
116 );
117 );
117 END;
118 END;
118
119
119 ARCHITECTURE Behavioral OF leon3_soc IS
120 ARCHITECTURE Behavioral OF leon3_soc IS
120
121
121 -----------------------------------------------------------------------------
122 -----------------------------------------------------------------------------
122 -- CONFIG -------------------------------------------------------------------
123 -- CONFIG -------------------------------------------------------------------
123 -----------------------------------------------------------------------------
124 -----------------------------------------------------------------------------
124
125
125 -- Clock generator
126 -- Clock generator
126 CONSTANT CFG_CLKMUL : INTEGER := (1);
127 CONSTANT CFG_CLKMUL : INTEGER := (1);
127 CONSTANT CFG_CLKDIV : INTEGER := (1); -- divide 50MHz by 2 to get 25MHz
128 CONSTANT CFG_CLKDIV : INTEGER := (1); -- divide 50MHz by 2 to get 25MHz
128 CONSTANT CFG_OCLKDIV : INTEGER := (1);
129 CONSTANT CFG_OCLKDIV : INTEGER := (1);
129 CONSTANT CFG_CLK_NOFB : INTEGER := 0;
130 CONSTANT CFG_CLK_NOFB : INTEGER := 0;
130 -- LEON3 processor core
131 -- LEON3 processor core
131 CONSTANT CFG_LEON3 : INTEGER := 1;
132 CONSTANT CFG_LEON3 : INTEGER := 1;
132 CONSTANT CFG_NCPU : INTEGER := NB_CPU;
133 CONSTANT CFG_NCPU : INTEGER := NB_CPU;
133 CONSTANT CFG_NWIN : INTEGER := (8); -- to be compatible with BCC and RCC
134 CONSTANT CFG_NWIN : INTEGER := (8); -- to be compatible with BCC and RCC
134 CONSTANT CFG_V8 : INTEGER := 0;
135 CONSTANT CFG_V8 : INTEGER := 0;
135 CONSTANT CFG_MAC : INTEGER := 0;
136 CONSTANT CFG_MAC : INTEGER := 0;
136 CONSTANT CFG_SVT : INTEGER := 0;
137 CONSTANT CFG_SVT : INTEGER := 0;
137 CONSTANT CFG_RSTADDR : INTEGER := 16#00000#;
138 CONSTANT CFG_RSTADDR : INTEGER := 16#00000#;
138 CONSTANT CFG_LDDEL : INTEGER := (1);
139 CONSTANT CFG_LDDEL : INTEGER := (1);
139 CONSTANT CFG_NWP : INTEGER := (0);
140 CONSTANT CFG_NWP : INTEGER := (0);
140 CONSTANT CFG_PWD : INTEGER := 1*2;
141 CONSTANT CFG_PWD : INTEGER := 1*2;
141 CONSTANT CFG_FPU : INTEGER := ENABLE_FPU *(8 + 16 * FPU_NETLIST);
142 CONSTANT CFG_FPU : INTEGER := ENABLE_FPU *(8 + 16 * FPU_NETLIST);
142 -- 1*(8 + 16 * 0) => grfpu-light
143 -- 1*(8 + 16 * 0) => grfpu-light
143 -- 1*(8 + 16 * 1) => netlist
144 -- 1*(8 + 16 * 1) => netlist
144 -- 0*(8 + 16 * 0) => No FPU
145 -- 0*(8 + 16 * 0) => No FPU
145 -- 0*(8 + 16 * 1) => No FPU;
146 -- 0*(8 + 16 * 1) => No FPU;
146 CONSTANT CFG_ICEN : INTEGER := 1;
147 CONSTANT CFG_ICEN : INTEGER := 1;
147 CONSTANT CFG_ISETS : INTEGER := 1;
148 CONSTANT CFG_ISETS : INTEGER := 1;
148 CONSTANT CFG_ISETSZ : INTEGER := 4;
149 CONSTANT CFG_ISETSZ : INTEGER := 4;
149 CONSTANT CFG_ILINE : INTEGER := 4;
150 CONSTANT CFG_ILINE : INTEGER := 4;
150 CONSTANT CFG_IREPL : INTEGER := 0;
151 CONSTANT CFG_IREPL : INTEGER := 0;
151 CONSTANT CFG_ILOCK : INTEGER := 0;
152 CONSTANT CFG_ILOCK : INTEGER := 0;
152 CONSTANT CFG_ILRAMEN : INTEGER := 0;
153 CONSTANT CFG_ILRAMEN : INTEGER := 0;
153 CONSTANT CFG_ILRAMADDR : INTEGER := 16#8E#;
154 CONSTANT CFG_ILRAMADDR : INTEGER := 16#8E#;
154 CONSTANT CFG_ILRAMSZ : INTEGER := 1;
155 CONSTANT CFG_ILRAMSZ : INTEGER := 1;
155 CONSTANT CFG_DCEN : INTEGER := 1;
156 CONSTANT CFG_DCEN : INTEGER := 1;
156 CONSTANT CFG_DSETS : INTEGER := 1;
157 CONSTANT CFG_DSETS : INTEGER := 1;
157 CONSTANT CFG_DSETSZ : INTEGER := 4;
158 CONSTANT CFG_DSETSZ : INTEGER := 4;
158 CONSTANT CFG_DLINE : INTEGER := 4;
159 CONSTANT CFG_DLINE : INTEGER := 4;
159 CONSTANT CFG_DREPL : INTEGER := 0;
160 CONSTANT CFG_DREPL : INTEGER := 0;
160 CONSTANT CFG_DLOCK : INTEGER := 0;
161 CONSTANT CFG_DLOCK : INTEGER := 0;
161 CONSTANT CFG_DSNOOP : INTEGER := 0 + 0 + 4*0;
162 CONSTANT CFG_DSNOOP : INTEGER := 0 + 0 + 4*0;
162 CONSTANT CFG_DLRAMEN : INTEGER := 0;
163 CONSTANT CFG_DLRAMEN : INTEGER := 0;
163 CONSTANT CFG_DLRAMADDR : INTEGER := 16#8F#;
164 CONSTANT CFG_DLRAMADDR : INTEGER := 16#8F#;
164 CONSTANT CFG_DLRAMSZ : INTEGER := 1;
165 CONSTANT CFG_DLRAMSZ : INTEGER := 1;
165 CONSTANT CFG_MMUEN : INTEGER := 0;
166 CONSTANT CFG_MMUEN : INTEGER := 0;
166 CONSTANT CFG_ITLBNUM : INTEGER := 2;
167 CONSTANT CFG_ITLBNUM : INTEGER := 2;
167 CONSTANT CFG_DTLBNUM : INTEGER := 2;
168 CONSTANT CFG_DTLBNUM : INTEGER := 2;
168 CONSTANT CFG_TLB_TYPE : INTEGER := 1 + 0*2;
169 CONSTANT CFG_TLB_TYPE : INTEGER := 1 + 0*2;
169 CONSTANT CFG_TLB_REP : INTEGER := 1;
170 CONSTANT CFG_TLB_REP : INTEGER := 1;
170
171
171 CONSTANT CFG_DSU : INTEGER := ENABLE_DSU;
172 CONSTANT CFG_DSU : INTEGER := ENABLE_DSU;
172 CONSTANT CFG_ITBSZ : INTEGER := 0;
173 CONSTANT CFG_ITBSZ : INTEGER := 0;
173 CONSTANT CFG_ATBSZ : INTEGER := 0;
174 CONSTANT CFG_ATBSZ : INTEGER := 0;
174
175
175 -- AMBA settings
176 -- AMBA settings
176 CONSTANT CFG_DEFMST : INTEGER := (0);
177 CONSTANT CFG_DEFMST : INTEGER := (0);
177 CONSTANT CFG_RROBIN : INTEGER := 1;
178 CONSTANT CFG_RROBIN : INTEGER := 1;
178 CONSTANT CFG_SPLIT : INTEGER := 0;
179 CONSTANT CFG_SPLIT : INTEGER := 0;
179 CONSTANT CFG_AHBIO : INTEGER := 16#FFF#;
180 CONSTANT CFG_AHBIO : INTEGER := 16#FFF#;
180 CONSTANT CFG_APBADDR : INTEGER := 16#800#;
181 CONSTANT CFG_APBADDR : INTEGER := 16#800#;
181
182
182 -- DSU UART
183 -- DSU UART
183 CONSTANT CFG_AHB_UART : INTEGER := ENABLE_AHB_UART;
184 CONSTANT CFG_AHB_UART : INTEGER := ENABLE_AHB_UART;
184
185
185 -- LEON2 memory controller
186 -- LEON2 memory controller
186 CONSTANT CFG_MCTRL_SDEN : INTEGER := 0;
187 CONSTANT CFG_MCTRL_SDEN : INTEGER := 0;
187
188
188 -- UART 1
189 -- UART 1
189 CONSTANT CFG_UART1_ENABLE : INTEGER := ENABLE_APB_UART;
190 CONSTANT CFG_UART1_ENABLE : INTEGER := ENABLE_APB_UART;
190 CONSTANT CFG_UART1_FIFO : INTEGER := 1;
191 CONSTANT CFG_UART1_FIFO : INTEGER := 1;
191
192
192 -- LEON3 interrupt controller
193 -- LEON3 interrupt controller
193 CONSTANT CFG_IRQ3_ENABLE : INTEGER := ENABLE_IRQMP;
194 CONSTANT CFG_IRQ3_ENABLE : INTEGER := ENABLE_IRQMP;
194
195
195 -- Modular timer
196 -- Modular timer
196 CONSTANT CFG_GPT_ENABLE : INTEGER := ENABLE_GPT;
197 CONSTANT CFG_GPT_ENABLE : INTEGER := ENABLE_GPT;
197 CONSTANT CFG_GPT_NTIM : INTEGER := (2);
198 CONSTANT CFG_GPT_NTIM : INTEGER := (2);
198 CONSTANT CFG_GPT_SW : INTEGER := (8);
199 CONSTANT CFG_GPT_SW : INTEGER := (8);
199 CONSTANT CFG_GPT_TW : INTEGER := (32);
200 CONSTANT CFG_GPT_TW : INTEGER := (32);
200 CONSTANT CFG_GPT_IRQ : INTEGER := (8);
201 CONSTANT CFG_GPT_IRQ : INTEGER := (8);
201 CONSTANT CFG_GPT_SEPIRQ : INTEGER := 1;
202 CONSTANT CFG_GPT_SEPIRQ : INTEGER := 1;
202 CONSTANT CFG_GPT_WDOGEN : INTEGER := 0;
203 CONSTANT CFG_GPT_WDOGEN : INTEGER := 0;
203 CONSTANT CFG_GPT_WDOG : INTEGER := 16#0#;
204 CONSTANT CFG_GPT_WDOG : INTEGER := 16#0#;
204 -----------------------------------------------------------------------------
205 -----------------------------------------------------------------------------
205
206
206 -----------------------------------------------------------------------------
207 -----------------------------------------------------------------------------
207 -- SIGNALs
208 -- SIGNALs
208 -----------------------------------------------------------------------------
209 -----------------------------------------------------------------------------
209 CONSTANT maxahbmsp : INTEGER := CFG_NCPU + CFG_AHB_UART + NB_AHB_MASTER;
210 CONSTANT maxahbmsp : INTEGER := CFG_NCPU + CFG_AHB_UART + NB_AHB_MASTER;
210 -- CLK & RST --
211 -- CLK & RST --
211 SIGNAL clk2x : STD_ULOGIC;
212 SIGNAL clk2x : STD_ULOGIC;
212 SIGNAL clkmn : STD_ULOGIC;
213 SIGNAL clkmn : STD_ULOGIC;
213 SIGNAL clkm : STD_ULOGIC;
214 SIGNAL clkm : STD_ULOGIC;
214 SIGNAL rstn : STD_ULOGIC;
215 SIGNAL rstn : STD_ULOGIC;
215 SIGNAL rstraw : STD_ULOGIC;
216 SIGNAL rstraw : STD_ULOGIC;
216 SIGNAL pciclk : STD_ULOGIC;
217 SIGNAL pciclk : STD_ULOGIC;
217 SIGNAL sdclkl : STD_ULOGIC;
218 SIGNAL sdclkl : STD_ULOGIC;
218 SIGNAL cgi : clkgen_in_type;
219 SIGNAL cgi : clkgen_in_type;
219 SIGNAL cgo : clkgen_out_type;
220 SIGNAL cgo : clkgen_out_type;
220 --- AHB / APB
221 --- AHB / APB
221 SIGNAL apbi : apb_slv_in_type;
222 SIGNAL apbi : apb_slv_in_type;
222 SIGNAL apbo : apb_slv_out_vector := (OTHERS => apb_none);
223 SIGNAL apbo : apb_slv_out_vector := (OTHERS => apb_none);
223 SIGNAL ahbsi : ahb_slv_in_type;
224 SIGNAL ahbsi : ahb_slv_in_type;
224 SIGNAL ahbso : ahb_slv_out_vector := (OTHERS => ahbs_none);
225 SIGNAL ahbso : ahb_slv_out_vector := (OTHERS => ahbs_none);
225 SIGNAL ahbmi : ahb_mst_in_type;
226 SIGNAL ahbmi : ahb_mst_in_type;
226 SIGNAL ahbmo : ahb_mst_out_vector := (OTHERS => ahbm_none);
227 SIGNAL ahbmo : ahb_mst_out_vector := (OTHERS => ahbm_none);
227 --UART
228 --UART
228 SIGNAL ahbuarti : uart_in_type;
229 SIGNAL ahbuarti : uart_in_type;
229 SIGNAL ahbuarto : uart_out_type;
230 SIGNAL ahbuarto : uart_out_type;
230 SIGNAL apbuarti : uart_in_type;
231 SIGNAL apbuarti : uart_in_type;
231 SIGNAL apbuarto : uart_out_type;
232 SIGNAL apbuarto : uart_out_type;
232 --MEM CTRLR
233 --MEM CTRLR
233 SIGNAL memi : memory_in_type;
234 SIGNAL memi : memory_in_type;
234 SIGNAL memo : memory_out_type;
235 SIGNAL memo : memory_out_type;
235 SIGNAL wpo : wprot_out_type;
236 SIGNAL wpo : wprot_out_type;
236 SIGNAL sdo : sdram_out_type;
237 SIGNAL sdo : sdram_out_type;
237 SIGNAL mbe : STD_LOGIC; -- enable memory programming
238 SIGNAL mbe : STD_LOGIC; -- enable memory programming
238 SIGNAL mbe_drive : STD_LOGIC; -- drive the MBE memory signal
239 SIGNAL mbe_drive : STD_LOGIC; -- drive the MBE memory signal
239 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
240 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
240 SIGNAL nSRAM_OE_s : STD_LOGIC;
241 SIGNAL nSRAM_OE_s : STD_LOGIC;
241 --IRQ
242 --IRQ
242 SIGNAL irqi : irq_in_vector(0 TO CFG_NCPU-1);
243 SIGNAL irqi : irq_in_vector(0 TO CFG_NCPU-1);
243 SIGNAL irqo : irq_out_vector(0 TO CFG_NCPU-1);
244 SIGNAL irqo : irq_out_vector(0 TO CFG_NCPU-1);
244 --Timer
245 --Timer
245 SIGNAL gpti : gptimer_in_type;
246 SIGNAL gpti : gptimer_in_type;
246 SIGNAL gpto : gptimer_out_type;
247 SIGNAL gpto : gptimer_out_type;
247 --DSU
248 --DSU
248 SIGNAL dbgi : l3_debug_in_vector(0 TO CFG_NCPU-1);
249 SIGNAL dbgi : l3_debug_in_vector(0 TO CFG_NCPU-1);
249 SIGNAL dbgo : l3_debug_out_vector(0 TO CFG_NCPU-1);
250 SIGNAL dbgo : l3_debug_out_vector(0 TO CFG_NCPU-1);
250 SIGNAL dsui : dsu_in_type;
251 SIGNAL dsui : dsu_in_type;
251 SIGNAL dsuo : dsu_out_type;
252 SIGNAL dsuo : dsu_out_type;
252 -----------------------------------------------------------------------------
253 -----------------------------------------------------------------------------
253
254 SIGNAL memo_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
255 SIGNAL memi_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
254
256
255 BEGIN
257 BEGIN
256
258
257
259
258 ----------------------------------------------------------------------
260 ----------------------------------------------------------------------
259 --- Reset and Clock generation -------------------------------------
261 --- Reset and Clock generation -------------------------------------
260 ----------------------------------------------------------------------
262 ----------------------------------------------------------------------
261
263
262 cgi.pllctrl <= "00";
264 cgi.pllctrl <= "00";
263 cgi.pllrst <= rstraw;
265 cgi.pllrst <= rstraw;
264
266
265 rst0 : rstgen PORT MAP (reset, clkm, cgo.clklock, rstn, rstraw);
267 rst0 : rstgen PORT MAP (reset, clkm, cgo.clklock, rstn, rstraw);
266
268
267 clkgen0 : clkgen -- clock generator
269 clkgen0 : clkgen -- clock generator
268 GENERIC MAP (clktech, CFG_CLKMUL, CFG_CLKDIV, CFG_MCTRL_SDEN,
270 GENERIC MAP (clktech, CFG_CLKMUL, CFG_CLKDIV, CFG_MCTRL_SDEN,
269 CFG_CLK_NOFB, 0, 0, 0, clk_freq, 0, 0, CFG_OCLKDIV)
271 CFG_CLK_NOFB, 0, 0, 0, clk_freq, 0, 0, CFG_OCLKDIV)
270 PORT MAP (clk, clk, clkm, clkmn, clk2x, sdclkl, pciclk, cgi, cgo);
272 PORT MAP (clk, clk, clkm, clkmn, clk2x, sdclkl, pciclk, cgi, cgo);
271
273
272 ----------------------------------------------------------------------
274 ----------------------------------------------------------------------
273 --- LEON3 processor / DSU / IRQ ------------------------------------
275 --- LEON3 processor / DSU / IRQ ------------------------------------
274 ----------------------------------------------------------------------
276 ----------------------------------------------------------------------
275
277
276 l3 : IF CFG_LEON3 = 1 GENERATE
278 l3 : IF CFG_LEON3 = 1 GENERATE
277 cpu : FOR i IN 0 TO CFG_NCPU-1 GENERATE
279 cpu : FOR i IN 0 TO CFG_NCPU-1 GENERATE
278 leon3_non_radhard : IF IS_RADHARD = 0 GENERATE
280 leon3_non_radhard : IF IS_RADHARD = 0 GENERATE
279 u0 : leon3s -- LEON3 processor
281 u0 : leon3s -- LEON3 processor
280 GENERIC MAP (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8,
282 GENERIC MAP (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8,
281 0, CFG_MAC, pclow, 0, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE,
283 0, CFG_MAC, pclow, 0, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE,
282 CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ,
284 CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ,
283 CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN,
285 CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN,
284 CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP,
286 CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP,
285 CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1)
287 CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1)
286 PORT MAP (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso,
288 PORT MAP (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso,
287 irqi(i), irqo(i), dbgi(i), dbgo(i));
289 irqi(i), irqo(i), dbgi(i), dbgo(i));
288 END GENERATE leon3_non_radhard;
290 END GENERATE leon3_non_radhard;
289
291
290 leon3_radhard_i : IF IS_RADHARD = 1 GENERATE
292 leon3_radhard_i : IF IS_RADHARD = 1 GENERATE
291 cpu : leon3ft
293 cpu : leon3ft
292 GENERIC MAP (
294 GENERIC MAP (
293 HINDEX => i, --: integer; --CPU_HINDEX,
295 HINDEX => i, --: integer; --CPU_HINDEX,
294 FABTECH => fabtech, --CFG_TECH,
296 FABTECH => fabtech, --CFG_TECH,
295 MEMTECH => memtech, --CFG_TECH,
297 MEMTECH => memtech, --CFG_TECH,
296 NWINDOWS => CFG_NWIN, --CFG_NWIN,
298 NWINDOWS => CFG_NWIN, --CFG_NWIN,
297 DSU => CFG_DSU, --condSel (HAS_DEBUG, 1, 0),
299 DSU => CFG_DSU, --condSel (HAS_DEBUG, 1, 0),
298 FPU => CFG_FPU, --CFG_FPU,
300 FPU => CFG_FPU, --CFG_FPU,
299 V8 => CFG_V8, --CFG_V8,
301 V8 => CFG_V8, --CFG_V8,
300 CP => 0, --CFG_CP,
302 CP => 0, --CFG_CP,
301 MAC => CFG_MAC, --CFG_MAC,
303 MAC => CFG_MAC, --CFG_MAC,
302 PCLOW => pclow, --CFG_PCLOW,
304 PCLOW => pclow, --CFG_PCLOW,
303 NOTAG => 0, --CFG_NOTAG,
305 NOTAG => 0, --CFG_NOTAG,
304 NWP => CFG_NWP, --CFG_NWP,
306 NWP => CFG_NWP, --CFG_NWP,
305 ICEN => CFG_ICEN, --CFG_ICEN,
307 ICEN => CFG_ICEN, --CFG_ICEN,
306 IREPL => CFG_IREPL, --CFG_IREPL,
308 IREPL => CFG_IREPL, --CFG_IREPL,
307 ISETS => CFG_ISETS, --CFG_ISETS,
309 ISETS => CFG_ISETS, --CFG_ISETS,
308 ILINESIZE => CFG_ILINE, --CFG_ILINE,
310 ILINESIZE => CFG_ILINE, --CFG_ILINE,
309 ISETSIZE => CFG_ISETSZ, --CFG_ISETSZ,
311 ISETSIZE => CFG_ISETSZ, --CFG_ISETSZ,
310 ISETLOCK => CFG_ILOCK, --CFG_ILOCK,
312 ISETLOCK => CFG_ILOCK, --CFG_ILOCK,
311 DCEN => CFG_DCEN, --CFG_DCEN,
313 DCEN => CFG_DCEN, --CFG_DCEN,
312 DREPL => CFG_DREPL, --CFG_DREPL,
314 DREPL => CFG_DREPL, --CFG_DREPL,
313 DSETS => CFG_DSETS, --CFG_DSETS,
315 DSETS => CFG_DSETS, --CFG_DSETS,
314 DLINESIZE => CFG_DLINE, --CFG_DLINE,
316 DLINESIZE => CFG_DLINE, --CFG_DLINE,
315 DSETSIZE => CFG_DSETSZ, --CFG_DSETSZ,
317 DSETSIZE => CFG_DSETSZ, --CFG_DSETSZ,
316 DSETLOCK => CFG_DLOCK, --CFG_DLOCK,
318 DSETLOCK => CFG_DLOCK, --CFG_DLOCK,
317 DSNOOP => CFG_DSNOOP, --CFG_DSNOOP,
319 DSNOOP => CFG_DSNOOP, --CFG_DSNOOP,
318 ILRAM => CFG_ILRAMEN, --CFG_ILRAMEN,
320 ILRAM => CFG_ILRAMEN, --CFG_ILRAMEN,
319 ILRAMSIZE => CFG_ILRAMSZ, --CFG_ILRAMSZ,
321 ILRAMSIZE => CFG_ILRAMSZ, --CFG_ILRAMSZ,
320 ILRAMSTART => CFG_ILRAMADDR, --CFG_ILRAMADDR,
322 ILRAMSTART => CFG_ILRAMADDR, --CFG_ILRAMADDR,
321 DLRAM => CFG_DLRAMEN, --CFG_DLRAMEN,
323 DLRAM => CFG_DLRAMEN, --CFG_DLRAMEN,
322 DLRAMSIZE => CFG_DLRAMSZ, --CFG_DLRAMSZ,
324 DLRAMSIZE => CFG_DLRAMSZ, --CFG_DLRAMSZ,
323 DLRAMSTART => CFG_DLRAMADDR, --CFG_DLRAMADDR,
325 DLRAMSTART => CFG_DLRAMADDR, --CFG_DLRAMADDR,
324 MMUEN => CFG_MMUEN, --CFG_MMUEN,
326 MMUEN => CFG_MMUEN, --CFG_MMUEN,
325 ITLBNUM => CFG_ITLBNUM, --CFG_ITLBNUM,
327 ITLBNUM => CFG_ITLBNUM, --CFG_ITLBNUM,
326 DTLBNUM => CFG_DTLBNUM, --CFG_DTLBNUM,
328 DTLBNUM => CFG_DTLBNUM, --CFG_DTLBNUM,
327 TLB_TYPE => CFG_TLB_TYPE, --CFG_TLB_TYPE,
329 TLB_TYPE => CFG_TLB_TYPE, --CFG_TLB_TYPE,
328 TLB_REP => CFG_TLB_REP, --CFG_TLB_REP,
330 TLB_REP => CFG_TLB_REP, --CFG_TLB_REP,
329 LDDEL => CFG_LDDEL, --CFG_LDDEL,
331 LDDEL => CFG_LDDEL, --CFG_LDDEL,
330 DISAS => disas, --condSel (SIM_ENABLED, 1, 0),
332 DISAS => disas, --condSel (SIM_ENABLED, 1, 0),
331 TBUF => CFG_ITBSZ, --CFG_ITBSZ,
333 TBUF => CFG_ITBSZ, --CFG_ITBSZ,
332 PWD => CFG_PWD, --CFG_PWD,
334 PWD => CFG_PWD, --CFG_PWD,
333 SVT => CFG_SVT, --CFG_SVT,
335 SVT => CFG_SVT, --CFG_SVT,
334 RSTADDR => CFG_RSTADDR, --CFG_RSTADDR,
336 RSTADDR => CFG_RSTADDR, --CFG_RSTADDR,
335 SMP => CFG_NCPU-1, --CFG_NCPU-1,
337 SMP => CFG_NCPU-1, --CFG_NCPU-1,
336 IUFT => 2, --: integer range 0 to 4;--CFG_IUFT_EN,
338 IUFT => 2, --: integer range 0 to 4;--CFG_IUFT_EN,
337 FPFT => 1, --: integer range 0 to 4;--CFG_FPUFT_EN,
339 FPFT => 1, --: integer range 0 to 4;--CFG_FPUFT_EN,
338 CMFT => 1, --: integer range 0 to 1;--CFG_CACHE_FT_EN,
340 CMFT => 1, --: integer range 0 to 1;--CFG_CACHE_FT_EN,
339 IUINJ => 0, --: integer; --CFG_RF_ERRINJ,
341 IUINJ => 0, --: integer; --CFG_RF_ERRINJ,
340 CEINJ => 0, --: integer range 0 to 3;--CFG_CACHE_ERRINJ,
342 CEINJ => 0, --: integer range 0 to 3;--CFG_CACHE_ERRINJ,
341 CACHED => 0, --: integer; --CFG_DFIXED,
343 CACHED => 0, --: integer; --CFG_DFIXED,
342 NETLIST => 0, --: integer; --CFG_LEON3_NETLIST,
344 NETLIST => 0, --: integer; --CFG_LEON3_NETLIST,
343 SCANTEST => 0, --: integer; --CFG_SCANTEST,
345 SCANTEST => 0, --: integer; --CFG_SCANTEST,
344 MMUPGSZ => 0, --: integer range 0 to 5;--CFG_MMU_PAGE,
346 MMUPGSZ => 0, --: integer range 0 to 5;--CFG_MMU_PAGE,
345 BP => 1) --CFG_BP
347 BP => 1) --CFG_BP
346 PORT MAP ( --
348 PORT MAP ( --
347 rstn => rstn, --rst_n,
349 rstn => rstn, --rst_n,
348 clk => clkm, --clk,
350 clk => clkm, --clk,
349 ahbi => ahbmi, --ahbmi,
351 ahbi => ahbmi, --ahbmi,
350 ahbo => ahbmo(i), --ahbmo(CPU_HINDEX),
352 ahbo => ahbmo(i), --ahbmo(CPU_HINDEX),
351 ahbsi => ahbsi, --ahbsi,
353 ahbsi => ahbsi, --ahbsi,
352 ahbso => ahbso, --ahbso,
354 ahbso => ahbso, --ahbso,
353 irqi => irqi(i), --irqi(CPU_HINDEX),
355 irqi => irqi(i), --irqi(CPU_HINDEX),
354 irqo => irqo(i), --irqo(CPU_HINDEX),
356 irqo => irqo(i), --irqo(CPU_HINDEX),
355 dbgi => dbgi(i), --dbgi(CPU_HINDEX),
357 dbgi => dbgi(i), --dbgi(CPU_HINDEX),
356 dbgo => dbgo(i), --dbgo(CPU_HINDEX),
358 dbgo => dbgo(i), --dbgo(CPU_HINDEX),
357 gclk => clkm --clk
359 gclk => clkm --clk
358 );
360 );
359 END GENERATE leon3_radhard_i;
361 END GENERATE leon3_radhard_i;
360
362
361 END GENERATE;
363 END GENERATE;
362 errorn_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (errorn, dbgo(0).error);
364 errorn_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (errorn, dbgo(0).error);
363
365
364 dsugen : IF CFG_DSU = 1 GENERATE
366 dsugen : IF CFG_DSU = 1 GENERATE
365 dsu0 : dsu3 -- LEON3 Debug Support Unit
367 dsu0 : dsu3 -- LEON3 Debug Support Unit
366 GENERIC MAP (hindex => 0, -- TODO : hindex => 2
368 GENERIC MAP (hindex => 0, -- TODO : hindex => 2
367 haddr => 16#900#, hmask => 16#F00#,
369 haddr => 16#900#, hmask => 16#F00#,
368 ncpu => CFG_NCPU, tbits => 30, tech => memtech,
370 ncpu => CFG_NCPU, tbits => 30, tech => memtech,
369 irq => 0, kbytes => CFG_ATBSZ)
371 irq => 0, kbytes => CFG_ATBSZ)
370 PORT MAP (rstn, clkm, ahbmi, ahbsi, ahbso(0),-- TODO :ahbso(2)
372 PORT MAP (rstn, clkm, ahbmi, ahbsi, ahbso(0),-- TODO :ahbso(2)
371 dbgo, dbgi, dsui, dsuo);
373 dbgo, dbgi, dsui, dsuo);
372 dsui.enable <= '1';
374 dsui.enable <= '1';
373 dsui.break <= '0';
375 dsui.break <= '0';
374 END GENERATE;
376 END GENERATE;
375 END GENERATE;
377 END GENERATE;
376
378
377 nodsu : IF CFG_DSU = 0 GENERATE
379 nodsu : IF CFG_DSU = 0 GENERATE
378 ahbso(0) <= ahbs_none;
380 ahbso(0) <= ahbs_none;
379 dsuo.tstop <= '0';
381 dsuo.tstop <= '0';
380 dsuo.active <= '0';
382 dsuo.active <= '0';
381 END GENERATE;
383 END GENERATE;
382
384
383 irqctrl : IF CFG_IRQ3_ENABLE /= 0 GENERATE
385 irqctrl : IF CFG_IRQ3_ENABLE /= 0 GENERATE
384 irqctrl0 : irqmp -- interrupt controller
386 irqctrl0 : irqmp -- interrupt controller
385 GENERIC MAP (pindex => 2, paddr => 2, ncpu => CFG_NCPU)
387 GENERIC MAP (pindex => 2, paddr => 2, ncpu => CFG_NCPU)
386 PORT MAP (rstn, clkm, apbi, apbo(2), irqo, irqi);
388 PORT MAP (rstn, clkm, apbi, apbo(2), irqo, irqi);
387 END GENERATE;
389 END GENERATE;
388 irq3 : IF CFG_IRQ3_ENABLE = 0 GENERATE
390 irq3 : IF CFG_IRQ3_ENABLE = 0 GENERATE
389 x : FOR i IN 0 TO CFG_NCPU-1 GENERATE
391 x : FOR i IN 0 TO CFG_NCPU-1 GENERATE
390 irqi(i).irl <= "0000";
392 irqi(i).irl <= "0000";
391 END GENERATE;
393 END GENERATE;
392 apbo(2) <= apb_none;
394 apbo(2) <= apb_none;
393 END GENERATE;
395 END GENERATE;
394
396
395 ----------------------------------------------------------------------
397 ----------------------------------------------------------------------
396 --- Memory controllers ---------------------------------------------
398 --- Memory controllers ---------------------------------------------
397 ----------------------------------------------------------------------
399 ----------------------------------------------------------------------
398 ESAMEMCT : IF USES_IAP_MEMCTRLR = 0 GENERATE
400 ESAMEMCT : IF USES_IAP_MEMCTRLR = 0 GENERATE
399 memctrlr : mctrl GENERIC MAP (
401 memctrlr : mctrl GENERIC MAP (
400 hindex => 2,
402 hindex => 2,
401 pindex => 0,
403 pindex => 0,
402 paddr => 0,
404 paddr => 0,
403 srbanks => 1
405 srbanks => 1
404 )
406 )
405 PORT MAP (rstn, clkm, memi, memo, ahbsi, ahbso(2), apbi, apbo(0), wpo, sdo);
407 PORT MAP (rstn, clkm, memi, memo, ahbsi, ahbso(2), apbi, apbo(0), wpo, sdo);
406 memi.bexcn <= '1';
408 memi.bexcn <= '1';
407 memi.brdyn <= '1';
409 memi.brdyn <= '1';
408
410
409 nSRAM_CE_s <= NOT (memo.ramsn(1 DOWNTO 0));
411 nSRAM_CE_s <= NOT (memo.ramsn(1 DOWNTO 0));
410 nSRAM_OE_s <= memo.ramoen(0);
412 nSRAM_OE_s <= memo.ramoen(0);
411 END GENERATE;
413 END GENERATE;
412
414
413 IAPMEMCT : IF USES_IAP_MEMCTRLR = 1 GENERATE
415 IAPMEMCT : IF USES_IAP_MEMCTRLR = 1 GENERATE
414 memctrlr : srctrle_0ws
416 memctrlr : srctrle_0ws
415 GENERIC MAP(
417 GENERIC MAP(
416 hindex => 2, -- TODO : hindex => 0
418 hindex => 2, -- TODO : hindex => 0
417 pindex => 0,
419 pindex => 0,
418 paddr => 0,
420 paddr => 0,
419 srbanks => 2,
421 srbanks => 2,
420 banksz => SRBANKSZ, --512k * 32
422 banksz => SRBANKSZ, --512k * 32
421 rmw => 1,
423 rmw => 1,
422 --Aeroflex memory generics:
424 --Aeroflex memory generics:
423 mbpedac => BYPASS_EDAC_MEMCTRLR,
425 mbpedac => BYPASS_EDAC_MEMCTRLR,
424 mprog => 1, -- program memory by default values after reset
426 mprog => 1, -- program memory by default values after reset
425 mpsrate => 15, -- default scrub rate period
427 mpsrate => 15, -- default scrub rate period
426 mpb2s => 14, -- default busy to scrub delay
428 mpb2s => 14, -- default busy to scrub delay
427 mpapb => 1, -- instantiate apb register
429 mpapb => 1, -- instantiate apb register
428 mchipcnt => 2,
430 mchipcnt => 2,
429 mpenall => 1 -- when 0 program only E1 chip, else program all dies
431 mpenall => 1 -- when 0 program only E1 chip, else program all dies
430 )
432 )
431 PORT MAP (
433 PORT MAP (
432 rst => rstn,
434 rst => rstn,
433 clk => clkm,
435 clk => clkm,
434 ahbsi => ahbsi,
436 ahbsi => ahbsi,
435 ahbso => ahbso(2), -- TODO :ahbso(0),
437 ahbso => ahbso(2), -- TODO :ahbso(0),
436 apbi => apbi,
438 apbi => apbi,
437 apbo => apbo(0),
439 apbo => apbo(0),
438 sri => memi,
440 sri => memi,
439 sro => memo,
441 sro => memo,
440 --Aeroflex memory signals:
442 --Aeroflex memory signals:
441 ucerr => OPEN, -- uncorrectable error signal
443 ucerr => OPEN, -- uncorrectable error signal
442 mbe => mbe, -- enable memory programming
444 mbe => mbe, -- enable memory programming
443 mbe_drive => mbe_drive -- drive the MBE memory signal
445 mbe_drive => mbe_drive -- drive the MBE memory signal
444 );
446 );
445
447
446 memi.brdyn <= nSRAM_READY;
448 memi.brdyn <= nSRAM_READY;
447
449
448 mbe_pad : iopad
450 mbe_pad : iopad
449 GENERIC MAP(tech => padtech, oepol => USES_IAP_MEMCTRLR)
451 GENERIC MAP(tech => padtech, oepol => USES_IAP_MEMCTRLR)
450 PORT MAP(pad => SRAM_MBE,
452 PORT MAP(pad => SRAM_MBE,
451 i => mbe,
453 i => mbe,
452 en => mbe_drive,
454 en => mbe_drive,
453 o => memi.bexcn);
455 o => memi.bexcn);
454
456
455 nSRAM_CE_s <= (memo.ramsn(1 DOWNTO 0));
457 nSRAM_CE_s <= (memo.ramsn(1 DOWNTO 0));
456 nSRAM_OE_s <= memo.oen;
458 nSRAM_OE_s <= memo.oen;
457
459
458 END GENERATE;
460 END GENERATE;
459
461
460
462
461 memi.writen <= '1';
463 memi.writen <= '1';
462 memi.wrn <= "1111";
464 memi.wrn <= "1111";
463 memi.bwidth <= "10";
465 memi.bwidth <= "10";
464
466
467 -----------------------------------------------------------------------------
468 -- SLOW TIMING EMULATION
469 -----------------------------------------------------------------------------
470 SLOW_TIMING_EMULATION_ON: IF SLOW_TIMING_EMULATION = 1 GENERATE
471 PROCESS (clkm, rstn)
472 BEGIN -- PROCESS
473 IF rstn = '0' THEN -- asynchronous reset (active low)
474 memi.data <= (OTHERS => '0');
475 memo_data <= (OTHERS => '0');
476 ELSIF clkm'event AND clkm = '1' THEN -- rising clock edge
477 memi.data <= memi_data;
478 memo_data <= memo.data;
479 END IF;
480 END PROCESS;
481 END GENERATE SLOW_TIMING_EMULATION_ON;
482 SLOW_TIMING_EMULATION_OFF: IF SLOW_TIMING_EMULATION = 0 GENERATE
483 memi.data <= memi_data;
484 memo_data <= memo.data;
485 END GENERATE SLOW_TIMING_EMULATION_OFF;
486
465 bdr : FOR i IN 0 TO 3 GENERATE
487 bdr : FOR i IN 0 TO 3 GENERATE
466 data_pad : iopadv GENERIC MAP (tech => padtech, width => 8, oepol => USES_IAP_MEMCTRLR)
488 data_pad : iopadv GENERIC MAP (tech => padtech, width => 8, oepol => USES_IAP_MEMCTRLR)
467 PORT MAP (
489 PORT MAP (
468 data(31-i*8 DOWNTO 24-i*8),
490 data(31-i*8 DOWNTO 24-i*8),
469 memo.data(31-i*8 DOWNTO 24-i*8),
491 memo_data(31-i*8 DOWNTO 24-i*8),
470 memo.bdrive(i),
492 memo.bdrive(i),
471 memi.data(31-i*8 DOWNTO 24-i*8));
493 memi_data(31-i*8 DOWNTO 24-i*8));
472 END GENERATE;
494 END GENERATE;
473
495 -----------------------------------------------------------------------------
496
474 addr_pad : outpadv GENERIC MAP (width => ADDRESS_SIZE, tech => padtech)
497 addr_pad : outpadv GENERIC MAP (width => ADDRESS_SIZE, tech => padtech)
475 PORT MAP (address, memo.address(ADDRESS_SIZE+1 DOWNTO 2));
498 PORT MAP (address, memo.address(ADDRESS_SIZE+1 DOWNTO 2));
476 rams_pad : outpadv GENERIC MAP (tech => padtech, width => 2) PORT MAP (nSRAM_CE, nSRAM_CE_s);
499 rams_pad : outpadv GENERIC MAP (tech => padtech, width => 2) PORT MAP (nSRAM_CE, nSRAM_CE_s);
477 oen_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_OE, nSRAM_OE_s);
500 oen_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_OE, nSRAM_OE_s);
478 nBWE_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_WE, memo.writen);
501 nBWE_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_WE, memo.writen);
479 nBWa_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE0, memo.mben(3));
502 nBWa_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE0, memo.mben(3));
480 nBWb_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE1, memo.mben(2));
503 nBWb_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE1, memo.mben(2));
481 nBWc_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE2, memo.mben(1));
504 nBWc_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE2, memo.mben(1));
482 nBWd_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE3, memo.mben(0));
505 nBWd_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE3, memo.mben(0));
483
506
484
485
486 ----------------------------------------------------------------------
507 ----------------------------------------------------------------------
487 --- AHB CONTROLLER -------------------------------------------------
508 --- AHB CONTROLLER -------------------------------------------------
488 ----------------------------------------------------------------------
509 ----------------------------------------------------------------------
489 ahb0 : ahbctrl -- AHB arbiter/multiplexer
510 ahb0 : ahbctrl -- AHB arbiter/multiplexer
490 GENERIC MAP (defmast => CFG_DEFMST, split => CFG_SPLIT,
511 GENERIC MAP (defmast => CFG_DEFMST, split => CFG_SPLIT,
491 rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO,
512 rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO,
492 ioen => 0, nahbm => maxahbmsp, nahbs => 8, fixbrst => 0)
513 ioen => 0, nahbm => maxahbmsp, nahbs => 8, fixbrst => 0)
493 PORT MAP (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso);
514 PORT MAP (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso);
494
515
495 ----------------------------------------------------------------------
516 ----------------------------------------------------------------------
496 --- AHB UART -------------------------------------------------------
517 --- AHB UART -------------------------------------------------------
497 ----------------------------------------------------------------------
518 ----------------------------------------------------------------------
498 dcomgen : IF CFG_AHB_UART = 1 GENERATE
519 dcomgen : IF CFG_AHB_UART = 1 GENERATE
499 dcom0 : ahbuart
520 dcom0 : ahbuart
500 GENERIC MAP (hindex => maxahbmsp-1, pindex => 4, paddr => 4)
521 GENERIC MAP (hindex => maxahbmsp-1, pindex => 4, paddr => 4)
501 PORT MAP (rstn, clkm, ahbuarti, ahbuarto, apbi, apbo(4), ahbmi, ahbmo(maxahbmsp-1));
522 PORT MAP (rstn, clkm, ahbuarti, ahbuarto, apbi, apbo(4), ahbmi, ahbmo(maxahbmsp-1));
502 dsurx_pad : inpad GENERIC MAP (tech => padtech) PORT MAP (ahbrxd, ahbuarti.rxd);
523 dsurx_pad : inpad GENERIC MAP (tech => padtech) PORT MAP (ahbrxd, ahbuarti.rxd);
503 dsutx_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (ahbtxd, ahbuarto.txd);
524 dsutx_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (ahbtxd, ahbuarto.txd);
504 END GENERATE;
525 END GENERATE;
505 nouah : IF CFG_AHB_UART = 0 GENERATE apbo(4) <= apb_none; END GENERATE;
526 nouah : IF CFG_AHB_UART = 0 GENERATE apbo(4) <= apb_none; END GENERATE;
506
527
507 ----------------------------------------------------------------------
528 ----------------------------------------------------------------------
508 --- APB Bridge -----------------------------------------------------
529 --- APB Bridge -----------------------------------------------------
509 ----------------------------------------------------------------------
530 ----------------------------------------------------------------------
510 apb0 : apbctrl -- AHB/APB bridge
531 apb0 : apbctrl -- AHB/APB bridge
511 GENERIC MAP (hindex => 1, haddr => CFG_APBADDR)
532 GENERIC MAP (hindex => 1, haddr => CFG_APBADDR)
512 PORT MAP (rstn, clkm, ahbsi, ahbso(1), apbi, apbo);
533 PORT MAP (rstn, clkm, ahbsi, ahbso(1), apbi, apbo);
513
534
514 ----------------------------------------------------------------------
535 ----------------------------------------------------------------------
515 --- GPT Timer ------------------------------------------------------
536 --- GPT Timer ------------------------------------------------------
516 ----------------------------------------------------------------------
537 ----------------------------------------------------------------------
517 gpt : IF CFG_GPT_ENABLE /= 0 GENERATE
538 gpt : IF CFG_GPT_ENABLE /= 0 GENERATE
518 timer0 : gptimer -- timer unit
539 timer0 : gptimer -- timer unit
519 GENERIC MAP (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ,
540 GENERIC MAP (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ,
520 sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM,
541 sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM,
521 nbits => CFG_GPT_TW)
542 nbits => CFG_GPT_TW)
522 PORT MAP (rstn, clkm, apbi, apbo(3), gpti, gpto);
543 PORT MAP (rstn, clkm, apbi, apbo(3), gpti, gpto);
523 gpti.dhalt <= dsuo.tstop;
544 gpti.dhalt <= dsuo.tstop;
524 gpti.extclk <= '0';
545 gpti.extclk <= '0';
525 END GENERATE;
546 END GENERATE;
526 notim : IF CFG_GPT_ENABLE = 0 GENERATE apbo(3) <= apb_none; END GENERATE;
547 notim : IF CFG_GPT_ENABLE = 0 GENERATE apbo(3) <= apb_none; END GENERATE;
527
548
528
549
529 ----------------------------------------------------------------------
550 ----------------------------------------------------------------------
530 --- APB UART -------------------------------------------------------
551 --- APB UART -------------------------------------------------------
531 ----------------------------------------------------------------------
552 ----------------------------------------------------------------------
532 ua1 : IF CFG_UART1_ENABLE /= 0 GENERATE
553 ua1 : IF CFG_UART1_ENABLE /= 0 GENERATE
533 uart1 : apbuart -- UART 1
554 uart1 : apbuart -- UART 1
534 GENERIC MAP (pindex => 1, paddr => 1, pirq => 2, console => dbguart,
555 GENERIC MAP (pindex => 1, paddr => 1, pirq => 2, console => dbguart,
535 fifosize => CFG_UART1_FIFO)
556 fifosize => CFG_UART1_FIFO)
536 PORT MAP (rstn, clkm, apbi, apbo(1), apbuarti, apbuarto);
557 PORT MAP (rstn, clkm, apbi, apbo(1), apbuarti, apbuarto);
537 apbuarti.rxd <= urxd1;
558 apbuarti.rxd <= urxd1;
538 apbuarti.extclk <= '0';
559 apbuarti.extclk <= '0';
539 utxd1 <= apbuarto.txd;
560 utxd1 <= apbuarto.txd;
540 apbuarti.ctsn <= '0';
561 apbuarti.ctsn <= '0';
541 END GENERATE;
562 END GENERATE;
542 noua0 : IF CFG_UART1_ENABLE = 0 GENERATE apbo(1) <= apb_none; END GENERATE;
563 noua0 : IF CFG_UART1_ENABLE = 0 GENERATE apbo(1) <= apb_none; END GENERATE;
543
564
544 -------------------------------------------------------------------------------
565 -------------------------------------------------------------------------------
545 -- AMBA BUS -------------------------------------------------------------------
566 -- AMBA BUS -------------------------------------------------------------------
546 -------------------------------------------------------------------------------
567 -------------------------------------------------------------------------------
547
568
548 -- APB --------------------------------------------------------------------
569 -- APB --------------------------------------------------------------------
549 apbi_ext <= apbi;
570 apbi_ext <= apbi;
550 all_apb : FOR I IN 0 TO NB_APB_SLAVE-1 GENERATE
571 all_apb : FOR I IN 0 TO NB_APB_SLAVE-1 GENERATE
551 max_16_apb : IF I + 5 < 16 GENERATE
572 max_16_apb : IF I + 5 < 16 GENERATE
552 apbo(I+5) <= apbo_ext(I+5);
573 apbo(I+5) <= apbo_ext(I+5);
553 END GENERATE max_16_apb;
574 END GENERATE max_16_apb;
554 END GENERATE all_apb;
575 END GENERATE all_apb;
555 -- AHB_Slave --------------------------------------------------------------
576 -- AHB_Slave --------------------------------------------------------------
556 ahbi_s_ext <= ahbsi;
577 ahbi_s_ext <= ahbsi;
557 all_ahbs : FOR I IN 0 TO NB_AHB_SLAVE-1 GENERATE
578 all_ahbs : FOR I IN 0 TO NB_AHB_SLAVE-1 GENERATE
558 max_16_ahbs : IF I + 3 < 16 GENERATE
579 max_16_ahbs : IF I + 3 < 16 GENERATE
559 ahbso(I+3) <= ahbo_s_ext(I+3);
580 ahbso(I+3) <= ahbo_s_ext(I+3);
560 END GENERATE max_16_ahbs;
581 END GENERATE max_16_ahbs;
561 END GENERATE all_ahbs;
582 END GENERATE all_ahbs;
562 -- AHB_Master -------------------------------------------------------------
583 -- AHB_Master -------------------------------------------------------------
563 ahbi_m_ext <= ahbmi;
584 ahbi_m_ext <= ahbmi;
564 all_ahbm : FOR I IN 0 TO NB_AHB_MASTER-1 GENERATE
585 all_ahbm : FOR I IN 0 TO NB_AHB_MASTER-1 GENERATE
565 max_16_ahbm : IF I + CFG_NCPU + CFG_AHB_UART < 16 GENERATE
586 max_16_ahbm : IF I + CFG_NCPU + CFG_AHB_UART < 16 GENERATE
566 ahbmo(I + CFG_NCPU) <= ahbo_m_ext(I+CFG_NCPU);
587 ahbmo(I + CFG_NCPU) <= ahbo_m_ext(I+CFG_NCPU);
567 END GENERATE max_16_ahbm;
588 END GENERATE max_16_ahbm;
568 END GENERATE all_ahbm;
589 END GENERATE all_ahbm;
569
590
570
591
571
592
572 END Behavioral;
593 END Behavioral;
@@ -1,145 +1,146
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 LIBRARY grlib;
25 LIBRARY grlib;
26 USE grlib.amba.ALL;
26 USE grlib.amba.ALL;
27
27
28 PACKAGE lpp_leon3_soc_pkg IS
28 PACKAGE lpp_leon3_soc_pkg IS
29
29
30 type soc_ahb_mst_out_vector is array (natural range <>) of ahb_mst_out_type;
30 type soc_ahb_mst_out_vector is array (natural range <>) of ahb_mst_out_type;
31 type soc_ahb_slv_out_vector is array (natural range <>) of ahb_slv_out_type;
31 type soc_ahb_slv_out_vector is array (natural range <>) of ahb_slv_out_type;
32 type soc_apb_slv_out_vector is array (natural range <>) of apb_slv_out_type;
32 type soc_apb_slv_out_vector is array (natural range <>) of apb_slv_out_type;
33
33
34 COMPONENT leon3_soc
34 COMPONENT leon3_soc
35 GENERIC (
35 GENERIC (
36 fabtech : INTEGER;
36 fabtech : INTEGER;
37 memtech : INTEGER;
37 memtech : INTEGER;
38 padtech : INTEGER;
38 padtech : INTEGER;
39 clktech : INTEGER;
39 clktech : INTEGER;
40 disas : INTEGER;
40 disas : INTEGER;
41 dbguart : INTEGER;
41 dbguart : INTEGER;
42 pclow : INTEGER;
42 pclow : INTEGER;
43 clk_freq : INTEGER;
43 clk_freq : INTEGER;
44 IS_RADHARD : INTEGER;
44 IS_RADHARD : INTEGER;
45 NB_CPU : INTEGER;
45 NB_CPU : INTEGER;
46 ENABLE_FPU : INTEGER;
46 ENABLE_FPU : INTEGER;
47 FPU_NETLIST : INTEGER;
47 FPU_NETLIST : INTEGER;
48 ENABLE_DSU : INTEGER;
48 ENABLE_DSU : INTEGER;
49 ENABLE_AHB_UART : INTEGER;
49 ENABLE_AHB_UART : INTEGER;
50 ENABLE_APB_UART : INTEGER;
50 ENABLE_APB_UART : INTEGER;
51 ENABLE_IRQMP : INTEGER;
51 ENABLE_IRQMP : INTEGER;
52 ENABLE_GPT : INTEGER;
52 ENABLE_GPT : INTEGER;
53 NB_AHB_MASTER : INTEGER;
53 NB_AHB_MASTER : INTEGER;
54 NB_AHB_SLAVE : INTEGER;
54 NB_AHB_SLAVE : INTEGER;
55 NB_APB_SLAVE : INTEGER;
55 NB_APB_SLAVE : INTEGER;
56 ADDRESS_SIZE : INTEGER;
56 ADDRESS_SIZE : INTEGER;
57 USES_IAP_MEMCTRLR : INTEGER;
57 USES_IAP_MEMCTRLR : INTEGER;
58 BYPASS_EDAC_MEMCTRLR : STD_LOGIC;
58 BYPASS_EDAC_MEMCTRLR : STD_LOGIC;
59 SRBANKSZ : INTEGER := 8
59 SRBANKSZ : INTEGER := 8;
60 SLOW_TIMING_EMULATION : integer := 0
60 );
61 );
61 PORT (
62 PORT (
62 clk : IN STD_ULOGIC;
63 clk : IN STD_ULOGIC;
63 reset : IN STD_ULOGIC;
64 reset : IN STD_ULOGIC;
64
65
65 errorn : OUT STD_ULOGIC;
66 errorn : OUT STD_ULOGIC;
66
67
67 -- UART AHB ---------------------------------------------------------------
68 -- UART AHB ---------------------------------------------------------------
68 ahbrxd : IN STD_ULOGIC; -- DSU rx data
69 ahbrxd : IN STD_ULOGIC; -- DSU rx data
69 ahbtxd : OUT STD_ULOGIC; -- DSU tx data
70 ahbtxd : OUT STD_ULOGIC; -- DSU tx data
70
71
71 -- UART APB ---------------------------------------------------------------
72 -- UART APB ---------------------------------------------------------------
72 urxd1 : IN STD_ULOGIC; -- UART1 rx data
73 urxd1 : IN STD_ULOGIC; -- UART1 rx data
73 utxd1 : OUT STD_ULOGIC; -- UART1 tx data
74 utxd1 : OUT STD_ULOGIC; -- UART1 tx data
74
75
75 -- RAM --------------------------------------------------------------------
76 -- RAM --------------------------------------------------------------------
76 address : OUT STD_LOGIC_VECTOR(ADDRESS_SIZE-1 DOWNTO 0);
77 address : OUT STD_LOGIC_VECTOR(ADDRESS_SIZE-1 DOWNTO 0);
77 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
78 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
78 nSRAM_BE0 : OUT STD_LOGIC;
79 nSRAM_BE0 : OUT STD_LOGIC;
79 nSRAM_BE1 : OUT STD_LOGIC;
80 nSRAM_BE1 : OUT STD_LOGIC;
80 nSRAM_BE2 : OUT STD_LOGIC;
81 nSRAM_BE2 : OUT STD_LOGIC;
81 nSRAM_BE3 : OUT STD_LOGIC;
82 nSRAM_BE3 : OUT STD_LOGIC;
82 nSRAM_WE : OUT STD_LOGIC;
83 nSRAM_WE : OUT STD_LOGIC;
83 nSRAM_CE : OUT STD_LOGIC_VECTOR(1 downto 0);
84 nSRAM_CE : OUT STD_LOGIC_VECTOR(1 downto 0);
84 nSRAM_OE : OUT STD_LOGIC;
85 nSRAM_OE : OUT STD_LOGIC;
85 nSRAM_READY : IN STD_LOGIC;
86 nSRAM_READY : IN STD_LOGIC;
86 SRAM_MBE : INOUT STD_LOGIC;
87 SRAM_MBE : INOUT STD_LOGIC;
87 -- APB --------------------------------------------------------------------
88 -- APB --------------------------------------------------------------------
88 apbi_ext : OUT apb_slv_in_type;
89 apbi_ext : OUT apb_slv_in_type;
89 apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
90 apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
90 -- AHB_Slave --------------------------------------------------------------
91 -- AHB_Slave --------------------------------------------------------------
91 ahbi_s_ext : OUT ahb_slv_in_type;
92 ahbi_s_ext : OUT ahb_slv_in_type;
92 ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
93 ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
93 -- AHB_Master -------------------------------------------------------------
94 -- AHB_Master -------------------------------------------------------------
94 ahbi_m_ext : OUT AHB_Mst_In_Type;
95 ahbi_m_ext : OUT AHB_Mst_In_Type;
95 ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU));
96 ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU));
96 END COMPONENT;
97 END COMPONENT;
97
98
98
99
99 --COMPONENT leon3ft_soc
100 --COMPONENT leon3ft_soc
100 -- GENERIC (
101 -- GENERIC (
101 -- fabtech : INTEGER;
102 -- fabtech : INTEGER;
102 -- memtech : INTEGER;
103 -- memtech : INTEGER;
103 -- padtech : INTEGER;
104 -- padtech : INTEGER;
104 -- clktech : INTEGER;
105 -- clktech : INTEGER;
105 -- disas : INTEGER;
106 -- disas : INTEGER;
106 -- dbguart : INTEGER;
107 -- dbguart : INTEGER;
107 -- pclow : INTEGER;
108 -- pclow : INTEGER;
108 -- clk_freq : INTEGER;
109 -- clk_freq : INTEGER;
109 -- NB_CPU : INTEGER;
110 -- NB_CPU : INTEGER;
110 -- ENABLE_FPU : INTEGER;
111 -- ENABLE_FPU : INTEGER;
111 -- FPU_NETLIST : INTEGER;
112 -- FPU_NETLIST : INTEGER;
112 -- ENABLE_DSU : INTEGER;
113 -- ENABLE_DSU : INTEGER;
113 -- ENABLE_AHB_UART : INTEGER;
114 -- ENABLE_AHB_UART : INTEGER;
114 -- ENABLE_APB_UART : INTEGER;
115 -- ENABLE_APB_UART : INTEGER;
115 -- ENABLE_IRQMP : INTEGER;
116 -- ENABLE_IRQMP : INTEGER;
116 -- ENABLE_GPT : INTEGER;
117 -- ENABLE_GPT : INTEGER;
117 -- NB_AHB_MASTER : INTEGER;
118 -- NB_AHB_MASTER : INTEGER;
118 -- NB_AHB_SLAVE : INTEGER;
119 -- NB_AHB_SLAVE : INTEGER;
119 -- NB_APB_SLAVE : INTEGER);
120 -- NB_APB_SLAVE : INTEGER);
120 -- PORT (
121 -- PORT (
121 -- clk : IN STD_ULOGIC;
122 -- clk : IN STD_ULOGIC;
122 -- reset : IN STD_ULOGIC;
123 -- reset : IN STD_ULOGIC;
123 -- errorn : OUT STD_ULOGIC;
124 -- errorn : OUT STD_ULOGIC;
124 -- ahbrxd : IN STD_ULOGIC;
125 -- ahbrxd : IN STD_ULOGIC;
125 -- ahbtxd : OUT STD_ULOGIC;
126 -- ahbtxd : OUT STD_ULOGIC;
126 -- urxd1 : IN STD_ULOGIC;
127 -- urxd1 : IN STD_ULOGIC;
127 -- utxd1 : OUT STD_ULOGIC;
128 -- utxd1 : OUT STD_ULOGIC;
128 -- address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
129 -- address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
129 -- data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
130 -- data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
130 -- nSRAM_BE0 : OUT STD_LOGIC;
131 -- nSRAM_BE0 : OUT STD_LOGIC;
131 -- nSRAM_BE1 : OUT STD_LOGIC;
132 -- nSRAM_BE1 : OUT STD_LOGIC;
132 -- nSRAM_BE2 : OUT STD_LOGIC;
133 -- nSRAM_BE2 : OUT STD_LOGIC;
133 -- nSRAM_BE3 : OUT STD_LOGIC;
134 -- nSRAM_BE3 : OUT STD_LOGIC;
134 -- nSRAM_WE : OUT STD_LOGIC;
135 -- nSRAM_WE : OUT STD_LOGIC;
135 -- nSRAM_CE : OUT STD_LOGIC;
136 -- nSRAM_CE : OUT STD_LOGIC;
136 -- nSRAM_OE : OUT STD_LOGIC;
137 -- nSRAM_OE : OUT STD_LOGIC;
137 -- apbi_ext : OUT apb_slv_in_type;
138 -- apbi_ext : OUT apb_slv_in_type;
138 -- apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
139 -- apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
139 -- ahbi_s_ext : OUT ahb_slv_in_type;
140 -- ahbi_s_ext : OUT ahb_slv_in_type;
140 -- ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
141 -- ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
141 -- ahbi_m_ext : OUT AHB_Mst_In_Type;
142 -- ahbi_m_ext : OUT AHB_Mst_In_Type;
142 -- ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU));
143 -- ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU));
143 --END COMPONENT;
144 --END COMPONENT;
144
145
145 END;
146 END;
@@ -1,515 +1,518
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 tech : INTEGER := inferred;
28 tech : INTEGER := inferred;
29 nb_data_by_buffer_size : INTEGER := 32;
29 nb_data_by_buffer_size : INTEGER := 32;
30 nb_snapshot_param_size : INTEGER := 32;
30 nb_snapshot_param_size : INTEGER := 32;
31 delta_vector_size : INTEGER := 32;
31 delta_vector_size : INTEGER := 32;
32 delta_vector_size_f0_2 : INTEGER := 7;
32 delta_vector_size_f0_2 : INTEGER := 7;
33
33
34 pindex : INTEGER := 15;
34 pindex : INTEGER := 15;
35 paddr : INTEGER := 15;
35 paddr : INTEGER := 15;
36 pmask : INTEGER := 16#fff#;
36 pmask : INTEGER := 16#fff#;
37 pirq_ms : INTEGER := 6;
37 pirq_ms : INTEGER := 6;
38 pirq_wfp : INTEGER := 14;
38 pirq_wfp : INTEGER := 14;
39
39
40 hindex : INTEGER := 2;
40 hindex : INTEGER := 2;
41
41
42 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0) := X"020153";
42 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0) := X"020153";
43
43
44 DEBUG_FORCE_DATA_DMA : INTEGER := 0
44 DEBUG_FORCE_DATA_DMA : INTEGER := 0;
45
45 RTL_DESIGN_LIGHT : INTEGER := 0;
46 WINDOWS_HAANNING_PARAM_SIZE : INTEGER := 15
46 );
47 );
47 PORT (
48 PORT (
48 clk : IN STD_LOGIC;
49 clk : IN STD_LOGIC;
49 rstn : IN STD_LOGIC;
50 rstn : IN STD_LOGIC;
50 -- SAMPLE
51 -- SAMPLE
51 sample_B : IN Samples(2 DOWNTO 0);
52 sample_B : IN Samples(2 DOWNTO 0);
52 sample_E : IN Samples(4 DOWNTO 0);
53 sample_E : IN Samples(4 DOWNTO 0);
53 sample_val : IN STD_LOGIC;
54 sample_val : IN STD_LOGIC;
54 -- APB
55 -- APB
55 apbi : IN apb_slv_in_type;
56 apbi : IN apb_slv_in_type;
56 apbo : OUT apb_slv_out_type;
57 apbo : OUT apb_slv_out_type;
57 -- AHB
58 -- AHB
58 ahbi : IN AHB_Mst_In_Type;
59 ahbi : IN AHB_Mst_In_Type;
59 ahbo : OUT AHB_Mst_Out_Type;
60 ahbo : OUT AHB_Mst_Out_Type;
60 -- TIME
61 -- TIME
61 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- todo
62 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- todo
62 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
63 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
63 --
64 --
64 data_shaping_BW : OUT STD_LOGIC;
65 data_shaping_BW : OUT STD_LOGIC;
65 --
66 --
66 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0);
67 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0);
67 debug_vector_ms : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
68 debug_vector_ms : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
68 );
69 );
69 END lpp_lfr;
70 END lpp_lfr;
70
71
71 ARCHITECTURE beh OF lpp_lfr IS
72 ARCHITECTURE beh OF lpp_lfr IS
72 SIGNAL sample_s : Samples(7 DOWNTO 0);
73 SIGNAL sample_s : Samples(7 DOWNTO 0);
73 --
74 --
74 SIGNAL data_shaping_SP0 : STD_LOGIC;
75 SIGNAL data_shaping_SP0 : STD_LOGIC;
75 SIGNAL data_shaping_SP1 : STD_LOGIC;
76 SIGNAL data_shaping_SP1 : STD_LOGIC;
76 SIGNAL data_shaping_R0 : STD_LOGIC;
77 SIGNAL data_shaping_R0 : STD_LOGIC;
77 SIGNAL data_shaping_R1 : STD_LOGIC;
78 SIGNAL data_shaping_R1 : STD_LOGIC;
78 SIGNAL data_shaping_R2 : STD_LOGIC;
79 SIGNAL data_shaping_R2 : STD_LOGIC;
79 --
80 --
80 SIGNAL sample_f0_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
81 SIGNAL sample_f0_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
81 SIGNAL sample_f1_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
82 SIGNAL sample_f1_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
82 SIGNAL sample_f2_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
83 SIGNAL sample_f2_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
83 --
84 --
84 SIGNAL sample_f0_val : STD_LOGIC;
85 SIGNAL sample_f0_val : STD_LOGIC;
85 SIGNAL sample_f1_val : STD_LOGIC;
86 SIGNAL sample_f1_val : STD_LOGIC;
86 SIGNAL sample_f2_val : STD_LOGIC;
87 SIGNAL sample_f2_val : STD_LOGIC;
87 SIGNAL sample_f3_val : STD_LOGIC;
88 SIGNAL sample_f3_val : STD_LOGIC;
88 --
89 --
89 SIGNAL sample_f0_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
90 SIGNAL sample_f0_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
90 SIGNAL sample_f1_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
91 SIGNAL sample_f1_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
91 SIGNAL sample_f2_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
92 SIGNAL sample_f2_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
92 SIGNAL sample_f3_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
93 SIGNAL sample_f3_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
93 --
94 --
94 SIGNAL sample_f0_data_sim : Samples(5 DOWNTO 0);
95 SIGNAL sample_f0_data_sim : Samples(5 DOWNTO 0);
95 SIGNAL sample_f1_data_sim : Samples(5 DOWNTO 0);
96 SIGNAL sample_f1_data_sim : Samples(5 DOWNTO 0);
96 SIGNAL sample_f2_data_sim : Samples(5 DOWNTO 0);
97 SIGNAL sample_f2_data_sim : Samples(5 DOWNTO 0);
97 SIGNAL sample_f3_data_sim : Samples(5 DOWNTO 0);
98 SIGNAL sample_f3_data_sim : Samples(5 DOWNTO 0);
98 --
99 --
99 SIGNAL sample_f0_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
100 SIGNAL sample_f0_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
100 SIGNAL sample_f1_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
101 SIGNAL sample_f1_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
101 SIGNAL sample_f2_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
102 SIGNAL sample_f2_wdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
102
103
103 -- SM
104 -- SM
104 SIGNAL ready_matrix_f0 : STD_LOGIC;
105 SIGNAL ready_matrix_f0 : STD_LOGIC;
105 -- SIGNAL ready_matrix_f0_1 : STD_LOGIC;
106 -- SIGNAL ready_matrix_f0_1 : STD_LOGIC;
106 SIGNAL ready_matrix_f1 : STD_LOGIC;
107 SIGNAL ready_matrix_f1 : STD_LOGIC;
107 SIGNAL ready_matrix_f2 : STD_LOGIC;
108 SIGNAL ready_matrix_f2 : STD_LOGIC;
108 SIGNAL status_ready_matrix_f0 : STD_LOGIC;
109 SIGNAL status_ready_matrix_f0 : STD_LOGIC;
109 -- SIGNAL status_ready_matrix_f0_1 : STD_LOGIC;
110 -- SIGNAL status_ready_matrix_f0_1 : STD_LOGIC;
110 SIGNAL status_ready_matrix_f1 : STD_LOGIC;
111 SIGNAL status_ready_matrix_f1 : STD_LOGIC;
111 SIGNAL status_ready_matrix_f2 : STD_LOGIC;
112 SIGNAL status_ready_matrix_f2 : STD_LOGIC;
112 SIGNAL addr_matrix_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
113 SIGNAL addr_matrix_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
113 SIGNAL addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
114 SIGNAL addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
114 SIGNAL addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
115 SIGNAL addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
115 SIGNAL length_matrix_f0 : STD_LOGIC_VECTOR(25 DOWNTO 0);
116 SIGNAL length_matrix_f0 : STD_LOGIC_VECTOR(25 DOWNTO 0);
116 SIGNAL length_matrix_f1 : STD_LOGIC_VECTOR(25 DOWNTO 0);
117 SIGNAL length_matrix_f1 : STD_LOGIC_VECTOR(25 DOWNTO 0);
117 SIGNAL length_matrix_f2 : STD_LOGIC_VECTOR(25 DOWNTO 0);
118 SIGNAL length_matrix_f2 : STD_LOGIC_VECTOR(25 DOWNTO 0);
118
119
119 -- WFP
120 -- WFP
120 SIGNAL status_new_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
121 SIGNAL status_new_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
121 SIGNAL delta_snapshot : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
122 SIGNAL delta_snapshot : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
122 SIGNAL delta_f0 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
123 SIGNAL delta_f0 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
123 SIGNAL delta_f0_2 : STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
124 SIGNAL delta_f0_2 : STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
124 SIGNAL delta_f1 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
125 SIGNAL delta_f1 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
125 SIGNAL delta_f2 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
126 SIGNAL delta_f2 : STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
126
127
127 SIGNAL nb_data_by_buffer : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
128 SIGNAL nb_data_by_buffer : STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
128 SIGNAL nb_snapshot_param : STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
129 SIGNAL nb_snapshot_param : STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
129 SIGNAL enable_f0 : STD_LOGIC;
130 SIGNAL enable_f0 : STD_LOGIC;
130 SIGNAL enable_f1 : STD_LOGIC;
131 SIGNAL enable_f1 : STD_LOGIC;
131 SIGNAL enable_f2 : STD_LOGIC;
132 SIGNAL enable_f2 : STD_LOGIC;
132 SIGNAL enable_f3 : STD_LOGIC;
133 SIGNAL enable_f3 : STD_LOGIC;
133 SIGNAL burst_f0 : STD_LOGIC;
134 SIGNAL burst_f0 : STD_LOGIC;
134 SIGNAL burst_f1 : STD_LOGIC;
135 SIGNAL burst_f1 : STD_LOGIC;
135 SIGNAL burst_f2 : STD_LOGIC;
136 SIGNAL burst_f2 : STD_LOGIC;
136
137
137 --SIGNAL run : STD_LOGIC;
138 --SIGNAL run : STD_LOGIC;
138 SIGNAL start_date : STD_LOGIC_VECTOR(30 DOWNTO 0);
139 SIGNAL start_date : STD_LOGIC_VECTOR(30 DOWNTO 0);
139
140
140 -----------------------------------------------------------------------------
141 -----------------------------------------------------------------------------
141 --
142 --
142 -----------------------------------------------------------------------------
143 -----------------------------------------------------------------------------
143
144
144 SIGNAL wfp_status_buffer_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
145 SIGNAL wfp_status_buffer_ready : STD_LOGIC_VECTOR(3 DOWNTO 0);
145 SIGNAL wfp_addr_buffer : STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
146 SIGNAL wfp_addr_buffer : STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
146 SIGNAL wfp_length_buffer : STD_LOGIC_VECTOR(25 DOWNTO 0);
147 SIGNAL wfp_length_buffer : STD_LOGIC_VECTOR(25 DOWNTO 0);
147 SIGNAL wfp_ready_buffer : STD_LOGIC_VECTOR(3 DOWNTO 0);
148 SIGNAL wfp_ready_buffer : STD_LOGIC_VECTOR(3 DOWNTO 0);
148 SIGNAL wfp_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
149 SIGNAL wfp_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
149 SIGNAL wfp_error_buffer_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
150 SIGNAL wfp_error_buffer_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
150
151
151 SIGNAL matrix_time_f0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
152 SIGNAL matrix_time_f0 : STD_LOGIC_VECTOR(47 DOWNTO 0);
152 SIGNAL matrix_time_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
153 SIGNAL matrix_time_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
153 SIGNAL matrix_time_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
154 SIGNAL matrix_time_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
154
155
155
156
156 SIGNAL error_buffer_full : STD_LOGIC;
157 SIGNAL error_buffer_full : STD_LOGIC;
157 SIGNAL error_input_fifo_write : STD_LOGIC_VECTOR(2 DOWNTO 0);
158 SIGNAL error_input_fifo_write : STD_LOGIC_VECTOR(2 DOWNTO 0);
158
159
159 -----------------------------------------------------------------------------
160 -----------------------------------------------------------------------------
160 SIGNAL dma_fifo_burst_valid : STD_LOGIC_VECTOR(4 DOWNTO 0);
161 SIGNAL dma_fifo_burst_valid : STD_LOGIC_VECTOR(4 DOWNTO 0);
161 SIGNAL dma_fifo_data : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
162 SIGNAL dma_fifo_data : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
162 SIGNAL dma_fifo_data_forced_gen : STD_LOGIC_VECTOR(32-1 DOWNTO 0); --21-04-2015
163 SIGNAL dma_fifo_data_forced_gen : STD_LOGIC_VECTOR(32-1 DOWNTO 0); --21-04-2015
163 SIGNAL dma_fifo_data_forced : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0); --21-04-2015
164 SIGNAL dma_fifo_data_forced : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0); --21-04-2015
164 SIGNAL dma_fifo_data_debug : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0); --21-04-2015
165 SIGNAL dma_fifo_data_debug : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0); --21-04-2015
165 SIGNAL dma_fifo_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
166 SIGNAL dma_fifo_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
166 SIGNAL dma_buffer_new : STD_LOGIC_VECTOR(4 DOWNTO 0);
167 SIGNAL dma_buffer_new : STD_LOGIC_VECTOR(4 DOWNTO 0);
167 SIGNAL dma_buffer_addr : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
168 SIGNAL dma_buffer_addr : STD_LOGIC_VECTOR(32*5-1 DOWNTO 0);
168 SIGNAL dma_buffer_length : STD_LOGIC_VECTOR(26*5-1 DOWNTO 0);
169 SIGNAL dma_buffer_length : STD_LOGIC_VECTOR(26*5-1 DOWNTO 0);
169 SIGNAL dma_buffer_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
170 SIGNAL dma_buffer_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
170 SIGNAL dma_buffer_full_err : STD_LOGIC_VECTOR(4 DOWNTO 0);
171 SIGNAL dma_buffer_full_err : STD_LOGIC_VECTOR(4 DOWNTO 0);
171 SIGNAL dma_grant_error : STD_LOGIC;
172 SIGNAL dma_grant_error : STD_LOGIC;
172
173
173 SIGNAL apb_reg_debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0);
174 SIGNAL apb_reg_debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0);
174 -----------------------------------------------------------------------------
175 -----------------------------------------------------------------------------
175 SIGNAL sample_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
176 SIGNAL sample_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
176 SIGNAL sample_f0_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
177 SIGNAL sample_f0_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
177 SIGNAL sample_f1_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
178 SIGNAL sample_f1_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
178 SIGNAL sample_f2_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
179 SIGNAL sample_f2_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
179 SIGNAL sample_f3_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
180 SIGNAL sample_f3_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
180
181
181 BEGIN
182 BEGIN
182
183
183 -----------------------------------------------------------------------------
184 -----------------------------------------------------------------------------
184
185
185 sample_s(4 DOWNTO 0) <= sample_E(4 DOWNTO 0);
186 sample_s(4 DOWNTO 0) <= sample_E(4 DOWNTO 0);
186 sample_s(7 DOWNTO 5) <= sample_B(2 DOWNTO 0);
187 sample_s(7 DOWNTO 5) <= sample_B(2 DOWNTO 0);
187 sample_time <= coarse_time & fine_time;
188 sample_time <= coarse_time & fine_time;
188
189
189 -----------------------------------------------------------------------------
190 -----------------------------------------------------------------------------
190 lpp_lfr_filter_1 : lpp_lfr_filter
191 lpp_lfr_filter_1 : lpp_lfr_filter
191 GENERIC MAP (
192 GENERIC MAP (
192 Mem_use => Mem_use)
193 Mem_use => Mem_use,
194 RTL_DESIGN_LIGHT => RTL_DESIGN_LIGHT)
193 PORT MAP (
195 PORT MAP (
194 sample => sample_s,
196 sample => sample_s,
195 sample_val => sample_val,
197 sample_val => sample_val,
196 sample_time => sample_time,
198 sample_time => sample_time,
197 clk => clk,
199 clk => clk,
198 rstn => rstn,
200 rstn => rstn,
199 data_shaping_SP0 => data_shaping_SP0,
201 data_shaping_SP0 => data_shaping_SP0,
200 data_shaping_SP1 => data_shaping_SP1,
202 data_shaping_SP1 => data_shaping_SP1,
201 data_shaping_R0 => data_shaping_R0,
203 data_shaping_R0 => data_shaping_R0,
202 data_shaping_R1 => data_shaping_R1,
204 data_shaping_R1 => data_shaping_R1,
203 data_shaping_R2 => data_shaping_R2,
205 data_shaping_R2 => data_shaping_R2,
204 sample_f0_val => sample_f0_val,
206 sample_f0_val => sample_f0_val,
205 sample_f1_val => sample_f1_val,
207 sample_f1_val => sample_f1_val,
206 sample_f2_val => sample_f2_val,
208 sample_f2_val => sample_f2_val,
207 sample_f3_val => sample_f3_val,
209 sample_f3_val => sample_f3_val,
208 sample_f0_wdata => sample_f0_data,
210 sample_f0_wdata => sample_f0_data,
209 sample_f1_wdata => sample_f1_data,
211 sample_f1_wdata => sample_f1_data,
210 sample_f2_wdata => sample_f2_data,
212 sample_f2_wdata => sample_f2_data,
211 sample_f3_wdata => sample_f3_data,
213 sample_f3_wdata => sample_f3_data,
212 sample_f0_time => sample_f0_time,
214 sample_f0_time => sample_f0_time,
213 sample_f1_time => sample_f1_time,
215 sample_f1_time => sample_f1_time,
214 sample_f2_time => sample_f2_time,
216 sample_f2_time => sample_f2_time,
215 sample_f3_time => sample_f3_time
217 sample_f3_time => sample_f3_time
216 );
218 );
217
219
218 -----------------------------------------------------------------------------
220 -----------------------------------------------------------------------------
219 lpp_lfr_apbreg_1 : lpp_lfr_apbreg
221 lpp_lfr_apbreg_1 : lpp_lfr_apbreg
220 GENERIC MAP (
222 GENERIC MAP (
221 nb_data_by_buffer_size => nb_data_by_buffer_size,
223 nb_data_by_buffer_size => nb_data_by_buffer_size,
222 nb_snapshot_param_size => nb_snapshot_param_size,
224 nb_snapshot_param_size => nb_snapshot_param_size,
223 delta_vector_size => delta_vector_size,
225 delta_vector_size => delta_vector_size,
224 delta_vector_size_f0_2 => delta_vector_size_f0_2,
226 delta_vector_size_f0_2 => delta_vector_size_f0_2,
225 pindex => pindex,
227 pindex => pindex,
226 paddr => paddr,
228 paddr => paddr,
227 pmask => pmask,
229 pmask => pmask,
228 pirq_ms => pirq_ms,
230 pirq_ms => pirq_ms,
229 pirq_wfp => pirq_wfp,
231 pirq_wfp => pirq_wfp,
230 top_lfr_version => top_lfr_version)
232 top_lfr_version => top_lfr_version)
231 PORT MAP (
233 PORT MAP (
232 HCLK => clk,
234 HCLK => clk,
233 HRESETn => rstn,
235 HRESETn => rstn,
234 apbi => apbi,
236 apbi => apbi,
235 apbo => apbo,
237 apbo => apbo,
236
238
237 -- run_ms => OPEN,--run_ms,
239 -- run_ms => OPEN,--run_ms,
238
240
239 ready_matrix_f0 => ready_matrix_f0,
241 ready_matrix_f0 => ready_matrix_f0,
240 ready_matrix_f1 => ready_matrix_f1,
242 ready_matrix_f1 => ready_matrix_f1,
241 ready_matrix_f2 => ready_matrix_f2,
243 ready_matrix_f2 => ready_matrix_f2,
242 error_buffer_full => error_buffer_full,
244 error_buffer_full => error_buffer_full,
243 error_input_fifo_write => error_input_fifo_write,
245 error_input_fifo_write => error_input_fifo_write,
244 status_ready_matrix_f0 => status_ready_matrix_f0,
246 status_ready_matrix_f0 => status_ready_matrix_f0,
245 status_ready_matrix_f1 => status_ready_matrix_f1,
247 status_ready_matrix_f1 => status_ready_matrix_f1,
246 status_ready_matrix_f2 => status_ready_matrix_f2,
248 status_ready_matrix_f2 => status_ready_matrix_f2,
247
249
248 matrix_time_f0 => matrix_time_f0,
250 matrix_time_f0 => matrix_time_f0,
249 matrix_time_f1 => matrix_time_f1,
251 matrix_time_f1 => matrix_time_f1,
250 matrix_time_f2 => matrix_time_f2,
252 matrix_time_f2 => matrix_time_f2,
251
253
252 addr_matrix_f0 => addr_matrix_f0,
254 addr_matrix_f0 => addr_matrix_f0,
253 addr_matrix_f1 => addr_matrix_f1,
255 addr_matrix_f1 => addr_matrix_f1,
254 addr_matrix_f2 => addr_matrix_f2,
256 addr_matrix_f2 => addr_matrix_f2,
255
257
256 length_matrix_f0 => length_matrix_f0,
258 length_matrix_f0 => length_matrix_f0,
257 length_matrix_f1 => length_matrix_f1,
259 length_matrix_f1 => length_matrix_f1,
258 length_matrix_f2 => length_matrix_f2,
260 length_matrix_f2 => length_matrix_f2,
259 status_new_err => status_new_err,
261 status_new_err => status_new_err,
260 data_shaping_BW => data_shaping_BW,
262 data_shaping_BW => data_shaping_BW,
261 data_shaping_SP0 => data_shaping_SP0,
263 data_shaping_SP0 => data_shaping_SP0,
262 data_shaping_SP1 => data_shaping_SP1,
264 data_shaping_SP1 => data_shaping_SP1,
263 data_shaping_R0 => data_shaping_R0,
265 data_shaping_R0 => data_shaping_R0,
264 data_shaping_R1 => data_shaping_R1,
266 data_shaping_R1 => data_shaping_R1,
265 data_shaping_R2 => data_shaping_R2,
267 data_shaping_R2 => data_shaping_R2,
266 delta_snapshot => delta_snapshot,
268 delta_snapshot => delta_snapshot,
267 delta_f0 => delta_f0,
269 delta_f0 => delta_f0,
268 delta_f0_2 => delta_f0_2,
270 delta_f0_2 => delta_f0_2,
269 delta_f1 => delta_f1,
271 delta_f1 => delta_f1,
270 delta_f2 => delta_f2,
272 delta_f2 => delta_f2,
271 nb_data_by_buffer => nb_data_by_buffer,
273 nb_data_by_buffer => nb_data_by_buffer,
272 nb_snapshot_param => nb_snapshot_param,
274 nb_snapshot_param => nb_snapshot_param,
273 enable_f0 => enable_f0,
275 enable_f0 => enable_f0,
274 enable_f1 => enable_f1,
276 enable_f1 => enable_f1,
275 enable_f2 => enable_f2,
277 enable_f2 => enable_f2,
276 enable_f3 => enable_f3,
278 enable_f3 => enable_f3,
277 burst_f0 => burst_f0,
279 burst_f0 => burst_f0,
278 burst_f1 => burst_f1,
280 burst_f1 => burst_f1,
279 burst_f2 => burst_f2,
281 burst_f2 => burst_f2,
280 run => OPEN,
282 run => OPEN,
281 start_date => start_date,
283 start_date => start_date,
282 wfp_status_buffer_ready => wfp_status_buffer_ready,
284 wfp_status_buffer_ready => wfp_status_buffer_ready,
283 wfp_addr_buffer => wfp_addr_buffer,
285 wfp_addr_buffer => wfp_addr_buffer,
284 wfp_length_buffer => wfp_length_buffer,
286 wfp_length_buffer => wfp_length_buffer,
285
287
286 wfp_ready_buffer => wfp_ready_buffer,
288 wfp_ready_buffer => wfp_ready_buffer,
287 wfp_buffer_time => wfp_buffer_time,
289 wfp_buffer_time => wfp_buffer_time,
288 wfp_error_buffer_full => wfp_error_buffer_full,
290 wfp_error_buffer_full => wfp_error_buffer_full,
289 -------------------------------------------------------------------------
291 -------------------------------------------------------------------------
290 sample_f3_v => sample_f3_data(1*16-1 DOWNTO 0*16),
292 sample_f3_v => sample_f3_data(1*16-1 DOWNTO 0*16),
291 sample_f3_e1 => sample_f3_data(2*16-1 DOWNTO 1*16),
293 sample_f3_e1 => sample_f3_data(2*16-1 DOWNTO 1*16),
292 sample_f3_e2 => sample_f3_data(3*16-1 DOWNTO 2*16),
294 sample_f3_e2 => sample_f3_data(3*16-1 DOWNTO 2*16),
293 sample_f3_valid => sample_f3_val,
295 sample_f3_valid => sample_f3_val,
294 debug_vector => apb_reg_debug_vector
296 debug_vector => apb_reg_debug_vector
295 );
297 );
296
298
297 -----------------------------------------------------------------------------
299 -----------------------------------------------------------------------------
298 -----------------------------------------------------------------------------
300 -----------------------------------------------------------------------------
299 lpp_waveform_1 : lpp_waveform
301 lpp_waveform_1 : lpp_waveform
300 GENERIC MAP (
302 GENERIC MAP (
301 tech => tech,
303 tech => tech,
302 data_size => 6*16,
304 data_size => 6*16,
303 nb_data_by_buffer_size => nb_data_by_buffer_size,
305 nb_data_by_buffer_size => nb_data_by_buffer_size,
304 nb_snapshot_param_size => nb_snapshot_param_size,
306 nb_snapshot_param_size => nb_snapshot_param_size,
305 delta_vector_size => delta_vector_size,
307 delta_vector_size => delta_vector_size,
306 delta_vector_size_f0_2 => delta_vector_size_f0_2
308 delta_vector_size_f0_2 => delta_vector_size_f0_2
307 )
309 )
308 PORT MAP (
310 PORT MAP (
309 clk => clk,
311 clk => clk,
310 rstn => rstn,
312 rstn => rstn,
311
313
312 reg_run => '1',--run,
314 reg_run => '1',--run,
313 reg_start_date => start_date,
315 reg_start_date => start_date,
314 reg_delta_snapshot => delta_snapshot,
316 reg_delta_snapshot => delta_snapshot,
315 reg_delta_f0 => delta_f0,
317 reg_delta_f0 => delta_f0,
316 reg_delta_f0_2 => delta_f0_2,
318 reg_delta_f0_2 => delta_f0_2,
317 reg_delta_f1 => delta_f1,
319 reg_delta_f1 => delta_f1,
318 reg_delta_f2 => delta_f2,
320 reg_delta_f2 => delta_f2,
319
321
320 enable_f0 => enable_f0,
322 enable_f0 => enable_f0,
321 enable_f1 => enable_f1,
323 enable_f1 => enable_f1,
322 enable_f2 => enable_f2,
324 enable_f2 => enable_f2,
323 enable_f3 => enable_f3,
325 enable_f3 => enable_f3,
324 burst_f0 => burst_f0,
326 burst_f0 => burst_f0,
325 burst_f1 => burst_f1,
327 burst_f1 => burst_f1,
326 burst_f2 => burst_f2,
328 burst_f2 => burst_f2,
327
329
328 nb_data_by_buffer => nb_data_by_buffer,
330 nb_data_by_buffer => nb_data_by_buffer,
329 nb_snapshot_param => nb_snapshot_param,
331 nb_snapshot_param => nb_snapshot_param,
330 status_new_err => status_new_err,
332 status_new_err => status_new_err,
331
333
332 status_buffer_ready => wfp_status_buffer_ready,
334 status_buffer_ready => wfp_status_buffer_ready,
333 addr_buffer => wfp_addr_buffer,
335 addr_buffer => wfp_addr_buffer,
334 length_buffer => wfp_length_buffer,
336 length_buffer => wfp_length_buffer,
335 ready_buffer => wfp_ready_buffer,
337 ready_buffer => wfp_ready_buffer,
336 buffer_time => wfp_buffer_time,
338 buffer_time => wfp_buffer_time,
337 error_buffer_full => wfp_error_buffer_full,
339 error_buffer_full => wfp_error_buffer_full,
338
340
339 coarse_time => coarse_time,
341 coarse_time => coarse_time,
340 -- fine_time => fine_time,
342 -- fine_time => fine_time,
341
343
342 --f0
344 --f0
343 data_f0_in_valid => sample_f0_val,
345 data_f0_in_valid => sample_f0_val,
344 data_f0_in => sample_f0_data,
346 data_f0_in => sample_f0_data,
345 data_f0_time => sample_f0_time,
347 data_f0_time => sample_f0_time,
346 --f1
348 --f1
347 data_f1_in_valid => sample_f1_val,
349 data_f1_in_valid => sample_f1_val,
348 data_f1_in => sample_f1_data,
350 data_f1_in => sample_f1_data,
349 data_f1_time => sample_f1_time,
351 data_f1_time => sample_f1_time,
350 --f2
352 --f2
351 data_f2_in_valid => sample_f2_val,
353 data_f2_in_valid => sample_f2_val,
352 data_f2_in => sample_f2_data,
354 data_f2_in => sample_f2_data,
353 data_f2_time => sample_f2_time,
355 data_f2_time => sample_f2_time,
354 --f3
356 --f3
355 data_f3_in_valid => sample_f3_val,
357 data_f3_in_valid => sample_f3_val,
356 data_f3_in => sample_f3_data,
358 data_f3_in => sample_f3_data,
357 data_f3_time => sample_f3_time,
359 data_f3_time => sample_f3_time,
358 -- OUTPUT -- DMA interface
360 -- OUTPUT -- DMA interface
359
361
360 dma_fifo_valid_burst => dma_fifo_burst_valid(3 DOWNTO 0),
362 dma_fifo_valid_burst => dma_fifo_burst_valid(3 DOWNTO 0),
361 dma_fifo_data => dma_fifo_data(32*4-1 DOWNTO 0),
363 dma_fifo_data => dma_fifo_data(32*4-1 DOWNTO 0),
362 dma_fifo_ren => dma_fifo_ren(3 DOWNTO 0),
364 dma_fifo_ren => dma_fifo_ren(3 DOWNTO 0),
363 dma_buffer_new => dma_buffer_new(3 DOWNTO 0),
365 dma_buffer_new => dma_buffer_new(3 DOWNTO 0),
364 dma_buffer_addr => dma_buffer_addr(32*4-1 DOWNTO 0),
366 dma_buffer_addr => dma_buffer_addr(32*4-1 DOWNTO 0),
365 dma_buffer_length => dma_buffer_length(26*4-1 DOWNTO 0),
367 dma_buffer_length => dma_buffer_length(26*4-1 DOWNTO 0),
366 dma_buffer_full => dma_buffer_full(3 DOWNTO 0),
368 dma_buffer_full => dma_buffer_full(3 DOWNTO 0),
367 dma_buffer_full_err => dma_buffer_full_err(3 DOWNTO 0)
369 dma_buffer_full_err => dma_buffer_full_err(3 DOWNTO 0)
368
370
369 );
371 );
370
372
371 -----------------------------------------------------------------------------
373 -----------------------------------------------------------------------------
372 -- Matrix Spectral
374 -- Matrix Spectral
373 -----------------------------------------------------------------------------
375 -----------------------------------------------------------------------------
374 sample_f0_wen <= NOT(sample_f0_val) & NOT(sample_f0_val) & NOT(sample_f0_val) &
376 sample_f0_wen <= NOT(sample_f0_val) & NOT(sample_f0_val) & NOT(sample_f0_val) &
375 NOT(sample_f0_val) & NOT(sample_f0_val);
377 NOT(sample_f0_val) & NOT(sample_f0_val);
376 sample_f1_wen <= NOT(sample_f1_val) & NOT(sample_f1_val) & NOT(sample_f1_val) &
378 sample_f1_wen <= NOT(sample_f1_val) & NOT(sample_f1_val) & NOT(sample_f1_val) &
377 NOT(sample_f1_val) & NOT(sample_f1_val);
379 NOT(sample_f1_val) & NOT(sample_f1_val);
378 sample_f2_wen <= NOT(sample_f2_val) & NOT(sample_f2_val) & NOT(sample_f2_val) &
380 sample_f2_wen <= NOT(sample_f2_val) & NOT(sample_f2_val) & NOT(sample_f2_val) &
379 NOT(sample_f2_val) & NOT(sample_f2_val);
381 NOT(sample_f2_val) & NOT(sample_f2_val);
380
382
381
383
382 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)
384 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)
383 sample_f1_wdata <= sample_f1_data((3*16)-1 DOWNTO (1*16)) & sample_f1_data((6*16)-1 DOWNTO (3*16));
385 sample_f1_wdata <= sample_f1_data((3*16)-1 DOWNTO (1*16)) & sample_f1_data((6*16)-1 DOWNTO (3*16));
384 sample_f2_wdata <= sample_f2_data((3*16)-1 DOWNTO (1*16)) & sample_f2_data((6*16)-1 DOWNTO (3*16));
386 sample_f2_wdata <= sample_f2_data((3*16)-1 DOWNTO (1*16)) & sample_f2_data((6*16)-1 DOWNTO (3*16));
385
387
386 -----------------------------------------------------------------------------
388 -----------------------------------------------------------------------------
387 lpp_lfr_ms_1 : lpp_lfr_ms
389 lpp_lfr_ms_1 : lpp_lfr_ms
388 GENERIC MAP (
390 GENERIC MAP (
389 Mem_use => Mem_use)
391 Mem_use => Mem_use,
392 WINDOWS_HAANNING_PARAM_SIZE => WINDOWS_HAANNING_PARAM_SIZE)
390 PORT MAP (
393 PORT MAP (
391 clk => clk,
394 clk => clk,
392 rstn => rstn,
395 rstn => rstn,
393
396
394 run => '1',--run_ms,
397 run => '1',--run_ms,
395
398
396 start_date => start_date,
399 start_date => start_date,
397
400
398 coarse_time => coarse_time,
401 coarse_time => coarse_time,
399
402
400 sample_f0_wen => sample_f0_wen,
403 sample_f0_wen => sample_f0_wen,
401 sample_f0_wdata => sample_f0_wdata,
404 sample_f0_wdata => sample_f0_wdata,
402 sample_f0_time => sample_f0_time,
405 sample_f0_time => sample_f0_time,
403 sample_f1_wen => sample_f1_wen,
406 sample_f1_wen => sample_f1_wen,
404 sample_f1_wdata => sample_f1_wdata,
407 sample_f1_wdata => sample_f1_wdata,
405 sample_f1_time => sample_f1_time,
408 sample_f1_time => sample_f1_time,
406 sample_f2_wen => sample_f2_wen,
409 sample_f2_wen => sample_f2_wen,
407 sample_f2_wdata => sample_f2_wdata,
410 sample_f2_wdata => sample_f2_wdata,
408 sample_f2_time => sample_f2_time,
411 sample_f2_time => sample_f2_time,
409
412
410 --DMA
413 --DMA
411 dma_fifo_burst_valid => dma_fifo_burst_valid(4), -- OUT
414 dma_fifo_burst_valid => dma_fifo_burst_valid(4), -- OUT
412 dma_fifo_data => dma_fifo_data((4+1)*32-1 DOWNTO 4*32), -- OUT
415 dma_fifo_data => dma_fifo_data((4+1)*32-1 DOWNTO 4*32), -- OUT
413 dma_fifo_ren => dma_fifo_ren(4), -- IN
416 dma_fifo_ren => dma_fifo_ren(4), -- IN
414 dma_buffer_new => dma_buffer_new(4), -- OUT
417 dma_buffer_new => dma_buffer_new(4), -- OUT
415 dma_buffer_addr => dma_buffer_addr((4+1)*32-1 DOWNTO 4*32), -- OUT
418 dma_buffer_addr => dma_buffer_addr((4+1)*32-1 DOWNTO 4*32), -- OUT
416 dma_buffer_length => dma_buffer_length((4+1)*26-1 DOWNTO 4*26), -- OUT
419 dma_buffer_length => dma_buffer_length((4+1)*26-1 DOWNTO 4*26), -- OUT
417 dma_buffer_full => dma_buffer_full(4), -- IN
420 dma_buffer_full => dma_buffer_full(4), -- IN
418 dma_buffer_full_err => dma_buffer_full_err(4), -- IN
421 dma_buffer_full_err => dma_buffer_full_err(4), -- IN
419
422
420
423
421
424
422 --REG
425 --REG
423 ready_matrix_f0 => ready_matrix_f0,
426 ready_matrix_f0 => ready_matrix_f0,
424 ready_matrix_f1 => ready_matrix_f1,
427 ready_matrix_f1 => ready_matrix_f1,
425 ready_matrix_f2 => ready_matrix_f2,
428 ready_matrix_f2 => ready_matrix_f2,
426 error_buffer_full => error_buffer_full,
429 error_buffer_full => error_buffer_full,
427 error_input_fifo_write => error_input_fifo_write,
430 error_input_fifo_write => error_input_fifo_write,
428
431
429 status_ready_matrix_f0 => status_ready_matrix_f0,
432 status_ready_matrix_f0 => status_ready_matrix_f0,
430 status_ready_matrix_f1 => status_ready_matrix_f1,
433 status_ready_matrix_f1 => status_ready_matrix_f1,
431 status_ready_matrix_f2 => status_ready_matrix_f2,
434 status_ready_matrix_f2 => status_ready_matrix_f2,
432 addr_matrix_f0 => addr_matrix_f0,
435 addr_matrix_f0 => addr_matrix_f0,
433 addr_matrix_f1 => addr_matrix_f1,
436 addr_matrix_f1 => addr_matrix_f1,
434 addr_matrix_f2 => addr_matrix_f2,
437 addr_matrix_f2 => addr_matrix_f2,
435
438
436 length_matrix_f0 => length_matrix_f0,
439 length_matrix_f0 => length_matrix_f0,
437 length_matrix_f1 => length_matrix_f1,
440 length_matrix_f1 => length_matrix_f1,
438 length_matrix_f2 => length_matrix_f2,
441 length_matrix_f2 => length_matrix_f2,
439
442
440 matrix_time_f0 => matrix_time_f0,
443 matrix_time_f0 => matrix_time_f0,
441 matrix_time_f1 => matrix_time_f1,
444 matrix_time_f1 => matrix_time_f1,
442 matrix_time_f2 => matrix_time_f2,
445 matrix_time_f2 => matrix_time_f2,
443
446
444 debug_vector => debug_vector_ms);
447 debug_vector => debug_vector_ms);
445
448
446 -----------------------------------------------------------------------------
449 -----------------------------------------------------------------------------
447 PROCESS (clk, rstn)
450 PROCESS (clk, rstn)
448 BEGIN
451 BEGIN
449 IF rstn = '0' THEN
452 IF rstn = '0' THEN
450 dma_fifo_data_forced_gen <= X"00040003";
453 dma_fifo_data_forced_gen <= X"00040003";
451 ELSIF clk'event AND clk = '1' THEN
454 ELSIF clk'event AND clk = '1' THEN
452 IF dma_fifo_ren(0) = '0' THEN
455 IF dma_fifo_ren(0) = '0' THEN
453 CASE dma_fifo_data_forced_gen IS
456 CASE dma_fifo_data_forced_gen IS
454 WHEN X"00040003" => dma_fifo_data_forced_gen <= X"00050002";
457 WHEN X"00040003" => dma_fifo_data_forced_gen <= X"00050002";
455 WHEN X"00050002" => dma_fifo_data_forced_gen <= X"00060001";
458 WHEN X"00050002" => dma_fifo_data_forced_gen <= X"00060001";
456 WHEN X"00060001" => dma_fifo_data_forced_gen <= X"00040003";
459 WHEN X"00060001" => dma_fifo_data_forced_gen <= X"00040003";
457 WHEN OTHERS => NULL;
460 WHEN OTHERS => NULL;
458 END CASE;
461 END CASE;
459 END IF;
462 END IF;
460 END IF;
463 END IF;
461 END PROCESS;
464 END PROCESS;
462
465
463 dma_fifo_data_forced(32 * 1 -1 DOWNTO 32 * 0) <= dma_fifo_data_forced_gen;
466 dma_fifo_data_forced(32 * 1 -1 DOWNTO 32 * 0) <= dma_fifo_data_forced_gen;
464 dma_fifo_data_forced(32 * 2 -1 DOWNTO 32 * 1) <= X"A0000100";
467 dma_fifo_data_forced(32 * 2 -1 DOWNTO 32 * 1) <= X"A0000100";
465 dma_fifo_data_forced(32 * 3 -1 DOWNTO 32 * 2) <= X"08001000";
468 dma_fifo_data_forced(32 * 3 -1 DOWNTO 32 * 2) <= X"08001000";
466 dma_fifo_data_forced(32 * 4 -1 DOWNTO 32 * 3) <= X"80007000";
469 dma_fifo_data_forced(32 * 4 -1 DOWNTO 32 * 3) <= X"80007000";
467 dma_fifo_data_forced(32 * 5 -1 DOWNTO 32 * 4) <= X"0A000B00";
470 dma_fifo_data_forced(32 * 5 -1 DOWNTO 32 * 4) <= X"0A000B00";
468
471
469 dma_fifo_data_debug <= dma_fifo_data WHEN DEBUG_FORCE_DATA_DMA = 0 ELSE dma_fifo_data_forced;
472 dma_fifo_data_debug <= dma_fifo_data WHEN DEBUG_FORCE_DATA_DMA = 0 ELSE dma_fifo_data_forced;
470
473
471 DMA_SubSystem_1 : DMA_SubSystem
474 DMA_SubSystem_1 : DMA_SubSystem
472 GENERIC MAP (
475 GENERIC MAP (
473 hindex => hindex,
476 hindex => hindex,
474 CUSTOM_DMA => 1)
477 CUSTOM_DMA => 1)
475 PORT MAP (
478 PORT MAP (
476 clk => clk,
479 clk => clk,
477 rstn => rstn,
480 rstn => rstn,
478 run => '1',--run_dma,
481 run => '1',--run_dma,
479 ahbi => ahbi,
482 ahbi => ahbi,
480 ahbo => ahbo,
483 ahbo => ahbo,
481
484
482 fifo_burst_valid => dma_fifo_burst_valid, --fifo_burst_valid,
485 fifo_burst_valid => dma_fifo_burst_valid, --fifo_burst_valid,
483 fifo_data => dma_fifo_data_debug, --fifo_data,
486 fifo_data => dma_fifo_data_debug, --fifo_data,
484 fifo_ren => dma_fifo_ren, --fifo_ren,
487 fifo_ren => dma_fifo_ren, --fifo_ren,
485
488
486 buffer_new => dma_buffer_new, --buffer_new,
489 buffer_new => dma_buffer_new, --buffer_new,
487 buffer_addr => dma_buffer_addr, --buffer_addr,
490 buffer_addr => dma_buffer_addr, --buffer_addr,
488 buffer_length => dma_buffer_length, --buffer_length,
491 buffer_length => dma_buffer_length, --buffer_length,
489 buffer_full => dma_buffer_full, --buffer_full,
492 buffer_full => dma_buffer_full, --buffer_full,
490 buffer_full_err => dma_buffer_full_err, --buffer_full_err,
493 buffer_full_err => dma_buffer_full_err, --buffer_full_err,
491 grant_error => dma_grant_error,
494 grant_error => dma_grant_error,
492 debug_vector => debug_vector(8 DOWNTO 0)
495 debug_vector => debug_vector(8 DOWNTO 0)
493 ); --grant_error);
496 ); --grant_error);
494
497
495 -----------------------------------------------------------------------------
498 -----------------------------------------------------------------------------
496 -- OBSERVATION for SIMULATION
499 -- OBSERVATION for SIMULATION
497 all_channel_sim: FOR I IN 0 TO 5 GENERATE
500 all_channel_sim: FOR I IN 0 TO 5 GENERATE
498 PROCESS (clk, rstn)
501 PROCESS (clk, rstn)
499 BEGIN -- PROCESS
502 BEGIN -- PROCESS
500 IF rstn = '0' THEN -- asynchronous reset (active low)
503 IF rstn = '0' THEN -- asynchronous reset (active low)
501 sample_f0_data_sim(I) <= (OTHERS => '0');
504 sample_f0_data_sim(I) <= (OTHERS => '0');
502 sample_f1_data_sim(I) <= (OTHERS => '0');
505 sample_f1_data_sim(I) <= (OTHERS => '0');
503 sample_f2_data_sim(I) <= (OTHERS => '0');
506 sample_f2_data_sim(I) <= (OTHERS => '0');
504 sample_f3_data_sim(I) <= (OTHERS => '0');
507 sample_f3_data_sim(I) <= (OTHERS => '0');
505 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
508 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
506 IF sample_f0_val = '1' THEN sample_f0_data_sim(I) <= sample_f0_data(((I+1)*16)-1 DOWNTO (I*16)); END IF;
509 IF sample_f0_val = '1' THEN sample_f0_data_sim(I) <= sample_f0_data(((I+1)*16)-1 DOWNTO (I*16)); END IF;
507 IF sample_f1_val = '1' THEN sample_f1_data_sim(I) <= sample_f1_data(((I+1)*16)-1 DOWNTO (I*16)); END IF;
510 IF sample_f1_val = '1' THEN sample_f1_data_sim(I) <= sample_f1_data(((I+1)*16)-1 DOWNTO (I*16)); END IF;
508 IF sample_f2_val = '1' THEN sample_f2_data_sim(I) <= sample_f2_data(((I+1)*16)-1 DOWNTO (I*16)); END IF;
511 IF sample_f2_val = '1' THEN sample_f2_data_sim(I) <= sample_f2_data(((I+1)*16)-1 DOWNTO (I*16)); END IF;
509 IF sample_f3_val = '1' THEN sample_f3_data_sim(I) <= sample_f3_data(((I+1)*16)-1 DOWNTO (I*16)); END IF;
512 IF sample_f3_val = '1' THEN sample_f3_data_sim(I) <= sample_f3_data(((I+1)*16)-1 DOWNTO (I*16)); END IF;
510 END IF;
513 END IF;
511 END PROCESS;
514 END PROCESS;
512 END GENERATE all_channel_sim;
515 END GENERATE all_channel_sim;
513 -----------------------------------------------------------------------------
516 -----------------------------------------------------------------------------
514
517
515 END beh;
518 END beh;
@@ -1,659 +1,666
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -- jean-christophe.pellion@easii-ic.com
21 -- jean-christophe.pellion@easii-ic.com
22 ----------------------------------------------------------------------------
22 ----------------------------------------------------------------------------
23 LIBRARY ieee;
23 LIBRARY ieee;
24 USE ieee.std_logic_1164.ALL;
24 USE ieee.std_logic_1164.ALL;
25 USE ieee.numeric_std.ALL;
25 USE ieee.numeric_std.ALL;
26
26
27 LIBRARY lpp;
27 LIBRARY lpp;
28 USE lpp.lpp_ad_conv.ALL;
28 USE lpp.lpp_ad_conv.ALL;
29 USE lpp.iir_filter.ALL;
29 USE lpp.iir_filter.ALL;
30 USE lpp.FILTERcfg.ALL;
30 USE lpp.FILTERcfg.ALL;
31 USE lpp.lpp_memory.ALL;
31 USE lpp.lpp_memory.ALL;
32 USE lpp.lpp_waveform_pkg.ALL;
32 USE lpp.lpp_waveform_pkg.ALL;
33 USE lpp.cic_pkg.ALL;
33 USE lpp.cic_pkg.ALL;
34 USE lpp.data_type_pkg.ALL;
34 USE lpp.data_type_pkg.ALL;
35 USE lpp.lpp_lfr_filter_coeff.ALL;
35 USE lpp.lpp_lfr_filter_coeff.ALL;
36
36
37 LIBRARY techmap;
37 LIBRARY techmap;
38 USE techmap.gencomp.ALL;
38 USE techmap.gencomp.ALL;
39
39
40 LIBRARY grlib;
40 LIBRARY grlib;
41 USE grlib.amba.ALL;
41 USE grlib.amba.ALL;
42 USE grlib.stdlib.ALL;
42 USE grlib.stdlib.ALL;
43 USE grlib.devices.ALL;
43 USE grlib.devices.ALL;
44 USE GRLIB.DMA2AHB_Package.ALL;
44 USE GRLIB.DMA2AHB_Package.ALL;
45
45
46 ENTITY lpp_lfr_filter IS
46 ENTITY lpp_lfr_filter IS
47 GENERIC(
47 GENERIC(
48 Mem_use : INTEGER := use_RAM
48 Mem_use : INTEGER := use_RAM;
49 RTL_DESIGN_LIGHT : INTEGER := 0
49 );
50 );
50 PORT (
51 PORT (
51 sample : IN Samples(7 DOWNTO 0);
52 sample : IN Samples(7 DOWNTO 0);
52 sample_val : IN STD_LOGIC;
53 sample_val : IN STD_LOGIC;
53 sample_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
54 sample_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
54 --
55 --
55 clk : IN STD_LOGIC;
56 clk : IN STD_LOGIC;
56 rstn : IN STD_LOGIC;
57 rstn : IN STD_LOGIC;
57 --
58 --
58 data_shaping_SP0 : IN STD_LOGIC;
59 data_shaping_SP0 : IN STD_LOGIC;
59 data_shaping_SP1 : IN STD_LOGIC;
60 data_shaping_SP1 : IN STD_LOGIC;
60 data_shaping_R0 : IN STD_LOGIC;
61 data_shaping_R0 : IN STD_LOGIC;
61 data_shaping_R1 : IN STD_LOGIC;
62 data_shaping_R1 : IN STD_LOGIC;
62 data_shaping_R2 : IN STD_LOGIC;
63 data_shaping_R2 : IN STD_LOGIC;
63 --
64 --
64 sample_f0_val : OUT STD_LOGIC;
65 sample_f0_val : OUT STD_LOGIC;
65 sample_f1_val : OUT STD_LOGIC;
66 sample_f1_val : OUT STD_LOGIC;
66 sample_f2_val : OUT STD_LOGIC;
67 sample_f2_val : OUT STD_LOGIC;
67 sample_f3_val : OUT STD_LOGIC;
68 sample_f3_val : OUT STD_LOGIC;
68 --
69 --
69 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
70 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
70 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
71 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
71 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
72 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
72 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
73 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
73 --
74 --
74 sample_f0_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
75 sample_f0_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
75 sample_f1_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
76 sample_f1_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
76 sample_f2_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
77 sample_f2_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
77 sample_f3_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0)
78 sample_f3_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0)
78 );
79 );
79 END lpp_lfr_filter;
80 END lpp_lfr_filter;
80
81
81 ARCHITECTURE tb OF lpp_lfr_filter IS
82 ARCHITECTURE tb OF lpp_lfr_filter IS
82
83
83 COMPONENT Downsampling
84 COMPONENT Downsampling
84 GENERIC (
85 GENERIC (
85 ChanelCount : INTEGER;
86 ChanelCount : INTEGER;
86 SampleSize : INTEGER;
87 SampleSize : INTEGER;
87 DivideParam : INTEGER);
88 DivideParam : INTEGER);
88 PORT (
89 PORT (
89 clk : IN STD_LOGIC;
90 clk : IN STD_LOGIC;
90 rstn : IN STD_LOGIC;
91 rstn : IN STD_LOGIC;
91 sample_in_val : IN STD_LOGIC;
92 sample_in_val : IN STD_LOGIC;
92 sample_in : IN samplT(ChanelCount-1 DOWNTO 0, SampleSize-1 DOWNTO 0);
93 sample_in : IN samplT(ChanelCount-1 DOWNTO 0, SampleSize-1 DOWNTO 0);
93 sample_out_val : OUT STD_LOGIC;
94 sample_out_val : OUT STD_LOGIC;
94 sample_out : OUT samplT(ChanelCount-1 DOWNTO 0, SampleSize-1 DOWNTO 0));
95 sample_out : OUT samplT(ChanelCount-1 DOWNTO 0, SampleSize-1 DOWNTO 0));
95 END COMPONENT;
96 END COMPONENT;
96
97
97 -----------------------------------------------------------------------------
98 -----------------------------------------------------------------------------
98 CONSTANT ChanelCount : INTEGER := 8;
99 CONSTANT ChanelCount : INTEGER := 8;
99
100
100 -----------------------------------------------------------------------------
101 -----------------------------------------------------------------------------
101 SIGNAL sample_val_delay : STD_LOGIC;
102 SIGNAL sample_val_delay : STD_LOGIC;
102 -----------------------------------------------------------------------------
103 -----------------------------------------------------------------------------
103 CONSTANT Coef_SZ : INTEGER := 9;
104 CONSTANT Coef_SZ : INTEGER := 9;
104 CONSTANT CoefCntPerCel : INTEGER := 6;
105 CONSTANT CoefCntPerCel : INTEGER := 6;
105 CONSTANT CoefPerCel : INTEGER := 5;
106 CONSTANT CoefPerCel : INTEGER := 5;
106 CONSTANT Cels_count : INTEGER := 5;
107 CONSTANT Cels_count : INTEGER := 5;
107
108
108 --SIGNAL coefs : STD_LOGIC_VECTOR((Coef_SZ*CoefCntPerCel*Cels_count)-1 DOWNTO 0);
109 --SIGNAL coefs : STD_LOGIC_VECTOR((Coef_SZ*CoefCntPerCel*Cels_count)-1 DOWNTO 0);
109 SIGNAL coefs_v2 : STD_LOGIC_VECTOR((Coef_SZ*CoefPerCel*Cels_count)-1 DOWNTO 0);
110 SIGNAL coefs_v2 : STD_LOGIC_VECTOR((Coef_SZ*CoefPerCel*Cels_count)-1 DOWNTO 0);
110 SIGNAL sample_filter_in : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
111 SIGNAL sample_filter_in : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
111 --SIGNAL sample_filter_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
112 --SIGNAL sample_filter_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
112 --
113 --
113 SIGNAL sample_filter_v2_out_sim : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
114 SIGNAL sample_filter_v2_out_sim : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
114
115
115 SIGNAL sample_filter_v2_out_val : STD_LOGIC;
116 SIGNAL sample_filter_v2_out_val : STD_LOGIC;
116 SIGNAL sample_filter_v2_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
117 SIGNAL sample_filter_v2_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
117 -----------------------------------------------------------------------------
118 -----------------------------------------------------------------------------
118 SIGNAL sample_data_shaping_out_val : STD_LOGIC;
119 SIGNAL sample_data_shaping_out_val : STD_LOGIC;
119 SIGNAL sample_data_shaping_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
120 SIGNAL sample_data_shaping_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
120 SIGNAL sample_data_shaping_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
121 SIGNAL sample_data_shaping_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
121 SIGNAL sample_data_shaping_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
122 SIGNAL sample_data_shaping_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
122 SIGNAL sample_data_shaping_f2_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
123 SIGNAL sample_data_shaping_f2_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
123 SIGNAL sample_data_shaping_f1_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
124 SIGNAL sample_data_shaping_f1_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
124 SIGNAL sample_data_shaping_f2_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
125 SIGNAL sample_data_shaping_f2_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
125 -----------------------------------------------------------------------------
126 -----------------------------------------------------------------------------
126 SIGNAL sample_filter_v2_out_val_s : STD_LOGIC;
127 SIGNAL sample_filter_v2_out_val_s : STD_LOGIC;
127 SIGNAL sample_filter_v2_out_s : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
128 SIGNAL sample_filter_v2_out_s : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
128 -----------------------------------------------------------------------------
129 -----------------------------------------------------------------------------
129 -- SIGNAL sample_f0_val : STD_LOGIC;
130 -- SIGNAL sample_f0_val : STD_LOGIC;
130 SIGNAL sample_f0 : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
131 SIGNAL sample_f0 : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
131 SIGNAL sample_f0_s : sample_vector(7 DOWNTO 0, 15 DOWNTO 0);
132 SIGNAL sample_f0_s : sample_vector(7 DOWNTO 0, 15 DOWNTO 0);
132 --
133 --
133 -- SIGNAL sample_f1_val : STD_LOGIC;
134 -- SIGNAL sample_f1_val : STD_LOGIC;
134
135
135 SIGNAL sample_f0_f1_s : samplT(5 DOWNTO 0, 17 DOWNTO 0);
136 SIGNAL sample_f0_f1_s : samplT(5 DOWNTO 0, 17 DOWNTO 0);
136 SIGNAL sample_f1_s : samplT(5 DOWNTO 0, 17 DOWNTO 0);
137 SIGNAL sample_f1_s : samplT(5 DOWNTO 0, 17 DOWNTO 0);
137 SIGNAL sample_f1 : samplT(5 DOWNTO 0, 17 DOWNTO 0);
138 SIGNAL sample_f1 : samplT(5 DOWNTO 0, 17 DOWNTO 0);
138 --
139 --
139 -- SIGNAL sample_f2_val : STD_LOGIC;
140 -- SIGNAL sample_f2_val : STD_LOGIC;
140 SIGNAL sample_f2 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
141 SIGNAL sample_f2 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
141 SIGNAL sample_f2_cic_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
142 SIGNAL sample_f2_cic_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
142 SIGNAL sample_f2_cic_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
143 SIGNAL sample_f2_cic_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
143 SIGNAL sample_f2_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
144 SIGNAL sample_f2_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
144 SIGNAL sample_f2_cic : sample_vector(5 DOWNTO 0, 15 DOWNTO 0);
145 SIGNAL sample_f2_cic : sample_vector(5 DOWNTO 0, 15 DOWNTO 0);
145 SIGNAL sample_f2_cic_val : STD_LOGIC;
146 SIGNAL sample_f2_cic_val : STD_LOGIC;
146 SIGNAL sample_f2_filter_val : STD_LOGIC;
147 SIGNAL sample_f2_filter_val : STD_LOGIC;
147
148
148 SIGNAL sample_f3 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
149 SIGNAL sample_f3 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
149 SIGNAL sample_f3_cic_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
150 SIGNAL sample_f3_cic_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
150 SIGNAL sample_f3_cic_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
151 SIGNAL sample_f3_cic_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
151 SIGNAL sample_f3_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
152 SIGNAL sample_f3_filter : samplT(5 DOWNTO 0, 17 DOWNTO 0);
152 SIGNAL sample_f3_cic : sample_vector(5 DOWNTO 0, 15 DOWNTO 0);
153 SIGNAL sample_f3_cic : sample_vector(5 DOWNTO 0, 15 DOWNTO 0);
153 SIGNAL sample_f3_cic_val : STD_LOGIC;
154 SIGNAL sample_f3_cic_val : STD_LOGIC;
154 SIGNAL sample_f3_filter_val : STD_LOGIC;
155 SIGNAL sample_f3_filter_val : STD_LOGIC;
155
156
156 -----------------------------------------------------------------------------
157 -----------------------------------------------------------------------------
157 --SIGNAL data_f0_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
158 --SIGNAL data_f0_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
158 --SIGNAL data_f1_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
159 --SIGNAL data_f1_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
159 --SIGNAL data_f2_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
160 --SIGNAL data_f2_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
160 --SIGNAL data_f3_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
161 --SIGNAL data_f3_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
161 -----------------------------------------------------------------------------
162 -----------------------------------------------------------------------------
162
163
163 SIGNAL sample_f0_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
164 SIGNAL sample_f0_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
164 SIGNAL sample_f1_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
165 SIGNAL sample_f1_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
165 SIGNAL sample_f2_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
166 SIGNAL sample_f2_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
166 SIGNAL sample_f3_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
167 SIGNAL sample_f3_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
167
168
168 SIGNAL sample_f0_val_s : STD_LOGIC;
169 SIGNAL sample_f0_val_s : STD_LOGIC;
169 SIGNAL sample_f1_val_s : STD_LOGIC;
170 SIGNAL sample_f1_val_s : STD_LOGIC;
170 SIGNAL sample_f1_val_ss : STD_LOGIC;
171 SIGNAL sample_f1_val_ss : STD_LOGIC;
171 SIGNAL sample_f2_val_s : STD_LOGIC;
172 SIGNAL sample_f2_val_s : STD_LOGIC;
172 SIGNAL sample_f3_val_s : STD_LOGIC;
173 SIGNAL sample_f3_val_s : STD_LOGIC;
173
174
174 -----------------------------------------------------------------------------
175 -----------------------------------------------------------------------------
175 -- CONFIG FILTER IIR f0 to f1
176 -- CONFIG FILTER IIR f0 to f1
176 -----------------------------------------------------------------------------
177 -----------------------------------------------------------------------------
177 CONSTANT f0_to_f1_CEL_NUMBER : INTEGER := 5;
178 CONSTANT f0_to_f1_CEL_NUMBER : INTEGER := 5;
178 CONSTANT f0_to_f1_COEFFICIENT_SIZE : INTEGER := 10;
179 CONSTANT f0_to_f1_COEFFICIENT_SIZE : INTEGER := 10;
179 CONSTANT f0_to_f1_POINT_POSITION : INTEGER := 8;
180 CONSTANT f0_to_f1_POINT_POSITION : INTEGER := 8;
180
181
181 CONSTANT f0_to_f1_sos : COEFF_CEL_ARRAY_REAL(1 TO 5) :=
182 CONSTANT f0_to_f1_sos : COEFF_CEL_ARRAY_REAL(1 TO 5) :=
182 (
183 (
183 (1.0, -1.61171504942096, 1.0, 1.0, -1.68876443778669, 0.908610171614583),
184 (1.0, -1.61171504942096, 1.0, 1.0, -1.68876443778669, 0.908610171614583),
184 (1.0, -1.53324505744412, 1.0, 1.0, -1.51088513595779, 0.732564401274351),
185 (1.0, -1.53324505744412, 1.0, 1.0, -1.51088513595779, 0.732564401274351),
185 (1.0, -1.30646173160060, 1.0, 1.0, -1.30571711968384, 0.546869268827102),
186 (1.0, -1.30646173160060, 1.0, 1.0, -1.30571711968384, 0.546869268827102),
186 (1.0, -0.651038739239370, 1.0, 1.0, -1.08747326287406, 0.358436944718464),
187 (1.0, -0.651038739239370, 1.0, 1.0, -1.08747326287406, 0.358436944718464),
187 (1.0, 1.24322747034001, 1.0, 1.0, -0.929530176676438, 0.224862726961691)
188 (1.0, 1.24322747034001, 1.0, 1.0, -0.929530176676438, 0.224862726961691)
188 );
189 );
189 CONSTANT f0_to_f1_gain : COEFF_CEL_REAL :=
190 CONSTANT f0_to_f1_gain : COEFF_CEL_REAL :=
190 ( 0.566196896119831, 0.474937156750133, 0.347712822970540, 0.200868393871900, 0.0910613125308450, 1.0);
191 ( 0.566196896119831, 0.474937156750133, 0.347712822970540, 0.200868393871900, 0.0910613125308450, 1.0);
191
192
192 CONSTANT coefs_iir_cel_f0_to_f1 : STD_LOGIC_VECTOR((f0_to_f1_CEL_NUMBER*f0_to_f1_COEFFICIENT_SIZE*5)-1 DOWNTO 0)
193 CONSTANT coefs_iir_cel_f0_to_f1 : STD_LOGIC_VECTOR((f0_to_f1_CEL_NUMBER*f0_to_f1_COEFFICIENT_SIZE*5)-1 DOWNTO 0)
193 := get_IIR_CEL_FILTER_CONFIG(
194 := get_IIR_CEL_FILTER_CONFIG(
194 f0_to_f1_COEFFICIENT_SIZE,
195 f0_to_f1_COEFFICIENT_SIZE,
195 f0_to_f1_POINT_POSITION,
196 f0_to_f1_POINT_POSITION,
196 f0_to_f1_CEL_NUMBER,
197 f0_to_f1_CEL_NUMBER,
197 f0_to_f1_sos,
198 f0_to_f1_sos,
198 f0_to_f1_gain);
199 f0_to_f1_gain);
199 -----------------------------------------------------------------------------
200 -----------------------------------------------------------------------------
200
201
201 -----------------------------------------------------------------------------
202 -----------------------------------------------------------------------------
202 -- CONFIG FILTER IIR f2 and f3
203 -- CONFIG FILTER IIR f2 and f3
203 -----------------------------------------------------------------------------
204 -----------------------------------------------------------------------------
204 CONSTANT f2_f3_CEL_NUMBER : INTEGER := 5;
205 CONSTANT f2_f3_CEL_NUMBER : INTEGER := 5;
205 CONSTANT f2_f3_COEFFICIENT_SIZE : INTEGER := 10;
206 CONSTANT f2_f3_COEFFICIENT_SIZE : INTEGER := 10;
206 CONSTANT f2_f3_POINT_POSITION : INTEGER := 8;
207 CONSTANT f2_f3_POINT_POSITION : INTEGER := 8;
207
208
208 CONSTANT f2_f3_sos : COEFF_CEL_ARRAY_REAL(1 TO 5) :=
209 CONSTANT f2_f3_sos : COEFF_CEL_ARRAY_REAL(1 TO 5) :=
209 (
210 (
210 (1.0, -1.61171504942096, 1.0, 1.0, -1.68876443778669, 0.908610171614583),
211 (1.0, -1.61171504942096, 1.0, 1.0, -1.68876443778669, 0.908610171614583),
211 (1.0, -1.53324505744412, 1.0, 1.0, -1.51088513595779, 0.732564401274351),
212 (1.0, -1.53324505744412, 1.0, 1.0, -1.51088513595779, 0.732564401274351),
212 (1.0, -1.30646173160060, 1.0, 1.0, -1.30571711968384, 0.546869268827102),
213 (1.0, -1.30646173160060, 1.0, 1.0, -1.30571711968384, 0.546869268827102),
213 (1.0, -0.651038739239370, 1.0, 1.0, -1.08747326287406, 0.358436944718464),
214 (1.0, -0.651038739239370, 1.0, 1.0, -1.08747326287406, 0.358436944718464),
214 (1.0, 1.24322747034001, 1.0, 1.0, -0.929530176676438, 0.224862726961691)
215 (1.0, 1.24322747034001, 1.0, 1.0, -0.929530176676438, 0.224862726961691)
215 );
216 );
216 CONSTANT f2_f3_gain : COEFF_CEL_REAL :=
217 CONSTANT f2_f3_gain : COEFF_CEL_REAL :=
217 ( 0.566196896119831, 0.474937156750133, 0.347712822970540, 0.200868393871900, 0.0910613125308450, 1.0);
218 ( 0.566196896119831, 0.474937156750133, 0.347712822970540, 0.200868393871900, 0.0910613125308450, 1.0);
218
219
219 CONSTANT coefs_iir_cel_f2_f3 : STD_LOGIC_VECTOR((f2_f3_CEL_NUMBER*f2_f3_COEFFICIENT_SIZE*5)-1 DOWNTO 0)
220 CONSTANT coefs_iir_cel_f2_f3 : STD_LOGIC_VECTOR((f2_f3_CEL_NUMBER*f2_f3_COEFFICIENT_SIZE*5)-1 DOWNTO 0)
220 := get_IIR_CEL_FILTER_CONFIG(
221 := get_IIR_CEL_FILTER_CONFIG(
221 f2_f3_COEFFICIENT_SIZE,
222 f2_f3_COEFFICIENT_SIZE,
222 f2_f3_POINT_POSITION,
223 f2_f3_POINT_POSITION,
223 f2_f3_CEL_NUMBER,
224 f2_f3_CEL_NUMBER,
224 f2_f3_sos,
225 f2_f3_sos,
225 f2_f3_gain);
226 f2_f3_gain);
226 -----------------------------------------------------------------------------
227 -----------------------------------------------------------------------------
227
228
228 SIGNAL sample_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
229 SIGNAL sample_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
229 SIGNAL sample_f0_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
230 SIGNAL sample_f0_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
230 SIGNAL sample_f1_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
231 SIGNAL sample_f1_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
231 SIGNAL sample_f2_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
232 SIGNAL sample_f2_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
232 SIGNAL sample_f3_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
233 SIGNAL sample_f3_time_reg : STD_LOGIC_VECTOR(47 DOWNTO 0);
233 SIGNAL sample_f0_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
234 SIGNAL sample_f0_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
234 SIGNAL sample_f1_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
235 SIGNAL sample_f1_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
235 -- SIGNAL sample_f2_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
236 -- SIGNAL sample_f2_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
236 -- SIGNAL sample_f3_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
237 -- SIGNAL sample_f3_time_s : STD_LOGIC_VECTOR(47 DOWNTO 0);
237 SIGNAL sample_filter_v2_out_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
238 SIGNAL sample_filter_v2_out_time : STD_LOGIC_VECTOR(47 DOWNTO 0);
238
239
239 BEGIN
240 BEGIN
240
241
241 -----------------------------------------------------------------------------
242 -----------------------------------------------------------------------------
242 PROCESS (clk, rstn)
243 PROCESS (clk, rstn)
243 BEGIN -- PROCESS
244 BEGIN -- PROCESS
244 IF rstn = '0' THEN -- asynchronous reset (active low)
245 IF rstn = '0' THEN -- asynchronous reset (active low)
245 sample_val_delay <= '0';
246 sample_val_delay <= '0';
246 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
247 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
247 sample_val_delay <= sample_val;
248 sample_val_delay <= sample_val;
248 END IF;
249 END IF;
249 END PROCESS;
250 END PROCESS;
250
251
251 -----------------------------------------------------------------------------
252 -----------------------------------------------------------------------------
252 ChanelLoop : FOR i IN 0 TO ChanelCount-1 GENERATE
253 ChanelLoop : FOR i IN 0 TO ChanelCount-1 GENERATE
253 SampleLoop : FOR j IN 0 TO 15 GENERATE
254 SampleLoop : FOR j IN 0 TO 15 GENERATE
254 sample_filter_in(i, j) <= sample(i)(j);
255 sample_filter_in(i, j) <= sample(i)(j);
255 END GENERATE;
256 END GENERATE;
256
257
257 sample_filter_in(i, 16) <= sample(i)(15);
258 sample_filter_in(i, 16) <= sample(i)(15);
258 sample_filter_in(i, 17) <= sample(i)(15);
259 sample_filter_in(i, 17) <= sample(i)(15);
259 END GENERATE;
260 END GENERATE;
260
261
261 coefs_v2 <= CoefsInitValCst_v2;
262 coefs_v2 <= CoefsInitValCst_v2;
262
263
263 IIR_CEL_CTRLR_v2_1 : IIR_CEL_CTRLR_v2
264 IIR_CEL_CTRLR_v2_1 : IIR_CEL_CTRLR_v2
264 GENERIC MAP (
265 GENERIC MAP (
265 tech => 0,
266 tech => 0,
266 Mem_use => Mem_use, -- use_RAM
267 Mem_use => Mem_use, -- use_RAM
267 Sample_SZ => 18,
268 Sample_SZ => 18,
268 Coef_SZ => Coef_SZ,
269 Coef_SZ => Coef_SZ,
269 Coef_Nb => 25,
270 Coef_Nb => 25,
270 Coef_sel_SZ => 5,
271 Coef_sel_SZ => 5,
271 Cels_count => Cels_count,
272 Cels_count => Cels_count,
272 ChanelsCount => ChanelCount)
273 ChanelsCount => ChanelCount)
273 PORT MAP (
274 PORT MAP (
274 rstn => rstn,
275 rstn => rstn,
275 clk => clk,
276 clk => clk,
276 virg_pos => 7,
277 virg_pos => 7,
277 coefs => coefs_v2,
278 coefs => coefs_v2,
278 sample_in_val => sample_val_delay,
279 sample_in_val => sample_val_delay,
279 sample_in => sample_filter_in,
280 sample_in => sample_filter_in,
280 sample_out_val => sample_filter_v2_out_val,
281 sample_out_val => sample_filter_v2_out_val,
281 sample_out => sample_filter_v2_out);
282 sample_out => sample_filter_v2_out);
282
283
283 -- TIME --
284 -- TIME --
284 PROCESS (clk, rstn)
285 PROCESS (clk, rstn)
285 BEGIN -- PROCESS
286 BEGIN -- PROCESS
286 IF rstn = '0' THEN -- asynchronous reset (active low)
287 IF rstn = '0' THEN -- asynchronous reset (active low)
287 sample_time_reg <= (OTHERS => '0');
288 sample_time_reg <= (OTHERS => '0');
288 sample_filter_v2_out_time <= (OTHERS => '0');
289 sample_filter_v2_out_time <= (OTHERS => '0');
289 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
290 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
290 IF sample_val = '1' THEN
291 IF sample_val = '1' THEN
291 sample_time_reg <= sample_time;
292 sample_time_reg <= sample_time;
292 END IF;
293 END IF;
293 IF sample_filter_v2_out_val = '1' THEN
294 IF sample_filter_v2_out_val = '1' THEN
294 sample_filter_v2_out_time <= sample_time_reg;
295 sample_filter_v2_out_time <= sample_time_reg;
295 END IF;
296 END IF;
296 END IF;
297 END IF;
297 END PROCESS;
298 END PROCESS;
298 ----------
299 ----------
299
300
300 --for simulation/observation-------------------------------------------------
301 --for simulation/observation-------------------------------------------------
301 ALL_channel_f0_sim: FOR I IN 0 TO ChanelCount-1 GENERATE
302 ALL_channel_f0_sim: FOR I IN 0 TO ChanelCount-1 GENERATE
302 all_bit: FOR J IN 0 TO 17 GENERATE
303 all_bit: FOR J IN 0 TO 17 GENERATE
303 PROCESS (clk, rstn)
304 PROCESS (clk, rstn)
304 BEGIN -- PROCESS
305 BEGIN -- PROCESS
305 IF rstn = '0' THEN -- asynchronous reset (active low)
306 IF rstn = '0' THEN -- asynchronous reset (active low)
306 sample_filter_v2_out_sim(I,J) <= '0';
307 sample_filter_v2_out_sim(I,J) <= '0';
307 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
308 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
308 IF sample_filter_v2_out_val = '1' THEN
309 IF sample_filter_v2_out_val = '1' THEN
309 sample_filter_v2_out_sim(I,J) <= sample_filter_v2_out(I,J);
310 sample_filter_v2_out_sim(I,J) <= sample_filter_v2_out(I,J);
310 END IF;
311 END IF;
311 END IF;
312 END IF;
312 END PROCESS;
313 END PROCESS;
313 END GENERATE all_bit;
314 END GENERATE all_bit;
314 END GENERATE ALL_channel_f0_sim;
315 END GENERATE ALL_channel_f0_sim;
315 -----------------------------------------------------------------------------
316 -----------------------------------------------------------------------------
316
317
317
318
318 -----------------------------------------------------------------------------
319 -----------------------------------------------------------------------------
319 -- DATA_SHAPING
320 -- DATA_SHAPING
320 -----------------------------------------------------------------------------
321 -----------------------------------------------------------------------------
321 all_data_shaping_in_loop : FOR I IN 17 DOWNTO 0 GENERATE
322 all_data_shaping_in_loop : FOR I IN 17 DOWNTO 0 GENERATE
322 sample_data_shaping_f0_s(I) <= sample_filter_v2_out(0, I);
323 sample_data_shaping_f0_s(I) <= sample_filter_v2_out(0, I);
323 sample_data_shaping_f1_s(I) <= sample_filter_v2_out(1, I);
324 sample_data_shaping_f1_s(I) <= sample_filter_v2_out(1, I);
324 sample_data_shaping_f2_s(I) <= sample_filter_v2_out(2, I);
325 sample_data_shaping_f2_s(I) <= sample_filter_v2_out(2, I);
325 END GENERATE all_data_shaping_in_loop;
326 END GENERATE all_data_shaping_in_loop;
326
327
327 sample_data_shaping_f1_f0_s <= sample_data_shaping_f1_s - sample_data_shaping_f0_s;
328 sample_data_shaping_f1_f0_s <= sample_data_shaping_f1_s - sample_data_shaping_f0_s;
328 sample_data_shaping_f2_f1_s <= sample_data_shaping_f2_s - sample_data_shaping_f1_s;
329 sample_data_shaping_f2_f1_s <= sample_data_shaping_f2_s - sample_data_shaping_f1_s;
329
330
330 PROCESS (clk, rstn)
331 PROCESS (clk, rstn)
331 BEGIN -- PROCESS
332 BEGIN -- PROCESS
332 IF rstn = '0' THEN -- asynchronous reset (active low)
333 IF rstn = '0' THEN -- asynchronous reset (active low)
333 sample_data_shaping_out_val <= '0';
334 sample_data_shaping_out_val <= '0';
334 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
335 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
335 sample_data_shaping_out_val <= sample_filter_v2_out_val;
336 sample_data_shaping_out_val <= sample_filter_v2_out_val;
336 END IF;
337 END IF;
337 END PROCESS;
338 END PROCESS;
338
339
339 SampleLoop_data_shaping : FOR j IN 0 TO 17 GENERATE
340 SampleLoop_data_shaping : FOR j IN 0 TO 17 GENERATE
340 PROCESS (clk, rstn)
341 PROCESS (clk, rstn)
341 BEGIN
342 BEGIN
342 IF rstn = '0' THEN
343 IF rstn = '0' THEN
343 sample_data_shaping_out(0, j) <= '0';
344 sample_data_shaping_out(0, j) <= '0';
344 sample_data_shaping_out(1, j) <= '0';
345 sample_data_shaping_out(1, j) <= '0';
345 sample_data_shaping_out(2, j) <= '0';
346 sample_data_shaping_out(2, j) <= '0';
346 sample_data_shaping_out(3, j) <= '0';
347 sample_data_shaping_out(3, j) <= '0';
347 sample_data_shaping_out(4, j) <= '0';
348 sample_data_shaping_out(4, j) <= '0';
348 sample_data_shaping_out(5, j) <= '0';
349 sample_data_shaping_out(5, j) <= '0';
349 sample_data_shaping_out(6, j) <= '0';
350 sample_data_shaping_out(6, j) <= '0';
350 sample_data_shaping_out(7, j) <= '0';
351 sample_data_shaping_out(7, j) <= '0';
351 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
352 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
352 sample_data_shaping_out(0, j) <= sample_filter_v2_out(0, j);
353 sample_data_shaping_out(0, j) <= sample_filter_v2_out(0, j);
353 IF data_shaping_SP0 = '1' THEN
354 IF data_shaping_SP0 = '1' THEN
354 sample_data_shaping_out(1, j) <= sample_data_shaping_f1_f0_s(j);
355 sample_data_shaping_out(1, j) <= sample_data_shaping_f1_f0_s(j);
355 ELSE
356 ELSE
356 sample_data_shaping_out(1, j) <= sample_filter_v2_out(1, j);
357 sample_data_shaping_out(1, j) <= sample_filter_v2_out(1, j);
357 END IF;
358 END IF;
358 IF data_shaping_SP1 = '1' THEN
359 IF data_shaping_SP1 = '1' THEN
359 sample_data_shaping_out(2, j) <= sample_data_shaping_f2_f1_s(j);
360 sample_data_shaping_out(2, j) <= sample_data_shaping_f2_f1_s(j);
360 ELSE
361 ELSE
361 sample_data_shaping_out(2, j) <= sample_filter_v2_out(2, j);
362 sample_data_shaping_out(2, j) <= sample_filter_v2_out(2, j);
362 END IF;
363 END IF;
363 sample_data_shaping_out(3, j) <= sample_filter_v2_out(3, j);
364 sample_data_shaping_out(3, j) <= sample_filter_v2_out(3, j);
364 sample_data_shaping_out(4, j) <= sample_filter_v2_out(4, j);
365 sample_data_shaping_out(4, j) <= sample_filter_v2_out(4, j);
365 sample_data_shaping_out(5, j) <= sample_filter_v2_out(5, j);
366 sample_data_shaping_out(5, j) <= sample_filter_v2_out(5, j);
366 sample_data_shaping_out(6, j) <= sample_filter_v2_out(6, j);
367 sample_data_shaping_out(6, j) <= sample_filter_v2_out(6, j);
367 sample_data_shaping_out(7, j) <= sample_filter_v2_out(7, j);
368 sample_data_shaping_out(7, j) <= sample_filter_v2_out(7, j);
368 END IF;
369 END IF;
369 END PROCESS;
370 END PROCESS;
370 END GENERATE;
371 END GENERATE;
371
372
372 sample_filter_v2_out_val_s <= sample_data_shaping_out_val;
373 sample_filter_v2_out_val_s <= sample_data_shaping_out_val;
373 ChanelLoopOut : FOR i IN 0 TO 7 GENERATE
374 ChanelLoopOut : FOR i IN 0 TO 7 GENERATE
374 SampleLoopOut : FOR j IN 0 TO 15 GENERATE
375 SampleLoopOut : FOR j IN 0 TO 15 GENERATE
375 sample_filter_v2_out_s(i, j) <= sample_data_shaping_out(i, j);
376 sample_filter_v2_out_s(i, j) <= sample_data_shaping_out(i, j);
376 END GENERATE;
377 END GENERATE;
377 END GENERATE;
378 END GENERATE;
378 -----------------------------------------------------------------------------
379 -----------------------------------------------------------------------------
379 -- F0 -- @24.576 kHz
380 -- F0 -- @24.576 kHz
380 -----------------------------------------------------------------------------
381 -----------------------------------------------------------------------------
381
382
382 Downsampling_f0 : Downsampling
383 Downsampling_f0 : Downsampling
383 GENERIC MAP (
384 GENERIC MAP (
384 ChanelCount => 8,
385 ChanelCount => 8,
385 SampleSize => 16,
386 SampleSize => 16,
386 DivideParam => 4)
387 DivideParam => 4)
387 PORT MAP (
388 PORT MAP (
388 clk => clk,
389 clk => clk,
389 rstn => rstn,
390 rstn => rstn,
390 sample_in_val => sample_filter_v2_out_val_s,
391 sample_in_val => sample_filter_v2_out_val_s,
391 sample_in => sample_filter_v2_out_s,
392 sample_in => sample_filter_v2_out_s,
392 sample_out_val => sample_f0_val_s,
393 sample_out_val => sample_f0_val_s,
393 sample_out => sample_f0);
394 sample_out => sample_f0);
394
395
395 -- TIME --
396 -- TIME --
396 PROCESS (clk, rstn)
397 PROCESS (clk, rstn)
397 BEGIN
398 BEGIN
398 IF rstn = '0' THEN
399 IF rstn = '0' THEN
399 sample_f0_time_reg <= (OTHERS => '0');
400 sample_f0_time_reg <= (OTHERS => '0');
400 ELSIF clk'event AND clk = '1' THEN
401 ELSIF clk'event AND clk = '1' THEN
401 IF sample_f0_val_s = '1' THEN
402 IF sample_f0_val_s = '1' THEN
402 sample_f0_time_reg <= sample_filter_v2_out_time;
403 sample_f0_time_reg <= sample_filter_v2_out_time;
403 END IF;
404 END IF;
404 END IF;
405 END IF;
405 END PROCESS;
406 END PROCESS;
406 sample_f0_time_s <= sample_filter_v2_out_time WHEN sample_f0_val_s = '1' ELSE sample_f0_time_reg;
407 sample_f0_time_s <= sample_filter_v2_out_time WHEN sample_f0_val_s = '1' ELSE sample_f0_time_reg;
407 sample_f0_time <= sample_f0_time_s;
408 sample_f0_time <= sample_f0_time_s;
408 ----------
409 ----------
409
410
410 sample_f0_val <= sample_f0_val_s;
411 sample_f0_val <= sample_f0_val_s;
411
412
412 all_bit_sample_f0 : FOR I IN 15 DOWNTO 0 GENERATE
413 all_bit_sample_f0 : FOR I IN 15 DOWNTO 0 GENERATE
413 sample_f0_wdata_s(I) <= sample_f0(0, I); -- V
414 sample_f0_wdata_s(I) <= sample_f0(0, I); -- V
414 sample_f0_wdata_s(16*1+I) <= sample_f0(1, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(3, I); -- E1
415 sample_f0_wdata_s(16*1+I) <= sample_f0(1, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(3, I); -- E1
415 sample_f0_wdata_s(16*2+I) <= sample_f0(2, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(4, I); -- E2
416 sample_f0_wdata_s(16*2+I) <= sample_f0(2, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(4, I); -- E2
416 sample_f0_wdata_s(16*3+I) <= sample_f0(5, I); -- B1
417 sample_f0_wdata_s(16*3+I) <= sample_f0(5, I); -- B1
417 sample_f0_wdata_s(16*4+I) <= sample_f0(6, I); -- B2
418 sample_f0_wdata_s(16*4+I) <= sample_f0(6, I); -- B2
418 sample_f0_wdata_s(16*5+I) <= sample_f0(7, I); -- B3
419 sample_f0_wdata_s(16*5+I) <= sample_f0(7, I); -- B3
419 END GENERATE all_bit_sample_f0;
420 END GENERATE all_bit_sample_f0;
420
421
421 -----------------------------------------------------------------------------
422 -----------------------------------------------------------------------------
422 -- F1 -- @4096 Hz
423 -- F1 -- @4096 Hz
423 -----------------------------------------------------------------------------
424 -----------------------------------------------------------------------------
424
425
425 all_bit_sample_f0_f1 : FOR I IN 15 DOWNTO 0 GENERATE
426 all_bit_sample_f0_f1 : FOR I IN 15 DOWNTO 0 GENERATE
426 sample_f0_f1_s(0,I) <= sample_f0(0,I); --V
427 sample_f0_f1_s(0,I) <= sample_f0(0,I); --V
427 sample_f0_f1_s(1,I) <= sample_f0(1,I) WHEN data_shaping_R1 = '1' ELSE sample_f0(3,I); --E1
428 sample_f0_f1_s(1,I) <= sample_f0(1,I) WHEN data_shaping_R1 = '1' ELSE sample_f0(3,I); --E1
428 sample_f0_f1_s(2,I) <= sample_f0(2,I) WHEN data_shaping_R1 = '1' ELSE sample_f0(4,I); --E2
429 sample_f0_f1_s(2,I) <= sample_f0(2,I) WHEN data_shaping_R1 = '1' ELSE sample_f0(4,I); --E2
429 sample_f0_f1_s(3,I) <= sample_f0(5,I); --B1
430 sample_f0_f1_s(3,I) <= sample_f0(5,I); --B1
430 sample_f0_f1_s(4,I) <= sample_f0(6,I); --B2
431 sample_f0_f1_s(4,I) <= sample_f0(6,I); --B2
431 sample_f0_f1_s(5,I) <= sample_f0(7,I); --B3
432 sample_f0_f1_s(5,I) <= sample_f0(7,I); --B3
432 END GENERATE all_bit_sample_f0_f1;
433 END GENERATE all_bit_sample_f0_f1;
433 all_bit_sample_f0_f1_extended : FOR I IN 17 DOWNTO 16 GENERATE
434 all_bit_sample_f0_f1_extended : FOR I IN 17 DOWNTO 16 GENERATE
434 sample_f0_f1_s(0,I) <= sample_f0(0,15);
435 sample_f0_f1_s(0,I) <= sample_f0(0,15);
435 sample_f0_f1_s(1,I) <= sample_f0(1,15) WHEN data_shaping_R1 = '1' ELSE sample_f0(3,15); --E1
436 sample_f0_f1_s(1,I) <= sample_f0(1,15) WHEN data_shaping_R1 = '1' ELSE sample_f0(3,15); --E1
436 sample_f0_f1_s(2,I) <= sample_f0(2,15) WHEN data_shaping_R1 = '1' ELSE sample_f0(4,15); --E2
437 sample_f0_f1_s(2,I) <= sample_f0(2,15) WHEN data_shaping_R1 = '1' ELSE sample_f0(4,15); --E2
437 sample_f0_f1_s(3,I) <= sample_f0(5,15); --B1
438 sample_f0_f1_s(3,I) <= sample_f0(5,15); --B1
438 sample_f0_f1_s(4,I) <= sample_f0(6,15); --B2
439 sample_f0_f1_s(4,I) <= sample_f0(6,15); --B2
439 sample_f0_f1_s(5,I) <= sample_f0(7,15); --B3
440 sample_f0_f1_s(5,I) <= sample_f0(7,15); --B3
440 END GENERATE all_bit_sample_f0_f1_extended;
441 END GENERATE all_bit_sample_f0_f1_extended;
441
442
442
443
443 IIR_CEL_f0_to_f1 : IIR_CEL_CTRLR_v2
444 IIR_CEL_f0_to_f1 : IIR_CEL_CTRLR_v2
444 GENERIC MAP (
445 GENERIC MAP (
445 tech => 0,
446 tech => 0,
446 Mem_use => Mem_use, -- use_RAM
447 Mem_use => Mem_use, -- use_RAM
447 Sample_SZ => 18,
448 Sample_SZ => 18,
448 Coef_SZ => f0_to_f1_COEFFICIENT_SIZE,
449 Coef_SZ => f0_to_f1_COEFFICIENT_SIZE,
449 Coef_Nb => f0_to_f1_CEL_NUMBER*5,
450 Coef_Nb => f0_to_f1_CEL_NUMBER*5,
450 Coef_sel_SZ => 5,
451 Coef_sel_SZ => 5,
451 Cels_count => f0_to_f1_CEL_NUMBER,
452 Cels_count => f0_to_f1_CEL_NUMBER,
452 ChanelsCount => 6)
453 ChanelsCount => 6)
453 PORT MAP (
454 PORT MAP (
454 rstn => rstn,
455 rstn => rstn,
455 clk => clk,
456 clk => clk,
456 virg_pos => f0_to_f1_POINT_POSITION,
457 virg_pos => f0_to_f1_POINT_POSITION,
457 coefs => coefs_iir_cel_f0_to_f1,
458 coefs => coefs_iir_cel_f0_to_f1,
458
459
459 sample_in_val => sample_f0_val_s,
460 sample_in_val => sample_f0_val_s,
460 sample_in => sample_f0_f1_s,
461 sample_in => sample_f0_f1_s,
461
462
462 sample_out_val => sample_f1_val_s,
463 sample_out_val => sample_f1_val_s,
463 sample_out => sample_f1_s);
464 sample_out => sample_f1_s);
464
465
465 Downsampling_f1 : Downsampling
466 Downsampling_f1 : Downsampling
466 GENERIC MAP (
467 GENERIC MAP (
467 ChanelCount => 6,
468 ChanelCount => 6,
468 SampleSize => 18,
469 SampleSize => 18,
469 DivideParam => 6)
470 DivideParam => 6)
470 PORT MAP (
471 PORT MAP (
471 clk => clk,
472 clk => clk,
472 rstn => rstn,
473 rstn => rstn,
473 sample_in_val => sample_f1_val_s,
474 sample_in_val => sample_f1_val_s,
474 sample_in => sample_f1_s,
475 sample_in => sample_f1_s,
475 sample_out_val => sample_f1_val_ss,
476 sample_out_val => sample_f1_val_ss,
476 sample_out => sample_f1);
477 sample_out => sample_f1);
477
478
478 sample_f1_val <= sample_f1_val_ss;
479 sample_f1_val <= sample_f1_val_ss;
479
480
480 -- TIME --
481 -- TIME --
481 PROCESS (clk, rstn)
482 PROCESS (clk, rstn)
482 BEGIN
483 BEGIN
483 IF rstn = '0' THEN
484 IF rstn = '0' THEN
484 sample_f1_time_reg <= (OTHERS => '0');
485 sample_f1_time_reg <= (OTHERS => '0');
485 ELSIF clk'event AND clk = '1' THEN
486 ELSIF clk'event AND clk = '1' THEN
486 IF sample_f1_val_ss = '1' THEN
487 IF sample_f1_val_ss = '1' THEN
487 sample_f1_time_reg <= sample_f0_time_s;
488 sample_f1_time_reg <= sample_f0_time_s;
488 END IF;
489 END IF;
489 END IF;
490 END IF;
490 END PROCESS;
491 END PROCESS;
491 sample_f1_time_s <= sample_f0_time_s WHEN sample_f1_val_ss = '1' ELSE sample_f1_time_reg;
492 sample_f1_time_s <= sample_f0_time_s WHEN sample_f1_val_ss = '1' ELSE sample_f1_time_reg;
492 sample_f1_time <= sample_f1_time_s;
493 sample_f1_time <= sample_f1_time_s;
493 ----------
494 ----------
494
495
495
496
496 all_bit_sample_f1 : FOR I IN 15 DOWNTO 0 GENERATE
497 all_bit_sample_f1 : FOR I IN 15 DOWNTO 0 GENERATE
497 all_channel_sample_f1: FOR J IN 5 DOWNTO 0 GENERATE
498 all_channel_sample_f1: FOR J IN 5 DOWNTO 0 GENERATE
498 sample_f1_wdata_s(16*J+I) <= sample_f1(J, I);
499 sample_f1_wdata_s(16*J+I) <= sample_f1(J, I);
499 END GENERATE all_channel_sample_f1;
500 END GENERATE all_channel_sample_f1;
500 END GENERATE all_bit_sample_f1;
501 END GENERATE all_bit_sample_f1;
501
502
502 -----------------------------------------------------------------------------
503 -----------------------------------------------------------------------------
503 -- F2 -- @256 Hz
504 -- F2 -- @256 Hz
504 -- F3 -- @16 Hz
505 -- F3 -- @16 Hz
505 -----------------------------------------------------------------------------
506 -----------------------------------------------------------------------------
506 all_bit_sample_f0_s : FOR I IN 15 DOWNTO 0 GENERATE
507 all_bit_sample_f0_s : FOR I IN 15 DOWNTO 0 GENERATE
507 sample_f0_s(0, I) <= sample_f0(0, I); -- V
508 sample_f0_s(0, I) <= sample_f0(0, I); -- V
508 sample_f0_s(1, I) <= sample_f0(1, I); -- E1
509 sample_f0_s(1, I) <= sample_f0(1, I); -- E1
509 sample_f0_s(2, I) <= sample_f0(2, I); -- E2
510 sample_f0_s(2, I) <= sample_f0(2, I); -- E2
510 sample_f0_s(3, I) <= sample_f0(5, I); -- B1
511 sample_f0_s(3, I) <= sample_f0(5, I); -- B1
511 sample_f0_s(4, I) <= sample_f0(6, I); -- B2
512 sample_f0_s(4, I) <= sample_f0(6, I); -- B2
512 sample_f0_s(5, I) <= sample_f0(7, I); -- B3
513 sample_f0_s(5, I) <= sample_f0(7, I); -- B3
513 sample_f0_s(6, I) <= sample_f0(3, I); --
514 sample_f0_s(6, I) <= sample_f0(3, I); --
514 sample_f0_s(7, I) <= sample_f0(4, I); --
515 sample_f0_s(7, I) <= sample_f0(4, I); --
515 END GENERATE all_bit_sample_f0_s;
516 END GENERATE all_bit_sample_f0_s;
516
517
517
518
518 cic_lfr_1: cic_lfr_r2
519 cic_lfr_1: cic_lfr_r2
519 GENERIC MAP (
520 GENERIC MAP (
520 tech => 0,
521 tech => 0,
521 use_RAM_nCEL => Mem_use)
522 use_RAM_nCEL => Mem_use)
522 PORT MAP (
523 PORT MAP (
523 clk => clk,
524 clk => clk,
524 rstn => rstn,
525 rstn => rstn,
525 run => '1',
526 run => '1',
526
527
527 param_r2 => data_shaping_R2,
528 param_r2 => data_shaping_R2,
528
529
529 data_in => sample_f0_s,
530 data_in => sample_f0_s,
530 data_in_valid => sample_f0_val_s,
531 data_in_valid => sample_f0_val_s,
531
532
532 data_out_16 => sample_f2_cic,
533 data_out_16 => sample_f2_cic,
533 data_out_16_valid => sample_f2_cic_val,
534 data_out_16_valid => sample_f2_cic_val,
534
535
535 data_out_256 => sample_f3_cic,
536 data_out_256 => sample_f3_cic,
536 data_out_256_valid => sample_f3_cic_val);
537 data_out_256_valid => sample_f3_cic_val);
537
538
538
539
539
540
540 all_channel_sample_f_cic : FOR J IN 5 DOWNTO 0 GENERATE
541 all_channel_sample_f_cic : FOR J IN 5 DOWNTO 0 GENERATE
541 all_bit_sample_f_cic : FOR I IN 15 DOWNTO 0 GENERATE
542 all_bit_sample_f_cic : FOR I IN 15 DOWNTO 0 GENERATE
542 sample_f2_cic_filter(J,I) <= sample_f2_cic(J,I);
543 sample_f2_cic_filter(J,I) <= sample_f2_cic(J,I);
543 sample_f3_cic_filter(J,I) <= sample_f3_cic(J,I);
544 sample_f3_cic_filter(J,I) <= sample_f3_cic(J,I);
544 END GENERATE all_bit_sample_f_cic;
545 END GENERATE all_bit_sample_f_cic;
545 sample_f2_cic_filter(J,16) <= sample_f2_cic(J,15);
546 sample_f2_cic_filter(J,16) <= sample_f2_cic(J,15);
546 sample_f2_cic_filter(J,17) <= sample_f2_cic(J,15);
547 sample_f2_cic_filter(J,17) <= sample_f2_cic(J,15);
547
548
548 sample_f3_cic_filter(J,16) <= sample_f3_cic(J,15);
549 sample_f3_cic_filter(J,16) <= sample_f3_cic(J,15);
549 sample_f3_cic_filter(J,17) <= sample_f3_cic(J,15);
550 sample_f3_cic_filter(J,17) <= sample_f3_cic(J,15);
550 END GENERATE all_channel_sample_f_cic;
551 END GENERATE all_channel_sample_f_cic;
551
552
552
553 NO_IIR_FILTER_f2_f3: IF RTL_DESIGN_LIGHT = 1 GENERATE
553 IIR_CEL_CTRLR_v3_1:IIR_CEL_CTRLR_v3
554 sample_f2_filter_val <= sample_f2_cic_val;
554 GENERIC MAP (
555 sample_f2_filter <= sample_f2_cic_filter;
555 tech => 0,
556 sample_f3_filter_val <= sample_f3_cic_val;
556 Mem_use => Mem_use,
557 sample_f3_filter <= sample_f3_cic_filter;
557 Sample_SZ => 18,
558 END GENERATE NO_IIR_FILTER_f2_f3;
558 Coef_SZ => f2_f3_COEFFICIENT_SIZE,
559 Coef_Nb => f2_f3_CEL_NUMBER*5,
560 Coef_sel_SZ => 5,
561 Cels_count => f2_f3_CEL_NUMBER,
562 ChanelsCount => 6)
563 PORT MAP (
564 rstn => rstn,
565 clk => clk,
566 virg_pos => f2_f3_POINT_POSITION,
567 coefs => coefs_iir_cel_f2_f3,
568
559
569 sample_in1_val => sample_f2_cic_val,
560 YES_IIR_FILTER_f2_f3: IF RTL_DESIGN_LIGHT = 0 GENERATE
570 sample_in1 => sample_f2_cic_filter,
561 IIR_CEL_CTRLR_v3_1:IIR_CEL_CTRLR_v3
571
562 GENERIC MAP (
572 sample_in2_val => sample_f3_cic_val,
563 tech => 0,
573 sample_in2 => sample_f3_cic_filter,
564 Mem_use => Mem_use,
574
565 Sample_SZ => 18,
575 sample_out1_val => sample_f2_filter_val,
566 Coef_SZ => f2_f3_COEFFICIENT_SIZE,
576 sample_out1 => sample_f2_filter,
567 Coef_Nb => f2_f3_CEL_NUMBER*5,
577 sample_out2_val => sample_f3_filter_val,
568 Coef_sel_SZ => 5,
578 sample_out2 => sample_f3_filter);
569 Cels_count => f2_f3_CEL_NUMBER,
579
570 ChanelsCount => 6)
571 PORT MAP (
572 rstn => rstn,
573 clk => clk,
574 virg_pos => f2_f3_POINT_POSITION,
575 coefs => coefs_iir_cel_f2_f3,
576
577 sample_in1_val => sample_f2_cic_val,
578 sample_in1 => sample_f2_cic_filter,
579
580 sample_in2_val => sample_f3_cic_val,
581 sample_in2 => sample_f3_cic_filter,
582
583 sample_out1_val => sample_f2_filter_val,
584 sample_out1 => sample_f2_filter,
585 sample_out2_val => sample_f3_filter_val,
586 sample_out2 => sample_f3_filter);
587 END GENERATE YES_IIR_FILTER_f2_f3;
580
588
581 all_channel_sample_f_filter : FOR J IN 5 DOWNTO 0 GENERATE
589 all_channel_sample_f_filter : FOR J IN 5 DOWNTO 0 GENERATE
582 all_bit_sample_f_filter : FOR I IN 15 DOWNTO 0 GENERATE
590 all_bit_sample_f_filter : FOR I IN 15 DOWNTO 0 GENERATE
583 sample_f2_cic_s(J,I) <= sample_f2_filter(J,I);
591 sample_f2_cic_s(J,I) <= sample_f2_filter(J,I);
584 sample_f3_cic_s(J,I) <= sample_f3_filter(J,I);
592 sample_f3_cic_s(J,I) <= sample_f3_filter(J,I);
585 END GENERATE all_bit_sample_f_filter;
593 END GENERATE all_bit_sample_f_filter;
586 END GENERATE all_channel_sample_f_filter;
594 END GENERATE all_channel_sample_f_filter;
587
588
595
589 -----------------------------------------------------------------------------
596 -----------------------------------------------------------------------------
590
597
591 Downsampling_f2 : Downsampling
598 Downsampling_f2 : Downsampling
592 GENERIC MAP (
599 GENERIC MAP (
593 ChanelCount => 6,
600 ChanelCount => 6,
594 SampleSize => 16,
601 SampleSize => 16,
595 DivideParam => 6)
602 DivideParam => 6)
596 PORT MAP (
603 PORT MAP (
597 clk => clk,
604 clk => clk,
598 rstn => rstn,
605 rstn => rstn,
599 sample_in_val => sample_f2_filter_val ,
606 sample_in_val => sample_f2_filter_val ,
600 sample_in => sample_f2_cic_s,
607 sample_in => sample_f2_cic_s,
601 sample_out_val => sample_f2_val_s,
608 sample_out_val => sample_f2_val_s,
602 sample_out => sample_f2);
609 sample_out => sample_f2);
603
610
604 sample_f2_val <= sample_f2_val_s;
611 sample_f2_val <= sample_f2_val_s;
605
612
606 all_bit_sample_f2 : FOR I IN 15 DOWNTO 0 GENERATE
613 all_bit_sample_f2 : FOR I IN 15 DOWNTO 0 GENERATE
607 all_channel_sample_f2 : FOR J IN 5 DOWNTO 0 GENERATE
614 all_channel_sample_f2 : FOR J IN 5 DOWNTO 0 GENERATE
608 sample_f2_wdata_s(16*J+I) <= sample_f2(J,I);
615 sample_f2_wdata_s(16*J+I) <= sample_f2(J,I);
609 END GENERATE all_channel_sample_f2;
616 END GENERATE all_channel_sample_f2;
610 END GENERATE all_bit_sample_f2;
617 END GENERATE all_bit_sample_f2;
611
618
612 -----------------------------------------------------------------------------
619 -----------------------------------------------------------------------------
613
620
614 Downsampling_f3 : Downsampling
621 Downsampling_f3 : Downsampling
615 GENERIC MAP (
622 GENERIC MAP (
616 ChanelCount => 6,
623 ChanelCount => 6,
617 SampleSize => 16,
624 SampleSize => 16,
618 DivideParam => 6)
625 DivideParam => 6)
619 PORT MAP (
626 PORT MAP (
620 clk => clk,
627 clk => clk,
621 rstn => rstn,
628 rstn => rstn,
622 sample_in_val => sample_f3_filter_val ,
629 sample_in_val => sample_f3_filter_val ,
623 sample_in => sample_f3_cic_s,
630 sample_in => sample_f3_cic_s,
624 sample_out_val => sample_f3_val_s,
631 sample_out_val => sample_f3_val_s,
625 sample_out => sample_f3);
632 sample_out => sample_f3);
626 sample_f3_val <= sample_f3_val_s;
633 sample_f3_val <= sample_f3_val_s;
627
634
628 all_bit_sample_f3 : FOR I IN 15 DOWNTO 0 GENERATE
635 all_bit_sample_f3 : FOR I IN 15 DOWNTO 0 GENERATE
629 all_channel_sample_f3 : FOR J IN 5 DOWNTO 0 GENERATE
636 all_channel_sample_f3 : FOR J IN 5 DOWNTO 0 GENERATE
630 sample_f3_wdata_s(16*J+I) <= sample_f3(J,I);
637 sample_f3_wdata_s(16*J+I) <= sample_f3(J,I);
631 END GENERATE all_channel_sample_f3;
638 END GENERATE all_channel_sample_f3;
632 END GENERATE all_bit_sample_f3;
639 END GENERATE all_bit_sample_f3;
633
640
634 -----------------------------------------------------------------------------
641 -----------------------------------------------------------------------------
635
642
636 -- TIME --
643 -- TIME --
637 PROCESS (clk, rstn)
644 PROCESS (clk, rstn)
638 BEGIN
645 BEGIN
639 IF rstn = '0' THEN
646 IF rstn = '0' THEN
640 sample_f2_time_reg <= (OTHERS => '0');
647 sample_f2_time_reg <= (OTHERS => '0');
641 sample_f3_time_reg <= (OTHERS => '0');
648 sample_f3_time_reg <= (OTHERS => '0');
642 ELSIF clk'event AND clk = '1' THEN
649 ELSIF clk'event AND clk = '1' THEN
643 IF sample_f2_val_s = '1' THEN sample_f2_time_reg <= sample_f0_time_s; END IF;
650 IF sample_f2_val_s = '1' THEN sample_f2_time_reg <= sample_f0_time_s; END IF;
644 IF sample_f3_val_s = '1' THEN sample_f3_time_reg <= sample_f0_time_s; END IF;
651 IF sample_f3_val_s = '1' THEN sample_f3_time_reg <= sample_f0_time_s; END IF;
645 END IF;
652 END IF;
646 END PROCESS;
653 END PROCESS;
647 sample_f2_time <= sample_f0_time_s WHEN sample_f2_val_s = '1' ELSE sample_f2_time_reg;
654 sample_f2_time <= sample_f0_time_s WHEN sample_f2_val_s = '1' ELSE sample_f2_time_reg;
648 sample_f3_time <= sample_f0_time_s WHEN sample_f3_val_s = '1' ELSE sample_f3_time_reg;
655 sample_f3_time <= sample_f0_time_s WHEN sample_f3_val_s = '1' ELSE sample_f3_time_reg;
649 ----------
656 ----------
650
657
651 -----------------------------------------------------------------------------
658 -----------------------------------------------------------------------------
652 --
659 --
653 -----------------------------------------------------------------------------
660 -----------------------------------------------------------------------------
654 sample_f0_wdata <= sample_f0_wdata_s;
661 sample_f0_wdata <= sample_f0_wdata_s;
655 sample_f1_wdata <= sample_f1_wdata_s;
662 sample_f1_wdata <= sample_f1_wdata_s;
656 sample_f2_wdata <= sample_f2_wdata_s;
663 sample_f2_wdata <= sample_f2_wdata_s;
657 sample_f3_wdata <= sample_f3_wdata_s;
664 sample_f3_wdata <= sample_f3_wdata_s;
658
665
659 END tb;
666 END tb;
@@ -1,1250 +1,1253
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 WINDOWS_HAANNING_PARAM_SIZE : INTEGER := 15
21 );
22 );
22 PORT (
23 PORT (
23 clk : IN STD_LOGIC;
24 clk : IN STD_LOGIC;
24 rstn : IN STD_LOGIC;
25 rstn : IN STD_LOGIC;
25 run : IN STD_LOGIC;
26 run : IN STD_LOGIC;
26
27
27 ---------------------------------------------------------------------------
28 ---------------------------------------------------------------------------
28 -- DATA INPUT
29 -- DATA INPUT
29 ---------------------------------------------------------------------------
30 ---------------------------------------------------------------------------
30 start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
31 start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
31 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
32 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
32 --fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
33 --fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); -- todo
33 --
34 --
34 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
35 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
35 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);
36 sample_f0_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
37 sample_f0_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
37 --
38 --
38 sample_f1_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
39 sample_f1_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
39 sample_f1_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
40 sample_f1_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
40 sample_f1_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
41 sample_f1_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
41 --
42 --
42 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
43 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
43 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
44 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
44 sample_f2_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
45 sample_f2_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
45
46
46 ---------------------------------------------------------------------------
47 ---------------------------------------------------------------------------
47 -- DMA
48 -- DMA
48 ---------------------------------------------------------------------------
49 ---------------------------------------------------------------------------
49 dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
50 dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
50 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
51 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
51 dma_fifo_ren : IN STD_LOGIC; --TODO
52 dma_fifo_ren : IN STD_LOGIC; --TODO
52 dma_buffer_new : OUT STD_LOGIC; --TODOx
53 dma_buffer_new : OUT STD_LOGIC; --TODOx
53 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
54 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
54 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
55 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
55 dma_buffer_full : IN STD_LOGIC; --TODO
56 dma_buffer_full : IN STD_LOGIC; --TODO
56 dma_buffer_full_err : IN STD_LOGIC; --TODO
57 dma_buffer_full_err : IN STD_LOGIC; --TODO
57
58
58 -- Reg out
59 -- Reg out
59 ready_matrix_f0 : OUT STD_LOGIC; -- TODO
60 ready_matrix_f0 : OUT STD_LOGIC; -- TODO
60 ready_matrix_f1 : OUT STD_LOGIC; -- TODO
61 ready_matrix_f1 : OUT STD_LOGIC; -- TODO
61 ready_matrix_f2 : OUT STD_LOGIC; -- TODO
62 ready_matrix_f2 : OUT STD_LOGIC; -- TODO
62 -- error_bad_component_error : OUT STD_LOGIC; -- TODO
63 -- error_bad_component_error : OUT STD_LOGIC; -- TODO
63 error_buffer_full : OUT STD_LOGIC; -- TODO
64 error_buffer_full : OUT STD_LOGIC; -- TODO
64 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
65 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
65
66
66 -- Reg In
67 -- Reg In
67 status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
68 status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
68 status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
69 status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
69 status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
70 status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
70
71
71 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
72 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
72 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
73 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
73 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
74 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
74
75
75 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
76 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
76 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
77 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
77 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
78 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0); -- TODO
78
79
79 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
80 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
80 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
81 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
81 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
82 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
82 ---------------------------------------------------------------------------
83 ---------------------------------------------------------------------------
83 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
84 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
84 );
85 );
85 END;
86 END;
86
87
87 ARCHITECTURE Behavioral OF lpp_lfr_ms IS
88 ARCHITECTURE Behavioral OF lpp_lfr_ms IS
88
89
89 SIGNAL sample_f0_A_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
90 SIGNAL sample_f0_A_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
90 SIGNAL sample_f0_A_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
91 SIGNAL sample_f0_A_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
91 SIGNAL sample_f0_A_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
92 SIGNAL sample_f0_A_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
92 SIGNAL sample_f0_A_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
93 SIGNAL sample_f0_A_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
93 SIGNAL sample_f0_A_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
94 SIGNAL sample_f0_A_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
94
95
95 SIGNAL sample_f0_B_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
96 SIGNAL sample_f0_B_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
96 SIGNAL sample_f0_B_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
97 SIGNAL sample_f0_B_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
97 SIGNAL sample_f0_B_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
98 SIGNAL sample_f0_B_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
98 SIGNAL sample_f0_B_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
99 SIGNAL sample_f0_B_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
99 SIGNAL sample_f0_B_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
100 SIGNAL sample_f0_B_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
100
101
101 SIGNAL sample_f1_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
102 SIGNAL sample_f1_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
102 SIGNAL sample_f1_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
103 SIGNAL sample_f1_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
103 SIGNAL sample_f1_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
104 SIGNAL sample_f1_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
104 SIGNAL sample_f1_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
105 SIGNAL sample_f1_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
105
106
106 SIGNAL sample_f1_almost_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
107 SIGNAL sample_f1_almost_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
107
108
108 SIGNAL sample_f2_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
109 SIGNAL sample_f2_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
109 SIGNAL sample_f2_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
110 SIGNAL sample_f2_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
110 SIGNAL sample_f2_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
111 SIGNAL sample_f2_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
111 SIGNAL sample_f2_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
112 SIGNAL sample_f2_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
112
113
113 SIGNAL error_wen_f0 : STD_LOGIC;
114 SIGNAL error_wen_f0 : STD_LOGIC;
114 SIGNAL error_wen_f1 : STD_LOGIC;
115 SIGNAL error_wen_f1 : STD_LOGIC;
115 SIGNAL error_wen_f2 : STD_LOGIC;
116 SIGNAL error_wen_f2 : STD_LOGIC;
116
117
117 SIGNAL one_sample_f1_full : STD_LOGIC;
118 SIGNAL one_sample_f1_full : STD_LOGIC;
118 SIGNAL one_sample_f1_wen : STD_LOGIC;
119 SIGNAL one_sample_f1_wen : STD_LOGIC;
119 SIGNAL one_sample_f2_full : STD_LOGIC;
120 SIGNAL one_sample_f2_full : STD_LOGIC;
120 SIGNAL one_sample_f2_wen : STD_LOGIC;
121 SIGNAL one_sample_f2_wen : STD_LOGIC;
121
122
122 -----------------------------------------------------------------------------
123 -----------------------------------------------------------------------------
123 -- FSM / SWITCH SELECT CHANNEL
124 -- FSM / SWITCH SELECT CHANNEL
124 -----------------------------------------------------------------------------
125 -----------------------------------------------------------------------------
125 TYPE fsm_select_channel IS (IDLE, SWITCH_F0_A, SWITCH_F0_B, SWITCH_F1, SWITCH_F2);
126 TYPE fsm_select_channel IS (IDLE, SWITCH_F0_A, SWITCH_F0_B, SWITCH_F1, SWITCH_F2);
126 SIGNAL state_fsm_select_channel : fsm_select_channel;
127 SIGNAL state_fsm_select_channel : fsm_select_channel;
127 -- SIGNAL pre_state_fsm_select_channel : fsm_select_channel;
128 -- SIGNAL pre_state_fsm_select_channel : fsm_select_channel;
128 SIGNAL select_channel : STD_LOGIC_VECTOR(1 DOWNTO 0);
129 SIGNAL select_channel : STD_LOGIC_VECTOR(1 DOWNTO 0);
129 SIGNAL select_channel_reg : STD_LOGIC_VECTOR(1 DOWNTO 0);
130 SIGNAL select_channel_reg : STD_LOGIC_VECTOR(1 DOWNTO 0);
130
131
131 SIGNAL sample_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
132 SIGNAL sample_rdata : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
132 SIGNAL sample_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
133 SIGNAL sample_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
133 SIGNAL sample_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
134 SIGNAL sample_full : STD_LOGIC_VECTOR(4 DOWNTO 0);
134 SIGNAL sample_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
135 SIGNAL sample_empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
135
136
136 -----------------------------------------------------------------------------
137 -----------------------------------------------------------------------------
137 -- FSM LOAD FFT
138 -- FSM LOAD FFT
138 -----------------------------------------------------------------------------
139 -----------------------------------------------------------------------------
139 TYPE fsm_load_FFT IS (IDLE, FIFO_1, FIFO_2, FIFO_3, FIFO_4, FIFO_5, WAIT_STATE, WAIT_STATE_2);
140 TYPE fsm_load_FFT IS (IDLE, FIFO_1, FIFO_2, FIFO_3, FIFO_4, FIFO_5, WAIT_STATE, WAIT_STATE_2);
140 SIGNAL state_fsm_load_FFT : fsm_load_FFT;
141 SIGNAL state_fsm_load_FFT : fsm_load_FFT;
141 SIGNAL next_state_fsm_load_FFT : fsm_load_FFT;
142 SIGNAL next_state_fsm_load_FFT : fsm_load_FFT;
142 SIGNAL select_fifo : STD_LOGIC_VECTOR(2 DOWNTO 0);
143 SIGNAL select_fifo : STD_LOGIC_VECTOR(2 DOWNTO 0);
143 SIGNAL select_fifo_reg : STD_LOGIC_VECTOR(2 DOWNTO 0);
144 SIGNAL select_fifo_reg : STD_LOGIC_VECTOR(2 DOWNTO 0);
144
145
145 SIGNAL sample_ren_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
146 SIGNAL sample_ren_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
146 SIGNAL sample_load : STD_LOGIC;
147 SIGNAL sample_load : STD_LOGIC;
147 SIGNAL sample_valid : STD_LOGIC;
148 SIGNAL sample_valid : STD_LOGIC;
148 SIGNAL sample_valid_r : STD_LOGIC;
149 SIGNAL sample_valid_r : STD_LOGIC;
149 SIGNAL sample_data : STD_LOGIC_VECTOR(15 DOWNTO 0);
150 SIGNAL sample_data : STD_LOGIC_VECTOR(15 DOWNTO 0);
150
151
151
152
152 -----------------------------------------------------------------------------
153 -----------------------------------------------------------------------------
153 -- FFT
154 -- FFT
154 -----------------------------------------------------------------------------
155 -----------------------------------------------------------------------------
155 SIGNAL fft_read : STD_LOGIC;
156 SIGNAL fft_read : STD_LOGIC;
156 SIGNAL fft_pong : STD_LOGIC;
157 SIGNAL fft_pong : STD_LOGIC;
157 SIGNAL fft_data_im : STD_LOGIC_VECTOR(15 DOWNTO 0);
158 SIGNAL fft_data_im : STD_LOGIC_VECTOR(15 DOWNTO 0);
158 SIGNAL fft_data_re : STD_LOGIC_VECTOR(15 DOWNTO 0);
159 SIGNAL fft_data_re : STD_LOGIC_VECTOR(15 DOWNTO 0);
159 SIGNAL fft_data_valid : STD_LOGIC;
160 SIGNAL fft_data_valid : STD_LOGIC;
160 SIGNAL fft_data_valid_pre : STD_LOGIC;
161 SIGNAL fft_data_valid_pre : STD_LOGIC;
161 SIGNAL fft_ready : STD_LOGIC;
162 SIGNAL fft_ready : STD_LOGIC;
162 -----------------------------------------------------------------------------
163 -----------------------------------------------------------------------------
163 -- SIGNAL fft_linker_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
164 -- SIGNAL fft_linker_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
164 -----------------------------------------------------------------------------
165 -----------------------------------------------------------------------------
165 TYPE fsm_load_MS_memory IS (IDLE, LOAD_FIFO, TRASH_FFT);
166 TYPE fsm_load_MS_memory IS (IDLE, LOAD_FIFO, TRASH_FFT);
166 SIGNAL state_fsm_load_MS_memory : fsm_load_MS_memory;
167 SIGNAL state_fsm_load_MS_memory : fsm_load_MS_memory;
167 SIGNAL current_fifo_load : STD_LOGIC_VECTOR(4 DOWNTO 0);
168 SIGNAL current_fifo_load : STD_LOGIC_VECTOR(4 DOWNTO 0);
168 SIGNAL current_fifo_empty : STD_LOGIC;
169 SIGNAL current_fifo_empty : STD_LOGIC;
169 SIGNAL current_fifo_locked : STD_LOGIC;
170 SIGNAL current_fifo_locked : STD_LOGIC;
170 SIGNAL current_fifo_full : STD_LOGIC;
171 SIGNAL current_fifo_full : STD_LOGIC;
171 SIGNAL MEM_IN_SM_locked : STD_LOGIC_VECTOR(4 DOWNTO 0);
172 SIGNAL MEM_IN_SM_locked : STD_LOGIC_VECTOR(4 DOWNTO 0);
172
173
173 -----------------------------------------------------------------------------
174 -----------------------------------------------------------------------------
174 SIGNAL MEM_IN_SM_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
175 SIGNAL MEM_IN_SM_ReUse : STD_LOGIC_VECTOR(4 DOWNTO 0);
175 SIGNAL MEM_IN_SM_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
176 SIGNAL MEM_IN_SM_wen : STD_LOGIC_VECTOR(4 DOWNTO 0);
176 SIGNAL MEM_IN_SM_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
177 SIGNAL MEM_IN_SM_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
177 SIGNAL MEM_IN_SM_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
178 SIGNAL MEM_IN_SM_ren : STD_LOGIC_VECTOR(4 DOWNTO 0);
178 SIGNAL MEM_IN_SM_wData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
179 SIGNAL MEM_IN_SM_wData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
179 SIGNAL MEM_IN_SM_rData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
180 SIGNAL MEM_IN_SM_rData : STD_LOGIC_VECTOR(16*2*5-1 DOWNTO 0);
180 SIGNAL MEM_IN_SM_Full : STD_LOGIC_VECTOR(4 DOWNTO 0);
181 SIGNAL MEM_IN_SM_Full : STD_LOGIC_VECTOR(4 DOWNTO 0);
181 SIGNAL MEM_IN_SM_Empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
182 SIGNAL MEM_IN_SM_Empty : STD_LOGIC_VECTOR(4 DOWNTO 0);
182 -----------------------------------------------------------------------------
183 -----------------------------------------------------------------------------
183 SIGNAL SM_in_data : STD_LOGIC_VECTOR(32*2-1 DOWNTO 0);
184 SIGNAL SM_in_data : STD_LOGIC_VECTOR(32*2-1 DOWNTO 0);
184 SIGNAL SM_in_ren : STD_LOGIC_VECTOR(1 DOWNTO 0);
185 SIGNAL SM_in_ren : STD_LOGIC_VECTOR(1 DOWNTO 0);
185 SIGNAL SM_in_empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
186 SIGNAL SM_in_empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
186
187
187 SIGNAL SM_correlation_start : STD_LOGIC;
188 SIGNAL SM_correlation_start : STD_LOGIC;
188 SIGNAL SM_correlation_auto : STD_LOGIC;
189 SIGNAL SM_correlation_auto : STD_LOGIC;
189 SIGNAL SM_correlation_done : STD_LOGIC;
190 SIGNAL SM_correlation_done : STD_LOGIC;
190 SIGNAL SM_correlation_done_reg1 : STD_LOGIC;
191 SIGNAL SM_correlation_done_reg1 : STD_LOGIC;
191 SIGNAL SM_correlation_done_reg2 : STD_LOGIC;
192 SIGNAL SM_correlation_done_reg2 : STD_LOGIC;
192 SIGNAL SM_correlation_done_reg3 : STD_LOGIC;
193 SIGNAL SM_correlation_done_reg3 : STD_LOGIC;
193 SIGNAL SM_correlation_begin : STD_LOGIC;
194 SIGNAL SM_correlation_begin : STD_LOGIC;
194
195
195 SIGNAL MEM_OUT_SM_Full_s : STD_LOGIC;
196 SIGNAL MEM_OUT_SM_Full_s : STD_LOGIC;
196 SIGNAL MEM_OUT_SM_Data_in_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
197 SIGNAL MEM_OUT_SM_Data_in_s : STD_LOGIC_VECTOR(31 DOWNTO 0);
197 SIGNAL MEM_OUT_SM_Write_s : STD_LOGIC;
198 SIGNAL MEM_OUT_SM_Write_s : STD_LOGIC;
198
199
199 SIGNAL current_matrix_write : STD_LOGIC;
200 SIGNAL current_matrix_write : STD_LOGIC;
200 SIGNAL current_matrix_wait_empty : STD_LOGIC;
201 SIGNAL current_matrix_wait_empty : STD_LOGIC;
201 -----------------------------------------------------------------------------
202 -----------------------------------------------------------------------------
202 SIGNAL fifo_0_ready : STD_LOGIC;
203 SIGNAL fifo_0_ready : STD_LOGIC;
203 SIGNAL fifo_1_ready : STD_LOGIC;
204 SIGNAL fifo_1_ready : STD_LOGIC;
204 SIGNAL fifo_ongoing : STD_LOGIC;
205 SIGNAL fifo_ongoing : STD_LOGIC;
205 SIGNAL fifo_ongoing_reg : STD_LOGIC;
206 SIGNAL fifo_ongoing_reg : STD_LOGIC;
206
207
207 SIGNAL FSM_DMA_fifo_ren : STD_LOGIC;
208 SIGNAL FSM_DMA_fifo_ren : STD_LOGIC;
208 SIGNAL FSM_DMA_fifo_empty : STD_LOGIC;
209 SIGNAL FSM_DMA_fifo_empty : STD_LOGIC;
209 SIGNAL FSM_DMA_fifo_empty_threshold : STD_LOGIC;
210 SIGNAL FSM_DMA_fifo_empty_threshold : STD_LOGIC;
210 SIGNAL FSM_DMA_fifo_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
211 SIGNAL FSM_DMA_fifo_data : STD_LOGIC_VECTOR(31 DOWNTO 0);
211 SIGNAL FSM_DMA_fifo_status : STD_LOGIC_VECTOR(53 DOWNTO 4);
212 SIGNAL FSM_DMA_fifo_status : STD_LOGIC_VECTOR(53 DOWNTO 4);
212 -----------------------------------------------------------------------------
213 -----------------------------------------------------------------------------
213 SIGNAL MEM_OUT_SM_Write : STD_LOGIC_VECTOR(1 DOWNTO 0);
214 SIGNAL MEM_OUT_SM_Write : STD_LOGIC_VECTOR(1 DOWNTO 0);
214 SIGNAL MEM_OUT_SM_Read : STD_LOGIC_VECTOR(1 DOWNTO 0);
215 SIGNAL MEM_OUT_SM_Read : STD_LOGIC_VECTOR(1 DOWNTO 0);
215 SIGNAL MEM_OUT_SM_Data_in : STD_LOGIC_VECTOR(63 DOWNTO 0);
216 SIGNAL MEM_OUT_SM_Data_in : STD_LOGIC_VECTOR(63 DOWNTO 0);
216 SIGNAL MEM_OUT_SM_Data_out : STD_LOGIC_VECTOR(63 DOWNTO 0);
217 SIGNAL MEM_OUT_SM_Data_out : STD_LOGIC_VECTOR(63 DOWNTO 0);
217 SIGNAL MEM_OUT_SM_Full : STD_LOGIC_VECTOR(1 DOWNTO 0);
218 SIGNAL MEM_OUT_SM_Full : STD_LOGIC_VECTOR(1 DOWNTO 0);
218 SIGNAL MEM_OUT_SM_Empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
219 SIGNAL MEM_OUT_SM_Empty : STD_LOGIC_VECTOR(1 DOWNTO 0);
219 SIGNAL MEM_OUT_SM_Empty_Threshold : STD_LOGIC_VECTOR(1 DOWNTO 0);
220 SIGNAL MEM_OUT_SM_Empty_Threshold : STD_LOGIC_VECTOR(1 DOWNTO 0);
220
221
221 -----------------------------------------------------------------------------
222 -----------------------------------------------------------------------------
222 -- TIME REG & INFOs
223 -- TIME REG & INFOs
223 -----------------------------------------------------------------------------
224 -----------------------------------------------------------------------------
224 SIGNAL all_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
225 SIGNAL all_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
225
226
226 SIGNAL f_empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
227 SIGNAL f_empty : STD_LOGIC_VECTOR(3 DOWNTO 0);
227 SIGNAL f_empty_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
228 SIGNAL f_empty_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
228 SIGNAL time_update_f : STD_LOGIC_VECTOR(3 DOWNTO 0);
229 SIGNAL time_update_f : STD_LOGIC_VECTOR(3 DOWNTO 0);
229 SIGNAL time_reg_f : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
230 SIGNAL time_reg_f : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
230
231
231 SIGNAL time_reg_f0_A : STD_LOGIC_VECTOR(47 DOWNTO 0);
232 SIGNAL time_reg_f0_A : STD_LOGIC_VECTOR(47 DOWNTO 0);
232 SIGNAL time_reg_f0_B : STD_LOGIC_VECTOR(47 DOWNTO 0);
233 SIGNAL time_reg_f0_B : STD_LOGIC_VECTOR(47 DOWNTO 0);
233 SIGNAL time_reg_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
234 SIGNAL time_reg_f1 : STD_LOGIC_VECTOR(47 DOWNTO 0);
234 SIGNAL time_reg_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
235 SIGNAL time_reg_f2 : STD_LOGIC_VECTOR(47 DOWNTO 0);
235
236
236 --SIGNAL time_update_f0_A : STD_LOGIC;
237 --SIGNAL time_update_f0_A : STD_LOGIC;
237 --SIGNAL time_update_f0_B : STD_LOGIC;
238 --SIGNAL time_update_f0_B : STD_LOGIC;
238 --SIGNAL time_update_f1 : STD_LOGIC;
239 --SIGNAL time_update_f1 : STD_LOGIC;
239 --SIGNAL time_update_f2 : STD_LOGIC;
240 --SIGNAL time_update_f2 : STD_LOGIC;
240 --
241 --
241 SIGNAL status_channel : STD_LOGIC_VECTOR(49 DOWNTO 0);
242 SIGNAL status_channel : STD_LOGIC_VECTOR(49 DOWNTO 0);
242 SIGNAL status_MS_input : STD_LOGIC_VECTOR(49 DOWNTO 0);
243 SIGNAL status_MS_input : STD_LOGIC_VECTOR(49 DOWNTO 0);
243 SIGNAL status_component : STD_LOGIC_VECTOR(53 DOWNTO 0);
244 SIGNAL status_component : STD_LOGIC_VECTOR(53 DOWNTO 0);
244
245
245 SIGNAL status_component_fifo_0 : STD_LOGIC_VECTOR(53 DOWNTO 4);
246 SIGNAL status_component_fifo_0 : STD_LOGIC_VECTOR(53 DOWNTO 4);
246 SIGNAL status_component_fifo_1 : STD_LOGIC_VECTOR(53 DOWNTO 4);
247 SIGNAL status_component_fifo_1 : STD_LOGIC_VECTOR(53 DOWNTO 4);
247 SIGNAL status_component_fifo_0_end : STD_LOGIC;
248 SIGNAL status_component_fifo_0_end : STD_LOGIC;
248 SIGNAL status_component_fifo_1_end : STD_LOGIC;
249 SIGNAL status_component_fifo_1_end : STD_LOGIC;
249 -----------------------------------------------------------------------------
250 -----------------------------------------------------------------------------
250 SIGNAL fft_ongoing_counter : STD_LOGIC;--_VECTOR(1 DOWNTO 0);
251 SIGNAL fft_ongoing_counter : STD_LOGIC;--_VECTOR(1 DOWNTO 0);
251
252
252 SIGNAL fft_ready_reg : STD_LOGIC;
253 SIGNAL fft_ready_reg : STD_LOGIC;
253 SIGNAL fft_ready_rising_down : STD_LOGIC;
254 SIGNAL fft_ready_rising_down : STD_LOGIC;
254
255
255 SIGNAL sample_load_reg : STD_LOGIC;
256 SIGNAL sample_load_reg : STD_LOGIC;
256 SIGNAL sample_load_rising_down : STD_LOGIC;
257 SIGNAL sample_load_rising_down : STD_LOGIC;
257
258
258 -----------------------------------------------------------------------------
259 -----------------------------------------------------------------------------
259 SIGNAL sample_f1_wen_head : STD_LOGIC_VECTOR(4 DOWNTO 0);
260 SIGNAL sample_f1_wen_head : STD_LOGIC_VECTOR(4 DOWNTO 0);
260 SIGNAL sample_f1_wen_head_in : STD_LOGIC;
261 SIGNAL sample_f1_wen_head_in : STD_LOGIC;
261 SIGNAL sample_f1_wen_head_out : STD_LOGIC;
262 SIGNAL sample_f1_wen_head_out : STD_LOGIC;
262 SIGNAL sample_f1_full_head_in : STD_LOGIC;
263 SIGNAL sample_f1_full_head_in : STD_LOGIC;
263 SIGNAL sample_f1_full_head_out : STD_LOGIC;
264 SIGNAL sample_f1_full_head_out : STD_LOGIC;
264 SIGNAL sample_f1_empty_head_in : STD_LOGIC;
265 SIGNAL sample_f1_empty_head_in : STD_LOGIC;
265
266
266 SIGNAL sample_f1_wdata_head : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
267 SIGNAL sample_f1_wdata_head : STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
267 -----------------------------------------------------------------------------
268 -----------------------------------------------------------------------------
268 SIGNAL sample_f0_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
269 SIGNAL sample_f0_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
269 SIGNAL sample_f1_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
270 SIGNAL sample_f1_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
270 SIGNAL sample_f2_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
271 SIGNAL sample_f2_wen_s : STD_LOGIC_VECTOR(4 DOWNTO 0);
271 SIGNAL ongoing : STD_LOGIC;
272 SIGNAL ongoing : STD_LOGIC;
272
273
273 BEGIN
274 BEGIN
274
275
275 PROCESS (clk, rstn)
276 PROCESS (clk, rstn)
276 BEGIN -- PROCESS
277 BEGIN -- PROCESS
277 IF rstn = '0' THEN -- asynchronous reset (active low)
278 IF rstn = '0' THEN -- asynchronous reset (active low)
278 sample_f0_wen_s <= (OTHERS => '1');
279 sample_f0_wen_s <= (OTHERS => '1');
279 sample_f1_wen_s <= (OTHERS => '1');
280 sample_f1_wen_s <= (OTHERS => '1');
280 sample_f2_wen_s <= (OTHERS => '1');
281 sample_f2_wen_s <= (OTHERS => '1');
281 ongoing <= '0';
282 ongoing <= '0';
282 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
283 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
283 IF ongoing = '1' THEN
284 IF ongoing = '1' THEN
284 sample_f0_wen_s <= sample_f0_wen;
285 sample_f0_wen_s <= sample_f0_wen;
285 sample_f1_wen_s <= sample_f1_wen;
286 sample_f1_wen_s <= sample_f1_wen;
286 sample_f2_wen_s <= sample_f2_wen;
287 sample_f2_wen_s <= sample_f2_wen;
287 ELSE
288 ELSE
288 IF start_date = coarse_time(30 DOWNTO 0) THEN
289 IF start_date = coarse_time(30 DOWNTO 0) THEN
289 ongoing <= '1';
290 ongoing <= '1';
290 END IF;
291 END IF;
291 sample_f0_wen_s <= (OTHERS => '1');
292 sample_f0_wen_s <= (OTHERS => '1');
292 sample_f1_wen_s <= (OTHERS => '1');
293 sample_f1_wen_s <= (OTHERS => '1');
293 sample_f2_wen_s <= (OTHERS => '1');
294 sample_f2_wen_s <= (OTHERS => '1');
294 END IF;
295 END IF;
295 END IF;
296 END IF;
296 END PROCESS;
297 END PROCESS;
297
298
298
299
299 error_input_fifo_write <= error_wen_f2 & error_wen_f1 & error_wen_f0;
300 error_input_fifo_write <= error_wen_f2 & error_wen_f1 & error_wen_f0;
300
301
301
302
302 switch_f0_inst : spectral_matrix_switch_f0
303 switch_f0_inst : spectral_matrix_switch_f0
303 PORT MAP (
304 PORT MAP (
304 clk => clk,
305 clk => clk,
305 rstn => rstn,
306 rstn => rstn,
306
307
307 sample_wen => sample_f0_wen_s,
308 sample_wen => sample_f0_wen_s,
308
309
309 fifo_A_empty => sample_f0_A_empty,
310 fifo_A_empty => sample_f0_A_empty,
310 fifo_A_full => sample_f0_A_full,
311 fifo_A_full => sample_f0_A_full,
311 fifo_A_wen => sample_f0_A_wen,
312 fifo_A_wen => sample_f0_A_wen,
312
313
313 fifo_B_empty => sample_f0_B_empty,
314 fifo_B_empty => sample_f0_B_empty,
314 fifo_B_full => sample_f0_B_full,
315 fifo_B_full => sample_f0_B_full,
315 fifo_B_wen => sample_f0_B_wen,
316 fifo_B_wen => sample_f0_B_wen,
316
317
317 error_wen => error_wen_f0); -- TODO
318 error_wen => error_wen_f0); -- TODO
318
319
319 -----------------------------------------------------------------------------
320 -----------------------------------------------------------------------------
320 -- FIFO IN
321 -- FIFO IN
321 -----------------------------------------------------------------------------
322 -----------------------------------------------------------------------------
322 lppFIFOxN_f0_a : lppFIFOxN
323 lppFIFOxN_f0_a : lppFIFOxN
323 GENERIC MAP (
324 GENERIC MAP (
324 tech => 0,
325 tech => 0,
325 Mem_use => Mem_use,
326 Mem_use => Mem_use,
326 Data_sz => 16,
327 Data_sz => 16,
327 Addr_sz => 8,
328 Addr_sz => 8,
328 FifoCnt => 5)
329 FifoCnt => 5)
329 PORT MAP (
330 PORT MAP (
330 clk => clk,
331 clk => clk,
331 rstn => rstn,
332 rstn => rstn,
332
333
333 ReUse => (OTHERS => '0'),
334 ReUse => (OTHERS => '0'),
334
335
335 run => (OTHERS => '1'),
336 run => (OTHERS => '1'),
336
337
337 wen => sample_f0_A_wen,
338 wen => sample_f0_A_wen,
338 wdata => sample_f0_wdata,
339 wdata => sample_f0_wdata,
339
340
340 ren => sample_f0_A_ren,
341 ren => sample_f0_A_ren,
341 rdata => sample_f0_A_rdata,
342 rdata => sample_f0_A_rdata,
342
343
343 empty => sample_f0_A_empty,
344 empty => sample_f0_A_empty,
344 full => sample_f0_A_full,
345 full => sample_f0_A_full,
345 almost_full => OPEN);
346 almost_full => OPEN);
346
347
347 lppFIFOxN_f0_b : lppFIFOxN
348 lppFIFOxN_f0_b : lppFIFOxN
348 GENERIC MAP (
349 GENERIC MAP (
349 tech => 0,
350 tech => 0,
350 Mem_use => Mem_use,
351 Mem_use => Mem_use,
351 Data_sz => 16,
352 Data_sz => 16,
352 Addr_sz => 8,
353 Addr_sz => 8,
353 FifoCnt => 5)
354 FifoCnt => 5)
354 PORT MAP (
355 PORT MAP (
355 clk => clk,
356 clk => clk,
356 rstn => rstn,
357 rstn => rstn,
357
358
358 ReUse => (OTHERS => '0'),
359 ReUse => (OTHERS => '0'),
359 run => (OTHERS => '1'),
360 run => (OTHERS => '1'),
360
361
361 wen => sample_f0_B_wen,
362 wen => sample_f0_B_wen,
362 wdata => sample_f0_wdata,
363 wdata => sample_f0_wdata,
363 ren => sample_f0_B_ren,
364 ren => sample_f0_B_ren,
364 rdata => sample_f0_B_rdata,
365 rdata => sample_f0_B_rdata,
365 empty => sample_f0_B_empty,
366 empty => sample_f0_B_empty,
366 full => sample_f0_B_full,
367 full => sample_f0_B_full,
367 almost_full => OPEN);
368 almost_full => OPEN);
368
369
369 -----------------------------------------------------------------------------
370 -----------------------------------------------------------------------------
370 -- sample_f1_wen in
371 -- sample_f1_wen in
371 -- sample_f1_wdata in
372 -- sample_f1_wdata in
372 -- sample_f1_full OUT
373 -- sample_f1_full OUT
373
374
374 sample_f1_wen_head_in <= '0' WHEN sample_f1_wen_s = "00000" ELSE '1';
375 sample_f1_wen_head_in <= '0' WHEN sample_f1_wen_s = "00000" ELSE '1';
375 sample_f1_full_head_in <= '0' WHEN sample_f1_full = "00000" ELSE '1';
376 sample_f1_full_head_in <= '0' WHEN sample_f1_full = "00000" ELSE '1';
376 sample_f1_empty_head_in <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
377 sample_f1_empty_head_in <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
377
378
378 lpp_lfr_ms_reg_head_1:lpp_lfr_ms_reg_head
379 lpp_lfr_ms_reg_head_1:lpp_lfr_ms_reg_head
379 PORT MAP (
380 PORT MAP (
380 clk => clk,
381 clk => clk,
381 rstn => rstn,
382 rstn => rstn,
382 in_wen => sample_f1_wen_head_in,
383 in_wen => sample_f1_wen_head_in,
383 in_data => sample_f1_wdata,
384 in_data => sample_f1_wdata,
384 in_full => sample_f1_full_head_in,
385 in_full => sample_f1_full_head_in,
385 in_empty => sample_f1_empty_head_in,
386 in_empty => sample_f1_empty_head_in,
386 out_write_error => error_wen_f1,
387 out_write_error => error_wen_f1,
387 out_wen => sample_f1_wen_head_out,
388 out_wen => sample_f1_wen_head_out,
388 out_data => sample_f1_wdata_head,
389 out_data => sample_f1_wdata_head,
389 out_full => sample_f1_full_head_out);
390 out_full => sample_f1_full_head_out);
390
391
391 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;
392 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;
392
393
393
394
394 lppFIFOxN_f1 : lppFIFOxN
395 lppFIFOxN_f1 : lppFIFOxN
395 GENERIC MAP (
396 GENERIC MAP (
396 tech => 0,
397 tech => 0,
397 Mem_use => Mem_use,
398 Mem_use => Mem_use,
398 Data_sz => 16,
399 Data_sz => 16,
399 Addr_sz => 8,
400 Addr_sz => 8,
400 FifoCnt => 5)
401 FifoCnt => 5)
401 PORT MAP (
402 PORT MAP (
402 clk => clk,
403 clk => clk,
403 rstn => rstn,
404 rstn => rstn,
404
405
405 ReUse => (OTHERS => '0'),
406 ReUse => (OTHERS => '0'),
406 run => (OTHERS => '1'),
407 run => (OTHERS => '1'),
407
408
408 wen => sample_f1_wen_head,
409 wen => sample_f1_wen_head,
409 wdata => sample_f1_wdata_head,
410 wdata => sample_f1_wdata_head,
410 ren => sample_f1_ren,
411 ren => sample_f1_ren,
411 rdata => sample_f1_rdata,
412 rdata => sample_f1_rdata,
412 empty => sample_f1_empty,
413 empty => sample_f1_empty,
413 full => sample_f1_full,
414 full => sample_f1_full,
414 almost_full => sample_f1_almost_full);
415 almost_full => sample_f1_almost_full);
415
416
416
417
417 one_sample_f1_wen <= '0' WHEN sample_f1_wen_head = "11111" ELSE '1';
418 one_sample_f1_wen <= '0' WHEN sample_f1_wen_head = "11111" ELSE '1';
418
419
419 PROCESS (clk, rstn)
420 PROCESS (clk, rstn)
420 BEGIN -- PROCESS
421 BEGIN -- PROCESS
421 IF rstn = '0' THEN -- asynchronous reset (active low)
422 IF rstn = '0' THEN -- asynchronous reset (active low)
422 one_sample_f1_full <= '0';
423 one_sample_f1_full <= '0';
423 --error_wen_f1 <= '0';
424 --error_wen_f1 <= '0';
424 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
425 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
425 IF sample_f1_full_head_out = '0' THEN
426 IF sample_f1_full_head_out = '0' THEN
426 one_sample_f1_full <= '0';
427 one_sample_f1_full <= '0';
427 ELSE
428 ELSE
428 one_sample_f1_full <= '1';
429 one_sample_f1_full <= '1';
429 END IF;
430 END IF;
430 --error_wen_f1 <= one_sample_f1_wen AND one_sample_f1_full;
431 --error_wen_f1 <= one_sample_f1_wen AND one_sample_f1_full;
431 END IF;
432 END IF;
432 END PROCESS;
433 END PROCESS;
433
434
434 -----------------------------------------------------------------------------
435 -----------------------------------------------------------------------------
435
436
436
437
437 lppFIFOxN_f2 : lppFIFOxN
438 lppFIFOxN_f2 : lppFIFOxN
438 GENERIC MAP (
439 GENERIC MAP (
439 tech => 0,
440 tech => 0,
440 Mem_use => Mem_use,
441 Mem_use => Mem_use,
441 Data_sz => 16,
442 Data_sz => 16,
442 Addr_sz => 8,
443 Addr_sz => 8,
443 FifoCnt => 5)
444 FifoCnt => 5)
444 PORT MAP (
445 PORT MAP (
445 clk => clk,
446 clk => clk,
446 rstn => rstn,
447 rstn => rstn,
447
448
448 ReUse => (OTHERS => '0'),
449 ReUse => (OTHERS => '0'),
449 run => (OTHERS => '1'),
450 run => (OTHERS => '1'),
450
451
451 wen => sample_f2_wen_s,
452 wen => sample_f2_wen_s,
452 wdata => sample_f2_wdata,
453 wdata => sample_f2_wdata,
453 ren => sample_f2_ren,
454 ren => sample_f2_ren,
454 rdata => sample_f2_rdata,
455 rdata => sample_f2_rdata,
455 empty => sample_f2_empty,
456 empty => sample_f2_empty,
456 full => sample_f2_full,
457 full => sample_f2_full,
457 almost_full => OPEN);
458 almost_full => OPEN);
458
459
459
460
460 one_sample_f2_wen <= '0' WHEN sample_f2_wen_s = "11111" ELSE '1';
461 one_sample_f2_wen <= '0' WHEN sample_f2_wen_s = "11111" ELSE '1';
461
462
462 PROCESS (clk, rstn)
463 PROCESS (clk, rstn)
463 BEGIN -- PROCESS
464 BEGIN -- PROCESS
464 IF rstn = '0' THEN -- asynchronous reset (active low)
465 IF rstn = '0' THEN -- asynchronous reset (active low)
465 one_sample_f2_full <= '0';
466 one_sample_f2_full <= '0';
466 error_wen_f2 <= '0';
467 error_wen_f2 <= '0';
467 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
468 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
468 IF sample_f2_full = "00000" THEN
469 IF sample_f2_full = "00000" THEN
469 one_sample_f2_full <= '0';
470 one_sample_f2_full <= '0';
470 ELSE
471 ELSE
471 one_sample_f2_full <= '1';
472 one_sample_f2_full <= '1';
472 END IF;
473 END IF;
473 error_wen_f2 <= one_sample_f2_wen AND one_sample_f2_full;
474 error_wen_f2 <= one_sample_f2_wen AND one_sample_f2_full;
474 END IF;
475 END IF;
475 END PROCESS;
476 END PROCESS;
476
477
477 -----------------------------------------------------------------------------
478 -----------------------------------------------------------------------------
478 -- FSM SELECT CHANNEL
479 -- FSM SELECT CHANNEL
479 -----------------------------------------------------------------------------
480 -----------------------------------------------------------------------------
480 PROCESS (clk, rstn)
481 PROCESS (clk, rstn)
481 BEGIN
482 BEGIN
482 IF rstn = '0' THEN
483 IF rstn = '0' THEN
483 state_fsm_select_channel <= IDLE;
484 state_fsm_select_channel <= IDLE;
484 select_channel <= (OTHERS => '0');
485 select_channel <= (OTHERS => '0');
485 ELSIF clk'EVENT AND clk = '1' THEN
486 ELSIF clk'EVENT AND clk = '1' THEN
486 CASE state_fsm_select_channel IS
487 CASE state_fsm_select_channel IS
487 WHEN IDLE =>
488 WHEN IDLE =>
488 IF sample_f1_full = "11111" THEN
489 IF sample_f1_full = "11111" THEN
489 state_fsm_select_channel <= SWITCH_F1;
490 state_fsm_select_channel <= SWITCH_F1;
490 select_channel <= "10";
491 select_channel <= "10";
491 ELSIF sample_f1_almost_full = "00000" THEN
492 ELSIF sample_f1_almost_full = "00000" THEN
492 IF sample_f0_A_full = "11111" THEN
493 IF sample_f0_A_full = "11111" THEN
493 state_fsm_select_channel <= SWITCH_F0_A;
494 state_fsm_select_channel <= SWITCH_F0_A;
494 select_channel <= "00";
495 select_channel <= "00";
495 ELSIF sample_f0_B_full = "11111" THEN
496 ELSIF sample_f0_B_full = "11111" THEN
496 state_fsm_select_channel <= SWITCH_F0_B;
497 state_fsm_select_channel <= SWITCH_F0_B;
497 select_channel <= "01";
498 select_channel <= "01";
498 ELSIF sample_f2_full = "11111" THEN
499 ELSIF sample_f2_full = "11111" THEN
499 state_fsm_select_channel <= SWITCH_F2;
500 state_fsm_select_channel <= SWITCH_F2;
500 select_channel <= "11";
501 select_channel <= "11";
501 END IF;
502 END IF;
502 END IF;
503 END IF;
503
504
504 WHEN SWITCH_F0_A =>
505 WHEN SWITCH_F0_A =>
505 IF sample_f0_A_empty = "11111" THEN
506 IF sample_f0_A_empty = "11111" THEN
506 state_fsm_select_channel <= IDLE;
507 state_fsm_select_channel <= IDLE;
507 select_channel <= (OTHERS => '0');
508 select_channel <= (OTHERS => '0');
508 END IF;
509 END IF;
509 WHEN SWITCH_F0_B =>
510 WHEN SWITCH_F0_B =>
510 IF sample_f0_B_empty = "11111" THEN
511 IF sample_f0_B_empty = "11111" THEN
511 state_fsm_select_channel <= IDLE;
512 state_fsm_select_channel <= IDLE;
512 select_channel <= (OTHERS => '0');
513 select_channel <= (OTHERS => '0');
513 END IF;
514 END IF;
514 WHEN SWITCH_F1 =>
515 WHEN SWITCH_F1 =>
515 IF sample_f1_empty = "11111" THEN
516 IF sample_f1_empty = "11111" THEN
516 state_fsm_select_channel <= IDLE;
517 state_fsm_select_channel <= IDLE;
517 select_channel <= (OTHERS => '0');
518 select_channel <= (OTHERS => '0');
518 END IF;
519 END IF;
519 WHEN SWITCH_F2 =>
520 WHEN SWITCH_F2 =>
520 IF sample_f2_empty = "11111" THEN
521 IF sample_f2_empty = "11111" THEN
521 state_fsm_select_channel <= IDLE;
522 state_fsm_select_channel <= IDLE;
522 select_channel <= (OTHERS => '0');
523 select_channel <= (OTHERS => '0');
523 END IF;
524 END IF;
524 WHEN OTHERS => NULL;
525 WHEN OTHERS => NULL;
525 END CASE;
526 END CASE;
526
527
527 END IF;
528 END IF;
528 END PROCESS;
529 END PROCESS;
529
530
530 PROCESS (clk, rstn)
531 PROCESS (clk, rstn)
531 BEGIN
532 BEGIN
532 IF rstn = '0' THEN
533 IF rstn = '0' THEN
533 select_channel_reg <= (OTHERS => '0');
534 select_channel_reg <= (OTHERS => '0');
534 --pre_state_fsm_select_channel <= IDLE;
535 --pre_state_fsm_select_channel <= IDLE;
535 ELSIF clk'EVENT AND clk = '1' THEN
536 ELSIF clk'EVENT AND clk = '1' THEN
536 select_channel_reg <= select_channel;
537 select_channel_reg <= select_channel;
537 --pre_state_fsm_select_channel <= state_fsm_select_channel;
538 --pre_state_fsm_select_channel <= state_fsm_select_channel;
538 END IF;
539 END IF;
539 END PROCESS;
540 END PROCESS;
540
541
541
542
542 -----------------------------------------------------------------------------
543 -----------------------------------------------------------------------------
543 -- SWITCH SELECT CHANNEL
544 -- SWITCH SELECT CHANNEL
544 -----------------------------------------------------------------------------
545 -----------------------------------------------------------------------------
545 sample_empty <= sample_f0_A_empty WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
546 sample_empty <= sample_f0_A_empty WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
546 sample_f0_B_empty WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
547 sample_f0_B_empty WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
547 sample_f1_empty WHEN state_fsm_select_channel = SWITCH_F1 ELSE
548 sample_f1_empty WHEN state_fsm_select_channel = SWITCH_F1 ELSE
548 sample_f2_empty WHEN state_fsm_select_channel = SWITCH_F2 ELSE
549 sample_f2_empty WHEN state_fsm_select_channel = SWITCH_F2 ELSE
549 (OTHERS => '1');
550 (OTHERS => '1');
550
551
551 sample_full <= sample_f0_A_full WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
552 sample_full <= sample_f0_A_full WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
552 sample_f0_B_full WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
553 sample_f0_B_full WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
553 sample_f1_full WHEN state_fsm_select_channel = SWITCH_F1 ELSE
554 sample_f1_full WHEN state_fsm_select_channel = SWITCH_F1 ELSE
554 sample_f2_full WHEN state_fsm_select_channel = SWITCH_F2 ELSE
555 sample_f2_full WHEN state_fsm_select_channel = SWITCH_F2 ELSE
555 (OTHERS => '0');
556 (OTHERS => '0');
556
557
557 --sample_rdata <= sample_f0_A_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_A ELSE
558 --sample_rdata <= sample_f0_A_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_A ELSE
558 -- sample_f0_B_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_B ELSE
559 -- sample_f0_B_rdata WHEN pre_state_fsm_select_channel = SWITCH_F0_B ELSE
559 -- sample_f1_rdata WHEN pre_state_fsm_select_channel = SWITCH_F1 ELSE
560 -- sample_f1_rdata WHEN pre_state_fsm_select_channel = SWITCH_F1 ELSE
560 -- sample_f2_rdata; -- WHEN state_fsm_select_channel = SWITCH_F2 ELSE
561 -- sample_f2_rdata; -- WHEN state_fsm_select_channel = SWITCH_F2 ELSE
561 sample_rdata <= sample_f0_A_rdata WHEN select_channel_reg = "00" ELSE
562 sample_rdata <= sample_f0_A_rdata WHEN select_channel_reg = "00" ELSE
562 sample_f0_B_rdata WHEN select_channel_reg = "01" ELSE
563 sample_f0_B_rdata WHEN select_channel_reg = "01" ELSE
563 sample_f1_rdata WHEN select_channel_reg = "10" ELSE
564 sample_f1_rdata WHEN select_channel_reg = "10" ELSE
564 sample_f2_rdata; -- WHEN state_fsm_select_channel = SWITCH_F2 ELSE
565 sample_f2_rdata; -- WHEN state_fsm_select_channel = SWITCH_F2 ELSE
565
566
566
567
567 sample_f0_A_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_A ELSE (OTHERS => '1');
568 sample_f0_A_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_A ELSE (OTHERS => '1');
568 sample_f0_B_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_B ELSE (OTHERS => '1');
569 sample_f0_B_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F0_B ELSE (OTHERS => '1');
569 sample_f1_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F1 ELSE (OTHERS => '1');
570 sample_f1_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F1 ELSE (OTHERS => '1');
570 sample_f2_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F2 ELSE (OTHERS => '1');
571 sample_f2_ren <= sample_ren WHEN state_fsm_select_channel = SWITCH_F2 ELSE (OTHERS => '1');
571
572
572
573
573 status_channel <= time_reg_f0_A & "00" WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
574 status_channel <= time_reg_f0_A & "00" WHEN state_fsm_select_channel = SWITCH_F0_A ELSE
574 time_reg_f0_B & "00" WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
575 time_reg_f0_B & "00" WHEN state_fsm_select_channel = SWITCH_F0_B ELSE
575 time_reg_f1 & "01" WHEN state_fsm_select_channel = SWITCH_F1 ELSE
576 time_reg_f1 & "01" WHEN state_fsm_select_channel = SWITCH_F1 ELSE
576 time_reg_f2 & "10"; -- WHEN state_fsm_select_channel = SWITCH_F2
577 time_reg_f2 & "10"; -- WHEN state_fsm_select_channel = SWITCH_F2
577
578
578 -----------------------------------------------------------------------------
579 -----------------------------------------------------------------------------
579 -- FSM LOAD FFT
580 -- FSM LOAD FFT
580 -----------------------------------------------------------------------------
581 -----------------------------------------------------------------------------
581
582
582 sample_ren <= (OTHERS => '1') WHEN fft_ongoing_counter = '1' ELSE
583 sample_ren <= (OTHERS => '1') WHEN fft_ongoing_counter = '1' ELSE
583 sample_ren_s WHEN sample_load = '1' ELSE
584 sample_ren_s WHEN sample_load = '1' ELSE
584 (OTHERS => '1');
585 (OTHERS => '1');
585
586
586 PROCESS (clk, rstn)
587 PROCESS (clk, rstn)
587 BEGIN
588 BEGIN
588 IF rstn = '0' THEN
589 IF rstn = '0' THEN
589 sample_ren_s <= (OTHERS => '1');
590 sample_ren_s <= (OTHERS => '1');
590 state_fsm_load_FFT <= IDLE;
591 state_fsm_load_FFT <= IDLE;
591 status_MS_input <= (OTHERS => '0');
592 status_MS_input <= (OTHERS => '0');
592 select_fifo <= "000";
593 select_fifo <= "000";
593 --next_state_fsm_load_FFT <= IDLE;
594 --next_state_fsm_load_FFT <= IDLE;
594 --sample_valid <= '0';
595 --sample_valid <= '0';
595 ELSIF clk'EVENT AND clk = '1' THEN
596 ELSIF clk'EVENT AND clk = '1' THEN
596 CASE state_fsm_load_FFT IS
597 CASE state_fsm_load_FFT IS
597 WHEN IDLE =>
598 WHEN IDLE =>
598 --sample_valid <= '0';
599 --sample_valid <= '0';
599 sample_ren_s <= (OTHERS => '1');
600 sample_ren_s <= (OTHERS => '1');
600 IF sample_full = "11111" AND sample_load = '1' THEN
601 IF sample_full = "11111" AND sample_load = '1' THEN
601 sample_ren_s <= "11111";
602 sample_ren_s <= "11111";
602 state_fsm_load_FFT <= FIFO_1;
603 state_fsm_load_FFT <= FIFO_1;
603 status_MS_input <= status_channel;
604 status_MS_input <= status_channel;
604 select_fifo <= "000";
605 select_fifo <= "000";
605 END IF;
606 END IF;
606
607
607 WHEN FIFO_1 =>
608 WHEN FIFO_1 =>
608 sample_ren_s <= "1111" & NOT(sample_load);
609 sample_ren_s <= "1111" & NOT(sample_load);
609 IF sample_empty(0) = '1' THEN
610 IF sample_empty(0) = '1' THEN
610 sample_ren_s <= "11111";
611 sample_ren_s <= "11111";
611 state_fsm_load_FFT <= WAIT_STATE;
612 state_fsm_load_FFT <= WAIT_STATE;
612 next_state_fsm_load_FFT <= FIFO_2;
613 next_state_fsm_load_FFT <= FIFO_2;
613 select_fifo <= "001";
614 select_fifo <= "001";
614 END IF;
615 END IF;
615
616
616 WHEN FIFO_2 =>
617 WHEN FIFO_2 =>
617 sample_ren_s <= "111" & NOT(sample_load) & '1';
618 sample_ren_s <= "111" & NOT(sample_load) & '1';
618 IF sample_empty(1) = '1' THEN
619 IF sample_empty(1) = '1' THEN
619 sample_ren_s <= "11111";
620 sample_ren_s <= "11111";
620 state_fsm_load_FFT <= WAIT_STATE;
621 state_fsm_load_FFT <= WAIT_STATE;
621 next_state_fsm_load_FFT <= FIFO_3;
622 next_state_fsm_load_FFT <= FIFO_3;
622 select_fifo <= "010";
623 select_fifo <= "010";
623 END IF;
624 END IF;
624
625
625 WHEN FIFO_3 =>
626 WHEN FIFO_3 =>
626 sample_ren_s <= "11" & NOT(sample_load) & "11";
627 sample_ren_s <= "11" & NOT(sample_load) & "11";
627 IF sample_empty(2) = '1' THEN
628 IF sample_empty(2) = '1' THEN
628 sample_ren_s <= "11111";
629 sample_ren_s <= "11111";
629 state_fsm_load_FFT <= WAIT_STATE;
630 state_fsm_load_FFT <= WAIT_STATE;
630 next_state_fsm_load_FFT <= FIFO_4;
631 next_state_fsm_load_FFT <= FIFO_4;
631 select_fifo <= "011";
632 select_fifo <= "011";
632 END IF;
633 END IF;
633
634
634 WHEN FIFO_4 =>
635 WHEN FIFO_4 =>
635 sample_ren_s <= '1' & NOT(sample_load) & "111";
636 sample_ren_s <= '1' & NOT(sample_load) & "111";
636 IF sample_empty(3) = '1' THEN
637 IF sample_empty(3) = '1' THEN
637 sample_ren_s <= "11111";
638 sample_ren_s <= "11111";
638 state_fsm_load_FFT <= WAIT_STATE;
639 state_fsm_load_FFT <= WAIT_STATE;
639 next_state_fsm_load_FFT <= FIFO_5;
640 next_state_fsm_load_FFT <= FIFO_5;
640 select_fifo <= "100";
641 select_fifo <= "100";
641 END IF;
642 END IF;
642
643
643 WHEN FIFO_5 =>
644 WHEN FIFO_5 =>
644 sample_ren_s <= NOT(sample_load) & "1111";
645 sample_ren_s <= NOT(sample_load) & "1111";
645 IF sample_empty(4) = '1' THEN
646 IF sample_empty(4) = '1' THEN
646 sample_ren_s <= (OTHERS => '1');
647 sample_ren_s <= (OTHERS => '1');
647 state_fsm_load_FFT <= WAIT_STATE;
648 state_fsm_load_FFT <= WAIT_STATE;
648 next_state_fsm_load_FFT <= IDLE;
649 next_state_fsm_load_FFT <= IDLE;
649 --state_fsm_load_FFT <= IDLE;
650 --state_fsm_load_FFT <= IDLE;
650 select_fifo <= "000";
651 select_fifo <= "000";
651 END IF;
652 END IF;
652
653
653 WHEN WAIT_STATE =>
654 WHEN WAIT_STATE =>
654 sample_ren_s <= (OTHERS => '1');
655 sample_ren_s <= (OTHERS => '1');
655 IF sample_load = '1' THEN
656 IF sample_load = '1' THEN
656 state_fsm_load_FFT <= WAIT_STATE_2 ;
657 state_fsm_load_FFT <= WAIT_STATE_2 ;
657 END IF;
658 END IF;
658
659
659 WHEN WAIT_STATE_2 =>
660 WHEN WAIT_STATE_2 =>
660 sample_ren_s <= (OTHERS => '1');
661 sample_ren_s <= (OTHERS => '1');
661 IF fft_data_valid = '0' AND fft_data_valid_pre = '1' THEN
662 IF fft_data_valid = '0' AND fft_data_valid_pre = '1' THEN
662 state_fsm_load_FFT <= next_state_fsm_load_FFT;
663 state_fsm_load_FFT <= next_state_fsm_load_FFT;
663 END IF;
664 END IF;
664
665
665 WHEN OTHERS => NULL;
666 WHEN OTHERS => NULL;
666 END CASE;
667 END CASE;
667 END IF;
668 END IF;
668 END PROCESS;
669 END PROCESS;
669
670
670 PROCESS (clk, rstn)
671 PROCESS (clk, rstn)
671 BEGIN -- PROCESS
672 BEGIN -- PROCESS
672 IF rstn = '0' THEN -- asynchronous reset (active low)
673 IF rstn = '0' THEN -- asynchronous reset (active low)
673 fft_data_valid_pre <= '0';
674 fft_data_valid_pre <= '0';
674 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
675 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
675 fft_data_valid_pre <= fft_data_valid;
676 fft_data_valid_pre <= fft_data_valid;
676 END IF;
677 END IF;
677 END PROCESS;
678 END PROCESS;
678
679
679 PROCESS (clk, rstn)
680 PROCESS (clk, rstn)
680 BEGIN
681 BEGIN
681 IF rstn = '0' THEN
682 IF rstn = '0' THEN
682 sample_valid_r <= '0';
683 sample_valid_r <= '0';
683 select_fifo_reg <= (OTHERS => '0');
684 select_fifo_reg <= (OTHERS => '0');
684 --next_state_fsm_load_FFT <= IDLE;
685 --next_state_fsm_load_FFT <= IDLE;
685 ELSIF clk'EVENT AND clk = '1' THEN
686 ELSIF clk'EVENT AND clk = '1' THEN
686 select_fifo_reg <= select_fifo;
687 select_fifo_reg <= select_fifo;
687 --next_state_fsm_load_FFT <= state_fsm_load_FFT;
688 --next_state_fsm_load_FFT <= state_fsm_load_FFT;
688 IF sample_ren_s = "11111" THEN
689 IF sample_ren_s = "11111" THEN
689 sample_valid_r <= '0';
690 sample_valid_r <= '0';
690 ELSE
691 ELSE
691 sample_valid_r <= '1';
692 sample_valid_r <= '1';
692 END IF;
693 END IF;
693 END IF;
694 END IF;
694 END PROCESS;
695 END PROCESS;
695
696
696 sample_valid <= '0' WHEN fft_ongoing_counter = '1' ELSE sample_valid_r AND sample_load;
697 sample_valid <= '0' WHEN fft_ongoing_counter = '1' ELSE sample_valid_r AND sample_load;
697
698
698 --sample_data <= sample_rdata(16*1-1 DOWNTO 16*0) WHEN next_state_fsm_load_FFT = FIFO_1 ELSE
699 --sample_data <= sample_rdata(16*1-1 DOWNTO 16*0) WHEN next_state_fsm_load_FFT = FIFO_1 ELSE
699 -- sample_rdata(16*2-1 DOWNTO 16*1) WHEN next_state_fsm_load_FFT = FIFO_2 ELSE
700 -- sample_rdata(16*2-1 DOWNTO 16*1) WHEN next_state_fsm_load_FFT = FIFO_2 ELSE
700 -- sample_rdata(16*3-1 DOWNTO 16*2) WHEN next_state_fsm_load_FFT = FIFO_3 ELSE
701 -- sample_rdata(16*3-1 DOWNTO 16*2) WHEN next_state_fsm_load_FFT = FIFO_3 ELSE
701 -- sample_rdata(16*4-1 DOWNTO 16*3) WHEN next_state_fsm_load_FFT = FIFO_4 ELSE
702 -- sample_rdata(16*4-1 DOWNTO 16*3) WHEN next_state_fsm_load_FFT = FIFO_4 ELSE
702 -- sample_rdata(16*5-1 DOWNTO 16*4); --WHEN next_state_fsm_load_FFT = FIFO_5 ELSE
703 -- sample_rdata(16*5-1 DOWNTO 16*4); --WHEN next_state_fsm_load_FFT = FIFO_5 ELSE
703 sample_data <= sample_rdata(16*1-1 DOWNTO 16*0) WHEN select_fifo_reg = "000" ELSE
704 sample_data <= sample_rdata(16*1-1 DOWNTO 16*0) WHEN select_fifo_reg = "000" ELSE
704 sample_rdata(16*2-1 DOWNTO 16*1) WHEN select_fifo_reg = "001" ELSE
705 sample_rdata(16*2-1 DOWNTO 16*1) WHEN select_fifo_reg = "001" ELSE
705 sample_rdata(16*3-1 DOWNTO 16*2) WHEN select_fifo_reg = "010" ELSE
706 sample_rdata(16*3-1 DOWNTO 16*2) WHEN select_fifo_reg = "010" ELSE
706 sample_rdata(16*4-1 DOWNTO 16*3) WHEN select_fifo_reg = "011" ELSE
707 sample_rdata(16*4-1 DOWNTO 16*3) WHEN select_fifo_reg = "011" ELSE
707 sample_rdata(16*5-1 DOWNTO 16*4); --WHEN next_state_fsm_load_FFT = FIFO_5 ELSE
708 sample_rdata(16*5-1 DOWNTO 16*4); --WHEN next_state_fsm_load_FFT = FIFO_5 ELSE
708
709
709 -----------------------------------------------------------------------------
710 -----------------------------------------------------------------------------
710 -- FFT
711 -- FFT
711 -----------------------------------------------------------------------------
712 -----------------------------------------------------------------------------
712 lpp_lfr_ms_FFT_1 : lpp_lfr_ms_FFT
713 lpp_lfr_ms_FFT_1 : lpp_lfr_ms_FFT
714 GENERIC MAP (
715 WINDOWS_HAANNING_PARAM_SIZE => WINDOWS_HAANNING_PARAM_SIZE)
713 PORT MAP (
716 PORT MAP (
714 clk => clk,
717 clk => clk,
715 rstn => rstn,
718 rstn => rstn,
716 sample_valid => sample_valid,
719 sample_valid => sample_valid,
717 fft_read => fft_read,
720 fft_read => fft_read,
718 sample_data => sample_data,
721 sample_data => sample_data,
719 sample_load => sample_load,
722 sample_load => sample_load,
720 fft_pong => fft_pong,
723 fft_pong => fft_pong,
721 fft_data_im => fft_data_im,
724 fft_data_im => fft_data_im,
722 fft_data_re => fft_data_re,
725 fft_data_re => fft_data_re,
723 fft_data_valid => fft_data_valid,
726 fft_data_valid => fft_data_valid,
724 fft_ready => fft_ready);
727 fft_ready => fft_ready);
725
728
726 debug_vector(0) <= fft_data_valid;
729 debug_vector(0) <= fft_data_valid;
727 debug_vector(1) <= fft_ready;
730 debug_vector(1) <= fft_ready;
728 debug_vector(11 DOWNTO 2) <= (OTHERS => '0');
731 debug_vector(11 DOWNTO 2) <= (OTHERS => '0');
729
732
730
733
731 -----------------------------------------------------------------------------
734 -----------------------------------------------------------------------------
732 fft_ready_rising_down <= fft_ready_reg AND NOT fft_ready;
735 fft_ready_rising_down <= fft_ready_reg AND NOT fft_ready;
733 sample_load_rising_down <= sample_load_reg AND NOT sample_load;
736 sample_load_rising_down <= sample_load_reg AND NOT sample_load;
734
737
735 PROCESS (clk, rstn)
738 PROCESS (clk, rstn)
736 BEGIN
739 BEGIN
737 IF rstn = '0' THEN
740 IF rstn = '0' THEN
738 fft_ready_reg <= '0';
741 fft_ready_reg <= '0';
739 sample_load_reg <= '0';
742 sample_load_reg <= '0';
740
743
741 fft_ongoing_counter <= '0';
744 fft_ongoing_counter <= '0';
742 ELSIF clk'event AND clk = '1' THEN
745 ELSIF clk'event AND clk = '1' THEN
743 fft_ready_reg <= fft_ready;
746 fft_ready_reg <= fft_ready;
744 sample_load_reg <= sample_load;
747 sample_load_reg <= sample_load;
745
748
746 IF fft_ready_rising_down = '1' AND sample_load_rising_down = '0' THEN
749 IF fft_ready_rising_down = '1' AND sample_load_rising_down = '0' THEN
747 fft_ongoing_counter <= '0';
750 fft_ongoing_counter <= '0';
748
751
749 -- CASE fft_ongoing_counter IS
752 -- CASE fft_ongoing_counter IS
750 -- WHEN "01" => fft_ongoing_counter <= "00";
753 -- WHEN "01" => fft_ongoing_counter <= "00";
751 ---- WHEN "10" => fft_ongoing_counter <= "01";
754 ---- WHEN "10" => fft_ongoing_counter <= "01";
752 -- WHEN OTHERS => NULL;
755 -- WHEN OTHERS => NULL;
753 -- END CASE;
756 -- END CASE;
754 ELSIF fft_ready_rising_down = '0' AND sample_load_rising_down = '1' THEN
757 ELSIF fft_ready_rising_down = '0' AND sample_load_rising_down = '1' THEN
755 fft_ongoing_counter <= '1';
758 fft_ongoing_counter <= '1';
756 -- CASE fft_ongoing_counter IS
759 -- CASE fft_ongoing_counter IS
757 -- WHEN "00" => fft_ongoing_counter <= "01";
760 -- WHEN "00" => fft_ongoing_counter <= "01";
758 ---- WHEN "01" => fft_ongoing_counter <= "10";
761 ---- WHEN "01" => fft_ongoing_counter <= "10";
759 -- WHEN OTHERS => NULL;
762 -- WHEN OTHERS => NULL;
760 -- END CASE;
763 -- END CASE;
761 END IF;
764 END IF;
762
765
763 END IF;
766 END IF;
764 END PROCESS;
767 END PROCESS;
765
768
766 -----------------------------------------------------------------------------
769 -----------------------------------------------------------------------------
767 PROCESS (clk, rstn)
770 PROCESS (clk, rstn)
768 BEGIN
771 BEGIN
769 IF rstn = '0' THEN
772 IF rstn = '0' THEN
770 state_fsm_load_MS_memory <= IDLE;
773 state_fsm_load_MS_memory <= IDLE;
771 current_fifo_load <= "00001";
774 current_fifo_load <= "00001";
772 ELSIF clk'EVENT AND clk = '1' THEN
775 ELSIF clk'EVENT AND clk = '1' THEN
773 CASE state_fsm_load_MS_memory IS
776 CASE state_fsm_load_MS_memory IS
774 WHEN IDLE =>
777 WHEN IDLE =>
775 IF current_fifo_empty = '1' AND fft_ready = '1' AND current_fifo_locked = '0' THEN
778 IF current_fifo_empty = '1' AND fft_ready = '1' AND current_fifo_locked = '0' THEN
776 state_fsm_load_MS_memory <= LOAD_FIFO;
779 state_fsm_load_MS_memory <= LOAD_FIFO;
777 END IF;
780 END IF;
778 WHEN LOAD_FIFO =>
781 WHEN LOAD_FIFO =>
779 IF current_fifo_full = '1' THEN
782 IF current_fifo_full = '1' THEN
780 state_fsm_load_MS_memory <= TRASH_FFT;
783 state_fsm_load_MS_memory <= TRASH_FFT;
781 END IF;
784 END IF;
782 WHEN TRASH_FFT =>
785 WHEN TRASH_FFT =>
783 IF fft_ready = '0' THEN
786 IF fft_ready = '0' THEN
784 state_fsm_load_MS_memory <= IDLE;
787 state_fsm_load_MS_memory <= IDLE;
785 current_fifo_load <= current_fifo_load(3 DOWNTO 0) & current_fifo_load(4);
788 current_fifo_load <= current_fifo_load(3 DOWNTO 0) & current_fifo_load(4);
786 END IF;
789 END IF;
787 WHEN OTHERS => NULL;
790 WHEN OTHERS => NULL;
788 END CASE;
791 END CASE;
789
792
790 END IF;
793 END IF;
791 END PROCESS;
794 END PROCESS;
792
795
793 current_fifo_empty <= MEM_IN_SM_Empty(0) WHEN current_fifo_load(0) = '1' ELSE
796 current_fifo_empty <= MEM_IN_SM_Empty(0) WHEN current_fifo_load(0) = '1' ELSE
794 MEM_IN_SM_Empty(1) WHEN current_fifo_load(1) = '1' ELSE
797 MEM_IN_SM_Empty(1) WHEN current_fifo_load(1) = '1' ELSE
795 MEM_IN_SM_Empty(2) WHEN current_fifo_load(2) = '1' ELSE
798 MEM_IN_SM_Empty(2) WHEN current_fifo_load(2) = '1' ELSE
796 MEM_IN_SM_Empty(3) WHEN current_fifo_load(3) = '1' ELSE
799 MEM_IN_SM_Empty(3) WHEN current_fifo_load(3) = '1' ELSE
797 MEM_IN_SM_Empty(4); -- WHEN current_fifo_load(3) = '1' ELSE
800 MEM_IN_SM_Empty(4); -- WHEN current_fifo_load(3) = '1' ELSE
798
801
799 current_fifo_full <= MEM_IN_SM_Full(0) WHEN current_fifo_load(0) = '1' ELSE
802 current_fifo_full <= MEM_IN_SM_Full(0) WHEN current_fifo_load(0) = '1' ELSE
800 MEM_IN_SM_Full(1) WHEN current_fifo_load(1) = '1' ELSE
803 MEM_IN_SM_Full(1) WHEN current_fifo_load(1) = '1' ELSE
801 MEM_IN_SM_Full(2) WHEN current_fifo_load(2) = '1' ELSE
804 MEM_IN_SM_Full(2) WHEN current_fifo_load(2) = '1' ELSE
802 MEM_IN_SM_Full(3) WHEN current_fifo_load(3) = '1' ELSE
805 MEM_IN_SM_Full(3) WHEN current_fifo_load(3) = '1' ELSE
803 MEM_IN_SM_Full(4); -- WHEN current_fifo_load(3) = '1' ELSE
806 MEM_IN_SM_Full(4); -- WHEN current_fifo_load(3) = '1' ELSE
804
807
805 current_fifo_locked <= MEM_IN_SM_locked(0) WHEN current_fifo_load(0) = '1' ELSE
808 current_fifo_locked <= MEM_IN_SM_locked(0) WHEN current_fifo_load(0) = '1' ELSE
806 MEM_IN_SM_locked(1) WHEN current_fifo_load(1) = '1' ELSE
809 MEM_IN_SM_locked(1) WHEN current_fifo_load(1) = '1' ELSE
807 MEM_IN_SM_locked(2) WHEN current_fifo_load(2) = '1' ELSE
810 MEM_IN_SM_locked(2) WHEN current_fifo_load(2) = '1' ELSE
808 MEM_IN_SM_locked(3) WHEN current_fifo_load(3) = '1' ELSE
811 MEM_IN_SM_locked(3) WHEN current_fifo_load(3) = '1' ELSE
809 MEM_IN_SM_locked(4); -- WHEN current_fifo_load(3) = '1' ELSE
812 MEM_IN_SM_locked(4); -- WHEN current_fifo_load(3) = '1' ELSE
810
813
811 fft_read <= '0' WHEN state_fsm_load_MS_memory = IDLE ELSE '1';
814 fft_read <= '0' WHEN state_fsm_load_MS_memory = IDLE ELSE '1';
812
815
813 all_fifo : FOR I IN 4 DOWNTO 0 GENERATE
816 all_fifo : FOR I IN 4 DOWNTO 0 GENERATE
814 MEM_IN_SM_wen_s(I) <= '0' WHEN fft_data_valid = '1'
817 MEM_IN_SM_wen_s(I) <= '0' WHEN fft_data_valid = '1'
815 AND state_fsm_load_MS_memory = LOAD_FIFO
818 AND state_fsm_load_MS_memory = LOAD_FIFO
816 AND current_fifo_load(I) = '1'
819 AND current_fifo_load(I) = '1'
817 ELSE '1';
820 ELSE '1';
818 END GENERATE all_fifo;
821 END GENERATE all_fifo;
819
822
820 PROCESS (clk, rstn)
823 PROCESS (clk, rstn)
821 BEGIN
824 BEGIN
822 IF rstn = '0' THEN
825 IF rstn = '0' THEN
823 MEM_IN_SM_wen <= (OTHERS => '1');
826 MEM_IN_SM_wen <= (OTHERS => '1');
824 ELSIF clk'EVENT AND clk = '1' THEN
827 ELSIF clk'EVENT AND clk = '1' THEN
825 MEM_IN_SM_wen <= MEM_IN_SM_wen_s;
828 MEM_IN_SM_wen <= MEM_IN_SM_wen_s;
826 END IF;
829 END IF;
827 END PROCESS;
830 END PROCESS;
828
831
829 MEM_IN_SM_wData <= (fft_data_im & fft_data_re) &
832 MEM_IN_SM_wData <= (fft_data_im & fft_data_re) &
830 (fft_data_im & fft_data_re) &
833 (fft_data_im & fft_data_re) &
831 (fft_data_im & fft_data_re) &
834 (fft_data_im & fft_data_re) &
832 (fft_data_im & fft_data_re) &
835 (fft_data_im & fft_data_re) &
833 (fft_data_im & fft_data_re);
836 (fft_data_im & fft_data_re);
834 -----------------------------------------------------------------------------
837 -----------------------------------------------------------------------------
835
838
836
839
837 -----------------------------------------------------------------------------
840 -----------------------------------------------------------------------------
838 Mem_In_SpectralMatrix : lppFIFOxN
841 Mem_In_SpectralMatrix : lppFIFOxN
839 GENERIC MAP (
842 GENERIC MAP (
840 tech => 0,
843 tech => 0,
841 Mem_use => Mem_use,
844 Mem_use => Mem_use,
842 Data_sz => 32, --16,
845 Data_sz => 32, --16,
843 Addr_sz => 7, --8
846 Addr_sz => 7, --8
844 FifoCnt => 5)
847 FifoCnt => 5)
845 PORT MAP (
848 PORT MAP (
846 clk => clk,
849 clk => clk,
847 rstn => rstn,
850 rstn => rstn,
848
851
849 ReUse => MEM_IN_SM_ReUse,
852 ReUse => MEM_IN_SM_ReUse,
850 run => (OTHERS => '1'),
853 run => (OTHERS => '1'),
851
854
852 wen => MEM_IN_SM_wen,
855 wen => MEM_IN_SM_wen,
853 wdata => MEM_IN_SM_wData,
856 wdata => MEM_IN_SM_wData,
854
857
855 ren => MEM_IN_SM_ren,
858 ren => MEM_IN_SM_ren,
856 rdata => MEM_IN_SM_rData,
859 rdata => MEM_IN_SM_rData,
857 full => MEM_IN_SM_Full,
860 full => MEM_IN_SM_Full,
858 empty => MEM_IN_SM_Empty,
861 empty => MEM_IN_SM_Empty,
859 almost_full => OPEN);
862 almost_full => OPEN);
860
863
861
864
862 -----------------------------------------------------------------------------
865 -----------------------------------------------------------------------------
863 MS_control_1 : MS_control
866 MS_control_1 : MS_control
864 PORT MAP (
867 PORT MAP (
865 clk => clk,
868 clk => clk,
866 rstn => rstn,
869 rstn => rstn,
867
870
868 current_status_ms => status_MS_input,
871 current_status_ms => status_MS_input,
869
872
870 fifo_in_lock => MEM_IN_SM_locked,
873 fifo_in_lock => MEM_IN_SM_locked,
871 fifo_in_data => MEM_IN_SM_rdata,
874 fifo_in_data => MEM_IN_SM_rdata,
872 fifo_in_full => MEM_IN_SM_Full,
875 fifo_in_full => MEM_IN_SM_Full,
873 fifo_in_empty => MEM_IN_SM_Empty,
876 fifo_in_empty => MEM_IN_SM_Empty,
874 fifo_in_ren => MEM_IN_SM_ren,
877 fifo_in_ren => MEM_IN_SM_ren,
875 fifo_in_reuse => MEM_IN_SM_ReUse,
878 fifo_in_reuse => MEM_IN_SM_ReUse,
876
879
877 fifo_out_data => SM_in_data,
880 fifo_out_data => SM_in_data,
878 fifo_out_ren => SM_in_ren,
881 fifo_out_ren => SM_in_ren,
879 fifo_out_empty => SM_in_empty,
882 fifo_out_empty => SM_in_empty,
880
883
881 current_status_component => status_component,
884 current_status_component => status_component,
882
885
883 correlation_start => SM_correlation_start,
886 correlation_start => SM_correlation_start,
884 correlation_auto => SM_correlation_auto,
887 correlation_auto => SM_correlation_auto,
885 correlation_done => SM_correlation_done);
888 correlation_done => SM_correlation_done);
886
889
887
890
888 MS_calculation_1 : MS_calculation
891 MS_calculation_1 : MS_calculation
889 PORT MAP (
892 PORT MAP (
890 clk => clk,
893 clk => clk,
891 rstn => rstn,
894 rstn => rstn,
892
895
893 fifo_in_data => SM_in_data,
896 fifo_in_data => SM_in_data,
894 fifo_in_ren => SM_in_ren,
897 fifo_in_ren => SM_in_ren,
895 fifo_in_empty => SM_in_empty,
898 fifo_in_empty => SM_in_empty,
896
899
897 fifo_out_data => MEM_OUT_SM_Data_in_s, -- TODO
900 fifo_out_data => MEM_OUT_SM_Data_in_s, -- TODO
898 fifo_out_wen => MEM_OUT_SM_Write_s, -- TODO
901 fifo_out_wen => MEM_OUT_SM_Write_s, -- TODO
899 fifo_out_full => MEM_OUT_SM_Full_s, -- TODO
902 fifo_out_full => MEM_OUT_SM_Full_s, -- TODO
900
903
901 correlation_start => SM_correlation_start,
904 correlation_start => SM_correlation_start,
902 correlation_auto => SM_correlation_auto,
905 correlation_auto => SM_correlation_auto,
903 correlation_begin => SM_correlation_begin,
906 correlation_begin => SM_correlation_begin,
904 correlation_done => SM_correlation_done);
907 correlation_done => SM_correlation_done);
905
908
906 -----------------------------------------------------------------------------
909 -----------------------------------------------------------------------------
907 PROCESS (clk, rstn)
910 PROCESS (clk, rstn)
908 BEGIN -- PROCESS
911 BEGIN -- PROCESS
909 IF rstn = '0' THEN -- asynchronous reset (active low)
912 IF rstn = '0' THEN -- asynchronous reset (active low)
910 current_matrix_write <= '0';
913 current_matrix_write <= '0';
911 current_matrix_wait_empty <= '1';
914 current_matrix_wait_empty <= '1';
912 status_component_fifo_0 <= (OTHERS => '0');
915 status_component_fifo_0 <= (OTHERS => '0');
913 status_component_fifo_1 <= (OTHERS => '0');
916 status_component_fifo_1 <= (OTHERS => '0');
914 status_component_fifo_0_end <= '0';
917 status_component_fifo_0_end <= '0';
915 status_component_fifo_1_end <= '0';
918 status_component_fifo_1_end <= '0';
916 SM_correlation_done_reg1 <= '0';
919 SM_correlation_done_reg1 <= '0';
917 SM_correlation_done_reg2 <= '0';
920 SM_correlation_done_reg2 <= '0';
918 SM_correlation_done_reg3 <= '0';
921 SM_correlation_done_reg3 <= '0';
919
922
920 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
923 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
921 SM_correlation_done_reg1 <= SM_correlation_done;
924 SM_correlation_done_reg1 <= SM_correlation_done;
922 SM_correlation_done_reg2 <= SM_correlation_done_reg1;
925 SM_correlation_done_reg2 <= SM_correlation_done_reg1;
923 SM_correlation_done_reg3 <= SM_correlation_done_reg2;
926 SM_correlation_done_reg3 <= SM_correlation_done_reg2;
924 status_component_fifo_0_end <= '0';
927 status_component_fifo_0_end <= '0';
925 status_component_fifo_1_end <= '0';
928 status_component_fifo_1_end <= '0';
926 IF SM_correlation_begin = '1' THEN
929 IF SM_correlation_begin = '1' THEN
927 IF current_matrix_write = '0' THEN
930 IF current_matrix_write = '0' THEN
928 status_component_fifo_0 <= status_component(53 DOWNTO 4);
931 status_component_fifo_0 <= status_component(53 DOWNTO 4);
929 ELSE
932 ELSE
930 status_component_fifo_1 <= status_component(53 DOWNTO 4);
933 status_component_fifo_1 <= status_component(53 DOWNTO 4);
931 END IF;
934 END IF;
932 END IF;
935 END IF;
933
936
934 IF SM_correlation_done_reg3 = '1' THEN
937 IF SM_correlation_done_reg3 = '1' THEN
935 IF current_matrix_write = '0' THEN
938 IF current_matrix_write = '0' THEN
936 status_component_fifo_0_end <= '1';
939 status_component_fifo_0_end <= '1';
937 ELSE
940 ELSE
938 status_component_fifo_1_end <= '1';
941 status_component_fifo_1_end <= '1';
939 END IF;
942 END IF;
940 current_matrix_wait_empty <= '1';
943 current_matrix_wait_empty <= '1';
941 current_matrix_write <= NOT current_matrix_write;
944 current_matrix_write <= NOT current_matrix_write;
942 END IF;
945 END IF;
943
946
944 IF current_matrix_wait_empty <= '1' THEN
947 IF current_matrix_wait_empty <= '1' THEN
945 IF current_matrix_write = '0' THEN
948 IF current_matrix_write = '0' THEN
946 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(0);
949 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(0);
947 ELSE
950 ELSE
948 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(1);
951 current_matrix_wait_empty <= NOT MEM_OUT_SM_Empty(1);
949 END IF;
952 END IF;
950 END IF;
953 END IF;
951
954
952 END IF;
955 END IF;
953 END PROCESS;
956 END PROCESS;
954
957
955 MEM_OUT_SM_Full_s <= '1' WHEN SM_correlation_done = '1' ELSE
958 MEM_OUT_SM_Full_s <= '1' WHEN SM_correlation_done = '1' ELSE
956 '1' WHEN SM_correlation_done_reg1 = '1' ELSE
959 '1' WHEN SM_correlation_done_reg1 = '1' ELSE
957 '1' WHEN SM_correlation_done_reg2 = '1' ELSE
960 '1' WHEN SM_correlation_done_reg2 = '1' ELSE
958 '1' WHEN SM_correlation_done_reg3 = '1' ELSE
961 '1' WHEN SM_correlation_done_reg3 = '1' ELSE
959 '1' WHEN current_matrix_wait_empty = '1' ELSE
962 '1' WHEN current_matrix_wait_empty = '1' ELSE
960 MEM_OUT_SM_Full(0) WHEN current_matrix_write = '0' ELSE
963 MEM_OUT_SM_Full(0) WHEN current_matrix_write = '0' ELSE
961 MEM_OUT_SM_Full(1);
964 MEM_OUT_SM_Full(1);
962
965
963 MEM_OUT_SM_Write(0) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '0' ELSE '1';
966 MEM_OUT_SM_Write(0) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '0' ELSE '1';
964 MEM_OUT_SM_Write(1) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '1' ELSE '1';
967 MEM_OUT_SM_Write(1) <= MEM_OUT_SM_Write_s WHEN current_matrix_write = '1' ELSE '1';
965
968
966 MEM_OUT_SM_Data_in <= MEM_OUT_SM_Data_in_s & MEM_OUT_SM_Data_in_s;
969 MEM_OUT_SM_Data_in <= MEM_OUT_SM_Data_in_s & MEM_OUT_SM_Data_in_s;
967 -----------------------------------------------------------------------------
970 -----------------------------------------------------------------------------
968
971
969 --Mem_Out_SpectralMatrix : lppFIFOxN
972 --Mem_Out_SpectralMatrix : lppFIFOxN
970 -- GENERIC MAP (
973 -- GENERIC MAP (
971 -- tech => 0,
974 -- tech => 0,
972 -- Mem_use => Mem_use,
975 -- Mem_use => Mem_use,
973 -- Data_sz => 32,
976 -- Data_sz => 32,
974 -- Addr_sz => 8,
977 -- Addr_sz => 8,
975 -- FifoCnt => 2)
978 -- FifoCnt => 2)
976 -- PORT MAP (
979 -- PORT MAP (
977 -- clk => clk,
980 -- clk => clk,
978 -- rstn => rstn,
981 -- rstn => rstn,
979
982
980 -- ReUse => (OTHERS => '0'),
983 -- ReUse => (OTHERS => '0'),
981 -- run => (OTHERS => '1'),
984 -- run => (OTHERS => '1'),
982
985
983 -- wen => MEM_OUT_SM_Write,
986 -- wen => MEM_OUT_SM_Write,
984 -- wdata => MEM_OUT_SM_Data_in,
987 -- wdata => MEM_OUT_SM_Data_in,
985
988
986 -- ren => MEM_OUT_SM_Read,
989 -- ren => MEM_OUT_SM_Read,
987 -- rdata => MEM_OUT_SM_Data_out,
990 -- rdata => MEM_OUT_SM_Data_out,
988
991
989 -- full => MEM_OUT_SM_Full,
992 -- full => MEM_OUT_SM_Full,
990 -- empty => MEM_OUT_SM_Empty,
993 -- empty => MEM_OUT_SM_Empty,
991 -- almost_full => OPEN);
994 -- almost_full => OPEN);
992
995
993
996
994 all_Mem_Out_SpectralMatrix: FOR I IN 1 DOWNTO 0 GENERATE
997 all_Mem_Out_SpectralMatrix: FOR I IN 1 DOWNTO 0 GENERATE
995 Mem_Out_SpectralMatrix_I: lpp_fifo
998 Mem_Out_SpectralMatrix_I: lpp_fifo
996 GENERIC MAP (
999 GENERIC MAP (
997 tech => 0,
1000 tech => 0,
998 Mem_use => Mem_use,
1001 Mem_use => Mem_use,
999 EMPTY_THRESHOLD_LIMIT => 15,
1002 EMPTY_THRESHOLD_LIMIT => 15,
1000 FULL_THRESHOLD_LIMIT => 1,
1003 FULL_THRESHOLD_LIMIT => 1,
1001 DataSz => 32,
1004 DataSz => 32,
1002 AddrSz => 8)
1005 AddrSz => 8)
1003 PORT MAP (
1006 PORT MAP (
1004 clk => clk,
1007 clk => clk,
1005 rstn => rstn,
1008 rstn => rstn,
1006 reUse => '0',
1009 reUse => '0',
1007 run => run,
1010 run => run,
1008
1011
1009 ren => MEM_OUT_SM_Read(I),
1012 ren => MEM_OUT_SM_Read(I),
1010 rdata => MEM_OUT_SM_Data_out(32*(I+1)-1 DOWNTO 32*i),
1013 rdata => MEM_OUT_SM_Data_out(32*(I+1)-1 DOWNTO 32*i),
1011
1014
1012 wen => MEM_OUT_SM_Write(I),
1015 wen => MEM_OUT_SM_Write(I),
1013 wdata => MEM_OUT_SM_Data_in(32*(I+1)-1 DOWNTO 32*i),
1016 wdata => MEM_OUT_SM_Data_in(32*(I+1)-1 DOWNTO 32*i),
1014
1017
1015 empty => MEM_OUT_SM_Empty(I),
1018 empty => MEM_OUT_SM_Empty(I),
1016 full => MEM_OUT_SM_Full(I),
1019 full => MEM_OUT_SM_Full(I),
1017 full_almost => OPEN,
1020 full_almost => OPEN,
1018 empty_threshold => MEM_OUT_SM_Empty_Threshold(I),
1021 empty_threshold => MEM_OUT_SM_Empty_Threshold(I),
1019
1022
1020 full_threshold => OPEN);
1023 full_threshold => OPEN);
1021
1024
1022 END GENERATE all_Mem_Out_SpectralMatrix;
1025 END GENERATE all_Mem_Out_SpectralMatrix;
1023
1026
1024 -----------------------------------------------------------------------------
1027 -----------------------------------------------------------------------------
1025 -- MEM_OUT_SM_Read <= "00";
1028 -- MEM_OUT_SM_Read <= "00";
1026 PROCESS (clk, rstn)
1029 PROCESS (clk, rstn)
1027 BEGIN
1030 BEGIN
1028 IF rstn = '0' THEN
1031 IF rstn = '0' THEN
1029 fifo_0_ready <= '0';
1032 fifo_0_ready <= '0';
1030 fifo_1_ready <= '0';
1033 fifo_1_ready <= '0';
1031 fifo_ongoing <= '0';
1034 fifo_ongoing <= '0';
1032 fifo_ongoing_reg <= '0';
1035 fifo_ongoing_reg <= '0';
1033 ELSIF clk'EVENT AND clk = '1' THEN
1036 ELSIF clk'EVENT AND clk = '1' THEN
1034 fifo_ongoing_reg <= fifo_ongoing;
1037 fifo_ongoing_reg <= fifo_ongoing;
1035 IF fifo_0_ready = '1' AND MEM_OUT_SM_Empty(0) = '1' THEN
1038 IF fifo_0_ready = '1' AND MEM_OUT_SM_Empty(0) = '1' THEN
1036 fifo_ongoing <= '1';
1039 fifo_ongoing <= '1';
1037 fifo_0_ready <= '0';
1040 fifo_0_ready <= '0';
1038 ELSIF status_component_fifo_0_end = '1' THEN
1041 ELSIF status_component_fifo_0_end = '1' THEN
1039 fifo_0_ready <= '1';
1042 fifo_0_ready <= '1';
1040 END IF;
1043 END IF;
1041
1044
1042 IF fifo_1_ready = '1' AND MEM_OUT_SM_Empty(1) = '1' THEN
1045 IF fifo_1_ready = '1' AND MEM_OUT_SM_Empty(1) = '1' THEN
1043 fifo_ongoing <= '0';
1046 fifo_ongoing <= '0';
1044 fifo_1_ready <= '0';
1047 fifo_1_ready <= '0';
1045 ELSIF status_component_fifo_1_end = '1' THEN
1048 ELSIF status_component_fifo_1_end = '1' THEN
1046 fifo_1_ready <= '1';
1049 fifo_1_ready <= '1';
1047 END IF;
1050 END IF;
1048
1051
1049 END IF;
1052 END IF;
1050 END PROCESS;
1053 END PROCESS;
1051
1054
1052 MEM_OUT_SM_Read(0) <= '1' WHEN fifo_ongoing = '1' ELSE
1055 MEM_OUT_SM_Read(0) <= '1' WHEN fifo_ongoing = '1' ELSE
1053 '1' WHEN fifo_0_ready = '0' ELSE
1056 '1' WHEN fifo_0_ready = '0' ELSE
1054 FSM_DMA_fifo_ren;
1057 FSM_DMA_fifo_ren;
1055
1058
1056 MEM_OUT_SM_Read(1) <= '1' WHEN fifo_ongoing = '0' ELSE
1059 MEM_OUT_SM_Read(1) <= '1' WHEN fifo_ongoing = '0' ELSE
1057 '1' WHEN fifo_1_ready = '0' ELSE
1060 '1' WHEN fifo_1_ready = '0' ELSE
1058 FSM_DMA_fifo_ren;
1061 FSM_DMA_fifo_ren;
1059
1062
1060 FSM_DMA_fifo_empty <= MEM_OUT_SM_Empty(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
1063 FSM_DMA_fifo_empty <= MEM_OUT_SM_Empty(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
1061 MEM_OUT_SM_Empty(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
1064 MEM_OUT_SM_Empty(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
1062 '1';
1065 '1';
1063
1066
1064 FSM_DMA_fifo_status <= status_component_fifo_0 WHEN fifo_ongoing = '0' ELSE
1067 FSM_DMA_fifo_status <= status_component_fifo_0 WHEN fifo_ongoing = '0' ELSE
1065 status_component_fifo_1;
1068 status_component_fifo_1;
1066
1069
1067 FSM_DMA_fifo_data <= MEM_OUT_SM_Data_out(31 DOWNTO 0) WHEN fifo_ongoing_reg = '0' ELSE
1070 FSM_DMA_fifo_data <= MEM_OUT_SM_Data_out(31 DOWNTO 0) WHEN fifo_ongoing_reg = '0' ELSE
1068 MEM_OUT_SM_Data_out(63 DOWNTO 32);
1071 MEM_OUT_SM_Data_out(63 DOWNTO 32);
1069
1072
1070
1073
1071 FSM_DMA_fifo_empty_threshold <= MEM_OUT_SM_Empty_Threshold(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
1074 FSM_DMA_fifo_empty_threshold <= MEM_OUT_SM_Empty_Threshold(0) WHEN fifo_ongoing = '0' AND fifo_0_ready = '1' ELSE
1072 MEM_OUT_SM_Empty_Threshold(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
1075 MEM_OUT_SM_Empty_Threshold(1) WHEN fifo_ongoing = '1' AND fifo_1_ready = '1' ELSE
1073 '1';
1076 '1';
1074
1077
1075 -----------------------------------------------------------------------------
1078 -----------------------------------------------------------------------------
1076 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4), --IN
1079 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4), --IN
1077 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0), --IN
1080 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0), --IN
1078 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6), --IN
1081 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6), --IN
1079 -- fifo_data => FSM_DMA_fifo_data, --IN
1082 -- fifo_data => FSM_DMA_fifo_data, --IN
1080 -- fifo_empty => FSM_DMA_fifo_empty, --IN
1083 -- fifo_empty => FSM_DMA_fifo_empty, --IN
1081 -- fifo_empty_threshold => FSM_DMA_fifo_empty_threshold, --IN
1084 -- fifo_empty_threshold => FSM_DMA_fifo_empty_threshold, --IN
1082 -- fifo_ren => FSM_DMA_fifo_ren, --OUT
1085 -- fifo_ren => FSM_DMA_fifo_ren, --OUT
1083
1086
1084
1087
1085 lpp_lfr_ms_fsmdma_1: lpp_lfr_ms_fsmdma
1088 lpp_lfr_ms_fsmdma_1: lpp_lfr_ms_fsmdma
1086 PORT MAP (
1089 PORT MAP (
1087 clk => clk,
1090 clk => clk,
1088 rstn => rstn,
1091 rstn => rstn,
1089 run => run,
1092 run => run,
1090
1093
1091 fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1094 fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1092 fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1095 fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1093 fifo_data => FSM_DMA_fifo_data,
1096 fifo_data => FSM_DMA_fifo_data,
1094 fifo_empty => FSM_DMA_fifo_empty,
1097 fifo_empty => FSM_DMA_fifo_empty,
1095 fifo_empty_threshold => FSM_DMA_fifo_empty_threshold,
1098 fifo_empty_threshold => FSM_DMA_fifo_empty_threshold,
1096 fifo_ren => FSM_DMA_fifo_ren,
1099 fifo_ren => FSM_DMA_fifo_ren,
1097
1100
1098 dma_fifo_valid_burst => dma_fifo_burst_valid,
1101 dma_fifo_valid_burst => dma_fifo_burst_valid,
1099 dma_fifo_data => dma_fifo_data,
1102 dma_fifo_data => dma_fifo_data,
1100 dma_fifo_ren => dma_fifo_ren,
1103 dma_fifo_ren => dma_fifo_ren,
1101 dma_buffer_new => dma_buffer_new,
1104 dma_buffer_new => dma_buffer_new,
1102 dma_buffer_addr => dma_buffer_addr,
1105 dma_buffer_addr => dma_buffer_addr,
1103 dma_buffer_length => dma_buffer_length,
1106 dma_buffer_length => dma_buffer_length,
1104 dma_buffer_full => dma_buffer_full,
1107 dma_buffer_full => dma_buffer_full,
1105 dma_buffer_full_err => dma_buffer_full_err,
1108 dma_buffer_full_err => dma_buffer_full_err,
1106
1109
1107 status_ready_matrix_f0 => status_ready_matrix_f0,
1110 status_ready_matrix_f0 => status_ready_matrix_f0,
1108 status_ready_matrix_f1 => status_ready_matrix_f1,
1111 status_ready_matrix_f1 => status_ready_matrix_f1,
1109 status_ready_matrix_f2 => status_ready_matrix_f2,
1112 status_ready_matrix_f2 => status_ready_matrix_f2,
1110 addr_matrix_f0 => addr_matrix_f0,
1113 addr_matrix_f0 => addr_matrix_f0,
1111 addr_matrix_f1 => addr_matrix_f1,
1114 addr_matrix_f1 => addr_matrix_f1,
1112 addr_matrix_f2 => addr_matrix_f2,
1115 addr_matrix_f2 => addr_matrix_f2,
1113 length_matrix_f0 => length_matrix_f0,
1116 length_matrix_f0 => length_matrix_f0,
1114 length_matrix_f1 => length_matrix_f1,
1117 length_matrix_f1 => length_matrix_f1,
1115 length_matrix_f2 => length_matrix_f2,
1118 length_matrix_f2 => length_matrix_f2,
1116 ready_matrix_f0 => ready_matrix_f0,
1119 ready_matrix_f0 => ready_matrix_f0,
1117 ready_matrix_f1 => ready_matrix_f1,
1120 ready_matrix_f1 => ready_matrix_f1,
1118 ready_matrix_f2 => ready_matrix_f2,
1121 ready_matrix_f2 => ready_matrix_f2,
1119 matrix_time_f0 => matrix_time_f0,
1122 matrix_time_f0 => matrix_time_f0,
1120 matrix_time_f1 => matrix_time_f1,
1123 matrix_time_f1 => matrix_time_f1,
1121 matrix_time_f2 => matrix_time_f2,
1124 matrix_time_f2 => matrix_time_f2,
1122 error_buffer_full => error_buffer_full);
1125 error_buffer_full => error_buffer_full);
1123
1126
1124
1127
1125
1128
1126
1129
1127
1130
1128 --dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
1131 --dma_fifo_burst_valid: OUT STD_LOGIC; --TODO
1129 --dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1132 --dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1130 --dma_fifo_ren : IN STD_LOGIC; --TODO
1133 --dma_fifo_ren : IN STD_LOGIC; --TODO
1131 --dma_buffer_new : OUT STD_LOGIC; --TODO
1134 --dma_buffer_new : OUT STD_LOGIC; --TODO
1132 --dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1135 --dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); --TODO
1133 --dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
1136 --dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0); --TODO
1134 --dma_buffer_full : IN STD_LOGIC; --TODO
1137 --dma_buffer_full : IN STD_LOGIC; --TODO
1135 --dma_buffer_full_err : IN STD_LOGIC; --TODO
1138 --dma_buffer_full_err : IN STD_LOGIC; --TODO
1136
1139
1137 ---- Reg out
1140 ---- Reg out
1138 --ready_matrix_f0 : OUT STD_LOGIC; -- TODO
1141 --ready_matrix_f0 : OUT STD_LOGIC; -- TODO
1139 --ready_matrix_f1 : OUT STD_LOGIC; -- TODO
1142 --ready_matrix_f1 : OUT STD_LOGIC; -- TODO
1140 --ready_matrix_f2 : OUT STD_LOGIC; -- TODO
1143 --ready_matrix_f2 : OUT STD_LOGIC; -- TODO
1141 --error_bad_component_error : OUT STD_LOGIC; -- TODO
1144 --error_bad_component_error : OUT STD_LOGIC; -- TODO
1142 --error_buffer_full : OUT STD_LOGIC; -- TODO
1145 --error_buffer_full : OUT STD_LOGIC; -- TODO
1143
1146
1144 ---- Reg In
1147 ---- Reg In
1145 --status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
1148 --status_ready_matrix_f0 : IN STD_LOGIC; -- TODO
1146 --status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
1149 --status_ready_matrix_f1 : IN STD_LOGIC; -- TODO
1147 --status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
1150 --status_ready_matrix_f2 : IN STD_LOGIC; -- TODO
1148
1151
1149 --addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1152 --addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1150 --addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1153 --addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1151 --addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1154 --addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0); -- TODO
1152
1155
1153 --matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1156 --matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1154 --matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1157 --matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0); -- TODO
1155 --matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0) -- TODO
1158 --matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0) -- TODO
1156 -----------------------------------------------------------------------------
1159 -----------------------------------------------------------------------------
1157
1160
1158 -----------------------------------------------------------------------------
1161 -----------------------------------------------------------------------------
1159 --lpp_lfr_ms_fsmdma_1 : lpp_lfr_ms_fsmdma
1162 --lpp_lfr_ms_fsmdma_1 : lpp_lfr_ms_fsmdma
1160 -- PORT MAP (
1163 -- PORT MAP (
1161 -- HCLK => clk,
1164 -- HCLK => clk,
1162 -- HRESETn => rstn,
1165 -- HRESETn => rstn,
1163
1166
1164 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1167 -- fifo_matrix_type => FSM_DMA_fifo_status(5 DOWNTO 4),
1165 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0),
1168 -- fifo_matrix_component => FSM_DMA_fifo_status(3 DOWNTO 0),
1166 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1169 -- fifo_matrix_time => FSM_DMA_fifo_status(53 DOWNTO 6),
1167 -- fifo_data => FSM_DMA_fifo_data,
1170 -- fifo_data => FSM_DMA_fifo_data,
1168 -- fifo_empty => FSM_DMA_fifo_empty,
1171 -- fifo_empty => FSM_DMA_fifo_empty,
1169 -- fifo_ren => FSM_DMA_fifo_ren,
1172 -- fifo_ren => FSM_DMA_fifo_ren,
1170
1173
1171 -- dma_addr => dma_addr,
1174 -- dma_addr => dma_addr,
1172 -- dma_data => dma_data,
1175 -- dma_data => dma_data,
1173 -- dma_valid => dma_valid,
1176 -- dma_valid => dma_valid,
1174 -- dma_valid_burst => dma_valid_burst,
1177 -- dma_valid_burst => dma_valid_burst,
1175 -- dma_ren => dma_ren,
1178 -- dma_ren => dma_ren,
1176 -- dma_done => dma_done,
1179 -- dma_done => dma_done,
1177
1180
1178 -- ready_matrix_f0 => ready_matrix_f0,
1181 -- ready_matrix_f0 => ready_matrix_f0,
1179 -- ready_matrix_f1 => ready_matrix_f1,
1182 -- ready_matrix_f1 => ready_matrix_f1,
1180 -- ready_matrix_f2 => ready_matrix_f2,
1183 -- ready_matrix_f2 => ready_matrix_f2,
1181
1184
1182 -- error_bad_component_error => error_bad_component_error,
1185 -- error_bad_component_error => error_bad_component_error,
1183 -- error_buffer_full => error_buffer_full,
1186 -- error_buffer_full => error_buffer_full,
1184
1187
1185 -- debug_reg => debug_reg,
1188 -- debug_reg => debug_reg,
1186 -- status_ready_matrix_f0 => status_ready_matrix_f0,
1189 -- status_ready_matrix_f0 => status_ready_matrix_f0,
1187 -- status_ready_matrix_f1 => status_ready_matrix_f1,
1190 -- status_ready_matrix_f1 => status_ready_matrix_f1,
1188 -- status_ready_matrix_f2 => status_ready_matrix_f2,
1191 -- status_ready_matrix_f2 => status_ready_matrix_f2,
1189
1192
1190 -- config_active_interruption_onNewMatrix => config_active_interruption_onNewMatrix,
1193 -- config_active_interruption_onNewMatrix => config_active_interruption_onNewMatrix,
1191 -- config_active_interruption_onError => config_active_interruption_onError,
1194 -- config_active_interruption_onError => config_active_interruption_onError,
1192
1195
1193 -- addr_matrix_f0 => addr_matrix_f0,
1196 -- addr_matrix_f0 => addr_matrix_f0,
1194 -- addr_matrix_f1 => addr_matrix_f1,
1197 -- addr_matrix_f1 => addr_matrix_f1,
1195 -- addr_matrix_f2 => addr_matrix_f2,
1198 -- addr_matrix_f2 => addr_matrix_f2,
1196
1199
1197 -- matrix_time_f0 => matrix_time_f0,
1200 -- matrix_time_f0 => matrix_time_f0,
1198 -- matrix_time_f1 => matrix_time_f1,
1201 -- matrix_time_f1 => matrix_time_f1,
1199 -- matrix_time_f2 => matrix_time_f2
1202 -- matrix_time_f2 => matrix_time_f2
1200 -- );
1203 -- );
1201 -----------------------------------------------------------------------------
1204 -----------------------------------------------------------------------------
1202
1205
1203
1206
1204
1207
1205
1208
1206
1209
1207
1210
1208 -----------------------------------------------------------------------------
1211 -----------------------------------------------------------------------------
1209 -- TIME MANAGMENT
1212 -- TIME MANAGMENT
1210 -----------------------------------------------------------------------------
1213 -----------------------------------------------------------------------------
1211 all_time <= sample_f2_time & sample_f1_time & sample_f0_time & sample_f0_time;
1214 all_time <= sample_f2_time & sample_f1_time & sample_f0_time & sample_f0_time;
1212 --all_time <= coarse_time & fine_time;
1215 --all_time <= coarse_time & fine_time;
1213 --
1216 --
1214 f_empty(0) <= '1' WHEN sample_f0_A_empty = "11111" ELSE '0';
1217 f_empty(0) <= '1' WHEN sample_f0_A_empty = "11111" ELSE '0';
1215 f_empty(1) <= '1' WHEN sample_f0_B_empty = "11111" ELSE '0';
1218 f_empty(1) <= '1' WHEN sample_f0_B_empty = "11111" ELSE '0';
1216 f_empty(2) <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
1219 f_empty(2) <= '1' WHEN sample_f1_empty = "11111" ELSE '0';
1217 f_empty(3) <= '1' WHEN sample_f2_empty = "11111" ELSE '0';
1220 f_empty(3) <= '1' WHEN sample_f2_empty = "11111" ELSE '0';
1218
1221
1219 all_time_reg: FOR I IN 0 TO 3 GENERATE
1222 all_time_reg: FOR I IN 0 TO 3 GENERATE
1220
1223
1221 PROCESS (clk, rstn)
1224 PROCESS (clk, rstn)
1222 BEGIN
1225 BEGIN
1223 IF rstn = '0' THEN
1226 IF rstn = '0' THEN
1224 f_empty_reg(I) <= '1';
1227 f_empty_reg(I) <= '1';
1225 ELSIF clk'event AND clk = '1' THEN
1228 ELSIF clk'event AND clk = '1' THEN
1226 f_empty_reg(I) <= f_empty(I);
1229 f_empty_reg(I) <= f_empty(I);
1227 END IF;
1230 END IF;
1228 END PROCESS;
1231 END PROCESS;
1229
1232
1230 time_update_f(I) <= '1' WHEN f_empty(I) = '0' AND f_empty_reg(I) = '1' ELSE '0';
1233 time_update_f(I) <= '1' WHEN f_empty(I) = '0' AND f_empty_reg(I) = '1' ELSE '0';
1231
1234
1232 s_m_t_m_f0_A : spectral_matrix_time_managment
1235 s_m_t_m_f0_A : spectral_matrix_time_managment
1233 PORT MAP (
1236 PORT MAP (
1234 clk => clk,
1237 clk => clk,
1235 rstn => rstn,
1238 rstn => rstn,
1236 time_in => all_time((I+1)*48-1 DOWNTO I*48),
1239 time_in => all_time((I+1)*48-1 DOWNTO I*48),
1237 update_1 => time_update_f(I),
1240 update_1 => time_update_f(I),
1238 time_out => time_reg_f((I+1)*48-1 DOWNTO I*48)
1241 time_out => time_reg_f((I+1)*48-1 DOWNTO I*48)
1239 );
1242 );
1240
1243
1241 END GENERATE all_time_reg;
1244 END GENERATE all_time_reg;
1242
1245
1243 time_reg_f0_A <= time_reg_f((0+1)*48-1 DOWNTO 0*48);
1246 time_reg_f0_A <= time_reg_f((0+1)*48-1 DOWNTO 0*48);
1244 time_reg_f0_B <= time_reg_f((1+1)*48-1 DOWNTO 1*48);
1247 time_reg_f0_B <= time_reg_f((1+1)*48-1 DOWNTO 1*48);
1245 time_reg_f1 <= time_reg_f((2+1)*48-1 DOWNTO 2*48);
1248 time_reg_f1 <= time_reg_f((2+1)*48-1 DOWNTO 2*48);
1246 time_reg_f2 <= time_reg_f((3+1)*48-1 DOWNTO 3*48);
1249 time_reg_f2 <= time_reg_f((3+1)*48-1 DOWNTO 3*48);
1247
1250
1248 -----------------------------------------------------------------------------
1251 -----------------------------------------------------------------------------
1249
1252
1250 END Behavioral;
1253 END Behavioral;
@@ -1,96 +1,114
1 LIBRARY ieee;
1 LIBRARY ieee;
2 USE ieee.std_logic_1164.ALL;
2 USE ieee.std_logic_1164.ALL;
3
3
4
4
5 LIBRARY lpp;
5 LIBRARY lpp;
6 USE lpp.lpp_memory.ALL;
6 USE lpp.lpp_memory.ALL;
7 USE lpp.iir_filter.ALL;
7 USE lpp.iir_filter.ALL;
8 USE lpp.spectral_matrix_package.ALL;
8 USE lpp.spectral_matrix_package.ALL;
9 USE lpp.lpp_dma_pkg.ALL;
9 USE lpp.lpp_dma_pkg.ALL;
10 USE lpp.lpp_Header.ALL;
10 USE lpp.lpp_Header.ALL;
11 USE lpp.lpp_matrix.ALL;
11 USE lpp.lpp_matrix.ALL;
12 USE lpp.lpp_matrix.ALL;
12 USE lpp.lpp_matrix.ALL;
13 USE lpp.lpp_lfr_pkg.ALL;
13 USE lpp.lpp_lfr_pkg.ALL;
14 USE lpp.lpp_fft.ALL;
14 USE lpp.lpp_fft.ALL;
15 USE lpp.fft_components.ALL;
15 USE lpp.fft_components.ALL;
16 USE lpp.window_function_pkg.ALL;
16 USE lpp.window_function_pkg.ALL;
17
17
18 ENTITY lpp_lfr_ms_FFT IS
18 ENTITY lpp_lfr_ms_FFT IS
19 GENERIC (
20 WINDOWS_HAANNING_PARAM_SIZE : INTEGER := 15
21 );
22
19 PORT (
23 PORT (
20 clk : IN STD_LOGIC;
24 clk : IN STD_LOGIC;
21 rstn : IN STD_LOGIC;
25 rstn : IN STD_LOGIC;
22 -- IN
26 -- IN
23 sample_valid : IN STD_LOGIC;
27 sample_valid : IN STD_LOGIC;
24 fft_read : IN STD_LOGIC;
28 fft_read : IN STD_LOGIC;
25 sample_data : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
29 sample_data : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
26 sample_load : OUT STD_LOGIC;
30 sample_load : OUT STD_LOGIC;
27
31
28 --OUT
32 --OUT
29 fft_pong : OUT STD_LOGIC;
33 fft_pong : OUT STD_LOGIC;
30 fft_data_im : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
34 fft_data_im : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
31 fft_data_re : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
35 fft_data_re : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
32 fft_data_valid : OUT STD_LOGIC;
36 fft_data_valid : OUT STD_LOGIC;
33 fft_ready : OUT STD_LOGIC
37 fft_ready : OUT STD_LOGIC
34
38
35 );
39 );
36 END;
40 END;
37
41
38 ARCHITECTURE Behavioral OF lpp_lfr_ms_FFT IS
42 ARCHITECTURE Behavioral OF lpp_lfr_ms_FFT IS
39
43
40 SIGNAL data_win : STD_LOGIC_VECTOR(15 DOWNTO 0);
44 SIGNAL data_win : STD_LOGIC_VECTOR(15 DOWNTO 0);
41 SIGNAL data_win_valid : STD_LOGIC;
45 SIGNAL data_win_valid : STD_LOGIC;
42
46
47 SIGNAL data_in_reg : STD_LOGIC_VECTOR(15 DOWNTO 0);
48 SIGNAL data_in_reg_valid : STD_LOGIC;
49
43 BEGIN
50 BEGIN
44
51
52 PROCESS (clk, rstn)
53 BEGIN -- PROCESS
54 IF rstn = '0' THEN -- asynchronous reset (active low)
55 data_in_reg <= (OTHERS => '0');
56 data_in_reg_valid <= '0';
57 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
58 data_in_reg <= sample_data;
59 data_in_reg_valid <= sample_valid;
60 END IF;
61 END PROCESS;
62
45 window_hanning: window_function
63 window_hanning: window_function
46 GENERIC MAP (
64 GENERIC MAP (
47 SIZE_DATA => 16,
65 SIZE_DATA => 16,
48 SIZE_PARAM => 15,
66 SIZE_PARAM => WINDOWS_HAANNING_PARAM_SIZE,
49 NB_POINT_BY_WINDOW => 256)
67 NB_POINT_BY_WINDOW => 256)
50 PORT MAP (
68 PORT MAP (
51 clk => clk,
69 clk => clk,
52 rstn => rstn,
70 rstn => rstn,
53
71
54 restart_window => '0',
72 restart_window => '0',
55 data_in => sample_data,
73 data_in => data_in_reg,
56 data_in_valid => sample_valid,
74 data_in_valid => data_in_reg_valid,
57
75
58 data_out => data_win,
76 data_out => data_win,
59 data_out_valid => data_win_valid);
77 data_out_valid => data_win_valid);
60
78
61 -----------------------------------------------------------------------------
79 -----------------------------------------------------------------------------
62 -- FFT
80 -- FFT
63 -----------------------------------------------------------------------------
81 -----------------------------------------------------------------------------
64 CoreFFT_1 : CoreFFT
82 CoreFFT_1 : CoreFFT
65 GENERIC MAP (
83 GENERIC MAP (
66 LOGPTS => gLOGPTS,
84 LOGPTS => gLOGPTS,
67 LOGLOGPTS => gLOGLOGPTS,
85 LOGLOGPTS => gLOGLOGPTS,
68 WSIZE => gWSIZE,
86 WSIZE => gWSIZE,
69 TWIDTH => gTWIDTH,
87 TWIDTH => gTWIDTH,
70 DWIDTH => gDWIDTH,
88 DWIDTH => gDWIDTH,
71 TDWIDTH => gTDWIDTH,
89 TDWIDTH => gTDWIDTH,
72 RND_MODE => gRND_MODE,
90 RND_MODE => gRND_MODE,
73 SCALE_MODE => gSCALE_MODE,
91 SCALE_MODE => gSCALE_MODE,
74 PTS => gPTS,
92 PTS => gPTS,
75 HALFPTS => gHALFPTS,
93 HALFPTS => gHALFPTS,
76 inBuf_RWDLY => gInBuf_RWDLY)
94 inBuf_RWDLY => gInBuf_RWDLY)
77 PORT MAP (
95 PORT MAP (
78 clk => clk,
96 clk => clk,
79 ifiStart => '0', -- '1'
97 ifiStart => '0', -- '1'
80 ifiNreset => rstn,
98 ifiNreset => rstn,
81
99
82 ifiD_valid => data_win_valid, -- IN
100 ifiD_valid => data_win_valid, -- IN
83 ifiRead_y => fft_read,
101 ifiRead_y => fft_read,
84 ifiD_im => (OTHERS => '0'), -- IN
102 ifiD_im => (OTHERS => '0'), -- IN
85 ifiD_re => data_win, -- IN
103 ifiD_re => data_win, -- IN
86 ifoLoad => sample_load, -- IN
104 ifoLoad => sample_load, -- IN
87
105
88 ifoPong => fft_pong,
106 ifoPong => fft_pong,
89 ifoY_im => fft_data_im,
107 ifoY_im => fft_data_im,
90 ifoY_re => fft_data_re,
108 ifoY_re => fft_data_re,
91 ifoY_valid => fft_data_valid,
109 ifoY_valid => fft_data_valid,
92 ifoY_rdy => fft_ready);
110 ifoY_rdy => fft_ready);
93
111
94 -----------------------------------------------------------------------------
112 -----------------------------------------------------------------------------
95
113
96 END Behavioral;
114 END Behavioral;
@@ -1,405 +1,412
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 WINDOWS_HAANNING_PARAM_SIZE : INTEGER);
73 PORT (
74 PORT (
74 clk : IN STD_LOGIC;
75 clk : IN STD_LOGIC;
75 rstn : IN STD_LOGIC;
76 rstn : IN STD_LOGIC;
76 run : IN STD_LOGIC;
77 run : IN STD_LOGIC;
77 start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
78 start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0);
78 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
79 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
79 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
80 sample_f0_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
80 sample_f0_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
81 sample_f0_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
81 sample_f0_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
82 sample_f0_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
82 sample_f1_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
83 sample_f1_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
83 sample_f1_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
84 sample_f1_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
84 sample_f1_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
85 sample_f1_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
85 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
86 sample_f2_wen : IN STD_LOGIC_VECTOR(4 DOWNTO 0);
86 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
87 sample_f2_wdata : IN STD_LOGIC_VECTOR((5*16)-1 DOWNTO 0);
87 sample_f2_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
88 sample_f2_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
88 dma_fifo_burst_valid : OUT STD_LOGIC;
89 dma_fifo_burst_valid : OUT STD_LOGIC;
89 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
90 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
90 dma_fifo_ren : IN STD_LOGIC;
91 dma_fifo_ren : IN STD_LOGIC;
91 dma_buffer_new : OUT STD_LOGIC;
92 dma_buffer_new : OUT STD_LOGIC;
92 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
93 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
93 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
94 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
94 dma_buffer_full : IN STD_LOGIC;
95 dma_buffer_full : IN STD_LOGIC;
95 dma_buffer_full_err : IN STD_LOGIC;
96 dma_buffer_full_err : IN STD_LOGIC;
96 ready_matrix_f0 : OUT STD_LOGIC;
97 ready_matrix_f0 : OUT STD_LOGIC;
97 ready_matrix_f1 : OUT STD_LOGIC;
98 ready_matrix_f1 : OUT STD_LOGIC;
98 ready_matrix_f2 : OUT STD_LOGIC;
99 ready_matrix_f2 : OUT STD_LOGIC;
99 error_buffer_full : OUT STD_LOGIC;
100 error_buffer_full : OUT STD_LOGIC;
100 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
101 error_input_fifo_write : OUT STD_LOGIC_VECTOR(2 DOWNTO 0);
101 status_ready_matrix_f0 : IN STD_LOGIC;
102 status_ready_matrix_f0 : IN STD_LOGIC;
102 status_ready_matrix_f1 : IN STD_LOGIC;
103 status_ready_matrix_f1 : IN STD_LOGIC;
103 status_ready_matrix_f2 : IN STD_LOGIC;
104 status_ready_matrix_f2 : IN STD_LOGIC;
104 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
105 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
105 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
106 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
106 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
107 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
107 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
108 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
108 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
109 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
109 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
110 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
110 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
111 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
111 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
112 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
112 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
113 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
113 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0));
114 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0));
114 END COMPONENT;
115 END COMPONENT;
115
116
116 COMPONENT lpp_lfr_ms_fsmdma
117 COMPONENT lpp_lfr_ms_fsmdma
117 PORT (
118 PORT (
118 clk : IN STD_ULOGIC;
119 clk : IN STD_ULOGIC;
119 rstn : IN STD_ULOGIC;
120 rstn : IN STD_ULOGIC;
120 run : IN STD_LOGIC;
121 run : IN STD_LOGIC;
121 fifo_matrix_type : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
122 fifo_matrix_type : IN STD_LOGIC_VECTOR(1 DOWNTO 0);
122 fifo_matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
123 fifo_matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
123 fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
124 fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
124 fifo_empty : IN STD_LOGIC;
125 fifo_empty : IN STD_LOGIC;
125 fifo_empty_threshold : IN STD_LOGIC;
126 fifo_empty_threshold : IN STD_LOGIC;
126 fifo_ren : OUT STD_LOGIC;
127 fifo_ren : OUT STD_LOGIC;
127 dma_fifo_valid_burst : OUT STD_LOGIC;
128 dma_fifo_valid_burst : OUT STD_LOGIC;
128 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
129 dma_fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
129 dma_fifo_ren : IN STD_LOGIC;
130 dma_fifo_ren : IN STD_LOGIC;
130 dma_buffer_new : OUT STD_LOGIC;
131 dma_buffer_new : OUT STD_LOGIC;
131 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
132 dma_buffer_addr : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
132 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
133 dma_buffer_length : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
133 dma_buffer_full : IN STD_LOGIC;
134 dma_buffer_full : IN STD_LOGIC;
134 dma_buffer_full_err : IN STD_LOGIC;
135 dma_buffer_full_err : IN STD_LOGIC;
135 status_ready_matrix_f0 : IN STD_LOGIC;
136 status_ready_matrix_f0 : IN STD_LOGIC;
136 status_ready_matrix_f1 : IN STD_LOGIC;
137 status_ready_matrix_f1 : IN STD_LOGIC;
137 status_ready_matrix_f2 : IN STD_LOGIC;
138 status_ready_matrix_f2 : IN STD_LOGIC;
138 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
139 addr_matrix_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
139 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
140 addr_matrix_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
140 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
141 addr_matrix_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
141 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
142 length_matrix_f0 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
142 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
143 length_matrix_f1 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
143 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
144 length_matrix_f2 : IN STD_LOGIC_VECTOR(25 DOWNTO 0);
144 ready_matrix_f0 : OUT STD_LOGIC;
145 ready_matrix_f0 : OUT STD_LOGIC;
145 ready_matrix_f1 : OUT STD_LOGIC;
146 ready_matrix_f1 : OUT STD_LOGIC;
146 ready_matrix_f2 : OUT STD_LOGIC;
147 ready_matrix_f2 : OUT STD_LOGIC;
147 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
148 matrix_time_f0 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
148 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
149 matrix_time_f1 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
149 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
150 matrix_time_f2 : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
150 error_buffer_full : OUT STD_LOGIC);
151 error_buffer_full : OUT STD_LOGIC);
151 END COMPONENT;
152 END COMPONENT;
152
153
153 COMPONENT lpp_lfr_ms_FFT
154 COMPONENT lpp_lfr_ms_FFT
155 GENERIC (
156 WINDOWS_HAANNING_PARAM_SIZE : INTEGER);
154 PORT (
157 PORT (
155 clk : IN STD_LOGIC;
158 clk : IN STD_LOGIC;
156 rstn : IN STD_LOGIC;
159 rstn : IN STD_LOGIC;
157 sample_valid : IN STD_LOGIC;
160 sample_valid : IN STD_LOGIC;
158 fft_read : IN STD_LOGIC;
161 fft_read : IN STD_LOGIC;
159 sample_data : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
162 sample_data : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
160 sample_load : OUT STD_LOGIC;
163 sample_load : OUT STD_LOGIC;
161 fft_pong : OUT STD_LOGIC;
164 fft_pong : OUT STD_LOGIC;
162 fft_data_im : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
165 fft_data_im : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
163 fft_data_re : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
166 fft_data_re : OUT STD_LOGIC_VECTOR(15 DOWNTO 0);
164 fft_data_valid : OUT STD_LOGIC;
167 fft_data_valid : OUT STD_LOGIC;
165 fft_ready : OUT STD_LOGIC);
168 fft_ready : OUT STD_LOGIC);
166 END COMPONENT;
169 END COMPONENT;
167
170
168 COMPONENT lpp_lfr_filter
171 COMPONENT lpp_lfr_filter
169 GENERIC (
172 GENERIC (
170 Mem_use : INTEGER);
173 Mem_use : INTEGER;
174 RTL_DESIGN_LIGHT : INTEGER
175 );
171 PORT (
176 PORT (
172 sample : IN Samples(7 DOWNTO 0);
177 sample : IN Samples(7 DOWNTO 0);
173 sample_val : IN STD_LOGIC;
178 sample_val : IN STD_LOGIC;
174 sample_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
179 sample_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
175 clk : IN STD_LOGIC;
180 clk : IN STD_LOGIC;
176 rstn : IN STD_LOGIC;
181 rstn : IN STD_LOGIC;
177 data_shaping_SP0 : IN STD_LOGIC;
182 data_shaping_SP0 : IN STD_LOGIC;
178 data_shaping_SP1 : IN STD_LOGIC;
183 data_shaping_SP1 : IN STD_LOGIC;
179 data_shaping_R0 : IN STD_LOGIC;
184 data_shaping_R0 : IN STD_LOGIC;
180 data_shaping_R1 : IN STD_LOGIC;
185 data_shaping_R1 : IN STD_LOGIC;
181 data_shaping_R2 : IN STD_LOGIC;
186 data_shaping_R2 : IN STD_LOGIC;
182 sample_f0_val : OUT STD_LOGIC;
187 sample_f0_val : OUT STD_LOGIC;
183 sample_f1_val : OUT STD_LOGIC;
188 sample_f1_val : OUT STD_LOGIC;
184 sample_f2_val : OUT STD_LOGIC;
189 sample_f2_val : OUT STD_LOGIC;
185 sample_f3_val : OUT STD_LOGIC;
190 sample_f3_val : OUT STD_LOGIC;
186 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
191 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
187 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
192 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
188 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
193 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
189 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
194 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
190 sample_f0_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
195 sample_f0_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
191 sample_f1_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
196 sample_f1_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
192 sample_f2_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
197 sample_f2_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
193 sample_f3_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0)
198 sample_f3_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0)
194 );
199 );
195 END COMPONENT;
200 END COMPONENT;
196
201
197 COMPONENT lpp_lfr
202 COMPONENT lpp_lfr
198 GENERIC (
203 GENERIC (
199 Mem_use : INTEGER;
204 Mem_use : INTEGER;
200 tech : INTEGER;
205 tech : INTEGER;
201 nb_data_by_buffer_size : INTEGER;
206 nb_data_by_buffer_size : INTEGER;
202 -- nb_word_by_buffer_size : INTEGER;
207 -- nb_word_by_buffer_size : INTEGER;
203 nb_snapshot_param_size : INTEGER;
208 nb_snapshot_param_size : INTEGER;
204 delta_vector_size : INTEGER;
209 delta_vector_size : INTEGER;
205 delta_vector_size_f0_2 : INTEGER;
210 delta_vector_size_f0_2 : INTEGER;
206 pindex : INTEGER;
211 pindex : INTEGER;
207 paddr : INTEGER;
212 paddr : INTEGER;
208 pmask : INTEGER;
213 pmask : INTEGER;
209 pirq_ms : INTEGER;
214 pirq_ms : INTEGER;
210 pirq_wfp : INTEGER;
215 pirq_wfp : INTEGER;
211 hindex : INTEGER;
216 hindex : INTEGER;
212 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0);
217 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0);
213 DEBUG_FORCE_DATA_DMA : INTEGER
218 DEBUG_FORCE_DATA_DMA : INTEGER;
219 RTL_DESIGN_LIGHT : INTEGER;
220 WINDOWS_HAANNING_PARAM_SIZE : INTEGER
214 );
221 );
215 PORT (
222 PORT (
216 clk : IN STD_LOGIC;
223 clk : IN STD_LOGIC;
217 rstn : IN STD_LOGIC;
224 rstn : IN STD_LOGIC;
218 sample_B : IN Samples(2 DOWNTO 0);
225 sample_B : IN Samples(2 DOWNTO 0);
219 sample_E : IN Samples(4 DOWNTO 0);
226 sample_E : IN Samples(4 DOWNTO 0);
220 sample_val : IN STD_LOGIC;
227 sample_val : IN STD_LOGIC;
221 apbi : IN apb_slv_in_type;
228 apbi : IN apb_slv_in_type;
222 apbo : OUT apb_slv_out_type;
229 apbo : OUT apb_slv_out_type;
223 ahbi : IN AHB_Mst_In_Type;
230 ahbi : IN AHB_Mst_In_Type;
224 ahbo : OUT AHB_Mst_Out_Type;
231 ahbo : OUT AHB_Mst_Out_Type;
225 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
232 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
226 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
233 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
227 data_shaping_BW : OUT STD_LOGIC;
234 data_shaping_BW : OUT STD_LOGIC;
228 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0);
235 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0);
229 debug_vector_ms : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
236 debug_vector_ms : OUT STD_LOGIC_VECTOR(11 DOWNTO 0)
230 );
237 );
231 END COMPONENT;
238 END COMPONENT;
232
239
233 -----------------------------------------------------------------------------
240 -----------------------------------------------------------------------------
234 -- LPP_LFR with only WaveForm Picker (and without Spectral Matrix Sub System)
241 -- LPP_LFR with only WaveForm Picker (and without Spectral Matrix Sub System)
235 -----------------------------------------------------------------------------
242 -----------------------------------------------------------------------------
236 COMPONENT lpp_lfr_WFP_nMS
243 COMPONENT lpp_lfr_WFP_nMS
237 GENERIC (
244 GENERIC (
238 Mem_use : INTEGER;
245 Mem_use : INTEGER;
239 nb_data_by_buffer_size : INTEGER;
246 nb_data_by_buffer_size : INTEGER;
240 nb_word_by_buffer_size : INTEGER;
247 nb_word_by_buffer_size : INTEGER;
241 nb_snapshot_param_size : INTEGER;
248 nb_snapshot_param_size : INTEGER;
242 delta_vector_size : INTEGER;
249 delta_vector_size : INTEGER;
243 delta_vector_size_f0_2 : INTEGER;
250 delta_vector_size_f0_2 : INTEGER;
244 pindex : INTEGER;
251 pindex : INTEGER;
245 paddr : INTEGER;
252 paddr : INTEGER;
246 pmask : INTEGER;
253 pmask : INTEGER;
247 pirq_ms : INTEGER;
254 pirq_ms : INTEGER;
248 pirq_wfp : INTEGER;
255 pirq_wfp : INTEGER;
249 hindex : INTEGER;
256 hindex : INTEGER;
250 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
257 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
251 PORT (
258 PORT (
252 clk : IN STD_LOGIC;
259 clk : IN STD_LOGIC;
253 rstn : IN STD_LOGIC;
260 rstn : IN STD_LOGIC;
254 sample_B : IN Samples(2 DOWNTO 0);
261 sample_B : IN Samples(2 DOWNTO 0);
255 sample_E : IN Samples(4 DOWNTO 0);
262 sample_E : IN Samples(4 DOWNTO 0);
256 sample_val : IN STD_LOGIC;
263 sample_val : IN STD_LOGIC;
257 apbi : IN apb_slv_in_type;
264 apbi : IN apb_slv_in_type;
258 apbo : OUT apb_slv_out_type;
265 apbo : OUT apb_slv_out_type;
259 ahbi : IN AHB_Mst_In_Type;
266 ahbi : IN AHB_Mst_In_Type;
260 ahbo : OUT AHB_Mst_Out_Type;
267 ahbo : OUT AHB_Mst_Out_Type;
261 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
268 coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
262 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
269 fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
263 data_shaping_BW : OUT STD_LOGIC;
270 data_shaping_BW : OUT STD_LOGIC;
264 observation_reg : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
271 observation_reg : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
265 END COMPONENT;
272 END COMPONENT;
266 -----------------------------------------------------------------------------
273 -----------------------------------------------------------------------------
267
274
268 COMPONENT lpp_lfr_apbreg
275 COMPONENT lpp_lfr_apbreg
269 GENERIC (
276 GENERIC (
270 nb_data_by_buffer_size : INTEGER;
277 nb_data_by_buffer_size : INTEGER;
271 nb_snapshot_param_size : INTEGER;
278 nb_snapshot_param_size : INTEGER;
272 delta_vector_size : INTEGER;
279 delta_vector_size : INTEGER;
273 delta_vector_size_f0_2 : INTEGER;
280 delta_vector_size_f0_2 : INTEGER;
274 pindex : INTEGER;
281 pindex : INTEGER;
275 paddr : INTEGER;
282 paddr : INTEGER;
276 pmask : INTEGER;
283 pmask : INTEGER;
277 pirq_ms : INTEGER;
284 pirq_ms : INTEGER;
278 pirq_wfp : INTEGER;
285 pirq_wfp : INTEGER;
279 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
286 top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0));
280 PORT (
287 PORT (
281 HCLK : IN STD_ULOGIC;
288 HCLK : IN STD_ULOGIC;
282 HRESETn : IN STD_ULOGIC;
289 HRESETn : IN STD_ULOGIC;
283 apbi : IN apb_slv_in_type;
290 apbi : IN apb_slv_in_type;
284 apbo : OUT apb_slv_out_type;
291 apbo : OUT apb_slv_out_type;
285 -- run_ms : OUT STD_LOGIC;
292 -- run_ms : OUT STD_LOGIC;
286 ready_matrix_f0 : IN STD_LOGIC;
293 ready_matrix_f0 : IN STD_LOGIC;
287 ready_matrix_f1 : IN STD_LOGIC;
294 ready_matrix_f1 : IN STD_LOGIC;
288 ready_matrix_f2 : IN STD_LOGIC;
295 ready_matrix_f2 : IN STD_LOGIC;
289 error_buffer_full : IN STD_LOGIC;
296 error_buffer_full : IN STD_LOGIC;
290 error_input_fifo_write : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
297 error_input_fifo_write : IN STD_LOGIC_VECTOR(2 DOWNTO 0);
291 status_ready_matrix_f0 : OUT STD_LOGIC;
298 status_ready_matrix_f0 : OUT STD_LOGIC;
292 status_ready_matrix_f1 : OUT STD_LOGIC;
299 status_ready_matrix_f1 : OUT STD_LOGIC;
293 status_ready_matrix_f2 : OUT STD_LOGIC;
300 status_ready_matrix_f2 : OUT STD_LOGIC;
294 addr_matrix_f0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
301 addr_matrix_f0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
295 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
302 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
296 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
303 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
297 length_matrix_f0 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
304 length_matrix_f0 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
298 length_matrix_f1 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
305 length_matrix_f1 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
299 length_matrix_f2 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
306 length_matrix_f2 : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
300 matrix_time_f0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
307 matrix_time_f0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
301 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
308 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
302 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
309 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
303 status_new_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
310 status_new_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
304 data_shaping_BW : OUT STD_LOGIC;
311 data_shaping_BW : OUT STD_LOGIC;
305 data_shaping_SP0 : OUT STD_LOGIC;
312 data_shaping_SP0 : OUT STD_LOGIC;
306 data_shaping_SP1 : OUT STD_LOGIC;
313 data_shaping_SP1 : OUT STD_LOGIC;
307 data_shaping_R0 : OUT STD_LOGIC;
314 data_shaping_R0 : OUT STD_LOGIC;
308 data_shaping_R1 : OUT STD_LOGIC;
315 data_shaping_R1 : OUT STD_LOGIC;
309 data_shaping_R2 : OUT STD_LOGIC;
316 data_shaping_R2 : OUT STD_LOGIC;
310 delta_snapshot : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
317 delta_snapshot : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
311 delta_f0 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
318 delta_f0 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
312 delta_f0_2 : OUT STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
319 delta_f0_2 : OUT STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0);
313 delta_f1 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
320 delta_f1 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
314 delta_f2 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
321 delta_f2 : OUT STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0);
315 nb_data_by_buffer : OUT STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
322 nb_data_by_buffer : OUT STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0);
316 nb_snapshot_param : OUT STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
323 nb_snapshot_param : OUT STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
317 enable_f0 : OUT STD_LOGIC;
324 enable_f0 : OUT STD_LOGIC;
318 enable_f1 : OUT STD_LOGIC;
325 enable_f1 : OUT STD_LOGIC;
319 enable_f2 : OUT STD_LOGIC;
326 enable_f2 : OUT STD_LOGIC;
320 enable_f3 : OUT STD_LOGIC;
327 enable_f3 : OUT STD_LOGIC;
321 burst_f0 : OUT STD_LOGIC;
328 burst_f0 : OUT STD_LOGIC;
322 burst_f1 : OUT STD_LOGIC;
329 burst_f1 : OUT STD_LOGIC;
323 burst_f2 : OUT STD_LOGIC;
330 burst_f2 : OUT STD_LOGIC;
324 run : OUT STD_LOGIC;
331 run : OUT STD_LOGIC;
325 start_date : OUT STD_LOGIC_VECTOR(30 DOWNTO 0);
332 start_date : OUT STD_LOGIC_VECTOR(30 DOWNTO 0);
326 wfp_status_buffer_ready : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
333 wfp_status_buffer_ready : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
327 wfp_addr_buffer : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
334 wfp_addr_buffer : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0);
328 wfp_length_buffer : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
335 wfp_length_buffer : OUT STD_LOGIC_VECTOR(25 DOWNTO 0);
329 wfp_ready_buffer : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
336 wfp_ready_buffer : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
330 wfp_buffer_time : IN STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
337 wfp_buffer_time : IN STD_LOGIC_VECTOR(48*4-1 DOWNTO 0);
331 wfp_error_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
338 wfp_error_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
332 sample_f3_v : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
339 sample_f3_v : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
333 sample_f3_e1 : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
340 sample_f3_e1 : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
334 sample_f3_e2 : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
341 sample_f3_e2 : IN STD_LOGIC_VECTOR(15 DOWNTO 0);
335 sample_f3_valid : IN STD_LOGIC;
342 sample_f3_valid : IN STD_LOGIC;
336 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0));
343 debug_vector : OUT STD_LOGIC_VECTOR(11 DOWNTO 0));
337 END COMPONENT;
344 END COMPONENT;
338
345
339 COMPONENT lpp_top_ms
346 COMPONENT lpp_top_ms
340 GENERIC (
347 GENERIC (
341 Mem_use : INTEGER;
348 Mem_use : INTEGER;
342 nb_burst_available_size : INTEGER;
349 nb_burst_available_size : INTEGER;
343 nb_snapshot_param_size : INTEGER;
350 nb_snapshot_param_size : INTEGER;
344 delta_snapshot_size : INTEGER;
351 delta_snapshot_size : INTEGER;
345 delta_f2_f0_size : INTEGER;
352 delta_f2_f0_size : INTEGER;
346 delta_f2_f1_size : INTEGER;
353 delta_f2_f1_size : INTEGER;
347 pindex : INTEGER;
354 pindex : INTEGER;
348 paddr : INTEGER;
355 paddr : INTEGER;
349 pmask : INTEGER;
356 pmask : INTEGER;
350 pirq_ms : INTEGER;
357 pirq_ms : INTEGER;
351 pirq_wfp : INTEGER;
358 pirq_wfp : INTEGER;
352 hindex_wfp : INTEGER;
359 hindex_wfp : INTEGER;
353 hindex_ms : INTEGER);
360 hindex_ms : INTEGER);
354 PORT (
361 PORT (
355 clk : IN STD_LOGIC;
362 clk : IN STD_LOGIC;
356 rstn : IN STD_LOGIC;
363 rstn : IN STD_LOGIC;
357 sample_B : IN Samples14v(2 DOWNTO 0);
364 sample_B : IN Samples14v(2 DOWNTO 0);
358 sample_E : IN Samples14v(4 DOWNTO 0);
365 sample_E : IN Samples14v(4 DOWNTO 0);
359 sample_val : IN STD_LOGIC;
366 sample_val : IN STD_LOGIC;
360 apbi : IN apb_slv_in_type;
367 apbi : IN apb_slv_in_type;
361 apbo : OUT apb_slv_out_type;
368 apbo : OUT apb_slv_out_type;
362 ahbi_ms : IN AHB_Mst_In_Type;
369 ahbi_ms : IN AHB_Mst_In_Type;
363 ahbo_ms : OUT AHB_Mst_Out_Type;
370 ahbo_ms : OUT AHB_Mst_Out_Type;
364 data_shaping_BW : OUT STD_LOGIC;
371 data_shaping_BW : OUT STD_LOGIC;
365 matrix_time_f0_0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
372 matrix_time_f0_0 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
366 matrix_time_f0_1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
373 matrix_time_f0_1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
367 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
374 matrix_time_f1 : IN STD_LOGIC_VECTOR(47 DOWNTO 0);
368 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0)
375 matrix_time_f2 : IN STD_LOGIC_VECTOR(47 DOWNTO 0)
369 );
376 );
370 END COMPONENT;
377 END COMPONENT;
371
378
372 COMPONENT lpp_apbreg_ms_pointer
379 COMPONENT lpp_apbreg_ms_pointer
373 PORT (
380 PORT (
374 clk : IN STD_LOGIC;
381 clk : IN STD_LOGIC;
375 rstn : IN STD_LOGIC;
382 rstn : IN STD_LOGIC;
376 run : IN STD_LOGIC;
383 run : IN STD_LOGIC;
377 reg0_status_ready_matrix : IN STD_LOGIC;
384 reg0_status_ready_matrix : IN STD_LOGIC;
378 reg0_ready_matrix : OUT STD_LOGIC;
385 reg0_ready_matrix : OUT STD_LOGIC;
379 reg0_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
386 reg0_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
380 reg0_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
387 reg0_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
381 reg1_status_ready_matrix : IN STD_LOGIC;
388 reg1_status_ready_matrix : IN STD_LOGIC;
382 reg1_ready_matrix : OUT STD_LOGIC;
389 reg1_ready_matrix : OUT STD_LOGIC;
383 reg1_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
390 reg1_addr_matrix : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
384 reg1_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
391 reg1_matrix_time : OUT STD_LOGIC_VECTOR(47 DOWNTO 0);
385 ready_matrix : IN STD_LOGIC;
392 ready_matrix : IN STD_LOGIC;
386 status_ready_matrix : OUT STD_LOGIC;
393 status_ready_matrix : OUT STD_LOGIC;
387 addr_matrix : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
394 addr_matrix : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
388 matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0));
395 matrix_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0));
389 END COMPONENT;
396 END COMPONENT;
390
397
391 COMPONENT lpp_lfr_ms_reg_head
398 COMPONENT lpp_lfr_ms_reg_head
392 PORT (
399 PORT (
393 clk : IN STD_LOGIC;
400 clk : IN STD_LOGIC;
394 rstn : IN STD_LOGIC;
401 rstn : IN STD_LOGIC;
395 in_wen : IN STD_LOGIC;
402 in_wen : IN STD_LOGIC;
396 in_data : IN STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
403 in_data : IN STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
397 in_full : IN STD_LOGIC;
404 in_full : IN STD_LOGIC;
398 in_empty : IN STD_LOGIC;
405 in_empty : IN STD_LOGIC;
399 out_write_error : OUT STD_LOGIC;
406 out_write_error : OUT STD_LOGIC;
400 out_wen : OUT STD_LOGIC;
407 out_wen : OUT STD_LOGIC;
401 out_data : OUT STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
408 out_data : OUT STD_LOGIC_VECTOR(5*16-1 DOWNTO 0);
402 out_full : OUT STD_LOGIC);
409 out_full : OUT STD_LOGIC);
403 END COMPONENT;
410 END COMPONENT;
404
411
405 END lpp_lfr_pkg;
412 END lpp_lfr_pkg;
General Comments 0
You need to be logged in to leave comments. Login now