##// END OF EJS Templates
add leon3ft into leon3_soc (and option IS_RADHARD to use leon3 or leon3ft)
pellion -
r524:cca844e6506f JC
parent child
Show More
@@ -1,443 +1,443
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -------------------------------------------------------------------------------
21 -------------------------------------------------------------------------------
22 LIBRARY IEEE;
22 LIBRARY IEEE;
23 USE IEEE.numeric_std.ALL;
23 USE IEEE.numeric_std.ALL;
24 USE IEEE.std_logic_1164.ALL;
24 USE IEEE.std_logic_1164.ALL;
25 LIBRARY grlib;
25 LIBRARY grlib;
26 USE grlib.amba.ALL;
26 USE grlib.amba.ALL;
27 USE grlib.stdlib.ALL;
27 USE grlib.stdlib.ALL;
28 LIBRARY techmap;
28 LIBRARY techmap;
29 USE techmap.gencomp.ALL;
29 USE techmap.gencomp.ALL;
30 LIBRARY gaisler;
30 LIBRARY gaisler;
31 USE gaisler.memctrl.ALL;
31 USE gaisler.memctrl.ALL;
32 USE gaisler.leon3.ALL;
32 USE gaisler.leon3.ALL;
33 USE gaisler.uart.ALL;
33 USE gaisler.uart.ALL;
34 USE gaisler.misc.ALL;
34 USE gaisler.misc.ALL;
35 USE gaisler.spacewire.ALL;
35 USE gaisler.spacewire.ALL;
36 LIBRARY esa;
36 LIBRARY esa;
37 USE esa.memoryctrl.ALL;
37 USE esa.memoryctrl.ALL;
38 LIBRARY lpp;
38 LIBRARY lpp;
39 USE lpp.lpp_memory.ALL;
39 USE lpp.lpp_memory.ALL;
40 USE lpp.lpp_ad_conv.ALL;
40 USE lpp.lpp_ad_conv.ALL;
41 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
41 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
42 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
42 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
43 USE lpp.iir_filter.ALL;
43 USE lpp.iir_filter.ALL;
44 USE lpp.general_purpose.ALL;
44 USE lpp.general_purpose.ALL;
45 USE lpp.lpp_lfr_management.ALL;
45 USE lpp.lpp_lfr_management.ALL;
46 USE lpp.lpp_leon3_soc_pkg.ALL;
46 USE lpp.lpp_leon3_soc_pkg.ALL;
47
47
48 ENTITY LFR_em IS
48 ENTITY LFR_em IS
49
49
50 PORT (
50 PORT (
51 clk100MHz : IN STD_ULOGIC;
51 clk100MHz : IN STD_ULOGIC;
52 clk49_152MHz : IN STD_ULOGIC;
52 clk49_152MHz : IN STD_ULOGIC;
53 reset : IN STD_ULOGIC;
53 reset : IN STD_ULOGIC;
54
54
55 -- TAG --------------------------------------------------------------------
55 -- TAG --------------------------------------------------------------------
56 TAG1 : IN STD_ULOGIC; -- DSU rx data
56 TAG1 : IN STD_ULOGIC; -- DSU rx data
57 TAG3 : OUT STD_ULOGIC; -- DSU tx data
57 TAG3 : OUT STD_ULOGIC; -- DSU tx data
58 -- UART APB ---------------------------------------------------------------
58 -- UART APB ---------------------------------------------------------------
59 TAG2 : IN STD_ULOGIC; -- UART1 rx data
59 TAG2 : IN STD_ULOGIC; -- UART1 rx data
60 TAG4 : OUT STD_ULOGIC; -- UART1 tx data
60 TAG4 : OUT STD_ULOGIC; -- UART1 tx data
61 -- RAM --------------------------------------------------------------------
61 -- RAM --------------------------------------------------------------------
62 address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
62 address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
63 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
63 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
64 nSRAM_BE0 : OUT STD_LOGIC;
64 nSRAM_BE0 : OUT STD_LOGIC;
65 nSRAM_BE1 : OUT STD_LOGIC;
65 nSRAM_BE1 : OUT STD_LOGIC;
66 nSRAM_BE2 : OUT STD_LOGIC;
66 nSRAM_BE2 : OUT STD_LOGIC;
67 nSRAM_BE3 : OUT STD_LOGIC;
67 nSRAM_BE3 : OUT STD_LOGIC;
68 nSRAM_WE : OUT STD_LOGIC;
68 nSRAM_WE : OUT STD_LOGIC;
69 nSRAM_CE : OUT STD_LOGIC;
69 nSRAM_CE : OUT STD_LOGIC;
70 nSRAM_OE : OUT STD_LOGIC;
70 nSRAM_OE : OUT STD_LOGIC;
71 -- SPW --------------------------------------------------------------------
71 -- SPW --------------------------------------------------------------------
72 spw1_din : IN STD_LOGIC;
72 spw1_din : IN STD_LOGIC;
73 spw1_sin : IN STD_LOGIC;
73 spw1_sin : IN STD_LOGIC;
74 spw1_dout : OUT STD_LOGIC;
74 spw1_dout : OUT STD_LOGIC;
75 spw1_sout : OUT STD_LOGIC;
75 spw1_sout : OUT STD_LOGIC;
76 spw2_din : IN STD_LOGIC;
76 spw2_din : IN STD_LOGIC;
77 spw2_sin : IN STD_LOGIC;
77 spw2_sin : IN STD_LOGIC;
78 spw2_dout : OUT STD_LOGIC;
78 spw2_dout : OUT STD_LOGIC;
79 spw2_sout : OUT STD_LOGIC;
79 spw2_sout : OUT STD_LOGIC;
80 -- ADC --------------------------------------------------------------------
80 -- ADC --------------------------------------------------------------------
81 bias_fail_sw : OUT STD_LOGIC;
81 bias_fail_sw : OUT STD_LOGIC;
82 ADC_OEB_bar_CH : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
82 ADC_OEB_bar_CH : OUT STD_LOGIC_VECTOR(7 DOWNTO 0);
83 ADC_smpclk : OUT STD_LOGIC;
83 ADC_smpclk : OUT STD_LOGIC;
84 ADC_data : IN STD_LOGIC_VECTOR(13 DOWNTO 0);
84 ADC_data : IN STD_LOGIC_VECTOR(13 DOWNTO 0);
85 -- HK ---------------------------------------------------------------------
85 -- HK ---------------------------------------------------------------------
86 HK_smpclk : OUT STD_LOGIC;
86 HK_smpclk : OUT STD_LOGIC;
87 ADC_OEB_bar_HK : OUT STD_LOGIC;
87 ADC_OEB_bar_HK : OUT STD_LOGIC;
88 HK_SEL : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
88 HK_SEL : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
89 ---------------------------------------------------------------------------
89 ---------------------------------------------------------------------------
90 TAG8 : OUT STD_LOGIC;
90 TAG8 : OUT STD_LOGIC;
91 led : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
91 led : OUT STD_LOGIC_VECTOR(2 DOWNTO 0)
92 );
92 );
93
93
94 END LFR_em;
94 END LFR_em;
95
95
96
96
97 ARCHITECTURE beh OF LFR_em IS
97 ARCHITECTURE beh OF LFR_em IS
98 SIGNAL clk_50_s : STD_LOGIC := '0';
98 SIGNAL clk_50_s : STD_LOGIC := '0';
99 SIGNAL clk_25 : STD_LOGIC := '0';
99 SIGNAL clk_25 : STD_LOGIC := '0';
100 SIGNAL clk_24 : STD_LOGIC := '0';
100 SIGNAL clk_24 : STD_LOGIC := '0';
101 -----------------------------------------------------------------------------
101 -----------------------------------------------------------------------------
102 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
102 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
103 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
103 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
104
104
105 -- CONSTANTS
105 -- CONSTANTS
106 CONSTANT CFG_PADTECH : INTEGER := inferred;
106 CONSTANT CFG_PADTECH : INTEGER := inferred;
107 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
107 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
108 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
108 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
109 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
109 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
110
110
111 SIGNAL apbi_ext : apb_slv_in_type;
111 SIGNAL apbi_ext : apb_slv_in_type;
112 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5) := (OTHERS => apb_none);
112 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5) := (OTHERS => apb_none);
113 SIGNAL ahbi_s_ext : ahb_slv_in_type;
113 SIGNAL ahbi_s_ext : ahb_slv_in_type;
114 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3) := (OTHERS => ahbs_none);
114 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3) := (OTHERS => ahbs_none);
115 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
115 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
116 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1) := (OTHERS => ahbm_none);
116 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1) := (OTHERS => ahbm_none);
117
117
118 -- Spacewire signals
118 -- Spacewire signals
119 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
119 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
120 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
120 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
121 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
121 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
122 SIGNAL spw_rxtxclk : STD_ULOGIC;
122 SIGNAL spw_rxtxclk : STD_ULOGIC;
123 SIGNAL spw_rxclkn : STD_ULOGIC;
123 SIGNAL spw_rxclkn : STD_ULOGIC;
124 SIGNAL spw_clk : STD_LOGIC;
124 SIGNAL spw_clk : STD_LOGIC;
125 SIGNAL swni : grspw_in_type;
125 SIGNAL swni : grspw_in_type;
126 SIGNAL swno : grspw_out_type;
126 SIGNAL swno : grspw_out_type;
127
127
128 --GPIO
128 --GPIO
129 SIGNAL gpioi : gpio_in_type;
129 SIGNAL gpioi : gpio_in_type;
130 SIGNAL gpioo : gpio_out_type;
130 SIGNAL gpioo : gpio_out_type;
131
131
132 -- AD Converter ADS7886
132 -- AD Converter ADS7886
133 SIGNAL sample : Samples14v(8 DOWNTO 0);
133 SIGNAL sample : Samples14v(8 DOWNTO 0);
134 SIGNAL sample_s : Samples(8 DOWNTO 0);
134 SIGNAL sample_s : Samples(8 DOWNTO 0);
135 SIGNAL sample_val : STD_LOGIC;
135 SIGNAL sample_val : STD_LOGIC;
136 SIGNAL ADC_OEB_bar_CH_s : STD_LOGIC_VECTOR(8 DOWNTO 0);
136 SIGNAL ADC_OEB_bar_CH_s : STD_LOGIC_VECTOR(8 DOWNTO 0);
137
137
138 -----------------------------------------------------------------------------
138 -----------------------------------------------------------------------------
139 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
139 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
140
140
141 -----------------------------------------------------------------------------
141 -----------------------------------------------------------------------------
142 SIGNAL rstn : STD_LOGIC;
142 SIGNAL rstn : STD_LOGIC;
143
143
144 SIGNAL LFR_soft_rstn : STD_LOGIC;
144 SIGNAL LFR_soft_rstn : STD_LOGIC;
145 SIGNAL LFR_rstn : STD_LOGIC;
145 SIGNAL LFR_rstn : STD_LOGIC;
146
146
147 SIGNAL ADC_smpclk_s : STD_LOGIC;
147 SIGNAL ADC_smpclk_s : STD_LOGIC;
148 -----------------------------------------------------------------------------
148 -----------------------------------------------------------------------------
149 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
149 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
150
150
151 BEGIN -- beh
151 BEGIN -- beh
152
152
153 -----------------------------------------------------------------------------
153 -----------------------------------------------------------------------------
154 -- CLK
154 -- CLK
155 -----------------------------------------------------------------------------
155 -----------------------------------------------------------------------------
156 rst0 : rstgen PORT MAP (reset, clk_25, '1', rstn, OPEN);
156 rst0 : rstgen PORT MAP (reset, clk_25, '1', rstn, OPEN);
157
157
158 PROCESS(clk100MHz)
158 PROCESS(clk100MHz)
159 BEGIN
159 BEGIN
160 IF clk100MHz'EVENT AND clk100MHz = '1' THEN
160 IF clk100MHz'EVENT AND clk100MHz = '1' THEN
161 clk_50_s <= NOT clk_50_s;
161 clk_50_s <= NOT clk_50_s;
162 END IF;
162 END IF;
163 END PROCESS;
163 END PROCESS;
164
164
165 PROCESS(clk_50_s)
165 PROCESS(clk_50_s)
166 BEGIN
166 BEGIN
167 IF clk_50_s'EVENT AND clk_50_s = '1' THEN
167 IF clk_50_s'EVENT AND clk_50_s = '1' THEN
168 clk_25 <= NOT clk_25;
168 clk_25 <= NOT clk_25;
169 END IF;
169 END IF;
170 END PROCESS;
170 END PROCESS;
171
171
172 PROCESS(clk49_152MHz)
172 PROCESS(clk49_152MHz)
173 BEGIN
173 BEGIN
174 IF clk49_152MHz'EVENT AND clk49_152MHz = '1' THEN
174 IF clk49_152MHz'EVENT AND clk49_152MHz = '1' THEN
175 clk_24 <= NOT clk_24;
175 clk_24 <= NOT clk_24;
176 END IF;
176 END IF;
177 END PROCESS;
177 END PROCESS;
178
178
179 -----------------------------------------------------------------------------
179 -----------------------------------------------------------------------------
180
180
181 PROCESS (clk_25, rstn)
181 PROCESS (clk_25, rstn)
182 BEGIN -- PROCESS
182 BEGIN -- PROCESS
183 IF rstn = '0' THEN -- asynchronous reset (active low)
183 IF rstn = '0' THEN -- asynchronous reset (active low)
184 led(0) <= '0';
184 led(0) <= '0';
185 led(1) <= '0';
185 led(1) <= '0';
186 led(2) <= '0';
186 led(2) <= '0';
187 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
187 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
188 led(0) <= '0';
188 led(0) <= '0';
189 led(1) <= '1';
189 led(1) <= '1';
190 led(2) <= '1';
190 led(2) <= '1';
191 END IF;
191 END IF;
192 END PROCESS;
192 END PROCESS;
193
193
194 --
194 --
195 leon3_soc_1 : leon3_soc
195 leon3_soc_1 : leon3_soc
196 GENERIC MAP (
196 GENERIC MAP (
197 fabtech => apa3e,
197 fabtech => apa3e,
198 memtech => apa3e,
198 memtech => apa3e,
199 padtech => inferred,
199 padtech => inferred,
200 clktech => inferred,
200 clktech => inferred,
201 disas => 0,
201 disas => 0,
202 dbguart => 0,
202 dbguart => 0,
203 pclow => 2,
203 pclow => 2,
204 clk_freq => 25000,
204 clk_freq => 25000,
205 NB_CPU => 1,
205 NB_CPU => 1,
206 ENABLE_FPU => 1,
206 ENABLE_FPU => 1,
207 FPU_NETLIST => 0,
207 FPU_NETLIST => 0,
208 ENABLE_DSU => 1,
208 ENABLE_DSU => 1,
209 ENABLE_AHB_UART => 1,
209 ENABLE_AHB_UART => 1,
210 ENABLE_APB_UART => 1,
210 ENABLE_APB_UART => 1,
211 ENABLE_IRQMP => 1,
211 ENABLE_IRQMP => 1,
212 ENABLE_GPT => 1,
212 ENABLE_GPT => 1,
213 NB_AHB_MASTER => NB_AHB_MASTER,
213 NB_AHB_MASTER => NB_AHB_MASTER,
214 NB_AHB_SLAVE => NB_AHB_SLAVE,
214 NB_AHB_SLAVE => NB_AHB_SLAVE,
215 NB_APB_SLAVE => NB_APB_SLAVE,
215 NB_APB_SLAVE => NB_APB_SLAVE,
216 ADDRESS_SIZE => 20,
216 ADDRESS_SIZE => 20,
217 USES_IAP_MEMCTRLR => 0)
217 USES_IAP_MEMCTRLR => 0)
218 PORT MAP (
218 PORT MAP (
219 clk => clk_25,
219 clk => clk_25,
220 reset => rstn,
220 reset => rstn,
221 errorn => OPEN,
221 errorn => OPEN,
222
222
223 ahbrxd => TAG1,
223 ahbrxd => TAG1,
224 ahbtxd => TAG3,
224 ahbtxd => TAG3,
225 urxd1 => TAG2,
225 urxd1 => TAG2,
226 utxd1 => TAG4,
226 utxd1 => TAG4,
227
227
228 address => address,
228 address => address,
229 data => data,
229 data => data,
230 nSRAM_BE0 => nSRAM_BE0,
230 nSRAM_BE0 => nSRAM_BE0,
231 nSRAM_BE1 => nSRAM_BE1,
231 nSRAM_BE1 => nSRAM_BE1,
232 nSRAM_BE2 => nSRAM_BE2,
232 nSRAM_BE2 => nSRAM_BE2,
233 nSRAM_BE3 => nSRAM_BE3,
233 nSRAM_BE3 => nSRAM_BE3,
234 nSRAM_WE => nSRAM_WE,
234 nSRAM_WE => nSRAM_WE,
235 nSRAM_CE => nSRAM_CE_s,
235 nSRAM_CE => nSRAM_CE_s,
236 nSRAM_OE => nSRAM_OE,
236 nSRAM_OE => nSRAM_OE,
237 nSRAM_READY => '0',
237 nSRAM_READY => '0',
238 SRAM_MBE => OPEN,
238 SRAM_MBE => OPEN,
239
239
240 apbi_ext => apbi_ext,
240 apbi_ext => apbi_ext,
241 apbo_ext => apbo_ext,
241 apbo_ext => apbo_ext,
242 ahbi_s_ext => ahbi_s_ext,
242 ahbi_s_ext => ahbi_s_ext,
243 ahbo_s_ext => ahbo_s_ext,
243 ahbo_s_ext => ahbo_s_ext,
244 ahbi_m_ext => ahbi_m_ext,
244 ahbi_m_ext => ahbi_m_ext,
245 ahbo_m_ext => ahbo_m_ext);
245 ahbo_m_ext => ahbo_m_ext);
246
246
247
247
248 nSRAM_CE <= nSRAM_CE_s(0);
248 nSRAM_CE <= nSRAM_CE_s(0);
249
249
250 -------------------------------------------------------------------------------
250 -------------------------------------------------------------------------------
251 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
251 -- APB_LFR_TIME_MANAGEMENT ----------------------------------------------------
252 -------------------------------------------------------------------------------
252 -------------------------------------------------------------------------------
253 apb_lfr_management_1 : apb_lfr_management
253 apb_lfr_management_1 : apb_lfr_management
254 GENERIC MAP (
254 GENERIC MAP (
255 pindex => 6,
255 pindex => 6,
256 paddr => 6,
256 paddr => 6,
257 pmask => 16#fff#,
257 pmask => 16#fff#,
258 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
258 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
259 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
259 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
260 PORT MAP (
260 PORT MAP (
261 clk25MHz => clk_25,
261 clk25MHz => clk_25,
262 clk24_576MHz => clk_24, -- 49.152MHz/2
262 clk24_576MHz => clk_24, -- 49.152MHz/2
263 resetn => rstn,
263 resetn => rstn,
264 grspw_tick => swno.tickout,
264 grspw_tick => swno.tickout,
265 apbi => apbi_ext,
265 apbi => apbi_ext,
266 apbo => apbo_ext(6),
266 apbo => apbo_ext(6),
267
267
268 HK_sample => sample_s(8),
268 HK_sample => sample_s(8),
269 HK_val => sample_val,
269 HK_val => sample_val,
270 HK_sel => HK_SEL,
270 HK_sel => HK_SEL,
271
271
272 coarse_time => coarse_time,
272 coarse_time => coarse_time,
273 fine_time => fine_time,
273 fine_time => fine_time,
274 LFR_soft_rstn => LFR_soft_rstn
274 LFR_soft_rstn => LFR_soft_rstn
275 );
275 );
276
276
277 -----------------------------------------------------------------------
277 -----------------------------------------------------------------------
278 --- SpaceWire --------------------------------------------------------
278 --- SpaceWire --------------------------------------------------------
279 -----------------------------------------------------------------------
279 -----------------------------------------------------------------------
280
280
281 -- SPW_EN <= '1';
281 -- SPW_EN <= '1';
282
282
283 spw_clk <= clk_50_s;
283 spw_clk <= clk_50_s;
284 spw_rxtxclk <= spw_clk;
284 spw_rxtxclk <= spw_clk;
285 spw_rxclkn <= NOT spw_rxtxclk;
285 spw_rxclkn <= NOT spw_rxtxclk;
286
286
287 -- PADS for SPW1
287 -- PADS for SPW1
288 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
288 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
289 PORT MAP (spw1_din, dtmp(0));
289 PORT MAP (spw1_din, dtmp(0));
290 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
290 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
291 PORT MAP (spw1_sin, stmp(0));
291 PORT MAP (spw1_sin, stmp(0));
292 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
292 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
293 PORT MAP (spw1_dout, swno.d(0));
293 PORT MAP (spw1_dout, swno.d(0));
294 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
294 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
295 PORT MAP (spw1_sout, swno.s(0));
295 PORT MAP (spw1_sout, swno.s(0));
296 -- PADS FOR SPW2
296 -- PADS FOR SPW2
297 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
297 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
298 PORT MAP (spw2_din, dtmp(1));
298 PORT MAP (spw2_din, dtmp(1));
299 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
299 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
300 PORT MAP (spw2_sin, stmp(1));
300 PORT MAP (spw2_sin, stmp(1));
301 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
301 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
302 PORT MAP (spw2_dout, swno.d(1));
302 PORT MAP (spw2_dout, swno.d(1));
303 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
303 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
304 PORT MAP (spw2_sout, swno.s(1));
304 PORT MAP (spw2_sout, swno.s(1));
305
305
306 -- GRSPW PHY
306 -- GRSPW PHY
307 --spw1_input: if CFG_SPW_GRSPW = 1 generate
307 --spw1_input: if CFG_SPW_GRSPW = 1 generate
308 spw_inputloop : FOR j IN 0 TO 1 GENERATE
308 spw_inputloop : FOR j IN 0 TO 1 GENERATE
309 spw_phy0 : grspw_phy
309 spw_phy0 : grspw_phy
310 GENERIC MAP(
310 GENERIC MAP(
311 tech => apa3e,
311 tech => apa3e,
312 rxclkbuftype => 1,
312 rxclkbuftype => 1,
313 scantest => 0)
313 scantest => 0)
314 PORT MAP(
314 PORT MAP(
315 rxrst => swno.rxrst,
315 rxrst => swno.rxrst,
316 di => dtmp(j),
316 di => dtmp(j),
317 si => stmp(j),
317 si => stmp(j),
318 rxclko => spw_rxclk(j),
318 rxclko => spw_rxclk(j),
319 do => swni.d(j),
319 do => swni.d(j),
320 ndo => swni.nd(j*5+4 DOWNTO j*5),
320 ndo => swni.nd(j*5+4 DOWNTO j*5),
321 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
321 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
322 END GENERATE spw_inputloop;
322 END GENERATE spw_inputloop;
323
323
324 -- SPW core
324 -- SPW core
325 sw0 : grspwm GENERIC MAP(
325 sw0 : grspwm GENERIC MAP(
326 tech => apa3e,
326 tech => apa3e,
327 hindex => 1,
327 hindex => 1,
328 pindex => 5,
328 pindex => 5,
329 paddr => 5,
329 paddr => 5,
330 pirq => 11,
330 pirq => 11,
331 sysfreq => 25000, -- CPU_FREQ
331 sysfreq => 25000, -- CPU_FREQ
332 rmap => 1,
332 rmap => 1,
333 rmapcrc => 1,
333 rmapcrc => 1,
334 fifosize1 => 16,
334 fifosize1 => 16,
335 fifosize2 => 16,
335 fifosize2 => 16,
336 rxclkbuftype => 1,
336 rxclkbuftype => 1,
337 rxunaligned => 0,
337 rxunaligned => 0,
338 rmapbufs => 4,
338 rmapbufs => 4,
339 ft => 0,
339 ft => 0,
340 netlist => 0,
340 netlist => 0,
341 ports => 2,
341 ports => 2,
342 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
342 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
343 memtech => apa3e,
343 memtech => apa3e,
344 destkey => 2,
344 destkey => 2,
345 spwcore => 1
345 spwcore => 1
346 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
346 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
347 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
347 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
348 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
348 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
349 )
349 )
350 PORT MAP(rstn, clk_25, spw_rxclk(0),
350 PORT MAP(rstn, clk_25, spw_rxclk(0),
351 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
351 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
352 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
352 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
353 swni, swno);
353 swni, swno);
354
354
355 swni.tickin <= '0';
355 swni.tickin <= '0';
356 swni.rmapen <= '1';
356 swni.rmapen <= '1';
357 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
357 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
358 swni.tickinraw <= '0';
358 swni.tickinraw <= '0';
359 swni.timein <= (OTHERS => '0');
359 swni.timein <= (OTHERS => '0');
360 swni.dcrstval <= (OTHERS => '0');
360 swni.dcrstval <= (OTHERS => '0');
361 swni.timerrstval <= (OTHERS => '0');
361 swni.timerrstval <= (OTHERS => '0');
362
362
363 -------------------------------------------------------------------------------
363 -------------------------------------------------------------------------------
364 -- LFR ------------------------------------------------------------------------
364 -- LFR ------------------------------------------------------------------------
365 -------------------------------------------------------------------------------
365 -------------------------------------------------------------------------------
366 LFR_rstn <= LFR_soft_rstn AND rstn;
366 LFR_rstn <= LFR_soft_rstn AND rstn;
367
367
368 lpp_lfr_1 : lpp_lfr
368 lpp_lfr_1 : lpp_lfr
369 GENERIC MAP (
369 GENERIC MAP (
370 Mem_use => use_RAM,
370 Mem_use => use_RAM,
371 nb_data_by_buffer_size => 32,
371 nb_data_by_buffer_size => 32,
372 --nb_word_by_buffer_size => 30,
372 --nb_word_by_buffer_size => 30,
373 nb_snapshot_param_size => 32,
373 nb_snapshot_param_size => 32,
374 delta_vector_size => 32,
374 delta_vector_size => 32,
375 delta_vector_size_f0_2 => 7, -- log2(96)
375 delta_vector_size_f0_2 => 7, -- log2(96)
376 pindex => 15,
376 pindex => 15,
377 paddr => 15,
377 paddr => 15,
378 pmask => 16#fff#,
378 pmask => 16#fff#,
379 pirq_ms => 6,
379 pirq_ms => 6,
380 pirq_wfp => 14,
380 pirq_wfp => 14,
381 hindex => 2,
381 hindex => 2,
382 top_lfr_version => X"010135") -- aa.bb.cc version
382 top_lfr_version => X"010138") -- aa.bb.cc version
383 -- AA : BOARD NUMBER
383 -- AA : BOARD NUMBER
384 -- 0 => MINI_LFR
384 -- 0 => MINI_LFR
385 -- 1 => EM
385 -- 1 => EM
386 PORT MAP (
386 PORT MAP (
387 clk => clk_25,
387 clk => clk_25,
388 rstn => LFR_rstn,
388 rstn => LFR_rstn,
389 sample_B => sample_s(2 DOWNTO 0),
389 sample_B => sample_s(2 DOWNTO 0),
390 sample_E => sample_s(7 DOWNTO 3),
390 sample_E => sample_s(7 DOWNTO 3),
391 sample_val => sample_val,
391 sample_val => sample_val,
392 apbi => apbi_ext,
392 apbi => apbi_ext,
393 apbo => apbo_ext(15),
393 apbo => apbo_ext(15),
394 ahbi => ahbi_m_ext,
394 ahbi => ahbi_m_ext,
395 ahbo => ahbo_m_ext(2),
395 ahbo => ahbo_m_ext(2),
396 coarse_time => coarse_time,
396 coarse_time => coarse_time,
397 fine_time => fine_time,
397 fine_time => fine_time,
398 data_shaping_BW => bias_fail_sw,
398 data_shaping_BW => bias_fail_sw,
399 debug_vector => OPEN,
399 debug_vector => OPEN,
400 debug_vector_ms => OPEN); --,
400 debug_vector_ms => OPEN); --,
401 --observation_vector_0 => OPEN,
401 --observation_vector_0 => OPEN,
402 --observation_vector_1 => OPEN,
402 --observation_vector_1 => OPEN,
403 --observation_reg => observation_reg);
403 --observation_reg => observation_reg);
404
404
405
405
406 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
406 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
407 sample_s(I) <= sample(I) & '0' & '0';
407 sample_s(I) <= sample(I) & '0' & '0';
408 END GENERATE all_sample;
408 END GENERATE all_sample;
409 sample_s(8) <= sample(8)(13) & sample(8)(13) & sample(8);
409 sample_s(8) <= sample(8)(13) & sample(8)(13) & sample(8);
410
410
411 -----------------------------------------------------------------------------
411 -----------------------------------------------------------------------------
412 --
412 --
413 -----------------------------------------------------------------------------
413 -----------------------------------------------------------------------------
414 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
414 top_ad_conv_RHF1401_withFilter_1 : top_ad_conv_RHF1401_withFilter
415 GENERIC MAP (
415 GENERIC MAP (
416 ChanelCount => 9,
416 ChanelCount => 9,
417 ncycle_cnv_high => 13,
417 ncycle_cnv_high => 13,
418 ncycle_cnv => 25,
418 ncycle_cnv => 25,
419 FILTER_ENABLED => 16#FF#)
419 FILTER_ENABLED => 16#FF#)
420 PORT MAP (
420 PORT MAP (
421 cnv_clk => clk_24,
421 cnv_clk => clk_24,
422 cnv_rstn => rstn,
422 cnv_rstn => rstn,
423 cnv => ADC_smpclk_s,
423 cnv => ADC_smpclk_s,
424 clk => clk_25,
424 clk => clk_25,
425 rstn => rstn,
425 rstn => rstn,
426 ADC_data => ADC_data,
426 ADC_data => ADC_data,
427 ADC_nOE => ADC_OEB_bar_CH_s,
427 ADC_nOE => ADC_OEB_bar_CH_s,
428 sample => sample,
428 sample => sample,
429 sample_val => sample_val);
429 sample_val => sample_val);
430
430
431 ADC_OEB_bar_CH <= ADC_OEB_bar_CH_s(7 DOWNTO 0);
431 ADC_OEB_bar_CH <= ADC_OEB_bar_CH_s(7 DOWNTO 0);
432
432
433 ADC_smpclk <= ADC_smpclk_s;
433 ADC_smpclk <= ADC_smpclk_s;
434 HK_smpclk <= ADC_smpclk_s;
434 HK_smpclk <= ADC_smpclk_s;
435
435
436 TAG8 <= ADC_smpclk_s;
436 TAG8 <= ADC_smpclk_s;
437
437
438 -----------------------------------------------------------------------------
438 -----------------------------------------------------------------------------
439 -- HK
439 -- HK
440 -----------------------------------------------------------------------------
440 -----------------------------------------------------------------------------
441 ADC_OEB_bar_HK <= ADC_OEB_bar_CH_s(8);
441 ADC_OEB_bar_HK <= ADC_OEB_bar_CH_s(8);
442
442
443 END beh;
443 END beh;
@@ -1,733 +1,732
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -------------------------------------------------------------------------------
21 -------------------------------------------------------------------------------
22 LIBRARY IEEE;
22 LIBRARY IEEE;
23 USE IEEE.numeric_std.ALL;
23 USE IEEE.numeric_std.ALL;
24 USE IEEE.std_logic_1164.ALL;
24 USE IEEE.std_logic_1164.ALL;
25 LIBRARY grlib;
25 LIBRARY grlib;
26 USE grlib.amba.ALL;
26 USE grlib.amba.ALL;
27 USE grlib.stdlib.ALL;
27 USE grlib.stdlib.ALL;
28 LIBRARY techmap;
28 LIBRARY techmap;
29 USE techmap.gencomp.ALL;
29 USE techmap.gencomp.ALL;
30 LIBRARY gaisler;
30 LIBRARY gaisler;
31 USE gaisler.memctrl.ALL;
31 USE gaisler.memctrl.ALL;
32 USE gaisler.leon3.ALL;
32 USE gaisler.leon3.ALL;
33 USE gaisler.uart.ALL;
33 USE gaisler.uart.ALL;
34 USE gaisler.misc.ALL;
34 USE gaisler.misc.ALL;
35 USE gaisler.spacewire.ALL;
35 USE gaisler.spacewire.ALL;
36 LIBRARY esa;
36 LIBRARY esa;
37 USE esa.memoryctrl.ALL;
37 USE esa.memoryctrl.ALL;
38 LIBRARY lpp;
38 LIBRARY lpp;
39 USE lpp.lpp_memory.ALL;
39 USE lpp.lpp_memory.ALL;
40 USE lpp.lpp_ad_conv.ALL;
40 USE lpp.lpp_ad_conv.ALL;
41 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
41 USE lpp.lpp_lfr_pkg.ALL; -- contains lpp_lfr, not in the 206 rev of the VHD_Lib
42 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
42 USE lpp.lpp_top_lfr_pkg.ALL; -- contains top_wf_picker
43 USE lpp.iir_filter.ALL;
43 USE lpp.iir_filter.ALL;
44 USE lpp.general_purpose.ALL;
44 USE lpp.general_purpose.ALL;
45 USE lpp.lpp_lfr_management.ALL;
45 USE lpp.lpp_lfr_management.ALL;
46 USE lpp.lpp_leon3_soc_pkg.ALL;
46 USE lpp.lpp_leon3_soc_pkg.ALL;
47
47
48 ENTITY MINI_LFR_top IS
48 ENTITY MINI_LFR_top IS
49
49
50 PORT (
50 PORT (
51 clk_50 : IN STD_LOGIC;
51 clk_50 : IN STD_LOGIC;
52 clk_49 : IN STD_LOGIC;
52 clk_49 : IN STD_LOGIC;
53 reset : IN STD_LOGIC;
53 reset : IN STD_LOGIC;
54 --BPs
54 --BPs
55 BP0 : IN STD_LOGIC;
55 BP0 : IN STD_LOGIC;
56 BP1 : IN STD_LOGIC;
56 BP1 : IN STD_LOGIC;
57 --LEDs
57 --LEDs
58 LED0 : OUT STD_LOGIC;
58 LED0 : OUT STD_LOGIC;
59 LED1 : OUT STD_LOGIC;
59 LED1 : OUT STD_LOGIC;
60 LED2 : OUT STD_LOGIC;
60 LED2 : OUT STD_LOGIC;
61 --UARTs
61 --UARTs
62 TXD1 : IN STD_LOGIC;
62 TXD1 : IN STD_LOGIC;
63 RXD1 : OUT STD_LOGIC;
63 RXD1 : OUT STD_LOGIC;
64 nCTS1 : OUT STD_LOGIC;
64 nCTS1 : OUT STD_LOGIC;
65 nRTS1 : IN STD_LOGIC;
65 nRTS1 : IN STD_LOGIC;
66
66
67 TXD2 : IN STD_LOGIC;
67 TXD2 : IN STD_LOGIC;
68 RXD2 : OUT STD_LOGIC;
68 RXD2 : OUT STD_LOGIC;
69 nCTS2 : OUT STD_LOGIC;
69 nCTS2 : OUT STD_LOGIC;
70 nDTR2 : IN STD_LOGIC;
70 nDTR2 : IN STD_LOGIC;
71 nRTS2 : IN STD_LOGIC;
71 nRTS2 : IN STD_LOGIC;
72 nDCD2 : OUT STD_LOGIC;
72 nDCD2 : OUT STD_LOGIC;
73
73
74 --EXT CONNECTOR
74 --EXT CONNECTOR
75 IO0 : INOUT STD_LOGIC;
75 IO0 : INOUT STD_LOGIC;
76 IO1 : INOUT STD_LOGIC;
76 IO1 : INOUT STD_LOGIC;
77 IO2 : INOUT STD_LOGIC;
77 IO2 : INOUT STD_LOGIC;
78 IO3 : INOUT STD_LOGIC;
78 IO3 : INOUT STD_LOGIC;
79 IO4 : INOUT STD_LOGIC;
79 IO4 : INOUT STD_LOGIC;
80 IO5 : INOUT STD_LOGIC;
80 IO5 : INOUT STD_LOGIC;
81 IO6 : INOUT STD_LOGIC;
81 IO6 : INOUT STD_LOGIC;
82 IO7 : INOUT STD_LOGIC;
82 IO7 : INOUT STD_LOGIC;
83 IO8 : INOUT STD_LOGIC;
83 IO8 : INOUT STD_LOGIC;
84 IO9 : INOUT STD_LOGIC;
84 IO9 : INOUT STD_LOGIC;
85 IO10 : INOUT STD_LOGIC;
85 IO10 : INOUT STD_LOGIC;
86 IO11 : INOUT STD_LOGIC;
86 IO11 : INOUT STD_LOGIC;
87
87
88 --SPACE WIRE
88 --SPACE WIRE
89 SPW_EN : OUT STD_LOGIC; -- 0 => off
89 SPW_EN : OUT STD_LOGIC; -- 0 => off
90 SPW_NOM_DIN : IN STD_LOGIC; -- NOMINAL LINK
90 SPW_NOM_DIN : IN STD_LOGIC; -- NOMINAL LINK
91 SPW_NOM_SIN : IN STD_LOGIC;
91 SPW_NOM_SIN : IN STD_LOGIC;
92 SPW_NOM_DOUT : OUT STD_LOGIC;
92 SPW_NOM_DOUT : OUT STD_LOGIC;
93 SPW_NOM_SOUT : OUT STD_LOGIC;
93 SPW_NOM_SOUT : OUT STD_LOGIC;
94 SPW_RED_DIN : IN STD_LOGIC; -- REDUNDANT LINK
94 SPW_RED_DIN : IN STD_LOGIC; -- REDUNDANT LINK
95 SPW_RED_SIN : IN STD_LOGIC;
95 SPW_RED_SIN : IN STD_LOGIC;
96 SPW_RED_DOUT : OUT STD_LOGIC;
96 SPW_RED_DOUT : OUT STD_LOGIC;
97 SPW_RED_SOUT : OUT STD_LOGIC;
97 SPW_RED_SOUT : OUT STD_LOGIC;
98 -- MINI LFR ADC INPUTS
98 -- MINI LFR ADC INPUTS
99 ADC_nCS : OUT STD_LOGIC;
99 ADC_nCS : OUT STD_LOGIC;
100 ADC_CLK : OUT STD_LOGIC;
100 ADC_CLK : OUT STD_LOGIC;
101 ADC_SDO : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
101 ADC_SDO : IN STD_LOGIC_VECTOR(7 DOWNTO 0);
102
102
103 -- SRAM
103 -- SRAM
104 SRAM_nWE : OUT STD_LOGIC;
104 SRAM_nWE : OUT STD_LOGIC;
105 SRAM_CE : OUT STD_LOGIC;
105 SRAM_CE : OUT STD_LOGIC;
106 SRAM_nOE : OUT STD_LOGIC;
106 SRAM_nOE : OUT STD_LOGIC;
107 SRAM_nBE : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
107 SRAM_nBE : OUT STD_LOGIC_VECTOR(3 DOWNTO 0);
108 SRAM_A : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
108 SRAM_A : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
109 SRAM_DQ : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0)
109 SRAM_DQ : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0)
110 );
110 );
111
111
112 END MINI_LFR_top;
112 END MINI_LFR_top;
113
113
114
114
115 ARCHITECTURE beh OF MINI_LFR_top IS
115 ARCHITECTURE beh OF MINI_LFR_top IS
116 SIGNAL clk_50_s : STD_LOGIC := '0';
116 SIGNAL clk_50_s : STD_LOGIC := '0';
117 SIGNAL clk_25 : STD_LOGIC := '0';
117 SIGNAL clk_25 : STD_LOGIC := '0';
118 SIGNAL clk_24 : STD_LOGIC := '0';
118 SIGNAL clk_24 : STD_LOGIC := '0';
119 -----------------------------------------------------------------------------
119 -----------------------------------------------------------------------------
120 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
120 SIGNAL coarse_time : STD_LOGIC_VECTOR(31 DOWNTO 0);
121 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
121 SIGNAL fine_time : STD_LOGIC_VECTOR(15 DOWNTO 0);
122 --
122 --
123 SIGNAL errorn : STD_LOGIC;
123 SIGNAL errorn : STD_LOGIC;
124 -- UART AHB ---------------------------------------------------------------
124 -- UART AHB ---------------------------------------------------------------
125 -- SIGNAL ahbrxd : STD_ULOGIC; -- DSU rx data
125 -- SIGNAL ahbrxd : STD_ULOGIC; -- DSU rx data
126 -- SIGNAL ahbtxd : STD_ULOGIC; -- DSU tx data
126 -- SIGNAL ahbtxd : STD_ULOGIC; -- DSU tx data
127
127
128 -- UART APB ---------------------------------------------------------------
128 -- UART APB ---------------------------------------------------------------
129 -- SIGNAL urxd1 : STD_ULOGIC; -- UART1 rx data
129 -- SIGNAL urxd1 : STD_ULOGIC; -- UART1 rx data
130 -- SIGNAL utxd1 : STD_ULOGIC; -- UART1 tx data
130 -- SIGNAL utxd1 : STD_ULOGIC; -- UART1 tx data
131 --
131 --
132 SIGNAL I00_s : STD_LOGIC;
132 SIGNAL I00_s : STD_LOGIC;
133
133
134 -- CONSTANTS
134 -- CONSTANTS
135 CONSTANT CFG_PADTECH : INTEGER := inferred;
135 CONSTANT CFG_PADTECH : INTEGER := inferred;
136 --
136 --
137 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
137 CONSTANT NB_APB_SLAVE : INTEGER := 11; -- 3 = grspw + waveform picker + time manager, 11 allows pindex = f
138 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
138 CONSTANT NB_AHB_SLAVE : INTEGER := 1;
139 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
139 CONSTANT NB_AHB_MASTER : INTEGER := 2; -- 2 = grspw + waveform picker
140
140
141 SIGNAL apbi_ext : apb_slv_in_type;
141 SIGNAL apbi_ext : apb_slv_in_type;
142 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5); -- := (OTHERS => apb_none);
142 SIGNAL apbo_ext : soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5); -- := (OTHERS => apb_none);
143 SIGNAL ahbi_s_ext : ahb_slv_in_type;
143 SIGNAL ahbi_s_ext : ahb_slv_in_type;
144 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3); -- := (OTHERS => ahbs_none);
144 SIGNAL ahbo_s_ext : soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3); -- := (OTHERS => ahbs_none);
145 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
145 SIGNAL ahbi_m_ext : AHB_Mst_In_Type;
146 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1); -- := (OTHERS => ahbm_none);
146 SIGNAL ahbo_m_ext : soc_ahb_mst_out_vector(NB_AHB_MASTER-1+1 DOWNTO 1); -- := (OTHERS => ahbm_none);
147
147
148 -- Spacewire signals
148 -- Spacewire signals
149 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
149 SIGNAL dtmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
150 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
150 SIGNAL stmp : STD_LOGIC_VECTOR(1 DOWNTO 0);
151 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
151 SIGNAL spw_rxclk : STD_LOGIC_VECTOR(1 DOWNTO 0);
152 SIGNAL spw_rxtxclk : STD_ULOGIC;
152 SIGNAL spw_rxtxclk : STD_ULOGIC;
153 SIGNAL spw_rxclkn : STD_ULOGIC;
153 SIGNAL spw_rxclkn : STD_ULOGIC;
154 SIGNAL spw_clk : STD_LOGIC;
154 SIGNAL spw_clk : STD_LOGIC;
155 SIGNAL swni : grspw_in_type;
155 SIGNAL swni : grspw_in_type;
156 SIGNAL swno : grspw_out_type;
156 SIGNAL swno : grspw_out_type;
157 -- SIGNAL clkmn : STD_ULOGIC;
157 -- SIGNAL clkmn : STD_ULOGIC;
158 -- SIGNAL txclk : STD_ULOGIC;
158 -- SIGNAL txclk : STD_ULOGIC;
159
159
160 --GPIO
160 --GPIO
161 SIGNAL gpioi : gpio_in_type;
161 SIGNAL gpioi : gpio_in_type;
162 SIGNAL gpioo : gpio_out_type;
162 SIGNAL gpioo : gpio_out_type;
163
163
164 -- AD Converter ADS7886
164 -- AD Converter ADS7886
165 SIGNAL sample : Samples14v(7 DOWNTO 0);
165 SIGNAL sample : Samples14v(7 DOWNTO 0);
166 SIGNAL sample_s : Samples(7 DOWNTO 0);
166 SIGNAL sample_s : Samples(7 DOWNTO 0);
167 SIGNAL sample_val : STD_LOGIC;
167 SIGNAL sample_val : STD_LOGIC;
168 SIGNAL ADC_nCS_sig : STD_LOGIC;
168 SIGNAL ADC_nCS_sig : STD_LOGIC;
169 SIGNAL ADC_CLK_sig : STD_LOGIC;
169 SIGNAL ADC_CLK_sig : STD_LOGIC;
170 SIGNAL ADC_SDO_sig : STD_LOGIC_VECTOR(7 DOWNTO 0);
170 SIGNAL ADC_SDO_sig : STD_LOGIC_VECTOR(7 DOWNTO 0);
171
171
172 SIGNAL bias_fail_sw_sig : STD_LOGIC;
172 SIGNAL bias_fail_sw_sig : STD_LOGIC;
173
173
174 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
174 SIGNAL observation_reg : STD_LOGIC_VECTOR(31 DOWNTO 0);
175 SIGNAL observation_vector_0 : STD_LOGIC_VECTOR(11 DOWNTO 0);
175 SIGNAL observation_vector_0 : STD_LOGIC_VECTOR(11 DOWNTO 0);
176 SIGNAL observation_vector_1 : STD_LOGIC_VECTOR(11 DOWNTO 0);
176 SIGNAL observation_vector_1 : STD_LOGIC_VECTOR(11 DOWNTO 0);
177 -----------------------------------------------------------------------------
177 -----------------------------------------------------------------------------
178
178
179 SIGNAL LFR_soft_rstn : STD_LOGIC;
179 SIGNAL LFR_soft_rstn : STD_LOGIC;
180 SIGNAL LFR_rstn : STD_LOGIC;
180 SIGNAL LFR_rstn : STD_LOGIC;
181
181
182
182
183 SIGNAL rstn_25 : STD_LOGIC;
183 SIGNAL rstn_25 : STD_LOGIC;
184 SIGNAL rstn_25_d1 : STD_LOGIC;
184 SIGNAL rstn_25_d1 : STD_LOGIC;
185 SIGNAL rstn_25_d2 : STD_LOGIC;
185 SIGNAL rstn_25_d2 : STD_LOGIC;
186 SIGNAL rstn_25_d3 : STD_LOGIC;
186 SIGNAL rstn_25_d3 : STD_LOGIC;
187
187
188 SIGNAL rstn_50 : STD_LOGIC;
188 SIGNAL rstn_50 : STD_LOGIC;
189 SIGNAL rstn_50_d1 : STD_LOGIC;
189 SIGNAL rstn_50_d1 : STD_LOGIC;
190 SIGNAL rstn_50_d2 : STD_LOGIC;
190 SIGNAL rstn_50_d2 : STD_LOGIC;
191 SIGNAL rstn_50_d3 : STD_LOGIC;
191 SIGNAL rstn_50_d3 : STD_LOGIC;
192
192
193 SIGNAL lfr_debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0);
193 SIGNAL lfr_debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0);
194 SIGNAL lfr_debug_vector_ms : STD_LOGIC_VECTOR(11 DOWNTO 0);
194 SIGNAL lfr_debug_vector_ms : STD_LOGIC_VECTOR(11 DOWNTO 0);
195
195
196 --
196 --
197 SIGNAL SRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
197 SIGNAL SRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
198
198
199 --
199 --
200 SIGNAL sample_hk : STD_LOGIC_VECTOR(15 DOWNTO 0);
200 SIGNAL sample_hk : STD_LOGIC_VECTOR(15 DOWNTO 0);
201 SIGNAL HK_SEL : STD_LOGIC_VECTOR( 1 DOWNTO 0);
201 SIGNAL HK_SEL : STD_LOGIC_VECTOR( 1 DOWNTO 0);
202
202
203 BEGIN -- beh
203 BEGIN -- beh
204
204
205 -----------------------------------------------------------------------------
205 -----------------------------------------------------------------------------
206 -- CLK
206 -- CLK
207 -----------------------------------------------------------------------------
207 -----------------------------------------------------------------------------
208
208
209 --PROCESS(clk_50)
209 --PROCESS(clk_50)
210 --BEGIN
210 --BEGIN
211 -- IF clk_50'EVENT AND clk_50 = '1' THEN
211 -- IF clk_50'EVENT AND clk_50 = '1' THEN
212 -- clk_50_s <= NOT clk_50_s;
212 -- clk_50_s <= NOT clk_50_s;
213 -- END IF;
213 -- END IF;
214 --END PROCESS;
214 --END PROCESS;
215
215
216 --PROCESS(clk_50_s)
216 --PROCESS(clk_50_s)
217 --BEGIN
217 --BEGIN
218 -- IF clk_50_s'EVENT AND clk_50_s = '1' THEN
218 -- IF clk_50_s'EVENT AND clk_50_s = '1' THEN
219 -- clk_25 <= NOT clk_25;
219 -- clk_25 <= NOT clk_25;
220 -- END IF;
220 -- END IF;
221 --END PROCESS;
221 --END PROCESS;
222
222
223 --PROCESS(clk_49)
223 --PROCESS(clk_49)
224 --BEGIN
224 --BEGIN
225 -- IF clk_49'EVENT AND clk_49 = '1' THEN
225 -- IF clk_49'EVENT AND clk_49 = '1' THEN
226 -- clk_24 <= NOT clk_24;
226 -- clk_24 <= NOT clk_24;
227 -- END IF;
227 -- END IF;
228 --END PROCESS;
228 --END PROCESS;
229
229
230 --PROCESS(clk_25)
230 --PROCESS(clk_25)
231 --BEGIN
231 --BEGIN
232 -- IF clk_25'EVENT AND clk_25 = '1' THEN
232 -- IF clk_25'EVENT AND clk_25 = '1' THEN
233 -- rstn_25 <= reset;
233 -- rstn_25 <= reset;
234 -- END IF;
234 -- END IF;
235 --END PROCESS;
235 --END PROCESS;
236
236
237 PROCESS (clk_50, reset)
237 PROCESS (clk_50, reset)
238 BEGIN -- PROCESS
238 BEGIN -- PROCESS
239 IF reset = '0' THEN -- asynchronous reset (active low)
239 IF reset = '0' THEN -- asynchronous reset (active low)
240 clk_50_s <= '0';
240 clk_50_s <= '0';
241 rstn_50 <= '0';
241 rstn_50 <= '0';
242 rstn_50_d1 <= '0';
242 rstn_50_d1 <= '0';
243 rstn_50_d2 <= '0';
243 rstn_50_d2 <= '0';
244 rstn_50_d3 <= '0';
244 rstn_50_d3 <= '0';
245
245
246 ELSIF clk_50'EVENT AND clk_50 = '1' THEN -- rising clock edge
246 ELSIF clk_50'EVENT AND clk_50 = '1' THEN -- rising clock edge
247 clk_50_s <= NOT clk_50_s;
247 clk_50_s <= NOT clk_50_s;
248 rstn_50_d1 <= '1';
248 rstn_50_d1 <= '1';
249 rstn_50_d2 <= rstn_50_d1;
249 rstn_50_d2 <= rstn_50_d1;
250 rstn_50_d3 <= rstn_50_d2;
250 rstn_50_d3 <= rstn_50_d2;
251 rstn_50 <= rstn_50_d3;
251 rstn_50 <= rstn_50_d3;
252 END IF;
252 END IF;
253 END PROCESS;
253 END PROCESS;
254
254
255 PROCESS (clk_50_s, rstn_50)
255 PROCESS (clk_50_s, rstn_50)
256 BEGIN -- PROCESS
256 BEGIN -- PROCESS
257 IF rstn_50 = '0' THEN -- asynchronous reset (active low)
257 IF rstn_50 = '0' THEN -- asynchronous reset (active low)
258 clk_25 <= '0';
258 clk_25 <= '0';
259 rstn_25 <= '0';
259 rstn_25 <= '0';
260 rstn_25_d1 <= '0';
260 rstn_25_d1 <= '0';
261 rstn_25_d2 <= '0';
261 rstn_25_d2 <= '0';
262 rstn_25_d3 <= '0';
262 rstn_25_d3 <= '0';
263 ELSIF clk_50_s'EVENT AND clk_50_s = '1' THEN -- rising clock edge
263 ELSIF clk_50_s'EVENT AND clk_50_s = '1' THEN -- rising clock edge
264 clk_25 <= NOT clk_25;
264 clk_25 <= NOT clk_25;
265 rstn_25_d1 <= '1';
265 rstn_25_d1 <= '1';
266 rstn_25_d2 <= rstn_25_d1;
266 rstn_25_d2 <= rstn_25_d1;
267 rstn_25_d3 <= rstn_25_d2;
267 rstn_25_d3 <= rstn_25_d2;
268 rstn_25 <= rstn_25_d3;
268 rstn_25 <= rstn_25_d3;
269 END IF;
269 END IF;
270 END PROCESS;
270 END PROCESS;
271
271
272 PROCESS (clk_49, reset)
272 PROCESS (clk_49, reset)
273 BEGIN -- PROCESS
273 BEGIN -- PROCESS
274 IF reset = '0' THEN -- asynchronous reset (active low)
274 IF reset = '0' THEN -- asynchronous reset (active low)
275 clk_24 <= '0';
275 clk_24 <= '0';
276 ELSIF clk_49'EVENT AND clk_49 = '1' THEN -- rising clock edge
276 ELSIF clk_49'EVENT AND clk_49 = '1' THEN -- rising clock edge
277 clk_24 <= NOT clk_24;
277 clk_24 <= NOT clk_24;
278 END IF;
278 END IF;
279 END PROCESS;
279 END PROCESS;
280
280
281 -----------------------------------------------------------------------------
281 -----------------------------------------------------------------------------
282
282
283 PROCESS (clk_25, rstn_25)
283 PROCESS (clk_25, rstn_25)
284 BEGIN -- PROCESS
284 BEGIN -- PROCESS
285 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
285 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
286 LED0 <= '0';
286 LED0 <= '0';
287 LED1 <= '0';
287 LED1 <= '0';
288 LED2 <= '0';
288 LED2 <= '0';
289 --IO1 <= '0';
289 --IO1 <= '0';
290 --IO2 <= '1';
290 --IO2 <= '1';
291 --IO3 <= '0';
291 --IO3 <= '0';
292 --IO4 <= '0';
292 --IO4 <= '0';
293 --IO5 <= '0';
293 --IO5 <= '0';
294 --IO6 <= '0';
294 --IO6 <= '0';
295 --IO7 <= '0';
295 --IO7 <= '0';
296 --IO8 <= '0';
296 --IO8 <= '0';
297 --IO9 <= '0';
297 --IO9 <= '0';
298 --IO10 <= '0';
298 --IO10 <= '0';
299 --IO11 <= '0';
299 --IO11 <= '0';
300 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
300 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
301 LED0 <= '0';
301 LED0 <= '0';
302 LED1 <= '1';
302 LED1 <= '1';
303 LED2 <= BP0 OR BP1 OR nDTR2 OR nRTS2 OR nRTS1;
303 LED2 <= BP0 OR BP1 OR nDTR2 OR nRTS2 OR nRTS1;
304 --IO1 <= '1';
304 --IO1 <= '1';
305 --IO2 <= SPW_NOM_DIN OR SPW_NOM_SIN OR SPW_RED_DIN OR SPW_RED_SIN;
305 --IO2 <= SPW_NOM_DIN OR SPW_NOM_SIN OR SPW_RED_DIN OR SPW_RED_SIN;
306 --IO3 <= ADC_SDO(0);
306 --IO3 <= ADC_SDO(0);
307 --IO4 <= ADC_SDO(1);
307 --IO4 <= ADC_SDO(1);
308 --IO5 <= ADC_SDO(2);
308 --IO5 <= ADC_SDO(2);
309 --IO6 <= ADC_SDO(3);
309 --IO6 <= ADC_SDO(3);
310 --IO7 <= ADC_SDO(4);
310 --IO7 <= ADC_SDO(4);
311 --IO8 <= ADC_SDO(5);
311 --IO8 <= ADC_SDO(5);
312 --IO9 <= ADC_SDO(6);
312 --IO9 <= ADC_SDO(6);
313 --IO10 <= ADC_SDO(7);
313 --IO10 <= ADC_SDO(7);
314 --IO11 <= BP1 OR nDTR2 OR nRTS2 OR nRTS1;
314 --IO11 <= BP1 OR nDTR2 OR nRTS2 OR nRTS1;
315 END IF;
315 END IF;
316 END PROCESS;
316 END PROCESS;
317
317
318 PROCESS (clk_24, rstn_25)
318 PROCESS (clk_24, rstn_25)
319 BEGIN -- PROCESS
319 BEGIN -- PROCESS
320 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
320 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
321 I00_s <= '0';
321 I00_s <= '0';
322 ELSIF clk_24'EVENT AND clk_24 = '1' THEN -- rising clock edge
322 ELSIF clk_24'EVENT AND clk_24 = '1' THEN -- rising clock edge
323 I00_s <= NOT I00_s;
323 I00_s <= NOT I00_s;
324 END IF;
324 END IF;
325 END PROCESS;
325 END PROCESS;
326 -- IO0 <= I00_s;
326 -- IO0 <= I00_s;
327
327
328 --UARTs
328 --UARTs
329 nCTS1 <= '1';
329 nCTS1 <= '1';
330 nCTS2 <= '1';
330 nCTS2 <= '1';
331 nDCD2 <= '1';
331 nDCD2 <= '1';
332
332
333 --EXT CONNECTOR
333 --
334
334
335 --SPACE WIRE
336
337 leon3_soc_1 : leon3_soc
335 leon3_soc_1 : leon3_soc
338 GENERIC MAP (
336 GENERIC MAP (
339 fabtech => apa3e,
337 fabtech => apa3e,
340 memtech => apa3e,
338 memtech => apa3e,
341 padtech => inferred,
339 padtech => inferred,
342 clktech => inferred,
340 clktech => inferred,
343 disas => 0,
341 disas => 0,
344 dbguart => 0,
342 dbguart => 0,
345 pclow => 2,
343 pclow => 2,
346 clk_freq => 25000,
344 clk_freq => 25000,
345 IS_RADHARD => 1,
347 NB_CPU => 1,
346 NB_CPU => 1,
348 ENABLE_FPU => 1,
347 ENABLE_FPU => 1,
349 FPU_NETLIST => 0,
348 FPU_NETLIST => 0,
350 ENABLE_DSU => 1,
349 ENABLE_DSU => 1,
351 ENABLE_AHB_UART => 1,
350 ENABLE_AHB_UART => 1,
352 ENABLE_APB_UART => 1,
351 ENABLE_APB_UART => 1,
353 ENABLE_IRQMP => 1,
352 ENABLE_IRQMP => 1,
354 ENABLE_GPT => 1,
353 ENABLE_GPT => 1,
355 NB_AHB_MASTER => NB_AHB_MASTER,
354 NB_AHB_MASTER => NB_AHB_MASTER,
356 NB_AHB_SLAVE => NB_AHB_SLAVE,
355 NB_AHB_SLAVE => NB_AHB_SLAVE,
357 NB_APB_SLAVE => NB_APB_SLAVE,
356 NB_APB_SLAVE => NB_APB_SLAVE,
358 ADDRESS_SIZE => 20,
357 ADDRESS_SIZE => 20,
359 USES_IAP_MEMCTRLR => 0)
358 USES_IAP_MEMCTRLR => 0)
360 PORT MAP (
359 PORT MAP (
361 clk => clk_25,
360 clk => clk_25,
362 reset => rstn_25,
361 reset => rstn_25,
363 errorn => errorn,
362 errorn => errorn,
364 ahbrxd => TXD1,
363 ahbrxd => TXD1,
365 ahbtxd => RXD1,
364 ahbtxd => RXD1,
366 urxd1 => TXD2,
365 urxd1 => TXD2,
367 utxd1 => RXD2,
366 utxd1 => RXD2,
368 address => SRAM_A,
367 address => SRAM_A,
369 data => SRAM_DQ,
368 data => SRAM_DQ,
370 nSRAM_BE0 => SRAM_nBE(0),
369 nSRAM_BE0 => SRAM_nBE(0),
371 nSRAM_BE1 => SRAM_nBE(1),
370 nSRAM_BE1 => SRAM_nBE(1),
372 nSRAM_BE2 => SRAM_nBE(2),
371 nSRAM_BE2 => SRAM_nBE(2),
373 nSRAM_BE3 => SRAM_nBE(3),
372 nSRAM_BE3 => SRAM_nBE(3),
374 nSRAM_WE => SRAM_nWE,
373 nSRAM_WE => SRAM_nWE,
375 nSRAM_CE => SRAM_CE_s,
374 nSRAM_CE => SRAM_CE_s,
376 nSRAM_OE => SRAM_nOE,
375 nSRAM_OE => SRAM_nOE,
377 nSRAM_READY => '0',
376 nSRAM_READY => '0',
378 SRAM_MBE => OPEN,
377 SRAM_MBE => OPEN,
379 apbi_ext => apbi_ext,
378 apbi_ext => apbi_ext,
380 apbo_ext => apbo_ext,
379 apbo_ext => apbo_ext,
381 ahbi_s_ext => ahbi_s_ext,
380 ahbi_s_ext => ahbi_s_ext,
382 ahbo_s_ext => ahbo_s_ext,
381 ahbo_s_ext => ahbo_s_ext,
383 ahbi_m_ext => ahbi_m_ext,
382 ahbi_m_ext => ahbi_m_ext,
384 ahbo_m_ext => ahbo_m_ext);
383 ahbo_m_ext => ahbo_m_ext);
385
384
386 SRAM_CE <= SRAM_CE_s(0);
385 SRAM_CE <= SRAM_CE_s(0);
387 -------------------------------------------------------------------------------
386 -------------------------------------------------------------------------------
388 -- APB_LFR_MANAGEMENT ---------------------------------------------------------
387 -- APB_LFR_MANAGEMENT ---------------------------------------------------------
389 -------------------------------------------------------------------------------
388 -------------------------------------------------------------------------------
390 apb_lfr_management_1 : apb_lfr_management
389 apb_lfr_management_1 : apb_lfr_management
391 GENERIC MAP (
390 GENERIC MAP (
392 pindex => 6,
391 pindex => 6,
393 paddr => 6,
392 paddr => 6,
394 pmask => 16#fff#,
393 pmask => 16#fff#,
395 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
394 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
396 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
395 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
397 PORT MAP (
396 PORT MAP (
398 clk25MHz => clk_25,
397 clk25MHz => clk_25,
399 clk24_576MHz => clk_24, -- 49.152MHz/2
398 clk24_576MHz => clk_24, -- 49.152MHz/2
400 resetn => rstn_25,
399 resetn => rstn_25,
401 grspw_tick => swno.tickout,
400 grspw_tick => swno.tickout,
402 apbi => apbi_ext,
401 apbi => apbi_ext,
403 apbo => apbo_ext(6),
402 apbo => apbo_ext(6),
404 HK_sample => sample_hk,
403 HK_sample => sample_hk,
405 HK_val => sample_val,
404 HK_val => sample_val,
406 HK_sel => HK_SEL,
405 HK_sel => HK_SEL,
407 coarse_time => coarse_time,
406 coarse_time => coarse_time,
408 fine_time => fine_time,
407 fine_time => fine_time,
409 LFR_soft_rstn => LFR_soft_rstn
408 LFR_soft_rstn => LFR_soft_rstn
410 );
409 );
411
410
412 -----------------------------------------------------------------------
411 -----------------------------------------------------------------------
413 --- SpaceWire --------------------------------------------------------
412 --- SpaceWire --------------------------------------------------------
414 -----------------------------------------------------------------------
413 -----------------------------------------------------------------------
415
414
416 SPW_EN <= '1';
415 SPW_EN <= '1';
417
416
418 spw_clk <= clk_50_s;
417 spw_clk <= clk_50_s;
419 spw_rxtxclk <= spw_clk;
418 spw_rxtxclk <= spw_clk;
420 spw_rxclkn <= NOT spw_rxtxclk;
419 spw_rxclkn <= NOT spw_rxtxclk;
421
420
422 -- PADS for SPW1
421 -- PADS for SPW1
423 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
422 spw1_rxd_pad : inpad GENERIC MAP (tech => inferred)
424 PORT MAP (SPW_NOM_DIN, dtmp(0));
423 PORT MAP (SPW_NOM_DIN, dtmp(0));
425 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
424 spw1_rxs_pad : inpad GENERIC MAP (tech => inferred)
426 PORT MAP (SPW_NOM_SIN, stmp(0));
425 PORT MAP (SPW_NOM_SIN, stmp(0));
427 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
426 spw1_txd_pad : outpad GENERIC MAP (tech => inferred)
428 PORT MAP (SPW_NOM_DOUT, swno.d(0));
427 PORT MAP (SPW_NOM_DOUT, swno.d(0));
429 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
428 spw1_txs_pad : outpad GENERIC MAP (tech => inferred)
430 PORT MAP (SPW_NOM_SOUT, swno.s(0));
429 PORT MAP (SPW_NOM_SOUT, swno.s(0));
431 -- PADS FOR SPW2
430 -- PADS FOR SPW2
432 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
431 spw2_rxd_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
433 PORT MAP (SPW_RED_SIN, dtmp(1));
432 PORT MAP (SPW_RED_SIN, dtmp(1));
434 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
433 spw2_rxs_pad : inpad GENERIC MAP (tech => inferred) -- bad naming of the MINI-LFR /!\
435 PORT MAP (SPW_RED_DIN, stmp(1));
434 PORT MAP (SPW_RED_DIN, stmp(1));
436 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
435 spw2_txd_pad : outpad GENERIC MAP (tech => inferred)
437 PORT MAP (SPW_RED_DOUT, swno.d(1));
436 PORT MAP (SPW_RED_DOUT, swno.d(1));
438 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
437 spw2_txs_pad : outpad GENERIC MAP (tech => inferred)
439 PORT MAP (SPW_RED_SOUT, swno.s(1));
438 PORT MAP (SPW_RED_SOUT, swno.s(1));
440
439
441 -- GRSPW PHY
440 -- GRSPW PHY
442 --spw1_input: if CFG_SPW_GRSPW = 1 generate
441 --spw1_input: if CFG_SPW_GRSPW = 1 generate
443 spw_inputloop : FOR j IN 0 TO 1 GENERATE
442 spw_inputloop : FOR j IN 0 TO 1 GENERATE
444 spw_phy0 : grspw_phy
443 spw_phy0 : grspw_phy
445 GENERIC MAP(
444 GENERIC MAP(
446 tech => apa3e,
445 tech => apa3e,
447 rxclkbuftype => 1,
446 rxclkbuftype => 1,
448 scantest => 0)
447 scantest => 0)
449 PORT MAP(
448 PORT MAP(
450 rxrst => swno.rxrst,
449 rxrst => swno.rxrst,
451 di => dtmp(j),
450 di => dtmp(j),
452 si => stmp(j),
451 si => stmp(j),
453 rxclko => spw_rxclk(j),
452 rxclko => spw_rxclk(j),
454 do => swni.d(j),
453 do => swni.d(j),
455 ndo => swni.nd(j*5+4 DOWNTO j*5),
454 ndo => swni.nd(j*5+4 DOWNTO j*5),
456 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
455 dconnect => swni.dconnect(j*2+1 DOWNTO j*2));
457 END GENERATE spw_inputloop;
456 END GENERATE spw_inputloop;
458
457
459 swni.rmapnodeaddr <= (OTHERS => '0');
458 swni.rmapnodeaddr <= (OTHERS => '0');
460
459
461 -- SPW core
460 -- SPW core
462 sw0 : grspwm GENERIC MAP(
461 sw0 : grspwm GENERIC MAP(
463 tech => apa3e,
462 tech => apa3e,
464 hindex => 1,
463 hindex => 1,
465 pindex => 5,
464 pindex => 5,
466 paddr => 5,
465 paddr => 5,
467 pirq => 11,
466 pirq => 11,
468 sysfreq => 25000, -- CPU_FREQ
467 sysfreq => 25000, -- CPU_FREQ
469 rmap => 1,
468 rmap => 1,
470 rmapcrc => 1,
469 rmapcrc => 1,
471 fifosize1 => 16,
470 fifosize1 => 16,
472 fifosize2 => 16,
471 fifosize2 => 16,
473 rxclkbuftype => 1,
472 rxclkbuftype => 1,
474 rxunaligned => 0,
473 rxunaligned => 0,
475 rmapbufs => 4,
474 rmapbufs => 4,
476 ft => 0,
475 ft => 0,
477 netlist => 0,
476 netlist => 0,
478 ports => 2,
477 ports => 2,
479 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
478 --dmachan => CFG_SPW_DMACHAN, -- not used byt the spw core 1
480 memtech => apa3e,
479 memtech => apa3e,
481 destkey => 2,
480 destkey => 2,
482 spwcore => 1
481 spwcore => 1
483 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
482 --input_type => CFG_SPW_INPUT, -- not used byt the spw core 1
484 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
483 --output_type => CFG_SPW_OUTPUT, -- not used byt the spw core 1
485 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
484 --rxtx_sameclk => CFG_SPW_RTSAME -- not used byt the spw core 1
486 )
485 )
487 PORT MAP(rstn_25, clk_25, spw_rxclk(0),
486 PORT MAP(rstn_25, clk_25, spw_rxclk(0),
488 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
487 spw_rxclk(1), spw_rxtxclk, spw_rxtxclk,
489 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
488 ahbi_m_ext, ahbo_m_ext(1), apbi_ext, apbo_ext(5),
490 swni, swno);
489 swni, swno);
491
490
492 swni.tickin <= '0';
491 swni.tickin <= '0';
493 swni.rmapen <= '1';
492 swni.rmapen <= '1';
494 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
493 swni.clkdiv10 <= "00000100"; -- 10 MHz / (4 + 1) = 10 MHz
495 swni.tickinraw <= '0';
494 swni.tickinraw <= '0';
496 swni.timein <= (OTHERS => '0');
495 swni.timein <= (OTHERS => '0');
497 swni.dcrstval <= (OTHERS => '0');
496 swni.dcrstval <= (OTHERS => '0');
498 swni.timerrstval <= (OTHERS => '0');
497 swni.timerrstval <= (OTHERS => '0');
499
498
500 -------------------------------------------------------------------------------
499 -------------------------------------------------------------------------------
501 -- LFR ------------------------------------------------------------------------
500 -- LFR ------------------------------------------------------------------------
502 -------------------------------------------------------------------------------
501 -------------------------------------------------------------------------------
503
502
504
503
505 LFR_rstn <= LFR_soft_rstn AND rstn_25;
504 LFR_rstn <= LFR_soft_rstn AND rstn_25;
506 --LFR_rstn <= rstn_25;
505 --LFR_rstn <= rstn_25;
507
506
508 lpp_lfr_1 : lpp_lfr
507 lpp_lfr_1 : lpp_lfr
509 GENERIC MAP (
508 GENERIC MAP (
510 Mem_use => use_RAM,
509 Mem_use => use_RAM,
511 nb_data_by_buffer_size => 32,
510 nb_data_by_buffer_size => 32,
512 nb_snapshot_param_size => 32,
511 nb_snapshot_param_size => 32,
513 delta_vector_size => 32,
512 delta_vector_size => 32,
514 delta_vector_size_f0_2 => 7, -- log2(96)
513 delta_vector_size_f0_2 => 7, -- log2(96)
515 pindex => 15,
514 pindex => 15,
516 paddr => 15,
515 paddr => 15,
517 pmask => 16#fff#,
516 pmask => 16#fff#,
518 pirq_ms => 6,
517 pirq_ms => 6,
519 pirq_wfp => 14,
518 pirq_wfp => 14,
520 hindex => 2,
519 hindex => 2,
521 top_lfr_version => X"000138") -- aa.bb.cc version
520 top_lfr_version => X"000138") -- aa.bb.cc version
522 PORT MAP (
521 PORT MAP (
523 clk => clk_25,
522 clk => clk_25,
524 rstn => LFR_rstn,
523 rstn => LFR_rstn,
525 sample_B => sample_s(2 DOWNTO 0),
524 sample_B => sample_s(2 DOWNTO 0),
526 sample_E => sample_s(7 DOWNTO 3),
525 sample_E => sample_s(7 DOWNTO 3),
527 sample_val => sample_val,
526 sample_val => sample_val,
528 apbi => apbi_ext,
527 apbi => apbi_ext,
529 apbo => apbo_ext(15),
528 apbo => apbo_ext(15),
530 ahbi => ahbi_m_ext,
529 ahbi => ahbi_m_ext,
531 ahbo => ahbo_m_ext(2),
530 ahbo => ahbo_m_ext(2),
532 coarse_time => coarse_time,
531 coarse_time => coarse_time,
533 fine_time => fine_time,
532 fine_time => fine_time,
534 data_shaping_BW => bias_fail_sw_sig,
533 data_shaping_BW => bias_fail_sw_sig,
535 debug_vector => lfr_debug_vector,
534 debug_vector => lfr_debug_vector,
536 debug_vector_ms => lfr_debug_vector_ms
535 debug_vector_ms => lfr_debug_vector_ms
537 );
536 );
538
537
539 observation_reg(11 DOWNTO 0) <= lfr_debug_vector;
538 observation_reg(11 DOWNTO 0) <= lfr_debug_vector;
540 observation_reg(31 DOWNTO 12) <= (OTHERS => '0');
539 observation_reg(31 DOWNTO 12) <= (OTHERS => '0');
541 observation_vector_0(11 DOWNTO 0) <= lfr_debug_vector;
540 observation_vector_0(11 DOWNTO 0) <= lfr_debug_vector;
542 observation_vector_1(11 DOWNTO 0) <= lfr_debug_vector;
541 observation_vector_1(11 DOWNTO 0) <= lfr_debug_vector;
543 IO0 <= rstn_25;
542 IO0 <= rstn_25;
544 IO1 <= lfr_debug_vector_ms(0); -- LFR MS FFT data_valid
543 IO1 <= lfr_debug_vector_ms(0); -- LFR MS FFT data_valid
545 IO2 <= lfr_debug_vector_ms(0); -- LFR MS FFT ready
544 IO2 <= lfr_debug_vector_ms(0); -- LFR MS FFT ready
546 IO3 <= lfr_debug_vector(0); -- LFR APBREG error_buffer_full
545 IO3 <= lfr_debug_vector(0); -- LFR APBREG error_buffer_full
547 IO4 <= lfr_debug_vector(1); -- LFR APBREG reg_sp.status_error_buffer_full
546 IO4 <= lfr_debug_vector(1); -- LFR APBREG reg_sp.status_error_buffer_full
548 IO5 <= lfr_debug_vector(8); -- LFR APBREG ready_matrix_f2
547 IO5 <= lfr_debug_vector(8); -- LFR APBREG ready_matrix_f2
549 IO6 <= lfr_debug_vector(9); -- LFR APBREG reg0_ready_matrix_f2
548 IO6 <= lfr_debug_vector(9); -- LFR APBREG reg0_ready_matrix_f2
550 IO7 <= lfr_debug_vector(10); -- LFR APBREG reg0_ready_matrix_f2
549 IO7 <= lfr_debug_vector(10); -- LFR APBREG reg0_ready_matrix_f2
551
550
552 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
551 all_sample : FOR I IN 7 DOWNTO 0 GENERATE
553 sample_s(I) <= sample(I)(11 DOWNTO 0) & '0' & '0' & '0' & '0';
552 sample_s(I) <= sample(I)(11 DOWNTO 0) & '0' & '0' & '0' & '0';
554 END GENERATE all_sample;
553 END GENERATE all_sample;
555
554
556 top_ad_conv_ADS7886_v2_1 : top_ad_conv_ADS7886_v2
555 top_ad_conv_ADS7886_v2_1 : top_ad_conv_ADS7886_v2
557 GENERIC MAP(
556 GENERIC MAP(
558 ChannelCount => 8,
557 ChannelCount => 8,
559 SampleNbBits => 14,
558 SampleNbBits => 14,
560 ncycle_cnv_high => 40, -- at least 32 cycles at 25 MHz, 32 * 49.152 / 25 /2 = 31.5
559 ncycle_cnv_high => 40, -- at least 32 cycles at 25 MHz, 32 * 49.152 / 25 /2 = 31.5
561 ncycle_cnv => 249) -- 49 152 000 / 98304 /2
560 ncycle_cnv => 249) -- 49 152 000 / 98304 /2
562 PORT MAP (
561 PORT MAP (
563 -- CONV
562 -- CONV
564 cnv_clk => clk_24,
563 cnv_clk => clk_24,
565 cnv_rstn => rstn_25,
564 cnv_rstn => rstn_25,
566 cnv => ADC_nCS_sig,
565 cnv => ADC_nCS_sig,
567 -- DATA
566 -- DATA
568 clk => clk_25,
567 clk => clk_25,
569 rstn => rstn_25,
568 rstn => rstn_25,
570 sck => ADC_CLK_sig,
569 sck => ADC_CLK_sig,
571 sdo => ADC_SDO_sig,
570 sdo => ADC_SDO_sig,
572 -- SAMPLE
571 -- SAMPLE
573 sample => sample,
572 sample => sample,
574 sample_val => sample_val);
573 sample_val => sample_val);
575
574
576 --IO10 <= ADC_SDO_sig(5);
575 --IO10 <= ADC_SDO_sig(5);
577 --IO9 <= ADC_SDO_sig(4);
576 --IO9 <= ADC_SDO_sig(4);
578 --IO8 <= ADC_SDO_sig(3);
577 --IO8 <= ADC_SDO_sig(3);
579
578
580 ADC_nCS <= ADC_nCS_sig;
579 ADC_nCS <= ADC_nCS_sig;
581 ADC_CLK <= ADC_CLK_sig;
580 ADC_CLK <= ADC_CLK_sig;
582 ADC_SDO_sig <= ADC_SDO;
581 ADC_SDO_sig <= ADC_SDO;
583
582
584 sample_hk <= "0001000100010001" WHEN HK_SEL = "00" ELSE
583 sample_hk <= "0001000100010001" WHEN HK_SEL = "00" ELSE
585 "0010001000100010" WHEN HK_SEL = "01" ELSE
584 "0010001000100010" WHEN HK_SEL = "01" ELSE
586 "0100010001000100" WHEN HK_SEL = "10" ELSE
585 "0100010001000100" WHEN HK_SEL = "10" ELSE
587 (OTHERS => '0');
586 (OTHERS => '0');
588
587
589
588
590 ----------------------------------------------------------------------
589 ----------------------------------------------------------------------
591 --- GPIO -----------------------------------------------------------
590 --- GPIO -----------------------------------------------------------
592 ----------------------------------------------------------------------
591 ----------------------------------------------------------------------
593
592
594 grgpio0 : grgpio
593 grgpio0 : grgpio
595 GENERIC MAP(pindex => 11, paddr => 11, imask => 16#0000#, nbits => 8)
594 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);
595 PORT MAP(rstn_25, clk_25, apbi_ext, apbo_ext(11), gpioi, gpioo);
597
596
598 gpioi.sig_en <= (OTHERS => '0');
597 gpioi.sig_en <= (OTHERS => '0');
599 gpioi.sig_in <= (OTHERS => '0');
598 gpioi.sig_in <= (OTHERS => '0');
600 gpioi.din <= (OTHERS => '0');
599 gpioi.din <= (OTHERS => '0');
601 --pio_pad_0 : iopad
600 --pio_pad_0 : iopad
602 -- GENERIC MAP (tech => CFG_PADTECH)
601 -- GENERIC MAP (tech => CFG_PADTECH)
603 -- PORT MAP (IO0, gpioo.dout(0), gpioo.oen(0), gpioi.din(0));
602 -- PORT MAP (IO0, gpioo.dout(0), gpioo.oen(0), gpioi.din(0));
604 --pio_pad_1 : iopad
603 --pio_pad_1 : iopad
605 -- GENERIC MAP (tech => CFG_PADTECH)
604 -- GENERIC MAP (tech => CFG_PADTECH)
606 -- PORT MAP (IO1, gpioo.dout(1), gpioo.oen(1), gpioi.din(1));
605 -- PORT MAP (IO1, gpioo.dout(1), gpioo.oen(1), gpioi.din(1));
607 --pio_pad_2 : iopad
606 --pio_pad_2 : iopad
608 -- GENERIC MAP (tech => CFG_PADTECH)
607 -- GENERIC MAP (tech => CFG_PADTECH)
609 -- PORT MAP (IO2, gpioo.dout(2), gpioo.oen(2), gpioi.din(2));
608 -- PORT MAP (IO2, gpioo.dout(2), gpioo.oen(2), gpioi.din(2));
610 --pio_pad_3 : iopad
609 --pio_pad_3 : iopad
611 -- GENERIC MAP (tech => CFG_PADTECH)
610 -- GENERIC MAP (tech => CFG_PADTECH)
612 -- PORT MAP (IO3, gpioo.dout(3), gpioo.oen(3), gpioi.din(3));
611 -- PORT MAP (IO3, gpioo.dout(3), gpioo.oen(3), gpioi.din(3));
613 --pio_pad_4 : iopad
612 --pio_pad_4 : iopad
614 -- GENERIC MAP (tech => CFG_PADTECH)
613 -- GENERIC MAP (tech => CFG_PADTECH)
615 -- PORT MAP (IO4, gpioo.dout(4), gpioo.oen(4), gpioi.din(4));
614 -- PORT MAP (IO4, gpioo.dout(4), gpioo.oen(4), gpioi.din(4));
616 --pio_pad_5 : iopad
615 --pio_pad_5 : iopad
617 -- GENERIC MAP (tech => CFG_PADTECH)
616 -- GENERIC MAP (tech => CFG_PADTECH)
618 -- PORT MAP (IO5, gpioo.dout(5), gpioo.oen(5), gpioi.din(5));
617 -- PORT MAP (IO5, gpioo.dout(5), gpioo.oen(5), gpioi.din(5));
619 --pio_pad_6 : iopad
618 --pio_pad_6 : iopad
620 -- GENERIC MAP (tech => CFG_PADTECH)
619 -- GENERIC MAP (tech => CFG_PADTECH)
621 -- PORT MAP (IO6, gpioo.dout(6), gpioo.oen(6), gpioi.din(6));
620 -- PORT MAP (IO6, gpioo.dout(6), gpioo.oen(6), gpioi.din(6));
622 --pio_pad_7 : iopad
621 --pio_pad_7 : iopad
623 -- GENERIC MAP (tech => CFG_PADTECH)
622 -- GENERIC MAP (tech => CFG_PADTECH)
624 -- PORT MAP (IO7, gpioo.dout(7), gpioo.oen(7), gpioi.din(7));
623 -- PORT MAP (IO7, gpioo.dout(7), gpioo.oen(7), gpioi.din(7));
625
624
626 PROCESS (clk_25, rstn_25)
625 PROCESS (clk_25, rstn_25)
627 BEGIN -- PROCESS
626 BEGIN -- PROCESS
628 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
627 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
629 -- --IO0 <= '0';
628 -- --IO0 <= '0';
630 -- IO1 <= '0';
629 -- IO1 <= '0';
631 -- IO2 <= '0';
630 -- IO2 <= '0';
632 -- IO3 <= '0';
631 -- IO3 <= '0';
633 -- IO4 <= '0';
632 -- IO4 <= '0';
634 -- IO5 <= '0';
633 -- IO5 <= '0';
635 -- IO6 <= '0';
634 -- IO6 <= '0';
636 -- IO7 <= '0';
635 -- IO7 <= '0';
637 IO8 <= '0';
636 IO8 <= '0';
638 IO9 <= '0';
637 IO9 <= '0';
639 IO10 <= '0';
638 IO10 <= '0';
640 IO11 <= '0';
639 IO11 <= '0';
641 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
640 ELSIF clk_25'EVENT AND clk_25 = '1' THEN -- rising clock edge
642 CASE gpioo.dout(2 DOWNTO 0) IS
641 CASE gpioo.dout(2 DOWNTO 0) IS
643 WHEN "011" =>
642 WHEN "011" =>
644 -- --IO0 <= observation_reg(0 );
643 -- --IO0 <= observation_reg(0 );
645 -- IO1 <= observation_reg(1 );
644 -- IO1 <= observation_reg(1 );
646 -- IO2 <= observation_reg(2 );
645 -- IO2 <= observation_reg(2 );
647 -- IO3 <= observation_reg(3 );
646 -- IO3 <= observation_reg(3 );
648 -- IO4 <= observation_reg(4 );
647 -- IO4 <= observation_reg(4 );
649 -- IO5 <= observation_reg(5 );
648 -- IO5 <= observation_reg(5 );
650 -- IO6 <= observation_reg(6 );
649 -- IO6 <= observation_reg(6 );
651 -- IO7 <= observation_reg(7 );
650 -- IO7 <= observation_reg(7 );
652 IO8 <= observation_reg(8);
651 IO8 <= observation_reg(8);
653 IO9 <= observation_reg(9);
652 IO9 <= observation_reg(9);
654 IO10 <= observation_reg(10);
653 IO10 <= observation_reg(10);
655 IO11 <= observation_reg(11);
654 IO11 <= observation_reg(11);
656 WHEN "001" =>
655 WHEN "001" =>
657 -- --IO0 <= observation_reg(0 + 12);
656 -- --IO0 <= observation_reg(0 + 12);
658 -- IO1 <= observation_reg(1 + 12);
657 -- IO1 <= observation_reg(1 + 12);
659 -- IO2 <= observation_reg(2 + 12);
658 -- IO2 <= observation_reg(2 + 12);
660 -- IO3 <= observation_reg(3 + 12);
659 -- IO3 <= observation_reg(3 + 12);
661 -- IO4 <= observation_reg(4 + 12);
660 -- IO4 <= observation_reg(4 + 12);
662 -- IO5 <= observation_reg(5 + 12);
661 -- IO5 <= observation_reg(5 + 12);
663 -- IO6 <= observation_reg(6 + 12);
662 -- IO6 <= observation_reg(6 + 12);
664 -- IO7 <= observation_reg(7 + 12);
663 -- IO7 <= observation_reg(7 + 12);
665 IO8 <= observation_reg(8 + 12);
664 IO8 <= observation_reg(8 + 12);
666 IO9 <= observation_reg(9 + 12);
665 IO9 <= observation_reg(9 + 12);
667 IO10 <= observation_reg(10 + 12);
666 IO10 <= observation_reg(10 + 12);
668 IO11 <= observation_reg(11 + 12);
667 IO11 <= observation_reg(11 + 12);
669 WHEN "010" =>
668 WHEN "010" =>
670 -- --IO0 <= observation_reg(0 + 12 + 12);
669 -- --IO0 <= observation_reg(0 + 12 + 12);
671 -- IO1 <= observation_reg(1 + 12 + 12);
670 -- IO1 <= observation_reg(1 + 12 + 12);
672 -- IO2 <= observation_reg(2 + 12 + 12);
671 -- IO2 <= observation_reg(2 + 12 + 12);
673 -- IO3 <= observation_reg(3 + 12 + 12);
672 -- IO3 <= observation_reg(3 + 12 + 12);
674 -- IO4 <= observation_reg(4 + 12 + 12);
673 -- IO4 <= observation_reg(4 + 12 + 12);
675 -- IO5 <= observation_reg(5 + 12 + 12);
674 -- IO5 <= observation_reg(5 + 12 + 12);
676 -- IO6 <= observation_reg(6 + 12 + 12);
675 -- IO6 <= observation_reg(6 + 12 + 12);
677 -- IO7 <= observation_reg(7 + 12 + 12);
676 -- IO7 <= observation_reg(7 + 12 + 12);
678 IO8 <= '0';
677 IO8 <= '0';
679 IO9 <= '0';
678 IO9 <= '0';
680 IO10 <= '0';
679 IO10 <= '0';
681 IO11 <= '0';
680 IO11 <= '0';
682 WHEN "000" =>
681 WHEN "000" =>
683 -- --IO0 <= observation_vector_0(0 );
682 -- --IO0 <= observation_vector_0(0 );
684 -- IO1 <= observation_vector_0(1 );
683 -- IO1 <= observation_vector_0(1 );
685 -- IO2 <= observation_vector_0(2 );
684 -- IO2 <= observation_vector_0(2 );
686 -- IO3 <= observation_vector_0(3 );
685 -- IO3 <= observation_vector_0(3 );
687 -- IO4 <= observation_vector_0(4 );
686 -- IO4 <= observation_vector_0(4 );
688 -- IO5 <= observation_vector_0(5 );
687 -- IO5 <= observation_vector_0(5 );
689 -- IO6 <= observation_vector_0(6 );
688 -- IO6 <= observation_vector_0(6 );
690 -- IO7 <= observation_vector_0(7 );
689 -- IO7 <= observation_vector_0(7 );
691 IO8 <= observation_vector_0(8);
690 IO8 <= observation_vector_0(8);
692 IO9 <= observation_vector_0(9);
691 IO9 <= observation_vector_0(9);
693 IO10 <= observation_vector_0(10);
692 IO10 <= observation_vector_0(10);
694 IO11 <= observation_vector_0(11);
693 IO11 <= observation_vector_0(11);
695 WHEN "100" =>
694 WHEN "100" =>
696 -- --IO0 <= observation_vector_1(0 );
695 -- --IO0 <= observation_vector_1(0 );
697 -- IO1 <= observation_vector_1(1 );
696 -- IO1 <= observation_vector_1(1 );
698 -- IO2 <= observation_vector_1(2 );
697 -- IO2 <= observation_vector_1(2 );
699 -- IO3 <= observation_vector_1(3 );
698 -- IO3 <= observation_vector_1(3 );
700 -- IO4 <= observation_vector_1(4 );
699 -- IO4 <= observation_vector_1(4 );
701 -- IO5 <= observation_vector_1(5 );
700 -- IO5 <= observation_vector_1(5 );
702 -- IO6 <= observation_vector_1(6 );
701 -- IO6 <= observation_vector_1(6 );
703 -- IO7 <= observation_vector_1(7 );
702 -- IO7 <= observation_vector_1(7 );
704 IO8 <= observation_vector_1(8);
703 IO8 <= observation_vector_1(8);
705 IO9 <= observation_vector_1(9);
704 IO9 <= observation_vector_1(9);
706 IO10 <= observation_vector_1(10);
705 IO10 <= observation_vector_1(10);
707 IO11 <= observation_vector_1(11);
706 IO11 <= observation_vector_1(11);
708 WHEN OTHERS => NULL;
707 WHEN OTHERS => NULL;
709 END CASE;
708 END CASE;
710
709
711 END IF;
710 END IF;
712 END PROCESS;
711 END PROCESS;
713 -----------------------------------------------------------------------------
712 -----------------------------------------------------------------------------
714 --
713 --
715 -----------------------------------------------------------------------------
714 -----------------------------------------------------------------------------
716 all_apbo_ext : FOR I IN NB_APB_SLAVE-1+5 DOWNTO 5 GENERATE
715 all_apbo_ext : FOR I IN NB_APB_SLAVE-1+5 DOWNTO 5 GENERATE
717 apbo_ext_not_used : IF I /= 5 AND I /= 6 AND I /= 11 AND I /= 15 GENERATE
716 apbo_ext_not_used : IF I /= 5 AND I /= 6 AND I /= 11 AND I /= 15 GENERATE
718 apbo_ext(I) <= apb_none;
717 apbo_ext(I) <= apb_none;
719 END GENERATE apbo_ext_not_used;
718 END GENERATE apbo_ext_not_used;
720 END GENERATE all_apbo_ext;
719 END GENERATE all_apbo_ext;
721
720
722
721
723 all_ahbo_ext : FOR I IN NB_AHB_SLAVE-1+3 DOWNTO 3 GENERATE
722 all_ahbo_ext : FOR I IN NB_AHB_SLAVE-1+3 DOWNTO 3 GENERATE
724 ahbo_s_ext(I) <= ahbs_none;
723 ahbo_s_ext(I) <= ahbs_none;
725 END GENERATE all_ahbo_ext;
724 END GENERATE all_ahbo_ext;
726
725
727 all_ahbo_m_ext : FOR I IN NB_AHB_MASTER-1+1 DOWNTO 1 GENERATE
726 all_ahbo_m_ext : FOR I IN NB_AHB_MASTER-1+1 DOWNTO 1 GENERATE
728 ahbo_m_ext_not_used : IF I /= 1 AND I /= 2 GENERATE
727 ahbo_m_ext_not_used : IF I /= 1 AND I /= 2 GENERATE
729 ahbo_m_ext(I) <= ahbm_none;
728 ahbo_m_ext(I) <= ahbm_none;
730 END GENERATE ahbo_m_ext_not_used;
729 END GENERATE ahbo_m_ext_not_used;
731 END GENERATE all_ahbo_m_ext;
730 END GENERATE all_ahbo_m_ext;
732
731
733 END beh;
732 END beh;
@@ -1,490 +1,565
1 -----------------------------------------------------------------------------
1 -----------------------------------------------------------------------------
2 -- LEON3 Demonstration design
2 -- LEON3 Demonstration design
3 -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research
3 -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ------------------------------------------------------------------------------
18 ------------------------------------------------------------------------------
19
19
20
20
21 LIBRARY ieee;
21 LIBRARY ieee;
22 USE ieee.std_logic_1164.ALL;
22 USE ieee.std_logic_1164.ALL;
23 LIBRARY grlib;
23 LIBRARY grlib;
24 USE grlib.amba.ALL;
24 USE grlib.amba.ALL;
25 USE grlib.stdlib.ALL;
25 USE grlib.stdlib.ALL;
26 LIBRARY techmap;
26 LIBRARY techmap;
27 USE techmap.gencomp.ALL;
27 USE techmap.gencomp.ALL;
28 LIBRARY gaisler;
28 LIBRARY gaisler;
29 USE gaisler.memctrl.ALL;
29 USE gaisler.memctrl.ALL;
30 USE gaisler.leon3.ALL;
30 USE gaisler.leon3.ALL;
31 USE gaisler.uart.ALL;
31 USE gaisler.uart.ALL;
32 USE gaisler.misc.ALL;
32 USE gaisler.misc.ALL;
33 USE gaisler.spacewire.ALL; -- PLE
33 USE gaisler.spacewire.ALL; -- PLE
34 LIBRARY esa;
34 LIBRARY esa;
35 USE esa.memoryctrl.ALL;
35 USE esa.memoryctrl.ALL;
36 LIBRARY lpp;
36 LIBRARY lpp;
37 USE lpp.lpp_memory.ALL;
37 USE lpp.lpp_memory.ALL;
38 USE lpp.lpp_ad_conv.ALL;
38 USE lpp.lpp_ad_conv.ALL;
39 USE lpp.lpp_lfr_pkg.ALL;
39 USE lpp.lpp_lfr_pkg.ALL;
40 USE lpp.iir_filter.ALL;
40 USE lpp.iir_filter.ALL;
41 USE lpp.general_purpose.ALL;
41 USE lpp.general_purpose.ALL;
42 USE lpp.lpp_leon3_soc_pkg.ALL;
42 USE lpp.lpp_leon3_soc_pkg.ALL;
43 LIBRARY iap;
43 LIBRARY iap;
44 USE iap.memctrl.all;
44 USE iap.memctrl.ALL;
45
45
46
46
47 ENTITY leon3_soc IS
47 ENTITY leon3_soc IS
48 GENERIC (
48 GENERIC (
49 fabtech : INTEGER := apa3e;
49 fabtech : INTEGER := apa3e;
50 memtech : INTEGER := apa3e;
50 memtech : INTEGER := apa3e;
51 padtech : INTEGER := inferred;
51 padtech : INTEGER := inferred;
52 clktech : INTEGER := inferred;
52 clktech : INTEGER := inferred;
53 disas : INTEGER := 0; -- Enable disassembly to console
53 disas : INTEGER := 0; -- Enable disassembly to console
54 dbguart : INTEGER := 0; -- Print UART on console
54 dbguart : INTEGER := 0; -- Print UART on console
55 pclow : INTEGER := 2;
55 pclow : INTEGER := 2;
56 --
56 --
57 clk_freq : INTEGER := 25000; --kHz
57 clk_freq : INTEGER := 25000; --kHz
58 --
59 IS_RADHARD : INTEGER := 0;
58 --
60 --
59 NB_CPU : INTEGER := 1;
61 NB_CPU : INTEGER := 1;
60 ENABLE_FPU : INTEGER := 1;
62 ENABLE_FPU : INTEGER := 1;
61 FPU_NETLIST : INTEGER := 1;
63 FPU_NETLIST : INTEGER := 1;
62 ENABLE_DSU : INTEGER := 1;
64 ENABLE_DSU : INTEGER := 1;
63 ENABLE_AHB_UART : INTEGER := 1;
65 ENABLE_AHB_UART : INTEGER := 1;
64 ENABLE_APB_UART : INTEGER := 1;
66 ENABLE_APB_UART : INTEGER := 1;
65 ENABLE_IRQMP : INTEGER := 1;
67 ENABLE_IRQMP : INTEGER := 1;
66 ENABLE_GPT : INTEGER := 1;
68 ENABLE_GPT : INTEGER := 1;
67 --
69 --
68 NB_AHB_MASTER : INTEGER := 1;
70 NB_AHB_MASTER : INTEGER := 1;
69 NB_AHB_SLAVE : INTEGER := 1;
71 NB_AHB_SLAVE : INTEGER := 1;
70 NB_APB_SLAVE : INTEGER := 1;
72 NB_APB_SLAVE : INTEGER := 1;
71 --
73 --
72 ADDRESS_SIZE : INTEGER := 20;
74 ADDRESS_SIZE : INTEGER := 20;
73 USES_IAP_MEMCTRLR : INTEGER := 0
75 USES_IAP_MEMCTRLR : INTEGER := 0
74
76
75 );
77 );
76 PORT (
78 PORT (
77 clk : IN STD_ULOGIC;
79 clk : IN STD_ULOGIC;
78 reset : IN STD_ULOGIC;
80 reset : IN STD_ULOGIC;
79
81
80 errorn : OUT STD_ULOGIC;
82 errorn : OUT STD_ULOGIC;
81
83
82 -- UART AHB ---------------------------------------------------------------
84 -- UART AHB ---------------------------------------------------------------
83 ahbrxd : IN STD_ULOGIC; -- DSU rx data
85 ahbrxd : IN STD_ULOGIC; -- DSU rx data
84 ahbtxd : OUT STD_ULOGIC; -- DSU tx data
86 ahbtxd : OUT STD_ULOGIC; -- DSU tx data
85
87
86 -- UART APB ---------------------------------------------------------------
88 -- UART APB ---------------------------------------------------------------
87 urxd1 : IN STD_ULOGIC; -- UART1 rx data
89 urxd1 : IN STD_ULOGIC; -- UART1 rx data
88 utxd1 : OUT STD_ULOGIC; -- UART1 tx data
90 utxd1 : OUT STD_ULOGIC; -- UART1 tx data
89
91
90 -- RAM --------------------------------------------------------------------
92 -- RAM --------------------------------------------------------------------
91 address : OUT STD_LOGIC_VECTOR(ADDRESS_SIZE-1 DOWNTO 0);
93 address : OUT STD_LOGIC_VECTOR(ADDRESS_SIZE-1 DOWNTO 0);
92 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
94 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
93 nSRAM_BE0 : OUT STD_LOGIC;
95 nSRAM_BE0 : OUT STD_LOGIC;
94 nSRAM_BE1 : OUT STD_LOGIC;
96 nSRAM_BE1 : OUT STD_LOGIC;
95 nSRAM_BE2 : OUT STD_LOGIC;
97 nSRAM_BE2 : OUT STD_LOGIC;
96 nSRAM_BE3 : OUT STD_LOGIC;
98 nSRAM_BE3 : OUT STD_LOGIC;
97 nSRAM_WE : OUT STD_LOGIC;
99 nSRAM_WE : OUT STD_LOGIC;
98 nSRAM_CE : OUT STD_LOGIC_VECTOR(1 downto 0);
100 nSRAM_CE : OUT STD_LOGIC_VECTOR(1 DOWNTO 0);
99 nSRAM_OE : OUT STD_LOGIC;
101 nSRAM_OE : OUT STD_LOGIC;
100 nSRAM_READY : IN STD_LOGIC;
102 nSRAM_READY : IN STD_LOGIC;
101 SRAM_MBE : INOUT STD_LOGIC;
103 SRAM_MBE : INOUT STD_LOGIC;
102 -- APB --------------------------------------------------------------------
104 -- APB --------------------------------------------------------------------
103 apbi_ext : OUT apb_slv_in_type;
105 apbi_ext : OUT apb_slv_in_type;
104 apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
106 apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
105 -- AHB_Slave --------------------------------------------------------------
107 -- AHB_Slave --------------------------------------------------------------
106 ahbi_s_ext : OUT ahb_slv_in_type;
108 ahbi_s_ext : OUT ahb_slv_in_type;
107 ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
109 ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
108 -- AHB_Master -------------------------------------------------------------
110 -- AHB_Master -------------------------------------------------------------
109 ahbi_m_ext : OUT AHB_Mst_In_Type;
111 ahbi_m_ext : OUT AHB_Mst_In_Type;
110 ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU)
112 ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU)
111
113
112 );
114 );
113 END;
115 END;
114
116
115 ARCHITECTURE Behavioral OF leon3_soc IS
117 ARCHITECTURE Behavioral OF leon3_soc IS
116
118
117 -----------------------------------------------------------------------------
119 -----------------------------------------------------------------------------
118 -- CONFIG -------------------------------------------------------------------
120 -- CONFIG -------------------------------------------------------------------
119 -----------------------------------------------------------------------------
121 -----------------------------------------------------------------------------
120
122
121 -- Clock generator
123 -- Clock generator
122 constant CFG_CLKMUL : integer := (1);
124 CONSTANT CFG_CLKMUL : INTEGER := (1);
123 constant CFG_CLKDIV : integer := (1); -- divide 50MHz by 2 to get 25MHz
125 CONSTANT CFG_CLKDIV : INTEGER := (1); -- divide 50MHz by 2 to get 25MHz
124 constant CFG_OCLKDIV : integer := (1);
126 CONSTANT CFG_OCLKDIV : INTEGER := (1);
125 constant CFG_CLK_NOFB : integer := 0;
127 CONSTANT CFG_CLK_NOFB : INTEGER := 0;
126 -- LEON3 processor core
128 -- LEON3 processor core
127 constant CFG_LEON3 : integer := 1;
129 CONSTANT CFG_LEON3 : INTEGER := 1;
128 constant CFG_NCPU : integer := NB_CPU;
130 CONSTANT CFG_NCPU : INTEGER := NB_CPU;
129 constant CFG_NWIN : integer := (8); -- to be compatible with BCC and RCC
131 CONSTANT CFG_NWIN : INTEGER := (8); -- to be compatible with BCC and RCC
130 constant CFG_V8 : integer := 0;
132 CONSTANT CFG_V8 : INTEGER := 0;
131 constant CFG_MAC : integer := 0;
133 CONSTANT CFG_MAC : INTEGER := 0;
132 constant CFG_SVT : integer := 0;
134 CONSTANT CFG_SVT : INTEGER := 0;
133 constant CFG_RSTADDR : integer := 16#00000#;
135 CONSTANT CFG_RSTADDR : INTEGER := 16#00000#;
134 constant CFG_LDDEL : integer := (1);
136 CONSTANT CFG_LDDEL : INTEGER := (1);
135 constant CFG_NWP : integer := (0);
137 CONSTANT CFG_NWP : INTEGER := (0);
136 constant CFG_PWD : integer := 1*2;
138 CONSTANT CFG_PWD : INTEGER := 1*2;
137 constant CFG_FPU : integer := ENABLE_FPU *(8 + 16 * FPU_NETLIST);
139 CONSTANT CFG_FPU : INTEGER := ENABLE_FPU *(8 + 16 * FPU_NETLIST);
138 -- 1*(8 + 16 * 0) => grfpu-light
140 -- 1*(8 + 16 * 0) => grfpu-light
139 -- 1*(8 + 16 * 1) => netlist
141 -- 1*(8 + 16 * 1) => netlist
140 -- 0*(8 + 16 * 0) => No FPU
142 -- 0*(8 + 16 * 0) => No FPU
141 -- 0*(8 + 16 * 1) => No FPU;
143 -- 0*(8 + 16 * 1) => No FPU;
142 constant CFG_ICEN : integer := 1;
144 CONSTANT CFG_ICEN : INTEGER := 1;
143 constant CFG_ISETS : integer := 1;
145 CONSTANT CFG_ISETS : INTEGER := 1;
144 constant CFG_ISETSZ : integer := 4;
146 CONSTANT CFG_ISETSZ : INTEGER := 4;
145 constant CFG_ILINE : integer := 4;
147 CONSTANT CFG_ILINE : INTEGER := 4;
146 constant CFG_IREPL : integer := 0;
148 CONSTANT CFG_IREPL : INTEGER := 0;
147 constant CFG_ILOCK : integer := 0;
149 CONSTANT CFG_ILOCK : INTEGER := 0;
148 constant CFG_ILRAMEN : integer := 0;
150 CONSTANT CFG_ILRAMEN : INTEGER := 0;
149 constant CFG_ILRAMADDR: integer := 16#8E#;
151 CONSTANT CFG_ILRAMADDR : INTEGER := 16#8E#;
150 constant CFG_ILRAMSZ : integer := 1;
152 CONSTANT CFG_ILRAMSZ : INTEGER := 1;
151 constant CFG_DCEN : integer := 1;
153 CONSTANT CFG_DCEN : INTEGER := 1;
152 constant CFG_DSETS : integer := 1;
154 CONSTANT CFG_DSETS : INTEGER := 1;
153 constant CFG_DSETSZ : integer := 4;
155 CONSTANT CFG_DSETSZ : INTEGER := 4;
154 constant CFG_DLINE : integer := 4;
156 CONSTANT CFG_DLINE : INTEGER := 4;
155 constant CFG_DREPL : integer := 0;
157 CONSTANT CFG_DREPL : INTEGER := 0;
156 constant CFG_DLOCK : integer := 0;
158 CONSTANT CFG_DLOCK : INTEGER := 0;
157 constant CFG_DSNOOP : integer := 0 + 0 + 4*0;
159 CONSTANT CFG_DSNOOP : INTEGER := 0 + 0 + 4*0;
158 constant CFG_DLRAMEN : integer := 0;
160 CONSTANT CFG_DLRAMEN : INTEGER := 0;
159 constant CFG_DLRAMADDR: integer := 16#8F#;
161 CONSTANT CFG_DLRAMADDR : INTEGER := 16#8F#;
160 constant CFG_DLRAMSZ : integer := 1;
162 CONSTANT CFG_DLRAMSZ : INTEGER := 1;
161 constant CFG_MMUEN : integer := 0;
163 CONSTANT CFG_MMUEN : INTEGER := 0;
162 constant CFG_ITLBNUM : integer := 2;
164 CONSTANT CFG_ITLBNUM : INTEGER := 2;
163 constant CFG_DTLBNUM : integer := 2;
165 CONSTANT CFG_DTLBNUM : INTEGER := 2;
164 constant CFG_TLB_TYPE : integer := 1 + 0*2;
166 CONSTANT CFG_TLB_TYPE : INTEGER := 1 + 0*2;
165 constant CFG_TLB_REP : integer := 1;
167 CONSTANT CFG_TLB_REP : INTEGER := 1;
166
168
167 constant CFG_DSU : integer := ENABLE_DSU;
169 CONSTANT CFG_DSU : INTEGER := ENABLE_DSU;
168 constant CFG_ITBSZ : integer := 0;
170 CONSTANT CFG_ITBSZ : INTEGER := 0;
169 constant CFG_ATBSZ : integer := 0;
171 CONSTANT CFG_ATBSZ : INTEGER := 0;
170
172
171 -- AMBA settings
173 -- AMBA settings
172 constant CFG_DEFMST : integer := (0);
174 CONSTANT CFG_DEFMST : INTEGER := (0);
173 constant CFG_RROBIN : integer := 1;
175 CONSTANT CFG_RROBIN : INTEGER := 1;
174 constant CFG_SPLIT : integer := 0;
176 CONSTANT CFG_SPLIT : INTEGER := 0;
175 constant CFG_AHBIO : integer := 16#FFF#;
177 CONSTANT CFG_AHBIO : INTEGER := 16#FFF#;
176 constant CFG_APBADDR : integer := 16#800#;
178 CONSTANT CFG_APBADDR : INTEGER := 16#800#;
177
179
178 -- DSU UART
180 -- DSU UART
179 constant CFG_AHB_UART : integer := ENABLE_AHB_UART;
181 CONSTANT CFG_AHB_UART : INTEGER := ENABLE_AHB_UART;
180
182
181 -- LEON2 memory controller
183 -- LEON2 memory controller
182 constant CFG_MCTRL_SDEN : integer := 0;
184 CONSTANT CFG_MCTRL_SDEN : INTEGER := 0;
183
185
184 -- UART 1
186 -- UART 1
185 constant CFG_UART1_ENABLE : integer := ENABLE_APB_UART;
187 CONSTANT CFG_UART1_ENABLE : INTEGER := ENABLE_APB_UART;
186 constant CFG_UART1_FIFO : integer := 1;
188 CONSTANT CFG_UART1_FIFO : INTEGER := 1;
187
189
188 -- LEON3 interrupt controller
190 -- LEON3 interrupt controller
189 constant CFG_IRQ3_ENABLE : integer := ENABLE_IRQMP;
191 CONSTANT CFG_IRQ3_ENABLE : INTEGER := ENABLE_IRQMP;
190
192
191 -- Modular timer
193 -- Modular timer
192 constant CFG_GPT_ENABLE : integer := ENABLE_GPT;
194 CONSTANT CFG_GPT_ENABLE : INTEGER := ENABLE_GPT;
193 constant CFG_GPT_NTIM : integer := (2);
195 CONSTANT CFG_GPT_NTIM : INTEGER := (2);
194 constant CFG_GPT_SW : integer := (8);
196 CONSTANT CFG_GPT_SW : INTEGER := (8);
195 constant CFG_GPT_TW : integer := (32);
197 CONSTANT CFG_GPT_TW : INTEGER := (32);
196 constant CFG_GPT_IRQ : integer := (8);
198 CONSTANT CFG_GPT_IRQ : INTEGER := (8);
197 constant CFG_GPT_SEPIRQ : integer := 1;
199 CONSTANT CFG_GPT_SEPIRQ : INTEGER := 1;
198 constant CFG_GPT_WDOGEN : integer := 0;
200 CONSTANT CFG_GPT_WDOGEN : INTEGER := 0;
199 constant CFG_GPT_WDOG : integer := 16#0#;
201 CONSTANT CFG_GPT_WDOG : INTEGER := 16#0#;
200 -----------------------------------------------------------------------------
202 -----------------------------------------------------------------------------
201
203
202 -----------------------------------------------------------------------------
204 -----------------------------------------------------------------------------
203 -- SIGNALs
205 -- SIGNALs
204 -----------------------------------------------------------------------------
206 -----------------------------------------------------------------------------
205 CONSTANT maxahbmsp : INTEGER := CFG_NCPU + CFG_AHB_UART + NB_AHB_MASTER;
207 CONSTANT maxahbmsp : INTEGER := CFG_NCPU + CFG_AHB_UART + NB_AHB_MASTER;
206 -- CLK & RST --
208 -- CLK & RST --
207 SIGNAL clk2x : STD_ULOGIC;
209 SIGNAL clk2x : STD_ULOGIC;
208 SIGNAL clkmn : STD_ULOGIC;
210 SIGNAL clkmn : STD_ULOGIC;
209 SIGNAL clkm : STD_ULOGIC;
211 SIGNAL clkm : STD_ULOGIC;
210 SIGNAL rstn : STD_ULOGIC;
212 SIGNAL rstn : STD_ULOGIC;
211 SIGNAL rstraw : STD_ULOGIC;
213 SIGNAL rstraw : STD_ULOGIC;
212 SIGNAL pciclk : STD_ULOGIC;
214 SIGNAL pciclk : STD_ULOGIC;
213 SIGNAL sdclkl : STD_ULOGIC;
215 SIGNAL sdclkl : STD_ULOGIC;
214 SIGNAL cgi : clkgen_in_type;
216 SIGNAL cgi : clkgen_in_type;
215 SIGNAL cgo : clkgen_out_type;
217 SIGNAL cgo : clkgen_out_type;
216 --- AHB / APB
218 --- AHB / APB
217 SIGNAL apbi : apb_slv_in_type;
219 SIGNAL apbi : apb_slv_in_type;
218 SIGNAL apbo : apb_slv_out_vector := (OTHERS => apb_none);
220 SIGNAL apbo : apb_slv_out_vector := (OTHERS => apb_none);
219 SIGNAL ahbsi : ahb_slv_in_type;
221 SIGNAL ahbsi : ahb_slv_in_type;
220 SIGNAL ahbso : ahb_slv_out_vector := (OTHERS => ahbs_none);
222 SIGNAL ahbso : ahb_slv_out_vector := (OTHERS => ahbs_none);
221 SIGNAL ahbmi : ahb_mst_in_type;
223 SIGNAL ahbmi : ahb_mst_in_type;
222 SIGNAL ahbmo : ahb_mst_out_vector := (OTHERS => ahbm_none);
224 SIGNAL ahbmo : ahb_mst_out_vector := (OTHERS => ahbm_none);
223 --UART
225 --UART
224 SIGNAL ahbuarti : uart_in_type;
226 SIGNAL ahbuarti : uart_in_type;
225 SIGNAL ahbuarto : uart_out_type;
227 SIGNAL ahbuarto : uart_out_type;
226 SIGNAL apbuarti : uart_in_type;
228 SIGNAL apbuarti : uart_in_type;
227 SIGNAL apbuarto : uart_out_type;
229 SIGNAL apbuarto : uart_out_type;
228 --MEM CTRLR
230 --MEM CTRLR
229 SIGNAL memi : memory_in_type;
231 SIGNAL memi : memory_in_type;
230 SIGNAL memo : memory_out_type;
232 SIGNAL memo : memory_out_type;
231 SIGNAL wpo : wprot_out_type;
233 SIGNAL wpo : wprot_out_type;
232 SIGNAL sdo : sdram_out_type;
234 SIGNAL sdo : sdram_out_type;
233 SIGNAl mbe : std_logic; -- enable memory programming
235 SIGNAL mbe : STD_LOGIC; -- enable memory programming
234 SIGNAL mbe_drive : std_logic; -- drive the MBE memory signal
236 SIGNAL mbe_drive : STD_LOGIC; -- drive the MBE memory signal
235 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 downto 0);
237 SIGNAL nSRAM_CE_s : STD_LOGIC_VECTOR(1 DOWNTO 0);
236 SIGNAL nSRAM_OE_s : STD_LOGIC;
238 SIGNAL nSRAM_OE_s : STD_LOGIC;
237 --IRQ
239 --IRQ
238 SIGNAL irqi : irq_in_vector(0 TO CFG_NCPU-1);
240 SIGNAL irqi : irq_in_vector(0 TO CFG_NCPU-1);
239 SIGNAL irqo : irq_out_vector(0 TO CFG_NCPU-1);
241 SIGNAL irqo : irq_out_vector(0 TO CFG_NCPU-1);
240 --Timer
242 --Timer
241 SIGNAL gpti : gptimer_in_type;
243 SIGNAL gpti : gptimer_in_type;
242 SIGNAL gpto : gptimer_out_type;
244 SIGNAL gpto : gptimer_out_type;
243 --DSU
245 --DSU
244 SIGNAL dbgi : l3_debug_in_vector(0 TO CFG_NCPU-1);
246 SIGNAL dbgi : l3_debug_in_vector(0 TO CFG_NCPU-1);
245 SIGNAL dbgo : l3_debug_out_vector(0 TO CFG_NCPU-1);
247 SIGNAL dbgo : l3_debug_out_vector(0 TO CFG_NCPU-1);
246 SIGNAL dsui : dsu_in_type;
248 SIGNAL dsui : dsu_in_type;
247 SIGNAL dsuo : dsu_out_type;
249 SIGNAL dsuo : dsu_out_type;
248 -----------------------------------------------------------------------------
250 -----------------------------------------------------------------------------
249
251
250
252
251 BEGIN
253 BEGIN
252
254
253
255
254 ----------------------------------------------------------------------
256 ----------------------------------------------------------------------
255 --- Reset and Clock generation -------------------------------------
257 --- Reset and Clock generation -------------------------------------
256 ----------------------------------------------------------------------
258 ----------------------------------------------------------------------
257
259
258 cgi.pllctrl <= "00";
260 cgi.pllctrl <= "00";
259 cgi.pllrst <= rstraw;
261 cgi.pllrst <= rstraw;
260
262
261 rst0 : rstgen PORT MAP (reset, clkm, cgo.clklock, rstn, rstraw);
263 rst0 : rstgen PORT MAP (reset, clkm, cgo.clklock, rstn, rstraw);
262
264
263 clkgen0 : clkgen -- clock generator
265 clkgen0 : clkgen -- clock generator
264 GENERIC MAP (clktech, CFG_CLKMUL, CFG_CLKDIV, CFG_MCTRL_SDEN,
266 GENERIC MAP (clktech, CFG_CLKMUL, CFG_CLKDIV, CFG_MCTRL_SDEN,
265 CFG_CLK_NOFB, 0, 0, 0, clk_freq, 0, 0, CFG_OCLKDIV)
267 CFG_CLK_NOFB, 0, 0, 0, clk_freq, 0, 0, CFG_OCLKDIV)
266 PORT MAP (clk, clk, clkm, clkmn, clk2x, sdclkl, pciclk, cgi, cgo);
268 PORT MAP (clk, clk, clkm, clkmn, clk2x, sdclkl, pciclk, cgi, cgo);
267
269
268 ----------------------------------------------------------------------
270 ----------------------------------------------------------------------
269 --- LEON3 processor / DSU / IRQ ------------------------------------
271 --- LEON3 processor / DSU / IRQ ------------------------------------
270 ----------------------------------------------------------------------
272 ----------------------------------------------------------------------
271
273
272 l3 : IF CFG_LEON3 = 1 GENERATE
274 l3 : IF CFG_LEON3 = 1 GENERATE
273 cpu : FOR i IN 0 TO CFG_NCPU-1 GENERATE
275 cpu : FOR i IN 0 TO CFG_NCPU-1 GENERATE
274 u0 : leon3s -- LEON3 processor
276 leon3_non_radhard : IF IS_RADHARD = 0 GENERATE
275 GENERIC MAP (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8,
277 u0 : leon3s -- LEON3 processor
276 0, CFG_MAC, pclow, 0, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE,
278 GENERIC MAP (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8,
277 CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ,
279 0, CFG_MAC, pclow, 0, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE,
278 CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN,
280 CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ,
279 CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP,
281 CFG_DLOCK, CFG_DSNOOP, CFG_ILRAMEN, CFG_ILRAMSZ, CFG_ILRAMADDR, CFG_DLRAMEN,
280 CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1)
282 CFG_DLRAMSZ, CFG_DLRAMADDR, CFG_MMUEN, CFG_ITLBNUM, CFG_DTLBNUM, CFG_TLB_TYPE, CFG_TLB_REP,
281 PORT MAP (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso,
283 CFG_LDDEL, disas, CFG_ITBSZ, CFG_PWD, CFG_SVT, CFG_RSTADDR, CFG_NCPU-1)
282 irqi(i), irqo(i), dbgi(i), dbgo(i));
284 PORT MAP (clkm, rstn, ahbmi, ahbmo(i), ahbsi, ahbso,
285 irqi(i), irqo(i), dbgi(i), dbgo(i));
286 END GENERATE leon3_non_radhard;
287 leon3_radhard_i : IF IS_RADHARD = 1 GENERATE
288 cpu : ENTITY gaisler.leon3ft
289 GENERIC MAP (
290 HINDEX => i, --: integer; --CPU_HINDEX,
291 FABTECH => fabtech, --CFG_TECH,
292 MEMTECH => memtech, --CFG_TECH,
293 NWINDOWS => CFG_NWIN, --CFG_NWIN,
294 DSU => CFG_DSU, --condSel (HAS_DEBUG, 1, 0),
295 FPU => CFG_FPU, --CFG_FPU,
296 V8 => CFG_V8, --CFG_V8,
297 CP => 0, --CFG_CP,
298 MAC => CFG_MAC, --CFG_MAC,
299 PCLOW => pclow, --CFG_PCLOW,
300 NOTAG => 0, --CFG_NOTAG,
301 NWP => CFG_NWP, --CFG_NWP,
302 ICEN => CFG_ICEN, --CFG_ICEN,
303 IREPL => CFG_IREPL, --CFG_IREPL,
304 ISETS => CFG_ISETS, --CFG_ISETS,
305 ILINESIZE => CFG_ILINE, --CFG_ILINE,
306 ISETSIZE => CFG_ISETSZ, --CFG_ISETSZ,
307 ISETLOCK => CFG_ILOCK, --CFG_ILOCK,
308 DCEN => CFG_DCEN, --CFG_DCEN,
309 DREPL => CFG_DREPL, --CFG_DREPL,
310 DSETS => CFG_DSETS, --CFG_DSETS,
311 DLINESIZE => CFG_DLINE, --CFG_DLINE,
312 DSETSIZE => CFG_DSETSZ, --CFG_DSETSZ,
313 DSETLOCK => CFG_DLOCK, --CFG_DLOCK,
314 DSNOOP => CFG_DSNOOP, --CFG_DSNOOP,
315 ILRAM => CFG_ILRAMEN, --CFG_ILRAMEN,
316 ILRAMSIZE => CFG_ILRAMSZ, --CFG_ILRAMSZ,
317 ILRAMSTART => CFG_ILRAMADDR, --CFG_ILRAMADDR,
318 DLRAM => CFG_DLRAMEN, --CFG_DLRAMEN,
319 DLRAMSIZE => CFG_DLRAMSZ, --CFG_DLRAMSZ,
320 DLRAMSTART => CFG_DLRAMADDR, --CFG_DLRAMADDR,
321 MMUEN => CFG_MMUEN, --CFG_MMUEN,
322 ITLBNUM => CFG_ITLBNUM, --CFG_ITLBNUM,
323 DTLBNUM => CFG_DTLBNUM, --CFG_DTLBNUM,
324 TLB_TYPE => CFG_TLB_TYPE, --CFG_TLB_TYPE,
325 TLB_REP => CFG_TLB_REP, --CFG_TLB_REP,
326 LDDEL => CFG_LDDEL, --CFG_LDDEL,
327 DISAS => disas, --condSel (SIM_ENABLED, 1, 0),
328 TBUF => CFG_ITBSZ, --CFG_ITBSZ,
329 PWD => CFG_PWD, --CFG_PWD,
330 SVT => CFG_SVT, --CFG_SVT,
331 RSTADDR => CFG_RSTADDR, --CFG_RSTADDR,
332 SMP => CFG_NCPU-1, --CFG_NCPU-1,
333 IUFT => 2, --: integer range 0 to 4;--CFG_IUFT_EN,
334 FPFT => 1, --: integer range 0 to 4;--CFG_FPUFT_EN,
335 CMFT => 1, --: integer range 0 to 1;--CFG_CACHE_FT_EN,
336 IUINJ => 0, --: integer; --CFG_RF_ERRINJ,
337 CEINJ => 0, --: integer range 0 to 3;--CFG_CACHE_ERRINJ,
338 CACHED => 0, --: integer; --CFG_DFIXED,
339 NETLIST => 0, --: integer; --CFG_LEON3_NETLIST,
340 SCANTEST => 0, --: integer; --CFG_SCANTEST,
341 MMUPGSZ => 0, --: integer range 0 to 5;--CFG_MMU_PAGE,
342 BP => 1) --CFG_BP
343 PORT MAP ( --
344 rstn => rstn, --rst_n,
345 clk => clkm, --clk,
346 ahbi => ahbmi, --ahbmi,
347 ahbo => ahbmo(i), --ahbmo(CPU_HINDEX),
348 ahbsi => ahbsi, --ahbsi,
349 ahbso => ahbso, --ahbso,
350 irqi => irqi(i), --irqi(CPU_HINDEX),
351 irqo => irqo(i), --irqo(CPU_HINDEX),
352 dbgi => dbgi(i), --dbgi(CPU_HINDEX),
353 dbgo => dbgo(i), --dbgo(CPU_HINDEX),
354 gclk => clkm --clk
355 );
356 END GENERATE leon3_radhard_i;
357
283 END GENERATE;
358 END GENERATE;
284 errorn_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (errorn, dbgo(0).error);
359 errorn_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (errorn, dbgo(0).error);
285
360
286 dsugen : IF CFG_DSU = 1 GENERATE
361 dsugen : IF CFG_DSU = 1 GENERATE
287 dsu0 : dsu3 -- LEON3 Debug Support Unit
362 dsu0 : dsu3 -- LEON3 Debug Support Unit
288 GENERIC MAP (hindex => 2, haddr => 16#900#, hmask => 16#F00#,
363 GENERIC MAP (hindex => 2, haddr => 16#900#, hmask => 16#F00#,
289 ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ)
364 ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ)
290 PORT MAP (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo);
365 PORT MAP (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo);
291 dsui.enable <= '1';
366 dsui.enable <= '1';
292 dsui.break <= '0';
367 dsui.break <= '0';
293 END GENERATE;
368 END GENERATE;
294 END GENERATE;
369 END GENERATE;
295
370
296 nodsu : IF CFG_DSU = 0 GENERATE
371 nodsu : IF CFG_DSU = 0 GENERATE
297 ahbso(2) <= ahbs_none;
372 ahbso(2) <= ahbs_none;
298 dsuo.tstop <= '0';
373 dsuo.tstop <= '0';
299 dsuo.active <= '0';
374 dsuo.active <= '0';
300 END GENERATE;
375 END GENERATE;
301
376
302 irqctrl : IF CFG_IRQ3_ENABLE /= 0 GENERATE
377 irqctrl : IF CFG_IRQ3_ENABLE /= 0 GENERATE
303 irqctrl0 : irqmp -- interrupt controller
378 irqctrl0 : irqmp -- interrupt controller
304 GENERIC MAP (pindex => 2, paddr => 2, ncpu => CFG_NCPU)
379 GENERIC MAP (pindex => 2, paddr => 2, ncpu => CFG_NCPU)
305 PORT MAP (rstn, clkm, apbi, apbo(2), irqo, irqi);
380 PORT MAP (rstn, clkm, apbi, apbo(2), irqo, irqi);
306 END GENERATE;
381 END GENERATE;
307 irq3 : IF CFG_IRQ3_ENABLE = 0 GENERATE
382 irq3 : IF CFG_IRQ3_ENABLE = 0 GENERATE
308 x : FOR i IN 0 TO CFG_NCPU-1 GENERATE
383 x : FOR i IN 0 TO CFG_NCPU-1 GENERATE
309 irqi(i).irl <= "0000";
384 irqi(i).irl <= "0000";
310 END GENERATE;
385 END GENERATE;
311 apbo(2) <= apb_none;
386 apbo(2) <= apb_none;
312 END GENERATE;
387 END GENERATE;
313
388
314 ----------------------------------------------------------------------
389 ----------------------------------------------------------------------
315 --- Memory controllers ---------------------------------------------
390 --- Memory controllers ---------------------------------------------
316 ----------------------------------------------------------------------
391 ----------------------------------------------------------------------
317 ESAMEMCT: IF USES_IAP_MEMCTRLR =0 GENERATE
392 ESAMEMCT : IF USES_IAP_MEMCTRLR = 0 GENERATE
318 memctrlr : mctrl GENERIC MAP (
393 memctrlr : mctrl GENERIC MAP (
319 hindex => 0,
394 hindex => 0,
320 pindex => 0,
395 pindex => 0,
321 paddr => 0,
396 paddr => 0,
322 srbanks => 1
397 srbanks => 1
323 )
398 )
324 PORT MAP (rstn, clkm, memi, memo, ahbsi, ahbso(0), apbi, apbo(0), wpo, sdo);
399 PORT MAP (rstn, clkm, memi, memo, ahbsi, ahbso(0), apbi, apbo(0), wpo, sdo);
325 memi.bexcn <= '1';
400 memi.bexcn <= '1';
326 memi.brdyn <= '1';
401 memi.brdyn <= '1';
327
402
328 nSRAM_CE_s <= NOT (memo.ramsn(1 downto 0));
403 nSRAM_CE_s <= NOT (memo.ramsn(1 DOWNTO 0));
329 nSRAM_OE_s <= memo.ramoen(0);
404 nSRAM_OE_s <= memo.ramoen(0);
330 END GENERATE;
405 END GENERATE;
331
406
332 IAPMEMCT: IF USES_IAP_MEMCTRLR =1 GENERATE
407 IAPMEMCT : IF USES_IAP_MEMCTRLR = 1 GENERATE
333 memctrlr : srctrle_0ws
408 memctrlr : srctrle_0ws
334 GENERIC MAP(
409 GENERIC MAP(
335 hindex => 0,
410 hindex => 0,
336 pindex => 0,
411 pindex => 0,
337 paddr => 0,
412 paddr => 0,
338 srbanks => 2,
413 srbanks => 2,
339 banksz => 8, --512k * 32
414 banksz => 8, --512k * 32
340 rmw => 1,
415 rmw => 1,
341 --Aeroflex memory generics:
416 --Aeroflex memory generics:
342 mprog => 1, -- program memory by default values after reset
417 mprog => 1, -- program memory by default values after reset
343 mpsrate => 12, -- default scrub rate period
418 mpsrate => 12, -- default scrub rate period
344 mpb2s => 4, -- default busy to scrub delay
419 mpb2s => 4, -- default busy to scrub delay
345 mpapb => 1, -- instantiate apb register
420 mpapb => 1, -- instantiate apb register
346 mchipcnt => 2,
421 mchipcnt => 2,
347 mpenall => 1 -- when 0 program only E1 chip, else program all dies
422 mpenall => 1 -- when 0 program only E1 chip, else program all dies
348 )
423 )
349 PORT MAP (
424 PORT MAP (
350 rst => rstn,
425 rst => rstn,
351 clk => clkm,
426 clk => clkm,
352 ahbsi => ahbsi,
427 ahbsi => ahbsi,
353 ahbso => ahbso(0),
428 ahbso => ahbso(0),
354 apbi => apbi,
429 apbi => apbi,
355 apbo => apbo(0),
430 apbo => apbo(0),
356 sri => memi,
431 sri => memi,
357 sro => memo,
432 sro => memo,
358 --Aeroflex memory signals:
433 --Aeroflex memory signals:
359 ucerr => open, -- uncorrectable error signal
434 ucerr => OPEN, -- uncorrectable error signal
360 mbe => mbe, -- enable memory programming
435 mbe => mbe, -- enable memory programming
361 mbe_drive => mbe_drive -- drive the MBE memory signal
436 mbe_drive => mbe_drive -- drive the MBE memory signal
362 );
437 );
363
438
364 memi.brdyn <= nSRAM_READY;
439 memi.brdyn <= nSRAM_READY;
365
440
366 mbe_pad : iopad
441 mbe_pad : iopad
367 GENERIC MAP(tech => padtech)
442 GENERIC MAP(tech => padtech)
368 PORT MAP(pad => SRAM_MBE,
443 PORT MAP(pad => SRAM_MBE,
369 i => mbe,
444 i => mbe,
370 en => mbe_drive,
445 en => mbe_drive,
371 o => memi.bexcn );
446 o => memi.bexcn);
372
447
373 nSRAM_CE_s <= (memo.ramsn(1 downto 0));
448 nSRAM_CE_s <= (memo.ramsn(1 DOWNTO 0));
374 nSRAM_OE_s <= memo.oen;
449 nSRAM_OE_s <= memo.oen;
375
450
376 END GENERATE;
451 END GENERATE;
377
452
378
453
379 memi.writen <= '1';
454 memi.writen <= '1';
380 memi.wrn <= "1111";
455 memi.wrn <= "1111";
381 memi.bwidth <= "10";
456 memi.bwidth <= "10";
382
457
383 bdr : FOR i IN 0 TO 3 GENERATE
458 bdr : FOR i IN 0 TO 3 GENERATE
384 data_pad : iopadv GENERIC MAP (tech => padtech, width => 8,oepol=> USES_IAP_MEMCTRLR)
459 data_pad : iopadv GENERIC MAP (tech => padtech, width => 8, oepol => USES_IAP_MEMCTRLR)
385 PORT MAP (
460 PORT MAP (
386 data(31-i*8 DOWNTO 24-i*8),
461 data(31-i*8 DOWNTO 24-i*8),
387 memo.data(31-i*8 DOWNTO 24-i*8),
462 memo.data(31-i*8 DOWNTO 24-i*8),
388 memo.bdrive(i),
463 memo.bdrive(i),
389 memi.data(31-i*8 DOWNTO 24-i*8));
464 memi.data(31-i*8 DOWNTO 24-i*8));
390 END GENERATE;
465 END GENERATE;
391
466
392 addr_pad : outpadv GENERIC MAP (width => ADDRESS_SIZE, tech => padtech)
467 addr_pad : outpadv GENERIC MAP (width => ADDRESS_SIZE, tech => padtech)
393 PORT MAP (address, memo.address(ADDRESS_SIZE+1 DOWNTO 2));
468 PORT MAP (address, memo.address(ADDRESS_SIZE+1 DOWNTO 2));
394 rams_pad : outpadv GENERIC MAP (tech => padtech,width => 2) PORT MAP (nSRAM_CE, nSRAM_CE_s);
469 rams_pad : outpadv GENERIC MAP (tech => padtech, width => 2) PORT MAP (nSRAM_CE, nSRAM_CE_s);
395 oen_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_OE, nSRAM_OE_s);
470 oen_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_OE, nSRAM_OE_s);
396 nBWE_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_WE, memo.writen);
471 nBWE_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_WE, memo.writen);
397 nBWa_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE0, memo.mben(3));
472 nBWa_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE0, memo.mben(3));
398 nBWb_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE1, memo.mben(2));
473 nBWb_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE1, memo.mben(2));
399 nBWc_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE2, memo.mben(1));
474 nBWc_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE2, memo.mben(1));
400 nBWd_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE3, memo.mben(0));
475 nBWd_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE3, memo.mben(0));
401
476
402
477
403
478
404 ----------------------------------------------------------------------
479 ----------------------------------------------------------------------
405 --- AHB CONTROLLER -------------------------------------------------
480 --- AHB CONTROLLER -------------------------------------------------
406 ----------------------------------------------------------------------
481 ----------------------------------------------------------------------
407 ahb0 : ahbctrl -- AHB arbiter/multiplexer
482 ahb0 : ahbctrl -- AHB arbiter/multiplexer
408 GENERIC MAP (defmast => CFG_DEFMST, split => CFG_SPLIT,
483 GENERIC MAP (defmast => CFG_DEFMST, split => CFG_SPLIT,
409 rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO,
484 rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO,
410 ioen => 0, nahbm => maxahbmsp, nahbs => 8)
485 ioen => 0, nahbm => maxahbmsp, nahbs => 8)
411 PORT MAP (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso);
486 PORT MAP (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso);
412
487
413 ----------------------------------------------------------------------
488 ----------------------------------------------------------------------
414 --- AHB UART -------------------------------------------------------
489 --- AHB UART -------------------------------------------------------
415 ----------------------------------------------------------------------
490 ----------------------------------------------------------------------
416 dcomgen : IF CFG_AHB_UART = 1 GENERATE
491 dcomgen : IF CFG_AHB_UART = 1 GENERATE
417 dcom0 : ahbuart
492 dcom0 : ahbuart
418 GENERIC MAP (hindex => maxahbmsp-1, pindex => 4, paddr => 4)
493 GENERIC MAP (hindex => maxahbmsp-1, pindex => 4, paddr => 4)
419 PORT MAP (rstn, clkm, ahbuarti, ahbuarto, apbi, apbo(4), ahbmi, ahbmo(maxahbmsp-1));
494 PORT MAP (rstn, clkm, ahbuarti, ahbuarto, apbi, apbo(4), ahbmi, ahbmo(maxahbmsp-1));
420 dsurx_pad : inpad GENERIC MAP (tech => padtech) PORT MAP (ahbrxd, ahbuarti.rxd);
495 dsurx_pad : inpad GENERIC MAP (tech => padtech) PORT MAP (ahbrxd, ahbuarti.rxd);
421 dsutx_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (ahbtxd, ahbuarto.txd);
496 dsutx_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (ahbtxd, ahbuarto.txd);
422 END GENERATE;
497 END GENERATE;
423 nouah : IF CFG_AHB_UART = 0 GENERATE apbo(4) <= apb_none; END GENERATE;
498 nouah : IF CFG_AHB_UART = 0 GENERATE apbo(4) <= apb_none; END GENERATE;
424
499
425 ----------------------------------------------------------------------
500 ----------------------------------------------------------------------
426 --- APB Bridge -----------------------------------------------------
501 --- APB Bridge -----------------------------------------------------
427 ----------------------------------------------------------------------
502 ----------------------------------------------------------------------
428 apb0 : apbctrl -- AHB/APB bridge
503 apb0 : apbctrl -- AHB/APB bridge
429 GENERIC MAP (hindex => 1, haddr => CFG_APBADDR)
504 GENERIC MAP (hindex => 1, haddr => CFG_APBADDR)
430 PORT MAP (rstn, clkm, ahbsi, ahbso(1), apbi, apbo);
505 PORT MAP (rstn, clkm, ahbsi, ahbso(1), apbi, apbo);
431
506
432 ----------------------------------------------------------------------
507 ----------------------------------------------------------------------
433 --- GPT Timer ------------------------------------------------------
508 --- GPT Timer ------------------------------------------------------
434 ----------------------------------------------------------------------
509 ----------------------------------------------------------------------
435 gpt : IF CFG_GPT_ENABLE /= 0 GENERATE
510 gpt : IF CFG_GPT_ENABLE /= 0 GENERATE
436 timer0 : gptimer -- timer unit
511 timer0 : gptimer -- timer unit
437 GENERIC MAP (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ,
512 GENERIC MAP (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ,
438 sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM,
513 sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM,
439 nbits => CFG_GPT_TW)
514 nbits => CFG_GPT_TW)
440 PORT MAP (rstn, clkm, apbi, apbo(3), gpti, gpto);
515 PORT MAP (rstn, clkm, apbi, apbo(3), gpti, gpto);
441 gpti.dhalt <= dsuo.tstop;
516 gpti.dhalt <= dsuo.tstop;
442 gpti.extclk <= '0';
517 gpti.extclk <= '0';
443 END GENERATE;
518 END GENERATE;
444 notim : IF CFG_GPT_ENABLE = 0 GENERATE apbo(3) <= apb_none; END GENERATE;
519 notim : IF CFG_GPT_ENABLE = 0 GENERATE apbo(3) <= apb_none; END GENERATE;
445
520
446
521
447 ----------------------------------------------------------------------
522 ----------------------------------------------------------------------
448 --- APB UART -------------------------------------------------------
523 --- APB UART -------------------------------------------------------
449 ----------------------------------------------------------------------
524 ----------------------------------------------------------------------
450 ua1 : IF CFG_UART1_ENABLE /= 0 GENERATE
525 ua1 : IF CFG_UART1_ENABLE /= 0 GENERATE
451 uart1 : apbuart -- UART 1
526 uart1 : apbuart -- UART 1
452 GENERIC MAP (pindex => 1, paddr => 1, pirq => 2, console => dbguart,
527 GENERIC MAP (pindex => 1, paddr => 1, pirq => 2, console => dbguart,
453 fifosize => CFG_UART1_FIFO)
528 fifosize => CFG_UART1_FIFO)
454 PORT MAP (rstn, clkm, apbi, apbo(1), apbuarti, apbuarto);
529 PORT MAP (rstn, clkm, apbi, apbo(1), apbuarti, apbuarto);
455 apbuarti.rxd <= urxd1;
530 apbuarti.rxd <= urxd1;
456 apbuarti.extclk <= '0';
531 apbuarti.extclk <= '0';
457 utxd1 <= apbuarto.txd;
532 utxd1 <= apbuarto.txd;
458 apbuarti.ctsn <= '0';
533 apbuarti.ctsn <= '0';
459 END GENERATE;
534 END GENERATE;
460 noua0 : IF CFG_UART1_ENABLE = 0 GENERATE apbo(1) <= apb_none; END GENERATE;
535 noua0 : IF CFG_UART1_ENABLE = 0 GENERATE apbo(1) <= apb_none; END GENERATE;
461
536
462 -------------------------------------------------------------------------------
537 -------------------------------------------------------------------------------
463 -- AMBA BUS -------------------------------------------------------------------
538 -- AMBA BUS -------------------------------------------------------------------
464 -------------------------------------------------------------------------------
539 -------------------------------------------------------------------------------
465
540
466 -- APB --------------------------------------------------------------------
541 -- APB --------------------------------------------------------------------
467 apbi_ext <= apbi;
542 apbi_ext <= apbi;
468 all_apb: FOR I IN 0 TO NB_APB_SLAVE-1 GENERATE
543 all_apb : FOR I IN 0 TO NB_APB_SLAVE-1 GENERATE
469 max_16_apb: IF I + 5 < 16 GENERATE
544 max_16_apb : IF I + 5 < 16 GENERATE
470 apbo(I+5)<= apbo_ext(I+5);
545 apbo(I+5) <= apbo_ext(I+5);
471 END GENERATE max_16_apb;
546 END GENERATE max_16_apb;
472 END GENERATE all_apb;
547 END GENERATE all_apb;
473 -- AHB_Slave --------------------------------------------------------------
548 -- AHB_Slave --------------------------------------------------------------
474 ahbi_s_ext <= ahbsi;
549 ahbi_s_ext <= ahbsi;
475 all_ahbs: FOR I IN 0 TO NB_AHB_SLAVE-1 GENERATE
550 all_ahbs : FOR I IN 0 TO NB_AHB_SLAVE-1 GENERATE
476 max_16_ahbs: IF I + 3 < 16 GENERATE
551 max_16_ahbs : IF I + 3 < 16 GENERATE
477 ahbso(I+3) <= ahbo_s_ext(I+3);
552 ahbso(I+3) <= ahbo_s_ext(I+3);
478 END GENERATE max_16_ahbs;
553 END GENERATE max_16_ahbs;
479 END GENERATE all_ahbs;
554 END GENERATE all_ahbs;
480 -- AHB_Master -------------------------------------------------------------
555 -- AHB_Master -------------------------------------------------------------
481 ahbi_m_ext <= ahbmi;
556 ahbi_m_ext <= ahbmi;
482 all_ahbm: FOR I IN 0 TO NB_AHB_MASTER-1 GENERATE
557 all_ahbm : FOR I IN 0 TO NB_AHB_MASTER-1 GENERATE
483 max_16_ahbm: IF I + CFG_NCPU + CFG_AHB_UART < 16 GENERATE
558 max_16_ahbm : IF I + CFG_NCPU + CFG_AHB_UART < 16 GENERATE
484 ahbmo(I + CFG_NCPU) <= ahbo_m_ext(I+CFG_NCPU);
559 ahbmo(I + CFG_NCPU) <= ahbo_m_ext(I+CFG_NCPU);
485 END GENERATE max_16_ahbm;
560 END GENERATE max_16_ahbm;
486 END GENERATE all_ahbm;
561 END GENERATE all_ahbm;
487
562
488
563
489
564
490 END Behavioral; No newline at end of file
565 END Behavioral;
@@ -1,487 +1,556
1 -----------------------------------------------------------------------------
1 -----------------------------------------------------------------------------
2 -- LEON3 Demonstration design
2 -- LEON3 Demonstration design
3 -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research
3 -- Copyright (C) 2004 Jiri Gaisler, Gaisler Research
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 2 of the License, or
7 -- the Free Software Foundation; either version 2 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 ------------------------------------------------------------------------------
18 ------------------------------------------------------------------------------
19
19
20
20
21 LIBRARY ieee;
21 LIBRARY ieee;
22 USE ieee.std_logic_1164.ALL;
22 USE ieee.std_logic_1164.ALL;
23 LIBRARY grlib;
23 LIBRARY grlib;
24 USE grlib.amba.ALL;
24 USE grlib.amba.ALL;
25 USE grlib.stdlib.ALL;
25 USE grlib.stdlib.ALL;
26 LIBRARY techmap;
26 LIBRARY techmap;
27 USE techmap.gencomp.ALL;
27 USE techmap.gencomp.ALL;
28 LIBRARY gaisler;
28 LIBRARY gaisler;
29 USE gaisler.memctrl.ALL;
29 USE gaisler.memctrl.ALL;
30 USE gaisler.leon3.ALL;
30 USE gaisler.leon3.ALL;
31 USE gaisler.uart.ALL;
31 USE gaisler.uart.ALL;
32 USE gaisler.misc.ALL;
32 USE gaisler.misc.ALL;
33 USE gaisler.spacewire.ALL; -- PLE
33 USE gaisler.spacewire.ALL; -- PLE
34 LIBRARY esa;
34 LIBRARY esa;
35 USE esa.memoryctrl.ALL;
35 USE esa.memoryctrl.ALL;
36 LIBRARY lpp;
36 LIBRARY lpp;
37 USE lpp.lpp_memory.ALL;
37 USE lpp.lpp_memory.ALL;
38 USE lpp.lpp_ad_conv.ALL;
38 USE lpp.lpp_ad_conv.ALL;
39 USE lpp.lpp_lfr_pkg.ALL;
39 USE lpp.lpp_lfr_pkg.ALL;
40 USE lpp.iir_filter.ALL;
40 USE lpp.iir_filter.ALL;
41 USE lpp.general_purpose.ALL;
41 USE lpp.general_purpose.ALL;
42 USE lpp.lpp_leon3_soc_pkg.ALL;
42 USE lpp.lpp_leon3_soc_pkg.ALL;
43
43
44 ENTITY leon3ft_soc IS
44 ENTITY leon3ft_soc IS
45 GENERIC (
45 GENERIC (
46 fabtech : INTEGER := apa3e;
46 fabtech : INTEGER := apa3e;
47 memtech : INTEGER := apa3e;
47 memtech : INTEGER := apa3e;
48 padtech : INTEGER := inferred;
48 padtech : INTEGER := inferred;
49 clktech : INTEGER := inferred;
49 clktech : INTEGER := inferred;
50 disas : INTEGER := 0; -- Enable disassembly to console
50 disas : INTEGER := 0; -- Enable disassembly to console
51 dbguart : INTEGER := 0; -- Print UART on console
51 dbguart : INTEGER := 0; -- Print UART on console
52 pclow : INTEGER := 2;
52 pclow : INTEGER := 2;
53 --
53 --
54 clk_freq : INTEGER := 25000; --kHz
54 clk_freq : INTEGER := 25000; --kHz
55 --
55 --
56 NB_CPU : INTEGER := 1;
56 NB_CPU : INTEGER := 1;
57 ENABLE_FPU : INTEGER := 1;
57 ENABLE_FPU : INTEGER := 1;
58 FPU_NETLIST : INTEGER := 1;
58 FPU_NETLIST : INTEGER := 1;
59 ENABLE_DSU : INTEGER := 1;
59 ENABLE_DSU : INTEGER := 1;
60 ENABLE_AHB_UART : INTEGER := 1;
60 ENABLE_AHB_UART : INTEGER := 1;
61 ENABLE_APB_UART : INTEGER := 1;
61 ENABLE_APB_UART : INTEGER := 1;
62 ENABLE_IRQMP : INTEGER := 1;
62 ENABLE_IRQMP : INTEGER := 1;
63 ENABLE_GPT : INTEGER := 1;
63 ENABLE_GPT : INTEGER := 1;
64 --
64 --
65 NB_AHB_MASTER : INTEGER := 11;
65 NB_AHB_MASTER : INTEGER := 11;
66 NB_AHB_SLAVE : INTEGER := 1;
66 NB_AHB_SLAVE : INTEGER := 1;
67 NB_APB_SLAVE : INTEGER := 2
67 NB_APB_SLAVE : INTEGER := 2
68 );
68 );
69 PORT (
69 PORT (
70 clk : IN STD_ULOGIC;
70 clk : IN STD_ULOGIC;
71 reset : IN STD_ULOGIC;
71 reset : IN STD_ULOGIC;
72
72
73 errorn : OUT STD_ULOGIC;
73 errorn : OUT STD_ULOGIC;
74
74
75 -- UART AHB ---------------------------------------------------------------
75 -- UART AHB ---------------------------------------------------------------
76 ahbrxd : IN STD_ULOGIC; -- DSU rx data
76 ahbrxd : IN STD_ULOGIC; -- DSU rx data
77 ahbtxd : OUT STD_ULOGIC; -- DSU tx data
77 ahbtxd : OUT STD_ULOGIC; -- DSU tx data
78
78
79 -- UART APB ---------------------------------------------------------------
79 -- UART APB ---------------------------------------------------------------
80 urxd1 : IN STD_ULOGIC; -- UART1 rx data
80 urxd1 : IN STD_ULOGIC; -- UART1 rx data
81 utxd1 : OUT STD_ULOGIC; -- UART1 tx data
81 utxd1 : OUT STD_ULOGIC; -- UART1 tx data
82
82
83 -- RAM --------------------------------------------------------------------
83 -- RAM --------------------------------------------------------------------
84 address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
84 address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
85 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
85 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
86 nSRAM_BE0 : OUT STD_LOGIC;
86 nSRAM_BE0 : OUT STD_LOGIC;
87 nSRAM_BE1 : OUT STD_LOGIC;
87 nSRAM_BE1 : OUT STD_LOGIC;
88 nSRAM_BE2 : OUT STD_LOGIC;
88 nSRAM_BE2 : OUT STD_LOGIC;
89 nSRAM_BE3 : OUT STD_LOGIC;
89 nSRAM_BE3 : OUT STD_LOGIC;
90 nSRAM_WE : OUT STD_LOGIC;
90 nSRAM_WE : OUT STD_LOGIC;
91 nSRAM_CE : OUT STD_LOGIC;
91 nSRAM_CE : OUT STD_LOGIC;
92 nSRAM_OE : OUT STD_LOGIC;
92 nSRAM_OE : OUT STD_LOGIC;
93
93
94 -- APB --------------------------------------------------------------------
94 -- APB --------------------------------------------------------------------
95 apbi_ext : OUT apb_slv_in_type;
95 apbi_ext : OUT apb_slv_in_type;
96 apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
96 apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
97 -- AHB_Slave --------------------------------------------------------------
97 -- AHB_Slave --------------------------------------------------------------
98 ahbi_s_ext : OUT ahb_slv_in_type;
98 ahbi_s_ext : OUT ahb_slv_in_type;
99 ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
99 ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
100 -- AHB_Master -------------------------------------------------------------
100 -- AHB_Master -------------------------------------------------------------
101 ahbi_m_ext : OUT AHB_Mst_In_Type;
101 ahbi_m_ext : OUT AHB_Mst_In_Type;
102 ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU)
102 ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU)
103
103
104 );
104 );
105 END;
105 END;
106
106
107 ARCHITECTURE Behavioral OF leon3ft_soc IS
107 ARCHITECTURE Behavioral OF leon3ft_soc IS
108
108
109 -----------------------------------------------------------------------------
109 -----------------------------------------------------------------------------
110 -- CONFIG -------------------------------------------------------------------
110 -- CONFIG -------------------------------------------------------------------
111 -----------------------------------------------------------------------------
111 -----------------------------------------------------------------------------
112
112
113 -- Clock generator
113 -- Clock generator
114 CONSTANT CFG_CLKMUL : INTEGER := (1);
114 CONSTANT CFG_CLKMUL : INTEGER := (1);
115 CONSTANT CFG_CLKDIV : INTEGER := (1); -- divide 50MHz by 2 to get 25MHz
115 CONSTANT CFG_CLKDIV : INTEGER := (1); -- divide 50MHz by 2 to get 25MHz
116 CONSTANT CFG_OCLKDIV : INTEGER := (1);
116 CONSTANT CFG_OCLKDIV : INTEGER := (1);
117 CONSTANT CFG_CLK_NOFB : INTEGER := 0;
117 CONSTANT CFG_CLK_NOFB : INTEGER := 0;
118 -- LEON3 processor core
118 -- LEON3 processor core
119 CONSTANT CFG_LEON3 : INTEGER := 1;
119 CONSTANT CFG_LEON3 : INTEGER := 1;
120 CONSTANT CFG_NCPU : INTEGER := NB_CPU;
120 CONSTANT CFG_NCPU : INTEGER := NB_CPU;
121 CONSTANT CFG_NWIN : INTEGER := (8); -- to be compatible with BCC and RCC
121 CONSTANT CFG_NWIN : INTEGER := (8); -- to be compatible with BCC and RCC
122 CONSTANT CFG_V8 : INTEGER := 0;
122 CONSTANT CFG_V8 : INTEGER := 0;
123 CONSTANT CFG_MAC : INTEGER := 0;
123 CONSTANT CFG_MAC : INTEGER := 0;
124 CONSTANT CFG_SVT : INTEGER := 0;
124 CONSTANT CFG_SVT : INTEGER := 0;
125 CONSTANT CFG_RSTADDR : INTEGER := 16#00000#;
125 CONSTANT CFG_RSTADDR : INTEGER := 16#00000#;
126 CONSTANT CFG_LDDEL : INTEGER := (1);
126 CONSTANT CFG_LDDEL : INTEGER := (1);
127 CONSTANT CFG_NWP : INTEGER := (0);
127 CONSTANT CFG_NWP : INTEGER := (0);
128 CONSTANT CFG_PWD : INTEGER := 1*2;
128 CONSTANT CFG_PWD : INTEGER := 1*2;
129 CONSTANT CFG_FPU : INTEGER := ENABLE_FPU *(8 + 16 * FPU_NETLIST);
129 CONSTANT CFG_FPU : INTEGER := ENABLE_FPU *(8 + 16 * FPU_NETLIST);
130 -- 1*(8 + 16 * 0) => grfpu-light
130 -- 1*(8 + 16 * 0) => grfpu-light
131 -- 1*(8 + 16 * 1) => netlist
131 -- 1*(8 + 16 * 1) => netlist
132 -- 0*(8 + 16 * 0) => No FPU
132 -- 0*(8 + 16 * 0) => No FPU
133 -- 0*(8 + 16 * 1) => No FPU;
133 -- 0*(8 + 16 * 1) => No FPU;
134 CONSTANT CFG_ICEN : INTEGER := 1;
134 CONSTANT CFG_ICEN : INTEGER := 1;
135 CONSTANT CFG_ISETS : INTEGER := 1;
135 CONSTANT CFG_ISETS : INTEGER := 1;
136 CONSTANT CFG_ISETSZ : INTEGER := 4;
136 CONSTANT CFG_ISETSZ : INTEGER := 4;
137 CONSTANT CFG_ILINE : INTEGER := 4;
137 CONSTANT CFG_ILINE : INTEGER := 4;
138 CONSTANT CFG_IREPL : INTEGER := 0;
138 CONSTANT CFG_IREPL : INTEGER := 0;
139 CONSTANT CFG_ILOCK : INTEGER := 0;
139 CONSTANT CFG_ILOCK : INTEGER := 0;
140 CONSTANT CFG_ILRAMEN : INTEGER := 0;
140 CONSTANT CFG_ILRAMEN : INTEGER := 0;
141 CONSTANT CFG_ILRAMADDR : INTEGER := 16#8E#;
141 CONSTANT CFG_ILRAMADDR : INTEGER := 16#8E#;
142 CONSTANT CFG_ILRAMSZ : INTEGER := 1;
142 CONSTANT CFG_ILRAMSZ : INTEGER := 1;
143 CONSTANT CFG_DCEN : INTEGER := 1;
143 CONSTANT CFG_DCEN : INTEGER := 1;
144 CONSTANT CFG_DSETS : INTEGER := 1;
144 CONSTANT CFG_DSETS : INTEGER := 1;
145 CONSTANT CFG_DSETSZ : INTEGER := 4;
145 CONSTANT CFG_DSETSZ : INTEGER := 4;
146 CONSTANT CFG_DLINE : INTEGER := 4;
146 CONSTANT CFG_DLINE : INTEGER := 4;
147 CONSTANT CFG_DREPL : INTEGER := 0;
147 CONSTANT CFG_DREPL : INTEGER := 0;
148 CONSTANT CFG_DLOCK : INTEGER := 0;
148 CONSTANT CFG_DLOCK : INTEGER := 0;
149 CONSTANT CFG_DSNOOP : INTEGER := 0 + 0 + 4*0;
149 CONSTANT CFG_DSNOOP : INTEGER := 0 + 0 + 4*0;
150 CONSTANT CFG_DLRAMEN : INTEGER := 0;
150 CONSTANT CFG_DLRAMEN : INTEGER := 0;
151 CONSTANT CFG_DLRAMADDR : INTEGER := 16#8F#;
151 CONSTANT CFG_DLRAMADDR : INTEGER := 16#8F#;
152 CONSTANT CFG_DLRAMSZ : INTEGER := 1;
152 CONSTANT CFG_DLRAMSZ : INTEGER := 1;
153 CONSTANT CFG_MMUEN : INTEGER := 0;
153 CONSTANT CFG_MMUEN : INTEGER := 0;
154 CONSTANT CFG_ITLBNUM : INTEGER := 2;
154 CONSTANT CFG_ITLBNUM : INTEGER := 2;
155 CONSTANT CFG_DTLBNUM : INTEGER := 2;
155 CONSTANT CFG_DTLBNUM : INTEGER := 2;
156 CONSTANT CFG_TLB_TYPE : INTEGER := 1 + 0*2;
156 CONSTANT CFG_TLB_TYPE : INTEGER := 1 + 0*2;
157 CONSTANT CFG_TLB_REP : INTEGER := 1;
157 CONSTANT CFG_TLB_REP : INTEGER := 1;
158
158
159 CONSTANT CFG_DSU : INTEGER := ENABLE_DSU;
159 CONSTANT CFG_DSU : INTEGER := ENABLE_DSU;
160 CONSTANT CFG_ITBSZ : INTEGER := 0;
160 CONSTANT CFG_ITBSZ : INTEGER := 0;
161 CONSTANT CFG_ATBSZ : INTEGER := 0;
161 CONSTANT CFG_ATBSZ : INTEGER := 0;
162
162
163 -- AMBA settings
163 -- AMBA settings
164 CONSTANT CFG_DEFMST : INTEGER := (0);
164 CONSTANT CFG_DEFMST : INTEGER := (0);
165 CONSTANT CFG_RROBIN : INTEGER := 1;
165 CONSTANT CFG_RROBIN : INTEGER := 1;
166 CONSTANT CFG_SPLIT : INTEGER := 0;
166 CONSTANT CFG_SPLIT : INTEGER := 0;
167 CONSTANT CFG_AHBIO : INTEGER := 16#FFF#;
167 CONSTANT CFG_AHBIO : INTEGER := 16#FFF#;
168 CONSTANT CFG_APBADDR : INTEGER := 16#800#;
168 CONSTANT CFG_APBADDR : INTEGER := 16#800#;
169
169
170 -- DSU UART
170 -- DSU UART
171 CONSTANT CFG_AHB_UART : INTEGER := ENABLE_AHB_UART;
171 CONSTANT CFG_AHB_UART : INTEGER := ENABLE_AHB_UART;
172
172
173 -- LEON2 memory controller
173 -- LEON2 memory controller
174 CONSTANT CFG_MCTRL_SDEN : INTEGER := 0;
174 CONSTANT CFG_MCTRL_SDEN : INTEGER := 0;
175
175
176 -- UART 1
176 -- UART 1
177 CONSTANT CFG_UART1_ENABLE : INTEGER := ENABLE_APB_UART;
177 CONSTANT CFG_UART1_ENABLE : INTEGER := ENABLE_APB_UART;
178 CONSTANT CFG_UART1_FIFO : INTEGER := 1;
178 CONSTANT CFG_UART1_FIFO : INTEGER := 1;
179
179
180 -- LEON3 interrupt controller
180 -- LEON3 interrupt controller
181 CONSTANT CFG_IRQ3_ENABLE : INTEGER := ENABLE_IRQMP;
181 CONSTANT CFG_IRQ3_ENABLE : INTEGER := ENABLE_IRQMP;
182
182
183 -- Modular timer
183 -- Modular timer
184 CONSTANT CFG_GPT_ENABLE : INTEGER := ENABLE_GPT;
184 CONSTANT CFG_GPT_ENABLE : INTEGER := ENABLE_GPT;
185 CONSTANT CFG_GPT_NTIM : INTEGER := (2);
185 CONSTANT CFG_GPT_NTIM : INTEGER := (2);
186 CONSTANT CFG_GPT_SW : INTEGER := (8);
186 CONSTANT CFG_GPT_SW : INTEGER := (8);
187 CONSTANT CFG_GPT_TW : INTEGER := (32);
187 CONSTANT CFG_GPT_TW : INTEGER := (32);
188 CONSTANT CFG_GPT_IRQ : INTEGER := (8);
188 CONSTANT CFG_GPT_IRQ : INTEGER := (8);
189 CONSTANT CFG_GPT_SEPIRQ : INTEGER := 1;
189 CONSTANT CFG_GPT_SEPIRQ : INTEGER := 1;
190 CONSTANT CFG_GPT_WDOGEN : INTEGER := 0;
190 CONSTANT CFG_GPT_WDOGEN : INTEGER := 0;
191 CONSTANT CFG_GPT_WDOG : INTEGER := 16#0#;
191 CONSTANT CFG_GPT_WDOG : INTEGER := 16#0#;
192 -----------------------------------------------------------------------------
192 -----------------------------------------------------------------------------
193
193
194 -----------------------------------------------------------------------------
194 -----------------------------------------------------------------------------
195 -- SIGNALs
195 -- SIGNALs
196 -----------------------------------------------------------------------------
196 -----------------------------------------------------------------------------
197 CONSTANT maxahbmsp : INTEGER := CFG_NCPU + CFG_AHB_UART + NB_AHB_MASTER;
197 CONSTANT maxahbmsp : INTEGER := CFG_NCPU + CFG_AHB_UART + NB_AHB_MASTER;
198 -- CLK & RST --
198 -- CLK & RST --
199 SIGNAL clk2x : STD_ULOGIC;
199 SIGNAL clk2x : STD_ULOGIC;
200 SIGNAL clkmn : STD_ULOGIC;
200 SIGNAL clkmn : STD_ULOGIC;
201 SIGNAL clkm : STD_ULOGIC;
201 SIGNAL clkm : STD_ULOGIC;
202 SIGNAL rstn : STD_ULOGIC;
202 SIGNAL rstn : STD_ULOGIC;
203 SIGNAL rstraw : STD_ULOGIC;
203 SIGNAL rstraw : STD_ULOGIC;
204 SIGNAL pciclk : STD_ULOGIC;
204 SIGNAL pciclk : STD_ULOGIC;
205 SIGNAL sdclkl : STD_ULOGIC;
205 SIGNAL sdclkl : STD_ULOGIC;
206 SIGNAL cgi : clkgen_in_type;
206 SIGNAL cgi : clkgen_in_type;
207 SIGNAL cgo : clkgen_out_type;
207 SIGNAL cgo : clkgen_out_type;
208 --- AHB / APB
208 --- AHB / APB
209 SIGNAL apbi : apb_slv_in_type;
209 SIGNAL apbi : apb_slv_in_type;
210 SIGNAL apbo : apb_slv_out_vector := (OTHERS => apb_none);
210 SIGNAL apbo : apb_slv_out_vector := (OTHERS => apb_none);
211 SIGNAL ahbsi : ahb_slv_in_type;
211 SIGNAL ahbsi : ahb_slv_in_type;
212 SIGNAL ahbso : ahb_slv_out_vector := (OTHERS => ahbs_none);
212 SIGNAL ahbso : ahb_slv_out_vector := (OTHERS => ahbs_none);
213 SIGNAL ahbmi : ahb_mst_in_type;
213 SIGNAL ahbmi : ahb_mst_in_type;
214 SIGNAL ahbmo : ahb_mst_out_vector := (OTHERS => ahbm_none);
214 SIGNAL ahbmo : ahb_mst_out_vector := (OTHERS => ahbm_none);
215 --UART
215 --UART
216 SIGNAL ahbuarti : uart_in_type;
216 SIGNAL ahbuarti : uart_in_type;
217 SIGNAL ahbuarto : uart_out_type;
217 SIGNAL ahbuarto : uart_out_type;
218 SIGNAL apbuarti : uart_in_type;
218 SIGNAL apbuarti : uart_in_type;
219 SIGNAL apbuarto : uart_out_type;
219 SIGNAL apbuarto : uart_out_type;
220 --MEM CTRLR
220 --MEM CTRLR
221 SIGNAL memi : memory_in_type;
221 SIGNAL memi : memory_in_type;
222 SIGNAL memo : memory_out_type;
222 SIGNAL memo : memory_out_type;
223 SIGNAL wpo : wprot_out_type;
223 SIGNAL wpo : wprot_out_type;
224 SIGNAL sdo : sdram_out_type;
224 SIGNAL sdo : sdram_out_type;
225 --IRQ
225 --IRQ
226 SIGNAL irqi : irq_in_vector(0 TO CFG_NCPU-1);
226 SIGNAL irqi : irq_in_vector(0 TO CFG_NCPU-1);
227 SIGNAL irqo : irq_out_vector(0 TO CFG_NCPU-1);
227 SIGNAL irqo : irq_out_vector(0 TO CFG_NCPU-1);
228 --Timer
228 --Timer
229 SIGNAL gpti : gptimer_in_type;
229 SIGNAL gpti : gptimer_in_type;
230 SIGNAL gpto : gptimer_out_type;
230 SIGNAL gpto : gptimer_out_type;
231 --DSU
231 --DSU
232 SIGNAL dbgi : l3_debug_in_vector(0 TO CFG_NCPU-1);
232 SIGNAL dbgi : l3_debug_in_vector(0 TO CFG_NCPU-1);
233 SIGNAL dbgo : l3_debug_out_vector(0 TO CFG_NCPU-1);
233 SIGNAL dbgo : l3_debug_out_vector(0 TO CFG_NCPU-1);
234 SIGNAL dsui : dsu_in_type;
234 SIGNAL dsui : dsu_in_type;
235 SIGNAL dsuo : dsu_out_type;
235 SIGNAL dsuo : dsu_out_type;
236 -----------------------------------------------------------------------------
236 -----------------------------------------------------------------------------
237
237
238 SIGNAL nSRAM_CE_s : STD_LOGIC;
238 SIGNAL nSRAM_CE_s : STD_LOGIC;
239 BEGIN
239 BEGIN
240
240
241
241
242 ----------------------------------------------------------------------
242 ----------------------------------------------------------------------
243 --- Reset and Clock generation -------------------------------------
243 --- Reset and Clock generation -------------------------------------
244 ----------------------------------------------------------------------
244 ----------------------------------------------------------------------
245
245
246 cgi.pllctrl <= "00";
246 cgi.pllctrl <= "00";
247 cgi.pllrst <= rstraw;
247 cgi.pllrst <= rstraw;
248
248
249 rst0 : rstgen PORT MAP (reset, clkm, cgo.clklock, rstn, rstraw);
249 rst0 : rstgen PORT MAP (reset, clkm, cgo.clklock, rstn, rstraw);
250
250
251 clkgen0 : clkgen -- clock generator
251 clkgen0 : clkgen -- clock generator
252 GENERIC MAP (clktech, CFG_CLKMUL, CFG_CLKDIV, CFG_MCTRL_SDEN,
252 GENERIC MAP (clktech, CFG_CLKMUL, CFG_CLKDIV, CFG_MCTRL_SDEN,
253 CFG_CLK_NOFB, 0, 0, 0, clk_freq, 0, 0, CFG_OCLKDIV)
253 CFG_CLK_NOFB, 0, 0, 0, clk_freq, 0, 0, CFG_OCLKDIV)
254 PORT MAP (clk, clk, clkm, clkmn, clk2x, sdclkl, pciclk, cgi, cgo);
254 PORT MAP (clk, clk, clkm, clkmn, clk2x, sdclkl, pciclk, cgi, cgo);
255
255
256 ----------------------------------------------------------------------
256 ----------------------------------------------------------------------
257 --- LEON3 processor / DSU / IRQ ------------------------------------
257 --- LEON3 processor / DSU / IRQ ------------------------------------
258 ----------------------------------------------------------------------
258 ----------------------------------------------------------------------
259
259
260 l3 : IF CFG_LEON3 = 1 GENERATE
260 l3 : IF CFG_LEON3 = 1 GENERATE
261 cpu : FOR i IN 0 TO CFG_NCPU-1 GENERATE
261 cpu: entity gaisler.leon3ft
262 u0 : leon3ft
262 generic map (
263 GENERIC MAP (
263 HINDEX => i, --: integer; --CPU_HINDEX,
264 hindex => i, --: integer;
264 FABTECH => fabtech, --CFG_TECH,
265 fabtech => fabtech,
265 MEMTECH => memtech, --CFG_TECH,
266 memtech => memtech,
266 NWINDOWS => CFG_NWIN, --CFG_NWIN,
267 nwindows => CFG_NWIN,
267 DSU => CFG_DSU, --condSel (HAS_DEBUG, 1, 0),
268 dsu => CFG_DSU,
268 FPU => CFG_FPU, --CFG_FPU,
269 fpu => CFG_FPU,
269 V8 => CFG_V8, --CFG_V8,
270 v8 => CFG_V8,
270 CP => 0, --CFG_CP,
271 cp => 0,
271 MAC => CFG_MAC, --CFG_MAC,
272 mac => CFG_MAC,
272 PCLOW => pclow, --CFG_PCLOW,
273 pclow => pclow,
273 NOTAG => 0, --CFG_NOTAG,
274 notag => 0,
274 NWP => CFG_NWP, --CFG_NWP,
275 nwp => CFG_NWP,
275 ICEN => CFG_ICEN, --CFG_ICEN,
276 icen => CFG_ICEN,
276 IREPL => CFG_IREPL, --CFG_IREPL,
277 irepl => CFG_IREPL,
277 ISETS => CFG_ISETS, --CFG_ISETS,
278 isets => CFG_ISETS,
278 ILINESIZE => CFG_ILINE, --CFG_ILINE,
279 ilinesize => CFG_ILINE,
279 ISETSIZE => CFG_ISETSZ, --CFG_ISETSZ,
280 isetsize => CFG_ISETSZ,
280 ISETLOCK => CFG_ILOCK, --CFG_ILOCK,
281 isetlock => CFG_ILOCK,
281 DCEN => CFG_DCEN, --CFG_DCEN,
282 dcen => CFG_DCEN,
282 DREPL => CFG_DREPL, --CFG_DREPL,
283 drepl => CFG_DREPL,
283 DSETS => CFG_DSETS, --CFG_DSETS,
284 dsets => CFG_DSETS,
284 DLINESIZE => CFG_DLINE, --CFG_DLINE,
285 dlinesize => CFG_DLINE,
285 DSETSIZE => CFG_DSETSZ, --CFG_DSETSZ,
286 dsetsize => CFG_DSETSZ,
286 DSETLOCK => CFG_DLOCK, --CFG_DLOCK,
287 dsetlock => CFG_DLOCK,
287 DSNOOP => CFG_DSNOOP, --CFG_DSNOOP,
288 dsnoop => CFG_DSNOOP,
288 ILRAM => CFG_ILRAMEN, --CFG_ILRAMEN,
289 ilram => CFG_ILRAMEN,
289 ILRAMSIZE => CFG_ILRAMSZ, --CFG_ILRAMSZ,
290 ilramsize => CFG_ILRAMSZ,
290 ILRAMSTART => CFG_ILRAMADDR, --CFG_ILRAMADDR,
291 ilramstart => CFG_ILRAMADDR,
291 DLRAM => CFG_DLRAMEN, --CFG_DLRAMEN,
292 dlram => CFG_DLRAMEN,
292 DLRAMSIZE => CFG_DLRAMSZ, --CFG_DLRAMSZ,
293 dlramsize => CFG_DLRAMSZ,
293 DLRAMSTART => CFG_DLRAMADDR, --CFG_DLRAMADDR,
294 dlramstart => CFG_DLRAMADDR,
294 MMUEN => CFG_MMUEN, --CFG_MMUEN,
295 mmuen => CFG_MMUEN,
295 ITLBNUM => CFG_ITLBNUM, --CFG_ITLBNUM,
296 itlbnum => CFG_ITLBNUM,
296 DTLBNUM => CFG_DTLBNUM, --CFG_DTLBNUM,
297 dtlbnum => CFG_DTLBNUM,
297 TLB_TYPE => CFG_TLB_TYPE, --CFG_TLB_TYPE,
298 tlb_type => CFG_TLB_TYPE,
298 TLB_REP => CFG_TLB_REP, --CFG_TLB_REP,
299 tlb_rep => CFG_TLB_REP,
299 LDDEL => CFG_LDDEL, --CFG_LDDEL,
300 lddel => CFG_LDDEL,
300 DISAS => disas, --condSel (SIM_ENABLED, 1, 0),
301 disas => disas,
301 TBUF => CFG_ITBSZ, --CFG_ITBSZ,
302 tbuf => CFG_ITBSZ,
302 PWD => CFG_PWD, --CFG_PWD,
303 pwd => CFG_PWD,
303 SVT => CFG_SVT, --CFG_SVT,
304 svt => CFG_SVT,
304 RSTADDR => CFG_RSTADDR, --CFG_RSTADDR,
305 rstaddr => CFG_RSTADDR,
305 SMP => CFG_NCPU-1, --CFG_NCPU-1,
306 smp => CFG_NCPU-1,
306 IUFT => 2, --: integer range 0 to 4;--CFG_IUFT_EN,
307 iuft => 2, --: integer range 0 to 4;
307 FPFT => 1, --: integer range 0 to 4;--CFG_FPUFT_EN,
308 fpft => 1, --: integer range 0 to 4;
308 CMFT => 1, --: integer range 0 to 1;--CFG_CACHE_FT_EN,
309 cmft => 1, --: integer range 0 to 1;
309 IUINJ => 0, --: integer; --CFG_RF_ERRINJ,
310 iuinj => 0, --: integer;
310 CEINJ => 0, --: integer range 0 to 3;--CFG_CACHE_ERRINJ,
311 ceinj => 0, --: integer range 0 to 3;
311 CACHED => 0, --: integer; --CFG_DFIXED,
312 cached => 0, --: integer;
312 NETLIST => 0, --: integer; --CFG_LEON3_NETLIST,
313 netlist => 0, --: integer;
313 SCANTEST => 0, --: integer; --CFG_SCANTEST,
314 scantest => 0, --: integer;
314 MMUPGSZ => 0, --: integer range 0 to 5;--CFG_MMU_PAGE,
315 mmupgsz => 0, --: integer range 0 to 5;
315 BP => 1)--CFG_BP
316 bp => 1) --: integer);
316 ) --
317 PORT MAP (
317 port map ( --
318 clk => clkm,
318 rstn => clkm, --rst_n,
319 rstn => rstn,
319 clk => rstn, --clk,
320 ahbi => ahbmi,
320 ahbi => ahbmi, --ahbmi,
321 ahbo => ahbmo(i),
321 ahbo => ahbmo(i)--ahbmo(CPU_HINDEX),
322 ahbsi => ahbsi,
322 ahbsi => ahbsi, --ahbsi,
323 ahbso => ahbso,
323 ahbso => ahbso, --ahbso,
324 irqi => irqi(i),
324 irqi => irqi(i),--irqi(CPU_HINDEX),
325 irqo => irqo(i),
325 irqo => irqo(i),--irqo(CPU_HINDEX),
326 dbgi => dbgi(i),
326 dbgi => dbgi(i),--dbgi(CPU_HINDEX),
327 dbgo => dbgo(i),
327 dbgo => dbgo(i),--dbgo(CPU_HINDEX),
328 gclk => clkm
328 gclk => clkm--clk
329 );
329 );
330 --cpu : FOR i IN 0 TO CFG_NCPU-1 GENERATE
331 -- u0 : leon3ft
332 -- GENERIC MAP (
333 -- hindex => i, --: integer;
334 -- fabtech => fabtech,
335 -- memtech => memtech,
336 -- nwindows => CFG_NWIN,
337 -- dsu => CFG_DSU,
338 -- fpu => CFG_FPU,
339 -- v8 => CFG_V8,
340 -- cp => 0,
341 -- mac => CFG_MAC,
342 -- pclow => pclow,
343 -- notag => 0,
344 -- nwp => CFG_NWP,
345 -- icen => CFG_ICEN,
346 -- irepl => CFG_IREPL,
347 -- isets => CFG_ISETS,
348 -- ilinesize => CFG_ILINE,
349 -- isetsize => CFG_ISETSZ,
350 -- isetlock => CFG_ILOCK,
351 -- dcen => CFG_DCEN,
352 -- drepl => CFG_DREPL,
353 -- dsets => CFG_DSETS,
354 -- dlinesize => CFG_DLINE,
355 -- dsetsize => CFG_DSETSZ,
356 -- dsetlock => CFG_DLOCK,
357 -- dsnoop => CFG_DSNOOP,
358 -- ilram => CFG_ILRAMEN,
359 -- ilramsize => CFG_ILRAMSZ,
360 -- ilramstart => CFG_ILRAMADDR,
361 -- dlram => CFG_DLRAMEN,
362 -- dlramsize => CFG_DLRAMSZ,
363 -- dlramstart => CFG_DLRAMADDR,
364 -- mmuen => CFG_MMUEN,
365 -- itlbnum => CFG_ITLBNUM,
366 -- dtlbnum => CFG_DTLBNUM,
367 -- tlb_type => CFG_TLB_TYPE,
368 -- tlb_rep => CFG_TLB_REP,
369 -- lddel => CFG_LDDEL,
370 -- disas => disas,
371 -- tbuf => CFG_ITBSZ,
372 -- pwd => CFG_PWD,
373 -- svt => CFG_SVT,
374 -- rstaddr => CFG_RSTADDR,
375 -- smp => CFG_NCPU-1,
376 -- iuft => 2, --: integer range 0 to 4;
377 -- fpft => 1, --: integer range 0 to 4;
378 -- cmft => 1, --: integer range 0 to 1;
379 -- iuinj => 0, --: integer;
380 -- ceinj => 0, --: integer range 0 to 3;
381 -- cached => 0, --: integer;
382 -- netlist => 0, --: integer;
383 -- scantest => 0, --: integer;
384 -- mmupgsz => 0, --: integer range 0 to 5;
385 -- bp => 1) --: integer);
386 -- PORT MAP (
387 -- clk => clkm,
388 -- rstn => rstn,
389 -- ahbi => ahbmi,
390 -- ahbo => ahbmo(i),
391 -- ahbsi => ahbsi,
392 -- ahbso => ahbso,
393 -- irqi => irqi(i),
394 -- irqo => irqo(i),
395 -- dbgi => dbgi(i),
396 -- dbgo => dbgo(i),
397 -- gclk => clkm
398 -- );
330
399
331 END GENERATE;
400 END GENERATE;
332
401
333
402
334 errorn_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (errorn, dbgo(0).error);
403 errorn_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (errorn, dbgo(0).error);
335
404
336 dsugen : IF CFG_DSU = 1 GENERATE
405 dsugen : IF CFG_DSU = 1 GENERATE
337 dsu0 : dsu3 -- LEON3 Debug Support Unit
406 dsu0 : dsu3 -- LEON3 Debug Support Unit
338 GENERIC MAP (hindex => 2, haddr => 16#900#, hmask => 16#F00#,
407 GENERIC MAP (hindex => 2, haddr => 16#900#, hmask => 16#F00#,
339 ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ)
408 ncpu => CFG_NCPU, tbits => 30, tech => memtech, irq => 0, kbytes => CFG_ATBSZ)
340 PORT MAP (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo);
409 PORT MAP (rstn, clkm, ahbmi, ahbsi, ahbso(2), dbgo, dbgi, dsui, dsuo);
341 dsui.enable <= '1';
410 dsui.enable <= '1';
342 dsui.break <= '0';
411 dsui.break <= '0';
343 END GENERATE;
412 END GENERATE;
344 END GENERATE;
413 END GENERATE;
345
414
346 nodsu : IF CFG_DSU = 0 GENERATE
415 nodsu : IF CFG_DSU = 0 GENERATE
347 ahbso(2) <= ahbs_none;
416 ahbso(2) <= ahbs_none;
348 dsuo.tstop <= '0';
417 dsuo.tstop <= '0';
349 dsuo.active <= '0';
418 dsuo.active <= '0';
350 END GENERATE;
419 END GENERATE;
351
420
352 irqctrl : IF CFG_IRQ3_ENABLE /= 0 GENERATE
421 irqctrl : IF CFG_IRQ3_ENABLE /= 0 GENERATE
353 irqctrl0 : irqmp -- interrupt controller
422 irqctrl0 : irqmp -- interrupt controller
354 GENERIC MAP (pindex => 2, paddr => 2, ncpu => CFG_NCPU)
423 GENERIC MAP (pindex => 2, paddr => 2, ncpu => CFG_NCPU)
355 PORT MAP (rstn, clkm, apbi, apbo(2), irqo, irqi);
424 PORT MAP (rstn, clkm, apbi, apbo(2), irqo, irqi);
356 END GENERATE;
425 END GENERATE;
357 irq3 : IF CFG_IRQ3_ENABLE = 0 GENERATE
426 irq3 : IF CFG_IRQ3_ENABLE = 0 GENERATE
358 x : FOR i IN 0 TO CFG_NCPU-1 GENERATE
427 x : FOR i IN 0 TO CFG_NCPU-1 GENERATE
359 irqi(i).irl <= "0000";
428 irqi(i).irl <= "0000";
360 END GENERATE;
429 END GENERATE;
361 apbo(2) <= apb_none;
430 apbo(2) <= apb_none;
362 END GENERATE;
431 END GENERATE;
363
432
364 ----------------------------------------------------------------------
433 ----------------------------------------------------------------------
365 --- Memory controllers ---------------------------------------------
434 --- Memory controllers ---------------------------------------------
366 ----------------------------------------------------------------------
435 ----------------------------------------------------------------------
367 memctrlr : mctrl GENERIC MAP (
436 memctrlr : mctrl GENERIC MAP (
368 hindex => 0,
437 hindex => 0,
369 pindex => 0,
438 pindex => 0,
370 paddr => 0,
439 paddr => 0,
371 srbanks => 1
440 srbanks => 1
372 )
441 )
373 PORT MAP (rstn, clkm, memi, memo, ahbsi, ahbso(0), apbi, apbo(0), wpo, sdo);
442 PORT MAP (rstn, clkm, memi, memo, ahbsi, ahbso(0), apbi, apbo(0), wpo, sdo);
374
443
375 memi.brdyn <= '1';
444 memi.brdyn <= '1';
376 memi.bexcn <= '1';
445 memi.bexcn <= '1';
377 memi.writen <= '1';
446 memi.writen <= '1';
378 memi.wrn <= "1111";
447 memi.wrn <= "1111";
379 memi.bwidth <= "10";
448 memi.bwidth <= "10";
380
449
381 bdr : FOR i IN 0 TO 3 GENERATE
450 bdr : FOR i IN 0 TO 3 GENERATE
382 data_pad : iopadv GENERIC MAP (tech => padtech, width => 8)
451 data_pad : iopadv GENERIC MAP (tech => padtech, width => 8)
383 PORT MAP (
452 PORT MAP (
384 data(31-i*8 DOWNTO 24-i*8),
453 data(31-i*8 DOWNTO 24-i*8),
385 memo.data(31-i*8 DOWNTO 24-i*8),
454 memo.data(31-i*8 DOWNTO 24-i*8),
386 memo.bdrive(i),
455 memo.bdrive(i),
387 memi.data(31-i*8 DOWNTO 24-i*8));
456 memi.data(31-i*8 DOWNTO 24-i*8));
388 END GENERATE;
457 END GENERATE;
389
458
390 addr_pad : outpadv GENERIC MAP (width => 20, tech => padtech)
459 addr_pad : outpadv GENERIC MAP (width => 20, tech => padtech)
391 PORT MAP (address, memo.address(21 DOWNTO 2));
460 PORT MAP (address, memo.address(21 DOWNTO 2));
392 nSRAM_CE_s <= NOT(memo.ramsn(0));
461 nSRAM_CE_s <= NOT(memo.ramsn(0));
393 rams_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_CE, nSRAM_CE_s);
462 rams_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_CE, nSRAM_CE_s);
394 oen_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_OE, memo.ramoen(0));
463 oen_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_OE, memo.ramoen(0));
395 nBWE_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_WE, memo.writen);
464 nBWE_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_WE, memo.writen);
396 nBWa_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE0, memo.mben(3));
465 nBWa_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE0, memo.mben(3));
397 nBWb_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE1, memo.mben(2));
466 nBWb_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE1, memo.mben(2));
398 nBWc_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE2, memo.mben(1));
467 nBWc_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE2, memo.mben(1));
399 nBWd_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE3, memo.mben(0));
468 nBWd_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (nSRAM_BE3, memo.mben(0));
400
469
401 ----------------------------------------------------------------------
470 ----------------------------------------------------------------------
402 --- AHB CONTROLLER -------------------------------------------------
471 --- AHB CONTROLLER -------------------------------------------------
403 ----------------------------------------------------------------------
472 ----------------------------------------------------------------------
404 ahb0 : ahbctrl -- AHB arbiter/multiplexer
473 ahb0 : ahbctrl -- AHB arbiter/multiplexer
405 GENERIC MAP (defmast => CFG_DEFMST, split => CFG_SPLIT,
474 GENERIC MAP (defmast => CFG_DEFMST, split => CFG_SPLIT,
406 rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO,
475 rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO,
407 ioen => 0, nahbm => maxahbmsp, nahbs => 8)
476 ioen => 0, nahbm => maxahbmsp, nahbs => 8)
408 PORT MAP (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso);
477 PORT MAP (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso);
409
478
410 ----------------------------------------------------------------------
479 ----------------------------------------------------------------------
411 --- AHB UART -------------------------------------------------------
480 --- AHB UART -------------------------------------------------------
412 ----------------------------------------------------------------------
481 ----------------------------------------------------------------------
413 dcomgen : IF CFG_AHB_UART = 1 GENERATE
482 dcomgen : IF CFG_AHB_UART = 1 GENERATE
414 dcom0 : ahbuart
483 dcom0 : ahbuart
415 GENERIC MAP (hindex => maxahbmsp-1, pindex => 4, paddr => 4)
484 GENERIC MAP (hindex => maxahbmsp-1, pindex => 4, paddr => 4)
416 PORT MAP (rstn, clkm, ahbuarti, ahbuarto, apbi, apbo(4), ahbmi, ahbmo(maxahbmsp-1));
485 PORT MAP (rstn, clkm, ahbuarti, ahbuarto, apbi, apbo(4), ahbmi, ahbmo(maxahbmsp-1));
417 dsurx_pad : inpad GENERIC MAP (tech => padtech) PORT MAP (ahbrxd, ahbuarti.rxd);
486 dsurx_pad : inpad GENERIC MAP (tech => padtech) PORT MAP (ahbrxd, ahbuarti.rxd);
418 dsutx_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (ahbtxd, ahbuarto.txd);
487 dsutx_pad : outpad GENERIC MAP (tech => padtech) PORT MAP (ahbtxd, ahbuarto.txd);
419 END GENERATE;
488 END GENERATE;
420 nouah : IF CFG_AHB_UART = 0 GENERATE apbo(4) <= apb_none; END GENERATE;
489 nouah : IF CFG_AHB_UART = 0 GENERATE apbo(4) <= apb_none; END GENERATE;
421
490
422 ----------------------------------------------------------------------
491 ----------------------------------------------------------------------
423 --- APB Bridge -----------------------------------------------------
492 --- APB Bridge -----------------------------------------------------
424 ----------------------------------------------------------------------
493 ----------------------------------------------------------------------
425 apb0 : apbctrl -- AHB/APB bridge
494 apb0 : apbctrl -- AHB/APB bridge
426 GENERIC MAP (hindex => 1, haddr => CFG_APBADDR)
495 GENERIC MAP (hindex => 1, haddr => CFG_APBADDR)
427 PORT MAP (rstn, clkm, ahbsi, ahbso(1), apbi, apbo);
496 PORT MAP (rstn, clkm, ahbsi, ahbso(1), apbi, apbo);
428
497
429 ----------------------------------------------------------------------
498 ----------------------------------------------------------------------
430 --- GPT Timer ------------------------------------------------------
499 --- GPT Timer ------------------------------------------------------
431 ----------------------------------------------------------------------
500 ----------------------------------------------------------------------
432 gpt : IF CFG_GPT_ENABLE /= 0 GENERATE
501 gpt : IF CFG_GPT_ENABLE /= 0 GENERATE
433 timer0 : gptimer -- timer unit
502 timer0 : gptimer -- timer unit
434 GENERIC MAP (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ,
503 GENERIC MAP (pindex => 3, paddr => 3, pirq => CFG_GPT_IRQ,
435 sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM,
504 sepirq => CFG_GPT_SEPIRQ, sbits => CFG_GPT_SW, ntimers => CFG_GPT_NTIM,
436 nbits => CFG_GPT_TW)
505 nbits => CFG_GPT_TW)
437 PORT MAP (rstn, clkm, apbi, apbo(3), gpti, gpto);
506 PORT MAP (rstn, clkm, apbi, apbo(3), gpti, gpto);
438 gpti.dhalt <= dsuo.tstop;
507 gpti.dhalt <= dsuo.tstop;
439 gpti.extclk <= '0';
508 gpti.extclk <= '0';
440 END GENERATE;
509 END GENERATE;
441 notim : IF CFG_GPT_ENABLE = 0 GENERATE apbo(3) <= apb_none; END GENERATE;
510 notim : IF CFG_GPT_ENABLE = 0 GENERATE apbo(3) <= apb_none; END GENERATE;
442
511
443
512
444 ----------------------------------------------------------------------
513 ----------------------------------------------------------------------
445 --- APB UART -------------------------------------------------------
514 --- APB UART -------------------------------------------------------
446 ----------------------------------------------------------------------
515 ----------------------------------------------------------------------
447 ua1 : IF CFG_UART1_ENABLE /= 0 GENERATE
516 ua1 : IF CFG_UART1_ENABLE /= 0 GENERATE
448 uart1 : apbuart -- UART 1
517 uart1 : apbuart -- UART 1
449 GENERIC MAP (pindex => 1, paddr => 1, pirq => 2, console => dbguart,
518 GENERIC MAP (pindex => 1, paddr => 1, pirq => 2, console => dbguart,
450 fifosize => CFG_UART1_FIFO)
519 fifosize => CFG_UART1_FIFO)
451 PORT MAP (rstn, clkm, apbi, apbo(1), apbuarti, apbuarto);
520 PORT MAP (rstn, clkm, apbi, apbo(1), apbuarti, apbuarto);
452 apbuarti.rxd <= urxd1;
521 apbuarti.rxd <= urxd1;
453 apbuarti.extclk <= '0';
522 apbuarti.extclk <= '0';
454 utxd1 <= apbuarto.txd;
523 utxd1 <= apbuarto.txd;
455 apbuarti.ctsn <= '0';
524 apbuarti.ctsn <= '0';
456 END GENERATE;
525 END GENERATE;
457 noua0 : IF CFG_UART1_ENABLE = 0 GENERATE apbo(1) <= apb_none; END GENERATE;
526 noua0 : IF CFG_UART1_ENABLE = 0 GENERATE apbo(1) <= apb_none; END GENERATE;
458
527
459 -------------------------------------------------------------------------------
528 -------------------------------------------------------------------------------
460 -- AMBA BUS -------------------------------------------------------------------
529 -- AMBA BUS -------------------------------------------------------------------
461 -------------------------------------------------------------------------------
530 -------------------------------------------------------------------------------
462
531
463 -- APB --------------------------------------------------------------------
532 -- APB --------------------------------------------------------------------
464 apbi_ext <= apbi;
533 apbi_ext <= apbi;
465 all_apb : FOR I IN 0 TO NB_APB_SLAVE-1 GENERATE
534 all_apb : FOR I IN 0 TO NB_APB_SLAVE-1 GENERATE
466 max_16_apb : IF I + 5 < 16 GENERATE
535 max_16_apb : IF I + 5 < 16 GENERATE
467 apbo(I+5) <= apbo_ext(I+5);
536 apbo(I+5) <= apbo_ext(I+5);
468 END GENERATE max_16_apb;
537 END GENERATE max_16_apb;
469 END GENERATE all_apb;
538 END GENERATE all_apb;
470 -- AHB_Slave --------------------------------------------------------------
539 -- AHB_Slave --------------------------------------------------------------
471 ahbi_s_ext <= ahbsi;
540 ahbi_s_ext <= ahbsi;
472 all_ahbs : FOR I IN 0 TO NB_AHB_SLAVE-1 GENERATE
541 all_ahbs : FOR I IN 0 TO NB_AHB_SLAVE-1 GENERATE
473 max_16_ahbs : IF I + 3 < 16 GENERATE
542 max_16_ahbs : IF I + 3 < 16 GENERATE
474 ahbso(I+3) <= ahbo_s_ext(I+3);
543 ahbso(I+3) <= ahbo_s_ext(I+3);
475 END GENERATE max_16_ahbs;
544 END GENERATE max_16_ahbs;
476 END GENERATE all_ahbs;
545 END GENERATE all_ahbs;
477 -- AHB_Master -------------------------------------------------------------
546 -- AHB_Master -------------------------------------------------------------
478 ahbi_m_ext <= ahbmi;
547 ahbi_m_ext <= ahbmi;
479 all_ahbm : FOR I IN 0 TO NB_AHB_MASTER-1 GENERATE
548 all_ahbm : FOR I IN 0 TO NB_AHB_MASTER-1 GENERATE
480 max_16_ahbm : IF I + CFG_NCPU + CFG_AHB_UART < 16 GENERATE
549 max_16_ahbm : IF I + CFG_NCPU + CFG_AHB_UART < 16 GENERATE
481 ahbmo(I + CFG_NCPU) <= ahbo_m_ext(I+CFG_NCPU);
550 ahbmo(I + CFG_NCPU) <= ahbo_m_ext(I+CFG_NCPU);
482 END GENERATE max_16_ahbm;
551 END GENERATE max_16_ahbm;
483 END GENERATE all_ahbm;
552 END GENERATE all_ahbm;
484
553
485
554
486
555
487 END Behavioral; No newline at end of file
556 END Behavioral;
@@ -1,142 +1,143
1 ------------------------------------------------------------------------------
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
4 --
5 -- This program is free software; you can redistribute it and/or modify
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
8 -- (at your option) any later version.
9 --
9 --
10 -- This program is distributed in the hope that it will be useful,
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
13 -- GNU General Public License for more details.
14 --
14 --
15 -- You should have received a copy of the GNU General Public License
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -- jean-christophe.pellion@easii-ic.com
21 -- jean-christophe.pellion@easii-ic.com
22 ----------------------------------------------------------------------------
22 ----------------------------------------------------------------------------
23 LIBRARY ieee;
23 LIBRARY ieee;
24 USE ieee.std_logic_1164.ALL;
24 USE ieee.std_logic_1164.ALL;
25 LIBRARY grlib;
25 LIBRARY grlib;
26 USE grlib.amba.ALL;
26 USE grlib.amba.ALL;
27
27
28 PACKAGE lpp_leon3_soc_pkg IS
28 PACKAGE lpp_leon3_soc_pkg IS
29
29
30 type soc_ahb_mst_out_vector is array (natural range <>) of ahb_mst_out_type;
30 type soc_ahb_mst_out_vector is array (natural range <>) of ahb_mst_out_type;
31 type soc_ahb_slv_out_vector is array (natural range <>) of ahb_slv_out_type;
31 type soc_ahb_slv_out_vector is array (natural range <>) of ahb_slv_out_type;
32 type soc_apb_slv_out_vector is array (natural range <>) of apb_slv_out_type;
32 type soc_apb_slv_out_vector is array (natural range <>) of apb_slv_out_type;
33
33
34 COMPONENT leon3_soc
34 COMPONENT leon3_soc
35 GENERIC (
35 GENERIC (
36 fabtech : INTEGER;
36 fabtech : INTEGER;
37 memtech : INTEGER;
37 memtech : INTEGER;
38 padtech : INTEGER;
38 padtech : INTEGER;
39 clktech : INTEGER;
39 clktech : INTEGER;
40 disas : INTEGER;
40 disas : INTEGER;
41 dbguart : INTEGER;
41 dbguart : INTEGER;
42 pclow : INTEGER;
42 pclow : INTEGER;
43 clk_freq : INTEGER;
43 clk_freq : INTEGER;
44 IS_RADHARD : INTEGER;
44 NB_CPU : INTEGER;
45 NB_CPU : INTEGER;
45 ENABLE_FPU : INTEGER;
46 ENABLE_FPU : INTEGER;
46 FPU_NETLIST : INTEGER;
47 FPU_NETLIST : INTEGER;
47 ENABLE_DSU : INTEGER;
48 ENABLE_DSU : INTEGER;
48 ENABLE_AHB_UART : INTEGER;
49 ENABLE_AHB_UART : INTEGER;
49 ENABLE_APB_UART : INTEGER;
50 ENABLE_APB_UART : INTEGER;
50 ENABLE_IRQMP : INTEGER;
51 ENABLE_IRQMP : INTEGER;
51 ENABLE_GPT : INTEGER;
52 ENABLE_GPT : INTEGER;
52 NB_AHB_MASTER : INTEGER;
53 NB_AHB_MASTER : INTEGER;
53 NB_AHB_SLAVE : INTEGER;
54 NB_AHB_SLAVE : INTEGER;
54 NB_APB_SLAVE : INTEGER;
55 NB_APB_SLAVE : INTEGER;
55 ADDRESS_SIZE : INTEGER;
56 ADDRESS_SIZE : INTEGER;
56 USES_IAP_MEMCTRLR : INTEGER
57 USES_IAP_MEMCTRLR : INTEGER
57 );
58 );
58 PORT (
59 PORT (
59 clk : IN STD_ULOGIC;
60 clk : IN STD_ULOGIC;
60 reset : IN STD_ULOGIC;
61 reset : IN STD_ULOGIC;
61
62
62 errorn : OUT STD_ULOGIC;
63 errorn : OUT STD_ULOGIC;
63
64
64 -- UART AHB ---------------------------------------------------------------
65 -- UART AHB ---------------------------------------------------------------
65 ahbrxd : IN STD_ULOGIC; -- DSU rx data
66 ahbrxd : IN STD_ULOGIC; -- DSU rx data
66 ahbtxd : OUT STD_ULOGIC; -- DSU tx data
67 ahbtxd : OUT STD_ULOGIC; -- DSU tx data
67
68
68 -- UART APB ---------------------------------------------------------------
69 -- UART APB ---------------------------------------------------------------
69 urxd1 : IN STD_ULOGIC; -- UART1 rx data
70 urxd1 : IN STD_ULOGIC; -- UART1 rx data
70 utxd1 : OUT STD_ULOGIC; -- UART1 tx data
71 utxd1 : OUT STD_ULOGIC; -- UART1 tx data
71
72
72 -- RAM --------------------------------------------------------------------
73 -- RAM --------------------------------------------------------------------
73 address : OUT STD_LOGIC_VECTOR(ADDRESS_SIZE-1 DOWNTO 0);
74 address : OUT STD_LOGIC_VECTOR(ADDRESS_SIZE-1 DOWNTO 0);
74 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
75 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
75 nSRAM_BE0 : OUT STD_LOGIC;
76 nSRAM_BE0 : OUT STD_LOGIC;
76 nSRAM_BE1 : OUT STD_LOGIC;
77 nSRAM_BE1 : OUT STD_LOGIC;
77 nSRAM_BE2 : OUT STD_LOGIC;
78 nSRAM_BE2 : OUT STD_LOGIC;
78 nSRAM_BE3 : OUT STD_LOGIC;
79 nSRAM_BE3 : OUT STD_LOGIC;
79 nSRAM_WE : OUT STD_LOGIC;
80 nSRAM_WE : OUT STD_LOGIC;
80 nSRAM_CE : OUT STD_LOGIC_VECTOR(1 downto 0);
81 nSRAM_CE : OUT STD_LOGIC_VECTOR(1 downto 0);
81 nSRAM_OE : OUT STD_LOGIC;
82 nSRAM_OE : OUT STD_LOGIC;
82 nSRAM_READY : IN STD_LOGIC;
83 nSRAM_READY : IN STD_LOGIC;
83 SRAM_MBE : INOUT STD_LOGIC;
84 SRAM_MBE : INOUT STD_LOGIC;
84 -- APB --------------------------------------------------------------------
85 -- APB --------------------------------------------------------------------
85 apbi_ext : OUT apb_slv_in_type;
86 apbi_ext : OUT apb_slv_in_type;
86 apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
87 apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
87 -- AHB_Slave --------------------------------------------------------------
88 -- AHB_Slave --------------------------------------------------------------
88 ahbi_s_ext : OUT ahb_slv_in_type;
89 ahbi_s_ext : OUT ahb_slv_in_type;
89 ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
90 ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
90 -- AHB_Master -------------------------------------------------------------
91 -- AHB_Master -------------------------------------------------------------
91 ahbi_m_ext : OUT AHB_Mst_In_Type;
92 ahbi_m_ext : OUT AHB_Mst_In_Type;
92 ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU));
93 ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU));
93 END COMPONENT;
94 END COMPONENT;
94
95
95
96
96 COMPONENT leon3ft_soc
97 --COMPONENT leon3ft_soc
97 GENERIC (
98 -- GENERIC (
98 fabtech : INTEGER;
99 -- fabtech : INTEGER;
99 memtech : INTEGER;
100 -- memtech : INTEGER;
100 padtech : INTEGER;
101 -- padtech : INTEGER;
101 clktech : INTEGER;
102 -- clktech : INTEGER;
102 disas : INTEGER;
103 -- disas : INTEGER;
103 dbguart : INTEGER;
104 -- dbguart : INTEGER;
104 pclow : INTEGER;
105 -- pclow : INTEGER;
105 clk_freq : INTEGER;
106 -- clk_freq : INTEGER;
106 NB_CPU : INTEGER;
107 -- NB_CPU : INTEGER;
107 ENABLE_FPU : INTEGER;
108 -- ENABLE_FPU : INTEGER;
108 FPU_NETLIST : INTEGER;
109 -- FPU_NETLIST : INTEGER;
109 ENABLE_DSU : INTEGER;
110 -- ENABLE_DSU : INTEGER;
110 ENABLE_AHB_UART : INTEGER;
111 -- ENABLE_AHB_UART : INTEGER;
111 ENABLE_APB_UART : INTEGER;
112 -- ENABLE_APB_UART : INTEGER;
112 ENABLE_IRQMP : INTEGER;
113 -- ENABLE_IRQMP : INTEGER;
113 ENABLE_GPT : INTEGER;
114 -- ENABLE_GPT : INTEGER;
114 NB_AHB_MASTER : INTEGER;
115 -- NB_AHB_MASTER : INTEGER;
115 NB_AHB_SLAVE : INTEGER;
116 -- NB_AHB_SLAVE : INTEGER;
116 NB_APB_SLAVE : INTEGER);
117 -- NB_APB_SLAVE : INTEGER);
117 PORT (
118 -- PORT (
118 clk : IN STD_ULOGIC;
119 -- clk : IN STD_ULOGIC;
119 reset : IN STD_ULOGIC;
120 -- reset : IN STD_ULOGIC;
120 errorn : OUT STD_ULOGIC;
121 -- errorn : OUT STD_ULOGIC;
121 ahbrxd : IN STD_ULOGIC;
122 -- ahbrxd : IN STD_ULOGIC;
122 ahbtxd : OUT STD_ULOGIC;
123 -- ahbtxd : OUT STD_ULOGIC;
123 urxd1 : IN STD_ULOGIC;
124 -- urxd1 : IN STD_ULOGIC;
124 utxd1 : OUT STD_ULOGIC;
125 -- utxd1 : OUT STD_ULOGIC;
125 address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
126 -- address : OUT STD_LOGIC_VECTOR(19 DOWNTO 0);
126 data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
127 -- data : INOUT STD_LOGIC_VECTOR(31 DOWNTO 0);
127 nSRAM_BE0 : OUT STD_LOGIC;
128 -- nSRAM_BE0 : OUT STD_LOGIC;
128 nSRAM_BE1 : OUT STD_LOGIC;
129 -- nSRAM_BE1 : OUT STD_LOGIC;
129 nSRAM_BE2 : OUT STD_LOGIC;
130 -- nSRAM_BE2 : OUT STD_LOGIC;
130 nSRAM_BE3 : OUT STD_LOGIC;
131 -- nSRAM_BE3 : OUT STD_LOGIC;
131 nSRAM_WE : OUT STD_LOGIC;
132 -- nSRAM_WE : OUT STD_LOGIC;
132 nSRAM_CE : OUT STD_LOGIC;
133 -- nSRAM_CE : OUT STD_LOGIC;
133 nSRAM_OE : OUT STD_LOGIC;
134 -- nSRAM_OE : OUT STD_LOGIC;
134 apbi_ext : OUT apb_slv_in_type;
135 -- apbi_ext : OUT apb_slv_in_type;
135 apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
136 -- apbo_ext : IN soc_apb_slv_out_vector(NB_APB_SLAVE-1+5 DOWNTO 5);
136 ahbi_s_ext : OUT ahb_slv_in_type;
137 -- ahbi_s_ext : OUT ahb_slv_in_type;
137 ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
138 -- ahbo_s_ext : IN soc_ahb_slv_out_vector(NB_AHB_SLAVE-1+3 DOWNTO 3);
138 ahbi_m_ext : OUT AHB_Mst_In_Type;
139 -- ahbi_m_ext : OUT AHB_Mst_In_Type;
139 ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU));
140 -- ahbo_m_ext : IN soc_ahb_mst_out_vector(NB_AHB_MASTER-1+NB_CPU DOWNTO NB_CPU));
140 END COMPONENT;
141 --END COMPONENT;
141
142
142 END; No newline at end of file
143 END;
@@ -1,3 +1,2
1 lpp_leon3_soc_pkg.vhd
1 lpp_leon3_soc_pkg.vhd
2 leon3_soc.vhd
2 leon3_soc.vhd
3 leon3ft_soc.vhd
General Comments 0
You need to be logged in to leave comments. Login now