1 |
2 |
feddischso |
----------------------------------------------------------------------
|
2 |
|
|
---- ----
|
3 |
|
|
---- PLB2WB-Bridge ----
|
4 |
|
|
---- ----
|
5 |
|
|
---- This file is part of the PLB-to-WB-Bridge project ----
|
6 |
|
|
---- http://opencores.org/project,plb2wbbridge ----
|
7 |
|
|
---- ----
|
8 |
|
|
---- Description ----
|
9 |
|
|
---- Implementation of a PLB-to-WB-Bridge according to ----
|
10 |
|
|
---- PLB-to-WB Bridge specification document. ----
|
11 |
|
|
---- ----
|
12 |
|
|
---- To Do: ----
|
13 |
|
|
---- Nothing ----
|
14 |
|
|
---- ----
|
15 |
|
|
---- Author(s): ----
|
16 |
|
|
---- - Christian Haettich ----
|
17 |
|
|
---- feddischson@opencores.org ----
|
18 |
|
|
---- ----
|
19 |
|
|
----------------------------------------------------------------------
|
20 |
|
|
---- ----
|
21 |
|
|
---- Copyright (C) 2010 Authors ----
|
22 |
|
|
---- ----
|
23 |
|
|
---- This source file may be used and distributed without ----
|
24 |
|
|
---- restriction provided that this copyright statement is not ----
|
25 |
|
|
---- removed from the file and that any derivative work contains ----
|
26 |
|
|
---- the original copyright notice and the associated disclaimer. ----
|
27 |
|
|
---- ----
|
28 |
|
|
---- This source file is free software; you can redistribute it ----
|
29 |
|
|
---- and/or modify it under the terms of the GNU Lesser General ----
|
30 |
|
|
---- Public License as published by the Free Software Foundation; ----
|
31 |
|
|
---- either version 2.1 of the License, or (at your option) any ----
|
32 |
|
|
---- later version. ----
|
33 |
|
|
---- ----
|
34 |
|
|
---- This source is distributed in the hope that it will be ----
|
35 |
|
|
---- useful, but WITHOUT ANY WARRANTY; without even the implied ----
|
36 |
|
|
---- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR ----
|
37 |
|
|
---- PURPOSE. See the GNU Lesser General Public License for more ----
|
38 |
|
|
---- details. ----
|
39 |
|
|
---- ----
|
40 |
|
|
---- You should have received a copy of the GNU Lesser General ----
|
41 |
|
|
---- Public License along with this source; if not, download it ----
|
42 |
|
|
---- from http://www.opencores.org/lgpl.shtml ----
|
43 |
|
|
---- ----
|
44 |
|
|
----------------------------------------------------------------------
|
45 |
|
|
|
46 |
|
|
|
47 |
|
|
library ieee;
|
48 |
|
|
use ieee.std_logic_1164.all;
|
49 |
|
|
use ieee.numeric_std.all;
|
50 |
|
|
use ieee.std_logic_unsigned.all;
|
51 |
|
|
|
52 |
|
|
|
53 |
|
|
library plb2wb_bridge_v1_00_a;
|
54 |
|
|
use plb2wb_bridge_v1_00_a.plb2wb_pkg.all;
|
55 |
|
|
|
56 |
|
|
entity plb2wb_tcu is
|
57 |
|
|
generic(
|
58 |
|
|
C_SPLB_NUM_MASTERS : integer := 1;
|
59 |
|
|
C_SPLB_MID_WIDTH : integer := 3;
|
60 |
|
|
C_SPLB_SIZE_WIDTH : integer := 4;
|
61 |
|
|
C_SPLB_NATIVE_BE_WIDTH : integer := 4;
|
62 |
|
|
C_SPLB_DWIDTH : integer := 128;
|
63 |
|
|
C_SPLB_TYPE_WIDTH : integer := 4;
|
64 |
|
|
C_SPLB_SUPPORT_BUR_LINE : integer := 1;
|
65 |
|
|
WB_PIC_INTS : integer := 0;
|
66 |
|
|
WB_PIC_INT_LEVEL : std_logic := '1';
|
67 |
|
|
WB_TIMEOUT_CYCLES : integer := 10;
|
68 |
|
|
WB_SUPPORT_BLOCK : integer := 1
|
69 |
|
|
|
70 |
|
|
);
|
71 |
|
|
port(
|
72 |
|
|
|
73 |
|
|
wb_clk_i : in std_logic;
|
74 |
|
|
wb_ack_i : in std_logic;
|
75 |
|
|
wb_err_i : in std_logic;
|
76 |
|
|
wb_rty_i : in std_logic;
|
77 |
|
|
wb_rst_i : in std_logic;
|
78 |
|
|
wb_pic_int_i : in std_logic_vector( WB_PIC_INTS-1 downto 0 );
|
79 |
|
|
|
80 |
|
|
AMU_deviceSelect : in std_logic;
|
81 |
|
|
AMU_statusSelect : in std_logic;
|
82 |
|
|
AMU_bufEmpty : in std_logic;
|
83 |
|
|
AMU_bufFull : in std_logic;
|
84 |
|
|
AMU_buf_RNW : in std_logic;
|
85 |
|
|
AMU_buf_size : in std_logic_vector( C_SPLB_SIZE_WIDTH-1 downto 0 );
|
86 |
|
|
AMU_buf_BE : in std_logic_vector( C_SPLB_NATIVE_BE_WIDTH-1 downto 0 );
|
87 |
|
|
AMU_pipe_size : in std_logic_vector( 0 to C_SPLB_SIZE_WIDTH-1 );
|
88 |
|
|
AMU_pipe_rmID : in std_logic_vector( 0 to C_SPLB_MID_WIDTH -1 );
|
89 |
|
|
AMU_pipe_wmID : in std_logic_vector( 0 to C_SPLB_MID_WIDTH -1 );
|
90 |
|
|
AMU_pipe_BE : in std_logic_vector( 0 to C_SPLB_NATIVE_BE_WIDTH-1 );
|
91 |
|
|
AMU_pipe_rStatusSelect : in std_logic;
|
92 |
|
|
AMU_pipe_wStatusSelect : in std_logic;
|
93 |
|
|
|
94 |
|
|
WBF_empty : in std_logic;
|
95 |
|
|
WBF_full : in std_logic;
|
96 |
|
|
|
97 |
|
|
RBF_empty : in std_logic;
|
98 |
|
|
RBF_almostEmpty : in std_logic;
|
99 |
|
|
RBF_full : in std_logic;
|
100 |
|
|
|
101 |
|
|
SPLB_Clk : in std_logic;
|
102 |
|
|
plb2wb_rst : in std_logic;
|
103 |
|
|
PLB_MSize : in std_logic_vector( 0 to 1 );
|
104 |
|
|
PLB_TAttribute : in std_logic_vector( 0 to 15 );
|
105 |
|
|
PLB_lockErr : in std_logic;
|
106 |
|
|
PLB_abort : in std_logic;
|
107 |
|
|
PLB_rdBurst : in std_logic;
|
108 |
|
|
PLB_wrBurst : in std_logic;
|
109 |
|
|
PLB_RNW : in std_logic;
|
110 |
|
|
PLB_PAValid : in std_logic;
|
111 |
|
|
PLB_masterID : in std_logic_vector( 0 to C_SPLB_MID_WIDTH-1 );
|
112 |
|
|
PLB_rdPrim : in std_logic;
|
113 |
|
|
PLB_wrPrim : in std_logic;
|
114 |
|
|
PLB_size : in std_logic_vector( 0 to C_SPLB_SIZE_WIDTH-1 );
|
115 |
|
|
PLB_BE : in std_logic_vector( 0 to C_SPLB_DWIDTH/8-1 );
|
116 |
|
|
PLB_type : in std_logic_vector( 0 to C_SPLB_TYPE_WIDTH -1 );
|
117 |
|
|
|
118 |
|
|
STU_abort : in std_logic;
|
119 |
|
|
STU_continue : in std_logic;
|
120 |
|
|
|
121 |
|
|
RBF_rdErrOut : in std_logic;
|
122 |
|
|
RBF_rdErrIn : out std_logic;
|
123 |
|
|
|
124 |
|
|
|
125 |
|
|
Sl_MRdErr : out std_logic_vector( 0 to C_SPLB_NUM_MASTERS-1 );
|
126 |
|
|
Sl_MWrErr : out std_logic_vector( 0 to C_SPLB_NUM_MASTERS-1 );
|
127 |
|
|
Sl_wrDAck : out std_logic;
|
128 |
|
|
Sl_wrComp : out std_logic;
|
129 |
|
|
Sl_wrBTerm : out std_logic;
|
130 |
|
|
Sl_rdDAck : out std_logic;
|
131 |
|
|
Sl_rdComp : out std_logic;
|
132 |
|
|
Sl_rdBTerm : out std_logic;
|
133 |
|
|
Sl_rdWdAddr : out std_logic_vector( 0 to 3 );
|
134 |
|
|
Sl_wait : out std_logic;
|
135 |
|
|
Sl_rearbitrate : out std_logic;
|
136 |
|
|
|
137 |
|
|
TCU_wbufWEn : out std_logic;
|
138 |
|
|
TCU_wbufREn : out std_logic;
|
139 |
|
|
|
140 |
|
|
TCU_rbufWEn : out std_logic;
|
141 |
|
|
TCU_rbufREn : out std_logic;
|
142 |
|
|
|
143 |
|
|
TCU_adrBufWEn : out std_logic;
|
144 |
|
|
TCU_adrBufREn : out std_logic;
|
145 |
|
|
TCU_rpipeRdEn : out std_logic;
|
146 |
|
|
TCU_wpipeRdEn : out std_logic;
|
147 |
|
|
|
148 |
|
|
TCU_enRdDBus : out std_logic;
|
149 |
|
|
TCU_MRBusy : out std_logic_vector( 0 to C_SPLB_NUM_MASTERS-1 );
|
150 |
|
|
TCU_addrAck : out std_logic;
|
151 |
|
|
TCU_adr_offset : out std_logic_vector( 3 downto 0 );
|
152 |
|
|
|
153 |
|
|
TCU_stuLatchPA : out std_logic;
|
154 |
|
|
TCU_stuLatchSA : out std_logic;
|
155 |
|
|
TCU_stuWritePA : out std_logic;
|
156 |
|
|
TCU_stuWriteSA : out std_logic;
|
157 |
|
|
TCU_stat2plb_en : out std_logic;
|
158 |
|
|
TCU_enStuRdDBus : out std_logic;
|
159 |
|
|
TCU_wb_status_info : out std_logic_vector( STATUS2PLB_INFO_SIZE-1 downto 0 );
|
160 |
|
|
TCU_wb_irq_info : out std_logic_vector( IRQ_INFO_SIZE-1 downto 0 );
|
161 |
|
|
|
162 |
|
|
wb_lock_o : out std_logic;
|
163 |
|
|
wb_stb_o : out std_logic;
|
164 |
|
|
wb_we_o : out std_logic;
|
165 |
|
|
wb_cyc_o : out std_logic
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
);
|
169 |
|
|
end entity plb2wb_tcu;
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
architecture IMP of plb2wb_tcu is
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
signal TCU_wbufWEn_t : std_logic;
|
176 |
|
|
signal TCU_wbufREn_t : std_logic;
|
177 |
|
|
signal TCU_adrBufWEn_w : std_logic;
|
178 |
|
|
signal TCU_adrBufWEn_r : std_logic;
|
179 |
|
|
signal TCU_rbufWEn_t : std_logic;
|
180 |
|
|
signal TCU_rbufREn_t : std_logic;
|
181 |
|
|
signal TCU_stuWritePA_t : std_logic;
|
182 |
|
|
signal TCU_stuWriteSA_t : std_logic;
|
183 |
|
|
|
184 |
|
|
signal Sl_rdComp_t : std_logic;
|
185 |
|
|
signal Sl_wrComp_t : std_logic;
|
186 |
|
|
|
187 |
|
|
signal Sl_rdDAck_t : std_logic;
|
188 |
|
|
|
189 |
|
|
signal TCU_rpipeRdEn_t : std_logic;
|
190 |
|
|
signal TCU_wpipeRdEn_t : std_logic;
|
191 |
|
|
|
192 |
|
|
--
|
193 |
|
|
-- Wishbone current and next state
|
194 |
|
|
type wb_trans_state is ( wb_idle, wb_write, wb_read, wb_write_rty, wb_read_rty, wb_write_stall );
|
195 |
|
|
type wb_trans_state_type is record
|
196 |
|
|
state : wb_trans_state;
|
197 |
|
|
transfer_count : std_logic_vector( 3 downto 0 );
|
198 |
|
|
abort : std_logic;
|
199 |
|
|
end record;
|
200 |
|
|
signal c_wb_state, n_wb_state : wb_trans_state_type;
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
|
204 |
|
|
--
|
205 |
|
|
-- PLB current and next state
|
206 |
|
|
type plb_wtrans_state is( plb_widle, plb_write, plb_burst_write );
|
207 |
|
|
type plb_rtrans_state is( plb_ridle, plb_read, plb_read_ack, plb_line_read,
|
208 |
|
|
plb_line_read_ack, plb_burst_read, plb_burst_read_ack,
|
209 |
|
|
plb_wait_line_read, plb_wait_burst_read );
|
210 |
|
|
|
211 |
|
|
type plb_rtrans_state_type is record
|
212 |
|
|
state : plb_rtrans_state;
|
213 |
|
|
r_master_id : std_logic_vector( C_SPLB_MID_WIDTH-1 downto 0 );
|
214 |
|
|
r_secondary : std_logic;
|
215 |
|
|
transfer_count : std_logic_vector( 0 to 3 );
|
216 |
|
|
transfer_size : std_logic_vector( 0 to C_SPLB_SIZE_WIDTH-1 );
|
217 |
|
|
status_transfer : std_logic;
|
218 |
|
|
end record;
|
219 |
|
|
|
220 |
|
|
type plb_wtrans_state_type is record
|
221 |
|
|
state : plb_wtrans_state;
|
222 |
|
|
w_master_id : std_logic_vector( C_SPLB_MID_WIDTH-1 downto 0 );
|
223 |
|
|
w_secondary : std_logic;
|
224 |
|
|
transfer_count : std_logic_vector( 0 to 3 );
|
225 |
|
|
transfer_size : std_logic_vector( 0 to C_SPLB_SIZE_WIDTH-1 );
|
226 |
|
|
status_transfer : std_logic;
|
227 |
|
|
end record;
|
228 |
|
|
|
229 |
|
|
signal c_plb_wstate : plb_wtrans_state_type; -- current write state
|
230 |
|
|
signal n_plb_wstate : plb_wtrans_state_type; -- next write state
|
231 |
|
|
signal c_plb_rstate : plb_rtrans_state_type; -- current read state
|
232 |
|
|
signal n_plb_rstate : plb_rtrans_state_type; -- next read state
|
233 |
|
|
|
234 |
|
|
|
235 |
|
|
|
236 |
|
|
signal mbusy_read_out : std_logic_vector( 0 to C_SPLB_NUM_MASTERS-1 );
|
237 |
|
|
signal mbusy_write_out : std_logic_vector( 0 to C_SPLB_NUM_MASTERS-1 );
|
238 |
|
|
|
239 |
|
|
|
240 |
|
|
signal start_plb_w : std_logic; -- start plb write (to wb side)
|
241 |
|
|
signal start_plb_r : std_logic; -- start plb read (from wb side)
|
242 |
|
|
|
243 |
|
|
signal start_plb_stat_w : std_logic; -- start plb status write
|
244 |
|
|
signal start_plb_stat_r : std_logic; -- start plb status read
|
245 |
|
|
|
246 |
|
|
signal start_plb_sec_w : std_logic; -- start plb write (to wb side, pipelined)
|
247 |
|
|
signal start_plb_sec_r : std_logic; -- start plb read (from wb side, pipelined)
|
248 |
|
|
|
249 |
|
|
signal start_plb_sec_stat_r : std_logic; -- start plb write to status (pipelined)
|
250 |
|
|
signal start_plb_sec_stat_w : std_logic; -- start plb read from status (pipelined)
|
251 |
|
|
|
252 |
|
|
|
253 |
|
|
|
254 |
|
|
signal start_wb_w : std_logic; -- start wb write
|
255 |
|
|
signal start_wb_r : std_logic; -- start wb read
|
256 |
|
|
|
257 |
|
|
signal wb_ack : std_logic;
|
258 |
|
|
signal wb_rty : std_logic;
|
259 |
|
|
signal wb_err : std_logic;
|
260 |
|
|
|
261 |
|
|
signal addrAck_w : std_logic;
|
262 |
|
|
signal addrAck_r : std_logic;
|
263 |
|
|
|
264 |
|
|
signal TCU_stuLatchPA_r : std_logic;
|
265 |
|
|
signal TCU_stuLatchSA_r : std_logic;
|
266 |
|
|
signal TCU_stuLatchPA_w : std_logic;
|
267 |
|
|
signal TCU_stuLatchSA_w : std_logic;
|
268 |
|
|
|
269 |
|
|
|
270 |
|
|
signal wb_rst_short : std_logic;
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
signal pic_int_ahigh : std_logic_vector( WB_PIC_INTS-1 downto 0 );
|
274 |
|
|
signal pic_int_ahigh_short : std_logic_vector( WB_PIC_INTS-1 downto 0 );
|
275 |
|
|
signal pic_int2plb_en : std_logic;
|
276 |
|
|
|
277 |
|
|
|
278 |
|
|
-----
|
279 |
|
|
-- wishbone timeout counter
|
280 |
|
|
--
|
281 |
|
|
constant WB_TOUT_COUNTER_SIZE : integer := log2( WB_TIMEOUT_CYCLES );
|
282 |
|
|
constant WB_TOUT_MAX_VALUE : std_logic_vector( WB_TOUT_COUNTER_SIZE-1 downto 0 )
|
283 |
|
|
:= std_logic_vector( to_unsigned( WB_TIMEOUT_CYCLES-1, WB_TOUT_COUNTER_SIZE ) );
|
284 |
|
|
constant WB_TOUT_MIN_VALUE : std_logic_vector( WB_TOUT_COUNTER_SIZE-1 downto 0 )
|
285 |
|
|
:= ( others => '0' );
|
286 |
|
|
signal wb_tout_counter : std_logic_vector( WB_TOUT_COUNTER_SIZE-1 downto 0 );
|
287 |
|
|
signal wb_tout_count : std_logic;
|
288 |
|
|
signal wb_tout_reset : std_logic;
|
289 |
|
|
signal wb_tout_alarm : std_logic;
|
290 |
|
|
|
291 |
|
|
|
292 |
|
|
|
293 |
|
|
begin
|
294 |
|
|
|
295 |
|
|
|
296 |
|
|
|
297 |
|
|
|
298 |
|
|
TCU_wbufWEn <= TCU_wbufWEn_t;
|
299 |
|
|
TCU_wbufREn <= TCU_wbufREn_t;
|
300 |
|
|
TCU_adrBufWEn <= TCU_adrBufWEn_w or TCU_adrBufWEn_r;
|
301 |
|
|
TCU_rbufWEn <= TCU_rbufWEn_t;
|
302 |
|
|
TCU_rbufREn <= TCU_rbufREn_t;
|
303 |
|
|
Sl_rdComp <= Sl_rdComp_t;
|
304 |
|
|
Sl_wrComp <= Sl_wrComp_t;
|
305 |
|
|
Sl_rdDAck <= Sl_rdDAck_t;
|
306 |
|
|
TCU_rpipeRdEn <= TCU_rpipeRdEn_t;
|
307 |
|
|
TCU_wpipeRdEn <= TCU_wpipeRdEn_t;
|
308 |
|
|
TCU_stuWritePA <= TCU_stuWritePA_t;
|
309 |
|
|
TCU_stuWriteSA <= TCU_stuWriteSA_t;
|
310 |
|
|
TCU_stuLatchSA <= TCU_stuLatchSA_r or TCU_stuLatchSA_w;
|
311 |
|
|
TCU_stuLatchPA <= TCU_stuLatchPA_r or TCU_stuLatchPA_w;
|
312 |
|
|
|
313 |
|
|
TCU_addrAck <= addrAck_w or addrAck_r;
|
314 |
|
|
|
315 |
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
Sl_rearbitrate <= '0'; -- there is no situation, where we want to reabitrate
|
321 |
|
|
|
322 |
|
|
|
323 |
|
|
|
324 |
|
|
|
325 |
|
|
|
326 |
|
|
Sl_wait <= '1' when addrAck_w = '0' and addrAck_r = '0'
|
327 |
|
|
and AMU_deviceSelect = '1'
|
328 |
|
|
and PLB_PAValid = '1'
|
329 |
|
|
and PLB_RNW = '0'
|
330 |
|
|
and AMU_bufFull = '1';
|
331 |
|
|
|
332 |
|
|
|
333 |
|
|
|
334 |
|
|
------
|
335 |
|
|
--
|
336 |
|
|
-- interrupt signals: they are converted to active-high signals,
|
337 |
|
|
-- which are only for one clock cycle '1'
|
338 |
|
|
--
|
339 |
|
|
pic_ints : if WB_PIC_INTS > 0 generate
|
340 |
|
|
|
341 |
|
|
--
|
342 |
|
|
-- Generate the active-high interrupt levels
|
343 |
|
|
-- (we work internaly only with active-high interrupt levels)
|
344 |
|
|
--
|
345 |
|
|
gen_active_high1 : if WB_PIC_INT_LEVEL = '0' generate
|
346 |
|
|
pic_int_ahigh <= not wb_pic_int_i;
|
347 |
|
|
end generate gen_active_high1;
|
348 |
|
|
gen_active_high2 : if WB_PIC_INT_LEVEL = '1' generate
|
349 |
|
|
pic_int_ahigh <= wb_pic_int_i;
|
350 |
|
|
end generate gen_active_high2;
|
351 |
|
|
|
352 |
|
|
--
|
353 |
|
|
-- Generate short impulses (of one clock cycle)
|
354 |
|
|
--
|
355 |
|
|
gen_active_high_short : for i in 0 to WB_PIC_INTS-1 generate
|
356 |
|
|
ah_short : entity plb2wb_bridge_v1_00_a.plb2wb_short_impulse( IMP )
|
357 |
|
|
port map( CLK => wb_clk_i,
|
358 |
|
|
RESET => plb2wb_rst,
|
359 |
|
|
IMPULSE => pic_int_ahigh(i),
|
360 |
|
|
SHORT_IMPULSE => pic_int_ahigh_short(i) );
|
361 |
|
|
|
362 |
|
|
end generate;
|
363 |
|
|
|
364 |
|
|
end generate;
|
365 |
|
|
--
|
366 |
|
|
-----
|
367 |
|
|
|
368 |
|
|
|
369 |
|
|
|
370 |
|
|
|
371 |
|
|
|
372 |
|
|
|
373 |
|
|
|
374 |
|
|
short_impulse : entity plb2wb_bridge_v1_00_a.plb2wb_short_impulse( IMP )
|
375 |
|
|
port map ( CLK => wb_clk_i,
|
376 |
|
|
RESET => plb2wb_rst,
|
377 |
|
|
IMPULSE => wb_rst_i,
|
378 |
|
|
SHORT_IMPULSE => wb_rst_short );
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
|
382 |
|
|
|
383 |
|
|
|
384 |
|
|
------------------------------
|
385 |
|
|
--
|
386 |
|
|
-- This signals are '1' if a transfer is started:
|
387 |
|
|
-- (burst and line transfers are supported)
|
388 |
|
|
--
|
389 |
|
|
-- start_plb_w: start a write transfer to the WB side
|
390 |
|
|
-- start_plb_r: start a read transfer from the WB side
|
391 |
|
|
-- start_plb_stat_w: start a write transfer to the status registers
|
392 |
|
|
-- start_plb_stat_r: start a read transfer from the status registers
|
393 |
|
|
--
|
394 |
|
|
--
|
395 |
|
|
with_plb_bursts : if C_SPLB_SUPPORT_BUR_LINE > 0 generate
|
396 |
|
|
|
397 |
|
|
|
398 |
|
|
start_plb_w <= '1' when ( -- we are in the idle state
|
399 |
|
|
c_plb_wstate.state = plb_widle
|
400 |
|
|
|
401 |
|
|
-- Address in our range, primary-addr is valid and it is a write transfer
|
402 |
|
|
and AMU_deviceSelect = '1' and PLB_PAValid = '1' and PLB_RNW = '0'
|
403 |
|
|
|
404 |
|
|
-- this transfer-type is implemented
|
405 |
|
|
--(normal, line and burst -> all fixed-length word bursts)
|
406 |
|
|
and ( PLB_size( 0 to 1 ) = "00" or ( PLB_size = "1010" and PLB_BE( 0 to 3 ) /= "0000" ) )
|
407 |
|
|
|
408 |
|
|
-- we are not transfering data from the read pipe
|
409 |
|
|
and TCU_rpipeRdEn_t /= '1'
|
410 |
|
|
|
411 |
|
|
-- the address buffer is not full
|
412 |
|
|
and AMU_bufFull = '0'
|
413 |
|
|
|
414 |
|
|
-- supported transfer-type (only mem-type is supported, see PLB-Spec. page 43)
|
415 |
|
|
and ( PLB_type = "000" or PLB_type = "110" ) )
|
416 |
|
|
else '0';
|
417 |
|
|
|
418 |
|
|
|
419 |
|
|
start_plb_r <= '1' when( -- we are in the idle state
|
420 |
|
|
c_plb_rstate.state = plb_ridle
|
421 |
|
|
|
422 |
|
|
-- Address in our range, primary-addr is valid and it is a read transfer
|
423 |
|
|
and AMU_deviceSelect = '1' and PLB_PAValid = '1' and PLB_RNW = '1'
|
424 |
|
|
|
425 |
|
|
-- this transfer-type is implemented (normal and line)
|
426 |
|
|
and ( PLB_size( 0 to 1 ) = "00" or ( PLB_size = "1010" and PLB_BE( 0 to 3 ) /="0000" ) )
|
427 |
|
|
|
428 |
|
|
-- we are not transfering data from the write-pipe
|
429 |
|
|
and TCU_wpipeRdEn_t /= '1'
|
430 |
|
|
|
431 |
|
|
-- the address buffer is not full
|
432 |
|
|
and AMU_bufFull = '0'
|
433 |
|
|
|
434 |
|
|
-- supported transfer-type (only mem-type is supported, see PLB-Spec. page 43)
|
435 |
|
|
and ( PLB_type = "000" or PLB_type = "110" ) )
|
436 |
|
|
|
437 |
|
|
else '0';
|
438 |
|
|
|
439 |
|
|
|
440 |
|
|
|
441 |
|
|
start_plb_stat_w <= '1' when ( -- we are in the idle state
|
442 |
|
|
c_plb_wstate.state = plb_widle
|
443 |
|
|
|
444 |
|
|
-- Address in our range, primary-addr is valid and it is a write transfer
|
445 |
|
|
and AMU_statusSelect = '1' and PLB_PAValid = '1' and PLB_RNW = '0'
|
446 |
|
|
|
447 |
|
|
-- this transfer-type is implemented
|
448 |
|
|
--(normal, line and burst -> all fixed-length word bursts)
|
449 |
|
|
and ( PLB_size( 0 to 1 ) = "00" or ( PLB_size = "1010" and PLB_BE( 0 to 3 ) /= "0000" ) )
|
450 |
|
|
|
451 |
|
|
-- supported transfer-type (only mem-type is supported, see PLB-Spec. page 43)
|
452 |
|
|
and ( PLB_type = "000" or PLB_type = "110" ) )
|
453 |
|
|
else '0';
|
454 |
|
|
|
455 |
|
|
|
456 |
|
|
|
457 |
|
|
|
458 |
|
|
start_plb_stat_r <= '1' when (
|
459 |
|
|
-- we are in the idle state
|
460 |
|
|
c_plb_rstate.state = plb_ridle
|
461 |
|
|
|
462 |
|
|
-- Address in our range, primary-addr is valid and it is a write transfer
|
463 |
|
|
and AMU_statusSelect = '1' and PLB_PAValid = '1' and PLB_RNW = '1'
|
464 |
|
|
|
465 |
|
|
-- this transfer-type is implemented
|
466 |
|
|
--(normal, line and burst -> all fixed-length word bursts)
|
467 |
|
|
and ( PLB_size( 0 to 1 ) = "00" or ( PLB_size = "1010" and PLB_BE( 0 to 3 ) /= "0000" ) )
|
468 |
|
|
|
469 |
|
|
-- supported transfer-type (only mem-type is supported, see PLB-Spec. page 43)
|
470 |
|
|
and ( PLB_type = "000" or PLB_type = "110" ) )
|
471 |
|
|
else '0';
|
472 |
|
|
|
473 |
|
|
end generate with_plb_bursts;
|
474 |
|
|
|
475 |
|
|
|
476 |
|
|
|
477 |
|
|
|
478 |
|
|
|
479 |
|
|
|
480 |
|
|
|
481 |
|
|
------------------------------
|
482 |
|
|
--
|
483 |
|
|
-- This signals are '1' if a transfer is started:
|
484 |
|
|
-- (burst and line transfers are not supported)
|
485 |
|
|
--
|
486 |
|
|
-- start_plb_w: start a write transfer to the WB side
|
487 |
|
|
-- start_plb_r: start a read transfer from the WB side
|
488 |
|
|
-- start_plb_stat_w: start a write transfer to the status registers
|
489 |
|
|
-- start_plb_stat_r: start a read transfer from the status registers
|
490 |
|
|
--
|
491 |
|
|
--
|
492 |
|
|
without_plb_bursts : if C_SPLB_SUPPORT_BUR_LINE = 0 generate
|
493 |
|
|
|
494 |
|
|
|
495 |
|
|
start_plb_w <= '1' when ( -- we are in the idle state
|
496 |
|
|
c_plb_wstate.state = plb_widle
|
497 |
|
|
|
498 |
|
|
-- Address in our range, primary-addr is valid and it is a write transfer
|
499 |
|
|
and AMU_deviceSelect = '1' and PLB_PAValid = '1' and PLB_RNW = '0'
|
500 |
|
|
|
501 |
|
|
-- this transfer-type is implemented (only single)
|
502 |
|
|
and ( PLB_size = "0000" )
|
503 |
|
|
|
504 |
|
|
-- we are not transfering data from the read pipe
|
505 |
|
|
and TCU_rpipeRdEn_t /= '1'
|
506 |
|
|
|
507 |
|
|
-- the address buffer is not full
|
508 |
|
|
and AMU_bufFull = '0'
|
509 |
|
|
|
510 |
|
|
-- supported transfer-type (only mem-type is supported, see PLB-Spec. page 43)
|
511 |
|
|
and ( PLB_type = "000" or PLB_type = "110" ) )
|
512 |
|
|
else '0';
|
513 |
|
|
|
514 |
|
|
|
515 |
|
|
start_plb_r <= '1' when( -- we are in the idle state
|
516 |
|
|
c_plb_rstate.state = plb_ridle
|
517 |
|
|
|
518 |
|
|
-- Address in our range, primary-addr is valid and it is a read transfer
|
519 |
|
|
and AMU_deviceSelect = '1' and PLB_PAValid = '1' and PLB_RNW = '1'
|
520 |
|
|
|
521 |
|
|
-- this transfer-type is implemented (only single)
|
522 |
|
|
and ( PLB_size = "0000" )
|
523 |
|
|
|
524 |
|
|
-- we are not transfering data from the write-pipe
|
525 |
|
|
and TCU_wpipeRdEn_t /= '1'
|
526 |
|
|
|
527 |
|
|
-- the address buffer is not full
|
528 |
|
|
and AMU_bufFull = '0'
|
529 |
|
|
|
530 |
|
|
-- supported transfer-type (only mem-type is supported, see PLB-Spec. page 43)
|
531 |
|
|
and ( PLB_type = "000" or PLB_type = "110" ) )
|
532 |
|
|
|
533 |
|
|
else '0';
|
534 |
|
|
|
535 |
|
|
|
536 |
|
|
|
537 |
|
|
start_plb_stat_w <= '1' when ( -- we are in the idle state
|
538 |
|
|
c_plb_wstate.state = plb_widle
|
539 |
|
|
|
540 |
|
|
-- Address in our range, primary-addr is valid and it is a write transfer
|
541 |
|
|
and AMU_statusSelect = '1' and PLB_PAValid = '1' and PLB_RNW = '0'
|
542 |
|
|
|
543 |
|
|
-- this transfer-type is implemented (only single)
|
544 |
|
|
and ( PLB_size = "0000" )
|
545 |
|
|
|
546 |
|
|
-- supported transfer-type (only mem-type is supported, see PLB-Spec. page 43)
|
547 |
|
|
and ( PLB_type = "000" or PLB_type = "110" ) )
|
548 |
|
|
else '0';
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
|
552 |
|
|
|
553 |
|
|
start_plb_stat_r <= '1' when (
|
554 |
|
|
-- we are in the idle state
|
555 |
|
|
c_plb_rstate.state = plb_ridle
|
556 |
|
|
|
557 |
|
|
-- Address in our range, primary-addr is valid and it is a write transfer
|
558 |
|
|
and AMU_statusSelect = '1' and PLB_PAValid = '1' and PLB_RNW = '1'
|
559 |
|
|
|
560 |
|
|
-- this transfer-type is implemented (only single)
|
561 |
|
|
and ( PLB_size = "0000" )
|
562 |
|
|
|
563 |
|
|
-- supported transfer-type (only mem-type is supported, see PLB-Spec. page 43)
|
564 |
|
|
and ( PLB_type = "000" or PLB_type = "110" ) )
|
565 |
|
|
else '0';
|
566 |
|
|
|
567 |
|
|
end generate without_plb_bursts;
|
568 |
|
|
|
569 |
|
|
|
570 |
|
|
|
571 |
|
|
|
572 |
|
|
|
573 |
|
|
|
574 |
|
|
|
575 |
|
|
|
576 |
|
|
|
577 |
|
|
start_plb_sec_w <= '1' when(
|
578 |
|
|
c_plb_wstate.state = plb_widle -- ----
|
579 |
|
|
and c_plb_wstate.w_secondary = '1' -- This is the case, when there is a write
|
580 |
|
|
and AMU_bufFull = '0' -- from a secondary request directly after a write
|
581 |
|
|
and AMU_pipe_wStatusSelect = '0' -- (this transfer does not write to our status regs)
|
582 |
|
|
-- and TCU_rpipeRdEn_t /= '1' -- note: start_plb_sec_w has a higher priority
|
583 |
|
|
-- than start_plb_sec_r, (we can't check
|
584 |
|
|
-- TCU_rpipeRdEn_t, because this generates a
|
585 |
|
|
-- combinatorial loop!!)
|
586 |
|
|
) -- ----
|
587 |
|
|
else '0';
|
588 |
|
|
|
589 |
|
|
|
590 |
|
|
start_plb_sec_stat_w <= '1' when( c_plb_wstate.state = plb_widle -- ----
|
591 |
|
|
and c_plb_wstate.w_secondary = '1' -- This is the case, when there is a write
|
592 |
|
|
and AMU_pipe_wStatusSelect = '1' -- from a secondary request (we write to our status regs)
|
593 |
|
|
) -- ----
|
594 |
|
|
else '0';
|
595 |
|
|
|
596 |
|
|
|
597 |
|
|
start_plb_sec_r <= '1' when( c_plb_rstate.state = plb_ridle -- ----
|
598 |
|
|
and c_plb_rstate.r_secondary = '1' -- This is the case, when there is a read
|
599 |
|
|
and AMU_bufFull = '0' -- from a secondary request directly after a read
|
600 |
|
|
and AMU_pipe_rStatusSelect = '0' -- (this transfer does not read from our status regs)
|
601 |
|
|
and TCU_wpipeRdEn_t /= '1' ) -- ----
|
602 |
|
|
else '0';
|
603 |
|
|
|
604 |
|
|
|
605 |
|
|
start_plb_sec_stat_r <= '1' when( c_plb_rstate.state = plb_ridle -- ----
|
606 |
|
|
and c_plb_rstate.r_secondary = '1' -- This is the case, when there is a read
|
607 |
|
|
and AMU_pipe_rStatusSelect = '1' -- from a secondary request (we read from our status regs)
|
608 |
|
|
) -- ----
|
609 |
|
|
else '0';
|
610 |
|
|
|
611 |
|
|
|
612 |
|
|
|
613 |
|
|
c_plb_state_p : process( SPLB_Clk, plb2wb_rst ) begin
|
614 |
|
|
if plb2wb_rst='1' then
|
615 |
|
|
|
616 |
|
|
c_plb_rstate <= ( state => plb_ridle,
|
617 |
|
|
r_master_id => ( others => '0' ),
|
618 |
|
|
transfer_count => ( others => '0' ),
|
619 |
|
|
transfer_size => ( others => '0' ),
|
620 |
|
|
status_transfer => '0',
|
621 |
|
|
r_secondary => '0' );
|
622 |
|
|
c_plb_wstate <= ( state => plb_widle,
|
623 |
|
|
w_master_id => ( others => '0' ),
|
624 |
|
|
transfer_count => ( others => '0' ),
|
625 |
|
|
transfer_size => ( others => '0' ),
|
626 |
|
|
status_transfer => '0',
|
627 |
|
|
w_secondary => '0' );
|
628 |
|
|
|
629 |
|
|
|
630 |
|
|
elsif SPLB_Clk'event and SPLB_Clk='1' then
|
631 |
|
|
c_plb_rstate <= n_plb_rstate;
|
632 |
|
|
c_plb_wstate <= n_plb_wstate;
|
633 |
|
|
end if;
|
634 |
|
|
end process;
|
635 |
|
|
|
636 |
|
|
|
637 |
|
|
|
638 |
|
|
|
639 |
|
|
|
640 |
|
|
n_plb_wstate_p : process( c_plb_wstate,
|
641 |
|
|
PLB_PAValid, PLB_RNW, PLB_masterID, PLB_wrPrim, PLB_size, PLB_BE,
|
642 |
|
|
AMU_deviceSelect, AMU_statusSelect, AMU_bufFull, WBF_full, AMU_pipe_size, AMU_pipe_wmID, AMU_pipe_BE,
|
643 |
|
|
start_plb_sec_w, start_plb_sec_stat_w, start_plb_w, start_plb_stat_w,
|
644 |
|
|
TCU_rpipeRdEn_t )
|
645 |
|
|
begin
|
646 |
|
|
|
647 |
|
|
|
648 |
|
|
Sl_MWrErr <= ( others => '0' );
|
649 |
|
|
|
650 |
|
|
-- default output logic
|
651 |
|
|
Sl_wrDAck <= '0';
|
652 |
|
|
Sl_wrComp_t <= '0';
|
653 |
|
|
Sl_wrBTerm <= '0';
|
654 |
|
|
|
655 |
|
|
TCU_wbufWEn_t <= '0';
|
656 |
|
|
TCU_adrBufWEn_w <= '0';
|
657 |
|
|
TCU_wpipeRdEn_t <= '0';
|
658 |
|
|
addrAck_w <= '0';
|
659 |
|
|
|
660 |
|
|
|
661 |
|
|
TCU_stuLatchSA_w <= '0';
|
662 |
|
|
TCU_stuLatchPA_w <= '0';
|
663 |
|
|
|
664 |
|
|
-- default state
|
665 |
|
|
n_plb_wstate <= c_plb_wstate;
|
666 |
|
|
mbusy_write_out <= ( others => '0' );
|
667 |
|
|
|
668 |
|
|
TCU_stuWritePA_t <= '0';
|
669 |
|
|
TCU_stuWriteSA_t <= '0';
|
670 |
|
|
|
671 |
|
|
if PLB_wrPrim = '1' then
|
672 |
|
|
n_plb_wstate.w_secondary <= '1';
|
673 |
|
|
end if;
|
674 |
|
|
|
675 |
|
|
|
676 |
|
|
|
677 |
|
|
if start_plb_sec_w = '1' then
|
678 |
|
|
|
679 |
|
|
-- read from pipe and add it to the buffer
|
680 |
|
|
TCU_wpipeRdEn_t <= '1';
|
681 |
|
|
TCU_adrBufWEn_w <= '1';
|
682 |
|
|
|
683 |
|
|
n_plb_wstate.w_secondary <= '0';
|
684 |
|
|
n_plb_wstate.status_transfer <= '0';
|
685 |
|
|
|
686 |
|
|
-- we latch the masterID
|
687 |
|
|
n_plb_wstate.w_master_id <= AMU_pipe_wmID;
|
688 |
|
|
|
689 |
|
|
-- buffer is not full, this is a implemented transfer and this is a normal/single transfer
|
690 |
|
|
if WBF_full = '0' and AMU_pipe_size = "0000" then
|
691 |
|
|
|
692 |
|
|
-- add data to the buffer
|
693 |
|
|
TCU_wbufWEn_t <= '1';
|
694 |
|
|
-- ack transfer to PLB
|
695 |
|
|
Sl_wrDAck <= '1';
|
696 |
|
|
Sl_wrComp_t <= '1';
|
697 |
|
|
|
698 |
|
|
-- we stay in the idle state
|
699 |
|
|
|
700 |
|
|
-- buffer is not full, this is a line transfer
|
701 |
|
|
elsif WBF_full = '0' and AMU_pipe_size( 0 to 1 ) = "00" and AMU_pipe_size( 2 to 3 ) /= "00" then
|
702 |
|
|
|
703 |
|
|
-- add data to the buffer
|
704 |
|
|
TCU_wbufWEn_t <= '1';
|
705 |
|
|
-- ack transfer to PLB
|
706 |
|
|
Sl_wrDAck <= '1';
|
707 |
|
|
|
708 |
|
|
n_plb_wstate.state <= plb_write;
|
709 |
|
|
n_plb_wstate.transfer_size <= AMU_pipe_size;
|
710 |
|
|
-- we did one transfer in this clock cycle
|
711 |
|
|
n_plb_wstate.transfer_count <= "0001";
|
712 |
|
|
|
713 |
|
|
-- buffer is full, we switch to the wait-state and wait until we can write to the buffer
|
714 |
|
|
elsif WBF_full = '1' and AMU_pipe_size( 0 to 1 ) = "00" then
|
715 |
|
|
|
716 |
|
|
n_plb_wstate.state <= plb_write;
|
717 |
|
|
n_plb_wstate.transfer_size <= AMU_pipe_size;
|
718 |
|
|
-- we did one transfer in this clock cycle
|
719 |
|
|
n_plb_wstate.transfer_count <= "0000";
|
720 |
|
|
|
721 |
|
|
-- this is a burst transfer
|
722 |
|
|
-- and the buffer is not full
|
723 |
|
|
elsif WBF_full = '0' and AMU_pipe_size( 0 to 1 ) /= "00" then
|
724 |
|
|
|
725 |
|
|
-- add data to the buffer
|
726 |
|
|
TCU_wbufWEn_t <= '1';
|
727 |
|
|
-- ack transfer to PLB
|
728 |
|
|
Sl_wrDAck <= '1';
|
729 |
|
|
|
730 |
|
|
n_plb_wstate.state <= plb_burst_write;
|
731 |
|
|
n_plb_wstate.transfer_size <= AMU_pipe_BE;
|
732 |
|
|
-- we did one transfer in this clock cycle
|
733 |
|
|
n_plb_wstate.transfer_count <= "0001";
|
734 |
|
|
|
735 |
|
|
-- this is a burst transfer
|
736 |
|
|
-- and the buffer is full
|
737 |
|
|
elsif WBF_full = '1' and AMU_pipe_size( 0 to 1 ) /= "00" then
|
738 |
|
|
|
739 |
|
|
n_plb_wstate.state <= plb_burst_write;
|
740 |
|
|
n_plb_wstate.transfer_size <= AMU_pipe_BE;
|
741 |
|
|
-- we did one transfer in this clock cycle
|
742 |
|
|
n_plb_wstate.transfer_count <= "0000";
|
743 |
|
|
|
744 |
|
|
end if;
|
745 |
|
|
|
746 |
|
|
|
747 |
|
|
|
748 |
|
|
--
|
749 |
|
|
-- NOTE: it is not allowed to write with a burst or line transfer to the status
|
750 |
|
|
-- registers, so TCU_stuWriteSA_t is only '1' for a single transfer!
|
751 |
|
|
--
|
752 |
|
|
elsif start_plb_sec_stat_w = '1' then
|
753 |
|
|
|
754 |
|
|
TCU_wpipeRdEn_t <= '1';
|
755 |
|
|
|
756 |
|
|
-- we latch the masterID
|
757 |
|
|
n_plb_wstate.w_master_id <= AMU_pipe_wmID;
|
758 |
|
|
|
759 |
|
|
n_plb_wstate.w_secondary <= '0';
|
760 |
|
|
|
761 |
|
|
-- ack transfer to PLB
|
762 |
|
|
Sl_wrDAck <= '1';
|
763 |
|
|
|
764 |
|
|
|
765 |
|
|
if AMU_pipe_size = "1010" and AMU_pipe_BE( 0 to 3 ) /= "0000" then
|
766 |
|
|
-- burst transfer
|
767 |
|
|
|
768 |
|
|
|
769 |
|
|
Sl_MWrErr( to_integer( unsigned'( unsigned( AMU_pipe_wmID ) ) ) ) <= '1';
|
770 |
|
|
|
771 |
|
|
-- we switch to the burst_write state:
|
772 |
|
|
-- we write until transfer_count = transfer_size
|
773 |
|
|
n_plb_wstate.state <= plb_burst_write;
|
774 |
|
|
n_plb_wstate.transfer_size <= AMU_pipe_BE( 0 to 3 );
|
775 |
|
|
-- we did no transfer in this clock cycle
|
776 |
|
|
n_plb_wstate.transfer_count <= "0001";
|
777 |
|
|
|
778 |
|
|
n_plb_wstate.status_transfer <= '1';
|
779 |
|
|
|
780 |
|
|
|
781 |
|
|
|
782 |
|
|
elsif AMU_pipe_size( 0 to 1 ) = "00" and AMU_pipe_size( 2 to 3 ) /= "00" then
|
783 |
|
|
-- line transfer
|
784 |
|
|
|
785 |
|
|
Sl_MWrErr( to_integer( unsigned'( unsigned( AMU_pipe_wmID ) ) ) ) <= '1';
|
786 |
|
|
|
787 |
|
|
-- we switch to the write state:
|
788 |
|
|
-- we write until transfer_count = transfer_size
|
789 |
|
|
n_plb_wstate.state <= plb_write;
|
790 |
|
|
n_plb_wstate.transfer_size <= AMU_pipe_size;
|
791 |
|
|
-- we did one transfer in this clock cycle
|
792 |
|
|
n_plb_wstate.transfer_count <= "0001";
|
793 |
|
|
|
794 |
|
|
n_plb_wstate.status_transfer <= '1';
|
795 |
|
|
|
796 |
|
|
|
797 |
|
|
else
|
798 |
|
|
|
799 |
|
|
-- single transfer
|
800 |
|
|
TCU_stuWriteSA_t <= '1';
|
801 |
|
|
Sl_wrComp_t <= '1';
|
802 |
|
|
end if;
|
803 |
|
|
|
804 |
|
|
|
805 |
|
|
--
|
806 |
|
|
-- start write transfer, initiated through PLB_PAValid
|
807 |
|
|
--
|
808 |
|
|
elsif start_plb_w = '1' then
|
809 |
|
|
|
810 |
|
|
-- we can accept the address
|
811 |
|
|
|
812 |
|
|
-- add address and data to the fifos/buffers
|
813 |
|
|
-- this implicit acks the address (see plb2wb_amu.vhd)
|
814 |
|
|
TCU_adrBufWEn_w <= '1';
|
815 |
|
|
|
816 |
|
|
addrAck_w <= '1';
|
817 |
|
|
|
818 |
|
|
|
819 |
|
|
-- we latch the masterID
|
820 |
|
|
n_plb_wstate.w_master_id <= PLB_masterID;
|
821 |
|
|
|
822 |
|
|
n_plb_wstate.status_transfer <= '0';
|
823 |
|
|
|
824 |
|
|
-- buffer is not full and this is a single/normal transfer
|
825 |
|
|
-- (we stay in the idle state)
|
826 |
|
|
if WBF_full = '0' and PLB_size = "0000" then
|
827 |
|
|
|
828 |
|
|
-- add data to the buffer
|
829 |
|
|
TCU_wbufWEn_t <= '1';
|
830 |
|
|
-- ack transfer to PLB
|
831 |
|
|
Sl_wrDAck <= '1';
|
832 |
|
|
Sl_wrComp_t <= '1';
|
833 |
|
|
|
834 |
|
|
|
835 |
|
|
-- this is a line transfer
|
836 |
|
|
elsif WBF_full = '0' and PLB_size( 0 to 1 ) = "00" and PLB_size( 2 to 3 ) /= "00" then
|
837 |
|
|
|
838 |
|
|
-- add data to the buffer
|
839 |
|
|
TCU_wbufWEn_t <= '1';
|
840 |
|
|
-- ack transfer to PLB
|
841 |
|
|
Sl_wrDAck <= '1';
|
842 |
|
|
|
843 |
|
|
-- we switch to the write state:
|
844 |
|
|
-- we write until transfer_count = transfer_size
|
845 |
|
|
n_plb_wstate.state <= plb_write;
|
846 |
|
|
n_plb_wstate.transfer_size <= PLB_size;
|
847 |
|
|
-- we did one transfer in this clock cycle
|
848 |
|
|
n_plb_wstate.transfer_count <= "0001";
|
849 |
|
|
|
850 |
|
|
|
851 |
|
|
-- the buffer is full:
|
852 |
|
|
-- if this is a single or line transfer, we switch to the plb_write state
|
853 |
|
|
elsif WBF_full = '1' and PLB_size( 0 to 1 ) = "00" then
|
854 |
|
|
|
855 |
|
|
|
856 |
|
|
-- we switch to the write state:
|
857 |
|
|
-- we write until transfer_count = transfer_size
|
858 |
|
|
n_plb_wstate.state <= plb_write;
|
859 |
|
|
n_plb_wstate.transfer_size <= PLB_size;
|
860 |
|
|
-- we did no transfer in this clock cycle
|
861 |
|
|
n_plb_wstate.transfer_count <= "0000";
|
862 |
|
|
|
863 |
|
|
|
864 |
|
|
-- this is a burst transfer
|
865 |
|
|
-- and the buffer is not full
|
866 |
|
|
elsif WBF_full = '0' and PLB_size( 0 to 1 ) /= "00" then
|
867 |
|
|
|
868 |
|
|
|
869 |
|
|
-- add data to the buffer
|
870 |
|
|
TCU_wbufWEn_t <= '1';
|
871 |
|
|
-- ack transfer to PLB
|
872 |
|
|
Sl_wrDAck <= '1';
|
873 |
|
|
|
874 |
|
|
|
875 |
|
|
-- we switch to the burst_write state:
|
876 |
|
|
-- we write until transfer_count = transfer_size
|
877 |
|
|
n_plb_wstate.state <= plb_burst_write;
|
878 |
|
|
n_plb_wstate.transfer_size <= PLB_BE( 0 to 3 );
|
879 |
|
|
-- we did no transfer in this clock cycle
|
880 |
|
|
n_plb_wstate.transfer_count <= "0001";
|
881 |
|
|
|
882 |
|
|
|
883 |
|
|
-- this is a burst transfer
|
884 |
|
|
-- and the buffer is full
|
885 |
|
|
elsif WBF_full = '1' and PLB_size( 0 to 1 ) /= "00" then
|
886 |
|
|
|
887 |
|
|
|
888 |
|
|
-- we switch to the burst_write state:
|
889 |
|
|
-- we write until transfer_count = transfer_size
|
890 |
|
|
n_plb_wstate.state <= plb_burst_write;
|
891 |
|
|
n_plb_wstate.transfer_size <= PLB_BE( 0 to 3 );
|
892 |
|
|
-- we did no transfer in this clock cycle
|
893 |
|
|
n_plb_wstate.transfer_count <= "0000";
|
894 |
|
|
|
895 |
|
|
end if;
|
896 |
|
|
|
897 |
|
|
--
|
898 |
|
|
-- start write transfer to state-register, initiated through PLB_PAValid
|
899 |
|
|
--
|
900 |
|
|
--
|
901 |
|
|
-- NOTE: it is not allowed to write with a burst or line transfer to the status
|
902 |
|
|
-- registers, so TCU_stuWritePA_t is only '1' for a single transfer!
|
903 |
|
|
--
|
904 |
|
|
elsif start_plb_stat_w = '1' then
|
905 |
|
|
|
906 |
|
|
addrAck_w <= '1';
|
907 |
|
|
|
908 |
|
|
-- we latch the masterID
|
909 |
|
|
n_plb_wstate.w_master_id <= PLB_masterID;
|
910 |
|
|
|
911 |
|
|
-- ack transfer to PLB
|
912 |
|
|
Sl_wrDAck <= '1';
|
913 |
|
|
|
914 |
|
|
|
915 |
|
|
if PLB_size = "1010" and PLB_BE( 0 to 3 ) /= "0000" then
|
916 |
|
|
-- burst transfer
|
917 |
|
|
|
918 |
|
|
|
919 |
|
|
Sl_MWrErr( to_integer( unsigned'( unsigned( PLB_masterID ) ) ) ) <= '1';
|
920 |
|
|
|
921 |
|
|
-- we switch to the burst_write state:
|
922 |
|
|
-- we write until transfer_count = transfer_size
|
923 |
|
|
n_plb_wstate.state <= plb_burst_write;
|
924 |
|
|
n_plb_wstate.transfer_size <= PLB_BE( 0 to 3 );
|
925 |
|
|
-- we did no transfer in this clock cycle
|
926 |
|
|
n_plb_wstate.transfer_count <= "0001";
|
927 |
|
|
|
928 |
|
|
n_plb_wstate.status_transfer <= '1';
|
929 |
|
|
|
930 |
|
|
|
931 |
|
|
|
932 |
|
|
elsif PLB_size( 0 to 1 ) = "00" and PLB_size( 2 to 3 ) /= "00" then
|
933 |
|
|
-- line transfer
|
934 |
|
|
|
935 |
|
|
Sl_MWrErr( to_integer( unsigned'( unsigned( PLB_masterID ) ) ) ) <= '1';
|
936 |
|
|
|
937 |
|
|
-- we switch to the write state:
|
938 |
|
|
-- we write until transfer_count = transfer_size
|
939 |
|
|
n_plb_wstate.state <= plb_write;
|
940 |
|
|
n_plb_wstate.transfer_size <= PLB_size;
|
941 |
|
|
-- we did one transfer in this clock cycle
|
942 |
|
|
n_plb_wstate.transfer_count <= "0001";
|
943 |
|
|
|
944 |
|
|
n_plb_wstate.status_transfer <= '1';
|
945 |
|
|
|
946 |
|
|
|
947 |
|
|
else
|
948 |
|
|
|
949 |
|
|
-- single transfer
|
950 |
|
|
TCU_stuWritePA_t <= '1';
|
951 |
|
|
Sl_wrComp_t <= '1';
|
952 |
|
|
end if;
|
953 |
|
|
end if;
|
954 |
|
|
|
955 |
|
|
|
956 |
|
|
|
957 |
|
|
|
958 |
|
|
|
959 |
|
|
--
|
960 |
|
|
-- write transfer: we are here because
|
961 |
|
|
-- - the write buffer was full and the adress buffer not, or
|
962 |
|
|
-- - this is a line transfer
|
963 |
|
|
--
|
964 |
|
|
if ( c_plb_wstate.state = plb_write and
|
965 |
|
|
( c_plb_wstate.status_transfer = '1' or ( WBF_full = '0' and c_plb_wstate.status_transfer = '0' ) ) ) then -- we can accept data
|
966 |
|
|
|
967 |
|
|
-- ack transfer to PLB
|
968 |
|
|
Sl_wrDAck <= '1';
|
969 |
|
|
|
970 |
|
|
|
971 |
|
|
if ( ( c_plb_wstate.transfer_size( 0 to 3 ) = "0001" and c_plb_wstate.transfer_count = "0011" ) or
|
972 |
|
|
( c_plb_wstate.transfer_size( 0 to 3 ) = "0010" and c_plb_wstate.transfer_count = "0111" ) or
|
973 |
|
|
( c_plb_wstate.transfer_size( 0 to 3 ) = "0011" and c_plb_wstate.transfer_count = "1111" ) or
|
974 |
|
|
( c_plb_wstate.transfer_size( 0 to 3 ) = "0000" ) -- single transfer
|
975 |
|
|
) then
|
976 |
|
|
-- we are at the end of this transfer
|
977 |
|
|
Sl_wrComp_t <= '1';
|
978 |
|
|
|
979 |
|
|
n_plb_wstate.state <= plb_widle;
|
980 |
|
|
|
981 |
|
|
|
982 |
|
|
else
|
983 |
|
|
n_plb_wstate.transfer_count <= std_logic_vector( unsigned'( unsigned(c_plb_wstate.transfer_count) +1 ) );
|
984 |
|
|
end if;
|
985 |
|
|
|
986 |
|
|
|
987 |
|
|
if c_plb_wstate.status_transfer = '1' then
|
988 |
|
|
|
989 |
|
|
Sl_MWrErr( to_integer( unsigned'( unsigned( c_plb_wstate.w_master_id ) ) ) ) <= '1';
|
990 |
|
|
|
991 |
|
|
elsif WBF_full = '0' then
|
992 |
|
|
|
993 |
|
|
-- add data to the buffer
|
994 |
|
|
TCU_wbufWEn_t <= '1';
|
995 |
|
|
|
996 |
|
|
end if;
|
997 |
|
|
|
998 |
|
|
|
999 |
|
|
|
1000 |
|
|
end if;
|
1001 |
|
|
|
1002 |
|
|
|
1003 |
|
|
--
|
1004 |
|
|
-- burst write transfer: we are here because
|
1005 |
|
|
-- - this is a burst transfer
|
1006 |
|
|
if( c_plb_wstate.state = plb_burst_write and
|
1007 |
|
|
( ( WBF_full = '0' and c_plb_wstate.status_transfer = '0' ) or c_plb_wstate.status_transfer = '1' ) )then -- we can accept data
|
1008 |
|
|
|
1009 |
|
|
|
1010 |
|
|
if c_plb_wstate.status_transfer = '1' then
|
1011 |
|
|
|
1012 |
|
|
Sl_MWrErr( to_integer( unsigned'( unsigned( c_plb_wstate.w_master_id ) ) ) ) <= '1';
|
1013 |
|
|
|
1014 |
|
|
elsif WBF_full = '0' then
|
1015 |
|
|
|
1016 |
|
|
-- add data to the buffer
|
1017 |
|
|
TCU_wbufWEn_t <= '1';
|
1018 |
|
|
|
1019 |
|
|
end if;
|
1020 |
|
|
|
1021 |
|
|
|
1022 |
|
|
|
1023 |
|
|
-- ack transfer to PLB
|
1024 |
|
|
Sl_wrDAck <= '1';
|
1025 |
|
|
|
1026 |
|
|
|
1027 |
|
|
-- we show that the burst-transfer ends after the next cycle
|
1028 |
|
|
if c_plb_wstate.transfer_count = std_logic_vector( unsigned'( unsigned( c_plb_wstate.transfer_size ) -1 ) ) then
|
1029 |
|
|
Sl_wrBTerm <= '1';
|
1030 |
|
|
end if;
|
1031 |
|
|
|
1032 |
|
|
|
1033 |
|
|
if c_plb_wstate.transfer_size = c_plb_wstate.transfer_count then
|
1034 |
|
|
-- we are at the end of this transfer
|
1035 |
|
|
Sl_wrComp_t <= '1';
|
1036 |
|
|
n_plb_wstate.state <= plb_widle;
|
1037 |
|
|
else
|
1038 |
|
|
n_plb_wstate.transfer_count <= std_logic_vector( unsigned'( unsigned(c_plb_wstate.transfer_count) +1 ) );
|
1039 |
|
|
end if;
|
1040 |
|
|
|
1041 |
|
|
|
1042 |
|
|
|
1043 |
|
|
|
1044 |
|
|
end if;
|
1045 |
|
|
|
1046 |
|
|
|
1047 |
|
|
|
1048 |
|
|
|
1049 |
|
|
if c_plb_wstate.state = plb_write
|
1050 |
|
|
or c_plb_wstate.state = plb_burst_write then
|
1051 |
|
|
mbusy_write_out( to_integer( unsigned'( unsigned( c_plb_wstate.w_master_id ) ) ) ) <= '1';
|
1052 |
|
|
elsif c_plb_wstate.w_secondary = '1' then
|
1053 |
|
|
mbusy_write_out( to_integer( unsigned'( unsigned( AMU_pipe_wmID ) ) ) ) <= '1';
|
1054 |
|
|
end if;
|
1055 |
|
|
|
1056 |
|
|
end process;
|
1057 |
|
|
|
1058 |
|
|
|
1059 |
|
|
|
1060 |
|
|
|
1061 |
|
|
|
1062 |
|
|
|
1063 |
|
|
|
1064 |
|
|
|
1065 |
|
|
|
1066 |
|
|
|
1067 |
|
|
|
1068 |
|
|
|
1069 |
|
|
|
1070 |
|
|
n_plb_rstate_p : process( c_plb_rstate,
|
1071 |
|
|
PLB_PAValid, PLB_RNW, PLB_masterID, PLB_rdPrim, PLB_size, PLB_BE,
|
1072 |
|
|
AMU_deviceSelect, AMU_bufFull, AMU_pipe_size, AMU_pipe_rmID, AMU_pipe_BE, AMU_statusSelect,
|
1073 |
|
|
RBF_empty, RBF_almostEmpty,
|
1074 |
|
|
start_plb_sec_r, start_plb_sec_stat_r, start_plb_r, start_plb_stat_r,
|
1075 |
|
|
TCU_wpipeRdEn_t )
|
1076 |
|
|
begin
|
1077 |
|
|
|
1078 |
|
|
|
1079 |
|
|
Sl_rdDAck_t <= '0';
|
1080 |
|
|
Sl_rdComp_t <= '0';
|
1081 |
|
|
Sl_rdBTerm <= '0';
|
1082 |
|
|
|
1083 |
|
|
TCU_rbufREn_t <= '0';
|
1084 |
|
|
TCU_adrBufWEn_r <= '0';
|
1085 |
|
|
|
1086 |
|
|
TCU_enRdDBus <= '0';
|
1087 |
|
|
TCU_rpipeRdEn_t <= '0';
|
1088 |
|
|
|
1089 |
|
|
-- TCU_rbufPreLoad <= '0'; -- TODO
|
1090 |
|
|
-- TCU_rbufPreEn <= '0'; -- TODO
|
1091 |
|
|
|
1092 |
|
|
addrAck_r <= '0';
|
1093 |
|
|
|
1094 |
|
|
|
1095 |
|
|
TCU_stuLatchSA_r <= '0';
|
1096 |
|
|
TCU_stuLatchPA_r <= '0';
|
1097 |
|
|
|
1098 |
|
|
TCU_enStuRdDBus <= '0';
|
1099 |
|
|
Sl_rdWdAddr <= ( others => '0' );
|
1100 |
|
|
|
1101 |
|
|
mbusy_read_out <= ( others => '0' );
|
1102 |
|
|
|
1103 |
|
|
n_plb_rstate <= c_plb_rstate;
|
1104 |
|
|
|
1105 |
|
|
if PLB_rdPrim = '1' then
|
1106 |
|
|
n_plb_rstate.r_secondary <= '1';
|
1107 |
|
|
end if;
|
1108 |
|
|
|
1109 |
|
|
|
1110 |
|
|
if start_plb_sec_r = '1' then
|
1111 |
|
|
|
1112 |
|
|
TCU_adrBufWEn_r <= '1';
|
1113 |
|
|
TCU_rpipeRdEn_t <= '1';
|
1114 |
|
|
n_plb_rstate.r_secondary <= '0';
|
1115 |
|
|
|
1116 |
|
|
-- latch the master-id from AMU
|
1117 |
|
|
n_plb_rstate.r_master_id <= AMU_pipe_rmID;
|
1118 |
|
|
|
1119 |
|
|
n_plb_rstate.status_transfer <= '0';
|
1120 |
|
|
|
1121 |
|
|
-- this is a line transfer
|
1122 |
|
|
if AMU_pipe_size( 0 to 1 ) = "00" and AMU_pipe_size( 2 to 3 ) /= "00" and C_SPLB_SUPPORT_BUR_LINE > 0 then
|
1123 |
|
|
|
1124 |
|
|
n_plb_rstate.state <= plb_line_read;
|
1125 |
|
|
n_plb_rstate.transfer_count <= ( others => '0' );
|
1126 |
|
|
n_plb_rstate.transfer_size <= AMU_pipe_size;
|
1127 |
|
|
|
1128 |
|
|
|
1129 |
|
|
-- this is a burst transfer
|
1130 |
|
|
elsif AMU_pipe_size( 0 to 1 ) /= "00" and C_SPLB_SUPPORT_BUR_LINE > 0 then
|
1131 |
|
|
|
1132 |
|
|
n_plb_rstate.state <= plb_burst_read;
|
1133 |
|
|
n_plb_rstate.transfer_count <= ( others => '0' );
|
1134 |
|
|
n_plb_rstate.transfer_size <= AMU_pipe_BE( 0 to 3 );
|
1135 |
|
|
|
1136 |
|
|
-- this is a single transfer
|
1137 |
|
|
else
|
1138 |
|
|
n_plb_rstate.state <= plb_read;
|
1139 |
|
|
end if;
|
1140 |
|
|
|
1141 |
|
|
|
1142 |
|
|
|
1143 |
|
|
--
|
1144 |
|
|
-- start read transfer from state-register, initiated through secondary request
|
1145 |
|
|
--
|
1146 |
|
|
elsif start_plb_sec_stat_r = '1' then
|
1147 |
|
|
|
1148 |
|
|
|
1149 |
|
|
TCU_rpipeRdEn_t <= '1';
|
1150 |
|
|
n_plb_rstate.r_secondary <= '0';
|
1151 |
|
|
|
1152 |
|
|
-- latch the master-id from AMU
|
1153 |
|
|
n_plb_rstate.r_master_id <= AMU_pipe_rmID;
|
1154 |
|
|
|
1155 |
|
|
-- tell the stu, that it should latch the secondary address
|
1156 |
|
|
TCU_stuLatchSA_r <= '1';
|
1157 |
|
|
|
1158 |
|
|
n_plb_rstate.status_transfer <= '1';
|
1159 |
|
|
|
1160 |
|
|
-- this is a line transfer
|
1161 |
|
|
if AMU_pipe_size( 0 to 1 ) = "00" and AMU_pipe_size( 2 to 3 ) /= "00" and C_SPLB_SUPPORT_BUR_LINE > 0 then
|
1162 |
|
|
|
1163 |
|
|
n_plb_rstate.state <= plb_line_read;
|
1164 |
|
|
n_plb_rstate.transfer_count <= ( others => '0' );
|
1165 |
|
|
n_plb_rstate.transfer_size <= AMU_pipe_size;
|
1166 |
|
|
|
1167 |
|
|
|
1168 |
|
|
-- this is a burst transfer
|
1169 |
|
|
elsif AMU_pipe_size( 0 to 1 ) /= "00" and C_SPLB_SUPPORT_BUR_LINE > 0 then
|
1170 |
|
|
|
1171 |
|
|
n_plb_rstate.state <= plb_burst_read;
|
1172 |
|
|
n_plb_rstate.transfer_count <= ( others => '0' );
|
1173 |
|
|
n_plb_rstate.transfer_size <= AMU_pipe_BE( 0 to 3 );
|
1174 |
|
|
|
1175 |
|
|
-- this is a single transfer
|
1176 |
|
|
else
|
1177 |
|
|
n_plb_rstate.state <= plb_read;
|
1178 |
|
|
end if;
|
1179 |
|
|
|
1180 |
|
|
|
1181 |
|
|
|
1182 |
|
|
--
|
1183 |
|
|
-- start read transfer, initiated through PLB_PAValid
|
1184 |
|
|
--
|
1185 |
|
|
elsif start_plb_r = '1' then
|
1186 |
|
|
|
1187 |
|
|
|
1188 |
|
|
-- add address to the buffer/fifo
|
1189 |
|
|
TCU_adrBufWEn_r <= '1';
|
1190 |
|
|
|
1191 |
|
|
addrAck_r <= '1';
|
1192 |
|
|
|
1193 |
|
|
-- latch the master-id from plb-bus
|
1194 |
|
|
n_plb_rstate.r_master_id <= PLB_masterID;
|
1195 |
|
|
|
1196 |
|
|
|
1197 |
|
|
n_plb_rstate.status_transfer <= '0';
|
1198 |
|
|
|
1199 |
|
|
|
1200 |
|
|
n_plb_rstate.transfer_count <= "0000";
|
1201 |
|
|
|
1202 |
|
|
-- this is a line transfer
|
1203 |
|
|
if PLB_size( 0 to 1 ) = "00" and PLB_size( 2 to 3 ) /= "00" and C_SPLB_SUPPORT_BUR_LINE > 0 then
|
1204 |
|
|
n_plb_rstate.transfer_size <= PLB_size;
|
1205 |
|
|
n_plb_rstate.state <= plb_wait_line_read;
|
1206 |
|
|
n_plb_rstate.transfer_count <= ( others => '0' );
|
1207 |
|
|
|
1208 |
|
|
-- this is a burst transfer
|
1209 |
|
|
elsif PLB_size( 0 to 1 ) /= "00" and C_SPLB_SUPPORT_BUR_LINE > 0 then
|
1210 |
|
|
n_plb_rstate.state <= plb_wait_burst_read;
|
1211 |
|
|
n_plb_rstate.transfer_count <= ( others => '0' );
|
1212 |
|
|
n_plb_rstate.transfer_size <= PLB_BE( 0 to 3 );
|
1213 |
|
|
-- this is a single transfer
|
1214 |
|
|
else
|
1215 |
|
|
n_plb_rstate.transfer_size <= PLB_size;
|
1216 |
|
|
n_plb_rstate.state <= plb_read;
|
1217 |
|
|
end if;
|
1218 |
|
|
|
1219 |
|
|
|
1220 |
|
|
--
|
1221 |
|
|
-- start read transfer from state-register, initiated through PLB_PAValid
|
1222 |
|
|
--
|
1223 |
|
|
elsif start_plb_stat_r = '1' then
|
1224 |
|
|
|
1225 |
|
|
|
1226 |
|
|
-- single transfer
|
1227 |
|
|
addrAck_r <= '1';
|
1228 |
|
|
|
1229 |
|
|
-- tell the stu, that it should latch the primary address
|
1230 |
|
|
TCU_stuLatchPA_r <= '1';
|
1231 |
|
|
|
1232 |
|
|
-- latch the master-id from plb-bus
|
1233 |
|
|
n_plb_rstate.r_master_id <= PLB_masterID;
|
1234 |
|
|
|
1235 |
|
|
n_plb_rstate.transfer_count <= "0000";
|
1236 |
|
|
|
1237 |
|
|
|
1238 |
|
|
n_plb_rstate.status_transfer <= '1';
|
1239 |
|
|
|
1240 |
|
|
-- this is a line transfer
|
1241 |
|
|
if PLB_size( 0 to 1 ) = "00" and PLB_size( 2 to 3 ) /= "00" and C_SPLB_SUPPORT_BUR_LINE > 0 then
|
1242 |
|
|
n_plb_rstate.transfer_size <= PLB_size;
|
1243 |
|
|
n_plb_rstate.state <= plb_wait_line_read;
|
1244 |
|
|
n_plb_rstate.transfer_count <= ( others => '0' );
|
1245 |
|
|
|
1246 |
|
|
-- this is a burst transfer
|
1247 |
|
|
elsif PLB_size( 0 to 1 ) /= "00" and C_SPLB_SUPPORT_BUR_LINE > 0 then
|
1248 |
|
|
n_plb_rstate.state <= plb_wait_burst_read;
|
1249 |
|
|
n_plb_rstate.transfer_count <= ( others => '0' );
|
1250 |
|
|
n_plb_rstate.transfer_size <= PLB_BE( 0 to 3 );
|
1251 |
|
|
-- this is a single transfer
|
1252 |
|
|
else
|
1253 |
|
|
n_plb_rstate.transfer_size <= PLB_size;
|
1254 |
|
|
n_plb_rstate.state <= plb_read;
|
1255 |
|
|
|
1256 |
|
|
end if;
|
1257 |
|
|
|
1258 |
|
|
|
1259 |
|
|
|
1260 |
|
|
end if;
|
1261 |
|
|
|
1262 |
|
|
|
1263 |
|
|
|
1264 |
|
|
-- the wb-side read the data and added it to the fifo
|
1265 |
|
|
-- -> fifo is not empty any more
|
1266 |
|
|
if ( ( c_plb_rstate.state = plb_read and c_plb_rstate.status_transfer = '0' and RBF_empty = '0' )
|
1267 |
|
|
-- this transfer reads from status register
|
1268 |
|
|
or ( c_plb_rstate.state = plb_read and c_plb_rstate.status_transfer = '1' ) )
|
1269 |
|
|
then
|
1270 |
|
|
|
1271 |
|
|
-- complete read transfer
|
1272 |
|
|
Sl_rdComp_t <= '1';
|
1273 |
|
|
|
1274 |
|
|
-- switch to the ack state
|
1275 |
|
|
n_plb_rstate.state <= plb_read_ack;
|
1276 |
|
|
|
1277 |
|
|
end if;
|
1278 |
|
|
|
1279 |
|
|
|
1280 |
|
|
|
1281 |
|
|
if c_plb_rstate.state = plb_read_ack then
|
1282 |
|
|
|
1283 |
|
|
-- switch to idle state
|
1284 |
|
|
n_plb_rstate.state <= plb_ridle;
|
1285 |
|
|
|
1286 |
|
|
-- ack. the read transfer
|
1287 |
|
|
Sl_rdDAck_t <= '1';
|
1288 |
|
|
|
1289 |
|
|
|
1290 |
|
|
if c_plb_rstate.status_transfer = '0' then
|
1291 |
|
|
|
1292 |
|
|
-- read from the buffer
|
1293 |
|
|
TCU_rbufREn_t <= '1';
|
1294 |
|
|
|
1295 |
|
|
end if;
|
1296 |
|
|
|
1297 |
|
|
end if;
|
1298 |
|
|
|
1299 |
|
|
|
1300 |
|
|
|
1301 |
|
|
|
1302 |
|
|
if c_plb_rstate.state = plb_line_read then
|
1303 |
|
|
-- /----- We know, that the fifo contains min. 2 elements
|
1304 |
|
|
if ( c_plb_rstate.status_transfer = '1' or -- \/
|
1305 |
|
|
( c_plb_rstate.status_transfer = '0' and RBF_almostEmpty = '0' ) ) then
|
1306 |
|
|
|
1307 |
|
|
n_plb_rstate.transfer_count <= std_logic_vector( unsigned'( unsigned(c_plb_rstate.transfer_count) + 1 ) );
|
1308 |
|
|
|
1309 |
|
|
Sl_rdDAck_t <= '1';
|
1310 |
|
|
|
1311 |
|
|
if ( ( c_plb_rstate.transfer_size( 0 to 3 ) = "0001" and c_plb_rstate.transfer_count = "0010" ) or
|
1312 |
|
|
( c_plb_rstate.transfer_size( 0 to 3 ) = "0010" and c_plb_rstate.transfer_count = "0110" ) or
|
1313 |
|
|
( c_plb_rstate.transfer_size( 0 to 3 ) = "0011" and c_plb_rstate.transfer_count = "1110" ) ) then
|
1314 |
|
|
-- we are finished after the next clock cycle
|
1315 |
|
|
Sl_rdComp_t <= '1';
|
1316 |
|
|
n_plb_rstate.state <= plb_line_read_ack;
|
1317 |
|
|
end if;
|
1318 |
|
|
end if;
|
1319 |
|
|
|
1320 |
|
|
if ( c_plb_rstate.status_transfer = '0' and RBF_almostEmpty = '0' ) then
|
1321 |
|
|
TCU_rbufREn_t <= '1';
|
1322 |
|
|
end if;
|
1323 |
|
|
|
1324 |
|
|
end if;
|
1325 |
|
|
|
1326 |
|
|
|
1327 |
|
|
|
1328 |
|
|
|
1329 |
|
|
|
1330 |
|
|
|
1331 |
|
|
if c_plb_rstate.state = plb_burst_read then
|
1332 |
|
|
|
1333 |
|
|
|
1334 |
|
|
-- /----- We know, that the fifo contains min. 2 elements
|
1335 |
|
|
if ( c_plb_rstate.status_transfer = '1' or -- \/
|
1336 |
|
|
( c_plb_rstate.status_transfer = '0' and RBF_almostEmpty = '0' ) ) then
|
1337 |
|
|
|
1338 |
|
|
n_plb_rstate.transfer_count <= std_logic_vector( unsigned'( unsigned(c_plb_rstate.transfer_count) + 1 ) );
|
1339 |
|
|
|
1340 |
|
|
Sl_rdDAck_t <= '1';
|
1341 |
|
|
|
1342 |
|
|
if c_plb_rstate.transfer_count = std_logic_vector( unsigned'( unsigned ( c_plb_rstate.transfer_size ) -1 ) ) then
|
1343 |
|
|
|
1344 |
|
|
-- we are finished after the next clock cycle
|
1345 |
|
|
Sl_rdComp_t <= '1';
|
1346 |
|
|
Sl_rdBTerm <= '1';
|
1347 |
|
|
n_plb_rstate.state <= plb_burst_read_ack;
|
1348 |
|
|
end if;
|
1349 |
|
|
|
1350 |
|
|
|
1351 |
|
|
end if;
|
1352 |
|
|
|
1353 |
|
|
if ( c_plb_rstate.status_transfer = '0' and RBF_almostEmpty = '0' ) then
|
1354 |
|
|
TCU_rbufREn_t <= '1';
|
1355 |
|
|
end if;
|
1356 |
|
|
|
1357 |
|
|
end if;
|
1358 |
|
|
|
1359 |
|
|
|
1360 |
|
|
-- the wait cycles
|
1361 |
|
|
if c_plb_rstate.state = plb_wait_burst_read then
|
1362 |
|
|
n_plb_rstate.state <= plb_burst_read;
|
1363 |
|
|
end if;
|
1364 |
|
|
|
1365 |
|
|
if c_plb_rstate.state = plb_wait_line_read then
|
1366 |
|
|
n_plb_rstate.state <= plb_line_read;
|
1367 |
|
|
end if;
|
1368 |
|
|
|
1369 |
|
|
|
1370 |
|
|
|
1371 |
|
|
|
1372 |
|
|
if c_plb_rstate.state = plb_line_read_ack or
|
1373 |
|
|
c_plb_rstate.state = plb_burst_read_ack then
|
1374 |
|
|
|
1375 |
|
|
Sl_rdDAck_t <= '1';
|
1376 |
|
|
n_plb_rstate.state <= plb_ridle;
|
1377 |
|
|
|
1378 |
|
|
if c_plb_rstate.status_transfer = '0' then
|
1379 |
|
|
TCU_rbufREn_t <= '1';
|
1380 |
|
|
end if;
|
1381 |
|
|
|
1382 |
|
|
end if;
|
1383 |
|
|
|
1384 |
|
|
|
1385 |
|
|
if ( ( c_plb_rstate.state = plb_read
|
1386 |
|
|
or c_plb_rstate.state = plb_read_ack
|
1387 |
|
|
or c_plb_rstate.state = plb_line_read
|
1388 |
|
|
or c_plb_rstate.state = plb_line_read_ack
|
1389 |
|
|
or c_plb_rstate.state = plb_burst_read
|
1390 |
|
|
or c_plb_rstate.state = plb_burst_read_ack)
|
1391 |
|
|
and c_plb_rstate.status_transfer = '0' )
|
1392 |
|
|
then
|
1393 |
|
|
-- we enable the read bus on plb side
|
1394 |
|
|
TCU_enRdDBus <= '1';
|
1395 |
|
|
|
1396 |
|
|
elsif ( ( c_plb_rstate.state = plb_read
|
1397 |
|
|
or c_plb_rstate.state = plb_read_ack
|
1398 |
|
|
or c_plb_rstate.state = plb_line_read
|
1399 |
|
|
or c_plb_rstate.state = plb_line_read_ack
|
1400 |
|
|
or c_plb_rstate.state = plb_burst_read
|
1401 |
|
|
or c_plb_rstate.state = plb_burst_read_ack)
|
1402 |
|
|
and c_plb_rstate.status_transfer = '1' )
|
1403 |
|
|
then
|
1404 |
|
|
|
1405 |
|
|
TCU_enStuRdDBus <= '1';
|
1406 |
|
|
end if;
|
1407 |
|
|
|
1408 |
|
|
|
1409 |
|
|
|
1410 |
|
|
if c_plb_rstate.state = plb_read or
|
1411 |
|
|
c_plb_rstate.state = plb_read_ack or
|
1412 |
|
|
c_plb_rstate.state = plb_line_read or
|
1413 |
|
|
c_plb_rstate.state = plb_line_read_ack or
|
1414 |
|
|
c_plb_rstate.state = plb_burst_read or
|
1415 |
|
|
c_plb_rstate.state = plb_burst_read_ack or
|
1416 |
|
|
c_plb_rstate.state = plb_wait_line_read or
|
1417 |
|
|
c_plb_rstate.state = plb_wait_burst_read
|
1418 |
|
|
then
|
1419 |
|
|
mbusy_read_out( to_integer( unsigned'( unsigned( c_plb_rstate.r_master_id ) ) ) ) <= '1';
|
1420 |
|
|
end if;
|
1421 |
|
|
|
1422 |
|
|
|
1423 |
|
|
if c_plb_rstate.r_secondary = '1' then
|
1424 |
|
|
mbusy_read_out( to_integer( unsigned'( unsigned( AMU_pipe_rmID ) ) ) ) <= '1';
|
1425 |
|
|
end if;
|
1426 |
|
|
|
1427 |
|
|
|
1428 |
|
|
if c_plb_rstate.state = plb_line_read or
|
1429 |
|
|
c_plb_rstate.state = plb_line_read_ack or
|
1430 |
|
|
c_plb_rstate.state = plb_burst_read or
|
1431 |
|
|
c_plb_rstate.state = plb_burst_read_ack
|
1432 |
|
|
then
|
1433 |
|
|
Sl_rdWdAddr <= c_plb_rstate.transfer_count;
|
1434 |
|
|
end if;
|
1435 |
|
|
|
1436 |
|
|
|
1437 |
|
|
|
1438 |
|
|
end process;
|
1439 |
|
|
|
1440 |
|
|
TCU_MRBusy <= mbusy_read_out or mbusy_write_out;
|
1441 |
|
|
|
1442 |
|
|
Sl_MRdErr <= mbusy_read_out when Sl_rdDAck_t = '1' and RBF_rdErrOut = '1' else
|
1443 |
|
|
( others => '0' );
|
1444 |
|
|
|
1445 |
|
|
|
1446 |
|
|
|
1447 |
|
|
|
1448 |
|
|
|
1449 |
|
|
-- ====================================================================================================|
|
1450 |
|
|
-- |
|
1451 |
|
|
-- ========================= W I S H B O N E -- S I D E =========================================|
|
1452 |
|
|
-- |
|
1453 |
|
|
-- ====================================================================================================|
|
1454 |
|
|
|
1455 |
|
|
|
1456 |
|
|
|
1457 |
|
|
|
1458 |
|
|
|
1459 |
|
|
|
1460 |
|
|
-------
|
1461 |
|
|
-- WB-timeout counter
|
1462 |
|
|
-- -> counts from WB_TOUT_MIN_VALUE to WB_TOUT_MAX_VALUE
|
1463 |
|
|
-- -> is reseted by driving wb_tout_reset high
|
1464 |
|
|
-- -> if counter reaches WB_TOUT_MAX_VALUE, wb_tout_alarm becomes '1'
|
1465 |
|
|
--
|
1466 |
|
|
wb_tout_process : process( wb_clk_i, plb2wb_rst, wb_tout_counter, wb_tout_reset )
|
1467 |
|
|
begin
|
1468 |
|
|
wb_tout_alarm <= '0';
|
1469 |
|
|
|
1470 |
|
|
if plb2wb_rst = '1' or wb_tout_reset = '1' then
|
1471 |
|
|
wb_tout_counter <= WB_TOUT_MIN_VALUE;
|
1472 |
|
|
elsif wb_clk_i'event and wb_clk_i = '1' then
|
1473 |
|
|
if ( wb_tout_count = '1' and wb_tout_counter /= WB_TOUT_MAX_VALUE ) then
|
1474 |
|
|
wb_tout_counter <= wb_tout_counter + 1;
|
1475 |
|
|
end if;
|
1476 |
|
|
end if;
|
1477 |
|
|
if wb_tout_counter = WB_TOUT_MAX_VALUE then
|
1478 |
|
|
wb_tout_alarm <= '1';
|
1479 |
|
|
end if;
|
1480 |
|
|
end process;
|
1481 |
|
|
--
|
1482 |
|
|
-----
|
1483 |
|
|
|
1484 |
|
|
|
1485 |
|
|
|
1486 |
|
|
|
1487 |
|
|
|
1488 |
|
|
|
1489 |
|
|
|
1490 |
|
|
|
1491 |
|
|
c_wb_state_p : process( wb_clk_i, plb2wb_rst ) begin
|
1492 |
|
|
if plb2wb_rst='1' then
|
1493 |
|
|
c_wb_state.state <= wb_idle;
|
1494 |
|
|
c_wb_state.transfer_count <= ( others => '0' );
|
1495 |
|
|
elsif wb_clk_i'event and wb_clk_i='1' then
|
1496 |
|
|
c_wb_state <= n_wb_state;
|
1497 |
|
|
|
1498 |
|
|
end if;
|
1499 |
|
|
end process;
|
1500 |
|
|
|
1501 |
|
|
|
1502 |
|
|
|
1503 |
|
|
--
|
1504 |
|
|
-- Note: we have fall-through fifo's, so the address is assigned when AMU_bufEmpty becomes '0'
|
1505 |
|
|
--
|
1506 |
|
|
start_wb_w <= '1' when ( c_wb_state.state = wb_idle and AMU_buf_RNW = '0' and AMU_bufEmpty = '0' and WBF_empty = '0' ) else
|
1507 |
|
|
'0';
|
1508 |
|
|
start_wb_r <= '1' when ( c_wb_state.state = wb_idle and AMU_buf_RNW = '1' and RBF_full = '0' and AMU_bufEmpty = '0' ) else
|
1509 |
|
|
'0';
|
1510 |
|
|
|
1511 |
|
|
|
1512 |
|
|
wb_ack <= wb_ack_i and not wb_err_i and not wb_rty_i;
|
1513 |
|
|
wb_rty <= wb_rty_i and not wb_err_i;
|
1514 |
|
|
wb_err <= wb_err_i;
|
1515 |
|
|
|
1516 |
|
|
|
1517 |
|
|
|
1518 |
|
|
n_wb_state_p : process( c_wb_state, AMU_buf_size,
|
1519 |
|
|
AMU_buf_BE, WBF_empty,
|
1520 |
|
|
start_wb_w, start_wb_r, wb_ack, wb_rty, wb_err, wb_tout_alarm,
|
1521 |
|
|
STU_continue, STU_abort, wb_rst_short,pic_int_ahigh_short ) begin
|
1522 |
|
|
|
1523 |
|
|
wb_we_o <= '0';
|
1524 |
|
|
wb_stb_o <= '0';
|
1525 |
|
|
wb_cyc_o <= '0';
|
1526 |
|
|
wb_lock_o <= '0';
|
1527 |
|
|
|
1528 |
|
|
TCU_wbufREn_t <= '0';
|
1529 |
|
|
TCU_rbufWEn_t <= '0';
|
1530 |
|
|
TCU_adrBufREn <= '0';
|
1531 |
|
|
TCU_wb_status_info <= ( others => '0' );
|
1532 |
|
|
TCU_stat2plb_en <= '0';
|
1533 |
|
|
|
1534 |
|
|
|
1535 |
|
|
wb_tout_count <= '0';
|
1536 |
|
|
wb_tout_reset <= '0';
|
1537 |
|
|
|
1538 |
|
|
n_wb_state <= c_wb_state;
|
1539 |
|
|
|
1540 |
|
|
if start_wb_w = '1' then
|
1541 |
|
|
|
1542 |
|
|
wb_stb_o <= '1';
|
1543 |
|
|
wb_cyc_o <= '1';
|
1544 |
|
|
wb_we_o <= '1';
|
1545 |
|
|
n_wb_state.abort <= '0';
|
1546 |
|
|
wb_tout_reset <= '1';
|
1547 |
|
|
|
1548 |
|
|
if wb_ack = '1' then
|
1549 |
|
|
TCU_wbufREn_t <= '1';
|
1550 |
|
|
|
1551 |
|
|
if AMU_buf_size /= "0000" then
|
1552 |
|
|
-- this is a line or burst transfer
|
1553 |
|
|
n_wb_state.state <= wb_write;
|
1554 |
|
|
n_wb_state.transfer_count <= "0001";
|
1555 |
|
|
else
|
1556 |
|
|
-- this is a single transfer:
|
1557 |
|
|
-- we read from the address buffer,
|
1558 |
|
|
-- because this transfer is complete
|
1559 |
|
|
|
1560 |
|
|
TCU_adrBufREn <= '1';
|
1561 |
|
|
|
1562 |
|
|
end if;
|
1563 |
|
|
|
1564 |
|
|
elsif wb_err = '1' then
|
1565 |
|
|
-- add error info to the status pipe
|
1566 |
|
|
-- and switch to the stall state
|
1567 |
|
|
n_wb_state.state <= wb_write_stall;
|
1568 |
|
|
TCU_wb_status_info( STATUS2PLB_W_ERR ) <= '1';
|
1569 |
|
|
TCU_stat2plb_en <= '1';
|
1570 |
|
|
elsif wb_rty = '1' then
|
1571 |
|
|
-- retry this transfer
|
1572 |
|
|
n_wb_state.state <= wb_write_rty;
|
1573 |
|
|
else
|
1574 |
|
|
n_wb_state.state <= wb_write;
|
1575 |
|
|
end if;
|
1576 |
|
|
|
1577 |
|
|
end if;
|
1578 |
|
|
|
1579 |
|
|
|
1580 |
|
|
|
1581 |
|
|
|
1582 |
|
|
|
1583 |
|
|
if start_wb_r = '1' then
|
1584 |
|
|
|
1585 |
|
|
|
1586 |
|
|
wb_stb_o <= '1';
|
1587 |
|
|
wb_cyc_o <= '1';
|
1588 |
|
|
wb_we_o <= '0';
|
1589 |
|
|
n_wb_state.abort <= '0';
|
1590 |
|
|
wb_tout_reset <= '1';
|
1591 |
|
|
|
1592 |
|
|
|
1593 |
|
|
if wb_ack = '1' or wb_err = '1' then
|
1594 |
|
|
TCU_rbufWEn_t <= '1';
|
1595 |
|
|
|
1596 |
|
|
if AMU_buf_size /= "0000" then
|
1597 |
|
|
-- this is a line or burst transfer
|
1598 |
|
|
|
1599 |
|
|
n_wb_state.state <= wb_read;
|
1600 |
|
|
n_wb_state.transfer_count <= "0001";
|
1601 |
|
|
else
|
1602 |
|
|
-- this is a single transfer:
|
1603 |
|
|
-- we read from the address buffer,
|
1604 |
|
|
-- because this transfer is complete
|
1605 |
|
|
|
1606 |
|
|
|
1607 |
|
|
TCU_adrBufREn <= '1';
|
1608 |
|
|
end if;
|
1609 |
|
|
|
1610 |
|
|
elsif wb_rty = '1' then
|
1611 |
|
|
n_wb_state.state <= wb_read_rty;
|
1612 |
|
|
else
|
1613 |
|
|
n_wb_state.state <= wb_read;
|
1614 |
|
|
end if;
|
1615 |
|
|
|
1616 |
|
|
end if;
|
1617 |
|
|
|
1618 |
|
|
|
1619 |
|
|
|
1620 |
|
|
--
|
1621 |
|
|
-- write-transfer without writing
|
1622 |
|
|
-- -->> we have to empty the write-pipe
|
1623 |
|
|
if c_wb_state.state = wb_write and WBF_empty ='0' and c_wb_state.abort = '1' then
|
1624 |
|
|
|
1625 |
|
|
TCU_wbufREn_t <= '1';
|
1626 |
|
|
|
1627 |
|
|
if AMU_buf_size = "0000" then
|
1628 |
|
|
-- single write transfer
|
1629 |
|
|
|
1630 |
|
|
n_wb_state.state <= wb_idle;
|
1631 |
|
|
TCU_adrBufREn <= '1';
|
1632 |
|
|
|
1633 |
|
|
elsif AMU_buf_size( 3 downto 2 ) = "00" then
|
1634 |
|
|
-- write line transfer
|
1635 |
|
|
|
1636 |
|
|
if ( ( AMU_buf_size( 1 downto 0 ) = "01" and c_wb_state.transfer_count = "0011" ) or
|
1637 |
|
|
( AMU_buf_size( 1 downto 0 ) = "10" and c_wb_state.transfer_count = "0111" ) or
|
1638 |
|
|
( AMU_buf_size( 1 downto 0 ) = "11" and c_wb_state.transfer_count = "1111" ) ) then
|
1639 |
|
|
-- we are at the end of this transfer
|
1640 |
|
|
|
1641 |
|
|
n_wb_state.transfer_count <= ( others => '0' );
|
1642 |
|
|
n_wb_state.state <= wb_idle;
|
1643 |
|
|
TCU_adrBufREn <= '1';
|
1644 |
|
|
|
1645 |
|
|
else
|
1646 |
|
|
n_wb_state.transfer_count <= std_logic_vector( unsigned'( unsigned(c_wb_state.transfer_count) +1 ) );
|
1647 |
|
|
end if;
|
1648 |
|
|
|
1649 |
|
|
else
|
1650 |
|
|
-- write burst transfer
|
1651 |
|
|
|
1652 |
|
|
if c_wb_state.transfer_count = AMU_buf_BE then
|
1653 |
|
|
-- we are at the end of this transfer
|
1654 |
|
|
|
1655 |
|
|
n_wb_state.transfer_count <= ( others => '0' );
|
1656 |
|
|
n_wb_state.state <= wb_idle;
|
1657 |
|
|
TCU_adrBufREn <= '1';
|
1658 |
|
|
|
1659 |
|
|
else
|
1660 |
|
|
n_wb_state.transfer_count <= std_logic_vector( unsigned'( unsigned(c_wb_state.transfer_count) +1 ) );
|
1661 |
|
|
end if;
|
1662 |
|
|
|
1663 |
|
|
end if;
|
1664 |
|
|
|
1665 |
|
|
|
1666 |
|
|
|
1667 |
|
|
elsif c_wb_state.state = wb_write and WBF_empty ='0' and c_wb_state.abort = '0' then
|
1668 |
|
|
|
1669 |
|
|
wb_stb_o <= '1';
|
1670 |
|
|
wb_cyc_o <= '1';
|
1671 |
|
|
wb_we_o <= '1';
|
1672 |
|
|
wb_tout_count <= '1';
|
1673 |
|
|
|
1674 |
|
|
|
1675 |
|
|
if wb_ack = '1' then
|
1676 |
|
|
|
1677 |
|
|
TCU_wbufREn_t <= '1';
|
1678 |
|
|
wb_tout_reset <= '1';
|
1679 |
|
|
|
1680 |
|
|
if AMU_buf_size = "0000" then
|
1681 |
|
|
-- single write transfer
|
1682 |
|
|
|
1683 |
|
|
n_wb_state.state <= wb_idle;
|
1684 |
|
|
TCU_adrBufREn <= '1';
|
1685 |
|
|
|
1686 |
|
|
elsif AMU_buf_size( 3 downto 2 ) = "00" then
|
1687 |
|
|
-- write line transfer
|
1688 |
|
|
|
1689 |
|
|
if ( ( AMU_buf_size( 1 downto 0 ) = "01" and c_wb_state.transfer_count = "0011" ) or
|
1690 |
|
|
( AMU_buf_size( 1 downto 0 ) = "10" and c_wb_state.transfer_count = "0111" ) or
|
1691 |
|
|
( AMU_buf_size( 1 downto 0 ) = "11" and c_wb_state.transfer_count = "1111" ) ) then
|
1692 |
|
|
-- we are at the end of this transfer
|
1693 |
|
|
|
1694 |
|
|
n_wb_state.transfer_count <= ( others => '0' );
|
1695 |
|
|
n_wb_state.state <= wb_idle;
|
1696 |
|
|
TCU_adrBufREn <= '1';
|
1697 |
|
|
|
1698 |
|
|
else
|
1699 |
|
|
n_wb_state.transfer_count <= std_logic_vector( unsigned'( unsigned(c_wb_state.transfer_count) +1 ) );
|
1700 |
|
|
end if;
|
1701 |
|
|
|
1702 |
|
|
else
|
1703 |
|
|
-- write burst transfer
|
1704 |
|
|
|
1705 |
|
|
if c_wb_state.transfer_count = AMU_buf_BE then
|
1706 |
|
|
-- we are at the end of this transfer
|
1707 |
|
|
|
1708 |
|
|
n_wb_state.transfer_count <= ( others => '0' );
|
1709 |
|
|
n_wb_state.state <= wb_idle;
|
1710 |
|
|
TCU_adrBufREn <= '1';
|
1711 |
|
|
|
1712 |
|
|
else
|
1713 |
|
|
n_wb_state.transfer_count <= std_logic_vector( unsigned'( unsigned(c_wb_state.transfer_count) +1 ) );
|
1714 |
|
|
end if;
|
1715 |
|
|
|
1716 |
|
|
end if;
|
1717 |
|
|
|
1718 |
|
|
elsif wb_err = '1' then
|
1719 |
|
|
-- add error info to the status pipe
|
1720 |
|
|
-- and switch to the stall state
|
1721 |
|
|
n_wb_state.state <= wb_write_stall;
|
1722 |
|
|
TCU_wb_status_info( STATUS2PLB_W_ERR ) <= '1';
|
1723 |
|
|
TCU_stat2plb_en <= '1';
|
1724 |
|
|
wb_tout_reset <= '1';
|
1725 |
|
|
elsif wb_rty = '1' then
|
1726 |
|
|
n_wb_state.state <= wb_write_rty;
|
1727 |
|
|
wb_tout_reset <= '1';
|
1728 |
|
|
elsif wb_tout_alarm = '1' then
|
1729 |
|
|
n_wb_state.state <= wb_write_stall;
|
1730 |
|
|
TCU_wb_status_info( STATUS2PLB_W_ERR ) <= '1';
|
1731 |
|
|
TCU_stat2plb_en <= '1';
|
1732 |
|
|
end if;
|
1733 |
|
|
|
1734 |
|
|
end if;
|
1735 |
|
|
|
1736 |
|
|
--
|
1737 |
|
|
-- The WB-spec says, that wb_rty_i terminates a cycle, so wb_stb_o and wb_cyc_o is '0'
|
1738 |
|
|
--
|
1739 |
|
|
if c_wb_state.state = wb_write_rty then
|
1740 |
|
|
n_wb_state.state <= wb_write;
|
1741 |
|
|
end if;
|
1742 |
|
|
|
1743 |
|
|
|
1744 |
|
|
|
1745 |
|
|
|
1746 |
|
|
if c_wb_state.state = wb_read then
|
1747 |
|
|
|
1748 |
|
|
wb_stb_o <= '1';
|
1749 |
|
|
wb_cyc_o <= '1';
|
1750 |
|
|
wb_we_o <= '0';
|
1751 |
|
|
wb_tout_count <= '1';
|
1752 |
|
|
|
1753 |
|
|
|
1754 |
|
|
if wb_ack = '1' or wb_err = '1' then
|
1755 |
|
|
|
1756 |
|
|
wb_tout_reset <= '1';
|
1757 |
|
|
|
1758 |
|
|
TCU_rbufWEn_t <= '1';
|
1759 |
|
|
|
1760 |
|
|
if AMU_buf_size = "0000" then
|
1761 |
|
|
-- single read transfer
|
1762 |
|
|
|
1763 |
|
|
n_wb_state.state <= wb_idle;
|
1764 |
|
|
TCU_adrBufREn <= '1';
|
1765 |
|
|
|
1766 |
|
|
elsif AMU_buf_size( 3 downto 2 ) = "00" then
|
1767 |
|
|
-- read line transfer
|
1768 |
|
|
|
1769 |
|
|
if ( ( AMU_buf_size( 1 downto 0 ) = "01" and c_wb_state.transfer_count = "0011" ) or
|
1770 |
|
|
( AMU_buf_size( 1 downto 0 ) = "10" and c_wb_state.transfer_count = "0111" ) or
|
1771 |
|
|
( AMU_buf_size( 1 downto 0 ) = "11" and c_wb_state.transfer_count = "1111" ) ) then
|
1772 |
|
|
|
1773 |
|
|
n_wb_state.transfer_count <= ( others => '0' );
|
1774 |
|
|
n_wb_state.state <= wb_idle;
|
1775 |
|
|
TCU_adrBufREn <= '1';
|
1776 |
|
|
|
1777 |
|
|
else
|
1778 |
|
|
|
1779 |
|
|
n_wb_state.transfer_count <= std_logic_vector( unsigned'( unsigned(c_wb_state.transfer_count) +1 ) );
|
1780 |
|
|
|
1781 |
|
|
end if;
|
1782 |
|
|
|
1783 |
|
|
|
1784 |
|
|
else
|
1785 |
|
|
-- burst read transfer
|
1786 |
|
|
|
1787 |
|
|
if c_wb_state.transfer_count = AMU_buf_BE then
|
1788 |
|
|
n_wb_state.transfer_count <= ( others => '0' );
|
1789 |
|
|
n_wb_state.state <= wb_idle;
|
1790 |
|
|
TCU_adrBufREn <= '1';
|
1791 |
|
|
-- add info to the status fifo
|
1792 |
|
|
else
|
1793 |
|
|
n_wb_state.transfer_count <= std_logic_vector( unsigned'( unsigned(c_wb_state.transfer_count) +1 ) );
|
1794 |
|
|
end if;
|
1795 |
|
|
|
1796 |
|
|
end if;
|
1797 |
|
|
|
1798 |
|
|
elsif wb_rty = '1' then
|
1799 |
|
|
n_wb_state.state <= wb_read_rty;
|
1800 |
|
|
wb_tout_reset <= '1';
|
1801 |
|
|
|
1802 |
|
|
|
1803 |
|
|
-----
|
1804 |
|
|
-- NOTE: This must be done after all other if-cases (ack, err, rty)
|
1805 |
|
|
-- doing this together with ack and err, it results into a wrong behavior,
|
1806 |
|
|
-- because the slave gives us a retry in the last timeout cycle
|
1807 |
|
|
--
|
1808 |
|
|
-- we are still waiting for an reaction of the slave ...
|
1809 |
|
|
-- we abort this cycle (we need to drive cyc and stb low)
|
1810 |
|
|
-- and continue with the next datum (if its a burst or line transfer)
|
1811 |
|
|
--
|
1812 |
|
|
elsif wb_tout_alarm = '1' then
|
1813 |
|
|
|
1814 |
|
|
n_wb_state.state <= wb_read_rty;
|
1815 |
|
|
TCU_rbufWEn_t <= '1';
|
1816 |
|
|
|
1817 |
|
|
if AMU_buf_size = "0000" then
|
1818 |
|
|
-- single read transfer
|
1819 |
|
|
|
1820 |
|
|
n_wb_state.state <= wb_idle;
|
1821 |
|
|
TCU_adrBufREn <= '1';
|
1822 |
|
|
|
1823 |
|
|
elsif AMU_buf_size( 3 downto 2 ) = "00" then
|
1824 |
|
|
-- read line transfer
|
1825 |
|
|
|
1826 |
|
|
if ( ( AMU_buf_size( 1 downto 0 ) = "01" and c_wb_state.transfer_count = "0011" ) or
|
1827 |
|
|
( AMU_buf_size( 1 downto 0 ) = "10" and c_wb_state.transfer_count = "0111" ) or
|
1828 |
|
|
( AMU_buf_size( 1 downto 0 ) = "11" and c_wb_state.transfer_count = "1111" ) ) then
|
1829 |
|
|
|
1830 |
|
|
n_wb_state.transfer_count <= ( others => '0' );
|
1831 |
|
|
n_wb_state.state <= wb_idle;
|
1832 |
|
|
TCU_adrBufREn <= '1';
|
1833 |
|
|
|
1834 |
|
|
else
|
1835 |
|
|
-- we use the retry state to drive stb and cyc low
|
1836 |
|
|
n_wb_state.state <= wb_read_rty;
|
1837 |
|
|
n_wb_state.transfer_count <= std_logic_vector( unsigned'( unsigned(c_wb_state.transfer_count) +1 ) );
|
1838 |
|
|
end if;
|
1839 |
|
|
|
1840 |
|
|
else
|
1841 |
|
|
-- burst read transfer
|
1842 |
|
|
|
1843 |
|
|
if c_wb_state.transfer_count = AMU_buf_BE then
|
1844 |
|
|
n_wb_state.transfer_count <= ( others => '0' );
|
1845 |
|
|
n_wb_state.state <= wb_idle;
|
1846 |
|
|
TCU_adrBufREn <= '1';
|
1847 |
|
|
-- add info to the status fifo
|
1848 |
|
|
else
|
1849 |
|
|
-- we use the retry state to drive stb and cyc low
|
1850 |
|
|
n_wb_state.state <= wb_read_rty;
|
1851 |
|
|
n_wb_state.transfer_count <= std_logic_vector( unsigned'( unsigned(c_wb_state.transfer_count) +1 ) );
|
1852 |
|
|
end if;
|
1853 |
|
|
|
1854 |
|
|
end if;
|
1855 |
|
|
|
1856 |
|
|
end if;
|
1857 |
|
|
|
1858 |
|
|
end if;
|
1859 |
|
|
|
1860 |
|
|
|
1861 |
|
|
|
1862 |
|
|
|
1863 |
|
|
--
|
1864 |
|
|
-- The generation of the lock-signal. If we are in a transfer (or starting a transfer), which is on
|
1865 |
|
|
-- the plb-size a line or burst transfer and if block transfers are supported, we lock the bus (block transfer)
|
1866 |
|
|
--
|
1867 |
|
|
--
|
1868 |
|
|
if ( ( c_wb_state.state = wb_read or
|
1869 |
|
|
c_wb_state.state = wb_write or
|
1870 |
|
|
c_wb_state.state = wb_read_rty or
|
1871 |
|
|
c_wb_state.state = wb_write_rty or
|
1872 |
|
|
start_wb_w = '1' or
|
1873 |
|
|
start_wb_r = '1' ) and AMU_buf_size /= "0000" and WB_SUPPORT_BLOCK > 0 ) then
|
1874 |
|
|
wb_lock_o <= '1';
|
1875 |
|
|
end if;
|
1876 |
|
|
|
1877 |
|
|
|
1878 |
|
|
|
1879 |
|
|
--
|
1880 |
|
|
-- The WB-spec says, that wb_rty_i terminates a cycle, so wb_stb_o and wb_cyc_o is '0'
|
1881 |
|
|
--
|
1882 |
|
|
if c_wb_state.state = wb_read_rty then
|
1883 |
|
|
n_wb_state.state <= wb_read;
|
1884 |
|
|
wb_tout_reset <= '1';
|
1885 |
|
|
end if;
|
1886 |
|
|
|
1887 |
|
|
|
1888 |
|
|
|
1889 |
|
|
if ( c_wb_state.state = wb_write_stall and ( STU_continue = '1' or STU_abort = '1' ) )then
|
1890 |
|
|
if STU_abort = '1' then
|
1891 |
|
|
n_wb_state.abort <= '1';
|
1892 |
|
|
end if;
|
1893 |
|
|
n_wb_state.state <= wb_write;
|
1894 |
|
|
wb_tout_reset <= '1';
|
1895 |
|
|
end if;
|
1896 |
|
|
|
1897 |
|
|
|
1898 |
|
|
|
1899 |
|
|
if wb_rst_short = '1' then
|
1900 |
|
|
TCU_wb_status_info( STATUS2PLB_RST ) <= '1';
|
1901 |
|
|
TCU_stat2plb_en <= '1';
|
1902 |
|
|
end if;
|
1903 |
|
|
|
1904 |
|
|
|
1905 |
|
|
|
1906 |
|
|
for i in 0 to WB_PIC_INTS-1 loop
|
1907 |
|
|
|
1908 |
|
|
if pic_int_ahigh_short( i ) = '1' then
|
1909 |
|
|
TCU_stat2plb_en <= '1';
|
1910 |
|
|
TCU_wb_status_info( STATUS2PLB_IRQ ) <= '1';
|
1911 |
|
|
end if;
|
1912 |
|
|
|
1913 |
|
|
end loop;
|
1914 |
|
|
|
1915 |
|
|
TCU_wb_irq_info <= ( others => '0' );
|
1916 |
|
|
TCU_wb_irq_info( IRQ_INFO_SIZE-1 downto IRQ_INFO_SIZE-WB_PIC_INTS ) <= pic_int_ahigh_short;
|
1917 |
|
|
|
1918 |
|
|
|
1919 |
|
|
end process;
|
1920 |
|
|
|
1921 |
|
|
|
1922 |
|
|
TCU_adr_offset <= c_wb_state.transfer_count;
|
1923 |
|
|
|
1924 |
|
|
-- We drive this signal high, if
|
1925 |
|
|
-- -> there is a wb-error
|
1926 |
|
|
-- -> there is a timeout and if we are not getting any response in this clock cycle
|
1927 |
|
|
RBF_rdErrIn <= '1' when ( wb_err_i = '1'
|
1928 |
|
|
or ( wb_tout_alarm = '1' and wb_rty_i = '0' and wb_ack_i = '0' ) )
|
1929 |
|
|
else '0';
|
1930 |
|
|
|
1931 |
|
|
end architecture IMP;
|