@@ -34,7 +34,7 ENTITY cic_lfr_control_r2 IS | |||
|
34 | 34 | PORT ( |
|
35 | 35 | clk : IN STD_LOGIC; |
|
36 | 36 | rstn : IN STD_LOGIC; |
|
37 | run : IN STD_LOGIC; | |
|
37 | -- run : IN STD_LOGIC; | |
|
38 | 38 | -- |
|
39 | 39 | data_in_valid : IN STD_LOGIC; |
|
40 | 40 | data_out_16_valid : OUT STD_LOGIC; |
@@ -55,7 +55,7 ARCHITECTURE beh OF cic_lfr_control_r2 I | |||
|
55 | 55 | |
|
56 | 56 | SIGNAL STATE_CIC_LFR : STATE_CIC_LFR_TYPE; |
|
57 | 57 | |
|
58 | SIGNAL nb_data_receipt : INTEGER := 0; | |
|
58 | SIGNAL nb_data_receipt : INTEGER RANGE 0 TO 255:= 0; | |
|
59 | 59 | SIGNAL current_cmd : INTEGER := 0; |
|
60 | 60 | SIGNAL current_channel : INTEGER := 0; |
|
61 | 61 | SIGNAL sample_16_odd : STD_LOGIC; |
@@ -246,4 +246,4 BEGIN | |||
|
246 | 246 | END IF; |
|
247 | 247 | END PROCESS; |
|
248 | 248 | |
|
249 |
END beh; |
|
|
249 | END beh; No newline at end of file |
@@ -280,7 +280,7 BEGIN | |||
|
280 | 280 | PORT MAP ( |
|
281 | 281 | clk => clk, |
|
282 | 282 | rstn => rstn, |
|
283 | run => run, | |
|
283 | -- run => run, | |
|
284 | 284 | data_in_valid => data_in_valid, |
|
285 | 285 | data_out_16_valid => data_out_16_valid_s, |
|
286 | 286 | data_out_256_valid => data_out_256_valid_s, |
@@ -390,4 +390,4 BEGIN | |||
|
390 | 390 | END GENERATE all_bits; |
|
391 | 391 | END GENERATE all_channel_out_v; |
|
392 | 392 | |
|
393 | END beh; No newline at end of file | |
|
393 | END beh; |
@@ -139,7 +139,7 PACKAGE cic_pkg IS | |||
|
139 | 139 | PORT ( |
|
140 | 140 | clk : IN STD_LOGIC; |
|
141 | 141 | rstn : IN STD_LOGIC; |
|
142 | run : IN STD_LOGIC; | |
|
142 | -- run : IN STD_LOGIC; | |
|
143 | 143 | data_in_valid : IN STD_LOGIC; |
|
144 | 144 | data_out_16_valid : OUT STD_LOGIC; |
|
145 | 145 | data_out_256_valid : OUT STD_LOGIC; |
@@ -68,7 +68,7 ARCHITECTURE ar_IIR_CEL_CTRLR_v2_CONTROL | |||
|
68 | 68 | wait_valid_last_output_2); |
|
69 | 69 | SIGNAL IIR_CEL_STATE : fsmIIR_CEL_T; |
|
70 | 70 | |
|
71 | SIGNAL alu_selected_coeff : INTEGER; | |
|
71 | SIGNAL alu_selected_coeff : INTEGER RANGE 0 TO 2**Coef_sel_SZ-1; | |
|
72 | 72 | SIGNAL Chanel_ongoing : INTEGER; |
|
73 | 73 | SIGNAL Cel_ongoing : INTEGER; |
|
74 | 74 |
@@ -44,7 +44,7 END Downsampling; | |||
|
44 | 44 | |
|
45 | 45 | ARCHITECTURE beh OF Downsampling IS |
|
46 | 46 | |
|
47 | SIGNAL counter : INTEGER; | |
|
47 | SIGNAL counter : INTEGER RANGE 0 TO DivideParam-1; | |
|
48 | 48 | |
|
49 | 49 | BEGIN -- beh |
|
50 | 50 |
@@ -123,7 +123,7 ARCHITECTURE Behavioral OF apb_lfr_manag | |||
|
123 | 123 | SIGNAL force_reset : STD_LOGIC; |
|
124 | 124 | SIGNAL previous_force_reset : STD_LOGIC; |
|
125 | 125 | SIGNAL soft_reset : STD_LOGIC; |
|
126 | SIGNAL soft_reset_sync : STD_LOGIC; | |
|
126 | ||
|
127 | 127 | ----------------------------------------------------------------------------- |
|
128 | 128 | SIGNAL HK_sel_s : STD_LOGIC_VECTOR(1 DOWNTO 0); |
|
129 | 129 | |
@@ -521,4 +521,5 BEGIN | |||
|
521 | 521 | ); |
|
522 | 522 | |
|
523 | 523 | DAC_CAL_EN <= DAC_CAL_EN_s; |
|
524 | ||
|
524 | 525 | END Behavioral; |
@@ -114,6 +114,31 PACKAGE lpp_lfr_management IS | |||
|
114 | 114 | fine_time_add : IN STD_LOGIC; |
|
115 | 115 | fine_time_max_value : OUT STD_LOGIC_VECTOR(8 DOWNTO 0)); |
|
116 | 116 | END COMPONENT; |
|
117 | ||
|
118 | COMPONENT apb_lfr_management_nocal | |
|
119 | GENERIC ( | |
|
120 | tech : INTEGER; | |
|
121 | pindex : INTEGER; | |
|
122 | paddr : INTEGER; | |
|
123 | pmask : INTEGER; | |
|
124 | NB_SECOND_DESYNC : INTEGER); | |
|
125 | PORT ( | |
|
126 | clk25MHz : IN STD_LOGIC; | |
|
127 | resetn_25MHz : IN STD_LOGIC; | |
|
128 | grspw_tick : IN STD_LOGIC; | |
|
129 | apbi : IN apb_slv_in_type; | |
|
130 | apbo : OUT apb_slv_out_type; | |
|
131 | HK_sample : IN STD_LOGIC_VECTOR(15 DOWNTO 0); | |
|
132 | HK_val : IN STD_LOGIC; | |
|
133 | HK_sel : OUT STD_LOGIC_VECTOR(1 DOWNTO 0); | |
|
134 | DAC_SDO : OUT STD_LOGIC; | |
|
135 | DAC_SCK : OUT STD_LOGIC; | |
|
136 | DAC_SYNC : OUT STD_LOGIC; | |
|
137 | DAC_CAL_EN : OUT STD_LOGIC; | |
|
138 | coarse_time : OUT STD_LOGIC_VECTOR(31 DOWNTO 0); | |
|
139 | fine_time : OUT STD_LOGIC_VECTOR(15 DOWNTO 0); | |
|
140 | LFR_soft_rstn : OUT STD_LOGIC); | |
|
141 | END COMPONENT; | |
|
117 | 142 | |
|
118 | 143 | END lpp_lfr_management; |
|
119 | 144 |
@@ -1,6 +1,7 | |||
|
1 | 1 | lpp_lfr_management.vhd |
|
2 | 2 | lpp_lfr_management_apbreg_pkg.vhd |
|
3 | 3 | apb_lfr_management.vhd |
|
4 | apb_lfr_management_nocal.vhd | |
|
4 | 5 | lfr_time_management.vhd |
|
5 | 6 | fine_time_counter.vhd |
|
6 | 7 | coarse_time_counter.vhd |
@@ -30,7 +30,7 END top_ad_conv_RHF1401_withFilter; | |||
|
30 | 30 | |
|
31 | 31 | ARCHITECTURE ar_top_ad_conv_RHF1401 OF top_ad_conv_RHF1401_withFilter IS |
|
32 | 32 | |
|
33 | SIGNAL cnv_cycle_counter : INTEGER; | |
|
33 | SIGNAL cnv_cycle_counter : INTEGER RANGE 0 TO ncycle_cnv-1; | |
|
34 | 34 | SIGNAL cnv_s : STD_LOGIC; |
|
35 | 35 | SIGNAL cnv_s_reg : STD_LOGIC; |
|
36 | 36 | SIGNAL cnv_sync : STD_LOGIC; |
@@ -225,4 +225,3 END ar_top_ad_conv_RHF1401; | |||
|
225 | 225 | |
|
226 | 226 | |
|
227 | 227 | |
|
228 |
@@ -19,81 +19,82 | |||
|
19 | 19 | -- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ------------------------------------------------------------------------------ |
|
22 | library IEEE; | |
|
23 |
|
|
|
24 |
|
|
|
22 | LIBRARY IEEE; | |
|
23 | USE IEEE.STD_LOGIC_1164.ALL; | |
|
24 | USE IEEE.NUMERIC_STD.ALL; | |
|
25 | 25 | |
|
26 |
|
|
|
27 | generic( | |
|
28 | PRESZ : integer range 1 to 32:=4; | |
|
29 |
|
|
|
30 | CPTSZ : integer range 1 to 32:=16 | |
|
31 |
|
|
|
32 | Port ( | |
|
33 |
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
|
|
|
38 |
|
|
|
39 |
|
|
|
40 |
|
|
|
26 | ENTITY dynamic_freq_div IS | |
|
27 | GENERIC( | |
|
28 | PRESZ : INTEGER RANGE 1 TO 32 := 4; | |
|
29 | PREMAX : INTEGER := 16#FFFFFF#; | |
|
30 | CPTSZ : INTEGER RANGE 1 TO 32 := 16 | |
|
31 | ); | |
|
32 | PORT ( | |
|
33 | clk : IN STD_LOGIC; | |
|
34 | rstn : IN STD_LOGIC; | |
|
35 | pre : IN STD_LOGIC_VECTOR(PRESZ-1 DOWNTO 0); | |
|
36 | N : IN STD_LOGIC_VECTOR(CPTSZ-1 DOWNTO 0); | |
|
37 | Reload : IN STD_LOGIC; | |
|
38 | clk_out : OUT STD_LOGIC | |
|
39 | ); | |
|
40 | END dynamic_freq_div; | |
|
41 | 41 | |
|
42 |
|
|
|
43 | constant prescaller_reg_sz : integer := 2**PRESZ; | |
|
44 |
|
|
|
45 | signal cpt_reg : std_logic_vector(CPTSZ-1 downto 0):=(others => '0'); | |
|
46 |
|
|
|
47 | signal internal_clk : std_logic:='0'; | |
|
48 | signal internal_clk_reg : std_logic:='0'; | |
|
49 | signal clk_out_reg : std_logic:='0'; | |
|
42 | ARCHITECTURE Behavioral OF dynamic_freq_div IS | |
|
43 | CONSTANT prescaller_reg_sz : INTEGER := 2**PRESZ; | |
|
44 | CONSTANT PREMAX_max : STD_LOGIC_VECTOR(PRESZ-1 DOWNTO 0) := (OTHERS => '1'); | |
|
45 | SIGNAL cpt_reg : STD_LOGIC_VECTOR(CPTSZ-1 DOWNTO 0) := (OTHERS => '0'); | |
|
46 | SIGNAL prescaller_reg : STD_LOGIC_VECTOR(prescaller_reg_sz-1 DOWNTO 0); --:=(others => '0'); | |
|
47 | SIGNAL internal_clk : STD_LOGIC := '0'; | |
|
48 | SIGNAL internal_clk_reg : STD_LOGIC := '0'; | |
|
49 | SIGNAL clk_out_reg : STD_LOGIC := '0'; | |
|
50 | ||
|
51 | BEGIN | |
|
50 | 52 | |
|
51 | begin | |
|
53 | max0 : IF (UNSIGNED(PREMAX_max) < PREMAX) GENERATE | |
|
52 | 54 | |
|
53 | max0: if (UNSIGNED(PREMAX_max) < PREMAX) generate | |
|
54 | ||
|
55 | internal_clk <= prescaller_reg(to_integer(unsigned(pre))) when (to_integer(unsigned(pre))<=UNSIGNED(PREMAX_max)) else | |
|
55 | internal_clk <= prescaller_reg(to_integer(UNSIGNED(pre))) WHEN (to_integer(UNSIGNED(pre)) <= UNSIGNED(PREMAX_max)) ELSE | |
|
56 | 56 | prescaller_reg(to_integer(UNSIGNED(PREMAX_max))); |
|
57 | end generate; | |
|
58 | max1: if UNSIGNED(PREMAX_max) > PREMAX generate | |
|
59 | internal_clk <= prescaller_reg(to_integer(unsigned(pre))) when (to_integer(unsigned(pre))<=PREMAX) else | |
|
57 | END GENERATE; | |
|
58 | ||
|
59 | max1 : IF UNSIGNED(PREMAX_max) > PREMAX GENERATE | |
|
60 | internal_clk <= prescaller_reg(to_integer(UNSIGNED(pre))) WHEN (to_integer(UNSIGNED(pre)) <= PREMAX) ELSE | |
|
60 | 61 | prescaller_reg(PREMAX); |
|
61 | end generate; | |
|
62 | END GENERATE; | |
|
62 | 63 | |
|
63 | 64 | |
|
64 | ||
|
65 |
prescaller: |
|
|
66 | begin | |
|
67 |
|
|
|
68 |
prescaller_reg |
|
|
69 | elsif clk'event and clk = '1' then | |
|
70 |
prescaller_reg <= |
|
|
71 | end if; | |
|
72 | end process; | |
|
65 | ||
|
66 | prescaller : PROCESS(rstn, clk) | |
|
67 | BEGIN | |
|
68 | IF rstn = '0' then | |
|
69 | prescaller_reg <= (OTHERS => '0'); | |
|
70 | ELSIF clk'EVENT AND clk = '1' THEN | |
|
71 | prescaller_reg <= STD_LOGIC_VECTOR(UNSIGNED(prescaller_reg) + 1); | |
|
72 | END IF; | |
|
73 | END PROCESS; | |
|
73 | 74 | |
|
74 | 75 | |
|
75 | clk_out <= clk_out_reg; | |
|
76 | clk_out <= clk_out_reg; | |
|
76 | 77 | |
|
77 |
counter: |
|
|
78 | begin | |
|
79 |
|
|
|
80 |
cpt_reg <= ( |
|
|
81 | internal_clk_reg <= '0'; | |
|
82 | clk_out_reg <= '0'; | |
|
83 | elsif clk'event and clk = '1' then | |
|
84 |
internal_clk_reg |
|
|
85 |
|
|
|
78 | counter : PROCESS(rstn, clk) | |
|
79 | BEGIN | |
|
80 | IF rstn = '0' then | |
|
81 | cpt_reg <= (OTHERS => '0'); | |
|
82 | internal_clk_reg <= '0'; | |
|
83 | clk_out_reg <= '0'; | |
|
84 | ELSIF clk'EVENT AND clk = '1' THEN | |
|
85 | internal_clk_reg <= internal_clk; | |
|
86 | IF Reload = '1' THEN | |
|
86 | 87 | clk_out_reg <= '0'; |
|
87 |
cpt_reg <= ( |
|
|
88 |
|
|
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
|
95 | end if; | |
|
96 | end if; | |
|
97 | end process; | |
|
88 | cpt_reg <= (OTHERS => '0'); | |
|
89 | ELSIF (internal_clk = '1' AND internal_clk_reg = '0') THEN | |
|
90 | IF cpt_reg = N THEN | |
|
91 | clk_out_reg <= NOT clk_out_reg; | |
|
92 | cpt_reg <= (OTHERS => '0'); | |
|
93 | ELSE | |
|
94 | cpt_reg <= STD_LOGIC_VECTOR(UNSIGNED(cpt_reg) + 1); | |
|
95 | END IF; | |
|
96 | END IF; | |
|
97 | END IF; | |
|
98 | END PROCESS; | |
|
98 | 99 | |
|
99 |
|
|
|
100 | END Behavioral; |
@@ -65,7 +65,7 ARCHITECTURE beh OF DMA_SubSystem IS | |||
|
65 | 65 | PORT ( |
|
66 | 66 | clk : IN STD_LOGIC; |
|
67 | 67 | rstn : IN STD_LOGIC; |
|
68 | run : IN STD_LOGIC; | |
|
68 | -- run : IN STD_LOGIC; | |
|
69 | 69 | buffer_new : IN STD_LOGIC; |
|
70 | 70 | buffer_addr : IN STD_LOGIC_VECTOR(BUFFER_ADDR_SIZE-1 DOWNTO 0); |
|
71 | 71 | buffer_length : IN STD_LOGIC_VECTOR(BUFFER_LENGTH_SIZE-1 DOWNTO 0); |
@@ -222,7 +222,7 BEGIN -- beh | |||
|
222 | 222 | PORT MAP ( |
|
223 | 223 | clk => clk, |
|
224 | 224 | rstn => rstn, |
|
225 | run => run, | |
|
225 | -- run => run, | |
|
226 | 226 | |
|
227 | 227 | buffer_new => buffer_new(I), |
|
228 | 228 | buffer_addr => buffer_addr(32*(I+1)-1 DOWNTO I*32), |
@@ -10,7 +10,7 ENTITY DMA_SubSystem_GestionBuffer IS | |||
|
10 | 10 | PORT ( |
|
11 | 11 | clk : IN STD_LOGIC; |
|
12 | 12 | rstn : IN STD_LOGIC; |
|
13 | run : IN STD_LOGIC; | |
|
13 | -- run : IN STD_LOGIC; | |
|
14 | 14 | -- |
|
15 | 15 | buffer_new : IN STD_LOGIC; |
|
16 | 16 | buffer_addr : IN STD_LOGIC_VECTOR(BUFFER_ADDR_SIZE-1 DOWNTO 0); |
This diff has been collapsed as it changes many lines, (506 lines changed) Show them Hide them | |||
@@ -1,255 +1,251 | |||
|
1 | ------------------------------------------------------------------------------ | |
|
2 | -- This file is a part of the LPP VHDL IP LIBRARY | |
|
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS | |
|
4 | -- | |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
|
6 | -- it under the terms of the GNU General Public License as published by | |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
|
8 | -- (at your option) any later version. | |
|
9 | -- | |
|
10 | -- This program is distributed in the hope that it will be useful, | |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
13 | -- GNU General Public License for more details. | |
|
14 | -- | |
|
15 | -- You should have received a copy of the GNU General Public License | |
|
16 | -- along with this program; if not, write to the Free Software | |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
|
18 | ------------------------------------------------------------------------------- | |
|
19 | -- Author : Jean-christophe Pellion | |
|
20 | -- Mail : jean-christophe.pellion@lpp.polytechnique.fr | |
|
21 | -- jean-christophe.pellion@easii-ic.com | |
|
22 | ------------------------------------------------------------------------------- | |
|
23 | -- 1.0 - initial version | |
|
24 | ------------------------------------------------------------------------------- | |
|
25 | LIBRARY ieee; | |
|
26 | USE ieee.std_logic_1164.ALL; | |
|
27 | USE ieee.numeric_std.ALL; | |
|
28 | LIBRARY grlib; | |
|
29 | USE grlib.amba.ALL; | |
|
30 | USE grlib.stdlib.ALL; | |
|
31 | USE grlib.devices.ALL; | |
|
32 | ||
|
33 | LIBRARY lpp; | |
|
34 | USE lpp.lpp_amba.ALL; | |
|
35 | USE lpp.apb_devices_list.ALL; | |
|
36 | USE lpp.lpp_memory.ALL; | |
|
37 | USE lpp.lpp_dma_pkg.ALL; | |
|
38 | USE lpp.general_purpose.ALL; | |
|
39 | --USE lpp.lpp_waveform_pkg.ALL; | |
|
40 | LIBRARY techmap; | |
|
41 | USE techmap.gencomp.ALL; | |
|
42 | ||
|
43 | ||
|
44 | ENTITY lpp_dma_SEND16B_FIFO2DMA IS | |
|
45 | GENERIC ( | |
|
46 | hindex : INTEGER := 2; | |
|
47 | vendorid : IN INTEGER := 0; | |
|
48 | deviceid : IN INTEGER := 0; | |
|
49 | version : IN INTEGER := 0 | |
|
50 | ); | |
|
51 | PORT ( | |
|
52 | clk : IN STD_LOGIC; | |
|
53 | rstn : IN STD_LOGIC; | |
|
54 | ||
|
55 | -- AMBA AHB Master Interface | |
|
56 | AHB_Master_In : IN AHB_Mst_In_Type; | |
|
57 | AHB_Master_Out : OUT AHB_Mst_Out_Type; | |
|
58 | ||
|
59 | -- FIFO Interface | |
|
60 | ren : OUT STD_LOGIC; | |
|
61 | data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
|
62 | ||
|
63 | -- Controls | |
|
64 | send : IN STD_LOGIC; | |
|
65 | valid_burst : IN STD_LOGIC; -- (1 => BURST , 0 => SINGLE) | |
|
66 | done : OUT STD_LOGIC; | |
|
67 | address : IN STD_LOGIC_VECTOR(31 DOWNTO 0) | |
|
68 | ); | |
|
69 | END; | |
|
70 | ||
|
71 | ARCHITECTURE Behavioral OF lpp_dma_SEND16B_FIFO2DMA IS | |
|
72 | ||
|
73 | CONSTANT HConfig : AHB_Config_Type := ( | |
|
74 | 0 => ahb_device_reg(vendorid, deviceid, 0, version, 0), | |
|
75 | OTHERS => (OTHERS => '0')); | |
|
76 | ||
|
77 | TYPE AHB_DMA_FSM_STATE IS (IDLE, s_INIT_TRANS, s_ARBITER ,s_CTRL, s_CTRL_DATA, s_DATA); | |
|
78 | SIGNAL state : AHB_DMA_FSM_STATE; | |
|
79 | ||
|
80 | SIGNAL address_counter_reg : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
81 | SIGNAL address_counter : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
82 | ||
|
83 |
SIGNAL |
|
|
84 | SIGNAL ctrl_window : STD_LOGIC; | |
|
85 | ||
|
86 | SIGNAL bus_request : STD_LOGIC; | |
|
87 |
SIGNAL |
|
|
88 | ||
|
89 | SIGNAL data_reg : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
|
90 | ||
|
91 | SIGNAL HREADY_pre : STD_LOGIC; | |
|
92 | SIGNAL HREADY_falling : STD_LOGIC; | |
|
93 | ||
|
94 | SIGNAL inhib_ren : STD_LOGIC; | |
|
95 | ||
|
96 | BEGIN | |
|
97 | ||
|
98 | ----------------------------------------------------------------------------- | |
|
99 |
AHB_Master_Out.H |
|
|
100 |
AHB_Master_Out.H |
|
|
101 |
AHB_Master_Out.H |
|
|
102 | AHB_Master_Out.HPROT <= "0011"; --DATA ACCESS and PRIVILEDGED ACCESS | |
|
103 | AHB_Master_Out.HIRQ <= (OTHERS => '0'); | |
|
104 | AHB_Master_Out.HBURST <= "111"; -- INCR --"111"; --INCR16 | |
|
105 |
AHB_Master_Out.H |
|
|
106 | ||
|
107 | --AHB_Master_Out.HTRANS <= HTRANS_NONSEQ WHEN ctrl_window = '1' OR data_window = '1' ELSE HTRANS_IDLE; | |
|
108 | ||
|
109 | --AHB_Master_Out.HBUSREQ <= bus_request; | |
|
110 | --AHB_Master_Out.HLOCK <= data_window; | |
|
111 | ||
|
112 |
|
|
|
113 | -- '1' WHEN ctrl_window = '1' ELSE | |
|
114 | -- '0'; | |
|
115 | ||
|
116 | --bus_lock <= '0' WHEN address_counter_reg = "1111" ELSE | |
|
117 | -- '1' WHEN ctrl_window = '1' ELSE '0'; | |
|
118 | ||
|
119 | ----------------------------------------------------------------------------- | |
|
120 | AHB_Master_Out.HADDR <= address(31 DOWNTO 6) & address_counter_reg & "00"; | |
|
121 | AHB_Master_Out.HWDATA <= ahbdrivedata(data) WHEN AHB_Master_In.HREADY = '1' ELSE ahbdrivedata(data_reg); | |
|
122 | ||
|
123 | ----------------------------------------------------------------------------- | |
|
124 | --ren <= NOT ((AHB_Master_In.HGRANT(hindex) OR LAST_READ ) AND AHB_Master_In.HREADY ); | |
|
125 | --ren <= NOT beat; | |
|
126 | ----------------------------------------------------------------------------- | |
|
127 | ||
|
128 | HREADY_falling <= inhib_ren WHEN AHB_Master_In.HREADY = '0' AND HREADY_pre = '1' ELSE '1'; | |
|
129 | ||
|
130 | ||
|
131 | PROCESS (clk, rstn) | |
|
132 | BEGIN -- PROCESS | |
|
133 | IF rstn = '0' THEN -- asynchronous reset (active low) | |
|
134 | state <= IDLE; | |
|
135 | done <= '0'; | |
|
136 | ren <= '1'; | |
|
137 | address_counter_reg <= (OTHERS => '0'); | |
|
138 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
139 | AHB_Master_Out.HBUSREQ <= '0'; | |
|
140 | AHB_Master_Out.HLOCK <= '0'; | |
|
141 | ||
|
142 | data_reg <= (OTHERS => '0'); | |
|
143 | ||
|
144 | HREADY_pre <= '0'; | |
|
145 | inhib_ren <= '0'; | |
|
146 | ELSIF clk'event AND clk = '1' THEN -- rising clock edge | |
|
147 | HREADY_pre <= AHB_Master_In.HREADY; | |
|
148 | ||
|
149 | IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN | |
|
150 |
|
|
|
151 | END IF; | |
|
152 | ||
|
153 | done <= '0'; | |
|
154 | ren <= '1'; | |
|
155 | inhib_ren <= '0'; | |
|
156 | CASE state IS | |
|
157 | WHEN IDLE => | |
|
158 | AHB_Master_Out.HBUSREQ <= '0'; | |
|
159 | AHB_Master_Out.HLOCK <= '0'; | |
|
160 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
161 | address_counter_reg <= (OTHERS => '0'); | |
|
162 | IF send = '1' THEN | |
|
163 | state <= s_INIT_TRANS; | |
|
164 | END IF; | |
|
165 | ||
|
166 | WHEN s_INIT_TRANS => | |
|
167 | AHB_Master_Out.HBUSREQ <= '1'; | |
|
168 | AHB_Master_Out.HLOCK <= '1'; | |
|
169 |
AHB_Master_Out.H |
|
|
170 | state <= s_ARBITER; | |
|
171 | ||
|
172 | WHEN s_ARBITER => | |
|
173 | AHB_Master_Out.HBUSREQ <= '1'; | |
|
174 | AHB_Master_Out.HLOCK <= '1'; | |
|
175 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
176 | address_counter_reg <= (OTHERS => '0'); | |
|
177 | ||
|
178 | IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN | |
|
179 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
180 | state <= s_CTRL; | |
|
181 | END IF; | |
|
182 | ||
|
183 | WHEN s_CTRL => | |
|
184 | inhib_ren <= '1'; | |
|
185 |
AHB_Master_Out.H |
|
|
186 | AHB_Master_Out.HLOCK <= '1'; | |
|
187 | AHB_Master_Out.HTRANS <= HTRANS_NONSEQ; | |
|
188 | IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN | |
|
189 | --AHB_Master_Out.HTRANS <= HTRANS_SEQ; | |
|
190 |
|
|
|
191 | --ren <= '0'; | |
|
192 | END IF; | |
|
193 | ||
|
194 | WHEN s_CTRL_DATA => | |
|
195 | AHB_Master_Out.HBUSREQ <= '1'; | |
|
196 | AHB_Master_Out.HLOCK <= '1'; | |
|
197 | AHB_Master_Out.HTRANS <= HTRANS_SEQ; | |
|
198 | IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN | |
|
199 | address_counter_reg <= STD_LOGIC_VECTOR(UNSIGNED(address_counter_reg) + 1); | |
|
200 | END IF; | |
|
201 | ||
|
202 | IF address_counter_reg = "1111" AND AHB_Master_In.HREADY = '1' THEN | |
|
203 | AHB_Master_Out.HBUSREQ <= '0'; | |
|
204 | AHB_Master_Out.HLOCK <= '1';--'0'; | |
|
205 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
206 | state <= s_DATA; | |
|
207 | END IF; | |
|
208 | ||
|
209 | ren <= HREADY_falling; | |
|
210 | ||
|
211 | --IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' AND address_counter_reg /= "1111" THEN | |
|
212 | -- ren <= '0'; | |
|
213 | --END IF; | |
|
214 | ||
|
215 | ||
|
216 | WHEN s_DATA => | |
|
217 | ren <= HREADY_falling; | |
|
218 | ||
|
219 |
AHB_Master_Out.H |
|
|
220 | --AHB_Master_Out.HLOCK <= '0'; | |
|
221 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
222 | IF AHB_Master_In.HREADY = '1' THEN | |
|
223 | AHB_Master_Out.HLOCK <= '0'; | |
|
224 | state <= IDLE; | |
|
225 | done <= '1'; | |
|
226 |
|
|
|
227 | ||
|
228 | WHEN OTHERS => NULL; | |
|
229 | END CASE; | |
|
230 | END IF; | |
|
231 | END PROCESS; | |
|
232 | ||
|
233 | ctrl_window <= '1' WHEN state = s_CTRL OR state = s_CTRL_DATA ELSE '0'; | |
|
234 | data_window <= '1' WHEN state = s_CTRL_DATA OR state = s_DATA ELSE '0'; | |
|
235 | ----------------------------------------------------------------------------- | |
|
236 | ||
|
237 | ||
|
238 | --ren <= NOT(AHB_Master_In.HREADY) WHEN state = s_CTRL_DATA ELSE '1'; | |
|
239 | ||
|
240 | ----------------------------------------------------------------------------- | |
|
241 | --PROCESS (clk, rstn) | |
|
242 | --BEGIN -- PROCESS | |
|
243 | -- IF rstn = '0' THEN -- asynchronous reset (active low) | |
|
244 | -- address_counter_reg <= (OTHERS => '0'); | |
|
245 | -- ELSIF clk'event AND clk = '1' THEN -- rising clock edge | |
|
246 | -- address_counter_reg <= address_counter; | |
|
247 | -- END IF; | |
|
248 | --END PROCESS; | |
|
249 |
|
|
|
250 | --address_counter <= STD_LOGIC_VECTOR(UNSIGNED(address_counter_reg) + 1) WHEN data_window = '1' AND AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' ELSE | |
|
251 | -- address_counter_reg; | |
|
252 | ----------------------------------------------------------------------------- | |
|
253 | ||
|
254 | ||
|
255 | END Behavioral; | |
|
1 | ------------------------------------------------------------------------------ | |
|
2 | -- This file is a part of the LPP VHDL IP LIBRARY | |
|
3 | -- Copyright (C) 2009 - 2010, Laboratory of Plasmas Physic - CNRS | |
|
4 | -- | |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
|
6 | -- it under the terms of the GNU General Public License as published by | |
|
7 | -- the Free Software Foundation; either version 3 of the License, or | |
|
8 | -- (at your option) any later version. | |
|
9 | -- | |
|
10 | -- This program is distributed in the hope that it will be useful, | |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
13 | -- GNU General Public License for more details. | |
|
14 | -- | |
|
15 | -- You should have received a copy of the GNU General Public License | |
|
16 | -- along with this program; if not, write to the Free Software | |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
|
18 | ------------------------------------------------------------------------------- | |
|
19 | -- Author : Jean-christophe Pellion | |
|
20 | -- Mail : jean-christophe.pellion@lpp.polytechnique.fr | |
|
21 | -- jean-christophe.pellion@easii-ic.com | |
|
22 | ------------------------------------------------------------------------------- | |
|
23 | -- 1.0 - initial version | |
|
24 | ------------------------------------------------------------------------------- | |
|
25 | LIBRARY ieee; | |
|
26 | USE ieee.std_logic_1164.ALL; | |
|
27 | USE ieee.numeric_std.ALL; | |
|
28 | LIBRARY grlib; | |
|
29 | USE grlib.amba.ALL; | |
|
30 | USE grlib.stdlib.ALL; | |
|
31 | USE grlib.devices.ALL; | |
|
32 | ||
|
33 | LIBRARY lpp; | |
|
34 | USE lpp.lpp_amba.ALL; | |
|
35 | USE lpp.apb_devices_list.ALL; | |
|
36 | USE lpp.lpp_memory.ALL; | |
|
37 | USE lpp.lpp_dma_pkg.ALL; | |
|
38 | USE lpp.general_purpose.ALL; | |
|
39 | --USE lpp.lpp_waveform_pkg.ALL; | |
|
40 | LIBRARY techmap; | |
|
41 | USE techmap.gencomp.ALL; | |
|
42 | ||
|
43 | ||
|
44 | ENTITY lpp_dma_SEND16B_FIFO2DMA IS | |
|
45 | GENERIC ( | |
|
46 | hindex : INTEGER := 2; | |
|
47 | vendorid : IN INTEGER := 0; | |
|
48 | deviceid : IN INTEGER := 0; | |
|
49 | version : IN INTEGER := 0 | |
|
50 | ); | |
|
51 | PORT ( | |
|
52 | clk : IN STD_LOGIC; | |
|
53 | rstn : IN STD_LOGIC; | |
|
54 | ||
|
55 | -- AMBA AHB Master Interface | |
|
56 | AHB_Master_In : IN AHB_Mst_In_Type; | |
|
57 | AHB_Master_Out : OUT AHB_Mst_Out_Type; | |
|
58 | ||
|
59 | -- FIFO Interface | |
|
60 | ren : OUT STD_LOGIC; | |
|
61 | data : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
|
62 | ||
|
63 | -- Controls | |
|
64 | send : IN STD_LOGIC; | |
|
65 | valid_burst : IN STD_LOGIC; -- (1 => BURST , 0 => SINGLE) | |
|
66 | done : OUT STD_LOGIC; | |
|
67 | address : IN STD_LOGIC_VECTOR(31 DOWNTO 0) | |
|
68 | ); | |
|
69 | END; | |
|
70 | ||
|
71 | ARCHITECTURE Behavioral OF lpp_dma_SEND16B_FIFO2DMA IS | |
|
72 | ||
|
73 | CONSTANT HConfig : AHB_Config_Type := ( | |
|
74 | 0 => ahb_device_reg(vendorid, deviceid, 0, version, 0), | |
|
75 | OTHERS => (OTHERS => '0')); | |
|
76 | ||
|
77 | TYPE AHB_DMA_FSM_STATE IS (IDLE, s_INIT_TRANS, s_ARBITER ,s_CTRL, s_CTRL_DATA, s_DATA); | |
|
78 | SIGNAL state : AHB_DMA_FSM_STATE; | |
|
79 | ||
|
80 | SIGNAL address_counter_reg : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
81 | ||
|
82 | SIGNAL data_window : STD_LOGIC; | |
|
83 | SIGNAL ctrl_window : STD_LOGIC; | |
|
84 | ||
|
85 | SIGNAL data_reg : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
|
86 | ||
|
87 | SIGNAL HREADY_pre : STD_LOGIC; | |
|
88 | SIGNAL HREADY_falling : STD_LOGIC; | |
|
89 | ||
|
90 | SIGNAL inhib_ren : STD_LOGIC; | |
|
91 | ||
|
92 | BEGIN | |
|
93 | ||
|
94 | ----------------------------------------------------------------------------- | |
|
95 | AHB_Master_Out.HCONFIG <= HConfig; | |
|
96 | AHB_Master_Out.HSIZE <= "010"; --WORDS 32b | |
|
97 | AHB_Master_Out.HINDEX <= hindex; | |
|
98 | AHB_Master_Out.HPROT <= "0011"; --DATA ACCESS and PRIVILEDGED ACCESS | |
|
99 | AHB_Master_Out.HIRQ <= (OTHERS => '0'); | |
|
100 | AHB_Master_Out.HBURST <= "111"; -- INCR --"111"; --INCR16 | |
|
101 | AHB_Master_Out.HWRITE <= '1'; | |
|
102 | ||
|
103 | --AHB_Master_Out.HTRANS <= HTRANS_NONSEQ WHEN ctrl_window = '1' OR data_window = '1' ELSE HTRANS_IDLE; | |
|
104 | ||
|
105 | --AHB_Master_Out.HBUSREQ <= bus_request; | |
|
106 | --AHB_Master_Out.HLOCK <= data_window; | |
|
107 | ||
|
108 | --bus_request <= '0' WHEN address_counter_reg = "1111" AND AHB_Master_In.HREADY = '1' ELSE | |
|
109 | -- '1' WHEN ctrl_window = '1' ELSE | |
|
110 | -- '0'; | |
|
111 | ||
|
112 | --bus_lock <= '0' WHEN address_counter_reg = "1111" ELSE | |
|
113 | -- '1' WHEN ctrl_window = '1' ELSE '0'; | |
|
114 | ||
|
115 | ----------------------------------------------------------------------------- | |
|
116 | AHB_Master_Out.HADDR <= address(31 DOWNTO 6) & address_counter_reg & "00"; | |
|
117 | AHB_Master_Out.HWDATA <= ahbdrivedata(data) WHEN AHB_Master_In.HREADY = '1' ELSE ahbdrivedata(data_reg); | |
|
118 | ||
|
119 | ----------------------------------------------------------------------------- | |
|
120 | --ren <= NOT ((AHB_Master_In.HGRANT(hindex) OR LAST_READ ) AND AHB_Master_In.HREADY ); | |
|
121 | --ren <= NOT beat; | |
|
122 | ----------------------------------------------------------------------------- | |
|
123 | ||
|
124 | HREADY_falling <= inhib_ren WHEN AHB_Master_In.HREADY = '0' AND HREADY_pre = '1' ELSE '1'; | |
|
125 | ||
|
126 | ||
|
127 | PROCESS (clk, rstn) | |
|
128 | BEGIN -- PROCESS | |
|
129 | IF rstn = '0' THEN -- asynchronous reset (active low) | |
|
130 | state <= IDLE; | |
|
131 | done <= '0'; | |
|
132 | ren <= '1'; | |
|
133 | address_counter_reg <= (OTHERS => '0'); | |
|
134 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
135 | AHB_Master_Out.HBUSREQ <= '0'; | |
|
136 | AHB_Master_Out.HLOCK <= '0'; | |
|
137 | ||
|
138 | data_reg <= (OTHERS => '0'); | |
|
139 | ||
|
140 | HREADY_pre <= '0'; | |
|
141 | inhib_ren <= '0'; | |
|
142 | ELSIF clk'event AND clk = '1' THEN -- rising clock edge | |
|
143 | HREADY_pre <= AHB_Master_In.HREADY; | |
|
144 | ||
|
145 | IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN | |
|
146 | data_reg <= data; | |
|
147 | END IF; | |
|
148 | ||
|
149 | done <= '0'; | |
|
150 | ren <= '1'; | |
|
151 | inhib_ren <= '0'; | |
|
152 | CASE state IS | |
|
153 | WHEN IDLE => | |
|
154 | AHB_Master_Out.HBUSREQ <= '0'; | |
|
155 | AHB_Master_Out.HLOCK <= '0'; | |
|
156 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
157 | address_counter_reg <= (OTHERS => '0'); | |
|
158 | IF send = '1' THEN | |
|
159 | state <= s_INIT_TRANS; | |
|
160 | END IF; | |
|
161 | ||
|
162 | WHEN s_INIT_TRANS => | |
|
163 | AHB_Master_Out.HBUSREQ <= '1'; | |
|
164 | AHB_Master_Out.HLOCK <= '1'; | |
|
165 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
166 | state <= s_ARBITER; | |
|
167 | ||
|
168 | WHEN s_ARBITER => | |
|
169 | AHB_Master_Out.HBUSREQ <= '1'; | |
|
170 | AHB_Master_Out.HLOCK <= '1'; | |
|
171 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
172 | address_counter_reg <= (OTHERS => '0'); | |
|
173 | ||
|
174 | IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN | |
|
175 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
176 | state <= s_CTRL; | |
|
177 | END IF; | |
|
178 | ||
|
179 | WHEN s_CTRL => | |
|
180 | inhib_ren <= '1'; | |
|
181 | AHB_Master_Out.HBUSREQ <= '1'; | |
|
182 | AHB_Master_Out.HLOCK <= '1'; | |
|
183 | AHB_Master_Out.HTRANS <= HTRANS_NONSEQ; | |
|
184 | IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN | |
|
185 | --AHB_Master_Out.HTRANS <= HTRANS_SEQ; | |
|
186 | state <= s_CTRL_DATA; | |
|
187 | --ren <= '0'; | |
|
188 | END IF; | |
|
189 | ||
|
190 | WHEN s_CTRL_DATA => | |
|
191 | AHB_Master_Out.HBUSREQ <= '1'; | |
|
192 | AHB_Master_Out.HLOCK <= '1'; | |
|
193 | AHB_Master_Out.HTRANS <= HTRANS_SEQ; | |
|
194 | IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN | |
|
195 | address_counter_reg <= STD_LOGIC_VECTOR(UNSIGNED(address_counter_reg) + 1); | |
|
196 | END IF; | |
|
197 | ||
|
198 | IF address_counter_reg = "1111" AND AHB_Master_In.HREADY = '1' THEN | |
|
199 | AHB_Master_Out.HBUSREQ <= '0'; | |
|
200 | AHB_Master_Out.HLOCK <= '1';--'0'; | |
|
201 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
202 | state <= s_DATA; | |
|
203 | END IF; | |
|
204 | ||
|
205 | ren <= HREADY_falling; | |
|
206 | ||
|
207 | --IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' AND address_counter_reg /= "1111" THEN | |
|
208 | -- ren <= '0'; | |
|
209 | --END IF; | |
|
210 | ||
|
211 | ||
|
212 | WHEN s_DATA => | |
|
213 | ren <= HREADY_falling; | |
|
214 | ||
|
215 | AHB_Master_Out.HBUSREQ <= '0'; | |
|
216 | --AHB_Master_Out.HLOCK <= '0'; | |
|
217 | AHB_Master_Out.HTRANS <= HTRANS_IDLE; | |
|
218 | IF AHB_Master_In.HREADY = '1' THEN | |
|
219 | AHB_Master_Out.HLOCK <= '0'; | |
|
220 | state <= IDLE; | |
|
221 | done <= '1'; | |
|
222 | END IF; | |
|
223 | ||
|
224 | WHEN OTHERS => NULL; | |
|
225 | END CASE; | |
|
226 | END IF; | |
|
227 | END PROCESS; | |
|
228 | ||
|
229 | ctrl_window <= '1' WHEN state = s_CTRL OR state = s_CTRL_DATA ELSE '0'; | |
|
230 | data_window <= '1' WHEN state = s_CTRL_DATA OR state = s_DATA ELSE '0'; | |
|
231 | ----------------------------------------------------------------------------- | |
|
232 | ||
|
233 | ||
|
234 | --ren <= NOT(AHB_Master_In.HREADY) WHEN state = s_CTRL_DATA ELSE '1'; | |
|
235 | ||
|
236 | ----------------------------------------------------------------------------- | |
|
237 | --PROCESS (clk, rstn) | |
|
238 | --BEGIN -- PROCESS | |
|
239 | -- IF rstn = '0' THEN -- asynchronous reset (active low) | |
|
240 | -- address_counter_reg <= (OTHERS => '0'); | |
|
241 | -- ELSIF clk'event AND clk = '1' THEN -- rising clock edge | |
|
242 | -- address_counter_reg <= address_counter; | |
|
243 | -- END IF; | |
|
244 | --END PROCESS; | |
|
245 | ||
|
246 | --address_counter <= STD_LOGIC_VECTOR(UNSIGNED(address_counter_reg) + 1) WHEN data_window = '1' AND AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' ELSE | |
|
247 | -- address_counter_reg; | |
|
248 | ----------------------------------------------------------------------------- | |
|
249 | ||
|
250 | ||
|
251 | END Behavioral; No newline at end of file |
@@ -251,7 +251,7 PACKAGE lpp_dma_pkg IS | |||
|
251 | 251 | PORT ( |
|
252 | 252 | clk : IN STD_LOGIC; |
|
253 | 253 | rstn : IN STD_LOGIC; |
|
254 | run : IN STD_LOGIC; | |
|
254 | -- run : IN STD_LOGIC; | |
|
255 | 255 | buffer_new : IN STD_LOGIC; |
|
256 | 256 | buffer_addr : IN STD_LOGIC_VECTOR(BUFFER_ADDR_SIZE-1 DOWNTO 0); |
|
257 | 257 | buffer_length : IN STD_LOGIC_VECTOR(BUFFER_LENGTH_SIZE-1 DOWNTO 0); |
@@ -46,8 +46,8 USE iap.memctrl.ALL; | |||
|
46 | 46 | |
|
47 | 47 | ENTITY leon3_soc IS |
|
48 | 48 | GENERIC ( |
|
49 |
fabtech : INTEGER := a |
|
|
50 |
memtech : INTEGER := a |
|
|
49 | fabtech : INTEGER := axcel;--apa3e; | |
|
50 | memtech : INTEGER := axcel;--apa3e; | |
|
51 | 51 | padtech : INTEGER := inferred; |
|
52 | 52 | clktech : INTEGER := inferred; |
|
53 | 53 | disas : INTEGER := 0; -- Enable disassembly to console |
@@ -56,11 +56,11 ENTITY leon3_soc IS | |||
|
56 | 56 | -- |
|
57 | 57 | clk_freq : INTEGER := 25000; --kHz |
|
58 | 58 | -- |
|
59 |
IS_RADHARD : INTEGER := |
|
|
59 | IS_RADHARD : INTEGER := 1; | |
|
60 | 60 | -- |
|
61 | 61 | NB_CPU : INTEGER := 1; |
|
62 | 62 | ENABLE_FPU : INTEGER := 1; |
|
63 |
FPU_NETLIST : INTEGER := |
|
|
63 | FPU_NETLIST : INTEGER := 0; | |
|
64 | 64 | ENABLE_DSU : INTEGER := 1; |
|
65 | 65 | ENABLE_AHB_UART : INTEGER := 1; |
|
66 | 66 | ENABLE_APB_UART : INTEGER := 1; |
@@ -71,8 +71,8 ENTITY leon3_soc IS | |||
|
71 | 71 | NB_AHB_SLAVE : INTEGER := 1; |
|
72 | 72 | NB_APB_SLAVE : INTEGER := 1; |
|
73 | 73 | -- |
|
74 |
ADDRESS_SIZE : INTEGER := |
|
|
75 |
USES_IAP_MEMCTRLR : INTEGER := |
|
|
74 | ADDRESS_SIZE : INTEGER := 19; | |
|
75 | USES_IAP_MEMCTRLR : INTEGER := 1; | |
|
76 | 76 | BYPASS_EDAC_MEMCTRLR : STD_LOGIC := '0'; |
|
77 | 77 | SRBANKSZ : INTEGER := 8 |
|
78 | 78 | |
@@ -276,7 +276,7 BEGIN | |||
|
276 | 276 | l3 : IF CFG_LEON3 = 1 GENERATE |
|
277 | 277 | cpu : FOR i IN 0 TO CFG_NCPU-1 GENERATE |
|
278 | 278 | leon3_non_radhard : IF IS_RADHARD = 0 GENERATE |
|
279 |
u0 : |
|
|
279 | u0 : leon3s -- LEON3 processor | |
|
280 | 280 | GENERIC MAP (i, fabtech, memtech, CFG_NWIN, CFG_DSU, CFG_FPU, CFG_V8, |
|
281 | 281 | 0, CFG_MAC, pclow, 0, CFG_NWP, CFG_ICEN, CFG_IREPL, CFG_ISETS, CFG_ILINE, |
|
282 | 282 | CFG_ISETSZ, CFG_ILOCK, CFG_DCEN, CFG_DREPL, CFG_DSETS, CFG_DLINE, CFG_DSETSZ, |
@@ -288,7 +288,7 BEGIN | |||
|
288 | 288 | END GENERATE leon3_non_radhard; |
|
289 | 289 | |
|
290 | 290 | leon3_radhard_i : IF IS_RADHARD = 1 GENERATE |
|
291 |
cpu : |
|
|
291 | cpu : leon3ft | |
|
292 | 292 | GENERIC MAP ( |
|
293 | 293 | HINDEX => i, --: integer; --CPU_HINDEX, |
|
294 | 294 | FABTECH => fabtech, --CFG_TECH, |
@@ -63,9 +63,6 ARCHITECTURE beh OF MS_calculation IS | |||
|
63 | 63 | |
|
64 | 64 | SIGNAL fifo_in_ren_s : STD_LOGIC_VECTOR(1 DOWNTO 0); |
|
65 | 65 | |
|
66 | ||
|
67 | SIGNAL fifo_in_empty_reg : STD_LOGIC_VECTOR(1 DOWNTO 0); | |
|
68 | ||
|
69 | 66 | |
|
70 | 67 | BEGIN |
|
71 | 68 | |
@@ -94,7 +91,6 BEGIN | |||
|
94 | 91 | select_op1 <= select_R0(0); |
|
95 | 92 | select_op2 <= select_R0; |
|
96 | 93 | res_wen <= '1'; |
|
97 | fifo_in_empty_reg <= "11"; | |
|
98 | 94 | |
|
99 | 95 | ELSIF clk'EVENT AND clk = '1' THEN |
|
100 | 96 | select_ctrl <= select_ctrl_NOP; |
@@ -103,7 +99,6 BEGIN | |||
|
103 | 99 | fifo_in_ren_s <= "11"; |
|
104 | 100 | res_wen <= '1'; |
|
105 | 101 | correlation_done <= '0'; |
|
106 | fifo_in_empty_reg <= fifo_in_empty; | |
|
107 | 102 | CASE state IS |
|
108 | 103 | WHEN IDLE => |
|
109 | 104 | IF correlation_start = '1' THEN |
@@ -259,4 +254,4 BEGIN | |||
|
259 | 254 | END PROCESS; |
|
260 | 255 | |
|
261 | 256 | |
|
262 |
END beh; |
|
|
257 | END beh; No newline at end of file |
@@ -26,20 +26,20 ENTITY lpp_lfr IS | |||
|
26 | 26 | GENERIC ( |
|
27 | 27 | Mem_use : INTEGER := use_RAM; |
|
28 | 28 | tech : INTEGER := inferred; |
|
29 |
nb_data_by_buffer_size : INTEGER := |
|
|
30 |
nb_snapshot_param_size : INTEGER := |
|
|
31 |
delta_vector_size : INTEGER := 2 |
|
|
29 | nb_data_by_buffer_size : INTEGER := 32; | |
|
30 | nb_snapshot_param_size : INTEGER := 32; | |
|
31 | delta_vector_size : INTEGER := 32; | |
|
32 | 32 | delta_vector_size_f0_2 : INTEGER := 7; |
|
33 | 33 | |
|
34 |
pindex : INTEGER := |
|
|
35 |
paddr : INTEGER := |
|
|
34 | pindex : INTEGER := 15; | |
|
35 | paddr : INTEGER := 15; | |
|
36 | 36 | pmask : INTEGER := 16#fff#; |
|
37 |
pirq_ms : INTEGER := |
|
|
38 | pirq_wfp : INTEGER := 1; | |
|
37 | pirq_ms : INTEGER := 6; | |
|
38 | pirq_wfp : INTEGER := 14; | |
|
39 | 39 | |
|
40 | 40 | hindex : INTEGER := 2; |
|
41 | 41 | |
|
42 |
top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0) := |
|
|
42 | top_lfr_version : STD_LOGIC_VECTOR(23 DOWNTO 0) := X"020153"; | |
|
43 | 43 | |
|
44 | 44 | DEBUG_FORCE_DATA_DMA : INTEGER := 0 |
|
45 | 45 | |
@@ -86,9 +86,6 ARCHITECTURE beh OF lpp_lfr IS | |||
|
86 | 86 | SIGNAL sample_f2_val : STD_LOGIC; |
|
87 | 87 | SIGNAL sample_f3_val : STD_LOGIC; |
|
88 | 88 | -- |
|
89 | SIGNAL sample_f_val : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
90 | SIGNAL sample_f_data : STD_LOGIC_VECTOR((6*16)*4-1 DOWNTO 0); | |
|
91 | -- | |
|
92 | 89 | SIGNAL sample_f0_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0); |
|
93 | 90 | SIGNAL sample_f1_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0); |
|
94 | 91 | SIGNAL sample_f2_data : STD_LOGIC_VECTOR((6*16)-1 DOWNTO 0); |
@@ -599,4 +596,4 BEGIN | |||
|
599 | 596 | END GENERATE all_channel_sim; |
|
600 | 597 | ----------------------------------------------------------------------------- |
|
601 | 598 | |
|
602 |
END beh; |
|
|
599 | END beh; No newline at end of file |
This diff has been collapsed as it changes many lines, (963 lines changed) Show them Hide them | |||
@@ -1,485 +1,478 | |||
|
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 | USE ieee.numeric_std.ALL; | |
|
26 | ||
|
27 | LIBRARY grlib; | |
|
28 | USE grlib.amba.ALL; | |
|
29 | USE grlib.stdlib.ALL; | |
|
30 | USE grlib.devices.ALL; | |
|
31 | USE GRLIB.DMA2AHB_Package.ALL; | |
|
32 | ||
|
33 | LIBRARY lpp; | |
|
34 | USE lpp.lpp_waveform_pkg.ALL; | |
|
35 | USE lpp.iir_filter.ALL; | |
|
36 | USE lpp.lpp_memory.ALL; | |
|
37 | ||
|
38 | LIBRARY techmap; | |
|
39 | USE techmap.gencomp.ALL; | |
|
40 | ||
|
41 | ENTITY lpp_waveform IS | |
|
42 | ||
|
43 | GENERIC ( | |
|
44 | tech : INTEGER := inferred; | |
|
45 | data_size : INTEGER := 96; --16*6 | |
|
46 | nb_data_by_buffer_size : INTEGER := 11; | |
|
47 | -- nb_word_by_buffer_size : INTEGER := 11; | |
|
48 | nb_snapshot_param_size : INTEGER := 11; | |
|
49 | delta_vector_size : INTEGER := 20; | |
|
50 | delta_vector_size_f0_2 : INTEGER := 3); | |
|
51 | ||
|
52 | PORT ( | |
|
53 | clk : IN STD_LOGIC; | |
|
54 | rstn : IN STD_LOGIC; | |
|
55 | ||
|
56 | ---- AMBA AHB Master Interface | |
|
57 | --AHB_Master_In : IN AHB_Mst_In_Type; -- TODO | |
|
58 | --AHB_Master_Out : OUT AHB_Mst_Out_Type; -- TODO | |
|
59 | ||
|
60 | --config | |
|
61 | reg_run : IN STD_LOGIC; | |
|
62 | reg_start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0); | |
|
63 | reg_delta_snapshot : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0); | |
|
64 | reg_delta_f0 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0); | |
|
65 | reg_delta_f0_2 : IN STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0); | |
|
66 | reg_delta_f1 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0); | |
|
67 | reg_delta_f2 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0); | |
|
68 | ||
|
69 | enable_f0 : IN STD_LOGIC; | |
|
70 | enable_f1 : IN STD_LOGIC; | |
|
71 | enable_f2 : IN STD_LOGIC; | |
|
72 | enable_f3 : IN STD_LOGIC; | |
|
73 | ||
|
74 | burst_f0 : IN STD_LOGIC; | |
|
75 | burst_f1 : IN STD_LOGIC; | |
|
76 | burst_f2 : IN STD_LOGIC; | |
|
77 | ||
|
78 | nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0); | |
|
79 | -- nb_word_by_buffer : IN STD_LOGIC_VECTOR(nb_word_by_buffer_size-1 DOWNTO 0); | |
|
80 | nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0); | |
|
81 | ||
|
82 | status_new_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); -- New data f(i) before the current data is write by dma | |
|
83 | ||
|
84 | ||
|
85 | -- REG DMA | |
|
86 | status_buffer_ready : IN STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
87 | addr_buffer : IN STD_LOGIC_VECTOR(32*4-1 DOWNTO 0); | |
|
88 | length_buffer : IN STD_LOGIC_VECTOR(25 DOWNTO 0); | |
|
89 | ||
|
90 | ready_buffer : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
91 | buffer_time : OUT STD_LOGIC_VECTOR(48*4-1 DOWNTO 0); | |
|
92 | error_buffer_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
93 | ||
|
94 | --------------------------------------------------------------------------- | |
|
95 | -- INPUT | |
|
96 | coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
|
97 | -- fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); | |
|
98 | ||
|
99 | --f0 | |
|
100 | data_f0_in_valid : IN STD_LOGIC; | |
|
101 | data_f0_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
102 | data_f0_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
103 | --f1 | |
|
104 | data_f1_in_valid : IN STD_LOGIC; | |
|
105 | data_f1_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
106 | data_f1_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
107 | --f2 | |
|
108 | data_f2_in_valid : IN STD_LOGIC; | |
|
109 | data_f2_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
110 | data_f2_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
111 | --f3 | |
|
112 | data_f3_in_valid : IN STD_LOGIC; | |
|
113 | data_f3_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
114 | data_f3_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
115 | ||
|
116 | --------------------------------------------------------------------------- | |
|
117 | -- DMA -------------------------------------------------------------------- | |
|
118 | ||
|
119 | dma_fifo_valid_burst : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
120 | dma_fifo_data : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0); | |
|
121 | dma_fifo_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
122 | dma_buffer_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
123 | dma_buffer_addr : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0); | |
|
124 | dma_buffer_length : OUT STD_LOGIC_VECTOR(26*4-1 DOWNTO 0); | |
|
125 | dma_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
126 | dma_buffer_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0) | |
|
127 | ||
|
128 | ); | |
|
129 | ||
|
130 | END lpp_waveform; | |
|
131 | ||
|
132 | ARCHITECTURE beh OF lpp_waveform IS | |
|
133 | SIGNAL start_snapshot_f0 : STD_LOGIC; | |
|
134 | SIGNAL start_snapshot_f1 : STD_LOGIC; | |
|
135 | SIGNAL start_snapshot_f2 : STD_LOGIC; | |
|
136 | ||
|
137 | SIGNAL data_f0_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
138 | SIGNAL data_f1_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
139 | SIGNAL data_f2_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
140 | SIGNAL data_f3_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
141 | ||
|
142 | SIGNAL data_f0_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
143 | SIGNAL data_f1_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
144 | SIGNAL data_f2_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
145 | SIGNAL data_f3_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
146 | ||
|
147 | SIGNAL data_f0_out_valid : STD_LOGIC; | |
|
148 | SIGNAL data_f1_out_valid : STD_LOGIC; | |
|
149 | SIGNAL data_f2_out_valid : STD_LOGIC; | |
|
150 | SIGNAL data_f3_out_valid : STD_LOGIC; | |
|
151 | SIGNAL nb_snapshot_param_more_one : STD_LOGIC_VECTOR(nb_snapshot_param_size DOWNTO 0); | |
|
152 | -- | |
|
153 | SIGNAL valid_in : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
154 | SIGNAL valid_out : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
155 | SIGNAL valid_ack : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
156 |
SIGNAL |
|
|
157 |
SIGNAL |
|
|
158 |
SIGNAL |
|
|
159 |
SIGNAL |
|
|
160 |
SIGNAL |
|
|
161 |
SIGNAL |
|
|
162 | SIGNAL full_almost : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
163 |
SIGNAL |
|
|
164 | SIGNAL empty_almost : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
165 |
SIGNAL |
|
|
166 | -- | |
|
167 | SIGNAL data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
168 |
SIGNAL |
|
|
169 |
SIGNAL |
|
|
170 |
SIGNAL |
|
|
171 | -- | |
|
172 |
SIGNAL |
|
|
173 | -- | |
|
174 | TYPE TIME_VECTOR IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
175 | SIGNAL data_out : Data_Vector(3 DOWNTO 0, 95 DOWNTO 0); | |
|
176 | SIGNAL time_out_2 : Data_Vector(3 DOWNTO 0, 47 DOWNTO 0); | |
|
177 |
SIGNAL |
|
|
178 |
SIGNAL |
|
|
179 |
SIGNAL |
|
|
180 |
SIGNAL |
|
|
181 | -- | |
|
182 | ||
|
183 | SIGNAL s_empty_almost : STD_LOGIC_VECTOR(3 DOWNTO 0); --occupancy is lesser than 16 * 32b | |
|
184 |
SIGNAL |
|
|
185 | SIGNAL s_data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
186 |
|
|
|
187 | SIGNAL s_rdata_v : STD_LOGIC_VECTOR(32*4-1 DOWNTO 0); | |
|
188 | ||
|
189 |
|
|
|
190 | SIGNAL arbiter_time_out : STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
191 | SIGNAL arbiter_time_out_new : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
192 | ||
|
193 | SIGNAL fifo_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0); | |
|
194 | ||
|
195 | SIGNAL fifo_buffer_time_s : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0); | |
|
196 | ||
|
197 | BEGIN -- beh | |
|
198 | ||
|
199 | ----------------------------------------------------------------------------- | |
|
200 | ||
|
201 | lpp_waveform_snapshot_controler_1 : lpp_waveform_snapshot_controler | |
|
202 | GENERIC MAP ( | |
|
203 | delta_vector_size => delta_vector_size, | |
|
204 | delta_vector_size_f0_2 => delta_vector_size_f0_2 | |
|
205 | ) | |
|
206 | PORT MAP ( | |
|
207 | clk => clk, | |
|
208 | rstn => rstn, | |
|
209 | reg_run => reg_run, | |
|
210 | reg_start_date => reg_start_date, | |
|
211 | reg_delta_snapshot => reg_delta_snapshot, | |
|
212 | reg_delta_f0 => reg_delta_f0, | |
|
213 | reg_delta_f0_2 => reg_delta_f0_2, | |
|
214 | reg_delta_f1 => reg_delta_f1, | |
|
215 | reg_delta_f2 => reg_delta_f2, | |
|
216 | coarse_time => coarse_time(30 DOWNTO 0), | |
|
217 | data_f0_valid => data_f0_in_valid, | |
|
218 | data_f2_valid => data_f2_in_valid, | |
|
219 | start_snapshot_f0 => start_snapshot_f0, | |
|
220 | start_snapshot_f1 => start_snapshot_f1, | |
|
221 | start_snapshot_f2 => start_snapshot_f2, | |
|
222 |
|
|
|
223 | ||
|
224 | lpp_waveform_snapshot_f0 : lpp_waveform_snapshot | |
|
225 | GENERIC MAP ( | |
|
226 | data_size => data_size, | |
|
227 |
nb_snapshot_param |
|
|
228 | PORT MAP ( | |
|
229 |
|
|
|
230 | rstn => rstn, | |
|
231 |
|
|
|
232 | enable => enable_f0, | |
|
233 | burst_enable => burst_f0, | |
|
234 |
|
|
|
235 | start_snapshot => start_snapshot_f0, | |
|
236 | data_in => data_f0_in, | |
|
237 | data_in_valid => data_f0_in_valid, | |
|
238 |
data_ |
|
|
239 | data_out_valid => data_f0_out_valid); | |
|
240 | ||
|
241 | nb_snapshot_param_more_one <= ('0' & nb_snapshot_param) ;--+ 1; | |
|
242 | ||
|
243 | lpp_waveform_snapshot_f1 : lpp_waveform_snapshot | |
|
244 | GENERIC MAP ( | |
|
245 | data_size => data_size, | |
|
246 |
nb_snapshot_param |
|
|
247 | PORT MAP ( | |
|
248 |
|
|
|
249 | rstn => rstn, | |
|
250 |
|
|
|
251 | enable => enable_f1, | |
|
252 | burst_enable => burst_f1, | |
|
253 | nb_snapshot_param => nb_snapshot_param_more_one, | |
|
254 | start_snapshot => start_snapshot_f1, | |
|
255 |
data_ |
|
|
256 | data_in_valid => data_f1_in_valid, | |
|
257 | data_out => data_f1_out, | |
|
258 | data_out_valid => data_f1_out_valid); | |
|
259 | ||
|
260 | lpp_waveform_snapshot_f2 : lpp_waveform_snapshot | |
|
261 | GENERIC MAP ( | |
|
262 | data_size => data_size, | |
|
263 |
nb_snapshot_param |
|
|
264 | PORT MAP ( | |
|
265 |
|
|
|
266 | rstn => rstn, | |
|
267 |
|
|
|
268 | enable => enable_f2, | |
|
269 | burst_enable => burst_f2, | |
|
270 | nb_snapshot_param => nb_snapshot_param_more_one, | |
|
271 | start_snapshot => start_snapshot_f2, | |
|
272 |
data_ |
|
|
273 | data_in_valid => data_f2_in_valid, | |
|
274 | data_out => data_f2_out, | |
|
275 | data_out_valid => data_f2_out_valid); | |
|
276 | ||
|
277 | lpp_waveform_burst_f3 : lpp_waveform_burst | |
|
278 | GENERIC MAP ( | |
|
279 |
data_ |
|
|
280 | PORT MAP ( | |
|
281 | clk => clk, | |
|
282 | rstn => rstn, | |
|
283 | run => run, | |
|
284 | enable => enable_f3, | |
|
285 | data_in => data_f3_in, | |
|
286 | data_in_valid => data_f3_in_valid, | |
|
287 | data_out => data_f3_out, | |
|
288 | data_out_valid => data_f3_out_valid); | |
|
289 | ||
|
290 | ----------------------------------------------------------------------------- | |
|
291 | -- DEBUG -- SNAPSHOT OUT | |
|
292 |
--debug_f |
|
|
293 | --debug_f0_data <= data_f0_out; | |
|
294 | --debug_f1_data_valid <= data_f1_out_valid; | |
|
295 | --debug_f1_data <= data_f1_out; | |
|
296 | --debug_f2_data_valid <= data_f2_out_valid; | |
|
297 | --debug_f2_data <= data_f2_out; | |
|
298 | --debug_f3_data_valid <= data_f3_out_valid; | |
|
299 | --debug_f3_data <= data_f3_out; | |
|
300 | ----------------------------------------------------------------------------- | |
|
301 | ||
|
302 | PROCESS (clk, rstn) | |
|
303 | BEGIN -- PROCESS | |
|
304 | IF rstn = '0' THEN -- asynchronous reset (active low) | |
|
305 | time_reg1 <= (OTHERS => '0'); | |
|
306 | time_reg2 <= (OTHERS => '0'); | |
|
307 | ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge | |
|
308 | time_reg1(48*1-1 DOWNTO 48*0) <= data_f0_time(15 DOWNTO 0) & data_f0_time(47 DOWNTO 16); | |
|
309 | time_reg1(48*2-1 DOWNTO 48*1) <= data_f1_time(15 DOWNTO 0) & data_f1_time(47 DOWNTO 16); | |
|
310 | time_reg1(48*3-1 DOWNTO 48*2) <= data_f2_time(15 DOWNTO 0) & data_f2_time(47 DOWNTO 16); | |
|
311 | time_reg1(48*4-1 DOWNTO 48*3) <= data_f3_time(15 DOWNTO 0) & data_f3_time(47 DOWNTO 16); | |
|
312 | time_reg2 <= time_reg1; | |
|
313 | END IF; | |
|
314 | END PROCESS; | |
|
315 | ||
|
316 | valid_in <= data_f3_out_valid & data_f2_out_valid & data_f1_out_valid & data_f0_out_valid; | |
|
317 | all_input_valid : FOR i IN 3 DOWNTO 0 GENERATE | |
|
318 | lpp_waveform_dma_genvalid_I : lpp_waveform_dma_genvalid | |
|
319 | PORT MAP ( | |
|
320 | HCLK => clk, | |
|
321 | HRESETn => rstn, | |
|
322 | run => run, | |
|
323 | valid_in => valid_in(I), | |
|
324 | ack_in => valid_ack(I), | |
|
325 | time_in => time_reg2(48*(I+1)-1 DOWNTO 48*I), -- Todo | |
|
326 | valid_out => valid_out(I), | |
|
327 | time_out => time_out(I), -- Todo | |
|
328 | error => status_new_err(I)); | |
|
329 | END GENERATE all_input_valid; | |
|
330 |
|
|
|
331 |
|
|
|
332 |
data_f |
|
|
333 |
data_f |
|
|
334 |
data_f |
|
|
335 |
data_f |
|
|
336 |
data_f |
|
|
337 | ||
|
338 |
data_f |
|
|
339 |
data_f |
|
|
340 |
data_f |
|
|
341 |
data_f |
|
|
342 |
data_f |
|
|
343 |
data_f |
|
|
344 | ||
|
345 |
data_f |
|
|
346 |
data_f |
|
|
347 |
data_f |
|
|
348 |
data_f |
|
|
349 |
data_f |
|
|
350 |
data_f |
|
|
351 | ||
|
352 | data_f3_out_swap <= data_f3_out((16*5)-1 DOWNTO 16*4) & | |
|
353 | data_f3_out((16*6)-1 DOWNTO 16*5) & | |
|
354 | data_f3_out((16*3)-1 DOWNTO 16*2) & | |
|
355 | data_f3_out((16*4)-1 DOWNTO 16*3) & | |
|
356 | data_f3_out((16*1)-1 DOWNTO 16*0) & | |
|
357 | data_f3_out((16*2)-1 DOWNTO 16*1) ; | |
|
358 | ||
|
359 | all_bit_of_data_out : FOR I IN 95 DOWNTO 0 GENERATE | |
|
360 | data_out(0, I) <= data_f0_out_swap(I); | |
|
361 | data_out(1, I) <= data_f1_out_swap(I); | |
|
362 | data_out(2, I) <= data_f2_out_swap(I); | |
|
363 | data_out(3, I) <= data_f3_out_swap(I); | |
|
364 | END GENERATE all_bit_of_data_out; | |
|
365 | ||
|
366 | ----------------------------------------------------------------------------- | |
|
367 | -- TODO : debug | |
|
368 | ----------------------------------------------------------------------------- | |
|
369 | all_bit_of_time_out : FOR I IN 47 DOWNTO 0 GENERATE | |
|
370 | all_sample_of_time_out : FOR J IN 3 DOWNTO 0 GENERATE | |
|
371 | time_out_2(J, I) <= time_out(J)(I); | |
|
372 | END GENERATE all_sample_of_time_out; | |
|
373 | END GENERATE all_bit_of_time_out; | |
|
374 | ||
|
375 | lpp_waveform_fifo_arbiter_1 : lpp_waveform_fifo_arbiter | |
|
376 | GENERIC MAP (tech => tech, | |
|
377 | nb_data_by_buffer_size => nb_data_by_buffer_size) | |
|
378 | PORT MAP ( | |
|
379 |
|
|
|
380 | rstn => rstn, | |
|
381 | run => run, | |
|
382 |
|
|
|
383 | data_in_valid => valid_out, | |
|
384 | data_in_ack => valid_ack, | |
|
385 | data_in => data_out, | |
|
386 |
time_ |
|
|
387 | ||
|
388 | data_out => wdata, | |
|
389 | data_out_wen => data_wen, | |
|
390 | full_almost => full_almost, | |
|
391 | full => full, | |
|
392 | ||
|
393 | time_out => arbiter_time_out, | |
|
394 | time_out_new => arbiter_time_out_new | |
|
395 | ||
|
396 | ); | |
|
397 | ||
|
398 | ----------------------------------------------------------------------------- | |
|
399 | ----------------------------------------------------------------------------- | |
|
400 | ||
|
401 | generate_all_fifo: FOR I IN 0 TO 3 GENERATE | |
|
402 | lpp_fifo_1: lpp_fifo | |
|
403 |
|
|
|
404 |
|
|
|
405 |
|
|
|
406 | EMPTY_THRESHOLD_LIMIT => 15, | |
|
407 | FULL_THRESHOLD_LIMIT => 3, | |
|
408 |
|
|
|
409 | AddrSz => 7) | |
|
410 | PORT MAP ( | |
|
411 |
|
|
|
412 |
|
|
|
413 |
|
|
|
414 | run => run, | |
|
415 | ren => data_ren(I), | |
|
416 | rdata => s_rdata_v((I+1)*32-1 downto I*32), | |
|
417 | wen => data_wen(I), | |
|
418 | wdata => wdata, | |
|
419 | empty => empty(I), | |
|
420 | full => full(I), | |
|
421 | full_almost => OPEN, | |
|
422 | empty_threshold => empty_almost(I), | |
|
423 | full_threshold => full_almost(I) ); | |
|
424 | ||
|
425 | END GENERATE generate_all_fifo; | |
|
426 | ||
|
427 | ----------------------------------------------------------------------------- | |
|
428 | -- | |
|
429 | ----------------------------------------------------------------------------- | |
|
430 | ||
|
431 | all_channel: FOR I IN 3 DOWNTO 0 GENERATE | |
|
432 | ||
|
433 | PROCESS (clk, rstn) | |
|
434 | BEGIN | |
|
435 | IF rstn = '0' THEN | |
|
436 | fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0'); | |
|
437 | ELSIF clk'event AND clk = '1' THEN | |
|
438 | IF run = '0' THEN | |
|
439 | fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0'); | |
|
440 | ELSE | |
|
441 | IF arbiter_time_out_new(I) = '1' THEN -- modif JC 15-01-2015 | |
|
442 |
fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) |
|
|
443 |
|
|
|
444 | END IF; | |
|
445 | END IF; | |
|
446 | END PROCESS; | |
|
447 | ||
|
448 | fifo_buffer_time_s(48*(I+1)-1 DOWNTO 48*I) <= arbiter_time_out WHEN arbiter_time_out_new(I) = '1' ELSE | |
|
449 | fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I); | |
|
450 | ||
|
451 | lpp_waveform_fsmdma_I: lpp_waveform_fsmdma | |
|
452 | PORT MAP ( | |
|
453 | clk => clk, | |
|
454 | rstn => rstn, | |
|
455 |
|
|
|
456 |
|
|
|
457 | fifo_buffer_time => fifo_buffer_time_s(48*(I+1)-1 DOWNTO 48*I), | |
|
458 | ||
|
459 | fifo_data => s_rdata_v(32*(I+1)-1 DOWNTO 32*I), | |
|
460 | fifo_empty => empty(I), | |
|
461 | fifo_empty_threshold => empty_almost(I), | |
|
462 | fifo_ren => data_ren(I), | |
|
463 | ||
|
464 | dma_fifo_valid_burst => dma_fifo_valid_burst(I), | |
|
465 | dma_fifo_data => dma_fifo_data(32*(I+1)-1 DOWNTO 32*I), | |
|
466 | dma_fifo_ren => dma_fifo_ren(I), | |
|
467 | dma_buffer_new => dma_buffer_new(I), | |
|
468 |
|
|
|
469 | dma_buffer_length => dma_buffer_length(26*(I+1)-1 DOWNTO 26*I), | |
|
470 | dma_buffer_full => dma_buffer_full(I), | |
|
471 | dma_buffer_full_err => dma_buffer_full_err(I), | |
|
472 | ||
|
473 | status_buffer_ready => status_buffer_ready(I), -- TODO | |
|
474 | addr_buffer => addr_buffer(32*(I+1)-1 DOWNTO 32*I), -- TODO | |
|
475 | length_buffer => length_buffer,--(26*(I+1)-1 DOWNTO 26*I), -- TODO | |
|
476 | ready_buffer => ready_buffer(I), -- TODO | |
|
477 | buffer_time => OPEN,--buffer_time(48*(I+1)-1 DOWNTO 48*I), -- TODO | |
|
478 | error_buffer_full => error_buffer_full(I)); -- TODO | |
|
479 | ||
|
480 | buffer_time(48*(I+1)-1 DOWNTO 48*I) <= fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I); | |
|
481 | ||
|
482 | END GENERATE all_channel; | |
|
483 | ||
|
484 | ||
|
485 | END beh; | |
|
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 | USE ieee.numeric_std.ALL; | |
|
26 | ||
|
27 | LIBRARY grlib; | |
|
28 | USE grlib.amba.ALL; | |
|
29 | USE grlib.stdlib.ALL; | |
|
30 | USE grlib.devices.ALL; | |
|
31 | USE GRLIB.DMA2AHB_Package.ALL; | |
|
32 | ||
|
33 | LIBRARY lpp; | |
|
34 | USE lpp.lpp_waveform_pkg.ALL; | |
|
35 | USE lpp.iir_filter.ALL; | |
|
36 | USE lpp.lpp_memory.ALL; | |
|
37 | ||
|
38 | LIBRARY techmap; | |
|
39 | USE techmap.gencomp.ALL; | |
|
40 | ||
|
41 | ENTITY lpp_waveform IS | |
|
42 | ||
|
43 | GENERIC ( | |
|
44 | tech : INTEGER := inferred; | |
|
45 | data_size : INTEGER := 96; --16*6 | |
|
46 | nb_data_by_buffer_size : INTEGER := 11; | |
|
47 | -- nb_word_by_buffer_size : INTEGER := 11; | |
|
48 | nb_snapshot_param_size : INTEGER := 11; | |
|
49 | delta_vector_size : INTEGER := 20; | |
|
50 | delta_vector_size_f0_2 : INTEGER := 3); | |
|
51 | ||
|
52 | PORT ( | |
|
53 | clk : IN STD_LOGIC; | |
|
54 | rstn : IN STD_LOGIC; | |
|
55 | ||
|
56 | ---- AMBA AHB Master Interface | |
|
57 | --AHB_Master_In : IN AHB_Mst_In_Type; -- TODO | |
|
58 | --AHB_Master_Out : OUT AHB_Mst_Out_Type; -- TODO | |
|
59 | ||
|
60 | --config | |
|
61 | reg_run : IN STD_LOGIC; | |
|
62 | reg_start_date : IN STD_LOGIC_VECTOR(30 DOWNTO 0); | |
|
63 | reg_delta_snapshot : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0); | |
|
64 | reg_delta_f0 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0); | |
|
65 | reg_delta_f0_2 : IN STD_LOGIC_VECTOR(delta_vector_size_f0_2-1 DOWNTO 0); | |
|
66 | reg_delta_f1 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0); | |
|
67 | reg_delta_f2 : IN STD_LOGIC_VECTOR(delta_vector_size-1 DOWNTO 0); | |
|
68 | ||
|
69 | enable_f0 : IN STD_LOGIC; | |
|
70 | enable_f1 : IN STD_LOGIC; | |
|
71 | enable_f2 : IN STD_LOGIC; | |
|
72 | enable_f3 : IN STD_LOGIC; | |
|
73 | ||
|
74 | burst_f0 : IN STD_LOGIC; | |
|
75 | burst_f1 : IN STD_LOGIC; | |
|
76 | burst_f2 : IN STD_LOGIC; | |
|
77 | ||
|
78 | nb_data_by_buffer : IN STD_LOGIC_VECTOR(nb_data_by_buffer_size-1 DOWNTO 0); | |
|
79 | -- nb_word_by_buffer : IN STD_LOGIC_VECTOR(nb_word_by_buffer_size-1 DOWNTO 0); | |
|
80 | nb_snapshot_param : IN STD_LOGIC_VECTOR(nb_snapshot_param_size-1 DOWNTO 0); | |
|
81 | ||
|
82 | status_new_err : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); -- New data f(i) before the current data is write by dma | |
|
83 | ||
|
84 | ||
|
85 | -- REG DMA | |
|
86 | status_buffer_ready : IN STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
87 | addr_buffer : IN STD_LOGIC_VECTOR(32*4-1 DOWNTO 0); | |
|
88 | length_buffer : IN STD_LOGIC_VECTOR(25 DOWNTO 0); | |
|
89 | ||
|
90 | ready_buffer : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
91 | buffer_time : OUT STD_LOGIC_VECTOR(48*4-1 DOWNTO 0); | |
|
92 | error_buffer_full : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
93 | ||
|
94 | --------------------------------------------------------------------------- | |
|
95 | -- INPUT | |
|
96 | coarse_time : IN STD_LOGIC_VECTOR(31 DOWNTO 0); | |
|
97 | -- fine_time : IN STD_LOGIC_VECTOR(15 DOWNTO 0); | |
|
98 | ||
|
99 | --f0 | |
|
100 | data_f0_in_valid : IN STD_LOGIC; | |
|
101 | data_f0_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
102 | data_f0_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
103 | --f1 | |
|
104 | data_f1_in_valid : IN STD_LOGIC; | |
|
105 | data_f1_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
106 | data_f1_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
107 | --f2 | |
|
108 | data_f2_in_valid : IN STD_LOGIC; | |
|
109 | data_f2_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
110 | data_f2_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
111 | --f3 | |
|
112 | data_f3_in_valid : IN STD_LOGIC; | |
|
113 | data_f3_in : IN STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
114 | data_f3_time : IN STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
115 | ||
|
116 | --------------------------------------------------------------------------- | |
|
117 | -- DMA -------------------------------------------------------------------- | |
|
118 | ||
|
119 | dma_fifo_valid_burst : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
120 | dma_fifo_data : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0); | |
|
121 | dma_fifo_ren : IN STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
122 | dma_buffer_new : OUT STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
123 | dma_buffer_addr : OUT STD_LOGIC_VECTOR(32*4-1 DOWNTO 0); | |
|
124 | dma_buffer_length : OUT STD_LOGIC_VECTOR(26*4-1 DOWNTO 0); | |
|
125 | dma_buffer_full : IN STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
126 | dma_buffer_full_err : IN STD_LOGIC_VECTOR(3 DOWNTO 0) | |
|
127 | ||
|
128 | ); | |
|
129 | ||
|
130 | END lpp_waveform; | |
|
131 | ||
|
132 | ARCHITECTURE beh OF lpp_waveform IS | |
|
133 | SIGNAL start_snapshot_f0 : STD_LOGIC; | |
|
134 | SIGNAL start_snapshot_f1 : STD_LOGIC; | |
|
135 | SIGNAL start_snapshot_f2 : STD_LOGIC; | |
|
136 | ||
|
137 | SIGNAL data_f0_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
138 | SIGNAL data_f1_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
139 | SIGNAL data_f2_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
140 | SIGNAL data_f3_out : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
141 | ||
|
142 | SIGNAL data_f0_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
143 | SIGNAL data_f1_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
144 | SIGNAL data_f2_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
145 | SIGNAL data_f3_out_swap : STD_LOGIC_VECTOR(data_size-1 DOWNTO 0); | |
|
146 | ||
|
147 | SIGNAL data_f0_out_valid : STD_LOGIC; | |
|
148 | SIGNAL data_f1_out_valid : STD_LOGIC; | |
|
149 | SIGNAL data_f2_out_valid : STD_LOGIC; | |
|
150 | SIGNAL data_f3_out_valid : STD_LOGIC; | |
|
151 | SIGNAL nb_snapshot_param_more_one : STD_LOGIC_VECTOR(nb_snapshot_param_size DOWNTO 0); | |
|
152 | -- | |
|
153 | SIGNAL valid_in : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
154 | SIGNAL valid_out : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
155 | SIGNAL valid_ack : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
156 | SIGNAL data_wen : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
157 | SIGNAL wdata : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
|
158 | SIGNAL full_almost : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
159 | SIGNAL full : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
160 | SIGNAL empty_almost : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
161 | SIGNAL empty : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
162 | -- | |
|
163 | SIGNAL data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
164 | -- | |
|
165 | SIGNAL run : STD_LOGIC; | |
|
166 | -- | |
|
167 | TYPE TIME_VECTOR IS ARRAY (NATURAL RANGE <>) OF STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
168 | SIGNAL data_out : Data_Vector(3 DOWNTO 0, 95 DOWNTO 0); | |
|
169 | SIGNAL time_out_2 : Data_Vector(3 DOWNTO 0, 47 DOWNTO 0); | |
|
170 | SIGNAL time_out : TIME_VECTOR(3 DOWNTO 0); | |
|
171 | SIGNAL time_out_debug : TIME_VECTOR(3 DOWNTO 0); -- TODO : debug | |
|
172 | SIGNAL time_reg1 : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0); | |
|
173 | SIGNAL time_reg2 : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0); | |
|
174 | -- | |
|
175 | ||
|
176 | SIGNAL s_empty_almost : STD_LOGIC_VECTOR(3 DOWNTO 0); --occupancy is lesser than 16 * 32b | |
|
177 | SIGNAL s_empty : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
178 | SIGNAL s_data_ren : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
179 | -- SIGNAL s_rdata : STD_LOGIC_VECTOR(31 DOWNTO 0); | |
|
180 | SIGNAL s_rdata_v : STD_LOGIC_VECTOR(32*4-1 DOWNTO 0); | |
|
181 | ||
|
182 | -- | |
|
183 | SIGNAL arbiter_time_out : STD_LOGIC_VECTOR(47 DOWNTO 0); | |
|
184 | SIGNAL arbiter_time_out_new : STD_LOGIC_VECTOR(3 DOWNTO 0); | |
|
185 | ||
|
186 | SIGNAL fifo_buffer_time : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0); | |
|
187 | ||
|
188 | SIGNAL fifo_buffer_time_s : STD_LOGIC_VECTOR(48*4-1 DOWNTO 0); | |
|
189 | ||
|
190 | BEGIN -- beh | |
|
191 | ||
|
192 | ----------------------------------------------------------------------------- | |
|
193 | ||
|
194 | lpp_waveform_snapshot_controler_1 : lpp_waveform_snapshot_controler | |
|
195 | GENERIC MAP ( | |
|
196 | delta_vector_size => delta_vector_size, | |
|
197 | delta_vector_size_f0_2 => delta_vector_size_f0_2 | |
|
198 | ) | |
|
199 | PORT MAP ( | |
|
200 | clk => clk, | |
|
201 | rstn => rstn, | |
|
202 | reg_run => reg_run, | |
|
203 | reg_start_date => reg_start_date, | |
|
204 | reg_delta_snapshot => reg_delta_snapshot, | |
|
205 | reg_delta_f0 => reg_delta_f0, | |
|
206 | reg_delta_f0_2 => reg_delta_f0_2, | |
|
207 | reg_delta_f1 => reg_delta_f1, | |
|
208 | reg_delta_f2 => reg_delta_f2, | |
|
209 | coarse_time => coarse_time(30 DOWNTO 0), | |
|
210 | data_f0_valid => data_f0_in_valid, | |
|
211 | data_f2_valid => data_f2_in_valid, | |
|
212 | start_snapshot_f0 => start_snapshot_f0, | |
|
213 | start_snapshot_f1 => start_snapshot_f1, | |
|
214 | start_snapshot_f2 => start_snapshot_f2, | |
|
215 | wfp_on => run); | |
|
216 | ||
|
217 | lpp_waveform_snapshot_f0 : lpp_waveform_snapshot | |
|
218 | GENERIC MAP ( | |
|
219 | data_size => data_size, | |
|
220 | nb_snapshot_param_size => nb_snapshot_param_size) | |
|
221 | PORT MAP ( | |
|
222 | clk => clk, | |
|
223 | rstn => rstn, | |
|
224 | run => run, | |
|
225 | enable => enable_f0, | |
|
226 | burst_enable => burst_f0, | |
|
227 | nb_snapshot_param => nb_snapshot_param, | |
|
228 | start_snapshot => start_snapshot_f0, | |
|
229 | data_in => data_f0_in, | |
|
230 | data_in_valid => data_f0_in_valid, | |
|
231 | data_out => data_f0_out, | |
|
232 | data_out_valid => data_f0_out_valid); | |
|
233 | ||
|
234 | nb_snapshot_param_more_one <= ('0' & nb_snapshot_param) ;--+ 1; | |
|
235 | ||
|
236 | lpp_waveform_snapshot_f1 : lpp_waveform_snapshot | |
|
237 | GENERIC MAP ( | |
|
238 | data_size => data_size, | |
|
239 | nb_snapshot_param_size => nb_snapshot_param_size+1) | |
|
240 | PORT MAP ( | |
|
241 | clk => clk, | |
|
242 | rstn => rstn, | |
|
243 | run => run, | |
|
244 | enable => enable_f1, | |
|
245 | burst_enable => burst_f1, | |
|
246 | nb_snapshot_param => nb_snapshot_param_more_one, | |
|
247 | start_snapshot => start_snapshot_f1, | |
|
248 | data_in => data_f1_in, | |
|
249 | data_in_valid => data_f1_in_valid, | |
|
250 | data_out => data_f1_out, | |
|
251 | data_out_valid => data_f1_out_valid); | |
|
252 | ||
|
253 | lpp_waveform_snapshot_f2 : lpp_waveform_snapshot | |
|
254 | GENERIC MAP ( | |
|
255 | data_size => data_size, | |
|
256 | nb_snapshot_param_size => nb_snapshot_param_size+1) | |
|
257 | PORT MAP ( | |
|
258 | clk => clk, | |
|
259 | rstn => rstn, | |
|
260 | run => run, | |
|
261 | enable => enable_f2, | |
|
262 | burst_enable => burst_f2, | |
|
263 | nb_snapshot_param => nb_snapshot_param_more_one, | |
|
264 | start_snapshot => start_snapshot_f2, | |
|
265 | data_in => data_f2_in, | |
|
266 | data_in_valid => data_f2_in_valid, | |
|
267 | data_out => data_f2_out, | |
|
268 | data_out_valid => data_f2_out_valid); | |
|
269 | ||
|
270 | lpp_waveform_burst_f3 : lpp_waveform_burst | |
|
271 | GENERIC MAP ( | |
|
272 | data_size => data_size) | |
|
273 | PORT MAP ( | |
|
274 | clk => clk, | |
|
275 | rstn => rstn, | |
|
276 | run => run, | |
|
277 | enable => enable_f3, | |
|
278 | data_in => data_f3_in, | |
|
279 | data_in_valid => data_f3_in_valid, | |
|
280 | data_out => data_f3_out, | |
|
281 | data_out_valid => data_f3_out_valid); | |
|
282 | ||
|
283 | ----------------------------------------------------------------------------- | |
|
284 | -- DEBUG -- SNAPSHOT OUT | |
|
285 | --debug_f0_data_valid <= data_f0_out_valid; | |
|
286 | --debug_f0_data <= data_f0_out; | |
|
287 | --debug_f1_data_valid <= data_f1_out_valid; | |
|
288 | --debug_f1_data <= data_f1_out; | |
|
289 | --debug_f2_data_valid <= data_f2_out_valid; | |
|
290 | --debug_f2_data <= data_f2_out; | |
|
291 | --debug_f3_data_valid <= data_f3_out_valid; | |
|
292 | --debug_f3_data <= data_f3_out; | |
|
293 | ----------------------------------------------------------------------------- | |
|
294 | ||
|
295 | PROCESS (clk, rstn) | |
|
296 | BEGIN -- PROCESS | |
|
297 | IF rstn = '0' THEN -- asynchronous reset (active low) | |
|
298 | time_reg1 <= (OTHERS => '0'); | |
|
299 | time_reg2 <= (OTHERS => '0'); | |
|
300 | ELSIF clk'EVENT AND clk = '1' THEN -- rising clock edge | |
|
301 | time_reg1(48*1-1 DOWNTO 48*0) <= data_f0_time(15 DOWNTO 0) & data_f0_time(47 DOWNTO 16); | |
|
302 | time_reg1(48*2-1 DOWNTO 48*1) <= data_f1_time(15 DOWNTO 0) & data_f1_time(47 DOWNTO 16); | |
|
303 | time_reg1(48*3-1 DOWNTO 48*2) <= data_f2_time(15 DOWNTO 0) & data_f2_time(47 DOWNTO 16); | |
|
304 | time_reg1(48*4-1 DOWNTO 48*3) <= data_f3_time(15 DOWNTO 0) & data_f3_time(47 DOWNTO 16); | |
|
305 | time_reg2 <= time_reg1; | |
|
306 | END IF; | |
|
307 | END PROCESS; | |
|
308 | ||
|
309 | valid_in <= data_f3_out_valid & data_f2_out_valid & data_f1_out_valid & data_f0_out_valid; | |
|
310 | all_input_valid : FOR i IN 3 DOWNTO 0 GENERATE | |
|
311 | lpp_waveform_dma_genvalid_I : lpp_waveform_dma_genvalid | |
|
312 | PORT MAP ( | |
|
313 | HCLK => clk, | |
|
314 | HRESETn => rstn, | |
|
315 | run => run, | |
|
316 | valid_in => valid_in(I), | |
|
317 | ack_in => valid_ack(I), | |
|
318 | time_in => time_reg2(48*(I+1)-1 DOWNTO 48*I), -- Todo | |
|
319 | valid_out => valid_out(I), | |
|
320 | time_out => time_out(I), -- Todo | |
|
321 | error => status_new_err(I)); | |
|
322 | END GENERATE all_input_valid; | |
|
323 | ||
|
324 | data_f0_out_swap <= data_f0_out((16*5)-1 DOWNTO 16*4) & | |
|
325 | data_f0_out((16*6)-1 DOWNTO 16*5) & | |
|
326 | data_f0_out((16*3)-1 DOWNTO 16*2) & | |
|
327 | data_f0_out((16*4)-1 DOWNTO 16*3) & | |
|
328 | data_f0_out((16*1)-1 DOWNTO 16*0) & | |
|
329 | data_f0_out((16*2)-1 DOWNTO 16*1) ; | |
|
330 | ||
|
331 | data_f1_out_swap <= data_f1_out((16*5)-1 DOWNTO 16*4) & | |
|
332 | data_f1_out((16*6)-1 DOWNTO 16*5) & | |
|
333 | data_f1_out((16*3)-1 DOWNTO 16*2) & | |
|
334 | data_f1_out((16*4)-1 DOWNTO 16*3) & | |
|
335 | data_f1_out((16*1)-1 DOWNTO 16*0) & | |
|
336 | data_f1_out((16*2)-1 DOWNTO 16*1) ; | |
|
337 | ||
|
338 | data_f2_out_swap <= data_f2_out((16*5)-1 DOWNTO 16*4) & | |
|
339 | data_f2_out((16*6)-1 DOWNTO 16*5) & | |
|
340 | data_f2_out((16*3)-1 DOWNTO 16*2) & | |
|
341 | data_f2_out((16*4)-1 DOWNTO 16*3) & | |
|
342 | data_f2_out((16*1)-1 DOWNTO 16*0) & | |
|
343 | data_f2_out((16*2)-1 DOWNTO 16*1) ; | |
|
344 | ||
|
345 | data_f3_out_swap <= data_f3_out((16*5)-1 DOWNTO 16*4) & | |
|
346 | data_f3_out((16*6)-1 DOWNTO 16*5) & | |
|
347 | data_f3_out((16*3)-1 DOWNTO 16*2) & | |
|
348 | data_f3_out((16*4)-1 DOWNTO 16*3) & | |
|
349 | data_f3_out((16*1)-1 DOWNTO 16*0) & | |
|
350 | data_f3_out((16*2)-1 DOWNTO 16*1) ; | |
|
351 | ||
|
352 | all_bit_of_data_out : FOR I IN 95 DOWNTO 0 GENERATE | |
|
353 | data_out(0, I) <= data_f0_out_swap(I); | |
|
354 | data_out(1, I) <= data_f1_out_swap(I); | |
|
355 | data_out(2, I) <= data_f2_out_swap(I); | |
|
356 | data_out(3, I) <= data_f3_out_swap(I); | |
|
357 | END GENERATE all_bit_of_data_out; | |
|
358 | ||
|
359 | ----------------------------------------------------------------------------- | |
|
360 | -- TODO : debug | |
|
361 | ----------------------------------------------------------------------------- | |
|
362 | all_bit_of_time_out : FOR I IN 47 DOWNTO 0 GENERATE | |
|
363 | all_sample_of_time_out : FOR J IN 3 DOWNTO 0 GENERATE | |
|
364 | time_out_2(J, I) <= time_out(J)(I); | |
|
365 | END GENERATE all_sample_of_time_out; | |
|
366 | END GENERATE all_bit_of_time_out; | |
|
367 | ||
|
368 | lpp_waveform_fifo_arbiter_1 : lpp_waveform_fifo_arbiter | |
|
369 | GENERIC MAP (tech => tech, | |
|
370 | nb_data_by_buffer_size => nb_data_by_buffer_size) | |
|
371 | PORT MAP ( | |
|
372 | clk => clk, | |
|
373 | rstn => rstn, | |
|
374 | run => run, | |
|
375 | nb_data_by_buffer => nb_data_by_buffer, | |
|
376 | data_in_valid => valid_out, | |
|
377 | data_in_ack => valid_ack, | |
|
378 | data_in => data_out, | |
|
379 | time_in => time_out_2, | |
|
380 | ||
|
381 | data_out => wdata, | |
|
382 | data_out_wen => data_wen, | |
|
383 | full_almost => full_almost, | |
|
384 | full => full, | |
|
385 | ||
|
386 | time_out => arbiter_time_out, | |
|
387 | time_out_new => arbiter_time_out_new | |
|
388 | ||
|
389 | ); | |
|
390 | ||
|
391 | ----------------------------------------------------------------------------- | |
|
392 | ----------------------------------------------------------------------------- | |
|
393 | ||
|
394 | generate_all_fifo: FOR I IN 0 TO 3 GENERATE | |
|
395 | lpp_fifo_1: lpp_fifo | |
|
396 | GENERIC MAP ( | |
|
397 | tech => 0, | |
|
398 | Mem_use => use_RAM, | |
|
399 | EMPTY_THRESHOLD_LIMIT => 15, | |
|
400 | FULL_THRESHOLD_LIMIT => 3, | |
|
401 | DataSz => 32, | |
|
402 | AddrSz => 7) | |
|
403 | PORT MAP ( | |
|
404 | clk => clk, | |
|
405 | rstn => rstn, | |
|
406 | reUse => '0', | |
|
407 | run => run, | |
|
408 | ren => data_ren(I), | |
|
409 | rdata => s_rdata_v((I+1)*32-1 downto I*32), | |
|
410 | wen => data_wen(I), | |
|
411 | wdata => wdata, | |
|
412 | empty => empty(I), | |
|
413 | full => full(I), | |
|
414 | full_almost => OPEN, | |
|
415 | empty_threshold => empty_almost(I), | |
|
416 | full_threshold => full_almost(I) ); | |
|
417 | ||
|
418 | END GENERATE generate_all_fifo; | |
|
419 | ||
|
420 | ----------------------------------------------------------------------------- | |
|
421 | -- | |
|
422 | ----------------------------------------------------------------------------- | |
|
423 | ||
|
424 | all_channel: FOR I IN 3 DOWNTO 0 GENERATE | |
|
425 | ||
|
426 | PROCESS (clk, rstn) | |
|
427 | BEGIN | |
|
428 | IF rstn = '0' THEN | |
|
429 | fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0'); | |
|
430 | ELSIF clk'event AND clk = '1' THEN | |
|
431 | IF run = '0' THEN | |
|
432 | fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= (OTHERS => '0'); | |
|
433 | ELSE | |
|
434 | IF arbiter_time_out_new(I) = '1' THEN -- modif JC 15-01-2015 | |
|
435 | fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I) <= arbiter_time_out; | |
|
436 | END IF; | |
|
437 | END IF; | |
|
438 | END IF; | |
|
439 | END PROCESS; | |
|
440 | ||
|
441 | fifo_buffer_time_s(48*(I+1)-1 DOWNTO 48*I) <= arbiter_time_out WHEN arbiter_time_out_new(I) = '1' ELSE | |
|
442 | fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I); | |
|
443 | ||
|
444 | lpp_waveform_fsmdma_I: lpp_waveform_fsmdma | |
|
445 | PORT MAP ( | |
|
446 | clk => clk, | |
|
447 | rstn => rstn, | |
|
448 | run => run, | |
|
449 | ||
|
450 | fifo_buffer_time => fifo_buffer_time_s(48*(I+1)-1 DOWNTO 48*I), | |
|
451 | ||
|
452 | fifo_data => s_rdata_v(32*(I+1)-1 DOWNTO 32*I), | |
|
453 | fifo_empty => empty(I), | |
|
454 | fifo_empty_threshold => empty_almost(I), | |
|
455 | fifo_ren => data_ren(I), | |
|
456 | ||
|
457 | dma_fifo_valid_burst => dma_fifo_valid_burst(I), | |
|
458 | dma_fifo_data => dma_fifo_data(32*(I+1)-1 DOWNTO 32*I), | |
|
459 | dma_fifo_ren => dma_fifo_ren(I), | |
|
460 | dma_buffer_new => dma_buffer_new(I), | |
|
461 | dma_buffer_addr => dma_buffer_addr(32*(I+1)-1 DOWNTO 32*I), | |
|
462 | dma_buffer_length => dma_buffer_length(26*(I+1)-1 DOWNTO 26*I), | |
|
463 | dma_buffer_full => dma_buffer_full(I), | |
|
464 | dma_buffer_full_err => dma_buffer_full_err(I), | |
|
465 | ||
|
466 | status_buffer_ready => status_buffer_ready(I), -- TODO | |
|
467 | addr_buffer => addr_buffer(32*(I+1)-1 DOWNTO 32*I), -- TODO | |
|
468 | length_buffer => length_buffer,--(26*(I+1)-1 DOWNTO 26*I), -- TODO | |
|
469 | ready_buffer => ready_buffer(I), -- TODO | |
|
470 | buffer_time => OPEN,--buffer_time(48*(I+1)-1 DOWNTO 48*I), -- TODO | |
|
471 | error_buffer_full => error_buffer_full(I)); -- TODO | |
|
472 | ||
|
473 | buffer_time(48*(I+1)-1 DOWNTO 48*I) <= fifo_buffer_time(48*(I+1)-1 DOWNTO 48*I); | |
|
474 | ||
|
475 | END GENERATE all_channel; | |
|
476 | ||
|
477 | ||
|
478 | END beh; No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now