@@ -1,168 +1,168 | |||||
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 | USE grlib.stdlib.ALL; |
|
27 | USE grlib.stdlib.ALL; | |
28 | USE grlib.devices.ALL; |
|
28 | USE grlib.devices.ALL; | |
29 | USE GRLIB.DMA2AHB_Package.ALL; |
|
29 | USE GRLIB.DMA2AHB_Package.ALL; | |
30 | --USE GRLIB.DMA2AHB_TestPackage.ALL; |
|
30 | ||
31 | LIBRARY lpp; |
|
31 | LIBRARY lpp; | |
32 | USE lpp.lpp_amba.ALL; |
|
32 | USE lpp.lpp_amba.ALL; | |
33 | USE lpp.apb_devices_list.ALL; |
|
33 | USE lpp.apb_devices_list.ALL; | |
34 | USE lpp.lpp_memory.ALL; |
|
34 | USE lpp.lpp_memory.ALL; | |
35 | LIBRARY techmap; |
|
35 | LIBRARY techmap; | |
36 | USE techmap.gencomp.ALL; |
|
36 | USE techmap.gencomp.ALL; | |
37 |
|
37 | |||
38 | ENTITY fifo_test_dma IS |
|
38 | ENTITY fifo_test_dma IS | |
39 | GENERIC ( |
|
39 | GENERIC ( | |
40 | tech : INTEGER := apa3; |
|
40 | tech : INTEGER := apa3; | |
41 | pindex : INTEGER := 0; |
|
41 | pindex : INTEGER := 0; | |
42 | paddr : INTEGER := 0; |
|
42 | paddr : INTEGER := 0; | |
43 | pmask : INTEGER := 16#fff# |
|
43 | pmask : INTEGER := 16#fff# | |
44 | ); |
|
44 | ); | |
45 | PORT ( |
|
45 | PORT ( | |
46 | -- AMBA AHB system signals |
|
46 | -- AMBA AHB system signals | |
47 | HCLK : IN STD_ULOGIC; |
|
47 | HCLK : IN STD_ULOGIC; | |
48 | HRESETn : IN STD_ULOGIC; |
|
48 | HRESETn : IN STD_ULOGIC; | |
49 |
|
49 | |||
50 | -- AMBA APB Slave Interface |
|
50 | -- AMBA APB Slave Interface | |
51 | apbi : IN apb_slv_in_type; |
|
51 | apbi : IN apb_slv_in_type; | |
52 | apbo : OUT apb_slv_out_type; |
|
52 | apbo : OUT apb_slv_out_type; | |
53 |
|
53 | |||
54 | -- FIFO Read interface |
|
54 | -- FIFO Read interface | |
55 | fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
55 | fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
56 | fifo_empty : OUT STD_LOGIC; |
|
56 | fifo_empty : OUT STD_LOGIC; | |
57 | fifo_ren : IN STD_LOGIC; |
|
57 | fifo_ren : IN STD_LOGIC; | |
58 |
|
58 | |||
59 | -- header |
|
59 | -- header | |
60 | header : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
60 | header : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
61 | header_val : OUT STD_LOGIC; |
|
61 | header_val : OUT STD_LOGIC; | |
62 | header_ack : IN STD_LOGIC |
|
62 | header_ack : IN STD_LOGIC | |
63 | ); |
|
63 | ); | |
64 | END; |
|
64 | END; | |
65 |
|
65 | |||
66 | ARCHITECTURE Behavioral OF fifo_test_dma IS |
|
66 | ARCHITECTURE Behavioral OF fifo_test_dma IS | |
67 | CONSTANT REVISION : INTEGER := 1; |
|
67 | CONSTANT REVISION : INTEGER := 1; | |
68 | CONSTANT pconfig : apb_config_type := ( |
|
68 | CONSTANT pconfig : apb_config_type := ( | |
69 | 0 => ahb_device_reg (VENDOR_LPP, 0 , 0, REVISION, 0), |
|
69 | 0 => ahb_device_reg (VENDOR_LPP, 0 , 0, REVISION, 0), | |
70 | 1 => apb_iobar(paddr, pmask)); |
|
70 | 1 => apb_iobar(paddr, pmask)); | |
71 |
|
71 | |||
72 | TYPE lpp_test_dma_regs IS RECORD |
|
72 | TYPE lpp_test_dma_regs IS RECORD | |
73 | tt : STD_LOGIC; |
|
73 | tt : STD_LOGIC; | |
74 | END RECORD; |
|
74 | END RECORD; | |
75 | SIGNAL reg : lpp_test_dma_regs; |
|
75 | SIGNAL reg : lpp_test_dma_regs; | |
76 |
|
76 | |||
77 | SIGNAL prdata : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
77 | SIGNAL prdata : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
78 | ----------------------------------------------------------------------------- |
|
78 | ----------------------------------------------------------------------------- | |
79 | SIGNAL fifo_empty_s : STD_LOGIC; |
|
79 | SIGNAL fifo_empty_s : STD_LOGIC; | |
80 | SIGNAL fifo_raddr : STD_LOGIC_VECTOR(7 DOWNTO 0); |
|
80 | SIGNAL fifo_raddr : STD_LOGIC_VECTOR(7 DOWNTO 0); | |
81 | SIGNAL fifo_wen : STD_LOGIC; |
|
81 | SIGNAL fifo_wen : STD_LOGIC; | |
82 | SIGNAL fifo_wdata : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
82 | SIGNAL fifo_wdata : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
83 | SIGNAL fifo_full : STD_LOGIC; |
|
83 | SIGNAL fifo_full : STD_LOGIC; | |
84 | SIGNAL fifo_waddr : STD_LOGIC_VECTOR(7 DOWNTO 0); |
|
84 | SIGNAL fifo_waddr : STD_LOGIC_VECTOR(7 DOWNTO 0); | |
85 | ----------------------------------------------------------------------------- |
|
85 | ----------------------------------------------------------------------------- | |
86 | SIGNAL fifo_nb_data : STD_LOGIC_VECTOR( 7 DOWNTO 0); |
|
86 | SIGNAL fifo_nb_data : STD_LOGIC_VECTOR( 7 DOWNTO 0); | |
87 | SIGNAL fifo_nb_data_s : STD_LOGIC_VECTOR( 7 DOWNTO 0); |
|
87 | SIGNAL fifo_nb_data_s : STD_LOGIC_VECTOR( 7 DOWNTO 0); | |
88 | ----------------------------------------------------------------------------- |
|
88 | ----------------------------------------------------------------------------- | |
89 | SIGNAL header_s : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
89 | SIGNAL header_s : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
90 | SIGNAL header_val_s : STD_LOGIC; |
|
90 | SIGNAL header_val_s : STD_LOGIC; | |
91 | BEGIN |
|
91 | BEGIN | |
92 |
|
92 | |||
93 | lpp_fifo_i : lpp_fifo |
|
93 | lpp_fifo_i : lpp_fifo | |
94 | GENERIC MAP ( |
|
94 | GENERIC MAP ( | |
95 | tech => tech, |
|
95 | tech => tech, | |
96 | Enable_ReUse => '0', |
|
96 | Enable_ReUse => '0', | |
97 | DataSz => 32, |
|
97 | DataSz => 32, | |
98 | abits => 8) |
|
98 | abits => 8) | |
99 | PORT MAP ( |
|
99 | PORT MAP ( | |
100 | rstn => HRESETn, |
|
100 | rstn => HRESETn, | |
101 | ReUse => '0', |
|
101 | ReUse => '0', | |
102 |
|
102 | |||
103 | rclk => HCLK, |
|
103 | rclk => HCLK, | |
104 | ren => fifo_ren, |
|
104 | ren => fifo_ren, | |
105 | rdata => fifo_data, |
|
105 | rdata => fifo_data, | |
106 | empty => fifo_empty_s, |
|
106 | empty => fifo_empty_s, | |
107 | raddr => fifo_raddr, |
|
107 | raddr => fifo_raddr, | |
108 |
|
108 | |||
109 | wclk => HCLK, |
|
109 | wclk => HCLK, | |
110 | wen => fifo_wen, |
|
110 | wen => fifo_wen, | |
111 | wdata => fifo_wdata, |
|
111 | wdata => fifo_wdata, | |
112 | full => fifo_full, |
|
112 | full => fifo_full, | |
113 | waddr => fifo_waddr); -- OUT |
|
113 | waddr => fifo_waddr); -- OUT | |
114 |
|
114 | |||
115 | fifo_nb_data_s(7) <= '1' WHEN (fifo_waddr < fifo_raddr) ELSE '0'; |
|
115 | fifo_nb_data_s(7) <= '1' WHEN (fifo_waddr < fifo_raddr) ELSE '0'; | |
116 | fifo_nb_data_s(6 DOWNTO 0) <= (OTHERS => '0'); |
|
116 | fifo_nb_data_s(6 DOWNTO 0) <= (OTHERS => '0'); | |
117 | fifo_nb_data <= (fifo_waddr - fifo_raddr) + fifo_nb_data_s; |
|
117 | fifo_nb_data <= (fifo_waddr - fifo_raddr) + fifo_nb_data_s; | |
118 |
|
118 | |||
119 | fifo_empty <= fifo_empty_s; |
|
119 | fifo_empty <= fifo_empty_s; | |
120 | header <= header_s; |
|
120 | header <= header_s; | |
121 | header_val <= header_val_s; |
|
121 | header_val <= header_val_s; | |
122 | ----------------------------------------------------------------------------- |
|
122 | ----------------------------------------------------------------------------- | |
123 |
|
123 | |||
124 | apb_reg_p : PROCESS (HCLK, HRESETn) |
|
124 | apb_reg_p : PROCESS (HCLK, HRESETn) | |
125 | VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2); |
|
125 | VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2); | |
126 | BEGIN -- PROCESS lpp_dma_top |
|
126 | BEGIN -- PROCESS lpp_dma_top | |
127 | IF HRESETn = '0' THEN -- asynchronous reset (active low) |
|
127 | IF HRESETn = '0' THEN -- asynchronous reset (active low) | |
128 | prdata <= (OTHERS => '0'); |
|
128 | prdata <= (OTHERS => '0'); | |
129 | fifo_wdata <= (OTHERS => '0'); |
|
129 | fifo_wdata <= (OTHERS => '0'); | |
130 | fifo_wen <= '1'; |
|
130 | fifo_wen <= '1'; | |
131 | header_val_s <= '0'; |
|
131 | header_val_s <= '0'; | |
132 | header_s <= (OTHERS => '0'); |
|
132 | header_s <= (OTHERS => '0'); | |
133 | ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge |
|
133 | ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge | |
134 | paddr := "000000"; |
|
134 | paddr := "000000"; | |
135 | paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2); |
|
135 | paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2); | |
136 | fifo_wen <= '1'; |
|
136 | fifo_wen <= '1'; | |
137 | header_val_s <= header_val_s AND (NOT header_ack); |
|
137 | header_val_s <= header_val_s AND (NOT header_ack); | |
138 | IF (apbi.psel(pindex)) = '1' THEN |
|
138 | IF (apbi.psel(pindex)) = '1' THEN | |
139 | -- APB DMA READ -- |
|
139 | -- APB DMA READ -- | |
140 | CASE paddr(7 DOWNTO 2) IS |
|
140 | CASE paddr(7 DOWNTO 2) IS | |
141 | WHEN "000000" => prdata( 7 DOWNTO 0) <= fifo_waddr; |
|
141 | WHEN "000000" => prdata( 7 DOWNTO 0) <= fifo_waddr; | |
142 | prdata(15 DOWNTO 8) <= fifo_raddr; |
|
142 | prdata(15 DOWNTO 8) <= fifo_raddr; | |
143 | prdata(23 DOWNTO 16) <= fifo_nb_data; |
|
143 | prdata(23 DOWNTO 16) <= fifo_nb_data; | |
144 | prdata(24) <= fifo_full; |
|
144 | prdata(24) <= fifo_full; | |
145 | prdata(25) <= fifo_empty_s; |
|
145 | prdata(25) <= fifo_empty_s; | |
146 | WHEN "000001" => prdata(31 DOWNTO 0) <= header_s; |
|
146 | WHEN "000001" => prdata(31 DOWNTO 0) <= header_s; | |
147 |
|
147 | |||
148 | WHEN OTHERS => prdata <= (OTHERS => '0'); |
|
148 | WHEN OTHERS => prdata <= (OTHERS => '0'); | |
149 | END CASE; |
|
149 | END CASE; | |
150 | IF (apbi.pwrite AND apbi.penable) = '1' THEN |
|
150 | IF (apbi.pwrite AND apbi.penable) = '1' THEN | |
151 | -- APB DMA WRITE -- |
|
151 | -- APB DMA WRITE -- | |
152 | CASE paddr(7 DOWNTO 2) IS |
|
152 | CASE paddr(7 DOWNTO 2) IS | |
153 | WHEN "000000" => fifo_wdata <= apbi.pwdata; |
|
153 | WHEN "000000" => fifo_wdata <= apbi.pwdata; | |
154 | fifo_wen <= '0'; |
|
154 | fifo_wen <= '0'; | |
155 | WHEN "000001" => header_s <= apbi.pwdata; |
|
155 | WHEN "000001" => header_s <= apbi.pwdata; | |
156 | header_val_s <= '1'; |
|
156 | header_val_s <= '1'; | |
157 | WHEN OTHERS => NULL; |
|
157 | WHEN OTHERS => NULL; | |
158 | END CASE; |
|
158 | END CASE; | |
159 | END IF; |
|
159 | END IF; | |
160 | END IF; |
|
160 | END IF; | |
161 | END IF; |
|
161 | END IF; | |
162 | END PROCESS apb_reg_p; |
|
162 | END PROCESS apb_reg_p; | |
163 | apbo.pirq <= (OTHERS => '0'); |
|
163 | apbo.pirq <= (OTHERS => '0'); | |
164 | apbo.pindex <= pindex; |
|
164 | apbo.pindex <= pindex; | |
165 | apbo.pconfig <= pconfig; |
|
165 | apbo.pconfig <= pconfig; | |
166 | apbo.prdata <= prdata; |
|
166 | apbo.prdata <= prdata; | |
167 |
|
167 | |||
168 | END Behavioral; |
|
168 | END Behavioral; |
@@ -1,366 +1,387 | |||||
1 | ------------------------------------------------------------------------------ |
|
1 | ------------------------------------------------------------------------------ | |
2 | -- This file is a part of the LPP VHDL IP LIBRARY |
|
2 | -- This file is a part of the LPP VHDL IP LIBRARY | |
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS |
|
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 3 of the License, or |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | ------------------------------------------------------------------------------- |
|
18 | ------------------------------------------------------------------------------- | |
19 | -- Author : Jean-christophe Pellion |
|
19 | -- Author : Jean-christophe Pellion | |
20 | -- Mail : jean-christophe.pellion@lpp.polytechnique.fr |
|
20 | -- Mail : jean-christophe.pellion@lpp.polytechnique.fr | |
21 | -- jean-christophe.pellion@easii-ic.com |
|
21 | -- jean-christophe.pellion@easii-ic.com | |
22 | ---------------------------------------------------------------------------- |
|
22 | ---------------------------------------------------------------------------- | |
23 | LIBRARY ieee; |
|
23 | LIBRARY ieee; | |
24 | USE ieee.std_logic_1164.ALL; |
|
24 | USE ieee.std_logic_1164.ALL; | |
25 | USE ieee.numeric_std.ALL; |
|
25 | USE ieee.numeric_std.ALL; | |
26 | LIBRARY grlib; |
|
26 | LIBRARY grlib; | |
27 | USE grlib.amba.ALL; |
|
27 | USE grlib.amba.ALL; | |
28 | USE grlib.stdlib.ALL; |
|
28 | USE grlib.stdlib.ALL; | |
29 | USE grlib.devices.ALL; |
|
29 | USE grlib.devices.ALL; | |
30 | USE GRLIB.DMA2AHB_Package.ALL; |
|
30 | USE GRLIB.DMA2AHB_Package.ALL; | |
31 | --USE GRLIB.DMA2AHB_TestPackage.ALL; |
|
31 | ||
32 | LIBRARY lpp; |
|
32 | LIBRARY lpp; | |
33 | USE lpp.lpp_amba.ALL; |
|
33 | USE lpp.lpp_amba.ALL; | |
34 | USE lpp.apb_devices_list.ALL; |
|
34 | USE lpp.apb_devices_list.ALL; | |
35 | USE lpp.lpp_memory.ALL; |
|
35 | USE lpp.lpp_memory.ALL; | |
36 | USE lpp.lpp_dma_pkg.ALL; |
|
36 | USE lpp.lpp_dma_pkg.ALL; | |
37 | LIBRARY techmap; |
|
37 | LIBRARY techmap; | |
38 | USE techmap.gencomp.ALL; |
|
38 | USE techmap.gencomp.ALL; | |
39 |
|
39 | |||
40 |
|
40 | |||
41 | ENTITY lpp_dma IS |
|
41 | ENTITY lpp_dma IS | |
42 | GENERIC ( |
|
42 | GENERIC ( | |
43 | tech : INTEGER := inferred; |
|
43 | tech : INTEGER := inferred; | |
44 | hindex : INTEGER := 2; |
|
44 | hindex : INTEGER := 2; | |
45 | pindex : INTEGER := 4; |
|
45 | pindex : INTEGER := 4; | |
46 | paddr : INTEGER := 4; |
|
46 | paddr : INTEGER := 4; | |
47 | pmask : INTEGER := 16#fff#; |
|
47 | pmask : INTEGER := 16#fff#; | |
48 | pirq : INTEGER := 0); |
|
48 | pirq : INTEGER := 0); | |
49 | PORT ( |
|
49 | PORT ( | |
50 | -- AMBA AHB system signals |
|
50 | -- AMBA AHB system signals | |
51 | HCLK : IN STD_ULOGIC; |
|
51 | HCLK : IN STD_ULOGIC; | |
52 | HRESETn : IN STD_ULOGIC; |
|
52 | HRESETn : IN STD_ULOGIC; | |
53 |
|
53 | |||
54 | -- AMBA APB Slave Interface |
|
54 | -- AMBA APB Slave Interface | |
55 | apbi : IN apb_slv_in_type; |
|
55 | apbi : IN apb_slv_in_type; | |
56 | apbo : OUT apb_slv_out_type; |
|
56 | apbo : OUT apb_slv_out_type; | |
57 |
|
57 | |||
58 | -- AMBA AHB Master Interface |
|
58 | -- AMBA AHB Master Interface | |
59 | AHB_Master_In : IN AHB_Mst_In_Type; |
|
59 | AHB_Master_In : IN AHB_Mst_In_Type; | |
60 | AHB_Master_Out : OUT AHB_Mst_Out_Type; |
|
60 | AHB_Master_Out : OUT AHB_Mst_Out_Type; | |
61 |
|
61 | |||
62 | -- fifo interface |
|
62 | -- fifo interface | |
63 | fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
63 | fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
64 | fifo_empty : IN STD_LOGIC; |
|
64 | fifo_empty : IN STD_LOGIC; | |
65 | fifo_ren : OUT STD_LOGIC; |
|
65 | fifo_ren : OUT STD_LOGIC; | |
66 |
|
66 | |||
67 | -- header |
|
67 | -- header | |
68 | header : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
68 | header : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
69 | header_val : IN STD_LOGIC; |
|
69 | header_val : IN STD_LOGIC; | |
70 | header_ack : OUT STD_LOGIC |
|
70 | header_ack : OUT STD_LOGIC | |
71 | ); |
|
71 | ); | |
72 | END; |
|
72 | END; | |
73 |
|
73 | |||
74 | ARCHITECTURE Behavioral OF lpp_dma IS |
|
74 | ARCHITECTURE Behavioral OF lpp_dma IS | |
75 | ----------------------------------------------------------------------------- |
|
75 | ----------------------------------------------------------------------------- | |
76 | SIGNAL DMAIn : DMA_In_Type; |
|
76 | SIGNAL DMAIn : DMA_In_Type; | |
77 | SIGNAL header_dmai : DMA_In_Type; |
|
77 | SIGNAL header_dmai : DMA_In_Type; | |
78 | SIGNAL component_dmai : DMA_In_Type; |
|
78 | SIGNAL component_dmai : DMA_In_Type; | |
79 | SIGNAL DMAOut : DMA_OUt_Type; |
|
79 | SIGNAL DMAOut : DMA_OUt_Type; | |
80 |
|
80 | |||
81 | SIGNAL ready_matrix_f0_0 : STD_LOGIC; |
|
81 | SIGNAL ready_matrix_f0_0 : STD_LOGIC; | |
82 | SIGNAL ready_matrix_f0_1 : STD_LOGIC; |
|
82 | SIGNAL ready_matrix_f0_1 : STD_LOGIC; | |
83 | SIGNAL ready_matrix_f1 : STD_LOGIC; |
|
83 | SIGNAL ready_matrix_f1 : STD_LOGIC; | |
84 | SIGNAL ready_matrix_f2 : STD_LOGIC; |
|
84 | SIGNAL ready_matrix_f2 : STD_LOGIC; | |
85 | SIGNAL error_anticipating_empty_fifo : STD_LOGIC; |
|
85 | SIGNAL error_anticipating_empty_fifo : STD_LOGIC; | |
86 | SIGNAL error_bad_component_error : STD_LOGIC; |
|
86 | SIGNAL error_bad_component_error : STD_LOGIC; | |
87 |
|
87 | |||
88 | SIGNAL config_active_interruption_onNewMatrix : STD_LOGIC; |
|
88 | SIGNAL config_active_interruption_onNewMatrix : STD_LOGIC; | |
89 | SIGNAL config_active_interruption_onError : STD_LOGIC; |
|
89 | SIGNAL config_active_interruption_onError : STD_LOGIC; | |
90 | SIGNAL status_ready_matrix_f0_0 : STD_LOGIC; |
|
90 | SIGNAL status_ready_matrix_f0_0 : STD_LOGIC; | |
91 | SIGNAL status_ready_matrix_f0_1 : STD_LOGIC; |
|
91 | SIGNAL status_ready_matrix_f0_1 : STD_LOGIC; | |
92 | SIGNAL status_ready_matrix_f1 : STD_LOGIC; |
|
92 | SIGNAL status_ready_matrix_f1 : STD_LOGIC; | |
93 | SIGNAL status_ready_matrix_f2 : STD_LOGIC; |
|
93 | SIGNAL status_ready_matrix_f2 : STD_LOGIC; | |
94 | SIGNAL status_error_anticipating_empty_fifo : STD_LOGIC; |
|
94 | SIGNAL status_error_anticipating_empty_fifo : STD_LOGIC; | |
95 | SIGNAL status_error_bad_component_error : STD_LOGIC; |
|
95 | SIGNAL status_error_bad_component_error : STD_LOGIC; | |
96 | SIGNAL addr_matrix_f0_0 : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
96 | SIGNAL addr_matrix_f0_0 : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
97 | SIGNAL addr_matrix_f0_1 : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
97 | SIGNAL addr_matrix_f0_1 : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
98 | SIGNAL addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
98 | SIGNAL addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
99 | SIGNAL addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
99 | SIGNAL addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
100 | ----------------------------------------------------------------------------- |
|
100 | ----------------------------------------------------------------------------- | |
101 |
|
101 | |||
102 | ----------------------------------------------------------------------------- |
|
102 | ----------------------------------------------------------------------------- | |
103 | ----------------------------------------------------------------------------- |
|
103 | ----------------------------------------------------------------------------- | |
104 | TYPE state_DMAWriteBurst IS (IDLE, |
|
104 | TYPE state_DMAWriteBurst IS (IDLE, | |
105 | TRASH_FIFO, |
|
105 | TRASH_FIFO, | |
106 | WAIT_HEADER_ACK, |
|
106 | WAIT_HEADER_ACK, | |
107 | SEND_DATA, |
|
107 | SEND_DATA, | |
108 | WAIT_DATA_ACK, |
|
108 | WAIT_DATA_ACK, | |
109 | CHECK_LENGTH |
|
109 | CHECK_LENGTH | |
110 | ); |
|
110 | ); | |
111 | SIGNAL state : state_DMAWriteBurst := IDLE; |
|
111 | SIGNAL state : state_DMAWriteBurst := IDLE; | |
112 |
|
112 | |||
113 | SIGNAL nbSend : INTEGER; |
|
113 | SIGNAL nbSend : INTEGER; | |
114 | SIGNAL matrix_type : STD_LOGIC_VECTOR(1 DOWNTO 0); |
|
114 | SIGNAL matrix_type : STD_LOGIC_VECTOR(1 DOWNTO 0); | |
115 | SIGNAL component_type : STD_LOGIC_VECTOR(3 DOWNTO 0); |
|
115 | SIGNAL component_type : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
116 | SIGNAL component_type_pre : STD_LOGIC_VECTOR(3 DOWNTO 0); |
|
116 | SIGNAL component_type_pre : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
117 | SIGNAL header_check_ok : STD_LOGIC; |
|
117 | SIGNAL header_check_ok : STD_LOGIC; | |
118 | SIGNAL address_matrix : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
118 | SIGNAL address_matrix : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
119 | SIGNAL send_matrix : STD_LOGIC; |
|
119 | SIGNAL send_matrix : STD_LOGIC; | |
120 | SIGNAL request : STD_LOGIC; |
|
120 | SIGNAL request : STD_LOGIC; | |
121 | SIGNAL remaining_data_request : INTEGER; |
|
121 | SIGNAL remaining_data_request : INTEGER; | |
122 | SIGNAL Address : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
122 | SIGNAL Address : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
123 | ----------------------------------------------------------------------------- |
|
123 | ----------------------------------------------------------------------------- | |
124 | ----------------------------------------------------------------------------- |
|
124 | ----------------------------------------------------------------------------- | |
125 | SIGNAL header_select : STD_LOGIC; |
|
125 | SIGNAL header_select : STD_LOGIC; | |
126 |
|
126 | |||
127 | SIGNAL header_send : STD_LOGIC; |
|
127 | SIGNAL header_send : STD_LOGIC; | |
128 | SIGNAL header_data : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
128 | SIGNAL header_data : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
129 | SIGNAL header_send_ok : STD_LOGIC; |
|
129 | SIGNAL header_send_ok : STD_LOGIC; | |
130 | SIGNAL header_send_ko : STD_LOGIC; |
|
130 | SIGNAL header_send_ko : STD_LOGIC; | |
131 |
|
131 | |||
132 | SIGNAL component_send : STD_LOGIC; |
|
132 | SIGNAL component_send : STD_LOGIC; | |
133 | SIGNAL component_send_ok : STD_LOGIC; |
|
133 | SIGNAL component_send_ok : STD_LOGIC; | |
134 | SIGNAL component_send_ko : STD_LOGIC; |
|
134 | SIGNAL component_send_ko : STD_LOGIC; | |
135 | ----------------------------------------------------------------------------- |
|
135 | ----------------------------------------------------------------------------- | |
136 | SIGNAL fifo_ren_trash : STD_LOGIC; |
|
136 | SIGNAL fifo_ren_trash : STD_LOGIC; | |
137 | SIGNAL component_fifo_ren : STD_LOGIC; |
|
137 | SIGNAL component_fifo_ren : STD_LOGIC; | |
138 |
|
138 | |||
|
139 | SIGNAL debug_reg : STD_LOGIC_VECTOR(31 DOWNTO 0); | |||
|
140 | ||||
139 | BEGIN |
|
141 | BEGIN | |
140 |
|
142 | |||
141 | ----------------------------------------------------------------------------- |
|
143 | ----------------------------------------------------------------------------- | |
142 | -- DMA to AHB interface |
|
144 | -- DMA to AHB interface | |
143 | ----------------------------------------------------------------------------- |
|
145 | ----------------------------------------------------------------------------- | |
144 |
|
146 | |||
145 | DMA2AHB_1 : DMA2AHB |
|
147 | DMA2AHB_1 : DMA2AHB | |
146 | GENERIC MAP ( |
|
148 | GENERIC MAP ( | |
147 | hindex => hindex, |
|
149 | hindex => hindex, | |
148 | vendorid => VENDOR_LPP, |
|
150 | vendorid => VENDOR_LPP, | |
149 | deviceid => 0, |
|
151 | deviceid => 0, | |
150 | version => 0, |
|
152 | version => 0, | |
151 | syncrst => 1, |
|
153 | syncrst => 1, | |
152 | boundary => 0) |
|
154 | boundary => 1) -- set TO TEST | |
153 | PORT MAP ( |
|
155 | PORT MAP ( | |
154 | HCLK => HCLK, |
|
156 | HCLK => HCLK, | |
155 | HRESETn => HRESETn, |
|
157 | HRESETn => HRESETn, | |
156 | DMAIn => DMAIn, |
|
158 | DMAIn => DMAIn, | |
157 | DMAOut => DMAOut, |
|
159 | DMAOut => DMAOut, | |
158 | AHBIn => AHB_Master_In, |
|
160 | AHBIn => AHB_Master_In, | |
159 | AHBOut => AHB_Master_Out); |
|
161 | AHBOut => AHB_Master_Out); | |
160 |
|
162 | |||
|
163 | ||||
|
164 | debug_info: PROCESS (HCLK, HRESETn) | |||
|
165 | BEGIN -- PROCESS debug_info | |||
|
166 | IF HRESETn = '0' THEN -- asynchronous reset (active low) | |||
|
167 | debug_reg <= (OTHERS => '0'); | |||
|
168 | ELSIF HCLK'event AND HCLK = '1' THEN -- rising clock edge | |||
|
169 | debug_reg(0) <= debug_reg(0) OR (DMAOut.Retry ); | |||
|
170 | debug_reg(1) <= debug_reg(1) OR (DMAOut.Grant AND DMAOut.Retry) ; | |||
|
171 | IF state = TRASH_FIFO THEN debug_reg(2) <= '1'; END IF; | |||
|
172 | debug_reg(3) <= debug_reg(3) OR (header_send_ko); | |||
|
173 | debug_reg(4) <= debug_reg(4) OR (header_send_ok); | |||
|
174 | debug_reg(5) <= debug_reg(5) OR (component_send_ko); | |||
|
175 | debug_reg(6) <= debug_reg(6) OR (component_send_ok); | |||
|
176 | ||||
|
177 | debug_reg(31 DOWNTO 7) <= (OTHERS => '1'); | |||
|
178 | END IF; | |||
|
179 | END PROCESS debug_info; | |||
|
180 | ||||
|
181 | ||||
161 |
|
|
182 | matrix_type <= header(1 DOWNTO 0); | |
162 | component_type <= header(5 DOWNTO 2); |
|
183 | component_type <= header(5 DOWNTO 2); | |
163 |
|
184 | |||
164 | send_matrix <= '1' WHEN matrix_type = "00" AND status_ready_matrix_f0_0 = '0' ELSE |
|
185 | send_matrix <= '1' WHEN matrix_type = "00" AND status_ready_matrix_f0_0 = '0' ELSE | |
165 | '1' WHEN matrix_type = "01" AND status_ready_matrix_f0_1 = '0' ELSE |
|
186 | '1' WHEN matrix_type = "01" AND status_ready_matrix_f0_1 = '0' ELSE | |
166 | '1' WHEN matrix_type = "10" AND status_ready_matrix_f1 = '0' ELSE |
|
187 | '1' WHEN matrix_type = "10" AND status_ready_matrix_f1 = '0' ELSE | |
167 | '1' WHEN matrix_type = "11" AND status_ready_matrix_f2 = '0' ELSE |
|
188 | '1' WHEN matrix_type = "11" AND status_ready_matrix_f2 = '0' ELSE | |
168 | '0'; |
|
189 | '0'; | |
169 |
|
190 | |||
170 | header_check_ok <= '0' WHEN component_type = "1111" ELSE |
|
191 | header_check_ok <= '0' WHEN component_type = "1111" ELSE | |
171 | '1' WHEN component_type = "0000" AND component_type_pre = "1110" ELSE |
|
192 | '1' WHEN component_type = "0000" AND component_type_pre = "1110" ELSE | |
172 | '1' WHEN component_type = component_type_pre + "0001" ELSE |
|
193 | '1' WHEN component_type = component_type_pre + "0001" ELSE | |
173 | '0'; |
|
194 | '0'; | |
174 |
|
195 | |||
175 | address_matrix <= addr_matrix_f0_0 WHEN matrix_type = "00" ELSE |
|
196 | address_matrix <= addr_matrix_f0_0 WHEN matrix_type = "00" ELSE | |
176 | addr_matrix_f0_1 WHEN matrix_type = "01" ELSE |
|
197 | addr_matrix_f0_1 WHEN matrix_type = "01" ELSE | |
177 | addr_matrix_f1 WHEN matrix_type = "10" ELSE |
|
198 | addr_matrix_f1 WHEN matrix_type = "10" ELSE | |
178 | addr_matrix_f2 WHEN matrix_type = "11" ELSE |
|
199 | addr_matrix_f2 WHEN matrix_type = "11" ELSE | |
179 | (OTHERS => '0'); |
|
200 | (OTHERS => '0'); | |
180 |
|
201 | |||
181 | ----------------------------------------------------------------------------- |
|
202 | ----------------------------------------------------------------------------- | |
182 | -- DMA control |
|
203 | -- DMA control | |
183 | ----------------------------------------------------------------------------- |
|
204 | ----------------------------------------------------------------------------- | |
184 | DMAWriteFSM_p : PROCESS (HCLK, HRESETn) |
|
205 | DMAWriteFSM_p : PROCESS (HCLK, HRESETn) | |
185 | BEGIN -- PROCESS DMAWriteBurst_p |
|
206 | BEGIN -- PROCESS DMAWriteBurst_p | |
186 | IF HRESETn = '0' THEN -- asynchronous reset (active low) |
|
207 | IF HRESETn = '0' THEN -- asynchronous reset (active low) | |
187 | state <= IDLE; |
|
208 | state <= IDLE; | |
188 | header_ack <= '0'; |
|
209 | header_ack <= '0'; | |
189 | ready_matrix_f0_0 <= '0'; |
|
210 | ready_matrix_f0_0 <= '0'; | |
190 | ready_matrix_f0_1 <= '0'; |
|
211 | ready_matrix_f0_1 <= '0'; | |
191 | ready_matrix_f1 <= '0'; |
|
212 | ready_matrix_f1 <= '0'; | |
192 | ready_matrix_f2 <= '0'; |
|
213 | ready_matrix_f2 <= '0'; | |
193 | error_anticipating_empty_fifo <= '0'; |
|
214 | error_anticipating_empty_fifo <= '0'; | |
194 | error_bad_component_error <= '0'; |
|
215 | error_bad_component_error <= '0'; | |
195 | component_type_pre <= "1110"; |
|
216 | component_type_pre <= "1110"; | |
196 | fifo_ren_trash <= '1'; |
|
217 | fifo_ren_trash <= '1'; | |
197 | component_send <= '0'; |
|
218 | component_send <= '0'; | |
198 | address <= (OTHERS => '0'); |
|
219 | address <= (OTHERS => '0'); | |
199 | header_select <= '0'; |
|
220 | header_select <= '0'; | |
200 | ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge |
|
221 | ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge | |
201 |
|
222 | |||
202 | CASE state IS |
|
223 | CASE state IS | |
203 | WHEN IDLE => |
|
224 | WHEN IDLE => | |
204 | ready_matrix_f0_0 <= '0'; |
|
225 | ready_matrix_f0_0 <= '0'; | |
205 | ready_matrix_f0_1 <= '0'; |
|
226 | ready_matrix_f0_1 <= '0'; | |
206 | ready_matrix_f1 <= '0'; |
|
227 | ready_matrix_f1 <= '0'; | |
207 | ready_matrix_f2 <= '0'; |
|
228 | ready_matrix_f2 <= '0'; | |
208 | error_bad_component_error <= '0'; |
|
229 | error_bad_component_error <= '0'; | |
209 | header_select <= '1'; |
|
230 | header_select <= '1'; | |
210 | IF header_val = '1' AND fifo_empty = '0' AND send_matrix = '1' THEN |
|
231 | IF header_val = '1' AND fifo_empty = '0' AND send_matrix = '1' THEN | |
211 | IF header_check_ok = '1' THEN |
|
232 | IF header_check_ok = '1' THEN | |
212 | header_data <= header; |
|
233 | header_data <= header; | |
213 | component_type_pre <= header(5 DOWNTO 2); |
|
234 | component_type_pre <= header(5 DOWNTO 2); | |
214 | header_ack <= '1'; |
|
235 | header_ack <= '1'; | |
215 | -- |
|
236 | -- | |
216 | header_send <= '1'; |
|
237 | header_send <= '1'; | |
217 | IF component_type = "0000" THEN |
|
238 | IF component_type = "0000" THEN | |
218 | address <= address_matrix; |
|
239 | address <= address_matrix; | |
219 | END IF; |
|
240 | END IF; | |
220 | header_data <= header; |
|
241 | header_data <= header; | |
221 | -- |
|
242 | -- | |
222 | state <= WAIT_HEADER_ACK; |
|
243 | state <= WAIT_HEADER_ACK; | |
223 | ELSE |
|
244 | ELSE | |
224 | error_bad_component_error <= '1'; |
|
245 | error_bad_component_error <= '1'; | |
225 | component_type_pre <= "1110"; |
|
246 | component_type_pre <= "1110"; | |
226 | header_ack <= '1'; |
|
247 | header_ack <= '1'; | |
227 | state <= TRASH_FIFO; |
|
248 | state <= TRASH_FIFO; | |
228 | END IF; |
|
249 | END IF; | |
229 | END IF; |
|
250 | END IF; | |
230 |
|
251 | |||
231 | WHEN TRASH_FIFO => |
|
252 | WHEN TRASH_FIFO => | |
232 | error_bad_component_error <= '0'; |
|
253 | error_bad_component_error <= '0'; | |
233 | error_anticipating_empty_fifo <= '0'; |
|
254 | error_anticipating_empty_fifo <= '0'; | |
234 | IF fifo_empty = '1' THEN |
|
255 | IF fifo_empty = '1' THEN | |
235 | state <= IDLE; |
|
256 | state <= IDLE; | |
236 | fifo_ren_trash <= '1'; |
|
257 | fifo_ren_trash <= '1'; | |
237 | ELSE |
|
258 | ELSE | |
238 | fifo_ren_trash <= '0'; |
|
259 | fifo_ren_trash <= '0'; | |
239 | END IF; |
|
260 | END IF; | |
240 |
|
261 | |||
241 | WHEN WAIT_HEADER_ACK => |
|
262 | WHEN WAIT_HEADER_ACK => | |
242 | header_send <= '0'; |
|
263 | header_send <= '0'; | |
243 | IF header_send_ko = '1' THEN |
|
264 | IF header_send_ko = '1' THEN | |
244 | state <= TRASH_FIFO; |
|
265 | state <= TRASH_FIFO; | |
245 | error_anticipating_empty_fifo <= '1'; |
|
266 | error_anticipating_empty_fifo <= '1'; | |
246 | -- TODO : error sending header |
|
267 | -- TODO : error sending header | |
247 | ELSIF header_send_ok = '1' THEN |
|
268 | ELSIF header_send_ok = '1' THEN | |
248 | header_select <= '0'; |
|
269 | header_select <= '0'; | |
249 | state <= SEND_DATA; |
|
270 | state <= SEND_DATA; | |
250 | address <= address + 4; |
|
271 | address <= address + 4; | |
251 | END IF; |
|
272 | END IF; | |
252 |
|
273 | |||
253 | WHEN SEND_DATA => |
|
274 | WHEN SEND_DATA => | |
254 | IF fifo_empty = '1' THEN |
|
275 | IF fifo_empty = '1' THEN | |
255 | state <= IDLE; |
|
276 | state <= IDLE; | |
256 | IF component_type = "1110" THEN |
|
277 | IF component_type = "1110" THEN | |
257 | CASE matrix_type IS |
|
278 | CASE matrix_type IS | |
258 | WHEN "00" => ready_matrix_f0_0 <= '1'; |
|
279 | WHEN "00" => ready_matrix_f0_0 <= '1'; | |
259 | WHEN "01" => ready_matrix_f0_1 <= '1'; |
|
280 | WHEN "01" => ready_matrix_f0_1 <= '1'; | |
260 | WHEN "10" => ready_matrix_f1 <= '1'; |
|
281 | WHEN "10" => ready_matrix_f1 <= '1'; | |
261 | WHEN "11" => ready_matrix_f2 <= '1'; |
|
282 | WHEN "11" => ready_matrix_f2 <= '1'; | |
262 | WHEN OTHERS => NULL; |
|
283 | WHEN OTHERS => NULL; | |
263 | END CASE; |
|
284 | END CASE; | |
264 | END IF; |
|
285 | END IF; | |
265 | ELSE |
|
286 | ELSE | |
266 | component_send <= '1'; |
|
287 | component_send <= '1'; | |
267 | address <= address; |
|
288 | address <= address; | |
268 | state <= WAIT_DATA_ACK; |
|
289 | state <= WAIT_DATA_ACK; | |
269 | END IF; |
|
290 | END IF; | |
270 |
|
291 | |||
271 | WHEN WAIT_DATA_ACK => |
|
292 | WHEN WAIT_DATA_ACK => | |
272 | component_send <= '0'; |
|
293 | component_send <= '0'; | |
273 | IF component_send_ok = '1' THEN |
|
294 | IF component_send_ok = '1' THEN | |
274 | address <= address + 64; |
|
295 | address <= address + 64; | |
275 | state <= SEND_DATA; |
|
296 | state <= SEND_DATA; | |
276 | ELSIF component_send_ko = '1' THEN |
|
297 | ELSIF component_send_ko = '1' THEN | |
277 | error_anticipating_empty_fifo <= '0'; |
|
298 | error_anticipating_empty_fifo <= '0'; | |
278 | state <= TRASH_FIFO; |
|
299 | state <= TRASH_FIFO; | |
279 | END IF; |
|
300 | END IF; | |
280 |
|
301 | |||
281 | WHEN CHECK_LENGTH => |
|
302 | WHEN CHECK_LENGTH => | |
282 | state <= IDLE; |
|
303 | state <= IDLE; | |
283 | WHEN OTHERS => NULL; |
|
304 | WHEN OTHERS => NULL; | |
284 | END CASE; |
|
305 | END CASE; | |
285 |
|
306 | |||
286 | END IF; |
|
307 | END IF; | |
287 | END PROCESS DMAWriteFSM_p; |
|
308 | END PROCESS DMAWriteFSM_p; | |
288 |
|
309 | |||
289 | ----------------------------------------------------------------------------- |
|
310 | ----------------------------------------------------------------------------- | |
290 | -- SEND 1 word by DMA |
|
311 | -- SEND 1 word by DMA | |
291 | ----------------------------------------------------------------------------- |
|
312 | ----------------------------------------------------------------------------- | |
292 | lpp_dma_send_1word_1 : lpp_dma_send_1word |
|
313 | lpp_dma_send_1word_1 : lpp_dma_send_1word | |
293 | PORT MAP ( |
|
314 | PORT MAP ( | |
294 | HCLK => HCLK, |
|
315 | HCLK => HCLK, | |
295 | HRESETn => HRESETn, |
|
316 | HRESETn => HRESETn, | |
296 | DMAIn => header_dmai, |
|
317 | DMAIn => header_dmai, | |
297 | DMAOut => DMAOut, |
|
318 | DMAOut => DMAOut, | |
298 |
|
319 | |||
299 | send => header_send, |
|
320 | send => header_send, | |
300 | address => address, |
|
321 | address => address, | |
301 | data => header_data, |
|
322 | data => header_data, | |
302 | send_ok => header_send_ok, |
|
323 | send_ok => header_send_ok, | |
303 | send_ko => header_send_ko |
|
324 | send_ko => header_send_ko | |
304 | ); |
|
325 | ); | |
305 |
|
326 | |||
306 | ----------------------------------------------------------------------------- |
|
327 | ----------------------------------------------------------------------------- | |
307 | -- SEND 16 word by DMA (in burst mode) |
|
328 | -- SEND 16 word by DMA (in burst mode) | |
308 | ----------------------------------------------------------------------------- |
|
329 | ----------------------------------------------------------------------------- | |
309 | lpp_dma_send_16word_1 : lpp_dma_send_16word |
|
330 | lpp_dma_send_16word_1 : lpp_dma_send_16word | |
310 | PORT MAP ( |
|
331 | PORT MAP ( | |
311 | HCLK => HCLK, |
|
332 | HCLK => HCLK, | |
312 | HRESETn => HRESETn, |
|
333 | HRESETn => HRESETn, | |
313 | DMAIn => component_dmai, |
|
334 | DMAIn => component_dmai, | |
314 | DMAOut => DMAOut, |
|
335 | DMAOut => DMAOut, | |
315 |
|
||||
316 | send => component_send, |
|
336 | send => component_send, | |
317 | address => address, |
|
337 | address => address, | |
318 | data => fifo_data, |
|
338 | data => fifo_data, | |
319 | ren => component_fifo_ren, |
|
339 | ren => component_fifo_ren, | |
320 | send_ok => component_send_ok, |
|
340 | send_ok => component_send_ok, | |
321 | send_ko => component_send_ko); |
|
341 | send_ko => component_send_ko); | |
322 |
|
342 | |||
323 | DMAIn <= header_dmai WHEN header_select = '1' ELSE component_dmai; |
|
343 | DMAIn <= header_dmai WHEN header_select = '1' ELSE component_dmai; | |
324 | fifo_ren <= fifo_ren_trash WHEN header_select = '1' ELSE component_fifo_ren; |
|
344 | fifo_ren <= fifo_ren_trash WHEN header_select = '1' ELSE component_fifo_ren; | |
325 |
|
345 | |||
326 |
|
346 | |||
327 | ----------------------------------------------------------------------------- |
|
347 | ----------------------------------------------------------------------------- | |
328 | -- APB REGISTER |
|
348 | -- APB REGISTER | |
329 | ----------------------------------------------------------------------------- |
|
349 | ----------------------------------------------------------------------------- | |
330 |
|
350 | |||
331 | lpp_dma_apbreg_2 : lpp_dma_apbreg |
|
351 | lpp_dma_apbreg_2 : lpp_dma_apbreg | |
332 | GENERIC MAP ( |
|
352 | GENERIC MAP ( | |
333 | pindex => pindex, |
|
353 | pindex => pindex, | |
334 | paddr => paddr, |
|
354 | paddr => paddr, | |
335 | pmask => pmask, |
|
355 | pmask => pmask, | |
336 | pirq => pirq) |
|
356 | pirq => pirq) | |
337 | PORT MAP ( |
|
357 | PORT MAP ( | |
338 | HCLK => HCLK, |
|
358 | HCLK => HCLK, | |
339 | HRESETn => HRESETn, |
|
359 | HRESETn => HRESETn, | |
340 | apbi => apbi, |
|
360 | apbi => apbi, | |
341 | apbo => apbo, |
|
361 | apbo => apbo, | |
342 | -- IN |
|
362 | -- IN | |
343 | ready_matrix_f0_0 => ready_matrix_f0_0, |
|
363 | ready_matrix_f0_0 => ready_matrix_f0_0, | |
344 | ready_matrix_f0_1 => ready_matrix_f0_1, |
|
364 | ready_matrix_f0_1 => ready_matrix_f0_1, | |
345 | ready_matrix_f1 => ready_matrix_f1, |
|
365 | ready_matrix_f1 => ready_matrix_f1, | |
346 |
ready_matrix_f2 => ready_matrix_f2, |
|
366 | ready_matrix_f2 => ready_matrix_f2, | |
347 | error_anticipating_empty_fifo => error_anticipating_empty_fifo, |
|
367 | error_anticipating_empty_fifo => error_anticipating_empty_fifo, | |
348 | error_bad_component_error => error_bad_component_error, |
|
368 | error_bad_component_error => error_bad_component_error, | |
|
369 | -- | |||
|
370 | debug_reg => debug_reg, | |||
349 | -- OUT |
|
371 | -- OUT | |
350 | status_ready_matrix_f0_0 => status_ready_matrix_f0_0, |
|
372 | status_ready_matrix_f0_0 => status_ready_matrix_f0_0, | |
351 | status_ready_matrix_f0_1 => status_ready_matrix_f0_1, |
|
373 | status_ready_matrix_f0_1 => status_ready_matrix_f0_1, | |
352 | status_ready_matrix_f1 => status_ready_matrix_f1, |
|
374 | status_ready_matrix_f1 => status_ready_matrix_f1, | |
353 | status_ready_matrix_f2 => status_ready_matrix_f2, |
|
375 | status_ready_matrix_f2 => status_ready_matrix_f2, | |
354 | status_error_anticipating_empty_fifo => status_error_anticipating_empty_fifo, |
|
376 | status_error_anticipating_empty_fifo => status_error_anticipating_empty_fifo, | |
355 | status_error_bad_component_error => status_error_bad_component_error, |
|
377 | status_error_bad_component_error => status_error_bad_component_error, | |
356 | config_active_interruption_onNewMatrix => config_active_interruption_onNewMatrix, -- TODO |
|
378 | config_active_interruption_onNewMatrix => config_active_interruption_onNewMatrix, -- TODO | |
357 | config_active_interruption_onError => config_active_interruption_onError, -- TODO |
|
379 | config_active_interruption_onError => config_active_interruption_onError, -- TODO | |
358 | addr_matrix_f0_0 => addr_matrix_f0_0, |
|
380 | addr_matrix_f0_0 => addr_matrix_f0_0, | |
359 | addr_matrix_f0_1 => addr_matrix_f0_1, |
|
381 | addr_matrix_f0_1 => addr_matrix_f0_1, | |
360 | addr_matrix_f1 => addr_matrix_f1, |
|
382 | addr_matrix_f1 => addr_matrix_f1, | |
361 | addr_matrix_f2 => addr_matrix_f2); |
|
383 | addr_matrix_f2 => addr_matrix_f2); | |
362 |
|
384 | |||
363 |
|
|
385 | ----------------------------------------------------------------------------- | |
364 |
|
386 | |||
365 | END Behavioral; |
|
387 | END Behavioral; | |
366 |
|
@@ -1,193 +1,198 | |||||
1 | ------------------------------------------------------------------------------ |
|
1 | ------------------------------------------------------------------------------ | |
2 | -- This file is a part of the LPP VHDL IP LIBRARY |
|
2 | -- This file is a part of the LPP VHDL IP LIBRARY | |
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS |
|
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS | |
4 | -- |
|
4 | -- | |
5 | -- This program is free software; you can redistribute it and/or modify |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
6 | -- it under the terms of the GNU General Public License as published by |
|
6 | -- it under the terms of the GNU General Public License as published by | |
7 | -- the Free Software Foundation; either version 3 of the License, or |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
8 | -- (at your option) any later version. |
|
8 | -- (at your option) any later version. | |
9 | -- |
|
9 | -- | |
10 | -- This program is distributed in the hope that it will be useful, |
|
10 | -- This program is distributed in the hope that it will be useful, | |
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | -- GNU General Public License for more details. |
|
13 | -- GNU General Public License for more details. | |
14 | -- |
|
14 | -- | |
15 | -- You should have received a copy of the GNU General Public License |
|
15 | -- You should have received a copy of the GNU General Public License | |
16 | -- along with this program; if not, write to the Free Software |
|
16 | -- along with this program; if not, write to the Free Software | |
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
18 | ------------------------------------------------------------------------------- |
|
18 | ------------------------------------------------------------------------------- | |
19 | -- Author : Jean-christophe Pellion |
|
19 | -- Author : Jean-christophe Pellion | |
20 | -- Mail : jean-christophe.pellion@lpp.polytechnique.fr |
|
20 | -- Mail : jean-christophe.pellion@lpp.polytechnique.fr | |
21 | -- jean-christophe.pellion@easii-ic.com |
|
21 | -- jean-christophe.pellion@easii-ic.com | |
22 | ---------------------------------------------------------------------------- |
|
22 | ---------------------------------------------------------------------------- | |
23 | LIBRARY ieee; |
|
23 | LIBRARY ieee; | |
24 | USE ieee.std_logic_1164.ALL; |
|
24 | USE ieee.std_logic_1164.ALL; | |
25 | USE ieee.numeric_std.ALL; |
|
25 | USE ieee.numeric_std.ALL; | |
26 | LIBRARY grlib; |
|
26 | LIBRARY grlib; | |
27 | USE grlib.amba.ALL; |
|
27 | USE grlib.amba.ALL; | |
28 | USE grlib.stdlib.ALL; |
|
28 | USE grlib.stdlib.ALL; | |
29 | USE grlib.devices.ALL; |
|
29 | USE grlib.devices.ALL; | |
30 | LIBRARY lpp; |
|
30 | LIBRARY lpp; | |
31 | USE lpp.lpp_amba.ALL; |
|
31 | USE lpp.lpp_amba.ALL; | |
32 | USE lpp.apb_devices_list.ALL; |
|
32 | USE lpp.apb_devices_list.ALL; | |
33 | USE lpp.lpp_memory.ALL; |
|
33 | USE lpp.lpp_memory.ALL; | |
34 | LIBRARY techmap; |
|
34 | LIBRARY techmap; | |
35 | USE techmap.gencomp.ALL; |
|
35 | USE techmap.gencomp.ALL; | |
|
36 | ||||
36 | ENTITY lpp_dma_apbreg IS |
|
37 | ENTITY lpp_dma_apbreg IS | |
37 | GENERIC ( |
|
38 | GENERIC ( | |
38 | pindex : INTEGER := 4; |
|
39 | pindex : INTEGER := 4; | |
39 | paddr : INTEGER := 4; |
|
40 | paddr : INTEGER := 4; | |
40 | pmask : INTEGER := 16#fff#; |
|
41 | pmask : INTEGER := 16#fff#; | |
41 | pirq : INTEGER := 0); |
|
42 | pirq : INTEGER := 0); | |
42 | PORT ( |
|
43 | PORT ( | |
43 | -- AMBA AHB system signals |
|
44 | -- AMBA AHB system signals | |
44 | HCLK : IN STD_ULOGIC; |
|
45 | HCLK : IN STD_ULOGIC; | |
45 | HRESETn : IN STD_ULOGIC; |
|
46 | HRESETn : IN STD_ULOGIC; | |
46 |
|
47 | |||
47 | -- AMBA APB Slave Interface |
|
48 | -- AMBA APB Slave Interface | |
48 | apbi : IN apb_slv_in_type; |
|
49 | apbi : IN apb_slv_in_type; | |
49 | apbo : OUT apb_slv_out_type; |
|
50 | apbo : OUT apb_slv_out_type; | |
50 |
|
51 | |||
51 | -- IN |
|
52 | -- IN | |
52 | ready_matrix_f0_0 : IN STD_LOGIC; |
|
53 | ready_matrix_f0_0 : IN STD_LOGIC; | |
53 | ready_matrix_f0_1 : IN STD_LOGIC; |
|
54 | ready_matrix_f0_1 : IN STD_LOGIC; | |
54 | ready_matrix_f1 : IN STD_LOGIC; |
|
55 | ready_matrix_f1 : IN STD_LOGIC; | |
55 | ready_matrix_f2 : IN STD_LOGIC; |
|
56 | ready_matrix_f2 : IN STD_LOGIC; | |
56 | error_anticipating_empty_fifo : IN STD_LOGIC; |
|
57 | error_anticipating_empty_fifo : IN STD_LOGIC; | |
57 | error_bad_component_error : IN STD_LOGIC; |
|
58 | error_bad_component_error : IN STD_LOGIC; | |
|
59 | debug_reg : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |||
58 |
|
60 | |||
59 | -- OUT |
|
61 | -- OUT | |
60 | status_ready_matrix_f0_0 : OUT STD_LOGIC; |
|
62 | status_ready_matrix_f0_0 : OUT STD_LOGIC; | |
61 | status_ready_matrix_f0_1 : OUT STD_LOGIC; |
|
63 | status_ready_matrix_f0_1 : OUT STD_LOGIC; | |
62 | status_ready_matrix_f1 : OUT STD_LOGIC; |
|
64 | status_ready_matrix_f1 : OUT STD_LOGIC; | |
63 | status_ready_matrix_f2 : OUT STD_LOGIC; |
|
65 | status_ready_matrix_f2 : OUT STD_LOGIC; | |
64 | status_error_anticipating_empty_fifo : OUT STD_LOGIC; |
|
66 | status_error_anticipating_empty_fifo : OUT STD_LOGIC; | |
65 | status_error_bad_component_error : OUT STD_LOGIC; |
|
67 | status_error_bad_component_error : OUT STD_LOGIC; | |
66 |
|
68 | |||
67 | config_active_interruption_onNewMatrix : OUT STD_LOGIC; |
|
69 | config_active_interruption_onNewMatrix : OUT STD_LOGIC; | |
68 | config_active_interruption_onError : OUT STD_LOGIC; |
|
70 | config_active_interruption_onError : OUT STD_LOGIC; | |
69 | addr_matrix_f0_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
71 | addr_matrix_f0_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
70 | addr_matrix_f0_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
72 | addr_matrix_f0_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
71 | addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
73 | addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
72 | addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0) |
|
74 | addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0) | |
73 | ); |
|
75 | ); | |
74 |
|
76 | |||
75 | END lpp_dma_apbreg; |
|
77 | END lpp_dma_apbreg; | |
76 |
|
78 | |||
77 | ARCHITECTURE beh OF lpp_dma_apbreg IS |
|
79 | ARCHITECTURE beh OF lpp_dma_apbreg IS | |
78 |
|
80 | |||
79 | CONSTANT REVISION : INTEGER := 1; |
|
81 | CONSTANT REVISION : INTEGER := 1; | |
80 |
|
82 | |||
81 | CONSTANT pconfig : apb_config_type := ( |
|
83 | CONSTANT pconfig : apb_config_type := ( | |
82 | 0 => ahb_device_reg (VENDOR_LPP, LPP_DMA_TYPE, 0, REVISION, pirq), |
|
84 | 0 => ahb_device_reg (VENDOR_LPP, LPP_DMA_TYPE, 0, REVISION, pirq), | |
83 | 1 => apb_iobar(paddr, pmask)); |
|
85 | 1 => apb_iobar(paddr, pmask)); | |
84 |
|
86 | |||
85 | TYPE lpp_dma_regs IS RECORD |
|
87 | TYPE lpp_dma_regs IS RECORD | |
86 | config_active_interruption_onNewMatrix : STD_LOGIC; |
|
88 | config_active_interruption_onNewMatrix : STD_LOGIC; | |
87 | config_active_interruption_onError : STD_LOGIC; |
|
89 | config_active_interruption_onError : STD_LOGIC; | |
88 | status_ready_matrix_f0_0 : STD_LOGIC; |
|
90 | status_ready_matrix_f0_0 : STD_LOGIC; | |
89 | status_ready_matrix_f0_1 : STD_LOGIC; |
|
91 | status_ready_matrix_f0_1 : STD_LOGIC; | |
90 | status_ready_matrix_f1 : STD_LOGIC; |
|
92 | status_ready_matrix_f1 : STD_LOGIC; | |
91 | status_ready_matrix_f2 : STD_LOGIC; |
|
93 | status_ready_matrix_f2 : STD_LOGIC; | |
92 | status_error_anticipating_empty_fifo : STD_LOGIC; |
|
94 | status_error_anticipating_empty_fifo : STD_LOGIC; | |
93 | status_error_bad_component_error : STD_LOGIC; |
|
95 | status_error_bad_component_error : STD_LOGIC; | |
94 | addr_matrix_f0_0 : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
96 | addr_matrix_f0_0 : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
95 | addr_matrix_f0_1 : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
97 | addr_matrix_f0_1 : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
96 | addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
98 | addr_matrix_f1 : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
97 | addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
99 | addr_matrix_f2 : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
98 | END RECORD; |
|
100 | END RECORD; | |
99 |
|
101 | |||
100 | SIGNAL reg : lpp_dma_regs; |
|
102 | SIGNAL reg : lpp_dma_regs; | |
101 |
|
103 | |||
102 | SIGNAL prdata : STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
104 | SIGNAL prdata : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
103 |
|
105 | |||
104 | BEGIN -- beh |
|
106 | BEGIN -- beh | |
105 |
|
107 | |||
106 | status_ready_matrix_f0_0 <= reg.status_ready_matrix_f0_0; |
|
108 | status_ready_matrix_f0_0 <= reg.status_ready_matrix_f0_0; | |
107 | status_ready_matrix_f0_1 <= reg.status_ready_matrix_f0_1; |
|
109 | status_ready_matrix_f0_1 <= reg.status_ready_matrix_f0_1; | |
108 | status_ready_matrix_f1 <= reg.status_ready_matrix_f1; |
|
110 | status_ready_matrix_f1 <= reg.status_ready_matrix_f1; | |
109 | status_ready_matrix_f2 <= reg.status_ready_matrix_f2; |
|
111 | status_ready_matrix_f2 <= reg.status_ready_matrix_f2; | |
110 | status_error_anticipating_empty_fifo <= reg.status_error_anticipating_empty_fifo; |
|
112 | status_error_anticipating_empty_fifo <= reg.status_error_anticipating_empty_fifo; | |
111 | status_error_bad_component_error <= reg.status_error_bad_component_error; |
|
113 | status_error_bad_component_error <= reg.status_error_bad_component_error; | |
112 |
|
114 | |||
113 | config_active_interruption_onNewMatrix <= reg.config_active_interruption_onNewMatrix; |
|
115 | config_active_interruption_onNewMatrix <= reg.config_active_interruption_onNewMatrix; | |
114 | config_active_interruption_onError <= reg.config_active_interruption_onError; |
|
116 | config_active_interruption_onError <= reg.config_active_interruption_onError; | |
115 | addr_matrix_f0_0 <= reg.addr_matrix_f0_0; |
|
117 | addr_matrix_f0_0 <= reg.addr_matrix_f0_0; | |
116 | addr_matrix_f0_1 <= reg.addr_matrix_f0_1; |
|
118 | addr_matrix_f0_1 <= reg.addr_matrix_f0_1; | |
117 | addr_matrix_f1 <= reg.addr_matrix_f1; |
|
119 | addr_matrix_f1 <= reg.addr_matrix_f1; | |
118 | addr_matrix_f2 <= reg.addr_matrix_f2; |
|
120 | addr_matrix_f2 <= reg.addr_matrix_f2; | |
119 |
|
121 | |||
120 | lpp_dma_apbreg : PROCESS (HCLK, HRESETn) |
|
122 | lpp_dma_apbreg : PROCESS (HCLK, HRESETn) | |
121 | VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2); |
|
123 | VARIABLE paddr : STD_LOGIC_VECTOR(7 DOWNTO 2); | |
122 | BEGIN -- PROCESS lpp_dma_top |
|
124 | BEGIN -- PROCESS lpp_dma_top | |
123 | IF HRESETn = '0' THEN -- asynchronous reset (active low) |
|
125 | IF HRESETn = '0' THEN -- asynchronous reset (active low) | |
124 | reg.config_active_interruption_onNewMatrix <= '0'; |
|
126 | reg.config_active_interruption_onNewMatrix <= '0'; | |
125 | reg.config_active_interruption_onError <= '0'; |
|
127 | reg.config_active_interruption_onError <= '0'; | |
126 | reg.status_ready_matrix_f0_0 <= '0'; |
|
128 | reg.status_ready_matrix_f0_0 <= '0'; | |
127 | reg.status_ready_matrix_f0_1 <= '0'; |
|
129 | reg.status_ready_matrix_f0_1 <= '0'; | |
128 | reg.status_ready_matrix_f1 <= '0'; |
|
130 | reg.status_ready_matrix_f1 <= '0'; | |
129 | reg.status_ready_matrix_f2 <= '0'; |
|
131 | reg.status_ready_matrix_f2 <= '0'; | |
130 | reg.status_error_anticipating_empty_fifo <= '0'; |
|
132 | reg.status_error_anticipating_empty_fifo <= '0'; | |
131 | reg.status_error_bad_component_error <= '0'; |
|
133 | reg.status_error_bad_component_error <= '0'; | |
132 | reg.addr_matrix_f0_0 <= (OTHERS => '0'); |
|
134 | reg.addr_matrix_f0_0 <= (OTHERS => '0'); | |
133 | reg.addr_matrix_f0_1 <= (OTHERS => '0'); |
|
135 | reg.addr_matrix_f0_1 <= (OTHERS => '0'); | |
134 | reg.addr_matrix_f1 <= (OTHERS => '0'); |
|
136 | reg.addr_matrix_f1 <= (OTHERS => '0'); | |
135 | reg.addr_matrix_f2 <= (OTHERS => '0'); |
|
137 | reg.addr_matrix_f2 <= (OTHERS => '0'); | |
136 | prdata <= (OTHERS => '0'); |
|
138 | prdata <= (OTHERS => '0'); | |
137 | ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge |
|
139 | ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge | |
138 |
|
140 | |||
139 | reg.status_ready_matrix_f0_0 <= reg.status_ready_matrix_f0_0 OR ready_matrix_f0_0; |
|
141 | reg.status_ready_matrix_f0_0 <= reg.status_ready_matrix_f0_0 OR ready_matrix_f0_0; | |
140 | reg.status_ready_matrix_f0_1 <= reg.status_ready_matrix_f0_1 OR ready_matrix_f0_1; |
|
142 | reg.status_ready_matrix_f0_1 <= reg.status_ready_matrix_f0_1 OR ready_matrix_f0_1; | |
141 | reg.status_ready_matrix_f1 <= reg.status_ready_matrix_f1 OR ready_matrix_f1; |
|
143 | reg.status_ready_matrix_f1 <= reg.status_ready_matrix_f1 OR ready_matrix_f1; | |
142 | reg.status_ready_matrix_f2 <= reg.status_ready_matrix_f2 OR ready_matrix_f2; |
|
144 | reg.status_ready_matrix_f2 <= reg.status_ready_matrix_f2 OR ready_matrix_f2; | |
143 |
|
145 | |||
144 | reg.status_error_anticipating_empty_fifo <= reg.status_error_anticipating_empty_fifo OR error_anticipating_empty_fifo; |
|
146 | reg.status_error_anticipating_empty_fifo <= reg.status_error_anticipating_empty_fifo OR error_anticipating_empty_fifo; | |
145 | reg.status_error_bad_component_error <= reg.status_error_bad_component_error OR error_bad_component_error; |
|
147 | reg.status_error_bad_component_error <= reg.status_error_bad_component_error OR error_bad_component_error; | |
146 |
|
148 | |||
147 | paddr := "000000"; |
|
149 | paddr := "000000"; | |
148 | paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2); |
|
150 | paddr(7 DOWNTO 2) := apbi.paddr(7 DOWNTO 2); | |
149 | prdata <= (OTHERS => '0'); |
|
151 | prdata <= (OTHERS => '0'); | |
150 | IF apbi.psel(pindex) = '1' THEN |
|
152 | IF apbi.psel(pindex) = '1' THEN | |
151 | -- APB DMA READ -- |
|
153 | -- APB DMA READ -- | |
152 | CASE paddr(7 DOWNTO 2) IS |
|
154 | CASE paddr(7 DOWNTO 2) IS | |
153 | WHEN "000000" => prdata(0) <= reg.config_active_interruption_onNewMatrix; |
|
155 | WHEN "000000" => prdata(0) <= reg.config_active_interruption_onNewMatrix; | |
154 | prdata(1) <= reg.config_active_interruption_onError; |
|
156 | prdata(1) <= reg.config_active_interruption_onError; | |
155 | WHEN "000001" => prdata(0) <= reg.status_ready_matrix_f0_0; |
|
157 | WHEN "000001" => prdata(0) <= reg.status_ready_matrix_f0_0; | |
156 | prdata(1) <= reg.status_ready_matrix_f0_1; |
|
158 | prdata(1) <= reg.status_ready_matrix_f0_1; | |
157 | prdata(2) <= reg.status_ready_matrix_f1; |
|
159 | prdata(2) <= reg.status_ready_matrix_f1; | |
158 | prdata(3) <= reg.status_ready_matrix_f2; |
|
160 | prdata(3) <= reg.status_ready_matrix_f2; | |
159 | prdata(4) <= reg.status_error_anticipating_empty_fifo; |
|
161 | prdata(4) <= reg.status_error_anticipating_empty_fifo; | |
160 | prdata(5) <= reg.status_error_bad_component_error; |
|
162 | prdata(5) <= reg.status_error_bad_component_error; | |
161 | WHEN "000010" => prdata <= reg.addr_matrix_f0_0; |
|
163 | WHEN "000010" => prdata <= reg.addr_matrix_f0_0; | |
162 | WHEN "000011" => prdata <= reg.addr_matrix_f0_1; |
|
164 | WHEN "000011" => prdata <= reg.addr_matrix_f0_1; | |
163 | WHEN "000100" => prdata <= reg.addr_matrix_f1; |
|
165 | WHEN "000100" => prdata <= reg.addr_matrix_f1; | |
164 | WHEN "000101" => prdata <= reg.addr_matrix_f2; |
|
166 | WHEN "000101" => prdata <= reg.addr_matrix_f2; | |
|
167 | WHEN "000110" => prdata <= debug_reg; | |||
165 | WHEN OTHERS => NULL; |
|
168 | WHEN OTHERS => NULL; | |
166 | END CASE; |
|
169 | END CASE; | |
167 | IF (apbi.pwrite AND apbi.penable) = '1' THEN |
|
170 | IF (apbi.pwrite AND apbi.penable) = '1' THEN | |
168 | -- APB DMA WRITE -- |
|
171 | -- APB DMA WRITE -- | |
169 | CASE paddr(7 DOWNTO 2) IS |
|
172 | CASE paddr(7 DOWNTO 2) IS | |
170 | WHEN "000000" => reg.config_active_interruption_onNewMatrix <= apbi.pwdata(0); |
|
173 | WHEN "000000" => reg.config_active_interruption_onNewMatrix <= apbi.pwdata(0); | |
171 |
reg.config_active_interruption_onError |
|
174 | reg.config_active_interruption_onError <= apbi.pwdata(1); | |
172 |
WHEN "000001" => reg.status_ready_matrix_f0_0 |
|
175 | WHEN "000001" => reg.status_ready_matrix_f0_0 <= apbi.pwdata(0); | |
173 |
reg.status_ready_matrix_f0_1 |
|
176 | reg.status_ready_matrix_f0_1 <= apbi.pwdata(1); | |
174 |
reg.status_ready_matrix_f1 |
|
177 | reg.status_ready_matrix_f1 <= apbi.pwdata(2); | |
175 |
reg.status_ready_matrix_f2 |
|
178 | reg.status_ready_matrix_f2 <= apbi.pwdata(3); | |
176 |
reg.status_error_anticipating_empty_fifo |
|
179 | reg.status_error_anticipating_empty_fifo <= apbi.pwdata(4); | |
177 |
reg.status_error_bad_component_error |
|
180 | reg.status_error_bad_component_error <= apbi.pwdata(5); | |
178 |
WHEN "000010" => reg.addr_matrix_f0_0 |
|
181 | WHEN "000010" => reg.addr_matrix_f0_0 <= apbi.pwdata; | |
179 |
WHEN "000011" => reg.addr_matrix_f0_1 |
|
182 | WHEN "000011" => reg.addr_matrix_f0_1 <= apbi.pwdata; | |
180 |
WHEN "000100" => reg.addr_matrix_f1 |
|
183 | WHEN "000100" => reg.addr_matrix_f1 <= apbi.pwdata; | |
181 |
WHEN "000101" => reg.addr_matrix_f2 |
|
184 | WHEN "000101" => reg.addr_matrix_f2 <= apbi.pwdata; | |
182 | WHEN OTHERS => NULL; |
|
185 | WHEN OTHERS => NULL; | |
183 | END CASE; |
|
186 | END CASE; | |
184 | END IF; |
|
187 | END IF; | |
185 | END IF; |
|
188 | END IF; | |
186 | END IF; |
|
189 | END IF; | |
187 | END PROCESS lpp_dma_apbreg; |
|
190 | END PROCESS lpp_dma_apbreg; | |
|
191 | ||||
188 | apbo.pirq <= (OTHERS => '0'); |
|
192 | apbo.pirq <= (OTHERS => '0'); | |
189 | apbo.pindex <= pindex; |
|
193 | apbo.pindex <= pindex; | |
190 | apbo.pconfig <= pconfig; |
|
194 | apbo.pconfig <= pconfig; | |
191 | apbo.prdata <= prdata; |
|
195 | apbo.prdata <= prdata; | |
192 |
|
196 | |||
|
197 | ||||
193 | END beh; |
|
198 | END beh; |
@@ -1,163 +1,164 | |||||
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 | USE std.textio.ALL; |
|
27 | USE std.textio.ALL; | |
28 | LIBRARY grlib; |
|
28 | LIBRARY grlib; | |
29 | USE grlib.amba.ALL; |
|
29 | USE grlib.amba.ALL; | |
30 | USE grlib.stdlib.ALL; |
|
30 | USE grlib.stdlib.ALL; | |
31 | USE GRLIB.DMA2AHB_Package.ALL; |
|
31 | USE GRLIB.DMA2AHB_Package.ALL; | |
32 | LIBRARY techmap; |
|
32 | LIBRARY techmap; | |
33 | USE techmap.gencomp.ALL; |
|
33 | USE techmap.gencomp.ALL; | |
34 | LIBRARY lpp; |
|
34 | LIBRARY lpp; | |
35 | USE lpp.lpp_amba.ALL; |
|
35 | USE lpp.lpp_amba.ALL; | |
36 | USE lpp.apb_devices_list.ALL; |
|
36 | USE lpp.apb_devices_list.ALL; | |
37 | USE lpp.lpp_memory.ALL; |
|
37 | USE lpp.lpp_memory.ALL; | |
38 |
|
38 | |||
39 | PACKAGE lpp_dma_pkg IS |
|
39 | PACKAGE lpp_dma_pkg IS | |
40 |
|
40 | |||
41 | COMPONENT lpp_dma |
|
41 | COMPONENT lpp_dma | |
42 | GENERIC ( |
|
42 | GENERIC ( | |
43 | tech : INTEGER; |
|
43 | tech : INTEGER; | |
44 | hindex : INTEGER; |
|
44 | hindex : INTEGER; | |
45 | pindex : INTEGER; |
|
45 | pindex : INTEGER; | |
46 | paddr : INTEGER; |
|
46 | paddr : INTEGER; | |
47 | pmask : INTEGER; |
|
47 | pmask : INTEGER; | |
48 | pirq : INTEGER); |
|
48 | pirq : INTEGER); | |
49 | PORT ( |
|
49 | PORT ( | |
50 | HCLK : IN STD_ULOGIC; |
|
50 | HCLK : IN STD_ULOGIC; | |
51 | HRESETn : IN STD_ULOGIC; |
|
51 | HRESETn : IN STD_ULOGIC; | |
52 | apbi : IN apb_slv_in_type; |
|
52 | apbi : IN apb_slv_in_type; | |
53 | apbo : OUT apb_slv_out_type; |
|
53 | apbo : OUT apb_slv_out_type; | |
54 | AHB_Master_In : IN AHB_Mst_In_Type; |
|
54 | AHB_Master_In : IN AHB_Mst_In_Type; | |
55 | AHB_Master_Out : OUT AHB_Mst_Out_Type; |
|
55 | AHB_Master_Out : OUT AHB_Mst_Out_Type; | |
56 | -- fifo interface |
|
56 | -- fifo interface | |
57 | fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
57 | fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
58 | fifo_empty : IN STD_LOGIC; |
|
58 | fifo_empty : IN STD_LOGIC; | |
59 | fifo_ren : OUT STD_LOGIC; |
|
59 | fifo_ren : OUT STD_LOGIC; | |
60 | -- header |
|
60 | -- header | |
61 | header : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
61 | header : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
62 | header_val : IN STD_LOGIC; |
|
62 | header_val : IN STD_LOGIC; | |
63 | header_ack : OUT STD_LOGIC); |
|
63 | header_ack : OUT STD_LOGIC); | |
64 | END COMPONENT; |
|
64 | END COMPONENT; | |
65 |
|
65 | |||
66 | COMPONENT fifo_test_dma |
|
66 | COMPONENT fifo_test_dma | |
67 | GENERIC ( |
|
67 | GENERIC ( | |
68 | tech : INTEGER; |
|
68 | tech : INTEGER; | |
69 | pindex : INTEGER; |
|
69 | pindex : INTEGER; | |
70 | paddr : INTEGER; |
|
70 | paddr : INTEGER; | |
71 | pmask : INTEGER); |
|
71 | pmask : INTEGER); | |
72 | PORT ( |
|
72 | PORT ( | |
73 | HCLK : IN STD_ULOGIC; |
|
73 | HCLK : IN STD_ULOGIC; | |
74 | HRESETn : IN STD_ULOGIC; |
|
74 | HRESETn : IN STD_ULOGIC; | |
75 | apbi : IN apb_slv_in_type; |
|
75 | apbi : IN apb_slv_in_type; | |
76 | apbo : OUT apb_slv_out_type; |
|
76 | apbo : OUT apb_slv_out_type; | |
77 | -- fifo interface |
|
77 | -- fifo interface | |
78 | fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
78 | fifo_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
79 | fifo_empty : OUT STD_LOGIC; |
|
79 | fifo_empty : OUT STD_LOGIC; | |
80 | fifo_ren : IN STD_LOGIC; |
|
80 | fifo_ren : IN STD_LOGIC; | |
81 | -- header |
|
81 | -- header | |
82 | header : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
82 | header : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
83 | header_val : OUT STD_LOGIC; |
|
83 | header_val : OUT STD_LOGIC; | |
84 | header_ack : IN STD_LOGIC |
|
84 | header_ack : IN STD_LOGIC | |
85 | ); |
|
85 | ); | |
86 | END COMPONENT; |
|
86 | END COMPONENT; | |
87 |
|
87 | |||
88 | COMPONENT lpp_dma_apbreg |
|
88 | COMPONENT lpp_dma_apbreg | |
89 | GENERIC ( |
|
89 | GENERIC ( | |
90 | pindex : INTEGER; |
|
90 | pindex : INTEGER; | |
91 | paddr : INTEGER; |
|
91 | paddr : INTEGER; | |
92 | pmask : INTEGER; |
|
92 | pmask : INTEGER; | |
93 | pirq : INTEGER); |
|
93 | pirq : INTEGER); | |
94 | PORT ( |
|
94 | PORT ( | |
95 | HCLK : IN STD_ULOGIC; |
|
95 | HCLK : IN STD_ULOGIC; | |
96 | HRESETn : IN STD_ULOGIC; |
|
96 | HRESETn : IN STD_ULOGIC; | |
97 | apbi : IN apb_slv_in_type; |
|
97 | apbi : IN apb_slv_in_type; | |
98 | apbo : OUT apb_slv_out_type; |
|
98 | apbo : OUT apb_slv_out_type; | |
99 | -- IN |
|
99 | -- IN | |
100 | ready_matrix_f0_0 : IN STD_LOGIC; |
|
100 | ready_matrix_f0_0 : IN STD_LOGIC; | |
101 | ready_matrix_f0_1 : IN STD_LOGIC; |
|
101 | ready_matrix_f0_1 : IN STD_LOGIC; | |
102 | ready_matrix_f1 : IN STD_LOGIC; |
|
102 | ready_matrix_f1 : IN STD_LOGIC; | |
103 | ready_matrix_f2 : IN STD_LOGIC; |
|
103 | ready_matrix_f2 : IN STD_LOGIC; | |
104 | error_anticipating_empty_fifo : IN STD_LOGIC; |
|
104 | error_anticipating_empty_fifo : IN STD_LOGIC; | |
105 | error_bad_component_error : IN STD_LOGIC; |
|
105 | error_bad_component_error : IN STD_LOGIC; | |
|
106 | debug_reg : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |||
106 |
|
107 | |||
107 | -- OUT |
|
108 | -- OUT | |
108 | status_ready_matrix_f0_0 : OUT STD_LOGIC; |
|
109 | status_ready_matrix_f0_0 : OUT STD_LOGIC; | |
109 | status_ready_matrix_f0_1 : OUT STD_LOGIC; |
|
110 | status_ready_matrix_f0_1 : OUT STD_LOGIC; | |
110 | status_ready_matrix_f1 : OUT STD_LOGIC; |
|
111 | status_ready_matrix_f1 : OUT STD_LOGIC; | |
111 | status_ready_matrix_f2 : OUT STD_LOGIC; |
|
112 | status_ready_matrix_f2 : OUT STD_LOGIC; | |
112 | status_error_anticipating_empty_fifo : OUT STD_LOGIC; |
|
113 | status_error_anticipating_empty_fifo : OUT STD_LOGIC; | |
113 | status_error_bad_component_error : OUT STD_LOGIC; |
|
114 | status_error_bad_component_error : OUT STD_LOGIC; | |
114 |
|
115 | |||
115 | config_active_interruption_onNewMatrix : OUT STD_LOGIC; |
|
116 | config_active_interruption_onNewMatrix : OUT STD_LOGIC; | |
116 | config_active_interruption_onError : OUT STD_LOGIC; |
|
117 | config_active_interruption_onError : OUT STD_LOGIC; | |
117 | addr_matrix_f0_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
118 | addr_matrix_f0_0 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
118 | addr_matrix_f0_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
119 | addr_matrix_f0_1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
119 | addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
120 | addr_matrix_f1 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
120 | addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0) |
|
121 | addr_matrix_f2 : OUT STD_LOGIC_VECTOR(31 DOWNTO 0) | |
121 | ); |
|
122 | ); | |
122 | END COMPONENT; |
|
123 | END COMPONENT; | |
123 |
|
124 | |||
124 | COMPONENT lpp_dma_send_1word |
|
125 | COMPONENT lpp_dma_send_1word | |
125 | PORT ( |
|
126 | PORT ( | |
126 | HCLK : IN STD_ULOGIC; |
|
127 | HCLK : IN STD_ULOGIC; | |
127 | HRESETn : IN STD_ULOGIC; |
|
128 | HRESETn : IN STD_ULOGIC; | |
128 | DMAIn : OUT DMA_In_Type; |
|
129 | DMAIn : OUT DMA_In_Type; | |
129 | DMAOut : IN DMA_OUt_Type; |
|
130 | DMAOut : IN DMA_OUt_Type; | |
130 | send : IN STD_LOGIC; |
|
131 | send : IN STD_LOGIC; | |
131 | address : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
132 | address : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
132 | data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
133 | data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
133 | send_ok : OUT STD_LOGIC; |
|
134 | send_ok : OUT STD_LOGIC; | |
134 | send_ko : OUT STD_LOGIC); |
|
135 | send_ko : OUT STD_LOGIC); | |
135 | END COMPONENT; |
|
136 | END COMPONENT; | |
136 |
|
137 | |||
137 | COMPONENT lpp_dma_send_16word |
|
138 | COMPONENT lpp_dma_send_16word | |
138 | PORT ( |
|
139 | PORT ( | |
139 | HCLK : IN STD_ULOGIC; |
|
140 | HCLK : IN STD_ULOGIC; | |
140 | HRESETn : IN STD_ULOGIC; |
|
141 | HRESETn : IN STD_ULOGIC; | |
141 | DMAIn : OUT DMA_In_Type; |
|
142 | DMAIn : OUT DMA_In_Type; | |
142 | DMAOut : IN DMA_OUt_Type; |
|
143 | DMAOut : IN DMA_OUt_Type; | |
143 | send : IN STD_LOGIC; |
|
144 | send : IN STD_LOGIC; | |
144 | address : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
145 | address : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
145 | data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
146 | data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
146 | ren : OUT STD_LOGIC; |
|
147 | ren : OUT STD_LOGIC; | |
147 | send_ok : OUT STD_LOGIC; |
|
148 | send_ok : OUT STD_LOGIC; | |
148 | send_ko : OUT STD_LOGIC); |
|
149 | send_ko : OUT STD_LOGIC); | |
149 | END COMPONENT; |
|
150 | END COMPONENT; | |
150 |
|
151 | |||
151 | COMPONENT fifo_latency_correction |
|
152 | COMPONENT fifo_latency_correction | |
152 | PORT ( |
|
153 | PORT ( | |
153 | HCLK : IN STD_ULOGIC; |
|
154 | HCLK : IN STD_ULOGIC; | |
154 | HRESETn : IN STD_ULOGIC; |
|
155 | HRESETn : IN STD_ULOGIC; | |
155 | fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
156 | fifo_data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
156 | fifo_empty : IN STD_LOGIC; |
|
157 | fifo_empty : IN STD_LOGIC; | |
157 | fifo_ren : OUT STD_LOGIC; |
|
158 | fifo_ren : OUT STD_LOGIC; | |
158 | dma_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
159 | dma_data : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
159 | dma_empty : OUT STD_LOGIC; |
|
160 | dma_empty : OUT STD_LOGIC; | |
160 | dma_ren : IN STD_LOGIC); |
|
161 | dma_ren : IN STD_LOGIC); | |
161 | END COMPONENT; |
|
162 | END COMPONENT; | |
162 |
|
163 | |||
163 | END; |
|
164 | END; |
@@ -1,160 +1,171 | |||||
|
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 | ---------------------------------------------------------------------------- | |||
1 |
|
23 | |||
2 | LIBRARY ieee; |
|
24 | LIBRARY ieee; | |
3 | USE ieee.std_logic_1164.ALL; |
|
25 | USE ieee.std_logic_1164.ALL; | |
4 | USE ieee.numeric_std.ALL; |
|
26 | USE ieee.numeric_std.ALL; | |
5 | LIBRARY grlib; |
|
27 | LIBRARY grlib; | |
6 | USE grlib.amba.ALL; |
|
28 | USE grlib.amba.ALL; | |
7 | USE grlib.stdlib.ALL; |
|
29 | USE grlib.stdlib.ALL; | |
8 | USE grlib.devices.ALL; |
|
30 | USE grlib.devices.ALL; | |
9 | USE GRLIB.DMA2AHB_Package.ALL; |
|
31 | USE GRLIB.DMA2AHB_Package.ALL; | |
10 | LIBRARY lpp; |
|
32 | LIBRARY lpp; | |
11 | USE lpp.lpp_amba.ALL; |
|
33 | USE lpp.lpp_amba.ALL; | |
12 | USE lpp.apb_devices_list.ALL; |
|
34 | USE lpp.apb_devices_list.ALL; | |
13 | USE lpp.lpp_memory.ALL; |
|
35 | USE lpp.lpp_memory.ALL; | |
14 | LIBRARY techmap; |
|
36 | LIBRARY techmap; | |
15 | USE techmap.gencomp.ALL; |
|
37 | USE techmap.gencomp.ALL; | |
16 |
|
38 | |||
17 | ENTITY lpp_dma_send_16word IS |
|
39 | ENTITY lpp_dma_send_16word IS | |
18 | PORT ( |
|
40 | PORT ( | |
19 | -- AMBA AHB system signals |
|
41 | -- AMBA AHB system signals | |
20 | HCLK : IN STD_ULOGIC; |
|
42 | HCLK : IN STD_ULOGIC; | |
21 | HRESETn : IN STD_ULOGIC; |
|
43 | HRESETn : IN STD_ULOGIC; | |
22 |
|
44 | |||
23 | -- DMA |
|
45 | -- DMA | |
24 | DMAIn : OUT DMA_In_Type; |
|
46 | DMAIn : OUT DMA_In_Type; | |
25 | DMAOut : IN DMA_OUt_Type; |
|
47 | DMAOut : IN DMA_OUt_Type; | |
26 |
|
48 | |||
27 | -- |
|
49 | -- | |
28 | send : IN STD_LOGIC; |
|
50 | send : IN STD_LOGIC; | |
29 | address : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
51 | address : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
30 | data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
52 | data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
31 |
ren : OUT |
|
53 | ren : OUT STD_LOGIC; | |
32 | -- |
|
54 | -- | |
33 | send_ok : OUT STD_LOGIC; |
|
55 | send_ok : OUT STD_LOGIC; | |
34 | send_ko : OUT STD_LOGIC |
|
56 | send_ko : OUT STD_LOGIC | |
35 | ); |
|
57 | ); | |
36 | END lpp_dma_send_16word; |
|
58 | END lpp_dma_send_16word; | |
37 |
|
59 | |||
38 | ARCHITECTURE beh OF lpp_dma_send_16word IS |
|
60 | ARCHITECTURE beh OF lpp_dma_send_16word IS | |
39 |
|
61 | |||
40 | TYPE state_fsm_send_16word IS (IDLE, REQUEST_BUS, SEND_DATA, ERROR0, ERROR1,WAIT_LAST_READY); |
|
62 | TYPE state_fsm_send_16word IS (IDLE, REQUEST_BUS, SEND_DATA, ERROR0, ERROR1, WAIT_LAST_READY); | |
41 | SIGNAL state : state_fsm_send_16word; |
|
63 | SIGNAL state : state_fsm_send_16word; | |
42 |
|
64 | |||
43 | SIGNAL data_counter : INTEGER; |
|
65 | SIGNAL data_counter : INTEGER; | |
44 | SIGNAL grant_counter : INTEGER; |
|
66 | SIGNAL grant_counter : INTEGER; | |
45 |
|
67 | |||
46 | BEGIN -- beh |
|
68 | BEGIN -- beh | |
47 |
|
69 | |||
48 |
DMAIn.Beat |
|
70 | DMAIn.Beat <= HINCR16; | |
49 |
DMAIn.Size |
|
71 | DMAIn.Size <= HSIZE32; | |
50 |
|
72 | |||
51 | PROCESS (HCLK, HRESETn) |
|
73 | PROCESS (HCLK, HRESETn) | |
52 | BEGIN -- PROCESS |
|
74 | BEGIN -- PROCESS | |
53 |
IF HRESETn = '0' THEN |
|
75 | IF HRESETn = '0' THEN -- asynchronous reset (active low) | |
54 |
state |
|
76 | state <= IDLE; | |
55 |
send_ok |
|
77 | send_ok <= '0'; | |
56 |
send_ko |
|
78 | send_ko <= '0'; | |
57 |
|
79 | |||
58 |
DMAIn.Reset |
|
80 | DMAIn.Reset <= '0'; | |
59 |
DMAIn.Address |
|
81 | DMAIn.Address <= (OTHERS => '0'); | |
60 |
|
|
82 | DMAIn.Request <= '0'; | |
61 |
DMAIn. |
|
83 | DMAIn.Store <= '0'; | |
62 |
DMAIn. |
|
84 | DMAIn.Burst <= '1'; | |
63 |
DMAIn. |
|
85 | DMAIn.Lock <= '0'; | |
64 | DMAIn.Lock <= '0'; |
|
86 | data_counter <= 0; | |
65 | data_counter <= 0; |
|
|||
66 | ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge |
|
87 | ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge | |
67 |
|
88 | |||
68 | CASE state IS |
|
89 | CASE state IS | |
69 | WHEN IDLE => |
|
90 | WHEN IDLE => | |
70 | -- ren <= '1'; |
|
|||
71 | DMAIn.Store <= '1'; |
|
91 | DMAIn.Store <= '1'; | |
72 | DMAIn.Request <= '0'; |
|
92 | DMAIn.Request <= '0'; | |
73 | send_ok <= '0'; |
|
93 | send_ok <= '0'; | |
74 | send_ko <= '0'; |
|
94 | send_ko <= '0'; | |
75 |
DMAIn.Address |
|
95 | DMAIn.Address <= address; | |
76 |
data_counter |
|
96 | data_counter <= 0; | |
77 |
DMAIn.Lock |
|
97 | DMAIn.Lock <= '0'; -- FIX test | |
78 | IF send = '1' THEN |
|
98 | IF send = '1' THEN | |
79 | state <= REQUEST_BUS; |
|
99 | state <= REQUEST_BUS; | |
80 |
DMAIn.Request |
|
100 | DMAIn.Request <= '1'; | |
81 |
DMAIn.Lock |
|
101 | DMAIn.Lock <= '1'; -- FIX test | |
82 |
DMAIn.Store |
|
102 | DMAIn.Store <= '1'; | |
83 | END IF; |
|
103 | END IF; | |
84 | WHEN REQUEST_BUS => |
|
104 | WHEN REQUEST_BUS => | |
85 | -- ren <= '1'; |
|
105 | IF DMAOut.Grant = '1' THEN | |
86 | IF DMAOut.Grant='1' THEN |
|
106 | data_counter <= 1; | |
87 |
|
|
107 | grant_counter <= 1; | |
88 |
|
|
108 | state <= SEND_DATA; | |
89 | -- ren <= '0'; |
|
|||
90 | state <= SEND_DATA; |
|
|||
91 | END IF; |
|
109 | END IF; | |
92 | WHEN SEND_DATA => |
|
110 | WHEN SEND_DATA => | |
93 | -- ren <= '1'; |
|
|||
94 |
|
111 | |||
95 | IF DMAOut.Fault = '1' THEN |
|
112 | IF DMAOut.Fault = '1' THEN | |
96 |
DMAIn.Reset |
|
113 | DMAIn.Reset <= '0'; | |
97 |
DMAIn.Address |
|
114 | DMAIn.Address <= (OTHERS => '0'); | |
98 |
|
|
115 | DMAIn.Request <= '0'; | |
99 |
DMAIn. |
|
116 | DMAIn.Store <= '0'; | |
100 |
DMAIn. |
|
117 | DMAIn.Burst <= '0'; | |
101 |
|
|
118 | state <= ERROR0; | |
102 | state <= ERROR0; |
|
|||
103 | ELSE |
|
119 | ELSE | |
104 |
|
120 | |||
105 | IF DMAOut.Grant = '1' THEN |
|
121 | IF DMAOut.Grant = '1' THEN | |
106 |
|
|
122 | IF grant_counter = 15 THEN | |
107 |
DMAIn.Reset |
|
123 | DMAIn.Reset <= '0'; | |
108 |
DMAIn.Request |
|
124 | DMAIn.Request <= '0'; | |
109 |
DMAIn.Store |
|
125 | DMAIn.Store <= '0'; | |
110 |
DMAIn.Burst |
|
126 | DMAIn.Burst <= '0'; | |
111 |
|
|
127 | ELSE | |
112 |
grant_counter |
|
128 | grant_counter <= grant_counter+1; | |
113 |
|
|
129 | END IF; | |
114 | END IF; |
|
130 | END IF; | |
115 |
|
131 | |||
116 | IF DMAOut.OKAY = '1' THEN |
|
132 | IF DMAOut.OKAY = '1' THEN | |
117 | IF data_counter = 15 THEN |
|
133 | IF data_counter = 15 THEN | |
118 |
DMAIn.Address |
|
134 | DMAIn.Address <= (OTHERS => '0'); | |
119 |
state |
|
135 | state <= WAIT_LAST_READY; | |
120 | ELSE |
|
136 | ELSE | |
121 |
|
|
137 | data_counter <= data_counter + 1; | |
122 | data_counter <= data_counter + 1; |
|
|||
123 | -- ren <= '0'; |
|
|||
124 | END IF; |
|
138 | END IF; | |
125 | END IF; |
|
139 | END IF; | |
126 | END IF; |
|
140 | END IF; | |
127 |
|
|
141 | ||
128 |
|
|
142 | ||
129 | WHEN WAIT_LAST_READY => |
|
143 | WHEN WAIT_LAST_READY => | |
130 | -- ren <= '1'; |
|
|||
131 | IF DMAOut.Ready = '1' THEN |
|
144 | IF DMAOut.Ready = '1' THEN | |
132 | IF grant_counter = 15 THEN |
|
145 | IF grant_counter = 15 THEN | |
133 | state <= IDLE; |
|
146 | state <= IDLE; | |
134 | send_ok <= '1'; |
|
147 | send_ok <= '1'; | |
135 | send_ko <= '0'; |
|
148 | send_ko <= '0'; | |
136 | ELSE |
|
149 | ELSE | |
137 |
state <= ERROR0; |
|
150 | state <= ERROR0; | |
138 | END IF; |
|
151 | END IF; | |
139 | END IF; |
|
152 | END IF; | |
140 |
|
153 | |||
141 | WHEN ERROR0 => |
|
154 | WHEN ERROR0 => | |
142 | -- ren <= '1'; |
|
|||
143 | state <= ERROR1; |
|
155 | state <= ERROR1; | |
144 | WHEN ERROR1 => |
|
156 | WHEN ERROR1 => | |
145 | send_ok <= '0'; |
|
157 | send_ok <= '0'; | |
146 | send_ko <= '1'; |
|
158 | send_ko <= '1'; | |
147 |
|
|
159 | state <= IDLE; | |
148 | state <= IDLE; |
|
|||
149 | WHEN OTHERS => NULL; |
|
160 | WHEN OTHERS => NULL; | |
150 | END CASE; |
|
161 | END CASE; | |
151 | END IF; |
|
162 | END IF; | |
152 | END PROCESS; |
|
163 | END PROCESS; | |
153 |
|
164 | |||
154 |
DMAIn.Data |
|
165 | DMAIn.Data <= data; | |
155 |
|
166 | |||
156 |
ren <= '0' WHEN DMAOut.OKAY = '1' |
|
167 | ren <= '0' WHEN DMAOut.OKAY = '1' AND state = SEND_DATA ELSE | |
157 |
'0' WHEN state = REQUEST_BUS |
|
168 | '0' WHEN state = REQUEST_BUS AND DMAOut.Grant = '1' ELSE | |
158 | '1'; |
|
169 | '1'; | |
159 |
|
170 | |||
160 | END beh; |
|
171 | END beh; |
@@ -1,101 +1,123 | |||||
|
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 | ---------------------------------------------------------------------------- | |||
1 |
|
23 | |||
2 | LIBRARY ieee; |
|
24 | LIBRARY ieee; | |
3 | USE ieee.std_logic_1164.ALL; |
|
25 | USE ieee.std_logic_1164.ALL; | |
4 | USE ieee.numeric_std.ALL; |
|
26 | USE ieee.numeric_std.ALL; | |
5 | LIBRARY grlib; |
|
27 | LIBRARY grlib; | |
6 | USE grlib.amba.ALL; |
|
28 | USE grlib.amba.ALL; | |
7 | USE grlib.stdlib.ALL; |
|
29 | USE grlib.stdlib.ALL; | |
8 | USE grlib.devices.ALL; |
|
30 | USE grlib.devices.ALL; | |
9 | USE GRLIB.DMA2AHB_Package.ALL; |
|
31 | USE GRLIB.DMA2AHB_Package.ALL; | |
10 | LIBRARY lpp; |
|
32 | LIBRARY lpp; | |
11 | USE lpp.lpp_amba.ALL; |
|
33 | USE lpp.lpp_amba.ALL; | |
12 | USE lpp.apb_devices_list.ALL; |
|
34 | USE lpp.apb_devices_list.ALL; | |
13 | USE lpp.lpp_memory.ALL; |
|
35 | USE lpp.lpp_memory.ALL; | |
14 | LIBRARY techmap; |
|
36 | LIBRARY techmap; | |
15 | USE techmap.gencomp.ALL; |
|
37 | USE techmap.gencomp.ALL; | |
16 |
|
38 | |||
17 | ENTITY lpp_dma_send_1word IS |
|
39 | ENTITY lpp_dma_send_1word IS | |
18 | PORT ( |
|
40 | PORT ( | |
19 | -- AMBA AHB system signals |
|
41 | -- AMBA AHB system signals | |
20 | HCLK : IN STD_ULOGIC; |
|
42 | HCLK : IN STD_ULOGIC; | |
21 | HRESETn : IN STD_ULOGIC; |
|
43 | HRESETn : IN STD_ULOGIC; | |
22 |
|
44 | |||
23 | -- DMA |
|
45 | -- DMA | |
24 | DMAIn : OUT DMA_In_Type; |
|
46 | DMAIn : OUT DMA_In_Type; | |
25 | DMAOut : IN DMA_OUt_Type; |
|
47 | DMAOut : IN DMA_OUt_Type; | |
26 | -- |
|
48 | -- | |
27 | send : IN STD_LOGIC; |
|
49 | send : IN STD_LOGIC; | |
28 | address : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
50 | address : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
29 | data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); |
|
51 | data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
30 | -- |
|
52 | -- | |
31 | send_ok : OUT STD_LOGIC; |
|
53 | send_ok : OUT STD_LOGIC; | |
32 | send_ko : OUT STD_LOGIC |
|
54 | send_ko : OUT STD_LOGIC | |
33 | ); |
|
55 | ); | |
34 | END lpp_dma_send_1word; |
|
56 | END lpp_dma_send_1word; | |
35 |
|
57 | |||
36 | ARCHITECTURE beh OF lpp_dma_send_1word IS |
|
58 | ARCHITECTURE beh OF lpp_dma_send_1word IS | |
37 |
|
59 | |||
38 | TYPE state_fsm_send_1word IS (IDLE, REQUEST_BUS, SEND_DATA, ERROR0, ERROR1); |
|
60 | TYPE state_fsm_send_1word IS (IDLE, REQUEST_BUS, SEND_DATA, ERROR0, ERROR1); | |
39 | SIGNAL state : state_fsm_send_1word; |
|
61 | SIGNAL state : state_fsm_send_1word; | |
40 |
|
62 | |||
41 | BEGIN -- beh |
|
63 | BEGIN -- beh | |
42 |
|
64 | |||
43 | DMAIn.Reset <= '0'; |
|
65 | DMAIn.Reset <= '0'; | |
44 | DMAIn.Address <= address; |
|
66 | DMAIn.Address <= address; | |
45 | DMAIn.Data <= data; |
|
67 | DMAIn.Data <= data; | |
46 | DMAIn.Beat <= (OTHERS => '0'); |
|
68 | DMAIn.Beat <= (OTHERS => '0'); | |
47 | DMAIn.Size <= HSIZE32; |
|
69 | DMAIn.Size <= HSIZE32; | |
48 | DMAIn.Burst <= '0'; |
|
70 | DMAIn.Burst <= '0'; | |
49 |
|
71 | |||
50 | PROCESS (HCLK, HRESETn) |
|
72 | PROCESS (HCLK, HRESETn) | |
51 | BEGIN -- PROCESS |
|
73 | BEGIN -- PROCESS | |
52 | IF HRESETn = '0' THEN -- asynchronous reset (active low) |
|
74 | IF HRESETn = '0' THEN -- asynchronous reset (active low) | |
53 | state <= IDLE; |
|
75 | state <= IDLE; | |
54 | DMAIn.Request <= '0'; |
|
76 | DMAIn.Request <= '0'; | |
55 | DMAIn.Store <= '0'; |
|
77 | DMAIn.Store <= '0'; | |
56 | send_ok <= '0'; |
|
78 | send_ok <= '0'; | |
57 | send_ko <= '0'; |
|
79 | send_ko <= '0'; | |
58 | DMAIn.Lock <= '0'; |
|
80 | DMAIn.Lock <= '0'; | |
59 | ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge |
|
81 | ELSIF HCLK'EVENT AND HCLK = '1' THEN -- rising clock edge | |
60 | CASE state IS |
|
82 | CASE state IS | |
61 | WHEN IDLE => |
|
83 | WHEN IDLE => | |
62 | DMAIn.Store <= '1'; |
|
84 | DMAIn.Store <= '1'; | |
63 | DMAIn.Request <= '0'; |
|
85 | DMAIn.Request <= '0'; | |
64 | send_ok <= '0'; |
|
86 | send_ok <= '0'; | |
65 | send_ko <= '0'; |
|
87 | send_ko <= '0'; | |
66 | DMAIn.Lock <= '0'; |
|
88 | DMAIn.Lock <= '0'; | |
67 | IF send = '1' THEN |
|
89 | IF send = '1' THEN | |
68 | DMAIn.Request <= '1'; |
|
90 | DMAIn.Request <= '1'; | |
69 | DMAIn.Lock <= '1'; |
|
91 | DMAIn.Lock <= '1'; | |
70 | state <= REQUEST_BUS; |
|
92 | state <= REQUEST_BUS; | |
71 | END IF; |
|
93 | END IF; | |
72 | WHEN REQUEST_BUS => |
|
94 | WHEN REQUEST_BUS => | |
73 | IF DMAOut.Grant = '1' THEN |
|
95 | IF DMAOut.Grant = '1' THEN | |
74 | DMAIn.Request <= '0'; |
|
96 | DMAIn.Request <= '0'; | |
75 | DMAIn.Store <= '0'; |
|
97 | DMAIn.Store <= '0'; | |
76 | state <= SEND_DATA; |
|
98 | state <= SEND_DATA; | |
77 | END IF; |
|
99 | END IF; | |
78 | WHEN SEND_DATA => |
|
100 | WHEN SEND_DATA => | |
79 | IF DMAOut.Fault = '1' THEN |
|
101 | IF DMAOut.Fault = '1' THEN | |
80 | DMAIn.Request <= '0'; |
|
102 | DMAIn.Request <= '0'; | |
81 | DMAIn.Store <= '0'; |
|
103 | DMAIn.Store <= '0'; | |
82 | state <= ERROR0; |
|
104 | state <= ERROR0; | |
83 | ELSIF DMAOut.Ready = '1' THEN |
|
105 | ELSIF DMAOut.Ready = '1' THEN | |
84 | DMAIn.Request <= '0'; |
|
106 | DMAIn.Request <= '0'; | |
85 | DMAIn.Store <= '0'; |
|
107 | DMAIn.Store <= '0'; | |
86 | send_ok <= '1'; |
|
108 | send_ok <= '1'; | |
87 | send_ko <= '0'; |
|
109 | send_ko <= '0'; | |
88 | state <= IDLE; |
|
110 | state <= IDLE; | |
89 | END IF; |
|
111 | END IF; | |
90 | WHEN ERROR0 => |
|
112 | WHEN ERROR0 => | |
91 | state <= ERROR1; |
|
113 | state <= ERROR1; | |
92 | WHEN ERROR1 => |
|
114 | WHEN ERROR1 => | |
93 | send_ok <= '0'; |
|
115 | send_ok <= '0'; | |
94 | send_ko <= '1'; |
|
116 | send_ko <= '1'; | |
95 | state <= IDLE; |
|
117 | state <= IDLE; | |
96 | WHEN OTHERS => NULL; |
|
118 | WHEN OTHERS => NULL; | |
97 | END CASE; |
|
119 | END CASE; | |
98 | END IF; |
|
120 | END IF; | |
99 | END PROCESS; |
|
121 | END PROCESS; | |
100 |
|
122 | |||
101 | END beh; |
|
123 | END beh; |
General Comments 0
You need to be logged in to leave comments.
Login now