##// END OF EJS Templates
WF picker IP + Reg...
pellion -
r167:7b2690121175 merge JC
parent child
Show More
@@ -0,0 +1,80
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
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
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
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
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
19 -- Author : Martin Morlot
20 -- Mail : martin.morlot@lpp.polytechnique.fr
21 -------------------------------------------------------------------------------
22 library IEEE;
23 use IEEE.numeric_std.all;
24 use IEEE.std_logic_1164.all;
25
26 entity ReUse_CTRLR is
27 port(
28 clk : in std_logic;
29 reset : in std_logic;
30
31 SetReUse : in std_logic_vector(4 downto 0);
32 Statu : in std_logic_vector(3 downto 0);
33
34 ReUse : out std_logic_vector(4 downto 0)
35 );
36 end entity;
37
38
39 architecture ar_ReUse_CTRLR of ReUse_CTRLR is
40
41 signal ResetReUse : std_logic_vector(4 downto 0);
42 signal MatrixParam : integer;
43 signal MatrixParam_Reg : integer;
44
45 begin
46
47
48
49 process (clk,reset)
50 -- variable MatrixParam : integer;
51 begin
52 -- MatrixParam := to_integer(unsigned(Statu));
53
54 if(reset='0')then
55 ResetReUse <= (others => '1');
56 MatrixParam_Reg <= 0;
57
58
59 elsif(clk' event and clk='1')then
60 MatrixParam_Reg <= MatrixParam;
61
62 if(MatrixParam_Reg = 7 and MatrixParam = 8)then -- On videra FIFO(B1) a sa derni�re utilisation PARAM = 11
63 ResetReUse(0) <= '0';
64 elsif(MatrixParam_Reg = 8 and MatrixParam = 9)then -- On videra FIFO(B2) a sa derni�re utilisation PARAM = 12
65 ResetReUse(1) <= '0';
66 elsif(MatrixParam_Reg = 9 and MatrixParam = 10)then -- On videra FIFO(B3) a sa derni�re utilisation PARAM = 13
67 ResetReUse(2) <= '0';
68 elsif(MatrixParam_Reg = 10 and MatrixParam = 11)then -- On videra FIFO(E1) a sa derni�re utilisation PARAM = 14
69 ResetReUse(3) <= '0';
70 elsif(MatrixParam_Reg = 14 and MatrixParam = 15)then -- On videra FIFO(E2) a sa derni�re utilisation PARAM = 15
71 ResetReUse(4) <= '0';
72 end if;
73
74 end if;
75 end process;
76
77 MatrixParam <= to_integer(unsigned(Statu));
78 ReUse <= SetReUse and ResetReUse;
79
80 end architecture; No newline at end of file
@@ -0,0 +1,243
1 LIBRARY ieee;
2 USE ieee.std_logic_1164.ALL;
3 USE ieee.numeric_std.ALL;
4
5 LIBRARY lpp;
6 USE lpp.lpp_ad_conv.ALL;
7 USE lpp.iir_filter.ALL;
8 USE lpp.FILTERcfg.ALL;
9 USE lpp.lpp_memory.ALL;
10 USE lpp.lpp_waveform_pkg.ALL;
11 USE lpp.lpp_top_lfr_pkg.ALL;
12
13 LIBRARY techmap;
14 USE techmap.gencomp.ALL;
15
16 LIBRARY grlib;
17 USE grlib.amba.ALL;
18 USE grlib.stdlib.ALL;
19 USE grlib.devices.ALL;
20 USE GRLIB.DMA2AHB_Package.ALL;
21
22 ENTITY lpp_top_lfr_wf_picker IS
23 GENERIC (
24 hindex : INTEGER := 2;
25 pindex : INTEGER := 4;
26 paddr : INTEGER := 4;
27 pmask : INTEGER := 16#fff#;
28 pirq : INTEGER := 0;
29 tech : INTEGER := 0;
30 nb_burst_available_size : INTEGER := 11;
31 nb_snapshot_param_size : INTEGER := 11;
32 delta_snapshot_size : INTEGER := 16;
33 delta_f2_f0_size : INTEGER := 10;
34 delta_f2_f1_size : INTEGER := 10
35 );
36 PORT (
37 -- ADS7886
38 cnv_run : IN STD_LOGIC;
39 cnv : OUT STD_LOGIC;
40 sck : OUT STD_LOGIC;
41 sdo : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
42 --
43 cnv_clk : IN STD_LOGIC;
44 cnv_rstn : IN STD_LOGIC;
45
46 -- AMBA AHB system signals
47 HCLK : IN STD_ULOGIC;
48 HRESETn : IN STD_ULOGIC;
49
50 -- AMBA APB Slave Interface
51 apbi : IN apb_slv_in_type;
52 apbo : OUT apb_slv_out_type;
53
54 -- AMBA AHB Master Interface
55 AHB_Master_In : IN AHB_Mst_In_Type;
56 AHB_Master_Out : OUT AHB_Mst_Out_Type;
57
58 --
59 coarse_time_0 : IN STD_LOGIC;
60
61 --
62 data_shaping_BW : OUT STD_LOGIC
63 );
64 END lpp_top_lfr_wf_picker;
65
66 ARCHITECTURE tb OF lpp_top_lfr_wf_picker IS
67
68 SIGNAL ready_matrix_f0_0 : STD_LOGIC;
69 SIGNAL ready_matrix_f0_1 : STD_LOGIC;
70 SIGNAL ready_matrix_f1 : STD_LOGIC;
71 SIGNAL ready_matrix_f2 : STD_LOGIC;
72 SIGNAL error_anticipating_empty_fifo : STD_LOGIC;
73 SIGNAL error_bad_component_error : STD_LOGIC;
74 SIGNAL debug_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
75 SIGNAL status_ready_matrix_f0_0 : STD_LOGIC;
76 SIGNAL status_ready_matrix_f0_1 : STD_LOGIC;
77 SIGNAL status_ready_matrix_f1 : STD_LOGIC;
78 SIGNAL status_ready_matrix_f2 : STD_LOGIC;
79 SIGNAL status_error_anticipating_empty_fifo : STD_LOGIC;
80 SIGNAL status_error_bad_component_error : STD_LOGIC;
81 SIGNAL config_active_interruption_onNewMatrix : STD_LOGIC;
82 SIGNAL config_active_interruption_onError : STD_LOGIC;
83 SIGNAL addr_matrix_f0_0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
84 SIGNAL addr_matrix_f0_1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
85 SIGNAL addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
86 SIGNAL addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
87
88 SIGNAL status_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
89 SIGNAL status_full_ack : STD_LOGIC_VECTOR(3 DOWNTO 0);
90 SIGNAL status_full_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
91 SIGNAL status_new_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
92 SIGNAL data_shaping_SP0 : STD_LOGIC;
93 SIGNAL data_shaping_SP1 : STD_LOGIC;
94 SIGNAL data_shaping_R0 : STD_LOGIC;
95 SIGNAL data_shaping_R1 : STD_LOGIC;
96 SIGNAL delta_snapshot : STD_LOGIC_VECTOR(delta_snapshot_size-1 DOWNTO 0);
97 SIGNAL delta_f2_f1 : STD_LOGIC_VECTOR(delta_f2_f1_size-1 DOWNTO 0);
98 SIGNAL delta_f2_f0 : STD_LOGIC_VECTOR(delta_f2_f0_size-1 DOWNTO 0);
99 SIGNAL nb_burst_available : STD_LOGIC_VECTOR(nb_burst_available_size-1 DOWNTO 0);
100 SIGNAL nb_snapshot_param : STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
101 SIGNAL enable_f0 : STD_LOGIC;
102 SIGNAL enable_f1 : STD_LOGIC;
103 SIGNAL enable_f2 : STD_LOGIC;
104 SIGNAL enable_f3 : STD_LOGIC;
105 SIGNAL burst_f0 : STD_LOGIC;
106 SIGNAL burst_f1 : STD_LOGIC;
107 SIGNAL burst_f2 : STD_LOGIC;
108 SIGNAL addr_data_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
109 SIGNAL addr_data_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
110 SIGNAL addr_data_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
111 SIGNAL addr_data_f3 : STD_LOGIC_VECTOR(31 DOWNTO 0);
112
113 SIGNAL sample_f0_wen : STD_LOGIC_VECTOR(5 DOWNTO 0);
114 SIGNAL sample_f0_wdata : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
115 SIGNAL sample_f1_wen : STD_LOGIC_VECTOR(5 DOWNTO 0);
116 SIGNAL sample_f1_wdata : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
117 SIGNAL sample_f2_wen : STD_LOGIC_VECTOR(5 DOWNTO 0);
118 SIGNAL sample_f2_wdata : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
119 SIGNAL sample_f3_wen : STD_LOGIC_VECTOR(5 DOWNTO 0);
120 SIGNAL sample_f3_wdata : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
121
122
123 BEGIN
124
125 lpp_top_apbreg_1: lpp_top_apbreg
126 GENERIC MAP (
127 nb_burst_available_size => nb_burst_available_size,
128 nb_snapshot_param_size => nb_snapshot_param_size,
129 delta_snapshot_size => delta_snapshot_size,
130 delta_f2_f0_size => delta_f2_f0_size,
131 delta_f2_f1_size => delta_f2_f1_size,
132 pindex => pindex,
133 paddr => paddr,
134 pmask => pmask,
135 pirq => pirq)
136 PORT MAP (
137 HCLK => HCLK,
138 HRESETn => HRESETn,
139 apbi => apbi,
140 apbo => apbo,
141
142 ready_matrix_f0_0 => ready_matrix_f0_0,
143 ready_matrix_f0_1 => ready_matrix_f0_1,
144 ready_matrix_f1 => ready_matrix_f1,
145 ready_matrix_f2 => ready_matrix_f2,
146 error_anticipating_empty_fifo => error_anticipating_empty_fifo,
147 error_bad_component_error => error_bad_component_error,
148 debug_reg => debug_reg,
149 status_ready_matrix_f0_0 => status_ready_matrix_f0_0,
150 status_ready_matrix_f0_1 => status_ready_matrix_f0_1,
151 status_ready_matrix_f1 => status_ready_matrix_f1,
152 status_ready_matrix_f2 => status_ready_matrix_f2,
153 status_error_anticipating_empty_fifo => status_error_anticipating_empty_fifo,
154 status_error_bad_component_error => status_error_bad_component_error,
155 config_active_interruption_onNewMatrix => config_active_interruption_onNewMatrix,
156 config_active_interruption_onError => config_active_interruption_onError,
157 addr_matrix_f0_0 => addr_matrix_f0_0,
158 addr_matrix_f0_1 => addr_matrix_f0_1,
159 addr_matrix_f1 => addr_matrix_f1,
160 addr_matrix_f2 => addr_matrix_f2,
161
162 status_full => status_full,
163 status_full_ack => status_full_ack,
164 status_full_err => status_full_err,
165 status_new_err => status_new_err,
166 data_shaping_BW => data_shaping_BW,
167 data_shaping_SP0 => data_shaping_SP0,
168 data_shaping_SP1 => data_shaping_SP1,
169 data_shaping_R0 => data_shaping_R0,
170 data_shaping_R1 => data_shaping_R1,
171 delta_snapshot => delta_snapshot,
172 delta_f2_f1 => delta_f2_f1,
173 delta_f2_f0 => delta_f2_f0,
174 nb_burst_available => nb_burst_available,
175 nb_snapshot_param => nb_snapshot_param,
176 enable_f0 => enable_f0,
177 enable_f1 => enable_f1,
178 enable_f2 => enable_f2,
179 enable_f3 => enable_f3,
180 burst_f0 => burst_f0,
181 burst_f1 => burst_f1,
182 burst_f2 => burst_f2,
183 addr_data_f0 => addr_data_f0,
184 addr_data_f1 => addr_data_f1,
185 addr_data_f2 => addr_data_f2,
186 addr_data_f3 => addr_data_f3);
187
188 lpp_top_lfr_wf_picker_ip_1: lpp_top_lfr_wf_picker_ip
189 GENERIC MAP (
190 hindex => hindex,
191 nb_burst_available_size => nb_burst_available_size,
192 nb_snapshot_param_size => nb_snapshot_param_size,
193 delta_snapshot_size => delta_snapshot_size,
194 delta_f2_f0_size => delta_f2_f0_size,
195 delta_f2_f1_size => delta_f2_f1_size,
196 tech => tech)
197 PORT MAP (
198 cnv_run => cnv_run,
199 cnv => cnv,
200 sck => sck,
201 sdo => sdo,
202 cnv_clk => cnv_clk,
203 cnv_rstn => cnv_rstn,
204
205 clk => HCLK,
206 rstn => HRESETn,
207
208 sample_f0_wen => sample_f0_wen,
209 sample_f0_wdata => sample_f0_wdata,
210 sample_f1_wen => sample_f1_wen,
211 sample_f1_wdata => sample_f1_wdata,
212 sample_f2_wen => sample_f2_wen,
213 sample_f2_wdata => sample_f2_wdata,
214 sample_f3_wen => sample_f3_wen,
215 sample_f3_wdata => sample_f3_wdata,
216 AHB_Master_In => AHB_Master_In,
217 AHB_Master_Out => AHB_Master_Out,
218 coarse_time_0 => coarse_time_0,
219 data_shaping_SP0 => data_shaping_SP0,
220 data_shaping_SP1 => data_shaping_SP1,
221 data_shaping_R0 => data_shaping_R0,
222 data_shaping_R1 => data_shaping_R1,
223 delta_snapshot => delta_snapshot,
224 delta_f2_f1 => delta_f2_f1,
225 delta_f2_f0 => delta_f2_f0,
226 enable_f0 => enable_f0,
227 enable_f1 => enable_f1,
228 enable_f2 => enable_f2,
229 enable_f3 => enable_f3,
230 burst_f0 => burst_f0,
231 burst_f1 => burst_f1,
232 burst_f2 => burst_f2,
233 nb_burst_available => nb_burst_available,
234 nb_snapshot_param => nb_snapshot_param,
235 status_full => status_full,
236 status_full_ack => status_full_ack,
237 status_full_err => status_full_err,
238 status_new_err => status_new_err,
239 addr_data_f0 => addr_data_f0,
240 addr_data_f1 => addr_data_f1,
241 addr_data_f2 => addr_data_f2,
242 addr_data_f3 => addr_data_f3);
243 END tb;
@@ -0,0 +1,498
1 LIBRARY ieee;
2 USE ieee.std_logic_1164.ALL;
3 USE ieee.numeric_std.ALL;
4
5 LIBRARY lpp;
6 USE lpp.lpp_ad_conv.ALL;
7 USE lpp.iir_filter.ALL;
8 USE lpp.FILTERcfg.ALL;
9 USE lpp.lpp_memory.ALL;
10 USE lpp.lpp_waveform_pkg.ALL;
11
12 LIBRARY techmap;
13 USE techmap.gencomp.ALL;
14
15 LIBRARY grlib;
16 USE grlib.amba.ALL;
17 USE grlib.stdlib.ALL;
18 USE grlib.devices.ALL;
19 USE GRLIB.DMA2AHB_Package.ALL;
20
21 ENTITY lpp_top_lfr_wf_picker_ip IS
22 GENERIC(
23 hindex : INTEGER := 2;
24 nb_burst_available_size : INTEGER := 11;
25 nb_snapshot_param_size : INTEGER := 11;
26 delta_snapshot_size : INTEGER := 16;
27 delta_f2_f0_size : INTEGER := 10;
28 delta_f2_f1_size : INTEGER := 10;
29 tech : INTEGER := 0
30 );
31 PORT (
32 -- ADS7886
33 cnv_run : IN STD_LOGIC;
34 cnv : OUT STD_LOGIC;
35 sck : OUT STD_LOGIC;
36 sdo : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
37 --
38 cnv_clk : IN STD_LOGIC;
39 cnv_rstn : IN STD_LOGIC;
40 --
41 clk : IN STD_LOGIC;
42 rstn : IN STD_LOGIC;
43 --
44 sample_f0_wen : OUT STD_LOGIC_VECTOR(5 DOWNTO 0);
45 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
46 --
47 sample_f1_wen : OUT STD_LOGIC_VECTOR(5 DOWNTO 0);
48 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
49 --
50 sample_f2_wen : OUT STD_LOGIC_VECTOR(5 DOWNTO 0);
51 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
52 --
53 sample_f3_wen : OUT STD_LOGIC_VECTOR(5 DOWNTO 0);
54 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
55
56 -- AMBA AHB Master Interface
57 AHB_Master_In : IN AHB_Mst_In_Type;
58 AHB_Master_Out : OUT AHB_Mst_Out_Type;
59
60 coarse_time_0 : IN STD_LOGIC;
61
62 --config
63 data_shaping_SP0 : IN STD_LOGIC;
64 data_shaping_SP1 : IN STD_LOGIC;
65 data_shaping_R0 : IN STD_LOGIC;
66 data_shaping_R1 : IN STD_LOGIC;
67
68 delta_snapshot : IN STD_LOGIC_VECTOR(delta_snapshot_size-1 DOWNTO 0);
69 delta_f2_f1 : IN STD_LOGIC_VECTOR(delta_f2_f1_size-1 DOWNTO 0);
70 delta_f2_f0 : IN STD_LOGIC_VECTOR(delta_f2_f0_size-1 DOWNTO 0);
71
72 enable_f0 : IN STD_LOGIC;
73 enable_f1 : IN STD_LOGIC;
74 enable_f2 : IN STD_LOGIC;
75 enable_f3 : IN STD_LOGIC;
76
77 burst_f0 : IN STD_LOGIC;
78 burst_f1 : IN STD_LOGIC;
79 burst_f2 : IN STD_LOGIC;
80
81 nb_burst_available : IN STD_LOGIC_VECTOR(nb_burst_available_size-1 DOWNTO 0);
82 nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
83 status_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
84 status_full_ack : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
85 status_full_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
86 status_new_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); -- New data f(i) before the current data is write by dma
87
88 addr_data_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
89 addr_data_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
90 addr_data_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
91 addr_data_f3 : IN STD_LOGIC_VECTOR(31 DOWNTO 0)
92 );
93 END lpp_top_lfr_wf_picker_ip;
94
95 ARCHITECTURE tb OF lpp_top_lfr_wf_picker_ip IS
96
97 COMPONENT Downsampling
98 GENERIC (
99 ChanelCount : INTEGER;
100 SampleSize : INTEGER;
101 DivideParam : INTEGER);
102 PORT (
103 clk : IN STD_LOGIC;
104 rstn : IN STD_LOGIC;
105 sample_in_val : IN STD_LOGIC;
106 sample_in : IN samplT(ChanelCount-1 DOWNTO 0, SampleSize-1 DOWNTO 0);
107 sample_out_val : OUT STD_LOGIC;
108 sample_out : OUT samplT(ChanelCount-1 DOWNTO 0, SampleSize-1 DOWNTO 0));
109 END COMPONENT;
110
111 -----------------------------------------------------------------------------
112 CONSTANT ChanelCount : INTEGER := 8;
113 CONSTANT ncycle_cnv_high : INTEGER := 79;
114 CONSTANT ncycle_cnv : INTEGER := 500;
115
116 -----------------------------------------------------------------------------
117 SIGNAL sample : Samples(ChanelCount-1 DOWNTO 0);
118 SIGNAL sample_val : STD_LOGIC;
119 SIGNAL sample_val_delay : STD_LOGIC;
120 -----------------------------------------------------------------------------
121 CONSTANT Coef_SZ : INTEGER := 9;
122 CONSTANT CoefCntPerCel : INTEGER := 6;
123 CONSTANT CoefPerCel : INTEGER := 5;
124 CONSTANT Cels_count : INTEGER := 5;
125
126 SIGNAL coefs : STD_LOGIC_VECTOR((Coef_SZ*CoefCntPerCel*Cels_count)-1 DOWNTO 0);
127 SIGNAL coefs_v2 : STD_LOGIC_VECTOR((Coef_SZ*CoefPerCel*Cels_count)-1 DOWNTO 0);
128 SIGNAL sample_filter_in : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
129 SIGNAL sample_filter_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
130 --
131 SIGNAL sample_filter_v2_out_val : STD_LOGIC;
132 SIGNAL sample_filter_v2_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
133 -----------------------------------------------------------------------------
134 SIGNAL sample_data_shaping_out_val : STD_LOGIC;
135 SIGNAL sample_data_shaping_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
136 SIGNAL sample_data_shaping_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
137 SIGNAL sample_data_shaping_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
138 SIGNAL sample_data_shaping_f2_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
139 SIGNAL sample_data_shaping_f1_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
140 SIGNAL sample_data_shaping_f2_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
141 -----------------------------------------------------------------------------
142 SIGNAL sample_filter_v2_out_val_s : STD_LOGIC;
143 SIGNAL sample_filter_v2_out_s : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
144 -----------------------------------------------------------------------------
145 SIGNAL sample_f0_val : STD_LOGIC;
146 SIGNAL sample_f0 : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
147 SIGNAL sample_f0_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
148 --
149 SIGNAL sample_f1_val : STD_LOGIC;
150 SIGNAL sample_f1 : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
151 SIGNAL sample_f1_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
152 --
153 SIGNAL sample_f2_val : STD_LOGIC;
154 SIGNAL sample_f2 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
155 --
156 SIGNAL sample_f3_val : STD_LOGIC;
157 SIGNAL sample_f3 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
158
159 -----------------------------------------------------------------------------
160 SIGNAL data_f0_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
161 SIGNAL data_f1_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
162 SIGNAL data_f2_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
163 SIGNAL data_f3_in_valid : STD_LOGIC_VECTOR(159 DOWNTO 0) := (OTHERS => '0');
164 -----------------------------------------------------------------------------
165
166 SIGNAL sample_f0_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
167 SIGNAL sample_f1_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
168 SIGNAL sample_f2_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
169 SIGNAL sample_f3_wdata_s : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
170 BEGIN
171
172 -- component instantiation
173 -----------------------------------------------------------------------------
174 DIGITAL_acquisition : AD7688_drvr
175 GENERIC MAP (
176 ChanelCount => ChanelCount,
177 ncycle_cnv_high => ncycle_cnv_high,
178 ncycle_cnv => ncycle_cnv)
179 PORT MAP (
180 cnv_clk => cnv_clk, --
181 cnv_rstn => cnv_rstn, --
182 cnv_run => cnv_run, --
183 cnv => cnv, --
184 clk => clk, --
185 rstn => rstn, --
186 sck => sck, --
187 sdo => sdo(ChanelCount-1 DOWNTO 0), --
188 sample => sample,
189 sample_val => sample_val);
190
191 -----------------------------------------------------------------------------
192
193 PROCESS (clk, rstn)
194 BEGIN -- PROCESS
195 IF rstn = '0' THEN -- asynchronous reset (active low)
196 sample_val_delay <= '0';
197 ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge
198 sample_val_delay <= sample_val;
199 END IF;
200 END PROCESS;
201
202 -----------------------------------------------------------------------------
203 ChanelLoop : FOR i IN 0 TO ChanelCount-1 GENERATE
204 SampleLoop : FOR j IN 0 TO 15 GENERATE
205 sample_filter_in(i, j) <= sample(i)(j);
206 END GENERATE;
207
208 sample_filter_in(i, 16) <= sample(i)(15);
209 sample_filter_in(i, 17) <= sample(i)(15);
210 END GENERATE;
211
212 coefs_v2 <= CoefsInitValCst_v2;
213
214 IIR_CEL_CTRLR_v2_1 : IIR_CEL_CTRLR_v2
215 GENERIC MAP (
216 tech => 0,
217 Mem_use => use_CEL, -- use_RAM
218 Sample_SZ => 18,
219 Coef_SZ => Coef_SZ,
220 Coef_Nb => 25,
221 Coef_sel_SZ => 5,
222 Cels_count => Cels_count,
223 ChanelsCount => ChanelCount)
224 PORT MAP (
225 rstn => rstn,
226 clk => clk,
227 virg_pos => 7,
228 coefs => coefs_v2,
229 sample_in_val => sample_val_delay,
230 sample_in => sample_filter_in,
231 sample_out_val => sample_filter_v2_out_val,
232 sample_out => sample_filter_v2_out);
233
234 -----------------------------------------------------------------------------
235 -- DATA_SHAPING
236 -----------------------------------------------------------------------------
237 all_data_shaping_in_loop: FOR I IN 17 DOWNTO 0 GENERATE
238 sample_data_shaping_f0_s(I) <= sample_filter_v2_out(0,I);
239 sample_data_shaping_f1_s(I) <= sample_filter_v2_out(1,I);
240 sample_data_shaping_f2_s(I) <= sample_filter_v2_out(2,I);
241 END GENERATE all_data_shaping_in_loop;
242
243 sample_data_shaping_f1_f0_s <= sample_data_shaping_f1_s - sample_data_shaping_f0_s;
244 sample_data_shaping_f2_f1_s <= sample_data_shaping_f2_s - sample_data_shaping_f1_s;
245
246 PROCESS (clk, rstn)
247 BEGIN -- PROCESS
248 IF rstn = '0' THEN -- asynchronous reset (active low)
249 sample_data_shaping_out_val <= '0';
250 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
251 sample_data_shaping_out_val <= sample_filter_v2_out_val;
252 END IF;
253 END PROCESS;
254
255 SampleLoop_data_shaping: FOR j IN 0 TO 17 GENERATE
256 PROCESS (clk, rstn)
257 BEGIN
258 IF rstn = '0' THEN
259 sample_data_shaping_out(0,j) <= '0';
260 sample_data_shaping_out(1,j) <= '0';
261 sample_data_shaping_out(2,j) <= '0';
262 sample_data_shaping_out(3,j) <= '0';
263 sample_data_shaping_out(4,j) <= '0';
264 sample_data_shaping_out(5,j) <= '0';
265 sample_data_shaping_out(6,j) <= '0';
266 sample_data_shaping_out(7,j) <= '0';
267 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
268 sample_data_shaping_out(0,j) <= sample_filter_v2_out(0,j);
269 IF data_shaping_SP0 = '1' THEN
270 sample_data_shaping_out(1,j) <= sample_data_shaping_f1_f0_s(j);
271 ELSE
272 sample_data_shaping_out(1,j) <= sample_filter_v2_out(1,j);
273 END IF;
274 IF data_shaping_SP1 = '1' THEN
275 sample_data_shaping_out(2,j) <= sample_data_shaping_f2_f1_s(j);
276 ELSE
277 sample_data_shaping_out(2,j) <= sample_filter_v2_out(2,j);
278 END IF;
279 sample_data_shaping_out(4,j) <= sample_filter_v2_out(4,j);
280 sample_data_shaping_out(5,j) <= sample_filter_v2_out(5,j);
281 sample_data_shaping_out(6,j) <= sample_filter_v2_out(6,j);
282 sample_data_shaping_out(7,j) <= sample_filter_v2_out(7,j);
283 END IF;
284 END PROCESS;
285 END GENERATE;
286
287 sample_filter_v2_out_val_s <= sample_data_shaping_out_val;
288 ChanelLoopOut : FOR i IN 0 TO 7 GENERATE
289 SampleLoopOut : FOR j IN 0 TO 15 GENERATE
290 sample_filter_v2_out_s(i,j) <= sample_data_shaping_out(i,j);
291 END GENERATE;
292 END GENERATE;
293 -----------------------------------------------------------------------------
294 -- F0 -- @24.576 kHz
295 -----------------------------------------------------------------------------
296 Downsampling_f0 : Downsampling
297 GENERIC MAP (
298 ChanelCount => 8,
299 SampleSize => 16,
300 DivideParam => 4)
301 PORT MAP (
302 clk => clk,
303 rstn => rstn,
304 sample_in_val => sample_filter_v2_out_val_s,
305 sample_in => sample_filter_v2_out_s,
306 sample_out_val => sample_f0_val,
307 sample_out => sample_f0);
308
309 all_bit_sample_f0 : FOR I IN 15 DOWNTO 0 GENERATE
310 sample_f0_wdata_s(I) <= sample_f0(0, I); -- V
311 sample_f0_wdata_s(16*1+I) <= sample_f0(1, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(3, I); -- E1
312 sample_f0_wdata_s(16*2+I) <= sample_f0(2, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(4, I); -- E2
313 sample_f0_wdata_s(16*3+I) <= sample_f0(5, I); -- B1
314 sample_f0_wdata_s(16*4+I) <= sample_f0(6, I); -- B2
315 sample_f0_wdata_s(16*5+I) <= sample_f0(7, I); -- B3
316 END GENERATE all_bit_sample_f0;
317
318 sample_f0_wen <= NOT(sample_f0_val) &
319 NOT(sample_f0_val) &
320 NOT(sample_f0_val) &
321 NOT(sample_f0_val) &
322 NOT(sample_f0_val) &
323 NOT(sample_f0_val);
324
325 -----------------------------------------------------------------------------
326 -- F1 -- @4096 Hz
327 -----------------------------------------------------------------------------
328 Downsampling_f1 : Downsampling
329 GENERIC MAP (
330 ChanelCount => 8,
331 SampleSize => 16,
332 DivideParam => 6)
333 PORT MAP (
334 clk => clk,
335 rstn => rstn,
336 sample_in_val => sample_f0_val ,
337 sample_in => sample_f0,
338 sample_out_val => sample_f1_val,
339 sample_out => sample_f1);
340
341 all_bit_sample_f1 : FOR I IN 15 DOWNTO 0 GENERATE
342 sample_f1_wdata_s(I) <= sample_f1(0, I); -- V
343 sample_f1_wdata_s(16*1+I) <= sample_f1(1, I) WHEN data_shaping_R1 = '1' ELSE sample_f1(3, I); -- E1
344 sample_f1_wdata_s(16*2+I) <= sample_f1(2, I) WHEN data_shaping_R1 = '1' ELSE sample_f1(4, I); -- E2
345 sample_f1_wdata_s(16*3+I) <= sample_f1(5, I); -- B1
346 sample_f1_wdata_s(16*4+I) <= sample_f1(6, I); -- B2
347 sample_f1_wdata_s(16*5+I) <= sample_f1(7, I); -- B3
348 END GENERATE all_bit_sample_f1;
349
350 sample_f1_wen <= NOT(sample_f1_val) &
351 NOT(sample_f1_val) &
352 NOT(sample_f1_val) &
353 NOT(sample_f1_val) &
354 NOT(sample_f1_val) &
355 NOT(sample_f1_val);
356
357 -----------------------------------------------------------------------------
358 -- F2 -- @256 Hz
359 -----------------------------------------------------------------------------
360 all_bit_sample_f0_s : FOR I IN 15 DOWNTO 0 GENERATE
361 sample_f0_s(0, I) <= sample_f0(0, I); -- V
362 sample_f0_s(1, I) <= sample_f0(1, I); -- E1
363 sample_f0_s(2, I) <= sample_f0(2, I); -- E2
364 sample_f0_s(3, I) <= sample_f0(5, I); -- B1
365 sample_f0_s(4, I) <= sample_f0(6, I); -- B2
366 sample_f0_s(5, I) <= sample_f0(7, I); -- B3
367 END GENERATE all_bit_sample_f0_s;
368
369 Downsampling_f2 : Downsampling
370 GENERIC MAP (
371 ChanelCount => 6,
372 SampleSize => 16,
373 DivideParam => 96)
374 PORT MAP (
375 clk => clk,
376 rstn => rstn,
377 sample_in_val => sample_f0_val ,
378 sample_in => sample_f0_s,
379 sample_out_val => sample_f2_val,
380 sample_out => sample_f2);
381
382 sample_f2_wen <= NOT(sample_f2_val) &
383 NOT(sample_f2_val) &
384 NOT(sample_f2_val) &
385 NOT(sample_f2_val) &
386 NOT(sample_f2_val) &
387 NOT(sample_f2_val);
388
389 all_bit_sample_f2 : FOR I IN 15 DOWNTO 0 GENERATE
390 sample_f2_wdata_s(I) <= sample_f2(0, I);
391 sample_f2_wdata_s(16*1+I) <= sample_f2(1, I);
392 sample_f2_wdata_s(16*2+I) <= sample_f2(2, I);
393 sample_f2_wdata_s(16*3+I) <= sample_f2(3, I);
394 sample_f2_wdata_s(16*4+I) <= sample_f2(4, I);
395 sample_f2_wdata_s(16*5+I) <= sample_f2(5, I);
396 END GENERATE all_bit_sample_f2;
397
398 -----------------------------------------------------------------------------
399 -- F3 -- @16 Hz
400 -----------------------------------------------------------------------------
401 all_bit_sample_f1_s : FOR I IN 15 DOWNTO 0 GENERATE
402 sample_f1_s(0, I) <= sample_f1(0, I); -- V
403 sample_f1_s(1, I) <= sample_f1(1, I); -- E1
404 sample_f1_s(2, I) <= sample_f1(2, I); -- E2
405 sample_f1_s(3, I) <= sample_f1(5, I); -- B1
406 sample_f1_s(4, I) <= sample_f1(6, I); -- B2
407 sample_f1_s(5, I) <= sample_f1(7, I); -- B3
408 END GENERATE all_bit_sample_f1_s;
409
410 Downsampling_f3 : Downsampling
411 GENERIC MAP (
412 ChanelCount => 6,
413 SampleSize => 16,
414 DivideParam => 256)
415 PORT MAP (
416 clk => clk,
417 rstn => rstn,
418 sample_in_val => sample_f1_val ,
419 sample_in => sample_f1_s,
420 sample_out_val => sample_f3_val,
421 sample_out => sample_f3);
422
423 sample_f3_wen <= (NOT sample_f3_val) &
424 (NOT sample_f3_val) &
425 (NOT sample_f3_val) &
426 (NOT sample_f3_val) &
427 (NOT sample_f3_val) &
428 (NOT sample_f3_val);
429
430 all_bit_sample_f3 : FOR I IN 15 DOWNTO 0 GENERATE
431 sample_f3_wdata_s(I) <= sample_f3(0, I);
432 sample_f3_wdata_s(16*1+I) <= sample_f3(1, I);
433 sample_f3_wdata_s(16*2+I) <= sample_f3(2, I);
434 sample_f3_wdata_s(16*3+I) <= sample_f3(3, I);
435 sample_f3_wdata_s(16*4+I) <= sample_f3(4, I);
436 sample_f3_wdata_s(16*5+I) <= sample_f3(5, I);
437 END GENERATE all_bit_sample_f3;
438
439 lpp_waveform_1 : lpp_waveform
440 GENERIC MAP (
441 hindex => hindex,
442 tech => tech,
443 data_size => 160,
444 nb_burst_available_size => nb_burst_available_size,
445 nb_snapshot_param_size => nb_snapshot_param_size,
446 delta_snapshot_size => delta_snapshot_size,
447 delta_f2_f0_size => delta_f2_f0_size,
448 delta_f2_f1_size => delta_f2_f1_size)
449 PORT MAP (
450 clk => clk,
451 rstn => rstn,
452
453 AHB_Master_In => AHB_Master_In,
454 AHB_Master_Out => AHB_Master_Out,
455
456 coarse_time_0 => coarse_time_0, -- IN
457 delta_snapshot => delta_snapshot, -- IN
458 delta_f2_f1 => delta_f2_f1, -- IN
459 delta_f2_f0 => delta_f2_f0, -- IN
460 enable_f0 => enable_f0, -- IN
461 enable_f1 => enable_f1, -- IN
462 enable_f2 => enable_f2, -- IN
463 enable_f3 => enable_f3, -- IN
464 burst_f0 => burst_f0, -- IN
465 burst_f1 => burst_f1, -- IN
466 burst_f2 => burst_f2, -- IN
467 nb_burst_available => nb_burst_available,
468 nb_snapshot_param => nb_snapshot_param,
469 status_full => status_full,
470 status_full_ack => status_full_ack, -- IN
471 status_full_err => status_full_err,
472 status_new_err => status_new_err,
473
474 addr_data_f0 => addr_data_f0, -- IN
475 addr_data_f1 => addr_data_f1, -- IN
476 addr_data_f2 => addr_data_f2, -- IN
477 addr_data_f3 => addr_data_f3, -- IN
478
479 data_f0_in => data_f0_in_valid,
480 data_f1_in => data_f1_in_valid,
481 data_f2_in => data_f2_in_valid,
482 data_f3_in => data_f3_in_valid,
483 data_f0_in_valid => sample_f0_val,
484 data_f1_in_valid => sample_f1_val,
485 data_f2_in_valid => sample_f2_val,
486 data_f3_in_valid => sample_f3_val);
487
488 data_f0_in_valid((10*16)-1 DOWNTO (4*16)) <= sample_f0_wdata_s;
489 data_f1_in_valid((10*16)-1 DOWNTO (4*16)) <= sample_f1_wdata_s;
490 data_f2_in_valid((10*16)-1 DOWNTO (4*16)) <= sample_f2_wdata_s;
491 data_f3_in_valid((10*16)-1 DOWNTO (4*16)) <= sample_f3_wdata_s;
492
493 sample_f0_wdata <= sample_f0_wdata_s;
494 sample_f1_wdata <= sample_f1_wdata_s;
495 sample_f2_wdata <= sample_f2_wdata_s;
496 sample_f3_wdata <= sample_f3_wdata_s;
497
498 END tb;
@@ -37,56 +37,60 ARCHITECTURE tb OF TB_Data_Acquisition I
37 sdo : OUT STD_LOGIC);
37 sdo : OUT STD_LOGIC);
38 END COMPONENT;
38 END COMPONENT;
39
39
40 COMPONENT Top_Data_Acquisition
40 --COMPONENT Top_Data_Acquisition
41 GENERIC (
41 -- GENERIC (
42 hindex : INTEGER;
42 -- hindex : INTEGER;
43 nb_burst_available_size : INTEGER := 11;
43 -- nb_burst_available_size : INTEGER := 11;
44 nb_snapshot_param_size : INTEGER := 11;
44 -- nb_snapshot_param_size : INTEGER := 11;
45 delta_snapshot_size : INTEGER := 16;
45 -- delta_snapshot_size : INTEGER := 16;
46 delta_f2_f0_size : INTEGER := 10;
46 -- delta_f2_f0_size : INTEGER := 10;
47 delta_f2_f1_size : INTEGER := 10;
47 -- delta_f2_f1_size : INTEGER := 10;
48 tech : integer);
48 -- tech : integer);
49 PORT (
49 -- PORT (
50 cnv_run : IN STD_LOGIC;
50 -- cnv_run : IN STD_LOGIC;
51 cnv : OUT STD_LOGIC;
51 -- cnv : OUT STD_LOGIC;
52 sck : OUT STD_LOGIC;
52 -- sck : OUT STD_LOGIC;
53 sdo : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
53 -- sdo : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
54 cnv_clk : IN STD_LOGIC;
54 -- cnv_clk : IN STD_LOGIC;
55 cnv_rstn : IN STD_LOGIC;
55 -- cnv_rstn : IN STD_LOGIC;
56 clk : IN STD_LOGIC;
56 -- clk : IN STD_LOGIC;
57 rstn : IN STD_LOGIC;
57 -- rstn : IN STD_LOGIC;
58 sample_f0_wen : out STD_LOGIC_VECTOR(5 DOWNTO 0);
58 -- sample_f0_wen : out STD_LOGIC_VECTOR(5 DOWNTO 0);
59 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
59 -- sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
60 sample_f1_wen : out STD_LOGIC_VECTOR(5 DOWNTO 0);
60 -- sample_f1_wen : out STD_LOGIC_VECTOR(5 DOWNTO 0);
61 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
61 -- sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
62 sample_f2_wen : out STD_LOGIC_VECTOR(5 DOWNTO 0);
62 -- sample_f2_wen : out STD_LOGIC_VECTOR(5 DOWNTO 0);
63 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
63 -- sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
64 sample_f3_wen : out STD_LOGIC_VECTOR(5 DOWNTO 0);
64 -- sample_f3_wen : out STD_LOGIC_VECTOR(5 DOWNTO 0);
65 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
65 -- sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
66 AHB_Master_In : IN AHB_Mst_In_Type;
66 -- AHB_Master_In : IN AHB_Mst_In_Type;
67 AHB_Master_Out : OUT AHB_Mst_Out_Type;
67 -- AHB_Master_Out : OUT AHB_Mst_Out_Type;
68 coarse_time_0 : IN STD_LOGIC;
68 -- coarse_time_0 : IN STD_LOGIC;
69 delta_snapshot : IN STD_LOGIC_VECTOR(delta_snapshot_size-1 DOWNTO 0);
69 -- data_shaping_SP0 : IN STD_LOGIC;
70 delta_f2_f1 : IN STD_LOGIC_VECTOR(delta_f2_f1_size-1 DOWNTO 0);
70 -- data_shaping_SP1 : IN STD_LOGIC;
71 delta_f2_f0 : IN STD_LOGIC_VECTOR(delta_f2_f0_size-1 DOWNTO 0);
71 -- data_shaping_R0 : IN STD_LOGIC;
72 enable_f0 : IN STD_LOGIC;
72 -- data_shaping_R1 : IN STD_LOGIC;
73 enable_f1 : IN STD_LOGIC;
73 -- delta_snapshot : IN STD_LOGIC_VECTOR(delta_snapshot_size-1 DOWNTO 0);
74 enable_f2 : IN STD_LOGIC;
74 -- delta_f2_f1 : IN STD_LOGIC_VECTOR(delta_f2_f1_size-1 DOWNTO 0);
75 enable_f3 : IN STD_LOGIC;
75 -- delta_f2_f0 : IN STD_LOGIC_VECTOR(delta_f2_f0_size-1 DOWNTO 0);
76 burst_f0 : IN STD_LOGIC;
76 -- enable_f0 : IN STD_LOGIC;
77 burst_f1 : IN STD_LOGIC;
77 -- enable_f1 : IN STD_LOGIC;
78 burst_f2 : IN STD_LOGIC;
78 -- enable_f2 : IN STD_LOGIC;
79 nb_burst_available : IN STD_LOGIC_VECTOR(nb_burst_available_size-1 DOWNTO 0);
79 -- enable_f3 : IN STD_LOGIC;
80 nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
80 -- burst_f0 : IN STD_LOGIC;
81 status_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
81 -- burst_f1 : IN STD_LOGIC;
82 status_full_ack : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
82 -- burst_f2 : IN STD_LOGIC;
83 status_full_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
83 -- nb_burst_available : IN STD_LOGIC_VECTOR(nb_burst_available_size-1 DOWNTO 0);
84 status_new_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
84 -- nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
85 addr_data_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
85 -- status_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
86 addr_data_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
86 -- status_full_ack : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
87 addr_data_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
87 -- status_full_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
88 addr_data_f3 : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
88 -- status_new_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
89 END COMPONENT;
89 -- addr_data_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
90 -- addr_data_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
91 -- addr_data_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
92 -- addr_data_f3 : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
93 --END COMPONENT;
90
94
91 -- component ports
95 -- component ports
92 SIGNAL cnv_rstn : STD_LOGIC;
96 SIGNAL cnv_rstn : STD_LOGIC;
@@ -154,6 +158,11 ARCHITECTURE tb OF TB_Data_Acquisition I
154 SIGNAL addr_data_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
158 SIGNAL addr_data_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
155 SIGNAL addr_data_f3 : STD_LOGIC_VECTOR(31 DOWNTO 0);
159 SIGNAL addr_data_f3 : STD_LOGIC_VECTOR(31 DOWNTO 0);
156
160
161
162 SIGNAL data_shaping_SP0 : STD_LOGIC;
163 SIGNAL data_shaping_SP1 : STD_LOGIC;
164 SIGNAL data_shaping_R0 : STD_LOGIC;
165 SIGNAL data_shaping_R1 : STD_LOGIC;
157 BEGIN -- tb
166 BEGIN -- tb
158
167
159 MODULE_ADS7886: FOR I IN 0 TO 6 GENERATE
168 MODULE_ADS7886: FOR I IN 0 TO 6 GENERATE
@@ -211,11 +220,14 BEGIN -- tb
211
220
212 -----------------------------------------------------------------------------
221 -----------------------------------------------------------------------------
213
222
214 Top_Data_Acquisition_2: Top_Data_Acquisition
223 Top_Data_Acquisition_2: lpp_top_lfr_wf_picker_ip
215 GENERIC MAP (
224 GENERIC MAP (
216 hindex => 2,
225 hindex => 2,
217 nb_burst_available_size => nb_burst_available_size,
226 nb_burst_available_size => nb_burst_available_size,
218 nb_snapshot_param_size => nb_snapshot_param_size,
227 nb_snapshot_param_size => nb_snapshot_param_size,
228 delta_snapshot_size =>16,
229 delta_f2_f0_size =>10,
230 delta_f2_f1_size =>10,
219 tech => 0)
231 tech => 0)
220 PORT MAP (
232 PORT MAP (
221 cnv_run => run_cnv,
233 cnv_run => run_cnv,
@@ -237,6 +249,10 BEGIN -- tb
237 AHB_Master_In => AHB_Master_In,
249 AHB_Master_In => AHB_Master_In,
238 AHB_Master_Out => AHB_Master_Out,
250 AHB_Master_Out => AHB_Master_Out,
239 coarse_time_0 => coarse_time_0,
251 coarse_time_0 => coarse_time_0,
252 data_shaping_SP0 => data_shaping_SP0,
253 data_shaping_SP1 => data_shaping_SP1,
254 data_shaping_R0 => data_shaping_R0,
255 data_shaping_R1 => data_shaping_R1,
240 delta_snapshot => delta_snapshot,
256 delta_snapshot => delta_snapshot,
241 delta_f2_f1 => delta_f2_f1,
257 delta_f2_f1 => delta_f2_f1,
242 delta_f2_f0 => delta_f2_f0,
258 delta_f2_f0 => delta_f2_f0,
@@ -277,6 +293,10 BEGIN -- tb
277 burst_f1 <= '0'; --TODO test
293 burst_f1 <= '0'; --TODO test
278 burst_f2 <= '0';
294 burst_f2 <= '0';
279
295
296 data_shaping_SP0 <= '0';
297 data_shaping_SP1 <= '0';
298 data_shaping_R0 <= '1';
299 data_shaping_R1 <= '1';
280
300
281 delta_snapshot <= "0000000000000001";
301 delta_snapshot <= "0000000000000001";
282 --nb_snapshot_param <= "00000001110"; -- 14+1 = 15
302 --nb_snapshot_param <= "00000001110"; -- 14+1 = 15
@@ -1,5 +1,6
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
4
4 LIBRARY lpp;
5 LIBRARY lpp;
5 USE lpp.lpp_ad_conv.ALL;
6 USE lpp.lpp_ad_conv.ALL;
@@ -59,6 +60,11 ENTITY Top_Data_Acquisition IS
59 coarse_time_0 : IN STD_LOGIC;
60 coarse_time_0 : IN STD_LOGIC;
60
61
61 --config
62 --config
63 data_shaping_SP0 : IN STD_LOGIC;
64 data_shaping_SP1 : IN STD_LOGIC;
65 data_shaping_R0 : IN STD_LOGIC;
66 data_shaping_R1 : IN STD_LOGIC;
67
62 delta_snapshot : IN STD_LOGIC_VECTOR(delta_snapshot_size-1 DOWNTO 0);
68 delta_snapshot : IN STD_LOGIC_VECTOR(delta_snapshot_size-1 DOWNTO 0);
63 delta_f2_f1 : IN STD_LOGIC_VECTOR(delta_f2_f1_size-1 DOWNTO 0);
69 delta_f2_f1 : IN STD_LOGIC_VECTOR(delta_f2_f1_size-1 DOWNTO 0);
64 delta_f2_f0 : IN STD_LOGIC_VECTOR(delta_f2_f0_size-1 DOWNTO 0);
70 delta_f2_f0 : IN STD_LOGIC_VECTOR(delta_f2_f0_size-1 DOWNTO 0);
@@ -124,13 +130,25 ARCHITECTURE tb OF Top_Data_Acquisition
124 --
130 --
125 SIGNAL sample_filter_v2_out_val : STD_LOGIC;
131 SIGNAL sample_filter_v2_out_val : STD_LOGIC;
126 SIGNAL sample_filter_v2_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
132 SIGNAL sample_filter_v2_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
127 SIGNAL sample_filter_v2_out_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
133 -----------------------------------------------------------------------------
134 SIGNAL sample_data_shaping_out_val : STD_LOGIC;
135 SIGNAL sample_data_shaping_out : samplT(ChanelCount-1 DOWNTO 0, 17 DOWNTO 0);
136 SIGNAL sample_data_shaping_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
137 SIGNAL sample_data_shaping_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
138 SIGNAL sample_data_shaping_f2_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
139 SIGNAL sample_data_shaping_f1_f0_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
140 SIGNAL sample_data_shaping_f2_f1_s : STD_LOGIC_VECTOR(17 DOWNTO 0);
141 -----------------------------------------------------------------------------
142 SIGNAL sample_filter_v2_out_val_s : STD_LOGIC;
143 SIGNAL sample_filter_v2_out_s : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
128 -----------------------------------------------------------------------------
144 -----------------------------------------------------------------------------
129 SIGNAL sample_f0_val : STD_LOGIC;
145 SIGNAL sample_f0_val : STD_LOGIC;
130 SIGNAL sample_f0 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
146 SIGNAL sample_f0 : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
147 SIGNAL sample_f0_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
131 --
148 --
132 SIGNAL sample_f1_val : STD_LOGIC;
149 SIGNAL sample_f1_val : STD_LOGIC;
133 SIGNAL sample_f1 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
150 SIGNAL sample_f1 : samplT(ChanelCount-1 DOWNTO 0, 15 DOWNTO 0);
151 SIGNAL sample_f1_s : samplT(5 DOWNTO 0, 15 DOWNTO 0);
134 --
152 --
135 SIGNAL sample_f2_val : STD_LOGIC;
153 SIGNAL sample_f2_val : STD_LOGIC;
136 SIGNAL sample_f2 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
154 SIGNAL sample_f2 : samplT(5 DOWNTO 0, 15 DOWNTO 0);
@@ -196,7 +214,7 BEGIN
196 IIR_CEL_CTRLR_v2_1 : IIR_CEL_CTRLR_v2
214 IIR_CEL_CTRLR_v2_1 : IIR_CEL_CTRLR_v2
197 GENERIC MAP (
215 GENERIC MAP (
198 tech => 0,
216 tech => 0,
199 Mem_use => use_RAM,
217 Mem_use => use_CEL, -- use_RAM
200 Sample_SZ => 18,
218 Sample_SZ => 18,
201 Coef_SZ => Coef_SZ,
219 Coef_SZ => Coef_SZ,
202 Coef_Nb => 25,
220 Coef_Nb => 25,
@@ -213,12 +231,63 BEGIN
213 sample_out_val => sample_filter_v2_out_val,
231 sample_out_val => sample_filter_v2_out_val,
214 sample_out => sample_filter_v2_out);
232 sample_out => sample_filter_v2_out);
215
233
216 --sample_filter_v2_out_val <= sample_val_delay;
234 -----------------------------------------------------------------------------
235 -- DATA_SHAPING
236 -----------------------------------------------------------------------------
237 all_data_shaping_in_loop: FOR I IN 17 DOWNTO 0 GENERATE
238 sample_data_shaping_f0_s(I) <= sample_filter_v2_out(0,I);
239 sample_data_shaping_f1_s(I) <= sample_filter_v2_out(1,I);
240 sample_data_shaping_f2_s(I) <= sample_filter_v2_out(2,I);
241 END GENERATE all_data_shaping_in_loop;
242
243 sample_data_shaping_f1_f0_s <= sample_data_shaping_f1_s - sample_data_shaping_f0_s;
244 sample_data_shaping_f2_f1_s <= sample_data_shaping_f2_s - sample_data_shaping_f1_s;
245
246 PROCESS (clk, rstn)
247 BEGIN -- PROCESS
248 IF rstn = '0' THEN -- asynchronous reset (active low)
249 sample_data_shaping_out_val <= '0';
250 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
251 sample_data_shaping_out_val <= sample_filter_v2_out_val;
252 END IF;
253 END PROCESS;
217
254
218 ChanelLoopOut : FOR i IN 0 TO 5 GENERATE
255 SampleLoop_data_shaping: FOR j IN 0 TO 17 GENERATE
256 PROCESS (clk, rstn)
257 BEGIN
258 IF rstn = '0' THEN
259 sample_data_shaping_out(0,j) <= '0';
260 sample_data_shaping_out(1,j) <= '0';
261 sample_data_shaping_out(2,j) <= '0';
262 sample_data_shaping_out(3,j) <= '0';
263 sample_data_shaping_out(4,j) <= '0';
264 sample_data_shaping_out(5,j) <= '0';
265 sample_data_shaping_out(6,j) <= '0';
266 sample_data_shaping_out(7,j) <= '0';
267 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
268 sample_data_shaping_out(0,j) <= sample_filter_v2_out(0,j);
269 IF data_shaping_SP0 = '1' THEN
270 sample_data_shaping_out(1,j) <= sample_data_shaping_f1_f0_s(j);
271 ELSE
272 sample_data_shaping_out(1,j) <= sample_filter_v2_out(1,j);
273 END IF;
274 IF data_shaping_SP1 = '1' THEN
275 sample_data_shaping_out(2,j) <= sample_data_shaping_f2_f1_s(j);
276 ELSE
277 sample_data_shaping_out(2,j) <= sample_filter_v2_out(2,j);
278 END IF;
279 sample_data_shaping_out(4,j) <= sample_filter_v2_out(4,j);
280 sample_data_shaping_out(5,j) <= sample_filter_v2_out(5,j);
281 sample_data_shaping_out(6,j) <= sample_filter_v2_out(6,j);
282 sample_data_shaping_out(7,j) <= sample_filter_v2_out(7,j);
283 END IF;
284 END PROCESS;
285 END GENERATE;
286
287 sample_filter_v2_out_val_s <= sample_data_shaping_out_val;
288 ChanelLoopOut : FOR i IN 0 TO 7 GENERATE
219 SampleLoopOut : FOR j IN 0 TO 15 GENERATE
289 SampleLoopOut : FOR j IN 0 TO 15 GENERATE
220 sample_filter_v2_out_s(i, j) <= sample_filter_v2_out(i, j);
290 sample_filter_v2_out_s(i,j) <= sample_data_shaping_out(i,j);
221 --sample_filter_v2_out_s(i, j) <= sample_filter_in(i, j);
222 END GENERATE;
291 END GENERATE;
223 END GENERATE;
292 END GENERATE;
224 -----------------------------------------------------------------------------
293 -----------------------------------------------------------------------------
@@ -226,24 +295,24 BEGIN
226 -----------------------------------------------------------------------------
295 -----------------------------------------------------------------------------
227 Downsampling_f0 : Downsampling
296 Downsampling_f0 : Downsampling
228 GENERIC MAP (
297 GENERIC MAP (
229 ChanelCount => 6,
298 ChanelCount => 8,
230 SampleSize => 16,
299 SampleSize => 16,
231 DivideParam => 4)
300 DivideParam => 4)
232 PORT MAP (
301 PORT MAP (
233 clk => clk,
302 clk => clk,
234 rstn => rstn,
303 rstn => rstn,
235 sample_in_val => sample_filter_v2_out_val,
304 sample_in_val => sample_filter_v2_out_val_s,
236 sample_in => sample_filter_v2_out_s,
305 sample_in => sample_filter_v2_out_s,
237 sample_out_val => sample_f0_val,
306 sample_out_val => sample_f0_val,
238 sample_out => sample_f0);
307 sample_out => sample_f0);
239
308
240 all_bit_sample_f0 : FOR I IN 15 DOWNTO 0 GENERATE
309 all_bit_sample_f0 : FOR I IN 15 DOWNTO 0 GENERATE
241 sample_f0_wdata_s(I) <= sample_f0(0, I);
310 sample_f0_wdata_s(I) <= sample_f0(0, I); -- V
242 sample_f0_wdata_s(16*1+I) <= sample_f0(1, I);
311 sample_f0_wdata_s(16*1+I) <= sample_f0(1, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(3, I); -- E1
243 sample_f0_wdata_s(16*2+I) <= sample_f0(2, I);
312 sample_f0_wdata_s(16*2+I) <= sample_f0(2, I) WHEN data_shaping_R0 = '1' ELSE sample_f0(4, I); -- E2
244 sample_f0_wdata_s(16*3+I) <= sample_f0(3, I);
313 sample_f0_wdata_s(16*3+I) <= sample_f0(5, I); -- B1
245 sample_f0_wdata_s(16*4+I) <= sample_f0(4, I);
314 sample_f0_wdata_s(16*4+I) <= sample_f0(6, I); -- B2
246 sample_f0_wdata_s(16*5+I) <= sample_f0(5, I);
315 sample_f0_wdata_s(16*5+I) <= sample_f0(7, I); -- B3
247 END GENERATE all_bit_sample_f0;
316 END GENERATE all_bit_sample_f0;
248
317
249 sample_f0_wen <= NOT(sample_f0_val) &
318 sample_f0_wen <= NOT(sample_f0_val) &
@@ -258,7 +327,7 BEGIN
258 -----------------------------------------------------------------------------
327 -----------------------------------------------------------------------------
259 Downsampling_f1 : Downsampling
328 Downsampling_f1 : Downsampling
260 GENERIC MAP (
329 GENERIC MAP (
261 ChanelCount => 6,
330 ChanelCount => 8,
262 SampleSize => 16,
331 SampleSize => 16,
263 DivideParam => 6)
332 DivideParam => 6)
264 PORT MAP (
333 PORT MAP (
@@ -269,6 +338,15 BEGIN
269 sample_out_val => sample_f1_val,
338 sample_out_val => sample_f1_val,
270 sample_out => sample_f1);
339 sample_out => sample_f1);
271
340
341 all_bit_sample_f1 : FOR I IN 15 DOWNTO 0 GENERATE
342 sample_f1_wdata_s(I) <= sample_f1(0, I); -- V
343 sample_f1_wdata_s(16*1+I) <= sample_f1(1, I) WHEN data_shaping_R1 = '1' ELSE sample_f1(3, I); -- E1
344 sample_f1_wdata_s(16*2+I) <= sample_f1(2, I) WHEN data_shaping_R1 = '1' ELSE sample_f1(4, I); -- E2
345 sample_f1_wdata_s(16*3+I) <= sample_f1(5, I); -- B1
346 sample_f1_wdata_s(16*4+I) <= sample_f1(6, I); -- B2
347 sample_f1_wdata_s(16*5+I) <= sample_f1(7, I); -- B3
348 END GENERATE all_bit_sample_f1;
349
272 sample_f1_wen <= NOT(sample_f1_val) &
350 sample_f1_wen <= NOT(sample_f1_val) &
273 NOT(sample_f1_val) &
351 NOT(sample_f1_val) &
274 NOT(sample_f1_val) &
352 NOT(sample_f1_val) &
@@ -276,18 +354,18 BEGIN
276 NOT(sample_f1_val) &
354 NOT(sample_f1_val) &
277 NOT(sample_f1_val);
355 NOT(sample_f1_val);
278
356
279 all_bit_sample_f1 : FOR I IN 15 DOWNTO 0 GENERATE
280 sample_f1_wdata_s(I) <= sample_f1(0, I);
281 sample_f1_wdata_s(16*1+I) <= sample_f1(1, I);
282 sample_f1_wdata_s(16*2+I) <= sample_f1(2, I);
283 sample_f1_wdata_s(16*3+I) <= sample_f1(3, I);
284 sample_f1_wdata_s(16*4+I) <= sample_f1(4, I);
285 sample_f1_wdata_s(16*5+I) <= sample_f1(5, I);
286 END GENERATE all_bit_sample_f1;
287
288 -----------------------------------------------------------------------------
357 -----------------------------------------------------------------------------
289 -- F2 -- @256 Hz
358 -- F2 -- @256 Hz
290 -----------------------------------------------------------------------------
359 -----------------------------------------------------------------------------
360 all_bit_sample_f0_s : FOR I IN 15 DOWNTO 0 GENERATE
361 sample_f0_s(0, I) <= sample_f0(0, I); -- V
362 sample_f0_s(1, I) <= sample_f0(1, I); -- E1
363 sample_f0_s(2, I) <= sample_f0(2, I); -- E2
364 sample_f0_s(3, I) <= sample_f0(5, I); -- B1
365 sample_f0_s(4, I) <= sample_f0(6, I); -- B2
366 sample_f0_s(5, I) <= sample_f0(7, I); -- B3
367 END GENERATE all_bit_sample_f0_s;
368
291 Downsampling_f2 : Downsampling
369 Downsampling_f2 : Downsampling
292 GENERIC MAP (
370 GENERIC MAP (
293 ChanelCount => 6,
371 ChanelCount => 6,
@@ -297,7 +375,7 BEGIN
297 clk => clk,
375 clk => clk,
298 rstn => rstn,
376 rstn => rstn,
299 sample_in_val => sample_f0_val ,
377 sample_in_val => sample_f0_val ,
300 sample_in => sample_f0,
378 sample_in => sample_f0_s,
301 sample_out_val => sample_f2_val,
379 sample_out_val => sample_f2_val,
302 sample_out => sample_f2);
380 sample_out => sample_f2);
303
381
@@ -320,6 +398,15 BEGIN
320 -----------------------------------------------------------------------------
398 -----------------------------------------------------------------------------
321 -- F3 -- @16 Hz
399 -- F3 -- @16 Hz
322 -----------------------------------------------------------------------------
400 -----------------------------------------------------------------------------
401 all_bit_sample_f1_s : FOR I IN 15 DOWNTO 0 GENERATE
402 sample_f1_s(0, I) <= sample_f1(0, I); -- V
403 sample_f1_s(1, I) <= sample_f1(1, I); -- E1
404 sample_f1_s(2, I) <= sample_f1(2, I); -- E2
405 sample_f1_s(3, I) <= sample_f1(5, I); -- B1
406 sample_f1_s(4, I) <= sample_f1(6, I); -- B2
407 sample_f1_s(5, I) <= sample_f1(7, I); -- B3
408 END GENERATE all_bit_sample_f1_s;
409
323 Downsampling_f3 : Downsampling
410 Downsampling_f3 : Downsampling
324 GENERIC MAP (
411 GENERIC MAP (
325 ChanelCount => 6,
412 ChanelCount => 6,
@@ -329,7 +416,7 BEGIN
329 clk => clk,
416 clk => clk,
330 rstn => rstn,
417 rstn => rstn,
331 sample_in_val => sample_f1_val ,
418 sample_in_val => sample_f1_val ,
332 sample_in => sample_f1,
419 sample_in => sample_f1_s,
333 sample_out_val => sample_f3_val,
420 sample_out_val => sample_f3_val,
334 sample_out => sample_f3);
421 sample_out => sample_f3);
335
422
@@ -42,7 +42,10 vcom -quiet -93 -work lpp ../../lib/lpp/
42
42
43
43
44 vcom -quiet -93 -work lpp ../../lib/lpp/lpp_top_lfr/lpp_top_lfr_pkg.vhd
44 vcom -quiet -93 -work lpp ../../lib/lpp/lpp_top_lfr/lpp_top_lfr_pkg.vhd
45 vcom -quiet -93 -work lpp ../../lib/lpp/lpp_top_lfr/lpp_top_acq.vhd
45 vcom -quiet -93 -work lpp ../../lib/lpp/lpp_top_lfr/lpp_top_apbreg.vhd
46 vcom -quiet -93 -work lpp ../../lib/lpp/lpp_top_lfr/lpp_top_lfr_wf_picker_ip.vhd
47 vcom -quiet -93 -work lpp ../../lib/lpp/lpp_top_lfr/lpp_top_lfr_wf_picker.vhd
48 #vcom -quiet -93 -work lpp ../../lib/lpp/lpp_top_lfr/lpp_top_acq.vhd
46 #vcom -quiet -93 -work lpp ../../lib/lpp/lpp_top_lfr/lpp_top_lfr.vhd
49 #vcom -quiet -93 -work lpp ../../lib/lpp/lpp_top_lfr/lpp_top_lfr.vhd
47
50
48 vcom -quiet -93 -work lpp ../../lib/lpp/lfr_time_management/lpp_lfr_time_management.vhd
51 vcom -quiet -93 -work lpp ../../lib/lpp/lfr_time_management/lpp_lfr_time_management.vhd
@@ -22,10 +22,6
22 LIBRARY IEEE;
22 LIBRARY IEEE;
23 USE IEEE.numeric_std.ALL;
23 USE IEEE.numeric_std.ALL;
24 USE IEEE.std_logic_1164.ALL;
24 USE IEEE.std_logic_1164.ALL;
25 LIBRARY lpp;
26 USE lpp.general_purpose.ALL;
27
28
29
25
30 ENTITY Adder IS
26 ENTITY Adder IS
31 GENERIC(
27 GENERIC(
@@ -22,9 +22,6
22 library IEEE;
22 library IEEE;
23 use IEEE.numeric_std.all;
23 use IEEE.numeric_std.all;
24 use IEEE.std_logic_1164.all;
24 use IEEE.std_logic_1164.all;
25 library lpp;
26 use lpp.general_purpose.all;
27
28
25
29 --IDLE =00 MAC =01 MULT =10 ADD =11
26 --IDLE =00 MAC =01 MULT =10 ADD =11
30
27
@@ -22,10 +22,6
22 library IEEE;
22 library IEEE;
23 use IEEE.numeric_std.all;
23 use IEEE.numeric_std.all;
24 use IEEE.std_logic_1164.all;
24 use IEEE.std_logic_1164.all;
25 library lpp;
26 use lpp.general_purpose.all;
27
28
29
25
30 entity MAC_MUX is
26 entity MAC_MUX is
31 generic(
27 generic(
@@ -22,9 +22,6
22 library IEEE;
22 library IEEE;
23 use IEEE.numeric_std.all;
23 use IEEE.numeric_std.all;
24 use IEEE.std_logic_1164.all;
24 use IEEE.std_logic_1164.all;
25 library lpp;
26 use lpp.general_purpose.all;
27
28
25
29
26
30 entity MAC_MUX2 is
27 entity MAC_MUX2 is
@@ -22,10 +22,6
22 library IEEE;
22 library IEEE;
23 use IEEE.numeric_std.all;
23 use IEEE.numeric_std.all;
24 use IEEE.std_logic_1164.all;
24 use IEEE.std_logic_1164.all;
25 library lpp;
26 use lpp.general_purpose.all;
27
28
29
25
30 entity MAC_REG is
26 entity MAC_REG is
31 generic(size : integer := 16);
27 generic(size : integer := 16);
@@ -23,11 +23,6 library IEEE;
23 use IEEE.numeric_std.all;
23 use IEEE.numeric_std.all;
24 use IEEE.std_logic_1164.all;
24 use IEEE.std_logic_1164.all;
25
25
26 library lpp;
27 use lpp.general_purpose.all;
28
29
30
31 entity Multiplier is
26 entity Multiplier is
32 generic(
27 generic(
33 Input_SZ_A : integer := 16;
28 Input_SZ_A : integer := 16;
@@ -22,7 +22,6
22 library IEEE;
22 library IEEE;
23 use IEEE.numeric_std.all;
23 use IEEE.numeric_std.all;
24 use IEEE.std_logic_1164.all;
24 use IEEE.std_logic_1164.all;
25 library lpp;
26 use lpp.general_purpose.all;
25 use lpp.general_purpose.all;
27
26
28 --! Driver de l'ALU
27 --! Driver de l'ALU
@@ -22,8 +22,8
22 library IEEE;
22 library IEEE;
23 use IEEE.std_logic_1164.all;
23 use IEEE.std_logic_1164.all;
24 use IEEE.numeric_std.all;
24 use IEEE.numeric_std.all;
25 library lpp;
25 --library lpp;
26 use lpp.lpp_matrix.all;
26 --use lpp.lpp_matrix.all;
27
27
28 entity MatriceSpectrale is
28 entity MatriceSpectrale is
29 generic(
29 generic(
@@ -34,14 +34,17 entity MatriceSpectrale is
34 rstn : in std_logic;
34 rstn : in std_logic;
35
35
36 FifoIN_Full : in std_logic_vector(4 downto 0);
36 FifoIN_Full : in std_logic_vector(4 downto 0);
37 SetReUse : in std_logic_vector(4 downto 0);
37 FifoOUT_Full : in std_logic_vector(1 downto 0);
38 FifoOUT_Full : in std_logic_vector(1 downto 0);
38 Data_IN : in std_logic_vector(79 downto 0);
39 Data_IN : in std_logic_vector((5*Input_SZ)-1 downto 0);
39 ACQ : in std_logic;
40 ACQ : in std_logic;
40 FlagError : out std_logic;
41 FlagError : out std_logic;
41 Pong : out std_logic;
42 Pong : out std_logic;
43 Statu : out std_logic_vector(3 downto 0);
42 Write : out std_logic_vector(1 downto 0);
44 Write : out std_logic_vector(1 downto 0);
43 Read : out std_logic_vector(4 downto 0);
45 Read : out std_logic_vector(4 downto 0);
44 Data_OUT : out std_logic_vector(63 downto 0)
46 ReUse : out std_logic_vector(4 downto 0);
47 Data_OUT : out std_logic_vector((2*Result_SZ)-1 downto 0)
45 );
48 );
46 end entity;
49 end entity;
47
50
@@ -59,18 +62,23 signal TopSM_Data2 : std_logic_vect
59
62
60 begin
63 begin
61
64
62 TopSM : TopSpecMatrix
65 CTRL0 : entity work.ReUse_CTRLR
66 port map(clkm,rstn,SetReUse,TopSM_Statu,ReUse);
67
68
69 TopSM : entity work.TopSpecMatrix
63 generic map (Input_SZ)
70 generic map (Input_SZ)
64 port map(clkm,rstn,Matrix_Write,Matrix_Read,FifoIN_Full,Data_IN,TopSM_Start,Read,TopSM_Statu,TopSM_Data1,TopSM_Data2);
71 port map(clkm,rstn,Matrix_Write,Matrix_Read,FifoIN_Full,Data_IN,TopSM_Start,Read,TopSM_Statu,TopSM_Data1,TopSM_Data2);
65
72
66 SM : SpectralMatrix
73 SM : entity work.SpectralMatrix
67 generic map (Input_SZ,Result_SZ)
74 generic map (Input_SZ,Result_SZ)
68 port map(clkm,rstn,TopSM_Start,TopSM_Data1,TopSM_Data2,TopSM_Statu,Matrix_Read,Matrix_Write,Matrix_Result);
75 port map(clkm,rstn,TopSM_Start,TopSM_Data1,TopSM_Data2,TopSM_Statu,Matrix_Read,Matrix_Write,Matrix_Result);
69
76
70 DISP : Dispatch
77 DISP : entity work.Dispatch
71 generic map(Result_SZ)
78 generic map(Result_SZ)
72 port map(clkm,rstn,ACQ,Matrix_Result,Matrix_Write,FifoOUT_Full,Data_OUT,Write,Pong,FlagError);
79 port map(clkm,rstn,ACQ,Matrix_Result,Matrix_Write,FifoOUT_Full,Data_OUT,Write,Pong,FlagError);
73
80
81 Statu <= TopSM_Statu;
74
82
75 end architecture;
83 end architecture;
76
84
@@ -65,14 +65,17 component MatriceSpectrale is
65 rstn : in std_logic;
65 rstn : in std_logic;
66
66
67 FifoIN_Full : in std_logic_vector(4 downto 0);
67 FifoIN_Full : in std_logic_vector(4 downto 0);
68 SetReUse : in std_logic_vector(4 downto 0);
68 FifoOUT_Full : in std_logic_vector(1 downto 0);
69 FifoOUT_Full : in std_logic_vector(1 downto 0);
69 Data_IN : in std_logic_vector(79 downto 0);
70 Data_IN : in std_logic_vector((5*Input_SZ)-1 downto 0);
70 ACQ : in std_logic;
71 ACQ : in std_logic;
71 FlagError : out std_logic;
72 FlagError : out std_logic;
72 Pong : out std_logic;
73 Pong : out std_logic;
74 Statu : out std_logic_vector(3 downto 0);
73 Write : out std_logic_vector(1 downto 0);
75 Write : out std_logic_vector(1 downto 0);
74 Read : out std_logic_vector(4 downto 0);
76 Read : out std_logic_vector(4 downto 0);
75 Data_OUT : out std_logic_vector(63 downto 0)
77 ReUse : out std_logic_vector(4 downto 0);
78 Data_OUT : out std_logic_vector((2*Result_SZ)-1 downto 0)
76 );
79 );
77 end component;
80 end component;
78
81
@@ -250,4 +253,14 component ALU_Driver is
250 );
253 );
251 end component;
254 end component;
252
255
256 component ReUse_CTRLR is
257 port(
258 clk : in std_logic;
259 reset : in std_logic;
260 SetReUse : in std_logic_vector(4 downto 0);
261 Statu : in std_logic_vector(3 downto 0);
262 ReUse : out std_logic_vector(4 downto 0)
263 );
264 end component;
265
253 end; No newline at end of file
266 end;
@@ -143,7 +143,7 BEGIN
143 IIR_CEL_CTRLR_v2_1 : IIR_CEL_CTRLR_v2
143 IIR_CEL_CTRLR_v2_1 : IIR_CEL_CTRLR_v2
144 GENERIC MAP (
144 GENERIC MAP (
145 tech => 0,
145 tech => 0,
146 Mem_use => use_CEL,
146 Mem_use => use_RAM,
147 Sample_SZ => 18,
147 Sample_SZ => 18,
148 Coef_SZ => Coef_SZ,
148 Coef_SZ => Coef_SZ,
149 Coef_Nb => 25, -- TODO
149 Coef_Nb => 25, -- TODO
@@ -36,6 +36,12 USE techmap.gencomp.ALL;
36
36
37 ENTITY lpp_top_apbreg IS
37 ENTITY lpp_top_apbreg IS
38 GENERIC (
38 GENERIC (
39 nb_burst_available_size : INTEGER := 11;
40 nb_snapshot_param_size : INTEGER := 11;
41 delta_snapshot_size : INTEGER := 16;
42 delta_f2_f0_size : INTEGER := 10;
43 delta_f2_f1_size : INTEGER := 10;
44
39 pindex : INTEGER := 4;
45 pindex : INTEGER := 4;
40 paddr : INTEGER := 4;
46 paddr : INTEGER := 4;
41 pmask : INTEGER := 16#fff#;
47 pmask : INTEGER := 16#fff#;
@@ -49,6 +55,8 ENTITY lpp_top_apbreg IS
49 apbi : IN apb_slv_in_type;
55 apbi : IN apb_slv_in_type;
50 apbo : OUT apb_slv_out_type;
56 apbo : OUT apb_slv_out_type;
51
57
58 ---------------------------------------------------------------------------
59 -- Spectral Matrix Reg
52 -- IN
60 -- IN
53 ready_matrix_f0_0 : IN STD_LOGIC;
61 ready_matrix_f0_0 : IN STD_LOGIC;
54 ready_matrix_f0_1 : IN STD_LOGIC;
62 ready_matrix_f0_1 : IN STD_LOGIC;
@@ -71,7 +79,43 ENTITY lpp_top_apbreg IS
71 addr_matrix_f0_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
79 addr_matrix_f0_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
72 addr_matrix_f0_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
80 addr_matrix_f0_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
73 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
81 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
74 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0)
82 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
83 ---------------------------------------------------------------------------
84 ---------------------------------------------------------------------------
85 -- WaveForm picker Reg
86 status_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
87 status_full_ack : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
88 status_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
89 status_new_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
90
91 -- OUT
92 data_shaping_BW : OUT STD_LOGIC;
93 data_shaping_SP0 : OUT STD_LOGIC;
94 data_shaping_SP1 : OUT STD_LOGIC;
95 data_shaping_R0 : OUT STD_LOGIC;
96 data_shaping_R1 : OUT STD_LOGIC;
97
98 delta_snapshot : OUT STD_LOGIC_VECTOR(delta_snapshot_size-1 DOWNTO 0);
99 delta_f2_f1 : OUT STD_LOGIC_VECTOR(delta_f2_f1_size-1 DOWNTO 0);
100 delta_f2_f0 : OUT STD_LOGIC_VECTOR(delta_f2_f0_size-1 DOWNTO 0);
101 nb_burst_available : OUT STD_LOGIC_VECTOR(nb_burst_available_size-1 DOWNTO 0);
102 nb_snapshot_param : OUT STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
103
104 enable_f0 : OUT STD_LOGIC;
105 enable_f1 : OUT STD_LOGIC;
106 enable_f2 : OUT STD_LOGIC;
107 enable_f3 : OUT STD_LOGIC;
108
109 burst_f0 : OUT STD_LOGIC;
110 burst_f1 : OUT STD_LOGIC;
111 burst_f2 : OUT STD_LOGIC;
112
113 addr_data_f0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
114 addr_data_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
115 addr_data_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
116 addr_data_f3 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0)
117
118 ---------------------------------------------------------------------------
75 );
119 );
76
120
77 END lpp_top_apbreg;
121 END lpp_top_apbreg;
@@ -84,7 +128,7 ARCHITECTURE beh OF lpp_top_apbreg IS
84 0 => ahb_device_reg (VENDOR_LPP, LPP_DMA_TYPE, 0, REVISION, pirq),
128 0 => ahb_device_reg (VENDOR_LPP, LPP_DMA_TYPE, 0, REVISION, pirq),
85 1 => apb_iobar(paddr, pmask));
129 1 => apb_iobar(paddr, pmask));
86
130
87 TYPE lpp_dma_regs IS RECORD
131 TYPE lpp_SpectralMatrix_regs IS RECORD
88 config_active_interruption_onNewMatrix : STD_LOGIC;
132 config_active_interruption_onNewMatrix : STD_LOGIC;
89 config_active_interruption_onError : STD_LOGIC;
133 config_active_interruption_onError : STD_LOGIC;
90 status_ready_matrix_f0_0 : STD_LOGIC;
134 status_ready_matrix_f0_0 : STD_LOGIC;
@@ -98,56 +142,144 ARCHITECTURE beh OF lpp_top_apbreg IS
98 addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
142 addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
99 addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
143 addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
100 END RECORD;
144 END RECORD;
145 SIGNAL reg_sp : lpp_SpectralMatrix_regs;
101
146
102 SIGNAL reg : lpp_dma_regs;
147 TYPE lpp_WaveformPicker_regs IS RECORD
148 status_full : STD_LOGIC_VECTOR(3 DOWNTO 0);
149 status_full_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
150 status_new_err : STD_LOGIC_VECTOR(3 DOWNTO 0);
151 data_shaping_BW : STD_LOGIC;
152 data_shaping_SP0 : STD_LOGIC;
153 data_shaping_SP1 : STD_LOGIC;
154 data_shaping_R0 : STD_LOGIC;
155 data_shaping_R1 : STD_LOGIC;
156 delta_snapshot : STD_LOGIC_VECTOR(delta_snapshot_size-1 DOWNTO 0);
157 delta_f2_f1 : STD_LOGIC_VECTOR(delta_f2_f1_size-1 DOWNTO 0);
158 delta_f2_f0 : STD_LOGIC_VECTOR(delta_f2_f0_size-1 DOWNTO 0);
159 nb_burst_available : STD_LOGIC_VECTOR(nb_burst_available_size-1 DOWNTO 0);
160 nb_snapshot_param : STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
161 enable_f0 : STD_LOGIC;
162 enable_f1 : STD_LOGIC;
163 enable_f2 : STD_LOGIC;
164 enable_f3 : STD_LOGIC;
165 burst_f0 : STD_LOGIC;
166 burst_f1 : STD_LOGIC;
167 burst_f2 : STD_LOGIC;
168 addr_data_f0 : STD_LOGIC_VECTOR(31 DOWNTO 0);
169 addr_data_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0);
170 addr_data_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0);
171 addr_data_f3 : STD_LOGIC_VECTOR(31 DOWNTO 0);
172 END RECORD;
173 SIGNAL reg_wp : lpp_WaveformPicker_regs;
103
174
104 SIGNAL prdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
175 SIGNAL prdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
105
176
106 BEGIN -- beh
177 BEGIN -- beh
107
178
108 status_ready_matrix_f0_0 <= reg.status_ready_matrix_f0_0;
179 status_ready_matrix_f0_0 <= reg_sp.status_ready_matrix_f0_0;
109 status_ready_matrix_f0_1 <= reg.status_ready_matrix_f0_1;
180 status_ready_matrix_f0_1 <= reg_sp.status_ready_matrix_f0_1;
110 status_ready_matrix_f1 <= reg.status_ready_matrix_f1;
181 status_ready_matrix_f1 <= reg_sp.status_ready_matrix_f1;
111 status_ready_matrix_f2 <= reg.status_ready_matrix_f2;
182 status_ready_matrix_f2 <= reg_sp.status_ready_matrix_f2;
112 status_error_anticipating_empty_fifo <= reg.status_error_anticipating_empty_fifo;
183 status_error_anticipating_empty_fifo <= reg_sp.status_error_anticipating_empty_fifo;
113 status_error_bad_component_error <= reg.status_error_bad_component_error;
184 status_error_bad_component_error <= reg_sp.status_error_bad_component_error;
185
186 config_active_interruption_onNewMatrix <= reg_sp.config_active_interruption_onNewMatrix;
187 config_active_interruption_onError <= reg_sp.config_active_interruption_onError;
188 addr_matrix_f0_0 <= reg_sp.addr_matrix_f0_0;
189 addr_matrix_f0_1 <= reg_sp.addr_matrix_f0_1;
190 addr_matrix_f1 <= reg_sp.addr_matrix_f1;
191 addr_matrix_f2 <= reg_sp.addr_matrix_f2;
192
193
194
114
195
115 config_active_interruption_onNewMatrix <= reg.config_active_interruption_onNewMatrix;
196 data_shaping_BW <= reg_wp.data_shaping_BW;
116 config_active_interruption_onError <= reg.config_active_interruption_onError;
197 data_shaping_SP0 <= reg_wp.data_shaping_SP0;
117 addr_matrix_f0_0 <= reg.addr_matrix_f0_0;
198 data_shaping_SP1 <= reg_wp.data_shaping_SP1;
118 addr_matrix_f0_1 <= reg.addr_matrix_f0_1;
199 data_shaping_R0 <= reg_wp.data_shaping_R0;
119 addr_matrix_f1 <= reg.addr_matrix_f1;
200 data_shaping_R1 <= reg_wp.data_shaping_R1;
120 addr_matrix_f2 <= reg.addr_matrix_f2;
201
202 delta_snapshot <= reg_wp.delta_snapshot;
203 delta_f2_f1 <= reg_wp.delta_f2_f1;
204 delta_f2_f0 <= reg_wp.delta_f2_f0;
205 nb_burst_available <= reg_wp.nb_burst_available;
206 nb_snapshot_param <= reg_wp.nb_snapshot_param;
207
208 enable_f0 <= reg_wp.enable_f0;
209 enable_f1 <= reg_wp.enable_f1;
210 enable_f2 <= reg_wp.enable_f2;
211 enable_f3 <= reg_wp.enable_f3;
212
213 burst_f0 <= reg_wp.burst_f0;
214 burst_f1 <= reg_wp.burst_f1;
215 burst_f2 <= reg_wp.burst_f2;
216
217 addr_data_f0 <= reg_wp.addr_data_f0;
218 addr_data_f1 <= reg_wp.addr_data_f1;
219 addr_data_f2 <= reg_wp.addr_data_f2;
220 addr_data_f3 <= reg_wp.addr_data_f3;
121
221
122 lpp_top_apbreg : PROCESS (HCLK, HRESETn)
222 lpp_top_apbreg : PROCESS (HCLK, HRESETn)
123 VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2);
223 VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2);
124 BEGIN -- PROCESS lpp_dma_top
224 BEGIN -- PROCESS lpp_dma_top
125 IF HRESETn = '0' THEN -- asynchronous reset (active low)
225 IF HRESETn = '0' THEN -- asynchronous reset (active low)
126 reg.config_active_interruption_onNewMatrix <= '0';
226 reg_sp.config_active_interruption_onNewMatrix <= '0';
127 reg.config_active_interruption_onError <= '0';
227 reg_sp.config_active_interruption_onError <= '0';
128 reg.status_ready_matrix_f0_0 <= '0';
228 reg_sp.status_ready_matrix_f0_0 <= '0';
129 reg.status_ready_matrix_f0_1 <= '0';
229 reg_sp.status_ready_matrix_f0_1 <= '0';
130 reg.status_ready_matrix_f1 <= '0';
230 reg_sp.status_ready_matrix_f1 <= '0';
131 reg.status_ready_matrix_f2 <= '0';
231 reg_sp.status_ready_matrix_f2 <= '0';
132 reg.status_error_anticipating_empty_fifo <= '0';
232 reg_sp.status_error_anticipating_empty_fifo <= '0';
133 reg.status_error_bad_component_error <= '0';
233 reg_sp.status_error_bad_component_error <= '0';
134 reg.addr_matrix_f0_0 <= (OTHERS => '0');
234 reg_sp.addr_matrix_f0_0 <= (OTHERS => '0');
135 reg.addr_matrix_f0_1 <= (OTHERS => '0');
235 reg_sp.addr_matrix_f0_1 <= (OTHERS => '0');
136 reg.addr_matrix_f1 <= (OTHERS => '0');
236 reg_sp.addr_matrix_f1 <= (OTHERS => '0');
137 reg.addr_matrix_f2 <= (OTHERS => '0');
237 reg_sp.addr_matrix_f2 <= (OTHERS => '0');
138 prdata <= (OTHERS => '0');
238 prdata <= (OTHERS => '0');
139
239
140 apbo.pirq <= (OTHERS => '0');
240 apbo.pirq <= (OTHERS => '0');
141
241
142 ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge
242 status_full_ack <= (OTHERS => '0');
143
243
144 reg.status_ready_matrix_f0_0 <= reg.status_ready_matrix_f0_0 OR ready_matrix_f0_0;
244 reg_wp.data_shaping_BW <= '0';
145 reg.status_ready_matrix_f0_1 <= reg.status_ready_matrix_f0_1 OR ready_matrix_f0_1;
245 reg_wp.data_shaping_SP0 <= '0';
146 reg.status_ready_matrix_f1 <= reg.status_ready_matrix_f1 OR ready_matrix_f1;
246 reg_wp.data_shaping_SP1 <= '0';
147 reg.status_ready_matrix_f2 <= reg.status_ready_matrix_f2 OR ready_matrix_f2;
247 reg_wp.data_shaping_R0 <= '0';
248 reg_wp.data_shaping_R1 <= '0';
249 reg_wp.enable_f0 <= '0';
250 reg_wp.enable_f1 <= '0';
251 reg_wp.enable_f2 <= '0';
252 reg_wp.enable_f3 <= '0';
253 reg_wp.burst_f0 <= '0';
254 reg_wp.burst_f1 <= '0';
255 reg_wp.burst_f2 <= '0';
256 reg_wp.addr_data_f0 <= (OTHERS => '0');
257 reg_wp.addr_data_f1 <= (OTHERS => '0');
258 reg_wp.addr_data_f2 <= (OTHERS => '0');
259 reg_wp.addr_data_f3 <= (OTHERS => '0');
260 reg_wp.status_full <= (OTHERS => '0');
261 reg_wp.status_full_err <= (OTHERS => '0');
262 reg_wp.status_new_err <= (OTHERS => '0');
263 reg_wp.delta_snapshot <= (OTHERS => '0');
264 reg_wp.delta_f2_f1 <= (OTHERS => '0');
265 reg_wp.delta_f2_f0 <= (OTHERS => '0');
266 reg_wp.nb_burst_available <= (OTHERS => '0');
267 reg_wp.nb_snapshot_param <= (OTHERS => '0');
148
268
149 reg.status_error_anticipating_empty_fifo <= reg.status_error_anticipating_empty_fifo OR error_anticipating_empty_fifo;
269 ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge
150 reg.status_error_bad_component_error <= reg.status_error_bad_component_error OR error_bad_component_error;
270 status_full_ack <= (OTHERS => '0');
271
272 reg_sp.status_ready_matrix_f0_0 <= reg_sp.status_ready_matrix_f0_0 OR ready_matrix_f0_0;
273 reg_sp.status_ready_matrix_f0_1 <= reg_sp.status_ready_matrix_f0_1 OR ready_matrix_f0_1;
274 reg_sp.status_ready_matrix_f1 <= reg_sp.status_ready_matrix_f1 OR ready_matrix_f1;
275 reg_sp.status_ready_matrix_f2 <= reg_sp.status_ready_matrix_f2 OR ready_matrix_f2;
276
277 reg_sp.status_error_anticipating_empty_fifo <= reg_sp.status_error_anticipating_empty_fifo OR error_anticipating_empty_fifo;
278 reg_sp.status_error_bad_component_error <= reg_sp.status_error_bad_component_error OR error_bad_component_error;
279
280 reg_wp.status_full <= reg_wp.status_full OR status_full;
281 reg_wp.status_full_err <= reg_wp.status_full_err OR status_full_err;
282 reg_wp.status_new_err <= reg_wp.status_new_err OR status_new_err;
151
283
152 paddr := "000000";
284 paddr := "000000";
153 paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2);
285 paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2);
@@ -155,49 +287,113 BEGIN -- beh
155 IF apbi.psel(pindex) = '1' THEN
287 IF apbi.psel(pindex) = '1' THEN
156 -- APB DMA READ --
288 -- APB DMA READ --
157 CASE paddr(7 DOWNTO 2) IS
289 CASE paddr(7 DOWNTO 2) IS
158 WHEN "000000" => prdata(0) <= reg.config_active_interruption_onNewMatrix;
290 --
159 prdata(1) <= reg.config_active_interruption_onError;
291 WHEN "000000" => prdata(0) <= reg_sp.config_active_interruption_onNewMatrix;
160 WHEN "000001" => prdata(0) <= reg.status_ready_matrix_f0_0;
292 prdata(1) <= reg_sp.config_active_interruption_onError;
161 prdata(1) <= reg.status_ready_matrix_f0_1;
293 WHEN "000001" => prdata(0) <= reg_sp.status_ready_matrix_f0_0;
162 prdata(2) <= reg.status_ready_matrix_f1;
294 prdata(1) <= reg_sp.status_ready_matrix_f0_1;
163 prdata(3) <= reg.status_ready_matrix_f2;
295 prdata(2) <= reg_sp.status_ready_matrix_f1;
164 prdata(4) <= reg.status_error_anticipating_empty_fifo;
296 prdata(3) <= reg_sp.status_ready_matrix_f2;
165 prdata(5) <= reg.status_error_bad_component_error;
297 prdata(4) <= reg_sp.status_error_anticipating_empty_fifo;
166 WHEN "000010" => prdata <= reg.addr_matrix_f0_0;
298 prdata(5) <= reg_sp.status_error_bad_component_error;
167 WHEN "000011" => prdata <= reg.addr_matrix_f0_1;
299 WHEN "000010" => prdata <= reg_sp.addr_matrix_f0_0;
168 WHEN "000100" => prdata <= reg.addr_matrix_f1;
300 WHEN "000011" => prdata <= reg_sp.addr_matrix_f0_1;
169 WHEN "000101" => prdata <= reg.addr_matrix_f2;
301 WHEN "000100" => prdata <= reg_sp.addr_matrix_f1;
302 WHEN "000101" => prdata <= reg_sp.addr_matrix_f2;
170 WHEN "000110" => prdata <= debug_reg;
303 WHEN "000110" => prdata <= debug_reg;
304 --
305 WHEN "001000" => prdata(0) <= reg_wp.data_shaping_BW;
306 prdata(1) <= reg_wp.data_shaping_SP0;
307 prdata(2) <= reg_wp.data_shaping_SP1;
308 prdata(3) <= reg_wp.data_shaping_R0;
309 prdata(4) <= reg_wp.data_shaping_R1;
310 WHEN "001001" => prdata(0) <= reg_wp.enable_f0;
311 prdata(1) <= reg_wp.enable_f1;
312 prdata(2) <= reg_wp.enable_f2;
313 prdata(3) <= reg_wp.enable_f3;
314 prdata(4) <= reg_wp.burst_f0;
315 prdata(5) <= reg_wp.burst_f1;
316 prdata(6) <= reg_wp.burst_f2;
317 WHEN "001010" => prdata <= reg_wp.addr_data_f0;
318 WHEN "001011" => prdata <= reg_wp.addr_data_f1;
319 WHEN "001100" => prdata <= reg_wp.addr_data_f2;
320 WHEN "001101" => prdata <= reg_wp.addr_data_f3;
321 WHEN "001110" => prdata(3 DOWNTO 0) <= reg_wp.status_full;
322 prdata(7 DOWNTO 4) <= reg_wp.status_full_err;
323 prdata(11 DOWNTO 8) <= reg_wp.status_new_err;
324 WHEN "001111" => prdata(delta_snapshot_size-1 DOWNTO 0) <= reg_wp.delta_snapshot;
325 WHEN "010000" => prdata(delta_f2_f1_size-1 DOWNTO 0) <= reg_wp.delta_f2_f1;
326 WHEN "010001" => prdata(delta_f2_f0_size-1 DOWNTO 0) <= reg_wp.delta_f2_f0;
327 WHEN "010010" => prdata(nb_burst_available_size-1 DOWNTO 0) <= reg_wp.nb_burst_available;
328 WHEN "010011" => prdata(nb_snapshot_param_size-1 DOWNTO 0) <= reg_wp.nb_snapshot_param;
329 --
171 WHEN OTHERS => NULL;
330 WHEN OTHERS => NULL;
172 END CASE;
331 END CASE;
173 IF (apbi.pwrite AND apbi.penable) = '1' THEN
332 IF (apbi.pwrite AND apbi.penable) = '1' THEN
174 -- APB DMA WRITE --
333 -- APB DMA WRITE --
175 CASE paddr(7 DOWNTO 2) IS
334 CASE paddr(7 DOWNTO 2) IS
176 WHEN "000000" => reg.config_active_interruption_onNewMatrix <= apbi.pwdata(0);
335 --
177 reg.config_active_interruption_onError <= apbi.pwdata(1);
336 WHEN "000000" => reg_sp.config_active_interruption_onNewMatrix <= apbi.pwdata(0);
178 WHEN "000001" => reg.status_ready_matrix_f0_0 <= apbi.pwdata(0);
337 reg_sp.config_active_interruption_onError <= apbi.pwdata(1);
179 reg.status_ready_matrix_f0_1 <= apbi.pwdata(1);
338 WHEN "000001" => reg_sp.status_ready_matrix_f0_0 <= apbi.pwdata(0);
180 reg.status_ready_matrix_f1 <= apbi.pwdata(2);
339 reg_sp.status_ready_matrix_f0_1 <= apbi.pwdata(1);
181 reg.status_ready_matrix_f2 <= apbi.pwdata(3);
340 reg_sp.status_ready_matrix_f1 <= apbi.pwdata(2);
182 reg.status_error_anticipating_empty_fifo <= apbi.pwdata(4);
341 reg_sp.status_ready_matrix_f2 <= apbi.pwdata(3);
183 reg.status_error_bad_component_error <= apbi.pwdata(5);
342 reg_sp.status_error_anticipating_empty_fifo <= apbi.pwdata(4);
184 WHEN "000010" => reg.addr_matrix_f0_0 <= apbi.pwdata;
343 reg_sp.status_error_bad_component_error <= apbi.pwdata(5);
185 WHEN "000011" => reg.addr_matrix_f0_1 <= apbi.pwdata;
344 WHEN "000010" => reg_sp.addr_matrix_f0_0 <= apbi.pwdata;
186 WHEN "000100" => reg.addr_matrix_f1 <= apbi.pwdata;
345 WHEN "000011" => reg_sp.addr_matrix_f0_1 <= apbi.pwdata;
187 WHEN "000101" => reg.addr_matrix_f2 <= apbi.pwdata;
346 WHEN "000100" => reg_sp.addr_matrix_f1 <= apbi.pwdata;
347 WHEN "000101" => reg_sp.addr_matrix_f2 <= apbi.pwdata;
348 --
349 WHEN "001000" => reg_wp.data_shaping_BW <= apbi.pwdata(0);
350 reg_wp.data_shaping_SP0 <= apbi.pwdata(1);
351 reg_wp.data_shaping_SP1 <= apbi.pwdata(2);
352 reg_wp.data_shaping_R0 <= apbi.pwdata(3);
353 reg_wp.data_shaping_R1 <= apbi.pwdata(4);
354 WHEN "001001" => reg_wp.enable_f0 <= apbi.pwdata(0);
355 reg_wp.enable_f1 <= apbi.pwdata(1);
356 reg_wp.enable_f2 <= apbi.pwdata(2);
357 reg_wp.enable_f3 <= apbi.pwdata(3);
358 reg_wp.burst_f0 <= apbi.pwdata(4);
359 reg_wp.burst_f1 <= apbi.pwdata(5);
360 reg_wp.burst_f2 <= apbi.pwdata(6);
361 WHEN "001010" => reg_wp.addr_data_f0 <= apbi.pwdata;
362 WHEN "001011" => reg_wp.addr_data_f1 <= apbi.pwdata;
363 WHEN "001100" => reg_wp.addr_data_f2 <= apbi.pwdata;
364 WHEN "001101" => reg_wp.addr_data_f3 <= apbi.pwdata;
365 WHEN "001110" => reg_wp.status_full <= apbi.pwdata(3 DOWNTO 0);
366 reg_wp.status_full_err <= apbi.pwdata(7 DOWNTO 4);
367 reg_wp.status_new_err <= apbi.pwdata(11 DOWNTO 8);
368 status_full_ack(0) <= reg_wp.status_full(0) AND NOT apbi.pwdata(0);
369 status_full_ack(1) <= reg_wp.status_full(1) AND NOT apbi.pwdata(1);
370 status_full_ack(2) <= reg_wp.status_full(2) AND NOT apbi.pwdata(2);
371 status_full_ack(3) <= reg_wp.status_full(3) AND NOT apbi.pwdata(3);
372 WHEN "001111" => reg_wp.delta_snapshot <= apbi.pwdata(delta_snapshot_size-1 DOWNTO 0);
373 WHEN "010000" => reg_wp.delta_f2_f1 <= apbi.pwdata(delta_f2_f1_size-1 DOWNTO 0);
374 WHEN "010001" => reg_wp.delta_f2_f0 <= apbi.pwdata(delta_f2_f0_size-1 DOWNTO 0);
375 WHEN "010010" => reg_wp.nb_burst_available <= apbi.pwdata(nb_burst_available_size-1 DOWNTO 0);
376 WHEN "010011" => reg_wp.nb_snapshot_param <= apbi.pwdata(nb_snapshot_param_size-1 DOWNTO 0);
377 --
188 WHEN OTHERS => NULL;
378 WHEN OTHERS => NULL;
189 END CASE;
379 END CASE;
190 END IF;
380 END IF;
191 END IF;
381 END IF;
192
382
193 apbo.pirq(pirq) <= ( reg.config_active_interruption_onNewMatrix AND ( ready_matrix_f0_0 OR
383 apbo.pirq(pirq) <= (reg_sp.config_active_interruption_onNewMatrix AND (ready_matrix_f0_0 OR
194 ready_matrix_f0_1 OR
384 ready_matrix_f0_1 OR
195 ready_matrix_f1 OR
385 ready_matrix_f1 OR
196 ready_matrix_f2)
386 ready_matrix_f2)
197 )
387 )
198 OR
388 OR
199 ( reg.config_active_interruption_onError AND ( error_anticipating_empty_fifo OR
389 (reg_sp.config_active_interruption_onError AND (error_anticipating_empty_fifo OR
200 error_bad_component_error)
390 error_bad_component_error)
391 )
392 OR
393 (status_full(0) OR status_full_err(0) OR status_new_err(0) OR
394 status_full(1) OR status_full_err(1) OR status_new_err(1) OR
395 status_full(2) OR status_full_err(2) OR status_new_err(2) OR
396 status_full(3) OR status_full_err(3) OR status_new_err(3)
201 );
397 );
202
398
203
399
@@ -47,6 +47,11 PACKAGE lpp_top_lfr_pkg IS
47
47
48 COMPONENT lpp_top_apbreg
48 COMPONENT lpp_top_apbreg
49 GENERIC (
49 GENERIC (
50 nb_burst_available_size : INTEGER;
51 nb_snapshot_param_size : INTEGER;
52 delta_snapshot_size : INTEGER;
53 delta_f2_f0_size : INTEGER;
54 delta_f2_f1_size : INTEGER;
50 pindex : INTEGER;
55 pindex : INTEGER;
51 paddr : INTEGER;
56 paddr : INTEGER;
52 pmask : INTEGER;
57 pmask : INTEGER;
@@ -74,7 +79,120 PACKAGE lpp_top_lfr_pkg IS
74 addr_matrix_f0_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
79 addr_matrix_f0_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
75 addr_matrix_f0_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
80 addr_matrix_f0_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
76 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
81 addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
77 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
82 addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
83 status_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
84 status_full_ack : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
85 status_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
86 status_new_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
87 data_shaping_BW : OUT STD_LOGIC;
88 data_shaping_SP0 : OUT STD_LOGIC;
89 data_shaping_SP1 : OUT STD_LOGIC;
90 data_shaping_R0 : OUT STD_LOGIC;
91 data_shaping_R1 : OUT STD_LOGIC;
92 delta_snapshot : OUT STD_LOGIC_VECTOR(delta_snapshot_size-1 DOWNTO 0);
93 delta_f2_f1 : OUT STD_LOGIC_VECTOR(delta_f2_f1_size-1 DOWNTO 0);
94 delta_f2_f0 : OUT STD_LOGIC_VECTOR(delta_f2_f0_size-1 DOWNTO 0);
95 nb_burst_available : OUT STD_LOGIC_VECTOR(nb_burst_available_size-1 DOWNTO 0);
96 nb_snapshot_param : OUT STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
97 enable_f0 : OUT STD_LOGIC;
98 enable_f1 : OUT STD_LOGIC;
99 enable_f2 : OUT STD_LOGIC;
100 enable_f3 : OUT STD_LOGIC;
101 burst_f0 : OUT STD_LOGIC;
102 burst_f1 : OUT STD_LOGIC;
103 burst_f2 : OUT STD_LOGIC;
104 addr_data_f0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
105 addr_data_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
106 addr_data_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0);
107 addr_data_f3 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0));
108 END COMPONENT;
109
110 COMPONENT lpp_top_lfr_wf_picker
111 GENERIC (
112 hindex : INTEGER;
113 pindex : INTEGER;
114 paddr : INTEGER;
115 pmask : INTEGER;
116 pirq : INTEGER;
117 tech : INTEGER;
118 nb_burst_available_size : INTEGER;
119 nb_snapshot_param_size : INTEGER;
120 delta_snapshot_size : INTEGER;
121 delta_f2_f0_size : INTEGER;
122 delta_f2_f1_size : INTEGER);
123 PORT (
124 cnv_run : IN STD_LOGIC;
125 cnv : OUT STD_LOGIC;
126 sck : OUT STD_LOGIC;
127 sdo : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
128 cnv_clk : IN STD_LOGIC;
129 cnv_rstn : IN STD_LOGIC;
130 HCLK : IN STD_ULOGIC;
131 HRESETn : IN STD_ULOGIC;
132 apbi : IN apb_slv_in_type;
133 apbo : OUT apb_slv_out_type;
134 AHB_Master_In : IN AHB_Mst_In_Type;
135 AHB_Master_Out : OUT AHB_Mst_Out_Type;
136 coarse_time_0 : IN STD_LOGIC;
137 data_shaping_BW : OUT STD_LOGIC);
78 END COMPONENT;
138 END COMPONENT;
79
139
80 END lpp_top_lfr_pkg; No newline at end of file
140
141 COMPONENT lpp_top_lfr_wf_picker_ip
142 GENERIC (
143 hindex : INTEGER;
144 nb_burst_available_size : INTEGER;
145 nb_snapshot_param_size : INTEGER;
146 delta_snapshot_size : INTEGER;
147 delta_f2_f0_size : INTEGER;
148 delta_f2_f1_size : INTEGER;
149 tech : INTEGER);
150 PORT (
151 cnv_run : IN STD_LOGIC;
152 cnv : OUT STD_LOGIC;
153 sck : OUT STD_LOGIC;
154 sdo : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
155 cnv_clk : IN STD_LOGIC;
156 cnv_rstn : IN STD_LOGIC;
157 clk : IN STD_LOGIC;
158 rstn : IN STD_LOGIC;
159 sample_f0_wen : OUT STD_LOGIC_VECTOR(5 DOWNTO 0);
160 sample_f0_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
161 sample_f1_wen : OUT STD_LOGIC_VECTOR(5 DOWNTO 0);
162 sample_f1_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
163 sample_f2_wen : OUT STD_LOGIC_VECTOR(5 DOWNTO 0);
164 sample_f2_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
165 sample_f3_wen : OUT STD_LOGIC_VECTOR(5 DOWNTO 0);
166 sample_f3_wdata : OUT STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0);
167 AHB_Master_In : IN AHB_Mst_In_Type;
168 AHB_Master_Out : OUT AHB_Mst_Out_Type;
169 coarse_time_0 : IN STD_LOGIC;
170 data_shaping_SP0 : IN STD_LOGIC;
171 data_shaping_SP1 : IN STD_LOGIC;
172 data_shaping_R0 : IN STD_LOGIC;
173 data_shaping_R1 : IN STD_LOGIC;
174 delta_snapshot : IN STD_LOGIC_VECTOR(delta_snapshot_size-1 DOWNTO 0);
175 delta_f2_f1 : IN STD_LOGIC_VECTOR(delta_f2_f1_size-1 DOWNTO 0);
176 delta_f2_f0 : IN STD_LOGIC_VECTOR(delta_f2_f0_size-1 DOWNTO 0);
177 enable_f0 : IN STD_LOGIC;
178 enable_f1 : IN STD_LOGIC;
179 enable_f2 : IN STD_LOGIC;
180 enable_f3 : IN STD_LOGIC;
181 burst_f0 : IN STD_LOGIC;
182 burst_f1 : IN STD_LOGIC;
183 burst_f2 : IN STD_LOGIC;
184 nb_burst_available : IN STD_LOGIC_VECTOR(nb_burst_available_size-1 DOWNTO 0);
185 nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0);
186 status_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
187 status_full_ack : IN STD_LOGIC_VECTOR(3 DOWNTO 0);
188 status_full_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
189 status_new_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
190 addr_data_f0 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
191 addr_data_f1 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
192 addr_data_f2 : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
193 addr_data_f3 : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
194 END COMPONENT;
195
196
197
198 END lpp_top_lfr_pkg;
@@ -59,12 +59,13 ARCHITECTURE Behavioral OF lpp_waveform_
59 SIGNAL nb_send_next : STD_LOGIC_VECTOR(nb_burst_available_size-1 DOWNTO 0);
59 SIGNAL nb_send_next : STD_LOGIC_VECTOR(nb_burst_available_size-1 DOWNTO 0);
60
60
61 SIGNAL update_s : STD_LOGIC;
61 SIGNAL update_s : STD_LOGIC;
62 SIGNAL update_r : STD_LOGIC_VECTOR(1 DOWNTO 0);
62 BEGIN
63 BEGIN
63
64
64 update_s <= update(0) OR update(1);
65 update_s <= update(0) OR update(1);
65
66
66 addr_data <= address;
67 addr_data <= address;
67 nb_send_next <= std_logic_vector(unsigned(nb_send) + 1);
68 nb_send_next <= STD_LOGIC_VECTOR(UNSIGNED(nb_send) + 1);
68
69
69 FSM_SELECT_ADDRESS : PROCESS (HCLK, HRESETn)
70 FSM_SELECT_ADDRESS : PROCESS (HCLK, HRESETn)
70 BEGIN
71 BEGIN
@@ -74,7 +75,9 BEGIN
74 nb_send <= (OTHERS => '0');
75 nb_send <= (OTHERS => '0');
75 status_full <= '0';
76 status_full <= '0';
76 status_full_err <= '0';
77 status_full_err <= '0';
78 update_r <= "00";
77 ELSIF HCLK'EVENT AND HCLK = '1' THEN
79 ELSIF HCLK'EVENT AND HCLK = '1' THEN
80 update_r <= update;
78 CASE state IS
81 CASE state IS
79 WHEN IDLE =>
82 WHEN IDLE =>
80 IF update_s = '1' THEN
83 IF update_s = '1' THEN
@@ -84,11 +87,11 BEGIN
84 WHEN ADD =>
87 WHEN ADD =>
85 IF UNSIGNED(nb_send_next) < UNSIGNED(nb_burst_available) THEN
88 IF UNSIGNED(nb_send_next) < UNSIGNED(nb_burst_available) THEN
86 state <= IDLE;
89 state <= IDLE;
87 IF update = "10" THEN
90 IF update_r = "10" THEN
88 address <= std_logic_vector(unsigned(address) + 16);
91 address <= STD_LOGIC_VECTOR(UNSIGNED(address) + 64);
89 nb_send <= nb_send_next;
92 nb_send <= nb_send_next;
90 ELSIF update = "01" THEN
93 ELSIF update_r = "01" THEN
91 address <= std_logic_vector(unsigned(address) + 1);
94 address <= STD_LOGIC_VECTOR(UNSIGNED(address) + 4);
92 END IF;
95 END IF;
93 ELSE
96 ELSE
94 state <= FULL;
97 state <= FULL;
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now