##// END OF EJS Templates
LFR-EQM et MINI-LFR x.1.70
pellion -
r577:bcb5a865d2bb (MINI-LFR) 0-1-70 (LFR-EQM) 2-1-70 JC
parent child
Show More
@@ -0,0 +1,213
1 ------------------------------------------------------------------------------
2 -- This file is a part of the LPP VHDL IP LIBRARY
3 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
4 --
5 -- This program is free software; you can redistribute it and/or modify
6 -- it under the terms of the GNU General Public License as published by
7 -- the Free Software Foundation; either version 3 of the License, or
8 -- (at your option) any later version.
9 --
10 -- This program is distributed in the hope that it will be useful,
11 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
12 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 -- GNU General Public License for more details.
14 --
15 -- You should have received a copy of the GNU General Public License
16 -- along with this program; if not, write to the Free Software
17 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18 -------------------------------------------------------------------------------
19 -- Author : Jean-christophe Pellion
20 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
21 -- jean-christophe.pellion@easii-ic.com
22 -------------------------------------------------------------------------------
23 -- 1.0 - initial version
24 -------------------------------------------------------------------------------
25 LIBRARY ieee;
26 USE ieee.std_logic_1164.ALL;
27 USE ieee.numeric_std.ALL;
28 LIBRARY grlib;
29 USE grlib.amba.ALL;
30 USE grlib.stdlib.ALL;
31 USE grlib.devices.ALL;
32
33 LIBRARY lpp;
34 USE lpp.lpp_amba.ALL;
35 USE lpp.apb_devices_list.ALL;
36 USE lpp.lpp_memory.ALL;
37 USE lpp.lpp_dma_pkg.ALL;
38 USE lpp.general_purpose.ALL;
39 --USE lpp.lpp_waveform_pkg.ALL;
40 LIBRARY techmap;
41 USE techmap.gencomp.ALL;
42
43
44 ENTITY lpp_dma_SEND16B_FIFO2DMA IS
45 GENERIC (
46 hindex : INTEGER := 2;
47 vendorid : IN INTEGER := 0;
48 deviceid : IN INTEGER := 0;
49 version : IN INTEGER := 0
50 );
51 PORT (
52 clk : IN STD_LOGIC;
53 rstn : IN STD_LOGIC;
54
55 -- AMBA AHB Master Interface
56 AHB_Master_In : IN AHB_Mst_In_Type;
57 AHB_Master_Out : OUT AHB_Mst_Out_Type;
58
59 -- FIFO Interface
60 ren : OUT STD_LOGIC;
61 data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
62
63 -- Controls
64 send : IN STD_LOGIC;
65 valid_burst : IN STD_LOGIC; -- (1 => BURST , 0 => SINGLE)
66 done : OUT STD_LOGIC;
67 address : IN STD_LOGIC_VECTOR(31 DOWNTO 0)
68 );
69 END;
70
71 ARCHITECTURE Behavioral OF lpp_dma_SEND16B_FIFO2DMA IS
72
73 CONSTANT HConfig : AHB_Config_Type := (
74 0 => ahb_device_reg(vendorid, deviceid, 0, version, 0),
75 OTHERS => (OTHERS => '0'));
76
77 TYPE AHB_DMA_FSM_STATE IS (IDLE, s_ARBITER ,s_CTRL, s_CTRL_DATA, s_DATA);
78 SIGNAL state : AHB_DMA_FSM_STATE;
79
80 SIGNAL address_counter_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
81 SIGNAL address_counter : STD_LOGIC_VECTOR(3 DOWNTO 0);
82
83 SIGNAL data_window : STD_LOGIC;
84 SIGNAL ctrl_window : STD_LOGIC;
85
86 SIGNAL bus_request : STD_LOGIC;
87 SIGNAL bus_lock : STD_LOGIC;
88
89 BEGIN
90
91 -----------------------------------------------------------------------------
92 AHB_Master_Out.HCONFIG <= HConfig;
93 AHB_Master_Out.HSIZE <= "010"; --WORDS 32b
94 AHB_Master_Out.HINDEX <= hindex;
95 AHB_Master_Out.HPROT <= "0011"; --DATA ACCESS and PRIVILEDGED ACCESS
96 AHB_Master_Out.HIRQ <= (OTHERS => '0');
97 AHB_Master_Out.HBURST <= "111"; -- INCR --"111"; --INCR16
98 AHB_Master_Out.HWRITE <= '1';
99
100 --AHB_Master_Out.HTRANS <= HTRANS_NONSEQ WHEN ctrl_window = '1' OR data_window = '1' ELSE HTRANS_IDLE;
101
102 --AHB_Master_Out.HBUSREQ <= bus_request;
103 --AHB_Master_Out.HLOCK <= data_window;
104
105 --bus_request <= '0' WHEN address_counter_reg = "1111" AND AHB_Master_In.HREADY = '1' ELSE
106 -- '1' WHEN ctrl_window = '1' ELSE
107 -- '0';
108
109 --bus_lock <= '0' WHEN address_counter_reg = "1111" ELSE
110 -- '1' WHEN ctrl_window = '1' ELSE '0';
111
112 -----------------------------------------------------------------------------
113 AHB_Master_Out.HADDR <= address(31 DOWNTO 6) & address_counter_reg & "00";
114 AHB_Master_Out.HWDATA <= ahbdrivedata(data);
115
116 -----------------------------------------------------------------------------
117 --ren <= NOT ((AHB_Master_In.HGRANT(hindex) OR LAST_READ ) AND AHB_Master_In.HREADY );
118 --ren <= NOT beat;
119 -----------------------------------------------------------------------------
120 PROCESS (clk, rstn)
121 BEGIN -- PROCESS
122 IF rstn = '0' THEN -- asynchronous reset (active low)
123 state <= IDLE;
124 done <= '0';
125 address_counter_reg <= (OTHERS => '0');
126 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
127 AHB_Master_Out.HBUSREQ <= '0';
128 AHB_Master_Out.HLOCK <= '0';
129 ELSIF clk'event AND clk = '1' THEN -- rising clock edge
130 done <= '0';
131 CASE state IS
132 WHEN IDLE =>
133 AHB_Master_Out.HBUSREQ <= '0';
134 AHB_Master_Out.HLOCK <= '0';
135 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
136 address_counter_reg <= (OTHERS => '0');
137 IF send = '1' THEN
138 AHB_Master_Out.HBUSREQ <= '1';
139 AHB_Master_Out.HLOCK <= '1';
140 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
141 state <= s_ARBITER;
142 END IF;
143
144 WHEN s_ARBITER =>
145 AHB_Master_Out.HBUSREQ <= '1';
146 AHB_Master_Out.HLOCK <= '1';
147 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
148 address_counter_reg <= (OTHERS => '0');
149
150 IF AHB_Master_In.HGRANT(hindex) = '1' THEN
151 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
152 state <= s_CTRL;
153 END IF;
154
155 WHEN s_CTRL =>
156 AHB_Master_Out.HBUSREQ <= '1';
157 AHB_Master_Out.HLOCK <= '1';
158 AHB_Master_Out.HTRANS <= HTRANS_NONSEQ;
159 IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN
160 AHB_Master_Out.HTRANS <= HTRANS_SEQ;
161 state <= s_CTRL_DATA;
162 END IF;
163
164 WHEN s_CTRL_DATA =>
165 AHB_Master_Out.HBUSREQ <= '1';
166 AHB_Master_Out.HLOCK <= '1';
167 AHB_Master_Out.HTRANS <= HTRANS_SEQ;
168 IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN
169 address_counter_reg <= STD_LOGIC_VECTOR(UNSIGNED(address_counter_reg) + 1);
170 END IF;
171
172 IF address_counter_reg = "1111" AND AHB_Master_In.HREADY = '1' THEN
173 AHB_Master_Out.HBUSREQ <= '0';
174 AHB_Master_Out.HLOCK <= '1';--'0';
175 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
176 state <= s_DATA;
177 END IF;
178
179 WHEN s_DATA =>
180 AHB_Master_Out.HBUSREQ <= '0';
181 AHB_Master_Out.HLOCK <= '0';
182 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
183 IF AHB_Master_In.HREADY = '1' THEN
184 state <= IDLE;
185 done <= '1';
186 END IF;
187
188 WHEN OTHERS => NULL;
189 END CASE;
190 END IF;
191 END PROCESS;
192
193 ctrl_window <= '1' WHEN state = s_CTRL OR state = s_CTRL_DATA ELSE '0';
194 data_window <= '1' WHEN state = s_CTRL_DATA OR state = s_DATA ELSE '0';
195 -----------------------------------------------------------------------------
196 ren <= NOT(AHB_Master_In.HREADY) WHEN state = s_CTRL_DATA ELSE '1';
197
198 -----------------------------------------------------------------------------
199 --PROCESS (clk, rstn)
200 --BEGIN -- PROCESS
201 -- IF rstn = '0' THEN -- asynchronous reset (active low)
202 -- address_counter_reg <= (OTHERS => '0');
203 -- ELSIF clk'event AND clk = '1' THEN -- rising clock edge
204 -- address_counter_reg <= address_counter;
205 -- END IF;
206 --END PROCESS;
207
208 --address_counter <= STD_LOGIC_VECTOR(UNSIGNED(address_counter_reg) + 1) WHEN data_window = '1' AND AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' ELSE
209 -- address_counter_reg;
210 -----------------------------------------------------------------------------
211
212
213 END Behavioral;
@@ -404,7 +404,7 BEGIN -- beh
404 404 pirq_ms => 6,
405 405 pirq_wfp => 14,
406 406 hindex => 2,
407 top_lfr_version => X"020145") -- aa.bb.cc version
407 top_lfr_version => X"020146") -- aa.bb.cc version
408 408 -- AA : BOARD NUMBER
409 409 -- 0 => MINI_LFR
410 410 -- 1 => EM
@@ -215,6 +215,8 ARCHITECTURE beh OF MINI_LFR_top IS
215 215 SIGNAL sample_hk : STD_LOGIC_VECTOR(15 DOWNTO 0);
216 216 SIGNAL HK_SEL : STD_LOGIC_VECTOR(1 DOWNTO 0);
217 217
218 SIGNAL nSRAM_READY : STD_LOGIC;
219
218 220 BEGIN -- beh
219 221
220 222 -----------------------------------------------------------------------------
@@ -368,7 +370,7 BEGIN -- beh
368 370 NB_APB_SLAVE => NB_APB_SLAVE,
369 371 ADDRESS_SIZE => 20,
370 372 USES_IAP_MEMCTRLR => USE_IAP_MEMCTRL,
371 BYPASS_EDAC_MEMCTRLR => '1',
373 BYPASS_EDAC_MEMCTRLR => '0',
372 374 SRBANKSZ => 9)
373 375 PORT MAP (
374 376 clk => clk_25,
@@ -387,7 +389,7 BEGIN -- beh
387 389 nSRAM_WE => SRAM_nWE,
388 390 nSRAM_CE => SRAM_CE_s,
389 391 nSRAM_OE => SRAM_nOE,
390 nSRAM_READY => '1',
392 nSRAM_READY => nSRAM_READY,
391 393 SRAM_MBE => OPEN,
392 394 apbi_ext => apbi_ext,
393 395 apbo_ext => apbo_ext,
@@ -396,6 +398,20 BEGIN -- beh
396 398 ahbi_m_ext => ahbi_m_ext,
397 399 ahbo_m_ext => ahbo_m_ext);
398 400
401 PROCESS (clk_25, rstn_25)
402 BEGIN -- PROCESS
403 IF rstn_25 = '0' THEN -- asynchronous reset (active low)
404 nSRAM_READY <= '1';
405 ELSIF clk_25'event AND clk_25 = '1' THEN -- rising clock edge
406 nSRAM_READY <= '1';
407 IF IO0 = '1' THEN
408 nSRAM_READY <= '0';
409 END IF;
410 END IF;
411 END PROCESS;
412
413
414
399 415 IAP:if USE_IAP_MEMCTRL = 1 GENERATE
400 416 SRAM_CE <= not SRAM_CE_s(0);
401 417 END GENERATE;
@@ -412,13 +428,13 END GENERATE;
412 428 pindex => 6,
413 429 paddr => 6,
414 430 pmask => 16#fff#,
415 FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
431 -- FIRST_DIVISION => 374, -- ((49.152/2) /2^16) - 1 = 375 - 1 = 374
416 432 NB_SECOND_DESYNC => 60) -- 60 secondes of desynchronization before CoarseTime's MSB is Set
417 433 PORT MAP (
418 434 clk25MHz => clk_25,
419 435 resetn_25MHz => rstn_25, -- TODO
420 clk24_576MHz => clk_24, -- 49.152MHz/2
421 resetn_24_576MHz => rstn_24, -- TODO
436 -- clk24_576MHz => clk_24, -- 49.152MHz/2
437 -- resetn_24_576MHz => rstn_24, -- TODO
422 438 grspw_tick => swno.tickout,
423 439 apbi => apbi_ext,
424 440 apbo => apbo_ext(6),
@@ -543,7 +559,7 END GENERATE;
543 559 pirq_ms => 6,
544 560 pirq_wfp => 14,
545 561 hindex => 2,
546 top_lfr_version => X"000144") -- aa.bb.cc version
562 top_lfr_version => X"000146") -- aa.bb.cc version
547 563 PORT MAP (
548 564 clk => clk_25,
549 565 rstn => LFR_rstn,
@@ -565,7 +581,7 END GENERATE;
565 581 observation_reg(31 DOWNTO 12) <= (OTHERS => '0');
566 582 observation_vector_0(11 DOWNTO 0) <= lfr_debug_vector;
567 583 observation_vector_1(11 DOWNTO 0) <= lfr_debug_vector;
568 IO0 <= rstn_25;
584 -- IO0 <= rstn_25;
569 585 IO1 <= lfr_debug_vector_ms(0); -- LFR MS FFT data_valid
570 586 IO2 <= lfr_debug_vector_ms(0); -- LFR MS FFT ready
571 587 IO3 <= lfr_debug_vector(0); -- LFR APBREG error_buffer_full
@@ -3,6 +3,7 USE ieee.std_logic_1164.ALL;
3 3 USE ieee.numeric_std.ALL;
4 4
5 5 LIBRARY lpp;
6 USE lpp.apb_devices_list.ALL;
6 7 USE lpp.lpp_ad_conv.ALL;
7 8 USE lpp.iir_filter.ALL;
8 9 USE lpp.FILTERcfg.ALL;
@@ -25,7 +26,8 USE GRLIB.DMA2AHB_Package.ALL;
25 26 ENTITY DMA_SubSystem IS
26 27
27 28 GENERIC (
28 hindex : INTEGER := 2);
29 hindex : INTEGER := 2;
30 CUSTOM_DMA : INTEGER := 1);
29 31
30 32 PORT (
31 33 clk : IN STD_LOGIC;
@@ -116,6 +118,7 BEGIN -- beh
116 118 -----------------------------------------------------------------------------
117 119 -- DMA
118 120 -----------------------------------------------------------------------------
121 GR_DMA : IF CUSTOM_DMA = 0 GENERATE
119 122 lpp_dma_singleOrBurst_1 : lpp_dma_singleOrBurst
120 123 GENERIC MAP (
121 124 tech => inferred,
@@ -133,6 +136,28 BEGIN -- beh
133 136 ren => dma_ren,
134 137 address => dma_address,
135 138 data => dma_data);
139 END GENERATE GR_DMA;
140
141 LPP_DMA_IP : IF CUSTOM_DMA = 1 GENERATE
142 lpp_dma_SEND16B_FIFO2DMA_1 : lpp_dma_SEND16B_FIFO2DMA
143 GENERIC MAP (
144 hindex => hindex,
145 vendorid => VENDOR_LPP,
146 deviceid => 10,
147 version => 0)
148 PORT MAP (
149 clk => clk,
150 rstn => rstn,
151 AHB_Master_In => ahbi,
152 AHB_Master_Out => ahbo,
153
154 ren => dma_ren,
155 data => dma_data,
156 send => dma_send,
157 valid_burst => dma_valid_burst,
158 done => dma_done,
159 address => dma_address);
160 END GENERATE LPP_DMA_IP;
136 161
137 162
138 163 -----------------------------------------------------------------------------
@@ -223,7 +223,8 PACKAGE lpp_dma_pkg IS
223 223 -----------------------------------------------------------------------------
224 224 COMPONENT DMA_SubSystem
225 225 GENERIC (
226 hindex : INTEGER);
226 hindex : INTEGER;
227 CUSTOM_DMA : INTEGER := 1);
227 228 PORT (
228 229 clk : IN STD_LOGIC;
229 230 rstn : IN STD_LOGIC;
@@ -286,4 +287,23 PACKAGE lpp_dma_pkg IS
286 287 grant_error : OUT STD_LOGIC);
287 288 END COMPONENT;
288 289
290 COMPONENT lpp_dma_SEND16B_FIFO2DMA
291 GENERIC (
292 hindex : INTEGER;
293 vendorid : in Integer;
294 deviceid : in Integer;
295 version : in Integer);
296 PORT (
297 clk : IN STD_LOGIC;
298 rstn : IN STD_LOGIC;
299 AHB_Master_In : IN AHB_Mst_In_Type;
300 AHB_Master_Out : OUT AHB_Mst_Out_Type;
301 ren : OUT STD_LOGIC;
302 data : IN STD_LOGIC_VECTOR(31 DOWNTO 0);
303 send : IN STD_LOGIC;
304 valid_burst : IN STD_LOGIC;
305 done : OUT STD_LOGIC;
306 address : IN STD_LOGIC_VECTOR(31 DOWNTO 0));
307 END COMPONENT;
308
289 309 END;
@@ -9,3 +9,4 DMA_SubSystem.vhd
9 9 DMA_SubSystem_GestionBuffer.vhd
10 10 DMA_SubSystem_Arbiter.vhd
11 11 DMA_SubSystem_MUX.vhd
12 lpp_dma_SEND16B_FIFO2DMA.vhd
@@ -375,7 +375,7 BEGIN
375 375 END GENERATE;
376 376
377 377 nodsu : IF CFG_DSU = 0 GENERATE
378 ahbso(2) <= ahbs_none;
378 ahbso(0) <= ahbs_none;
379 379 dsuo.tstop <= '0';
380 380 dsuo.active <= '0';
381 381 END GENERATE;
@@ -397,12 +397,12 BEGIN
397 397 ----------------------------------------------------------------------
398 398 ESAMEMCT : IF USES_IAP_MEMCTRLR = 0 GENERATE
399 399 memctrlr : mctrl GENERIC MAP (
400 hindex => 0,
400 hindex => 2,
401 401 pindex => 0,
402 402 paddr => 0,
403 403 srbanks => 1
404 404 )
405 PORT MAP (rstn, clkm, memi, memo, ahbsi, ahbso(0), apbi, apbo(0), wpo, sdo);
405 PORT MAP (rstn, clkm, memi, memo, ahbsi, ahbso(2), apbi, apbo(0), wpo, sdo);
406 406 memi.bexcn <= '1';
407 407 memi.brdyn <= '1';
408 408
@@ -489,7 +489,7 BEGIN
489 489 ahb0 : ahbctrl -- AHB arbiter/multiplexer
490 490 GENERIC MAP (defmast => CFG_DEFMST, split => CFG_SPLIT,
491 491 rrobin => CFG_RROBIN, ioaddr => CFG_AHBIO,
492 ioen => 0, nahbm => maxahbmsp, nahbs => 8)
492 ioen => 0, nahbm => maxahbmsp, nahbs => 8, fixbrst => 0)
493 493 PORT MAP (rstn, clkm, ahbmi, ahbmo, ahbsi, ahbso);
494 494
495 495 ----------------------------------------------------------------------
@@ -569,4 +569,4 BEGIN
569 569
570 570
571 571
572 END Behavioral; No newline at end of file
572 END Behavioral;
General Comments 0
You need to be logged in to leave comments. Login now