##// END OF EJS Templates
DEBUG LPP_DMA
pellion -
r268:c91962047b2b JC
parent child
Show More
@@ -0,0 +1,192
1
2 ------------------------------------------------------------------------------
3 -- This file is a part of the LPP VHDL IP LIBRARY
4 -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS
5 --
6 -- This program is free software; you can redistribute it and/or modify
7 -- it under the terms of the GNU General Public License as published by
8 -- the Free Software Foundation; either version 3 of the License, or
9 -- (at your option) any later version.
10 --
11 -- This program is distributed in the hope that it will be useful,
12 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
13 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 -- GNU General Public License for more details.
15 --
16 -- You should have received a copy of the GNU General Public License
17 -- along with this program; if not, write to the Free Software
18 -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 -------------------------------------------------------------------------------
20 -- Author : Jean-christophe Pellion
21 -- Mail : jean-christophe.pellion@lpp.polytechnique.fr
22 -- jean-christophe.pellion@easii-ic.com
23 -------------------------------------------------------------------------------
24 -- 1.0 - initial version
25 -- 1.1 - (01/11/2013) FIX boundary error (1kB address should not be crossed by BURSTS)
26 -------------------------------------------------------------------------------
27 LIBRARY ieee;
28 USE ieee.std_logic_1164.ALL;
29 USE ieee.numeric_std.ALL;
30 LIBRARY grlib;
31 USE grlib.amba.ALL;
32 USE grlib.stdlib.ALL;
33 USE grlib.devices.ALL;
34 USE GRLIB.DMA2AHB_Package.ALL;
35 LIBRARY lpp;
36 USE lpp.lpp_amba.ALL;
37 USE lpp.apb_devices_list.ALL;
38 USE lpp.lpp_memory.ALL;
39 USE lpp.lpp_dma_pkg.ALL;
40 USE lpp.lpp_waveform_pkg.ALL;
41 LIBRARY techmap;
42 USE techmap.gencomp.ALL;
43
44
45 ENTITY lpp_debug_dma_singleOrBurst IS
46 GENERIC (
47 tech : INTEGER := inferred;
48 hindex : INTEGER := 2;
49 pindex : INTEGER := 4;
50 paddr : INTEGER := 4;
51 pmask : INTEGER := 16#fff#
52 );
53 PORT (
54 -- AMBA AHB system signals
55 HCLK : IN STD_ULOGIC;
56 HRESETn : IN STD_ULOGIC;
57 -- AMBA AHB Master Interface
58 ahbmi : IN AHB_Mst_In_Type;
59 ahbmo : OUT AHB_Mst_Out_Type;
60 -- AMBA AHB Master Interface
61 apbi : IN apb_slv_in_type;
62 apbo : OUT apb_slv_out_type
63 );
64 END;
65
66 ARCHITECTURE Behavioral OF lpp_debug_dma_singleOrBurst IS
67 SIGNAL run : STD_LOGIC;
68 SIGNAL send : STD_LOGIC;
69 SIGNAL valid_burst : STD_LOGIC;
70 SIGNAL done : STD_LOGIC;
71 SIGNAL ren : STD_LOGIC;
72 SIGNAL address : STD_LOGIC_VECTOR(31 DOWNTO 0);
73 SIGNAL data : STD_LOGIC_VECTOR(31 DOWNTO 0);
74 --
75
76 CONSTANT REVISION : INTEGER := 1;
77
78 CONSTANT pconfig : apb_config_type := (
79 0 => ahb_device_reg (VENDOR_LPP, LPP_DEBUG_DMA, 2, REVISION, 0),
80 1 => apb_iobar(paddr, pmask));
81
82 TYPE lpp_debug_dma_regs IS RECORD
83 run : STD_LOGIC;
84 send : STD_LOGIC;
85 valid_burst : STD_LOGIC;
86 done : STD_LOGIC;
87 ren : STD_LOGIC;
88 addr : STD_LOGIC_VECTOR(31 DOWNTO 0);
89 data : STD_LOGIC_VECTOR(31 DOWNTO 0);
90 nb_ren : STD_LOGIC_VECTOR(31 DOWNTO 0);
91 END RECORD;
92 SIGNAL reg : lpp_debug_dma_regs;
93
94 SIGNAL prdata : STD_LOGIC_VECTOR(31 DOWNTO 0);
95
96 BEGIN
97
98 lpp_dma_singleOrBurst_1 : lpp_dma_singleOrBurst
99 GENERIC MAP (
100 tech => tech,
101 hindex => hindex)
102 PORT MAP (
103 HCLK => HCLK,
104 HRESETn => HRESETn,
105 run => run, --
106 AHB_Master_In => ahbmi,
107 AHB_Master_Out => ahbmo,
108 send => send, --
109 valid_burst => valid_burst, --
110 done => done, -- out
111 ren => ren, -- out
112 address => address,
113 data => data);
114
115
116 run <= reg.run;
117 valid_burst <= reg.valid_burst;
118 send <= reg.send;
119 address <= reg.addr;
120 data <= reg.data;
121
122 lpp_lfr_apbreg : PROCESS (HCLK, HRESETn)
123 VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2);
124 BEGIN -- PROCESS lpp_dma_top
125 IF HRESETn = '0' THEN -- asynchronous reset (active low)
126 reg.run <= '0';
127 reg.send <= '0';
128 reg.valid_burst <= '0';
129 reg.done <= '0';
130 reg.ren <= '0';
131 reg.addr <= (OTHERS => '0');
132 reg.data <= (OTHERS => '0');
133 reg.nb_ren <= (OTHERS => '0');
134
135 apbo.pirq <= (OTHERS => '0');
136 ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge
137 paddr := "000000";
138 paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2);
139 prdata <= (OTHERS => '0');
140 ------------------------------------
141 reg.send <= '0';
142 IF done = '1' THEN
143 reg.done <= '1';
144 END IF;
145 IF ren = '0' THEN
146 reg.ren <= '1';
147 reg.nb_ren <= STD_LOGIC_VECTOR(UNSIGNED(reg.nb_ren) + 1);
148 END IF;
149 ------------------------------------
150
151 IF apbi.psel(pindex) = '1' THEN
152 -- APB DMA READ --
153 CASE paddr(7 DOWNTO 2) IS
154 --
155 WHEN "000000" => prdata(0) <= reg.run;
156 prdata(1) <= reg.send;
157 prdata(2) <= reg.valid_burst;
158 prdata(3) <= reg.done;
159 prdata(4) <= reg.ren;
160 WHEN "000001" => prdata <= reg.addr;
161 WHEN "000010" => prdata <= reg.data;
162 WHEN "000011" => prdata <= reg.nb_ren;
163
164 WHEN OTHERS => NULL;
165 END CASE;
166 IF (apbi.pwrite AND apbi.penable) = '1' THEN
167 -- APB DMA WRITE --
168 CASE paddr(7 DOWNTO 2) IS
169 --
170 WHEN "000000" => reg.run <= apbi.pwdata(0);
171 reg.send <= apbi.pwdata(1);
172 reg.valid_burst <= apbi.pwdata(2);
173 reg.done <= apbi.pwdata(3);
174 reg.ren <= apbi.pwdata(4);
175 WHEN "000001" => reg.addr <= apbi.pwdata;
176 WHEN "000010" => reg.data <= apbi.pwdata;
177 WHEN "000011" => reg.nb_ren <= apbi.pwdata;
178 WHEN OTHERS => NULL;
179 END CASE;
180 END IF;
181 END IF;
182
183 END IF;
184 END PROCESS lpp_lfr_apbreg;
185
186 apbo.pindex <= pindex;
187 apbo.pconfig <= pconfig;
188 apbo.prdata <= prdata;
189
190
191
192 END Behavioral; No newline at end of file
@@ -0,0 +1,46
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 LIBRARY ieee;
24 USE ieee.std_logic_1164.ALL;
25 LIBRARY grlib;
26 USE grlib.amba.ALL;
27
28 PACKAGE lpp_debug_lfr_pkg IS
29
30 COMPONENT lpp_debug_dma_singleOrBurst
31 GENERIC (
32 tech : INTEGER;
33 hindex : INTEGER;
34 pindex : INTEGER;
35 paddr : INTEGER;
36 pmask : INTEGER);
37 PORT (
38 HCLK : IN STD_ULOGIC;
39 HRESETn : IN STD_ULOGIC;
40 ahbmi : IN AHB_Mst_In_Type;
41 ahbmo : OUT AHB_Mst_Out_Type;
42 apbi : IN apb_slv_in_type;
43 apbo : OUT apb_slv_out_type);
44 END COMPONENT;
45
46 END;
@@ -0,0 +1,2
1 lpp_debug_lfr_pkg.vhd
2 lpp_debug_dma_singleOrBurst.vhd
@@ -43,6 +43,7 USE lpp.iir_filter.ALL;
43 USE lpp.general_purpose.ALL;
43 USE lpp.general_purpose.ALL;
44 USE lpp.lpp_lfr_time_management.ALL;
44 USE lpp.lpp_lfr_time_management.ALL;
45 USE lpp.lpp_leon3_soc_pkg.ALL;
45 USE lpp.lpp_leon3_soc_pkg.ALL;
46 USE lpp.lpp_debug_lfr_pkg.ALL;
46
47
47 ENTITY MINI_LFR_top IS
48 ENTITY MINI_LFR_top IS
48
49
@@ -212,8 +213,6 BEGIN -- beh
212 nCTS2 <= '1';
213 nCTS2 <= '1';
213 nDCD2 <= '1';
214 nDCD2 <= '1';
214
215
215 --EXT CONNECTOR
216
217 --SPACE WIRE
216 --SPACE WIRE
218 SPW_EN <= '0'; -- 0 => off
217 SPW_EN <= '0'; -- 0 => off
219
218
@@ -225,6 +224,24 BEGIN -- beh
225 ADC_nCS <= '0';
224 ADC_nCS <= '0';
226 ADC_CLK <= '0';
225 ADC_CLK <= '0';
227
226
227
228 -----------------------------------------------------------------------------
229 lpp_debug_dma_singleOrBurst_1: lpp_debug_dma_singleOrBurst
230 GENERIC MAP (
231 tech => apa3e,
232 hindex => 1,
233 pindex => 5,
234 paddr => 5,
235 pmask => 16#fff#)
236 PORT MAP (
237 HCLK => clk_25,
238 HRESETn => reset ,
239 ahbmi => ahbi_m_ext ,
240 ahbmo => ahbo_m_ext(1),
241 apbi => apbi_ext,
242 apbo => apbo_ext(5));
243
244 -----------------------------------------------------------------------------
228
245
229 leon3_soc_1: leon3_soc
246 leon3_soc_1: leon3_soc
230 GENERIC MAP (
247 GENERIC MAP (
@@ -272,4 +289,4 BEGIN -- beh
272 ahbi_m_ext => ahbi_m_ext,
289 ahbi_m_ext => ahbi_m_ext,
273 ahbo_m_ext => ahbo_m_ext);
290 ahbo_m_ext => ahbo_m_ext);
274
291
275 END beh;
292 END beh; No newline at end of file
@@ -22,3 +22,4
22 ./lpp_top_lfr
22 ./lpp_top_lfr
23 ./lpp_Header
23 ./lpp_Header
24 ./lpp_leon3_soc
24 ./lpp_leon3_soc
25 ./lpp_debug_lfr
@@ -37,5 +37,7 PACKAGE apb_devices_list IS
37 CONSTANT LPP_DMA_TYPE : amba_device_type := 16#17#;
37 CONSTANT LPP_DMA_TYPE : amba_device_type := 16#17#;
38 CONSTANT LPP_BOOTLOADER_TYPE : amba_device_type := 16#18#;
38 CONSTANT LPP_BOOTLOADER_TYPE : amba_device_type := 16#18#;
39 CONSTANT LPP_LFR : amba_device_type := 16#19#;
39 CONSTANT LPP_LFR : amba_device_type := 16#19#;
40
41 CONSTANT LPP_DEBUG_DMA : amba_device_type := 16#A0#;
40
42
41 END;
43 END;
1 NO CONTENT: file was removed
NO CONTENT: file was removed
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now