@@ -1,733 +1,733 | |||||
1 | ------------------------------------------------------------------------------ |
|
1 | ------------------------------------------------------------------------------ | |
2 | -- This file is a part of the LPP VHDL IP LIBRARY |
|
2 | -- This file is a part of the LPP VHDL IP LIBRARY | |
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS |
|
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 3 of the License, or |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | ------------------------------------------------------------------------------- |
|
18 | ------------------------------------------------------------------------------- | |
19 | -- Author : Jean-christophe Pellion |
|
19 | -- Author : Jean-christophe Pellion | |
20 | -- Mail : jean-christophe.pellion@lpp.polytechnique.fr |
|
20 | -- Mail : jean-christophe.pellion@lpp.polytechnique.fr | |
21 | ------------------------------------------------------------------------------- |
|
21 | ------------------------------------------------------------------------------- | |
22 | LIBRARY IEEE; |
|
22 | LIBRARY IEEE; | |
23 | USE IEEE.numeric_std.ALL; |
|
23 | USE IEEE.numeric_std.ALL; | |
24 | USE IEEE.std_logic_1164.ALL; |
|
24 | USE IEEE.std_logic_1164.ALL; | |
25 | LIBRARY grlib; |
|
25 | LIBRARY grlib; | |
26 | USE grlib.amba.ALL; |
|
26 | USE grlib.amba.ALL; | |
27 | USE grlib.stdlib.ALL; |
|
27 | USE grlib.stdlib.ALL; | |
28 | LIBRARY techmap; |
|
28 | LIBRARY techmap; | |
29 | USE techmap.gencomp.ALL; |
|
29 | USE techmap.gencomp.ALL; | |
30 | LIBRARY gaisler; |
|
30 | LIBRARY gaisler; | |
31 | USE gaisler.memctrl.ALL; |
|
31 | USE gaisler.memctrl.ALL; | |
32 | USE gaisler.leon3.ALL; |
|
32 | USE gaisler.leon3.ALL; | |
33 | USE gaisler.uart.ALL; |
|
33 | USE gaisler.uart.ALL; | |
34 | USE gaisler.misc.ALL; |
|
34 | USE gaisler.misc.ALL; | |
35 | USE gaisler.spacewire.ALL; |
|
35 | USE gaisler.spacewire.ALL; | |
36 | LIBRARY esa; |
|
36 | LIBRARY esa; | |
37 | USE esa.memoryctrl.ALL; |
|
37 | USE esa.memoryctrl.ALL; | |
38 | LIBRARY lpp; |
|
38 | LIBRARY lpp; | |
39 | USE lpp.lpp_memory.ALL; |
|
39 | USE lpp.lpp_memory.ALL; | |
40 | USE lpp.lpp_ad_conv.ALL; |
|
40 | USE lpp.lpp_ad_conv.ALL; | |
41 | USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib |
|
41 | USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib | |
42 | USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker |
|
42 | USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker | |
43 | USE lpp.iir_filter.ALL; |
|
43 | USE lpp.iir_filter.ALL; | |
44 | USE lpp.general_purpose.ALL; |
|
44 | USE lpp.general_purpose.ALL; | |
45 | USE lpp.lpp_lfr_management.ALL; |
|
45 | USE lpp.lpp_lfr_management.ALL; | |
46 | USE lpp.lpp_leon3_soc_pkg.ALL; |
|
46 | USE lpp.lpp_leon3_soc_pkg.ALL; | |
47 |
|
47 | |||
48 | ENTITY MINI_LFR_top IS |
|
48 | ENTITY MINI_LFR_top IS | |
49 |
|
49 | |||
50 | PORT ( |
|
50 | PORT ( | |
51 | clk_50 : IN STD_LOGIC; |
|
51 | clk_50 : IN STD_LOGIC; | |
52 | clk_49 : IN STD_LOGIC; |
|
52 | clk_49 : IN STD_LOGIC; | |
53 | reset : IN STD_LOGIC; |
|
53 | reset : IN STD_LOGIC; | |
54 | --BPs |
|
54 | --BPs | |
55 | BP0 : IN STD_LOGIC; |
|
55 | BP0 : IN STD_LOGIC; | |
56 | BP1 : IN STD_LOGIC; |
|
56 | BP1 : IN STD_LOGIC; | |
57 | --LEDs |
|
57 | --LEDs | |
58 | LED0 : OUT STD_LOGIC; |
|
58 | LED0 : OUT STD_LOGIC; | |
59 | LED1 : OUT STD_LOGIC; |
|
59 | LED1 : OUT STD_LOGIC; | |
60 | LED2 : OUT STD_LOGIC; |
|
60 | LED2 : OUT STD_LOGIC; | |
61 | --UARTs |
|
61 | --UARTs | |
62 | TXD1 : IN STD_LOGIC; |
|
62 | TXD1 : IN STD_LOGIC; | |
63 | RXD1 : OUT STD_LOGIC; |
|
63 | RXD1 : OUT STD_LOGIC; | |
64 | nCTS1 : OUT STD_LOGIC; |
|
64 | nCTS1 : OUT STD_LOGIC; | |
65 | nRTS1 : IN STD_LOGIC; |
|
65 | nRTS1 : IN STD_LOGIC; | |
66 |
|
66 | |||
67 | TXD2 : IN STD_LOGIC; |
|
67 | TXD2 : IN STD_LOGIC; | |
68 | RXD2 : OUT STD_LOGIC; |
|
68 | RXD2 : OUT STD_LOGIC; | |
69 | nCTS2 : OUT STD_LOGIC; |
|
69 | nCTS2 : OUT STD_LOGIC; | |
70 | nDTR2 : IN STD_LOGIC; |
|
70 | nDTR2 : IN STD_LOGIC; | |
71 | nRTS2 : IN STD_LOGIC; |
|
71 | nRTS2 : IN STD_LOGIC; | |
72 | nDCD2 : OUT STD_LOGIC; |
|
72 | nDCD2 : OUT STD_LOGIC; | |
73 |
|
73 | |||
74 | --EXT CONNECTOR |
|
74 | --EXT CONNECTOR | |
75 | IO0 : INOUT STD_LOGIC; |
|
75 | IO0 : INOUT STD_LOGIC; | |
76 | IO1 : INOUT STD_LOGIC; |
|
76 | IO1 : INOUT STD_LOGIC; | |
77 | IO2 : INOUT STD_LOGIC; |
|
77 | IO2 : INOUT STD_LOGIC; | |
78 | IO3 : INOUT STD_LOGIC; |
|
78 | IO3 : INOUT STD_LOGIC; | |
79 | IO4 : INOUT STD_LOGIC; |
|
79 | IO4 : INOUT STD_LOGIC; | |
80 | IO5 : INOUT STD_LOGIC; |
|
80 | IO5 : INOUT STD_LOGIC; | |
81 | IO6 : INOUT STD_LOGIC; |
|
81 | IO6 : INOUT STD_LOGIC; | |
82 | IO7 : INOUT STD_LOGIC; |
|
82 | IO7 : INOUT STD_LOGIC; | |
83 | IO8 : INOUT STD_LOGIC; |
|
83 | IO8 : INOUT STD_LOGIC; | |
84 | IO9 : INOUT STD_LOGIC; |
|
84 | IO9 : INOUT STD_LOGIC; | |
85 | IO10 : INOUT STD_LOGIC; |
|
85 | IO10 : INOUT STD_LOGIC; | |
86 | IO11 : INOUT STD_LOGIC; |
|
86 | IO11 : INOUT STD_LOGIC; | |
87 |
|
87 | |||
88 | --SPACE WIRE |
|
88 | --SPACE WIRE | |
89 | SPW_EN : OUT STD_LOGIC; -- 0 => off |
|
89 | SPW_EN : OUT STD_LOGIC; -- 0 => off | |
90 | SPW_NOM_DIN : IN STD_LOGIC; -- NOMINAL LINK |
|
90 | SPW_NOM_DIN : IN STD_LOGIC; -- NOMINAL LINK | |
91 | SPW_NOM_SIN : IN STD_LOGIC; |
|
91 | SPW_NOM_SIN : IN STD_LOGIC; | |
92 | SPW_NOM_DOUT : OUT STD_LOGIC; |
|
92 | SPW_NOM_DOUT : OUT STD_LOGIC; | |
93 | SPW_NOM_SOUT : OUT STD_LOGIC; |
|
93 | SPW_NOM_SOUT : OUT STD_LOGIC; | |
94 | SPW_RED_DIN : IN STD_LOGIC; -- REDUNDANT LINK |
|
94 | SPW_RED_DIN : IN STD_LOGIC; -- REDUNDANT LINK | |
95 | SPW_RED_SIN : IN STD_LOGIC; |
|
95 | SPW_RED_SIN : IN STD_LOGIC; | |
96 | SPW_RED_DOUT : OUT STD_LOGIC; |
|
96 | SPW_RED_DOUT : OUT STD_LOGIC; | |
97 | SPW_RED_SOUT : OUT STD_LOGIC; |
|
97 | SPW_RED_SOUT : OUT STD_LOGIC; | |
98 | -- MINI LFR ADC INPUTS |
|
98 | -- MINI LFR ADC INPUTS | |
99 | ADC_nCS : OUT STD_LOGIC; |
|
99 | ADC_nCS : OUT STD_LOGIC; | |
100 | ADC_CLK : OUT STD_LOGIC; |
|
100 | ADC_CLK : OUT STD_LOGIC; | |
101 | ADC_SDO : IN STD_LOGIC_VECTOR(7 DOWNTO 0); |
|
101 | ADC_SDO : IN STD_LOGIC_VECTOR(7 DOWNTO 0); | |
102 |
|
102 | |||
103 | -- SRAM |
|
103 | -- SRAM | |
104 | SRAM_nWE : OUT STD_LOGIC; |
|
104 | SRAM_nWE : OUT STD_LOGIC; | |
105 | SRAM_CE : OUT STD_LOGIC; |
|
105 | SRAM_CE : OUT STD_LOGIC; | |
106 | SRAM_nOE : OUT STD_LOGIC; |
|
106 | SRAM_nOE : OUT STD_LOGIC; | |
107 | SRAM_nBE : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); |
|
107 | SRAM_nBE : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); | |
108 | SRAM_A : OUT STD_LOGIC_VECTOR(19 DOWNTO 0); |
|
108 | SRAM_A : OUT STD_LOGIC_VECTOR(19 DOWNTO 0); | |
109 | SRAM_DQ : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0) |
|
109 | SRAM_DQ : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0) | |
110 | ); |
|
110 | ); | |
111 |
|
111 | |||
112 | END MINI_LFR_top; |
|
112 | END MINI_LFR_top; | |
113 |
|
113 | |||
114 |
|
114 | |||
115 | ARCHITECTURE beh OF MINI_LFR_top IS |
|
115 | ARCHITECTURE beh OF MINI_LFR_top IS | |
116 | SIGNAL clk_50_s : STD_LOGIC := '0'; |
|
116 | SIGNAL clk_50_s : STD_LOGIC := '0'; | |
117 | SIGNAL clk_25 : STD_LOGIC := '0'; |
|
117 | SIGNAL clk_25 : STD_LOGIC := '0'; | |
118 | SIGNAL clk_24 : STD_LOGIC := '0'; |
|
118 | SIGNAL clk_24 : STD_LOGIC := '0'; | |
119 | ----------------------------------------------------------------------------- |
|
119 | ----------------------------------------------------------------------------- | |
120 | SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
120 | SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
121 | SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0); |
|
121 | SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0); | |
122 | -- |
|
122 | -- | |
123 | SIGNAL errorn : STD_LOGIC; |
|
123 | SIGNAL errorn : STD_LOGIC; | |
124 | -- UART AHB --------------------------------------------------------------- |
|
124 | -- UART AHB --------------------------------------------------------------- | |
125 | -- SIGNAL ahbrxd : STD_ULOGIC; -- DSU rx data |
|
125 | -- SIGNAL ahbrxd : STD_ULOGIC; -- DSU rx data | |
126 | -- SIGNAL ahbtxd : STD_ULOGIC; -- DSU tx data |
|
126 | -- SIGNAL ahbtxd : STD_ULOGIC; -- DSU tx data | |
127 |
|
127 | |||
128 | -- UART APB --------------------------------------------------------------- |
|
128 | -- UART APB --------------------------------------------------------------- | |
129 | -- SIGNAL urxd1 : STD_ULOGIC; -- UART1 rx data |
|
129 | -- SIGNAL urxd1 : STD_ULOGIC; -- UART1 rx data | |
130 | -- SIGNAL utxd1 : STD_ULOGIC; -- UART1 tx data |
|
130 | -- SIGNAL utxd1 : STD_ULOGIC; -- UART1 tx data | |
131 | -- |
|
131 | -- | |
132 | SIGNAL I00_s : STD_LOGIC; |
|
132 | SIGNAL I00_s : STD_LOGIC; | |
133 |
|
133 | |||
134 | -- CONSTANTS |
|
134 | -- CONSTANTS | |
135 | CONSTANT CFG_PADTECH : INTEGER := inferred; |
|
135 | CONSTANT CFG_PADTECH : INTEGER := inferred; | |
136 | -- |
|
136 | -- | |
137 | CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f |
|
137 | CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f | |
138 | CONSTANT NB_AHB_SLAVE : INTEGER := 1; |
|
138 | CONSTANT NB_AHB_SLAVE : INTEGER := 1; | |
139 | CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker |
|
139 | CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker | |
140 |
|
140 | |||
141 | SIGNAL apbi_ext : apb_slv_in_type; |
|
141 | SIGNAL apbi_ext : apb_slv_in_type; | |
142 | SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5); -- := (OTHERS => apb_none); |
|
142 | SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5); -- := (OTHERS => apb_none); | |
143 | SIGNAL ahbi_s_ext : ahb_slv_in_type; |
|
143 | SIGNAL ahbi_s_ext : ahb_slv_in_type; | |
144 | SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3); -- := (OTHERS => ahbs_none); |
|
144 | SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3); -- := (OTHERS => ahbs_none); | |
145 | SIGNAL ahbi_m_ext : AHB_Mst_In_Type; |
|
145 | SIGNAL ahbi_m_ext : AHB_Mst_In_Type; | |
146 | SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1); -- := (OTHERS => ahbm_none); |
|
146 | SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1); -- := (OTHERS => ahbm_none); | |
147 |
|
147 | |||
148 | -- Spacewire signals |
|
148 | -- Spacewire signals | |
149 | SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0); |
|
149 | SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0); | |
150 | SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0); |
|
150 | SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0); | |
151 | SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0); |
|
151 | SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0); | |
152 | SIGNAL spw_rxtxclk : STD_ULOGIC; |
|
152 | SIGNAL spw_rxtxclk : STD_ULOGIC; | |
153 | SIGNAL spw_rxclkn : STD_ULOGIC; |
|
153 | SIGNAL spw_rxclkn : STD_ULOGIC; | |
154 | SIGNAL spw_clk : STD_LOGIC; |
|
154 | SIGNAL spw_clk : STD_LOGIC; | |
155 | SIGNAL swni : grspw_in_type; |
|
155 | SIGNAL swni : grspw_in_type; | |
156 | SIGNAL swno : grspw_out_type; |
|
156 | SIGNAL swno : grspw_out_type; | |
157 | -- SIGNAL clkmn : STD_ULOGIC; |
|
157 | -- SIGNAL clkmn : STD_ULOGIC; | |
158 | -- SIGNAL txclk : STD_ULOGIC; |
|
158 | -- SIGNAL txclk : STD_ULOGIC; | |
159 |
|
159 | |||
160 | --GPIO |
|
160 | --GPIO | |
161 | SIGNAL gpioi : gpio_in_type; |
|
161 | SIGNAL gpioi : gpio_in_type; | |
162 | SIGNAL gpioo : gpio_out_type; |
|
162 | SIGNAL gpioo : gpio_out_type; | |
163 |
|
163 | |||
164 | -- AD Converter ADS7886 |
|
164 | -- AD Converter ADS7886 | |
165 | SIGNAL sample : Samples14v(7 DOWNTO 0); |
|
165 | SIGNAL sample : Samples14v(7 DOWNTO 0); | |
166 | SIGNAL sample_s : Samples(7 DOWNTO 0); |
|
166 | SIGNAL sample_s : Samples(7 DOWNTO 0); | |
167 | SIGNAL sample_val : STD_LOGIC; |
|
167 | SIGNAL sample_val : STD_LOGIC; | |
168 | SIGNAL ADC_nCS_sig : STD_LOGIC; |
|
168 | SIGNAL ADC_nCS_sig : STD_LOGIC; | |
169 | SIGNAL ADC_CLK_sig : STD_LOGIC; |
|
169 | SIGNAL ADC_CLK_sig : STD_LOGIC; | |
170 | SIGNAL ADC_SDO_sig : STD_LOGIC_VECTOR(7 DOWNTO 0); |
|
170 | SIGNAL ADC_SDO_sig : STD_LOGIC_VECTOR(7 DOWNTO 0); | |
171 |
|
171 | |||
172 | SIGNAL bias_fail_sw_sig : STD_LOGIC; |
|
172 | SIGNAL bias_fail_sw_sig : STD_LOGIC; | |
173 |
|
173 | |||
174 | SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
174 | SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
175 | SIGNAL observation_vector_0 : STD_LOGIC_VECTOR(11 DOWNTO 0); |
|
175 | SIGNAL observation_vector_0 : STD_LOGIC_VECTOR(11 DOWNTO 0); | |
176 | SIGNAL observation_vector_1 : STD_LOGIC_VECTOR(11 DOWNTO 0); |
|
176 | SIGNAL observation_vector_1 : STD_LOGIC_VECTOR(11 DOWNTO 0); | |
177 | ----------------------------------------------------------------------------- |
|
177 | ----------------------------------------------------------------------------- | |
178 |
|
178 | |||
179 | SIGNAL LFR_soft_rstn : STD_LOGIC; |
|
179 | SIGNAL LFR_soft_rstn : STD_LOGIC; | |
180 | SIGNAL LFR_rstn : STD_LOGIC; |
|
180 | SIGNAL LFR_rstn : STD_LOGIC; | |
181 |
|
181 | |||
182 |
|
182 | |||
183 | SIGNAL rstn_25 : STD_LOGIC; |
|
183 | SIGNAL rstn_25 : STD_LOGIC; | |
184 | SIGNAL rstn_25_d1 : STD_LOGIC; |
|
184 | SIGNAL rstn_25_d1 : STD_LOGIC; | |
185 | SIGNAL rstn_25_d2 : STD_LOGIC; |
|
185 | SIGNAL rstn_25_d2 : STD_LOGIC; | |
186 | SIGNAL rstn_25_d3 : STD_LOGIC; |
|
186 | SIGNAL rstn_25_d3 : STD_LOGIC; | |
187 |
|
187 | |||
188 | SIGNAL rstn_50 : STD_LOGIC; |
|
188 | SIGNAL rstn_50 : STD_LOGIC; | |
189 | SIGNAL rstn_50_d1 : STD_LOGIC; |
|
189 | SIGNAL rstn_50_d1 : STD_LOGIC; | |
190 | SIGNAL rstn_50_d2 : STD_LOGIC; |
|
190 | SIGNAL rstn_50_d2 : STD_LOGIC; | |
191 | SIGNAL rstn_50_d3 : STD_LOGIC; |
|
191 | SIGNAL rstn_50_d3 : STD_LOGIC; | |
192 |
|
192 | |||
193 | SIGNAL lfr_debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0); |
|
193 | SIGNAL lfr_debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0); | |
194 | SIGNAL lfr_debug_vector_ms : STD_LOGIC_VECTOR(11 DOWNTO 0); |
|
194 | SIGNAL lfr_debug_vector_ms : STD_LOGIC_VECTOR(11 DOWNTO 0); | |
195 |
|
195 | |||
196 | -- |
|
196 | -- | |
197 | SIGNAL SRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0); |
|
197 | SIGNAL SRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0); | |
198 |
|
198 | |||
199 | -- |
|
199 | -- | |
200 | SIGNAL sample_hk : STD_LOGIC_VECTOR(15 DOWNTO 0); |
|
200 | SIGNAL sample_hk : STD_LOGIC_VECTOR(15 DOWNTO 0); | |
201 | SIGNAL HK_SEL : STD_LOGIC_VECTOR( 1 DOWNTO 0); |
|
201 | SIGNAL HK_SEL : STD_LOGIC_VECTOR( 1 DOWNTO 0); | |
202 |
|
202 | |||
203 | BEGIN -- beh |
|
203 | BEGIN -- beh | |
204 |
|
204 | |||
205 | ----------------------------------------------------------------------------- |
|
205 | ----------------------------------------------------------------------------- | |
206 | -- CLK |
|
206 | -- CLK | |
207 | ----------------------------------------------------------------------------- |
|
207 | ----------------------------------------------------------------------------- | |
208 |
|
208 | |||
209 | --PROCESS(clk_50) |
|
209 | --PROCESS(clk_50) | |
210 | --BEGIN |
|
210 | --BEGIN | |
211 | -- IF clk_50'EVENT AND clk_50 = '1' THEN |
|
211 | -- IF clk_50'EVENT AND clk_50 = '1' THEN | |
212 | -- clk_50_s <= NOT clk_50_s; |
|
212 | -- clk_50_s <= NOT clk_50_s; | |
213 | -- END IF; |
|
213 | -- END IF; | |
214 | --END PROCESS; |
|
214 | --END PROCESS; | |
215 |
|
215 | |||
216 | --PROCESS(clk_50_s) |
|
216 | --PROCESS(clk_50_s) | |
217 | --BEGIN |
|
217 | --BEGIN | |
218 | -- IF clk_50_s'EVENT AND clk_50_s = '1' THEN |
|
218 | -- IF clk_50_s'EVENT AND clk_50_s = '1' THEN | |
219 | -- clk_25 <= NOT clk_25; |
|
219 | -- clk_25 <= NOT clk_25; | |
220 | -- END IF; |
|
220 | -- END IF; | |
221 | --END PROCESS; |
|
221 | --END PROCESS; | |
222 |
|
222 | |||
223 | --PROCESS(clk_49) |
|
223 | --PROCESS(clk_49) | |
224 | --BEGIN |
|
224 | --BEGIN | |
225 | -- IF clk_49'EVENT AND clk_49 = '1' THEN |
|
225 | -- IF clk_49'EVENT AND clk_49 = '1' THEN | |
226 | -- clk_24 <= NOT clk_24; |
|
226 | -- clk_24 <= NOT clk_24; | |
227 | -- END IF; |
|
227 | -- END IF; | |
228 | --END PROCESS; |
|
228 | --END PROCESS; | |
229 |
|
229 | |||
230 | --PROCESS(clk_25) |
|
230 | --PROCESS(clk_25) | |
231 | --BEGIN |
|
231 | --BEGIN | |
232 | -- IF clk_25'EVENT AND clk_25 = '1' THEN |
|
232 | -- IF clk_25'EVENT AND clk_25 = '1' THEN | |
233 | -- rstn_25 <= reset; |
|
233 | -- rstn_25 <= reset; | |
234 | -- END IF; |
|
234 | -- END IF; | |
235 | --END PROCESS; |
|
235 | --END PROCESS; | |
236 |
|
236 | |||
237 | PROCESS (clk_50, reset) |
|
237 | PROCESS (clk_50, reset) | |
238 | BEGIN -- PROCESS |
|
238 | BEGIN -- PROCESS | |
239 | IF reset = '0' THEN -- asynchronous reset (active low) |
|
239 | IF reset = '0' THEN -- asynchronous reset (active low) | |
240 | clk_50_s <= '0'; |
|
240 | clk_50_s <= '0'; | |
241 | rstn_50 <= '0'; |
|
241 | rstn_50 <= '0'; | |
242 | rstn_50_d1 <= '0'; |
|
242 | rstn_50_d1 <= '0'; | |
243 | rstn_50_d2 <= '0'; |
|
243 | rstn_50_d2 <= '0'; | |
244 | rstn_50_d3 <= '0'; |
|
244 | rstn_50_d3 <= '0'; | |
245 |
|
245 | |||
246 | ELSIF clk_50'EVENT AND clk_50 = '1' THEN -- rising clock edge |
|
246 | ELSIF clk_50'EVENT AND clk_50 = '1' THEN -- rising clock edge | |
247 | clk_50_s <= NOT clk_50_s; |
|
247 | clk_50_s <= NOT clk_50_s; | |
248 | rstn_50_d1 <= '1'; |
|
248 | rstn_50_d1 <= '1'; | |
249 | rstn_50_d2 <= rstn_50_d1; |
|
249 | rstn_50_d2 <= rstn_50_d1; | |
250 | rstn_50_d3 <= rstn_50_d2; |
|
250 | rstn_50_d3 <= rstn_50_d2; | |
251 | rstn_50 <= rstn_50_d3; |
|
251 | rstn_50 <= rstn_50_d3; | |
252 | END IF; |
|
252 | END IF; | |
253 | END PROCESS; |
|
253 | END PROCESS; | |
254 |
|
254 | |||
255 | PROCESS (clk_50_s, rstn_50) |
|
255 | PROCESS (clk_50_s, rstn_50) | |
256 | BEGIN -- PROCESS |
|
256 | BEGIN -- PROCESS | |
257 | IF rstn_50 = '0' THEN -- asynchronous reset (active low) |
|
257 | IF rstn_50 = '0' THEN -- asynchronous reset (active low) | |
258 | clk_25 <= '0'; |
|
258 | clk_25 <= '0'; | |
259 | rstn_25 <= '0'; |
|
259 | rstn_25 <= '0'; | |
260 | rstn_25_d1 <= '0'; |
|
260 | rstn_25_d1 <= '0'; | |
261 | rstn_25_d2 <= '0'; |
|
261 | rstn_25_d2 <= '0'; | |
262 | rstn_25_d3 <= '0'; |
|
262 | rstn_25_d3 <= '0'; | |
263 | ELSIF clk_50_s'EVENT AND clk_50_s = '1' THEN -- rising clock edge |
|
263 | ELSIF clk_50_s'EVENT AND clk_50_s = '1' THEN -- rising clock edge | |
264 | clk_25 <= NOT clk_25; |
|
264 | clk_25 <= NOT clk_25; | |
265 | rstn_25_d1 <= '1'; |
|
265 | rstn_25_d1 <= '1'; | |
266 | rstn_25_d2 <= rstn_25_d1; |
|
266 | rstn_25_d2 <= rstn_25_d1; | |
267 | rstn_25_d3 <= rstn_25_d2; |
|
267 | rstn_25_d3 <= rstn_25_d2; | |
268 | rstn_25 <= rstn_25_d3; |
|
268 | rstn_25 <= rstn_25_d3; | |
269 | END IF; |
|
269 | END IF; | |
270 | END PROCESS; |
|
270 | END PROCESS; | |
271 |
|
271 | |||
272 | PROCESS (clk_49, reset) |
|
272 | PROCESS (clk_49, reset) | |
273 | BEGIN -- PROCESS |
|
273 | BEGIN -- PROCESS | |
274 | IF reset = '0' THEN -- asynchronous reset (active low) |
|
274 | IF reset = '0' THEN -- asynchronous reset (active low) | |
275 | clk_24 <= '0'; |
|
275 | clk_24 <= '0'; | |
276 | ELSIF clk_49'EVENT AND clk_49 = '1' THEN -- rising clock edge |
|
276 | ELSIF clk_49'EVENT AND clk_49 = '1' THEN -- rising clock edge | |
277 | clk_24 <= NOT clk_24; |
|
277 | clk_24 <= NOT clk_24; | |
278 | END IF; |
|
278 | END IF; | |
279 | END PROCESS; |
|
279 | END PROCESS; | |
280 |
|
280 | |||
281 | ----------------------------------------------------------------------------- |
|
281 | ----------------------------------------------------------------------------- | |
282 |
|
282 | |||
283 | PROCESS (clk_25, rstn_25) |
|
283 | PROCESS (clk_25, rstn_25) | |
284 | BEGIN -- PROCESS |
|
284 | BEGIN -- PROCESS | |
285 | IF rstn_25 = '0' THEN -- asynchronous reset (active low) |
|
285 | IF rstn_25 = '0' THEN -- asynchronous reset (active low) | |
286 | LED0 <= '0'; |
|
286 | LED0 <= '0'; | |
287 | LED1 <= '0'; |
|
287 | LED1 <= '0'; | |
288 | LED2 <= '0'; |
|
288 | LED2 <= '0'; | |
289 | --IO1 <= '0'; |
|
289 | --IO1 <= '0'; | |
290 | --IO2 <= '1'; |
|
290 | --IO2 <= '1'; | |
291 | --IO3 <= '0'; |
|
291 | --IO3 <= '0'; | |
292 | --IO4 <= '0'; |
|
292 | --IO4 <= '0'; | |
293 | --IO5 <= '0'; |
|
293 | --IO5 <= '0'; | |
294 | --IO6 <= '0'; |
|
294 | --IO6 <= '0'; | |
295 | --IO7 <= '0'; |
|
295 | --IO7 <= '0'; | |
296 | --IO8 <= '0'; |
|
296 | --IO8 <= '0'; | |
297 | --IO9 <= '0'; |
|
297 | --IO9 <= '0'; | |
298 | --IO10 <= '0'; |
|
298 | --IO10 <= '0'; | |
299 | --IO11 <= '0'; |
|
299 | --IO11 <= '0'; | |
300 | ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge |
|
300 | ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge | |
301 | LED0 <= '0'; |
|
301 | LED0 <= '0'; | |
302 | LED1 <= '1'; |
|
302 | LED1 <= '1'; | |
303 | LED2 <= BP0 OR BP1 OR nDTR2 OR nRTS2 OR nRTS1; |
|
303 | LED2 <= BP0 OR BP1 OR nDTR2 OR nRTS2 OR nRTS1; | |
304 | --IO1 <= '1'; |
|
304 | --IO1 <= '1'; | |
305 | --IO2 <= SPW_NOM_DIN OR SPW_NOM_SIN OR SPW_RED_DIN OR SPW_RED_SIN; |
|
305 | --IO2 <= SPW_NOM_DIN OR SPW_NOM_SIN OR SPW_RED_DIN OR SPW_RED_SIN; | |
306 | --IO3 <= ADC_SDO(0); |
|
306 | --IO3 <= ADC_SDO(0); | |
307 | --IO4 <= ADC_SDO(1); |
|
307 | --IO4 <= ADC_SDO(1); | |
308 | --IO5 <= ADC_SDO(2); |
|
308 | --IO5 <= ADC_SDO(2); | |
309 | --IO6 <= ADC_SDO(3); |
|
309 | --IO6 <= ADC_SDO(3); | |
310 | --IO7 <= ADC_SDO(4); |
|
310 | --IO7 <= ADC_SDO(4); | |
311 | --IO8 <= ADC_SDO(5); |
|
311 | --IO8 <= ADC_SDO(5); | |
312 | --IO9 <= ADC_SDO(6); |
|
312 | --IO9 <= ADC_SDO(6); | |
313 | --IO10 <= ADC_SDO(7); |
|
313 | --IO10 <= ADC_SDO(7); | |
314 | --IO11 <= BP1 OR nDTR2 OR nRTS2 OR nRTS1; |
|
314 | --IO11 <= BP1 OR nDTR2 OR nRTS2 OR nRTS1; | |
315 | END IF; |
|
315 | END IF; | |
316 | END PROCESS; |
|
316 | END PROCESS; | |
317 |
|
317 | |||
318 | PROCESS (clk_24, rstn_25) |
|
318 | PROCESS (clk_24, rstn_25) | |
319 | BEGIN -- PROCESS |
|
319 | BEGIN -- PROCESS | |
320 | IF rstn_25 = '0' THEN -- asynchronous reset (active low) |
|
320 | IF rstn_25 = '0' THEN -- asynchronous reset (active low) | |
321 | I00_s <= '0'; |
|
321 | I00_s <= '0'; | |
322 | ELSIF clk_24'EVENT AND clk_24 = '1' THEN -- rising clock edge |
|
322 | ELSIF clk_24'EVENT AND clk_24 = '1' THEN -- rising clock edge | |
323 | I00_s <= NOT I00_s; |
|
323 | I00_s <= NOT I00_s; | |
324 | END IF; |
|
324 | END IF; | |
325 | END PROCESS; |
|
325 | END PROCESS; | |
326 | -- IO0 <= I00_s; |
|
326 | -- IO0 <= I00_s; | |
327 |
|
327 | |||
328 | --UARTs |
|
328 | --UARTs | |
329 | nCTS1 <= '1'; |
|
329 | nCTS1 <= '1'; | |
330 | nCTS2 <= '1'; |
|
330 | nCTS2 <= '1'; | |
331 | nDCD2 <= '1'; |
|
331 | nDCD2 <= '1'; | |
332 |
|
332 | |||
333 | --EXT CONNECTOR |
|
333 | --EXT CONNECTOR | |
334 |
|
334 | |||
335 | --SPACE WIRE |
|
335 | --SPACE WIRE | |
336 |
|
336 | |||
337 | leon3_soc_1 : leon3_soc |
|
337 | leon3_soc_1 : leon3_soc | |
338 | GENERIC MAP ( |
|
338 | GENERIC MAP ( | |
339 | fabtech => apa3e, |
|
339 | fabtech => apa3e, | |
340 | memtech => apa3e, |
|
340 | memtech => apa3e, | |
341 | padtech => inferred, |
|
341 | padtech => inferred, | |
342 | clktech => inferred, |
|
342 | clktech => inferred, | |
343 | disas => 0, |
|
343 | disas => 0, | |
344 | dbguart => 0, |
|
344 | dbguart => 0, | |
345 | pclow => 2, |
|
345 | pclow => 2, | |
346 | clk_freq => 25000, |
|
346 | clk_freq => 25000, | |
347 | NB_CPU => 1, |
|
347 | NB_CPU => 1, | |
348 | ENABLE_FPU => 1, |
|
348 | ENABLE_FPU => 1, | |
349 | FPU_NETLIST => 0, |
|
349 | FPU_NETLIST => 0, | |
350 | ENABLE_DSU => 1, |
|
350 | ENABLE_DSU => 1, | |
351 | ENABLE_AHB_UART => 1, |
|
351 | ENABLE_AHB_UART => 1, | |
352 | ENABLE_APB_UART => 1, |
|
352 | ENABLE_APB_UART => 1, | |
353 | ENABLE_IRQMP => 1, |
|
353 | ENABLE_IRQMP => 1, | |
354 | ENABLE_GPT => 1, |
|
354 | ENABLE_GPT => 1, | |
355 | NB_AHB_MASTER => NB_AHB_MASTER, |
|
355 | NB_AHB_MASTER => NB_AHB_MASTER, | |
356 | NB_AHB_SLAVE => NB_AHB_SLAVE, |
|
356 | NB_AHB_SLAVE => NB_AHB_SLAVE, | |
357 | NB_APB_SLAVE => NB_APB_SLAVE, |
|
357 | NB_APB_SLAVE => NB_APB_SLAVE, | |
358 | ADDRESS_SIZE => 20, |
|
358 | ADDRESS_SIZE => 20, | |
359 | USES_IAP_MEMCTRLR => 0) |
|
359 | USES_IAP_MEMCTRLR => 0) | |
360 | PORT MAP ( |
|
360 | PORT MAP ( | |
361 | clk => clk_25, |
|
361 | clk => clk_25, | |
362 | reset => rstn_25, |
|
362 | reset => rstn_25, | |
363 | errorn => errorn, |
|
363 | errorn => errorn, | |
364 | ahbrxd => TXD1, |
|
364 | ahbrxd => TXD1, | |
365 | ahbtxd => RXD1, |
|
365 | ahbtxd => RXD1, | |
366 | urxd1 => TXD2, |
|
366 | urxd1 => TXD2, | |
367 | utxd1 => RXD2, |
|
367 | utxd1 => RXD2, | |
368 | address => SRAM_A, |
|
368 | address => SRAM_A, | |
369 | data => SRAM_DQ, |
|
369 | data => SRAM_DQ, | |
370 | nSRAM_BE0 => SRAM_nBE(0), |
|
370 | nSRAM_BE0 => SRAM_nBE(0), | |
371 | nSRAM_BE1 => SRAM_nBE(1), |
|
371 | nSRAM_BE1 => SRAM_nBE(1), | |
372 | nSRAM_BE2 => SRAM_nBE(2), |
|
372 | nSRAM_BE2 => SRAM_nBE(2), | |
373 | nSRAM_BE3 => SRAM_nBE(3), |
|
373 | nSRAM_BE3 => SRAM_nBE(3), | |
374 | nSRAM_WE => SRAM_nWE, |
|
374 | nSRAM_WE => SRAM_nWE, | |
375 | nSRAM_CE => SRAM_CE_s, |
|
375 | nSRAM_CE => SRAM_CE_s, | |
376 | nSRAM_OE => SRAM_nOE, |
|
376 | nSRAM_OE => SRAM_nOE, | |
377 | nSRAM_READY => '0', |
|
377 | nSRAM_READY => '0', | |
378 | SRAM_MBE => OPEN, |
|
378 | SRAM_MBE => OPEN, | |
379 | apbi_ext => apbi_ext, |
|
379 | apbi_ext => apbi_ext, | |
380 | apbo_ext => apbo_ext, |
|
380 | apbo_ext => apbo_ext, | |
381 | ahbi_s_ext => ahbi_s_ext, |
|
381 | ahbi_s_ext => ahbi_s_ext, | |
382 | ahbo_s_ext => ahbo_s_ext, |
|
382 | ahbo_s_ext => ahbo_s_ext, | |
383 | ahbi_m_ext => ahbi_m_ext, |
|
383 | ahbi_m_ext => ahbi_m_ext, | |
384 | ahbo_m_ext => ahbo_m_ext); |
|
384 | ahbo_m_ext => ahbo_m_ext); | |
385 |
|
385 | |||
386 | SRAM_CE <= SRAM_CE_s(0); |
|
386 | SRAM_CE <= SRAM_CE_s(0); | |
387 | ------------------------------------------------------------------------------- |
|
387 | ------------------------------------------------------------------------------- | |
388 | -- APB_LFR_MANAGEMENT --------------------------------------------------------- |
|
388 | -- APB_LFR_MANAGEMENT --------------------------------------------------------- | |
389 | ------------------------------------------------------------------------------- |
|
389 | ------------------------------------------------------------------------------- | |
390 | apb_lfr_management_1 : apb_lfr_management |
|
390 | apb_lfr_management_1 : apb_lfr_management | |
391 | GENERIC MAP ( |
|
391 | GENERIC MAP ( | |
392 | pindex => 6, |
|
392 | pindex => 6, | |
393 | paddr => 6, |
|
393 | paddr => 6, | |
394 | pmask => 16#fff#, |
|
394 | pmask => 16#fff#, | |
395 | FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374 |
|
395 | FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374 | |
396 | NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set |
|
396 | NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set | |
397 | PORT MAP ( |
|
397 | PORT MAP ( | |
398 | clk25MHz => clk_25, |
|
398 | clk25MHz => clk_25, | |
399 | clk24_576MHz => clk_24, -- 49.152MHz/2 |
|
399 | clk24_576MHz => clk_24, -- 49.152MHz/2 | |
400 | resetn => rstn_25, |
|
400 | resetn => rstn_25, | |
401 | grspw_tick => swno.tickout, |
|
401 | grspw_tick => swno.tickout, | |
402 | apbi => apbi_ext, |
|
402 | apbi => apbi_ext, | |
403 | apbo => apbo_ext(6), |
|
403 | apbo => apbo_ext(6), | |
404 | HK_sample => sample_hk, |
|
404 | HK_sample => sample_hk, | |
405 | HK_val => sample_val, |
|
405 | HK_val => sample_val, | |
406 | HK_sel => HK_SEL, |
|
406 | HK_sel => HK_SEL, | |
407 | coarse_time => coarse_time, |
|
407 | coarse_time => coarse_time, | |
408 | fine_time => fine_time, |
|
408 | fine_time => fine_time, | |
409 | LFR_soft_rstn => LFR_soft_rstn |
|
409 | LFR_soft_rstn => LFR_soft_rstn | |
410 | ); |
|
410 | ); | |
411 |
|
411 | |||
412 | ----------------------------------------------------------------------- |
|
412 | ----------------------------------------------------------------------- | |
413 | --- SpaceWire -------------------------------------------------------- |
|
413 | --- SpaceWire -------------------------------------------------------- | |
414 | ----------------------------------------------------------------------- |
|
414 | ----------------------------------------------------------------------- | |
415 |
|
415 | |||
416 | SPW_EN <= '1'; |
|
416 | SPW_EN <= '1'; | |
417 |
|
417 | |||
418 | spw_clk <= clk_50_s; |
|
418 | spw_clk <= clk_50_s; | |
419 | spw_rxtxclk <= spw_clk; |
|
419 | spw_rxtxclk <= spw_clk; | |
420 | spw_rxclkn <= NOT spw_rxtxclk; |
|
420 | spw_rxclkn <= NOT spw_rxtxclk; | |
421 |
|
421 | |||
422 | -- PADS for SPW1 |
|
422 | -- PADS for SPW1 | |
423 | spw1_rxd_pad : inpad GENERIC MAP (tech => inferred) |
|
423 | spw1_rxd_pad : inpad GENERIC MAP (tech => inferred) | |
424 | PORT MAP (SPW_NOM_DIN, dtmp(0)); |
|
424 | PORT MAP (SPW_NOM_DIN, dtmp(0)); | |
425 | spw1_rxs_pad : inpad GENERIC MAP (tech => inferred) |
|
425 | spw1_rxs_pad : inpad GENERIC MAP (tech => inferred) | |
426 | PORT MAP (SPW_NOM_SIN, stmp(0)); |
|
426 | PORT MAP (SPW_NOM_SIN, stmp(0)); | |
427 | spw1_txd_pad : outpad GENERIC MAP (tech => inferred) |
|
427 | spw1_txd_pad : outpad GENERIC MAP (tech => inferred) | |
428 | PORT MAP (SPW_NOM_DOUT, swno.d(0)); |
|
428 | PORT MAP (SPW_NOM_DOUT, swno.d(0)); | |
429 | spw1_txs_pad : outpad GENERIC MAP (tech => inferred) |
|
429 | spw1_txs_pad : outpad GENERIC MAP (tech => inferred) | |
430 | PORT MAP (SPW_NOM_SOUT, swno.s(0)); |
|
430 | PORT MAP (SPW_NOM_SOUT, swno.s(0)); | |
431 | -- PADS FOR SPW2 |
|
431 | -- PADS FOR SPW2 | |
432 | spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\ |
|
432 | spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\ | |
433 | PORT MAP (SPW_RED_SIN, dtmp(1)); |
|
433 | PORT MAP (SPW_RED_SIN, dtmp(1)); | |
434 | spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\ |
|
434 | spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\ | |
435 | PORT MAP (SPW_RED_DIN, stmp(1)); |
|
435 | PORT MAP (SPW_RED_DIN, stmp(1)); | |
436 | spw2_txd_pad : outpad GENERIC MAP (tech => inferred) |
|
436 | spw2_txd_pad : outpad GENERIC MAP (tech => inferred) | |
437 | PORT MAP (SPW_RED_DOUT, swno.d(1)); |
|
437 | PORT MAP (SPW_RED_DOUT, swno.d(1)); | |
438 | spw2_txs_pad : outpad GENERIC MAP (tech => inferred) |
|
438 | spw2_txs_pad : outpad GENERIC MAP (tech => inferred) | |
439 | PORT MAP (SPW_RED_SOUT, swno.s(1)); |
|
439 | PORT MAP (SPW_RED_SOUT, swno.s(1)); | |
440 |
|
440 | |||
441 | -- GRSPW PHY |
|
441 | -- GRSPW PHY | |
442 | --spw1_input: if CFG_SPW_GRSPW = 1 generate |
|
442 | --spw1_input: if CFG_SPW_GRSPW = 1 generate | |
443 | spw_inputloop : FOR j IN 0 TO 1 GENERATE |
|
443 | spw_inputloop : FOR j IN 0 TO 1 GENERATE | |
444 | spw_phy0 : grspw_phy |
|
444 | spw_phy0 : grspw_phy | |
445 | GENERIC MAP( |
|
445 | GENERIC MAP( | |
446 | tech => apa3e, |
|
446 | tech => apa3e, | |
447 | rxclkbuftype => 1, |
|
447 | rxclkbuftype => 1, | |
448 | scantest => 0) |
|
448 | scantest => 0) | |
449 | PORT MAP( |
|
449 | PORT MAP( | |
450 | rxrst => swno.rxrst, |
|
450 | rxrst => swno.rxrst, | |
451 | di => dtmp(j), |
|
451 | di => dtmp(j), | |
452 | si => stmp(j), |
|
452 | si => stmp(j), | |
453 | rxclko => spw_rxclk(j), |
|
453 | rxclko => spw_rxclk(j), | |
454 | do => swni.d(j), |
|
454 | do => swni.d(j), | |
455 | ndo => swni.nd(j*5+4 DOWNTO j*5), |
|
455 | ndo => swni.nd(j*5+4 DOWNTO j*5), | |
456 | dconnect => swni.dconnect(j*2+1 DOWNTO j*2)); |
|
456 | dconnect => swni.dconnect(j*2+1 DOWNTO j*2)); | |
457 | END GENERATE spw_inputloop; |
|
457 | END GENERATE spw_inputloop; | |
458 |
|
458 | |||
459 | swni.rmapnodeaddr <= (OTHERS => '0'); |
|
459 | swni.rmapnodeaddr <= (OTHERS => '0'); | |
460 |
|
460 | |||
461 | -- SPW core |
|
461 | -- SPW core | |
462 | sw0 : grspwm GENERIC MAP( |
|
462 | sw0 : grspwm GENERIC MAP( | |
463 | tech => apa3e, |
|
463 | tech => apa3e, | |
464 | hindex => 1, |
|
464 | hindex => 1, | |
465 | pindex => 5, |
|
465 | pindex => 5, | |
466 | paddr => 5, |
|
466 | paddr => 5, | |
467 | pirq => 11, |
|
467 | pirq => 11, | |
468 | sysfreq => 25000, -- CPU_FREQ |
|
468 | sysfreq => 25000, -- CPU_FREQ | |
469 | rmap => 1, |
|
469 | rmap => 1, | |
470 | rmapcrc => 1, |
|
470 | rmapcrc => 1, | |
471 | fifosize1 => 16, |
|
471 | fifosize1 => 16, | |
472 | fifosize2 => 16, |
|
472 | fifosize2 => 16, | |
473 | rxclkbuftype => 1, |
|
473 | rxclkbuftype => 1, | |
474 | rxunaligned => 0, |
|
474 | rxunaligned => 0, | |
475 | rmapbufs => 4, |
|
475 | rmapbufs => 4, | |
476 | ft => 0, |
|
476 | ft => 0, | |
477 | netlist => 0, |
|
477 | netlist => 0, | |
478 | ports => 2, |
|
478 | ports => 2, | |
479 | --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1 |
|
479 | --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1 | |
480 | memtech => apa3e, |
|
480 | memtech => apa3e, | |
481 | destkey => 2, |
|
481 | destkey => 2, | |
482 | spwcore => 1 |
|
482 | spwcore => 1 | |
483 | --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1 |
|
483 | --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1 | |
484 | --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1 |
|
484 | --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1 | |
485 | --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1 |
|
485 | --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1 | |
486 | ) |
|
486 | ) | |
487 | PORT MAP(rstn_25, clk_25, spw_rxclk(0), |
|
487 | PORT MAP(rstn_25, clk_25, spw_rxclk(0), | |
488 | spw_rxclk(1), spw_rxtxclk, spw_rxtxclk, |
|
488 | spw_rxclk(1), spw_rxtxclk, spw_rxtxclk, | |
489 | ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5), |
|
489 | ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5), | |
490 | swni, swno); |
|
490 | swni, swno); | |
491 |
|
491 | |||
492 | swni.tickin <= '0'; |
|
492 | swni.tickin <= '0'; | |
493 | swni.rmapen <= '1'; |
|
493 | swni.rmapen <= '1'; | |
494 | swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz |
|
494 | swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz | |
495 | swni.tickinraw <= '0'; |
|
495 | swni.tickinraw <= '0'; | |
496 | swni.timein <= (OTHERS => '0'); |
|
496 | swni.timein <= (OTHERS => '0'); | |
497 | swni.dcrstval <= (OTHERS => '0'); |
|
497 | swni.dcrstval <= (OTHERS => '0'); | |
498 | swni.timerrstval <= (OTHERS => '0'); |
|
498 | swni.timerrstval <= (OTHERS => '0'); | |
499 |
|
499 | |||
500 | ------------------------------------------------------------------------------- |
|
500 | ------------------------------------------------------------------------------- | |
501 | -- LFR ------------------------------------------------------------------------ |
|
501 | -- LFR ------------------------------------------------------------------------ | |
502 | ------------------------------------------------------------------------------- |
|
502 | ------------------------------------------------------------------------------- | |
503 |
|
503 | |||
504 |
|
504 | |||
505 | LFR_rstn <= LFR_soft_rstn AND rstn_25; |
|
505 | LFR_rstn <= LFR_soft_rstn AND rstn_25; | |
506 | --LFR_rstn <= rstn_25; |
|
506 | --LFR_rstn <= rstn_25; | |
507 |
|
507 | |||
508 | lpp_lfr_1 : lpp_lfr |
|
508 | lpp_lfr_1 : lpp_lfr | |
509 | GENERIC MAP ( |
|
509 | GENERIC MAP ( | |
510 | Mem_use => use_RAM, |
|
510 | Mem_use => use_RAM, | |
511 | nb_data_by_buffer_size => 32, |
|
511 | nb_data_by_buffer_size => 32, | |
512 | nb_snapshot_param_size => 32, |
|
512 | nb_snapshot_param_size => 32, | |
513 | delta_vector_size => 32, |
|
513 | delta_vector_size => 32, | |
514 | delta_vector_size_f0_2 => 7, -- log2(96) |
|
514 | delta_vector_size_f0_2 => 7, -- log2(96) | |
515 | pindex => 15, |
|
515 | pindex => 15, | |
516 | paddr => 15, |
|
516 | paddr => 15, | |
517 | pmask => 16#fff#, |
|
517 | pmask => 16#fff#, | |
518 | pirq_ms => 6, |
|
518 | pirq_ms => 6, | |
519 | pirq_wfp => 14, |
|
519 | pirq_wfp => 14, | |
520 | hindex => 2, |
|
520 | hindex => 2, | |
521 |
top_lfr_version => X"00013 |
|
521 | top_lfr_version => X"000134") -- aa.bb.cc version | |
522 | PORT MAP ( |
|
522 | PORT MAP ( | |
523 | clk => clk_25, |
|
523 | clk => clk_25, | |
524 | rstn => LFR_rstn, |
|
524 | rstn => LFR_rstn, | |
525 | sample_B => sample_s(2 DOWNTO 0), |
|
525 | sample_B => sample_s(2 DOWNTO 0), | |
526 | sample_E => sample_s(7 DOWNTO 3), |
|
526 | sample_E => sample_s(7 DOWNTO 3), | |
527 | sample_val => sample_val, |
|
527 | sample_val => sample_val, | |
528 | apbi => apbi_ext, |
|
528 | apbi => apbi_ext, | |
529 | apbo => apbo_ext(15), |
|
529 | apbo => apbo_ext(15), | |
530 | ahbi => ahbi_m_ext, |
|
530 | ahbi => ahbi_m_ext, | |
531 | ahbo => ahbo_m_ext(2), |
|
531 | ahbo => ahbo_m_ext(2), | |
532 | coarse_time => coarse_time, |
|
532 | coarse_time => coarse_time, | |
533 | fine_time => fine_time, |
|
533 | fine_time => fine_time, | |
534 | data_shaping_BW => bias_fail_sw_sig, |
|
534 | data_shaping_BW => bias_fail_sw_sig, | |
535 | debug_vector => lfr_debug_vector, |
|
535 | debug_vector => lfr_debug_vector, | |
536 | debug_vector_ms => lfr_debug_vector_ms |
|
536 | debug_vector_ms => lfr_debug_vector_ms | |
537 | ); |
|
537 | ); | |
538 |
|
538 | |||
539 | observation_reg(11 DOWNTO 0) <= lfr_debug_vector; |
|
539 | observation_reg(11 DOWNTO 0) <= lfr_debug_vector; | |
540 | observation_reg(31 DOWNTO 12) <= (OTHERS => '0'); |
|
540 | observation_reg(31 DOWNTO 12) <= (OTHERS => '0'); | |
541 | observation_vector_0(11 DOWNTO 0) <= lfr_debug_vector; |
|
541 | observation_vector_0(11 DOWNTO 0) <= lfr_debug_vector; | |
542 | observation_vector_1(11 DOWNTO 0) <= lfr_debug_vector; |
|
542 | observation_vector_1(11 DOWNTO 0) <= lfr_debug_vector; | |
543 | IO0 <= rstn_25; |
|
543 | IO0 <= rstn_25; | |
544 | IO1 <= lfr_debug_vector_ms(0); -- LFR MS FFT data_valid |
|
544 | IO1 <= lfr_debug_vector_ms(0); -- LFR MS FFT data_valid | |
545 | IO2 <= lfr_debug_vector_ms(0); -- LFR MS FFT ready |
|
545 | IO2 <= lfr_debug_vector_ms(0); -- LFR MS FFT ready | |
546 | IO3 <= lfr_debug_vector(0); -- LFR APBREG error_buffer_full |
|
546 | IO3 <= lfr_debug_vector(0); -- LFR APBREG error_buffer_full | |
547 | IO4 <= lfr_debug_vector(1); -- LFR APBREG reg_sp.status_error_buffer_full |
|
547 | IO4 <= lfr_debug_vector(1); -- LFR APBREG reg_sp.status_error_buffer_full | |
548 | IO5 <= lfr_debug_vector(8); -- LFR APBREG ready_matrix_f2 |
|
548 | IO5 <= lfr_debug_vector(8); -- LFR APBREG ready_matrix_f2 | |
549 | IO6 <= lfr_debug_vector(9); -- LFR APBREG reg0_ready_matrix_f2 |
|
549 | IO6 <= lfr_debug_vector(9); -- LFR APBREG reg0_ready_matrix_f2 | |
550 | IO7 <= lfr_debug_vector(10); -- LFR APBREG reg0_ready_matrix_f2 |
|
550 | IO7 <= lfr_debug_vector(10); -- LFR APBREG reg0_ready_matrix_f2 | |
551 |
|
551 | |||
552 | all_sample : FOR I IN 7 DOWNTO 0 GENERATE |
|
552 | all_sample : FOR I IN 7 DOWNTO 0 GENERATE | |
553 | sample_s(I) <= sample(I)(11 DOWNTO 0) & '0' & '0' & '0' & '0'; |
|
553 | sample_s(I) <= sample(I)(11 DOWNTO 0) & '0' & '0' & '0' & '0'; | |
554 | END GENERATE all_sample; |
|
554 | END GENERATE all_sample; | |
555 |
|
555 | |||
556 | top_ad_conv_ADS7886_v2_1 : top_ad_conv_ADS7886_v2 |
|
556 | top_ad_conv_ADS7886_v2_1 : top_ad_conv_ADS7886_v2 | |
557 | GENERIC MAP( |
|
557 | GENERIC MAP( | |
558 | ChannelCount => 8, |
|
558 | ChannelCount => 8, | |
559 | SampleNbBits => 14, |
|
559 | SampleNbBits => 14, | |
560 | ncycle_cnv_high => 40, -- at least 32 cycles at 25 MHz, 32 * 49.152 / 25 /2 = 31.5 |
|
560 | ncycle_cnv_high => 40, -- at least 32 cycles at 25 MHz, 32 * 49.152 / 25 /2 = 31.5 | |
561 | ncycle_cnv => 249) -- 49 152 000 / 98304 /2 |
|
561 | ncycle_cnv => 249) -- 49 152 000 / 98304 /2 | |
562 | PORT MAP ( |
|
562 | PORT MAP ( | |
563 | -- CONV |
|
563 | -- CONV | |
564 | cnv_clk => clk_24, |
|
564 | cnv_clk => clk_24, | |
565 | cnv_rstn => rstn_25, |
|
565 | cnv_rstn => rstn_25, | |
566 | cnv => ADC_nCS_sig, |
|
566 | cnv => ADC_nCS_sig, | |
567 | -- DATA |
|
567 | -- DATA | |
568 | clk => clk_25, |
|
568 | clk => clk_25, | |
569 | rstn => rstn_25, |
|
569 | rstn => rstn_25, | |
570 | sck => ADC_CLK_sig, |
|
570 | sck => ADC_CLK_sig, | |
571 | sdo => ADC_SDO_sig, |
|
571 | sdo => ADC_SDO_sig, | |
572 | -- SAMPLE |
|
572 | -- SAMPLE | |
573 | sample => sample, |
|
573 | sample => sample, | |
574 | sample_val => sample_val); |
|
574 | sample_val => sample_val); | |
575 |
|
575 | |||
576 | --IO10 <= ADC_SDO_sig(5); |
|
576 | --IO10 <= ADC_SDO_sig(5); | |
577 | --IO9 <= ADC_SDO_sig(4); |
|
577 | --IO9 <= ADC_SDO_sig(4); | |
578 | --IO8 <= ADC_SDO_sig(3); |
|
578 | --IO8 <= ADC_SDO_sig(3); | |
579 |
|
579 | |||
580 | ADC_nCS <= ADC_nCS_sig; |
|
580 | ADC_nCS <= ADC_nCS_sig; | |
581 | ADC_CLK <= ADC_CLK_sig; |
|
581 | ADC_CLK <= ADC_CLK_sig; | |
582 | ADC_SDO_sig <= ADC_SDO; |
|
582 | ADC_SDO_sig <= ADC_SDO; | |
583 |
|
583 | |||
584 | sample_hk <= "0001000100010001" WHEN HK_SEL = "00" ELSE |
|
584 | sample_hk <= "0001000100010001" WHEN HK_SEL = "00" ELSE | |
585 | "0010001000100010" WHEN HK_SEL = "10" ELSE |
|
585 | "0010001000100010" WHEN HK_SEL = "10" ELSE | |
586 | "0100010001000100" WHEN HK_SEL = "10" ELSE |
|
586 | "0100010001000100" WHEN HK_SEL = "10" ELSE | |
587 | (OTHERS => '0'); |
|
587 | (OTHERS => '0'); | |
588 |
|
588 | |||
589 |
|
589 | |||
590 | ---------------------------------------------------------------------- |
|
590 | ---------------------------------------------------------------------- | |
591 | --- GPIO ----------------------------------------------------------- |
|
591 | --- GPIO ----------------------------------------------------------- | |
592 | ---------------------------------------------------------------------- |
|
592 | ---------------------------------------------------------------------- | |
593 |
|
593 | |||
594 | grgpio0 : grgpio |
|
594 | grgpio0 : grgpio | |
595 | GENERIC MAP(pindex => 11, paddr => 11, imask => 16#0000#, nbits => 8) |
|
595 | GENERIC MAP(pindex => 11, paddr => 11, imask => 16#0000#, nbits => 8) | |
596 | PORT MAP(rstn_25, clk_25, apbi_ext, apbo_ext(11), gpioi, gpioo); |
|
596 | PORT MAP(rstn_25, clk_25, apbi_ext, apbo_ext(11), gpioi, gpioo); | |
597 |
|
597 | |||
598 | gpioi.sig_en <= (OTHERS => '0'); |
|
598 | gpioi.sig_en <= (OTHERS => '0'); | |
599 | gpioi.sig_in <= (OTHERS => '0'); |
|
599 | gpioi.sig_in <= (OTHERS => '0'); | |
600 | gpioi.din <= (OTHERS => '0'); |
|
600 | gpioi.din <= (OTHERS => '0'); | |
601 | --pio_pad_0 : iopad |
|
601 | --pio_pad_0 : iopad | |
602 | -- GENERIC MAP (tech => CFG_PADTECH) |
|
602 | -- GENERIC MAP (tech => CFG_PADTECH) | |
603 | -- PORT MAP (IO0, gpioo.dout(0), gpioo.oen(0), gpioi.din(0)); |
|
603 | -- PORT MAP (IO0, gpioo.dout(0), gpioo.oen(0), gpioi.din(0)); | |
604 | --pio_pad_1 : iopad |
|
604 | --pio_pad_1 : iopad | |
605 | -- GENERIC MAP (tech => CFG_PADTECH) |
|
605 | -- GENERIC MAP (tech => CFG_PADTECH) | |
606 | -- PORT MAP (IO1, gpioo.dout(1), gpioo.oen(1), gpioi.din(1)); |
|
606 | -- PORT MAP (IO1, gpioo.dout(1), gpioo.oen(1), gpioi.din(1)); | |
607 | --pio_pad_2 : iopad |
|
607 | --pio_pad_2 : iopad | |
608 | -- GENERIC MAP (tech => CFG_PADTECH) |
|
608 | -- GENERIC MAP (tech => CFG_PADTECH) | |
609 | -- PORT MAP (IO2, gpioo.dout(2), gpioo.oen(2), gpioi.din(2)); |
|
609 | -- PORT MAP (IO2, gpioo.dout(2), gpioo.oen(2), gpioi.din(2)); | |
610 | --pio_pad_3 : iopad |
|
610 | --pio_pad_3 : iopad | |
611 | -- GENERIC MAP (tech => CFG_PADTECH) |
|
611 | -- GENERIC MAP (tech => CFG_PADTECH) | |
612 | -- PORT MAP (IO3, gpioo.dout(3), gpioo.oen(3), gpioi.din(3)); |
|
612 | -- PORT MAP (IO3, gpioo.dout(3), gpioo.oen(3), gpioi.din(3)); | |
613 | --pio_pad_4 : iopad |
|
613 | --pio_pad_4 : iopad | |
614 | -- GENERIC MAP (tech => CFG_PADTECH) |
|
614 | -- GENERIC MAP (tech => CFG_PADTECH) | |
615 | -- PORT MAP (IO4, gpioo.dout(4), gpioo.oen(4), gpioi.din(4)); |
|
615 | -- PORT MAP (IO4, gpioo.dout(4), gpioo.oen(4), gpioi.din(4)); | |
616 | --pio_pad_5 : iopad |
|
616 | --pio_pad_5 : iopad | |
617 | -- GENERIC MAP (tech => CFG_PADTECH) |
|
617 | -- GENERIC MAP (tech => CFG_PADTECH) | |
618 | -- PORT MAP (IO5, gpioo.dout(5), gpioo.oen(5), gpioi.din(5)); |
|
618 | -- PORT MAP (IO5, gpioo.dout(5), gpioo.oen(5), gpioi.din(5)); | |
619 | --pio_pad_6 : iopad |
|
619 | --pio_pad_6 : iopad | |
620 | -- GENERIC MAP (tech => CFG_PADTECH) |
|
620 | -- GENERIC MAP (tech => CFG_PADTECH) | |
621 | -- PORT MAP (IO6, gpioo.dout(6), gpioo.oen(6), gpioi.din(6)); |
|
621 | -- PORT MAP (IO6, gpioo.dout(6), gpioo.oen(6), gpioi.din(6)); | |
622 | --pio_pad_7 : iopad |
|
622 | --pio_pad_7 : iopad | |
623 | -- GENERIC MAP (tech => CFG_PADTECH) |
|
623 | -- GENERIC MAP (tech => CFG_PADTECH) | |
624 | -- PORT MAP (IO7, gpioo.dout(7), gpioo.oen(7), gpioi.din(7)); |
|
624 | -- PORT MAP (IO7, gpioo.dout(7), gpioo.oen(7), gpioi.din(7)); | |
625 |
|
625 | |||
626 | PROCESS (clk_25, rstn_25) |
|
626 | PROCESS (clk_25, rstn_25) | |
627 | BEGIN -- PROCESS |
|
627 | BEGIN -- PROCESS | |
628 | IF rstn_25 = '0' THEN -- asynchronous reset (active low) |
|
628 | IF rstn_25 = '0' THEN -- asynchronous reset (active low) | |
629 | -- --IO0 <= '0'; |
|
629 | -- --IO0 <= '0'; | |
630 | -- IO1 <= '0'; |
|
630 | -- IO1 <= '0'; | |
631 | -- IO2 <= '0'; |
|
631 | -- IO2 <= '0'; | |
632 | -- IO3 <= '0'; |
|
632 | -- IO3 <= '0'; | |
633 | -- IO4 <= '0'; |
|
633 | -- IO4 <= '0'; | |
634 | -- IO5 <= '0'; |
|
634 | -- IO5 <= '0'; | |
635 | -- IO6 <= '0'; |
|
635 | -- IO6 <= '0'; | |
636 | -- IO7 <= '0'; |
|
636 | -- IO7 <= '0'; | |
637 | IO8 <= '0'; |
|
637 | IO8 <= '0'; | |
638 | IO9 <= '0'; |
|
638 | IO9 <= '0'; | |
639 | IO10 <= '0'; |
|
639 | IO10 <= '0'; | |
640 | IO11 <= '0'; |
|
640 | IO11 <= '0'; | |
641 | ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge |
|
641 | ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge | |
642 | CASE gpioo.dout(2 DOWNTO 0) IS |
|
642 | CASE gpioo.dout(2 DOWNTO 0) IS | |
643 | WHEN "011" => |
|
643 | WHEN "011" => | |
644 | -- --IO0 <= observation_reg(0 ); |
|
644 | -- --IO0 <= observation_reg(0 ); | |
645 | -- IO1 <= observation_reg(1 ); |
|
645 | -- IO1 <= observation_reg(1 ); | |
646 | -- IO2 <= observation_reg(2 ); |
|
646 | -- IO2 <= observation_reg(2 ); | |
647 | -- IO3 <= observation_reg(3 ); |
|
647 | -- IO3 <= observation_reg(3 ); | |
648 | -- IO4 <= observation_reg(4 ); |
|
648 | -- IO4 <= observation_reg(4 ); | |
649 | -- IO5 <= observation_reg(5 ); |
|
649 | -- IO5 <= observation_reg(5 ); | |
650 | -- IO6 <= observation_reg(6 ); |
|
650 | -- IO6 <= observation_reg(6 ); | |
651 | -- IO7 <= observation_reg(7 ); |
|
651 | -- IO7 <= observation_reg(7 ); | |
652 | IO8 <= observation_reg(8); |
|
652 | IO8 <= observation_reg(8); | |
653 | IO9 <= observation_reg(9); |
|
653 | IO9 <= observation_reg(9); | |
654 | IO10 <= observation_reg(10); |
|
654 | IO10 <= observation_reg(10); | |
655 | IO11 <= observation_reg(11); |
|
655 | IO11 <= observation_reg(11); | |
656 | WHEN "001" => |
|
656 | WHEN "001" => | |
657 | -- --IO0 <= observation_reg(0 + 12); |
|
657 | -- --IO0 <= observation_reg(0 + 12); | |
658 | -- IO1 <= observation_reg(1 + 12); |
|
658 | -- IO1 <= observation_reg(1 + 12); | |
659 | -- IO2 <= observation_reg(2 + 12); |
|
659 | -- IO2 <= observation_reg(2 + 12); | |
660 | -- IO3 <= observation_reg(3 + 12); |
|
660 | -- IO3 <= observation_reg(3 + 12); | |
661 | -- IO4 <= observation_reg(4 + 12); |
|
661 | -- IO4 <= observation_reg(4 + 12); | |
662 | -- IO5 <= observation_reg(5 + 12); |
|
662 | -- IO5 <= observation_reg(5 + 12); | |
663 | -- IO6 <= observation_reg(6 + 12); |
|
663 | -- IO6 <= observation_reg(6 + 12); | |
664 | -- IO7 <= observation_reg(7 + 12); |
|
664 | -- IO7 <= observation_reg(7 + 12); | |
665 | IO8 <= observation_reg(8 + 12); |
|
665 | IO8 <= observation_reg(8 + 12); | |
666 | IO9 <= observation_reg(9 + 12); |
|
666 | IO9 <= observation_reg(9 + 12); | |
667 | IO10 <= observation_reg(10 + 12); |
|
667 | IO10 <= observation_reg(10 + 12); | |
668 | IO11 <= observation_reg(11 + 12); |
|
668 | IO11 <= observation_reg(11 + 12); | |
669 | WHEN "010" => |
|
669 | WHEN "010" => | |
670 | -- --IO0 <= observation_reg(0 + 12 + 12); |
|
670 | -- --IO0 <= observation_reg(0 + 12 + 12); | |
671 | -- IO1 <= observation_reg(1 + 12 + 12); |
|
671 | -- IO1 <= observation_reg(1 + 12 + 12); | |
672 | -- IO2 <= observation_reg(2 + 12 + 12); |
|
672 | -- IO2 <= observation_reg(2 + 12 + 12); | |
673 | -- IO3 <= observation_reg(3 + 12 + 12); |
|
673 | -- IO3 <= observation_reg(3 + 12 + 12); | |
674 | -- IO4 <= observation_reg(4 + 12 + 12); |
|
674 | -- IO4 <= observation_reg(4 + 12 + 12); | |
675 | -- IO5 <= observation_reg(5 + 12 + 12); |
|
675 | -- IO5 <= observation_reg(5 + 12 + 12); | |
676 | -- IO6 <= observation_reg(6 + 12 + 12); |
|
676 | -- IO6 <= observation_reg(6 + 12 + 12); | |
677 | -- IO7 <= observation_reg(7 + 12 + 12); |
|
677 | -- IO7 <= observation_reg(7 + 12 + 12); | |
678 | IO8 <= '0'; |
|
678 | IO8 <= '0'; | |
679 | IO9 <= '0'; |
|
679 | IO9 <= '0'; | |
680 | IO10 <= '0'; |
|
680 | IO10 <= '0'; | |
681 | IO11 <= '0'; |
|
681 | IO11 <= '0'; | |
682 | WHEN "000" => |
|
682 | WHEN "000" => | |
683 | -- --IO0 <= observation_vector_0(0 ); |
|
683 | -- --IO0 <= observation_vector_0(0 ); | |
684 | -- IO1 <= observation_vector_0(1 ); |
|
684 | -- IO1 <= observation_vector_0(1 ); | |
685 | -- IO2 <= observation_vector_0(2 ); |
|
685 | -- IO2 <= observation_vector_0(2 ); | |
686 | -- IO3 <= observation_vector_0(3 ); |
|
686 | -- IO3 <= observation_vector_0(3 ); | |
687 | -- IO4 <= observation_vector_0(4 ); |
|
687 | -- IO4 <= observation_vector_0(4 ); | |
688 | -- IO5 <= observation_vector_0(5 ); |
|
688 | -- IO5 <= observation_vector_0(5 ); | |
689 | -- IO6 <= observation_vector_0(6 ); |
|
689 | -- IO6 <= observation_vector_0(6 ); | |
690 | -- IO7 <= observation_vector_0(7 ); |
|
690 | -- IO7 <= observation_vector_0(7 ); | |
691 | IO8 <= observation_vector_0(8); |
|
691 | IO8 <= observation_vector_0(8); | |
692 | IO9 <= observation_vector_0(9); |
|
692 | IO9 <= observation_vector_0(9); | |
693 | IO10 <= observation_vector_0(10); |
|
693 | IO10 <= observation_vector_0(10); | |
694 | IO11 <= observation_vector_0(11); |
|
694 | IO11 <= observation_vector_0(11); | |
695 | WHEN "100" => |
|
695 | WHEN "100" => | |
696 | -- --IO0 <= observation_vector_1(0 ); |
|
696 | -- --IO0 <= observation_vector_1(0 ); | |
697 | -- IO1 <= observation_vector_1(1 ); |
|
697 | -- IO1 <= observation_vector_1(1 ); | |
698 | -- IO2 <= observation_vector_1(2 ); |
|
698 | -- IO2 <= observation_vector_1(2 ); | |
699 | -- IO3 <= observation_vector_1(3 ); |
|
699 | -- IO3 <= observation_vector_1(3 ); | |
700 | -- IO4 <= observation_vector_1(4 ); |
|
700 | -- IO4 <= observation_vector_1(4 ); | |
701 | -- IO5 <= observation_vector_1(5 ); |
|
701 | -- IO5 <= observation_vector_1(5 ); | |
702 | -- IO6 <= observation_vector_1(6 ); |
|
702 | -- IO6 <= observation_vector_1(6 ); | |
703 | -- IO7 <= observation_vector_1(7 ); |
|
703 | -- IO7 <= observation_vector_1(7 ); | |
704 | IO8 <= observation_vector_1(8); |
|
704 | IO8 <= observation_vector_1(8); | |
705 | IO9 <= observation_vector_1(9); |
|
705 | IO9 <= observation_vector_1(9); | |
706 | IO10 <= observation_vector_1(10); |
|
706 | IO10 <= observation_vector_1(10); | |
707 | IO11 <= observation_vector_1(11); |
|
707 | IO11 <= observation_vector_1(11); | |
708 | WHEN OTHERS => NULL; |
|
708 | WHEN OTHERS => NULL; | |
709 | END CASE; |
|
709 | END CASE; | |
710 |
|
710 | |||
711 | END IF; |
|
711 | END IF; | |
712 | END PROCESS; |
|
712 | END PROCESS; | |
713 | ----------------------------------------------------------------------------- |
|
713 | ----------------------------------------------------------------------------- | |
714 | -- |
|
714 | -- | |
715 | ----------------------------------------------------------------------------- |
|
715 | ----------------------------------------------------------------------------- | |
716 | all_apbo_ext : FOR I IN NB_APB_SLAVE-1+5 DOWNTO 5 GENERATE |
|
716 | all_apbo_ext : FOR I IN NB_APB_SLAVE-1+5 DOWNTO 5 GENERATE | |
717 | apbo_ext_not_used : IF I /= 5 AND I /= 6 AND I /= 11 AND I /= 15 GENERATE |
|
717 | apbo_ext_not_used : IF I /= 5 AND I /= 6 AND I /= 11 AND I /= 15 GENERATE | |
718 | apbo_ext(I) <= apb_none; |
|
718 | apbo_ext(I) <= apb_none; | |
719 | END GENERATE apbo_ext_not_used; |
|
719 | END GENERATE apbo_ext_not_used; | |
720 | END GENERATE all_apbo_ext; |
|
720 | END GENERATE all_apbo_ext; | |
721 |
|
721 | |||
722 |
|
722 | |||
723 | all_ahbo_ext : FOR I IN NB_AHB_SLAVE-1+3 DOWNTO 3 GENERATE |
|
723 | all_ahbo_ext : FOR I IN NB_AHB_SLAVE-1+3 DOWNTO 3 GENERATE | |
724 | ahbo_s_ext(I) <= ahbs_none; |
|
724 | ahbo_s_ext(I) <= ahbs_none; | |
725 | END GENERATE all_ahbo_ext; |
|
725 | END GENERATE all_ahbo_ext; | |
726 |
|
726 | |||
727 | all_ahbo_m_ext : FOR I IN NB_AHB_MASTER-1+1 DOWNTO 1 GENERATE |
|
727 | all_ahbo_m_ext : FOR I IN NB_AHB_MASTER-1+1 DOWNTO 1 GENERATE | |
728 | ahbo_m_ext_not_used : IF I /= 1 AND I /= 2 GENERATE |
|
728 | ahbo_m_ext_not_used : IF I /= 1 AND I /= 2 GENERATE | |
729 | ahbo_m_ext(I) <= ahbm_none; |
|
729 | ahbo_m_ext(I) <= ahbm_none; | |
730 | END GENERATE ahbo_m_ext_not_used; |
|
730 | END GENERATE ahbo_m_ext_not_used; | |
731 | END GENERATE all_ahbo_m_ext; |
|
731 | END GENERATE all_ahbo_m_ext; | |
732 |
|
732 | |||
733 | END beh; |
|
733 | END beh; |
@@ -1,93 +1,101 | |||||
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 | USE ieee.math_real.ALL; |
|
26 | USE ieee.math_real.ALL; | |
27 |
|
27 | |||
28 | PACKAGE lpp_lfr_filter_coeff IS |
|
28 | PACKAGE lpp_lfr_filter_coeff IS | |
29 |
|
29 | |||
30 | --REAL |
|
30 | --REAL | |
31 | TYPE COEFF_CEL_REAL IS ARRAY (1 TO 6) OF REAL; -- b0, b1, b2, a0, a1, a2 |
|
31 | TYPE COEFF_CEL_REAL IS ARRAY (1 TO 6) OF REAL; -- b0, b1, b2, a0, a1, a2 | |
32 | TYPE COEFF_CEL_ARRAY_REAL IS ARRAY (INTEGER RANGE <>) OF COEFF_CEL_REAL; |
|
32 | TYPE COEFF_CEL_ARRAY_REAL IS ARRAY (INTEGER RANGE <>) OF COEFF_CEL_REAL; | |
33 | --INTEGER |
|
33 | --INTEGER | |
34 | TYPE COEFF_CEL_INTEGER IS ARRAY (1 TO 6) OF INTEGER; -- b0, b1, b2, a0, a1, a2 |
|
34 | TYPE COEFF_CEL_INTEGER IS ARRAY (1 TO 6) OF INTEGER; -- b0, b1, b2, a0, a1, a2 | |
35 | TYPE COEFF_CEL_ARRAY_INTEGER IS ARRAY (INTEGER RANGE <>) OF COEFF_CEL_INTEGER; |
|
35 | TYPE COEFF_CEL_ARRAY_INTEGER IS ARRAY (INTEGER RANGE <>) OF COEFF_CEL_INTEGER; | |
36 |
|
36 | |||
37 | ----------------------------------------------------------------------------- |
|
37 | ----------------------------------------------------------------------------- | |
38 | -- |
|
38 | -- | |
39 | ----------------------------------------------------------------------------- |
|
39 | ----------------------------------------------------------------------------- | |
40 | FUNCTION get_IIR_CEL_FILTER_CONFIG ( |
|
40 | FUNCTION get_IIR_CEL_FILTER_CONFIG ( | |
41 | COEFFICIENT_SIZE , POINT_POSITION, CEL_NUMBER : INTEGER; |
|
41 | COEFFICIENT_SIZE , POINT_POSITION, CEL_NUMBER : INTEGER; | |
42 | SOS_array : COEFF_CEL_ARRAY_REAL;--(INTEGER RANGE <>); |
|
42 | SOS_array : COEFF_CEL_ARRAY_REAL;--(INTEGER RANGE <>); | |
43 | GAIN_array : COEFF_CEL_REAL |
|
43 | GAIN_array : COEFF_CEL_REAL | |
44 | ) RETURN STD_LOGIC_VECTOR; |
|
44 | ) RETURN STD_LOGIC_VECTOR; | |
45 |
|
45 | |||
46 |
|
46 | |||
47 | END lpp_lfr_filter_coeff; |
|
47 | END lpp_lfr_filter_coeff; | |
48 |
|
48 | |||
49 | PACKAGE BODY lpp_lfr_filter_coeff IS |
|
49 | PACKAGE BODY lpp_lfr_filter_coeff IS | |
50 |
|
50 | |||
51 | FUNCTION get_IIR_CEL_FILTER_CONFIG ( |
|
51 | FUNCTION get_IIR_CEL_FILTER_CONFIG ( | |
52 | COEFFICIENT_SIZE , POINT_POSITION, CEL_NUMBER : INTEGER; |
|
52 | COEFFICIENT_SIZE , POINT_POSITION, CEL_NUMBER : INTEGER; | |
53 | SOS_array : COEFF_CEL_ARRAY_REAL;--(INTEGER RANGE <>); |
|
53 | SOS_array : COEFF_CEL_ARRAY_REAL;--(INTEGER RANGE <>); | |
54 | GAIN_array : COEFF_CEL_REAL |
|
54 | GAIN_array : COEFF_CEL_REAL | |
55 | ) RETURN STD_LOGIC_VECTOR IS |
|
55 | ) RETURN STD_LOGIC_VECTOR IS | |
56 |
|
56 | |||
57 | VARIABLE config_vector : STD_LOGIC_VECTOR((CEL_NUMBER * 5 * COEFFICIENT_SIZE)-1 DOWNTO 0); |
|
57 | VARIABLE config_vector : STD_LOGIC_VECTOR((CEL_NUMBER * 5 * COEFFICIENT_SIZE)-1 DOWNTO 0); | |
58 | VARIABLE SOS_with_gain_array : COEFF_CEL_ARRAY_REAL(1 TO CEL_NUMBER); |
|
58 | VARIABLE SOS_with_gain_array : COEFF_CEL_ARRAY_REAL(1 TO CEL_NUMBER); | |
59 |
|
59 | |||
60 | VARIABLE SOS_with_gain_array_integer : COEFF_CEL_ARRAY_INTEGER(1 TO CEL_NUMBER); |
|
60 | VARIABLE SOS_with_gain_array_integer : COEFF_CEL_ARRAY_INTEGER(1 TO CEL_NUMBER); | |
|
61 | ||||
|
62 | CONSTANT REAL_NEG : REAL := -1.0; | |||
61 | BEGIN |
|
63 | BEGIN | |
62 |
|
64 | |||
63 | all_cel: FOR I IN 1 TO CEL_NUMBER LOOP |
|
65 | all_cel: FOR I IN 1 TO CEL_NUMBER LOOP | |
64 | all_param_b : FOR J IN 1 TO 3 LOOP |
|
66 | all_param_b : FOR J IN 1 TO 3 LOOP | |
65 | SOS_with_gain_array(I)(J) := SOS_array(I)(J) * GAIN_array(I); |
|
67 | SOS_with_gain_array(I)(J) := SOS_array(I)(J) * GAIN_array(I); | |
66 | END LOOP all_param_b; |
|
68 | END LOOP all_param_b; | |
67 | all_param_a : FOR J IN 4 TO 6 LOOP |
|
69 | all_param_a : FOR J IN 4 TO 6 LOOP | |
68 | SOS_with_gain_array(I)(J) := SOS_array(I)(J); |
|
70 | SOS_with_gain_array(I)(J) := SOS_array(I)(J); | |
69 | END LOOP all_param_a; |
|
71 | END LOOP all_param_a; | |
70 | END LOOP all_cel; |
|
72 | END LOOP all_cel; | |
71 |
|
73 | |||
72 | all_cel_int: FOR I IN 1 TO CEL_NUMBER LOOP |
|
74 | all_cel_int: FOR I IN 1 TO CEL_NUMBER LOOP | |
73 |
all_param_int: FOR J IN 1 TO |
|
75 | all_param_int: FOR J IN 1 TO 3 LOOP | |
74 | SOS_with_gain_array_integer(I)(J) := INTEGER( SOS_with_gain_array(I)(J) * REAL(2**(POINT_POSITION)) ); |
|
76 | SOS_with_gain_array_integer(I)(J) := INTEGER( SOS_with_gain_array(I)(J) * REAL(2**(POINT_POSITION)) ); | |
75 | END LOOP all_param_int; |
|
77 | END LOOP all_param_int; | |
76 | END LOOP all_cel_int; |
|
78 | ||
|
79 | --------------------------------------------------------------------------- | |||
|
80 | -- INVERSION of A param due to fact that IIR_CEL module make only MULT and MAC operation | |||
|
81 | all_param_int_a: FOR J IN 4 TO 6 LOOP | |||
|
82 | SOS_with_gain_array_integer(I)(J) := INTEGER( SOS_with_gain_array(I)(J) * REAL(2**(POINT_POSITION)) * REAL_NEG ); | |||
|
83 | END LOOP all_param_int_a; | |||
|
84 | --------------------------------------------------------------------------- | |||
|
85 | END LOOP all_cel_int; | |||
77 |
|
|
86 | ||
|
87 | ||||
78 |
|
|
88 | all_cel_output: FOR I IN 1 TO CEL_NUMBER LOOP | |
79 | all_param_b_out: FOR J IN 1 TO 3 LOOP |
|
89 | all_param_b_out: FOR J IN 1 TO 3 LOOP | |
80 | config_vector( (((I-1)*5)+3-J)*COEFFICIENT_SIZE + COEFFICIENT_SIZE -1 DOWNTO (((I-1)*5)+3-J)*COEFFICIENT_SIZE ) |
|
90 | config_vector( (((I-1)*5)+3-J)*COEFFICIENT_SIZE + COEFFICIENT_SIZE -1 DOWNTO (((I-1)*5)+3-J)*COEFFICIENT_SIZE ) := std_logic_vector(TO_SIGNED(SOS_with_gain_array_integer(I)(J),COEFFICIENT_SIZE )); | |
81 | := std_logic_vector(TO_SIGNED(SOS_with_gain_array_integer(I)(J),COEFFICIENT_SIZE )); |
|
|||
82 | END LOOP all_param_b_out; |
|
91 | END LOOP all_param_b_out; | |
83 | config_vector( (((I-1)*5)+3)*COEFFICIENT_SIZE + COEFFICIENT_SIZE -1 DOWNTO (((I-1)*5)+3)*COEFFICIENT_SIZE ) |
|
92 | ||
84 | := std_logic_vector(TO_SIGNED(SOS_with_gain_array_integer(I)(6),COEFFICIENT_SIZE)); |
|
93 | config_vector( (((I-1)*5)+3)*COEFFICIENT_SIZE + COEFFICIENT_SIZE -1 DOWNTO (((I-1)*5)+3)*COEFFICIENT_SIZE ) := std_logic_vector(TO_SIGNED(SOS_with_gain_array_integer(I)(6),COEFFICIENT_SIZE)); --a2 | |
85 | config_vector( (((I-1)*5)+4)*COEFFICIENT_SIZE + COEFFICIENT_SIZE -1 DOWNTO (((I-1)*5)+4)*COEFFICIENT_SIZE ) |
|
94 | config_vector( (((I-1)*5)+4)*COEFFICIENT_SIZE + COEFFICIENT_SIZE -1 DOWNTO (((I-1)*5)+4)*COEFFICIENT_SIZE ) := std_logic_vector(TO_SIGNED(SOS_with_gain_array_integer(I)(5),COEFFICIENT_SIZE)); --a1 | |
86 | := std_logic_vector(TO_SIGNED(SOS_with_gain_array_integer(I)(5),COEFFICIENT_SIZE)); |
|
|||
87 | END LOOP all_cel_output; |
|
95 | END LOOP all_cel_output; | |
88 |
|
96 | |||
89 | RETURN config_vector; |
|
97 | RETURN config_vector; | |
90 |
|
98 | |||
91 | END FUNCTION; |
|
99 | END FUNCTION; | |
92 |
|
100 | |||
93 | END lpp_lfr_filter_coeff; |
|
101 | END lpp_lfr_filter_coeff; |
General Comments 0
You need to be logged in to leave comments.
Login now