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 |
|
|
|
51 |
|
|
library plb2wb_bridge_v1_00_a;
|
52 |
|
|
|
53 |
|
|
entity plb2wb_amu is
|
54 |
|
|
generic(
|
55 |
|
|
SYNCHRONY : boolean := true;
|
56 |
|
|
PIPELINE_DEPTH : integer := 2;
|
57 |
|
|
|
58 |
|
|
WB_DWIDTH : integer := 4;
|
59 |
|
|
WB_AWIDTH : integer := 32;
|
60 |
|
|
WB_ADR_OFFSET : std_logic_vector := X"00000000";
|
61 |
|
|
WB_ADR_OFFSET_NEG : std_logic := '0';
|
62 |
|
|
|
63 |
|
|
C_BASEADDR : std_logic_vector := X"FFFFFFFF";
|
64 |
|
|
C_HIGHADDR : std_logic_vector := X"00000000";
|
65 |
|
|
C_STATUS_BASEADDR : std_logic_vector := X"FFFFFFFF";
|
66 |
|
|
C_STATUS_HIGHADDR : std_logic_vector := X"00000000";
|
67 |
|
|
C_SPLB_AWIDTH : integer := 32;
|
68 |
|
|
C_SPLB_SIZE_WIDTH : integer := 4;
|
69 |
|
|
C_SPLB_TYPE_WIDTH : integer := 4;
|
70 |
|
|
C_SPLB_BE_WIDTH : integer := 4;
|
71 |
|
|
C_SPLB_NATIVE_BE_WIDTH : integer := 4;
|
72 |
|
|
C_SPLB_MID_WIDTH : integer := 0;
|
73 |
|
|
C_SPLB_SUPPORT_BUR_LINE : integer := 1;
|
74 |
|
|
C_SPLB_SUPPORT_ADR_PIPE : integer := 1
|
75 |
|
|
|
76 |
|
|
);
|
77 |
|
|
port(
|
78 |
|
|
wb_clk_i : in std_logic;
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
-- PLB Signals --
|
82 |
|
|
SPLB_Clk : in std_logic;
|
83 |
|
|
plb2wb_rst : in std_logic;
|
84 |
|
|
PLB_SAValid : in std_logic;
|
85 |
|
|
PLB_RNW : in std_logic;
|
86 |
|
|
PLB_ABus : in std_logic_vector( 0 to C_SPLB_AWIDTH -1 );
|
87 |
|
|
PLB_UABus : in std_logic_vector( 0 to C_SPLB_AWIDTH -1 );
|
88 |
|
|
PLB_size : in std_logic_vector( 0 to C_SPLB_SIZE_WIDTH -1 );
|
89 |
|
|
PLB_type : in std_logic_vector( 0 to C_SPLB_TYPE_WIDTH -1 );
|
90 |
|
|
PLB_BE : in std_logic_vector( 0 to C_SPLB_BE_WIDTH -1 );
|
91 |
|
|
PLB_masterID : in std_logic_vector( 0 to C_SPLB_MID_WIDTH -1 );
|
92 |
|
|
|
93 |
|
|
|
94 |
|
|
TCU_adrBufWEn : in std_logic;
|
95 |
|
|
TCU_adrBufREn : in std_logic;
|
96 |
|
|
TCU_rpipeRdEn : in std_logic;
|
97 |
|
|
TCU_wpipeRdEn : in std_logic;
|
98 |
|
|
TCU_stuWriteSA : in std_logic;
|
99 |
|
|
|
100 |
|
|
-- Internal signals
|
101 |
|
|
AMU_deviceSelect : out std_logic;
|
102 |
|
|
AMU_statusSelect : out std_logic;
|
103 |
|
|
AMU_addrAck : OUT std_logic;
|
104 |
|
|
|
105 |
|
|
AMU_bufEmpty : out std_logic;
|
106 |
|
|
AMU_bufFull : out std_logic;
|
107 |
|
|
AMU_buf_RNW : out std_logic;
|
108 |
|
|
AMU_buf_size : out std_logic_vector( C_SPLB_SIZE_WIDTH -1 downto 0 );
|
109 |
|
|
AMU_buf_BE : out std_logic_vector( C_SPLB_NATIVE_BE_WIDTH -1 downto 0 );
|
110 |
|
|
AMU_buf_adr : out std_logic_vector( WB_AWIDTH -1 downto 0 );
|
111 |
|
|
AMU_buf_adr_wo : out std_logic_vector( WB_AWIDTH -1 downto 0 ); -- address without offset
|
112 |
|
|
AMU_buf_masterID : out std_logic_vector( 0 to C_SPLB_MID_WIDTH -1 );
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
AMU_pipe_rmID : out std_logic_vector( 0 to C_SPLB_MID_WIDTH -1 );
|
116 |
|
|
AMU_pipe_wmID : out std_logic_vector( 0 to C_SPLB_MID_WIDTH -1 );
|
117 |
|
|
AMU_pipe_size : out std_logic_vector( 0 to C_SPLB_SIZE_WIDTH -1 );
|
118 |
|
|
AMU_pipe_BE : out std_logic_vector( 0 to C_SPLB_NATIVE_BE_WIDTH -1 );
|
119 |
|
|
AMU_pipe_adr : out std_logic_vector( 0 to C_SPLB_AWIDTH -1 );
|
120 |
|
|
AMU_pipe_rStatusSelect : out std_logic;
|
121 |
|
|
AMU_pipe_wStatusSelect : out std_logic;
|
122 |
|
|
|
123 |
|
|
wb_sel_o : out std_logic_vector( WB_DWIDTH/8-1 downto 0 )
|
124 |
|
|
|
125 |
|
|
);
|
126 |
|
|
end plb2wb_amu;
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
architecture IMP of plb2wb_amu is
|
130 |
|
|
|
131 |
|
|
-- TODO: muss master ID durch pipe und buffer??
|
132 |
|
|
-- TODO: remove PLB_type und chkecke PLB_type auf "000" und "110"
|
133 |
|
|
-- TODO: nur ein comperator fuer status_select -->> info durch pipe!
|
134 |
|
|
|
135 |
|
|
|
136 |
|
|
------------------------------------------------------|
|
137 |
|
|
-- |
|
138 |
|
|
--
|
139 |
|
|
-- Pipelined data types and convertion functions
|
140 |
|
|
--
|
141 |
|
|
type pipeline_data_type is record
|
142 |
|
|
PLB_Abus : std_logic_vector( 0 to C_SPLB_AWIDTH -1 );
|
143 |
|
|
PLB_size : std_logic_vector( 0 to C_SPLB_SIZE_WIDTH -1 );
|
144 |
|
|
PLB_BE : std_logic_vector( 0 to C_SPLB_NATIVE_BE_WIDTH-1 );
|
145 |
|
|
PLB_masterID : std_logic_vector( 0 to C_SPLB_MID_WIDTH -1 );
|
146 |
|
|
statusSelect : std_logic; -- we transfer the statusSelect through the pipe,
|
147 |
|
|
end record; -- so we don't need an additional comperator after the pipe
|
148 |
|
|
constant PIPELINE_DATA_WIDTH : integer := C_SPLB_AWIDTH + C_SPLB_SIZE_WIDTH + C_SPLB_NATIVE_BE_WIDTH + C_SPLB_MID_WIDTH + 1;
|
149 |
|
|
|
150 |
|
|
--
|
151 |
|
|
-- pipeline_data_type to std_logic_vector
|
152 |
|
|
function pdt_to_vector( data : pipeline_data_type ) return std_logic_vector is
|
153 |
|
|
begin
|
154 |
|
|
return data.PLB_Abus & data.PLB_size & data.PLB_BE & data.PLB_masterID & data.statusSelect;
|
155 |
|
|
end function pdt_to_vector;
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
|
160 |
|
|
constant PIPE_ABUS_START : integer := 0 ;
|
161 |
|
|
constant PIPE_SIZE_START : integer := C_SPLB_AWIDTH ;
|
162 |
|
|
constant PIPE_TYPE_START : integer := C_SPLB_AWIDTH + C_SPLB_SIZE_WIDTH ;
|
163 |
|
|
constant PIPE_BE_START : integer := C_SPLB_AWIDTH + C_SPLB_SIZE_WIDTH ;
|
164 |
|
|
constant PIPE_MASTERID_START : integer := C_SPLB_AWIDTH + C_SPLB_SIZE_WIDTH + C_SPLB_NATIVE_BE_WIDTH ;
|
165 |
|
|
|
166 |
|
|
constant PIPE_ABUS_END : integer := C_SPLB_AWIDTH -1 ;
|
167 |
|
|
constant PIPE_SIZE_END : integer := C_SPLB_AWIDTH + C_SPLB_SIZE_WIDTH -1 ;
|
168 |
|
|
constant PIPE_TYPE_END : integer := C_SPLB_AWIDTH + C_SPLB_SIZE_WIDTH -1 ;
|
169 |
|
|
constant PIPE_BE_END : integer := C_SPLB_AWIDTH + C_SPLB_SIZE_WIDTH + C_SPLB_NATIVE_BE_WIDTH -1 ;
|
170 |
|
|
constant PIPE_MASTERID_END : integer := PIPELINE_DATA_WIDTH-2 ;
|
171 |
|
|
|
172 |
|
|
constant PIPE_STATUS_SELECT : integer := PIPELINE_DATA_WIDTH-1;
|
173 |
|
|
|
174 |
|
|
procedure vector_to_pdt( signal vector : in std_logic_vector;
|
175 |
|
|
signal pdt : out pipeline_data_type ) is
|
176 |
|
|
begin
|
177 |
|
|
pdt.PLB_Abus <= vector( PIPE_ABUS_START to PIPE_ABUS_END );
|
178 |
|
|
pdt.PLB_size <= vector( PIPE_SIZE_START to PIPE_SIZE_END );
|
179 |
|
|
pdt.PLB_BE <= vector( PIPE_BE_START to PIPE_BE_END );
|
180 |
|
|
pdt.PLB_masterID <= vector( PIPE_MASTERID_START to PIPE_MASTERID_END );
|
181 |
|
|
pdt.statusSelect <= vector( PIPE_STATUS_SELECT );
|
182 |
|
|
end procedure vector_to_pdt;
|
183 |
|
|
|
184 |
|
|
|
185 |
|
|
--
|
186 |
|
|
-- clear pipeline_data_type
|
187 |
|
|
procedure pdt_clear( signal data : out pipeline_data_type ) is
|
188 |
|
|
begin
|
189 |
|
|
data.PLB_ABus <= ( others => '0' );
|
190 |
|
|
data.PLB_size <= ( others => '0' );
|
191 |
|
|
data.PLB_BE <= ( others => '0' );
|
192 |
|
|
data.PLB_masterID <= ( others => '0' );
|
193 |
|
|
data.statusSelect <= '0';
|
194 |
|
|
end procedure pdt_clear;
|
195 |
|
|
-- |
|
196 |
|
|
------------------------------------------------------|
|
197 |
|
|
|
198 |
|
|
|
199 |
|
|
|
200 |
|
|
constant ABUF_WIDTH : integer := C_SPLB_AWIDTH + C_SPLB_NATIVE_BE_WIDTH + C_SPLB_SIZE_WIDTH + C_SPLB_MID_WIDTH + 1;
|
201 |
|
|
|
202 |
|
|
|
203 |
|
|
------------------------------------------------------|
|
204 |
|
|
-- |
|
205 |
|
|
-- Pipeline-FIFO signals
|
206 |
|
|
--
|
207 |
|
|
signal pipeline_in : pipeline_data_type;
|
208 |
|
|
signal pipe_data_in : std_logic_vector( 0 to PIPELINE_DATA_WIDTH-1 );
|
209 |
|
|
|
210 |
|
|
signal rpipe_rd : std_logic;
|
211 |
|
|
signal rpipe_wr : std_logic;
|
212 |
|
|
signal rpipe_data_out : std_logic_vector( 0 to PIPELINE_DATA_WIDTH-1 );
|
213 |
|
|
signal rpipe_out : pipeline_data_type;
|
214 |
|
|
signal rpipe_empty : std_logic;
|
215 |
|
|
signal rpipe_full : std_logic;
|
216 |
|
|
--
|
217 |
|
|
signal wpipe_rd : std_logic;
|
218 |
|
|
signal wpipe_wr : std_logic;
|
219 |
|
|
signal wpipe_data_out : std_logic_vector( 0 to PIPELINE_DATA_WIDTH-1 );
|
220 |
|
|
signal wpipe_out : pipeline_data_type;
|
221 |
|
|
signal wpipe_empty : std_logic;
|
222 |
|
|
signal wpipe_full : std_logic;
|
223 |
|
|
|
224 |
|
|
signal en_rpipe_outputs : std_logic;
|
225 |
|
|
-- |
|
226 |
|
|
------------------------------------------------------|
|
227 |
|
|
|
228 |
|
|
|
229 |
|
|
|
230 |
|
|
|
231 |
|
|
------------------------------------------------------|
|
232 |
|
|
-- |
|
233 |
|
|
-- Buffer-FIFO signals
|
234 |
|
|
--
|
235 |
|
|
|
236 |
|
|
signal abuf_dout : std_logic_vector( 0 to ABUF_WIDTH -1 );
|
237 |
|
|
signal abuf_din : std_logic_vector( 0 to ABUF_WIDTH -1 );
|
238 |
|
|
signal abuf_wr_en : std_logic;
|
239 |
|
|
-- |
|
240 |
|
|
------------------------------------------------------|
|
241 |
|
|
|
242 |
|
|
|
243 |
|
|
signal BE_selected : std_logic_vector( 0 to C_SPLB_NATIVE_BE_WIDTH-1 );
|
244 |
|
|
|
245 |
|
|
|
246 |
|
|
signal AMU_deviceSelect_t : std_logic;
|
247 |
|
|
signal AMU_statusSelect_t : std_logic;
|
248 |
|
|
|
249 |
|
|
signal AMU_buf_size_t : std_logic_vector( C_SPLB_SIZE_WIDTH-1 downto 0 );
|
250 |
|
|
|
251 |
|
|
|
252 |
|
|
begin
|
253 |
|
|
|
254 |
|
|
|
255 |
|
|
|
256 |
|
|
-- We ack. the secondary address, if we write to the write-address-pipe or read-address-pipe
|
257 |
|
|
AMU_addrAck <= rpipe_wr or wpipe_wr;
|
258 |
|
|
|
259 |
|
|
|
260 |
|
|
-------------
|
261 |
|
|
--
|
262 |
|
|
-- Comperator: device_select is '1' if PLB_ABus selects this IP
|
263 |
|
|
--
|
264 |
|
|
AMU_deviceSelect_t <= '1' when ( PLB_ABus >= C_BASEADDR and PLB_ABus <= C_HIGHADDR ) else
|
265 |
|
|
'0';
|
266 |
|
|
|
267 |
|
|
AMU_statusSelect_t <= '1' when ( PLB_ABus >= C_STATUS_BASEADDR and PLB_ABus <= C_STATUS_HIGHADDR ) else
|
268 |
|
|
'0';
|
269 |
|
|
|
270 |
|
|
|
271 |
|
|
|
272 |
|
|
|
273 |
|
|
|
274 |
|
|
AMU_deviceSelect <= AMU_deviceSelect_t;
|
275 |
|
|
AMU_statusSelect <= AMU_statusSelect_t;
|
276 |
|
|
|
277 |
|
|
AMU_buf_size <= AMU_buf_size_t;
|
278 |
|
|
|
279 |
|
|
|
280 |
|
|
-----
|
281 |
|
|
-- The selection of the Byte-Enable signals, according to spec:5.6.x
|
282 |
|
|
--
|
283 |
|
|
besel_p : process( PLB_BE, PLB_ABus(28 to 29) ) begin
|
284 |
|
|
|
285 |
|
|
|
286 |
|
|
-- 128-bit bridge on 128-bit PLB (default)
|
287 |
|
|
BE_selected <= PLB_BE( 0 to C_SPLB_NATIVE_BE_WIDTH-1 );
|
288 |
|
|
|
289 |
|
|
-- 32-bit bridge on 128-bit PLB
|
290 |
|
|
if C_SPLB_NATIVE_BE_WIDTH = 4 and C_SPLB_BE_WIDTH = 16 then
|
291 |
|
|
case PLB_ABus(28 to 29) is
|
292 |
|
|
when "00" => BE_selected <= PLB_BE( 0 to 3 );
|
293 |
|
|
when "01" => BE_selected <= PLB_BE( 4 to 7 );
|
294 |
|
|
when "10" => BE_selected <= PLB_BE( 8 to 11 );
|
295 |
|
|
when others => BE_selected <= PLB_BE( 12 to 15 );
|
296 |
|
|
end case;
|
297 |
|
|
end if;
|
298 |
|
|
|
299 |
|
|
|
300 |
|
|
-- 64-bit bridge on 128-bit PLB
|
301 |
|
|
if C_SPLB_NATIVE_BE_WIDTH = 8 and C_SPLB_BE_WIDTH = 16 then
|
302 |
|
|
case PLB_ABus(28) is
|
303 |
|
|
when '0' => BE_selected <= PLB_BE( 0 to 7 );
|
304 |
|
|
when others => BE_selected <= PLB_BE( 8 to 15 );
|
305 |
|
|
end case;
|
306 |
|
|
end if;
|
307 |
|
|
|
308 |
|
|
|
309 |
|
|
end process;
|
310 |
|
|
|
311 |
|
|
|
312 |
|
|
|
313 |
|
|
|
314 |
|
|
with_adr_pipelinig : if C_SPLB_SUPPORT_ADR_PIPE > 0 generate
|
315 |
|
|
|
316 |
|
|
|
317 |
|
|
-------------------------------
|
318 |
|
|
--
|
319 |
|
|
-- read and write pipe control signals
|
320 |
|
|
--
|
321 |
|
|
-- -> we only write to a pipeline, if the transfer is supported.
|
322 |
|
|
--
|
323 |
|
|
--
|
324 |
|
|
with_plb_bursts : if C_SPLB_SUPPORT_BUR_LINE > 0 generate
|
325 |
|
|
|
326 |
|
|
rpipe_wr <= '1' when PLB_SAValid = '1'
|
327 |
|
|
and PLB_RNW = '1'
|
328 |
|
|
and rpipe_full = '0'
|
329 |
|
|
and ( PLB_size( 0 to 1 ) = "00" or ( PLB_size = "1010" and PLB_BE( 0 to 3 ) /= "0000" ) )
|
330 |
|
|
and ( AMU_deviceSelect_t = '1' or AMU_statusSelect_t = '1' )
|
331 |
|
|
and ( PLB_type = "000" or PLB_type = "110" )
|
332 |
|
|
else '0';
|
333 |
|
|
|
334 |
|
|
wpipe_wr <= '1' when PLB_SAValid = '1'
|
335 |
|
|
and PLB_RNW = '0'
|
336 |
|
|
and wpipe_full = '0'
|
337 |
|
|
and ( PLB_size( 0 to 1 ) = "00" or ( PLB_size = "1010" and PLB_BE( 0 to 3 ) /= "0000" ) )
|
338 |
|
|
and ( AMU_deviceSelect_t = '1' or AMU_statusSelect_t = '1' )
|
339 |
|
|
and ( PLB_type = "000" or PLB_type = "110" )
|
340 |
|
|
else '0';
|
341 |
|
|
|
342 |
|
|
end generate with_plb_bursts;
|
343 |
|
|
|
344 |
|
|
without_plb_bursts : if C_SPLB_SUPPORT_BUR_LINE = 0 generate
|
345 |
|
|
|
346 |
|
|
rpipe_wr <= '1' when PLB_SAValid = '1'
|
347 |
|
|
and PLB_RNW = '1'
|
348 |
|
|
and rpipe_full = '0'
|
349 |
|
|
and PLB_size = "0000"
|
350 |
|
|
and ( AMU_deviceSelect_t = '1' or AMU_statusSelect_t = '1' )
|
351 |
|
|
and ( PLB_type = "000" or PLB_type = "110" )
|
352 |
|
|
else '0';
|
353 |
|
|
|
354 |
|
|
wpipe_wr <= '1' when PLB_SAValid = '1'
|
355 |
|
|
and PLB_RNW = '0'
|
356 |
|
|
and wpipe_full = '0'
|
357 |
|
|
and PLB_size = "0000"
|
358 |
|
|
and ( AMU_deviceSelect_t = '1' or AMU_statusSelect_t = '1' )
|
359 |
|
|
and ( PLB_type = "000" or PLB_type = "110" )
|
360 |
|
|
else '0';
|
361 |
|
|
|
362 |
|
|
end generate without_plb_bursts;
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
|
366 |
|
|
|
367 |
|
|
rpipe_rd <= TCU_rpipeRdEn;
|
368 |
|
|
wpipe_rd <= TCU_wpipeRdEn;
|
369 |
|
|
en_rpipe_outputs <= TCU_rpipeRdEn or TCU_stuWriteSA;
|
370 |
|
|
|
371 |
|
|
|
372 |
|
|
------
|
373 |
|
|
--
|
374 |
|
|
-- read and write pipe inputs
|
375 |
|
|
--
|
376 |
|
|
vector_to_pdt( rpipe_data_out, rpipe_out );
|
377 |
|
|
vector_to_pdt( wpipe_data_out, wpipe_out );
|
378 |
|
|
pipeline_in.PLB_ABus <= PLB_ABus;
|
379 |
|
|
pipeline_in.PLB_size <= PLB_size;
|
380 |
|
|
pipeline_in.PLB_BE <= BE_selected;
|
381 |
|
|
pipeline_in.PLB_masterID <= PLB_masterID;
|
382 |
|
|
pipeline_in.statusSelect <= AMU_statusSelect_t;
|
383 |
|
|
pipe_data_in <= pdt_to_vector( pipeline_in );
|
384 |
|
|
|
385 |
|
|
|
386 |
|
|
-----
|
387 |
|
|
-- read and write pipe outputs
|
388 |
|
|
--
|
389 |
|
|
AMU_pipe_adr <= rpipe_out.PLB_Abus when en_rpipe_outputs = '1' else
|
390 |
|
|
wpipe_out.PLB_Abus;
|
391 |
|
|
|
392 |
|
|
AMU_pipe_BE <= rpipe_out.PLB_BE when en_rpipe_outputs = '1' else
|
393 |
|
|
wpipe_out.PLB_BE;
|
394 |
|
|
|
395 |
|
|
AMU_pipe_rmID <= rpipe_out.PLB_masterID;
|
396 |
|
|
AMU_pipe_wmID <= wpipe_out.PLB_masterID;
|
397 |
|
|
|
398 |
|
|
AMU_pipe_size <= rpipe_out.PLB_size when en_rpipe_outputs = '1' else
|
399 |
|
|
wpipe_out.PLB_size;
|
400 |
|
|
|
401 |
|
|
AMU_pipe_rStatusSelect <= rpipe_out.statusSelect;
|
402 |
|
|
AMU_pipe_wStatusSelect <= wpipe_out.statusSelect;
|
403 |
|
|
|
404 |
|
|
--
|
405 |
|
|
-- read pipe
|
406 |
|
|
--
|
407 |
|
|
read_pipeline : entity plb2wb_bridge_v1_00_a.plb2wb_fifo( IMP )
|
408 |
|
|
generic map(
|
409 |
|
|
DATA_W => PIPELINE_DATA_WIDTH,
|
410 |
|
|
ADDR_W => PIPELINE_DEPTH
|
411 |
|
|
)
|
412 |
|
|
port map(
|
413 |
|
|
rd_en => rpipe_rd,
|
414 |
|
|
wr_en => rpipe_wr,
|
415 |
|
|
full => rpipe_full,
|
416 |
|
|
empty => rpipe_empty,
|
417 |
|
|
clk => SPLB_Clk,
|
418 |
|
|
rst => plb2wb_rst,
|
419 |
|
|
dout => rpipe_data_out,
|
420 |
|
|
din => pipe_data_in
|
421 |
|
|
);
|
422 |
|
|
|
423 |
|
|
--
|
424 |
|
|
-- write pipe
|
425 |
|
|
--
|
426 |
|
|
write_pipeline : entity plb2wb_bridge_v1_00_a.plb2wb_fifo( IMP )
|
427 |
|
|
generic map(
|
428 |
|
|
DATA_W => PIPELINE_DATA_WIDTH,
|
429 |
|
|
ADDR_W => PIPELINE_DEPTH
|
430 |
|
|
)
|
431 |
|
|
port map(
|
432 |
|
|
rd_en => wpipe_rd,
|
433 |
|
|
wr_en => wpipe_wr,
|
434 |
|
|
full => wpipe_full,
|
435 |
|
|
empty => wpipe_empty,
|
436 |
|
|
clk => SPLB_Clk,
|
437 |
|
|
rst => plb2wb_rst,
|
438 |
|
|
dout => wpipe_data_out,
|
439 |
|
|
din => pipe_data_in
|
440 |
|
|
);
|
441 |
|
|
|
442 |
|
|
--
|
443 |
|
|
--
|
444 |
|
|
--------------------------
|
445 |
|
|
|
446 |
|
|
|
447 |
|
|
end generate with_adr_pipelinig;
|
448 |
|
|
|
449 |
|
|
|
450 |
|
|
without_adr_pipelining : if C_SPLB_SUPPORT_ADR_PIPE = 0 generate
|
451 |
|
|
|
452 |
|
|
pdt_clear( rpipe_out );
|
453 |
|
|
pdt_clear( wpipe_out );
|
454 |
|
|
|
455 |
|
|
wpipe_full <= '1';
|
456 |
|
|
rpipe_full <= '1';
|
457 |
|
|
wpipe_empty <= '1';
|
458 |
|
|
rpipe_empty <= '1';
|
459 |
|
|
|
460 |
|
|
end generate without_adr_pipelining;
|
461 |
|
|
|
462 |
|
|
|
463 |
|
|
|
464 |
|
|
|
465 |
|
|
--------------------------
|
466 |
|
|
--
|
467 |
|
|
-- address-buffer input
|
468 |
|
|
--
|
469 |
|
|
-- address byte enable size master-id rnw
|
470 |
|
|
abuf_din <= rpipe_out.PLB_ABus & rpipe_out.PLB_BE & rpipe_out.PLB_size & rpipe_out.PLB_masterID & "1" when TCU_rpipeRdEn = '1' else
|
471 |
|
|
wpipe_out.PLB_ABus & wpipe_out.PLB_BE & wpipe_out.PLB_size & rpipe_out.PLB_masterID & "0" when TCU_wpipeRdEn = '1' else
|
472 |
|
|
PLB_ABus & BE_selected & PLB_size & PLB_masterID & PLB_RNW;
|
473 |
|
|
|
474 |
|
|
----------------
|
475 |
|
|
--
|
476 |
|
|
-- address-buffer outputs
|
477 |
|
|
--
|
478 |
|
|
|
479 |
|
|
-- address-output without offset
|
480 |
|
|
AMU_buf_adr_wo <= abuf_dout( 0 to C_SPLB_AWIDTH-1 );
|
481 |
|
|
|
482 |
|
|
-- address-output with offset (but offset is 0)
|
483 |
|
|
adr_offset_g1 : if WB_ADR_OFFSET = X"00000000" generate
|
484 |
|
|
AMU_buf_adr <= abuf_dout( 0 to C_SPLB_AWIDTH-1 );
|
485 |
|
|
end generate;
|
486 |
|
|
|
487 |
|
|
-- address-output with offset
|
488 |
|
|
adr_offset_g2 : if WB_ADR_OFFSET /= X"00000000" generate
|
489 |
|
|
|
490 |
|
|
-- negative offset
|
491 |
|
|
adr_offset_g3 : if WB_ADR_OFFSET_NEG = '1' generate
|
492 |
|
|
AMU_buf_adr <= std_logic_vector ( unsigned'(unsigned( abuf_dout( 0 to C_SPLB_AWIDTH-1 )) ) - unsigned'(unsigned( WB_ADR_OFFSET )) );
|
493 |
|
|
end generate;
|
494 |
|
|
-- positive offset
|
495 |
|
|
adr_offset_g4 : if WB_ADR_OFFSET_NEG = '0' generate
|
496 |
|
|
AMU_buf_adr <= std_logic_vector ( unsigned'(unsigned( abuf_dout( 0 to C_SPLB_AWIDTH-1 ) )) + unsigned'(unsigned( WB_ADR_OFFSET )) );
|
497 |
|
|
end generate;
|
498 |
|
|
|
499 |
|
|
end generate;
|
500 |
|
|
|
501 |
|
|
|
502 |
|
|
-- note: AMU_buf_BE and wb_sel_o is almoust the same, except the case that we have a burst transfer
|
503 |
|
|
--
|
504 |
|
|
AMU_buf_BE <= abuf_dout( C_SPLB_AWIDTH to C_SPLB_AWIDTH + C_SPLB_NATIVE_BE_WIDTH-1 );
|
505 |
|
|
-- note: wb_sel_o is "1111" if we have a burst transfer
|
506 |
|
|
wb_sel_o <= abuf_dout( C_SPLB_AWIDTH to C_SPLB_AWIDTH + C_SPLB_NATIVE_BE_WIDTH-1 )
|
507 |
|
|
when AMU_buf_size_t( 3 downto 2 ) = "00" else
|
508 |
|
|
( others => '1' );
|
509 |
|
|
|
510 |
|
|
AMU_buf_size_t <= abuf_dout( C_SPLB_AWIDTH + C_SPLB_NATIVE_BE_WIDTH to C_SPLB_AWIDTH + C_SPLB_NATIVE_BE_WIDTH + C_SPLB_SIZE_WIDTH-1 );
|
511 |
|
|
AMU_buf_masterID <= abuf_dout( C_SPLB_AWIDTH + C_SPLB_NATIVE_BE_WIDTH + C_SPLB_SIZE_WIDTH to C_SPLB_AWIDTH + C_SPLB_NATIVE_BE_WIDTH + C_SPLB_SIZE_WIDTH + C_SPLB_MID_WIDTH -1 );
|
512 |
|
|
AMU_buf_RNW <= abuf_dout( C_SPLB_AWIDTH + C_SPLB_NATIVE_BE_WIDTH + C_SPLB_SIZE_WIDTH + C_SPLB_MID_WIDTH + 1 - 1 );
|
513 |
|
|
|
514 |
|
|
|
515 |
|
|
-----
|
516 |
|
|
--
|
517 |
|
|
-- address-buffer control signals
|
518 |
|
|
--
|
519 |
|
|
abuf_wr_en <= TCU_adrBufWEn;
|
520 |
|
|
|
521 |
|
|
--
|
522 |
|
|
-- address buffer
|
523 |
|
|
--
|
524 |
|
|
addr_buffer_e : entity plb2wb_bridge_v1_00_a.fifo_adr( IMP )
|
525 |
|
|
generic map
|
526 |
|
|
(
|
527 |
|
|
SYNCHRONY => SYNCHRONY,
|
528 |
|
|
C_SPLB_MID_WIDTH => C_SPLB_MID_WIDTH
|
529 |
|
|
)
|
530 |
|
|
port map(
|
531 |
|
|
rd_en => TCU_adrBufREn,
|
532 |
|
|
wr_en => abuf_wr_en,
|
533 |
|
|
full => AMU_bufFull,
|
534 |
|
|
empty => AMU_bufEmpty,
|
535 |
|
|
wr_clk => SPLB_Clk,
|
536 |
|
|
rst => plb2wb_rst,
|
537 |
|
|
rd_clk => wb_clk_i,
|
538 |
|
|
dout => abuf_dout,
|
539 |
|
|
din => abuf_din
|
540 |
|
|
|
541 |
|
|
);
|
542 |
|
|
|
543 |
|
|
--
|
544 |
|
|
--
|
545 |
|
|
--------------------------
|
546 |
|
|
|
547 |
|
|
|
548 |
|
|
end IMP;
|
549 |
|
|
|
550 |
|
|
|
551 |
|
|
|
552 |
|
|
|