##// END OF EJS Templates
merge simu_with_leon3...
pellion -
r590:f6390d699855 JC
parent child
Show More
@@ -166,13 +166,46 ARCHITECTURE beh OF LFR_EQM IS
166 166
167 167 component clkint port(A : in std_ulogic; Y :out std_ulogic); end component;
168 168
169 SIGNAL rstn_50 : STD_LOGIC;
170 SIGNAL clk_lock : STD_LOGIC;
171 SIGNAL clk_busy_counter : STD_LOGIC_VECTOR(3 DOWNTO 0);
172 SIGNAL nSRAM_BUSY_reg : STD_LOGIC;
173
174 SIGNAL debug_vector : STD_LOGIC_VECTOR(11 DOWNTO 0);
175 SIGNAL ahbrxd: STD_LOGIC;
176 SIGNAL ahbtxd: STD_LOGIC;
177 SIGNAL urxd1 : STD_LOGIC;
178 SIGNAL utxd1 : STD_LOGIC;
169 179 BEGIN -- beh
170 180
171 181 -----------------------------------------------------------------------------
182 -- CLK_LOCK
183 -----------------------------------------------------------------------------
184 rst_gen_global : rstgen PORT MAP (reset, clk50MHz, '1', rstn_50, OPEN);
185
186 PROCESS (clk50MHz_int, rstn_50)
187 BEGIN -- PROCESS
188 IF rstn_50 = '0' THEN -- asynchronous reset (active low)
189 clk_lock <= '0';
190 clk_busy_counter <= (OTHERS => '0');
191 nSRAM_BUSY_reg <= '0';
192 ELSIF clk50MHz_int'event AND clk50MHz_int = '1' THEN -- rising clock edge
193 nSRAM_BUSY_reg <= nSRAM_BUSY;
194 IF nSRAM_BUSY_reg = '1' AND nSRAM_BUSY = '0' THEN
195 IF clk_busy_counter = "1111" THEN
196 clk_lock <= '1';
197 ELSE
198 clk_busy_counter <= STD_LOGIC_VECTOR(to_unsigned(to_integer(UNSIGNED(clk_busy_counter))+1,4));
199 END IF;
200 END IF;
201 END IF;
202 END PROCESS;
203
204 -----------------------------------------------------------------------------
172 205 -- CLK
173 206 -----------------------------------------------------------------------------
174 rst_domain25 : rstgen PORT MAP (reset, clk_25, '1', rstn_25, OPEN);
175 rst_domain24 : rstgen PORT MAP (reset, clk_24, '1', rstn_24, OPEN);
207 rst_domain25 : rstgen PORT MAP (reset, clk_25, clk_lock, rstn_25, OPEN);
208 rst_domain24 : rstgen PORT MAP (reset, clk_24, clk_lock, rstn_24, OPEN);
176 209
177 210 --clk_pad : clkint port map (A => clk50MHz, Y => clk50MHz_int );
178 211 clk50MHz_int <= clk50MHz;
@@ -74,7 +74,7 ARCHITECTURE Behavioral OF lpp_dma_SEND1
74 74 0 => ahb_device_reg(vendorid, deviceid, 0, version, 0),
75 75 OTHERS => (OTHERS => '0'));
76 76
77 TYPE AHB_DMA_FSM_STATE IS (IDLE, s_ARBITER ,s_CTRL, s_CTRL_DATA, s_DATA);
77 TYPE AHB_DMA_FSM_STATE IS (IDLE, s_INIT_TRANS, s_ARBITER ,s_CTRL, s_CTRL_DATA, s_DATA);
78 78 SIGNAL state : AHB_DMA_FSM_STATE;
79 79
80 80 SIGNAL address_counter_reg : STD_LOGIC_VECTOR(3 DOWNTO 0);
@@ -86,6 +86,13 ARCHITECTURE Behavioral OF lpp_dma_SEND1
86 86 SIGNAL bus_request : STD_LOGIC;
87 87 SIGNAL bus_lock : STD_LOGIC;
88 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
89 96 BEGIN
90 97
91 98 -----------------------------------------------------------------------------
@@ -111,23 +118,41 BEGIN
111 118
112 119 -----------------------------------------------------------------------------
113 120 AHB_Master_Out.HADDR <= address(31 DOWNTO 6) & address_counter_reg & "00";
114 AHB_Master_Out.HWDATA <= ahbdrivedata(data);
121 AHB_Master_Out.HWDATA <= ahbdrivedata(data) WHEN AHB_Master_In.HREADY = '1' ELSE ahbdrivedata(data_reg);
115 122
116 123 -----------------------------------------------------------------------------
117 124 --ren <= NOT ((AHB_Master_In.HGRANT(hindex) OR LAST_READ ) AND AHB_Master_In.HREADY );
118 125 --ren <= NOT beat;
119 126 -----------------------------------------------------------------------------
127
128 HREADY_falling <= inhib_ren WHEN AHB_Master_In.HREADY = '0' AND HREADY_pre = '1' ELSE '1';
129
130
120 131 PROCESS (clk, rstn)
121 132 BEGIN -- PROCESS
122 133 IF rstn = '0' THEN -- asynchronous reset (active low)
123 134 state <= IDLE;
124 135 done <= '0';
136 ren <= '1';
125 137 address_counter_reg <= (OTHERS => '0');
126 138 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
127 139 AHB_Master_Out.HBUSREQ <= '0';
128 140 AHB_Master_Out.HLOCK <= '0';
141
142 data_reg <= (OTHERS => '0');
143
144 HREADY_pre <= '0';
145 inhib_ren <= '0';
129 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 data_reg <= data;
151 END IF;
152
130 153 done <= '0';
154 ren <= '1';
155 inhib_ren <= '0';
131 156 CASE state IS
132 157 WHEN IDLE =>
133 158 AHB_Master_Out.HBUSREQ <= '0';
@@ -135,11 +160,14 BEGIN
135 160 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
136 161 address_counter_reg <= (OTHERS => '0');
137 162 IF send = '1' THEN
163 state <= s_INIT_TRANS;
164 END IF;
165
166 WHEN s_INIT_TRANS =>
138 167 AHB_Master_Out.HBUSREQ <= '1';
139 168 AHB_Master_Out.HLOCK <= '1';
140 169 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
141 170 state <= s_ARBITER;
142 END IF;
143 171
144 172 WHEN s_ARBITER =>
145 173 AHB_Master_Out.HBUSREQ <= '1';
@@ -147,18 +175,20 BEGIN
147 175 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
148 176 address_counter_reg <= (OTHERS => '0');
149 177
150 IF AHB_Master_In.HGRANT(hindex) = '1' THEN
178 IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN
151 179 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
152 180 state <= s_CTRL;
153 181 END IF;
154 182
155 183 WHEN s_CTRL =>
184 inhib_ren <= '1';
156 185 AHB_Master_Out.HBUSREQ <= '1';
157 186 AHB_Master_Out.HLOCK <= '1';
158 187 AHB_Master_Out.HTRANS <= HTRANS_NONSEQ;
159 188 IF AHB_Master_In.HREADY = '1' AND AHB_Master_In.HGRANT(hindex) = '1' THEN
160 AHB_Master_Out.HTRANS <= HTRANS_SEQ;
189 --AHB_Master_Out.HTRANS <= HTRANS_SEQ;
161 190 state <= s_CTRL_DATA;
191 --ren <= '0';
162 192 END IF;
163 193
164 194 WHEN s_CTRL_DATA =>
@@ -176,11 +206,21 BEGIN
176 206 state <= s_DATA;
177 207 END IF;
178 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
179 216 WHEN s_DATA =>
217 ren <= HREADY_falling;
218
180 219 AHB_Master_Out.HBUSREQ <= '0';
181 AHB_Master_Out.HLOCK <= '0';
220 --AHB_Master_Out.HLOCK <= '0';
182 221 AHB_Master_Out.HTRANS <= HTRANS_IDLE;
183 222 IF AHB_Master_In.HREADY = '1' THEN
223 AHB_Master_Out.HLOCK <= '0';
184 224 state <= IDLE;
185 225 done <= '1';
186 226 END IF;
@@ -193,7 +233,9 BEGIN
193 233 ctrl_window <= '1' WHEN state = s_CTRL OR state = s_CTRL_DATA ELSE '0';
194 234 data_window <= '1' WHEN state = s_CTRL_DATA OR state = s_DATA ELSE '0';
195 235 -----------------------------------------------------------------------------
196 ren <= NOT(AHB_Master_In.HREADY) WHEN state = s_CTRL_DATA ELSE '1';
236
237
238 --ren <= NOT(AHB_Master_In.HREADY) WHEN state = s_CTRL_DATA ELSE '1';
197 239
198 240 -----------------------------------------------------------------------------
199 241 --PROCESS (clk, rstn)
General Comments 0
You need to be logged in to leave comments. Login now