1 |
145 |
lanttu |
-------------------------------------------------------------------------------
|
2 |
|
|
-- Title : Hibi toplevel using r4 wrappers
|
3 |
|
|
-- Project :
|
4 |
|
|
-------------------------------------------------------------------------------
|
5 |
|
|
-- File : hibiv3_r4.vhd
|
6 |
|
|
-- Author : Lasse Lehtonen, modified from Jussi Nieminen's HWTG hibi
|
7 |
|
|
-- top level
|
8 |
|
|
-- Company :
|
9 |
|
|
-- Last update: 2011-04-04
|
10 |
|
|
-- Platform :
|
11 |
|
|
-------------------------------------------------------------------------------
|
12 |
|
|
-- Description: Semi-generic toplevel, add as many agents as you like. Just
|
13 |
|
|
-- be sure to create enough addresses in the tables (scroll down).
|
14 |
|
|
-- Every segment has equal number of wrappers and are connected
|
15 |
|
|
-- as a chain.
|
16 |
|
|
-------------------------------------------------------------------------------
|
17 |
|
|
-- Revisions :
|
18 |
|
|
-- Date Version Author Description
|
19 |
|
|
-- 2009/06/23 1.0 niemin95 Created
|
20 |
|
|
-------------------------------------------------------------------------------
|
21 |
|
|
|
22 |
|
|
library ieee;
|
23 |
|
|
use ieee.std_logic_1164.all;
|
24 |
|
|
use work.hibiv3_pkg.all;
|
25 |
|
|
|
26 |
|
|
|
27 |
|
|
entity hibiv3_r4 is
|
28 |
|
|
|
29 |
|
|
generic (
|
30 |
|
|
-- HIBI generics
|
31 |
|
|
id_width_g : integer := 4;
|
32 |
|
|
addr_width_g : integer := 16;
|
33 |
|
|
data_width_g : integer := 32;
|
34 |
|
|
comm_width_g : integer := 5;
|
35 |
|
|
counter_width_g : integer := 8;
|
36 |
|
|
rel_agent_freq_g : integer := 1;
|
37 |
|
|
rel_bus_freq_g : integer := 1;
|
38 |
|
|
arb_type_g : integer := 3;
|
39 |
|
|
fifo_sel_g : integer := 0;
|
40 |
|
|
rx_fifo_depth_g : integer := 4;
|
41 |
|
|
rx_msg_fifo_depth_g : integer := 4;
|
42 |
|
|
tx_fifo_depth_g : integer := 4;
|
43 |
|
|
tx_msg_fifo_depth_g : integer := 4;
|
44 |
|
|
max_send_g : integer := 20;
|
45 |
|
|
n_cfg_pages_g : integer := 1;
|
46 |
|
|
n_time_slots_g : integer := 0;
|
47 |
|
|
keep_slot_g : integer := 0;
|
48 |
|
|
n_extra_params_g : integer := 1;
|
49 |
|
|
|
50 |
|
|
cfg_re_g : integer := 1;
|
51 |
|
|
cfg_we_g : integer := 1;
|
52 |
|
|
debug_width_g : integer := 0;
|
53 |
|
|
|
54 |
|
|
n_agents_g : integer := 12;
|
55 |
|
|
n_segments_g : integer := 3;
|
56 |
|
|
|
57 |
|
|
separate_addr_g : integer := 0
|
58 |
|
|
);
|
59 |
|
|
|
60 |
|
|
port (
|
61 |
|
|
clk_ip : in std_logic;
|
62 |
|
|
clk_noc : in std_logic;
|
63 |
|
|
rst_n : in std_logic;
|
64 |
|
|
|
65 |
|
|
agent_comm_in : in std_logic_vector(n_agents_g*comm_width_g-1 downto 0);
|
66 |
|
|
agent_data_in : in std_logic_vector(n_agents_g*data_width_g-1 downto 0);
|
67 |
|
|
agent_av_in : in std_logic_vector(n_agents_g-1 downto 0);
|
68 |
|
|
agent_we_in : in std_logic_vector(n_agents_g-1 downto 0);
|
69 |
|
|
agent_re_in : in std_logic_vector(n_agents_g-1 downto 0);
|
70 |
|
|
agent_comm_out : out std_logic_vector(n_agents_g*comm_width_g-1 downto 0);
|
71 |
|
|
agent_data_out : out std_logic_vector(n_agents_g*data_width_g-1 downto 0);
|
72 |
|
|
agent_av_out : out std_logic_vector(n_agents_g-1 downto 0);
|
73 |
|
|
agent_full_out : out std_logic_vector(n_agents_g-1 downto 0);
|
74 |
|
|
agent_one_p_out : out std_logic_vector(n_agents_g-1 downto 0);
|
75 |
|
|
agent_empty_out : out std_logic_vector(n_agents_g-1 downto 0);
|
76 |
|
|
agent_one_d_out : out std_logic_vector(n_agents_g-1 downto 0)
|
77 |
|
|
|
78 |
|
|
);
|
79 |
|
|
|
80 |
|
|
end hibiv3_r4;
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
|
84 |
|
|
architecture structural of hibiv3_r4 is
|
85 |
|
|
|
86 |
|
|
-----------------------------------------------------------------------------
|
87 |
|
|
-- HIBI ADDRESSES
|
88 |
|
|
-----------------------------------------------------------------------------
|
89 |
|
|
|
90 |
|
|
type gen_addr_array_type is array (1 to 4) of integer;
|
91 |
|
|
type gen_addr_array_3d_type is array (0 to 2) of gen_addr_array_type;
|
92 |
|
|
type gen_bridge_addr_array is array (0 to 1) of integer;
|
93 |
|
|
|
94 |
|
|
-- addresses_c(segment index)(wrapper index in the segment)
|
95 |
|
|
constant addresses_lo_c : gen_addr_array_3d_type :=
|
96 |
|
|
((16#00000000#, 16#00000200#, 16#00000400#, 16#00000000#),
|
97 |
|
|
(16#00000000#, 16#00000130#, 16#00000000#, 16#00000000#),
|
98 |
|
|
(16#00000000#, 16#00000330#, 16#00000000#, 16#00000000#));
|
99 |
|
|
|
100 |
|
|
constant addresses_hi_c : gen_addr_array_3d_type :=
|
101 |
|
|
((16#000001FF#, 16#000003FF#, 16#000005FF#, 16#00000000#),
|
102 |
|
|
(16#00000000#, 16#00000000#, 16#00000000#, 16#00000000#),
|
103 |
|
|
(16#00000000#, 16#00000000#, 16#00000000#, 16#00000000#));
|
104 |
|
|
|
105 |
|
|
constant bridge_a_addr_base_c : gen_bridge_addr_array :=
|
106 |
|
|
(16#00000000#, 16#00000000#);
|
107 |
|
|
constant bridge_a_addr_limit_c : gen_bridge_addr_array :=
|
108 |
|
|
(16#000000FF#, 16#000001FF#);
|
109 |
|
|
constant bridge_b_addr_base_c : gen_bridge_addr_array :=
|
110 |
|
|
(16#00000000#, 16#00000000#);
|
111 |
|
|
constant bridge_b_addr_limit_c : gen_bridge_addr_array :=
|
112 |
|
|
(16#000000FF#, 16#000001FF#);
|
113 |
|
|
|
114 |
|
|
constant bridge_a_id_min_c : gen_bridge_addr_array :=
|
115 |
|
|
(1, 1);
|
116 |
|
|
constant bridge_a_id_max_c : gen_bridge_addr_array :=
|
117 |
|
|
(5, 11);
|
118 |
|
|
constant bridge_b_id_min_c : gen_bridge_addr_array :=
|
119 |
|
|
(1, 1);
|
120 |
|
|
constant bridge_b_id_max_c : gen_bridge_addr_array :=
|
121 |
|
|
(5, 11);
|
122 |
|
|
|
123 |
|
|
constant bridge_a_inv_addr_c : gen_bridge_addr_array :=
|
124 |
|
|
(1, 1);
|
125 |
|
|
constant bridge_b_inv_addr_c : gen_bridge_addr_array :=
|
126 |
|
|
(0, 0);
|
127 |
|
|
|
128 |
|
|
|
129 |
|
|
|
130 |
|
|
|
131 |
|
|
|
132 |
|
|
|
133 |
|
|
|
134 |
|
|
-----------------------------------------------------------------------------
|
135 |
|
|
--
|
136 |
|
|
-----------------------------------------------------------------------------
|
137 |
|
|
|
138 |
|
|
-- purpose: to resolve the number of agents in each segment
|
139 |
|
|
function n_agents_in_segment (
|
140 |
|
|
constant segment, n_segments, wrappers_per_seg : integer)
|
141 |
|
|
return integer is
|
142 |
|
|
begin -- n_agents_in_segment
|
143 |
|
|
|
144 |
|
|
if n_segments = 1 then
|
145 |
|
|
return wrappers_per_seg;
|
146 |
|
|
elsif segment = 0 or segment = n_segments - 1 then
|
147 |
|
|
-- end segment, only one bridge
|
148 |
|
|
return wrappers_per_seg + 1;
|
149 |
|
|
else
|
150 |
|
|
-- middle segment
|
151 |
|
|
return wrappers_per_seg + 2;
|
152 |
|
|
end if;
|
153 |
|
|
|
154 |
|
|
end n_agents_in_segment;
|
155 |
|
|
|
156 |
|
|
function priority_a (
|
157 |
|
|
constant segment, n_segments, wrappers_per_seg : integer)
|
158 |
|
|
return integer is
|
159 |
|
|
begin
|
160 |
|
|
|
161 |
|
|
if n_segments = 1 then
|
162 |
|
|
return 0;
|
163 |
|
|
elsif segment = 0 or segment = n_segments - 1 then
|
164 |
|
|
-- end segment, only one bridge
|
165 |
|
|
return wrappers_per_seg + 1;
|
166 |
|
|
else
|
167 |
|
|
-- middle segment
|
168 |
|
|
return wrappers_per_seg + 2;
|
169 |
|
|
end if;
|
170 |
|
|
|
171 |
|
|
end priority_a;
|
172 |
|
|
|
173 |
|
|
function priority_b (
|
174 |
|
|
constant segment, n_segments, wrappers_per_seg : integer)
|
175 |
|
|
return integer is
|
176 |
|
|
begin
|
177 |
|
|
|
178 |
|
|
if n_segments = 1 then
|
179 |
|
|
return 0;
|
180 |
|
|
elsif segment = 0 or segment = n_segments - 1 then
|
181 |
|
|
-- end segment, only one bridge
|
182 |
|
|
return wrappers_per_seg + 1;
|
183 |
|
|
else
|
184 |
|
|
-- middle segment
|
185 |
|
|
return wrappers_per_seg + 1;
|
186 |
|
|
end if;
|
187 |
|
|
|
188 |
|
|
end priority_b;
|
189 |
|
|
|
190 |
|
|
function id_agent (
|
191 |
|
|
constant segment, n_segments, wrappers_per_seg : integer)
|
192 |
|
|
return integer is
|
193 |
|
|
begin
|
194 |
|
|
|
195 |
|
|
if n_segments = 1 then
|
196 |
|
|
return 1;
|
197 |
|
|
elsif segment = 0 then
|
198 |
|
|
-- first segment
|
199 |
|
|
return 1;
|
200 |
|
|
elsif segment = n_segments - 1 then
|
201 |
|
|
-- last segment
|
202 |
|
|
return segment*(wrappers_per_seg+2);
|
203 |
|
|
else
|
204 |
|
|
-- middle segment
|
205 |
|
|
return segment*(wrappers_per_seg+2);
|
206 |
|
|
end if;
|
207 |
|
|
|
208 |
|
|
end id_agent;
|
209 |
|
|
|
210 |
|
|
function id_a (
|
211 |
|
|
constant segment, n_segments, wrappers_per_seg : integer)
|
212 |
|
|
return integer is
|
213 |
|
|
begin
|
214 |
|
|
|
215 |
|
|
if n_segments = 1 then
|
216 |
|
|
return 0;
|
217 |
|
|
elsif segment = 0 then
|
218 |
|
|
-- first segment
|
219 |
|
|
return wrappers_per_seg + 1;
|
220 |
|
|
elsif segment = n_segments - 1 then
|
221 |
|
|
-- last segment
|
222 |
|
|
return 0;
|
223 |
|
|
else
|
224 |
|
|
-- middle segment
|
225 |
|
|
return segment*(wrappers_per_seg+2)+wrappers_per_seg;
|
226 |
|
|
end if;
|
227 |
|
|
|
228 |
|
|
end id_a;
|
229 |
|
|
|
230 |
|
|
function id_b (
|
231 |
|
|
constant segment, n_segments, wrappers_per_seg : integer)
|
232 |
|
|
return integer is
|
233 |
|
|
begin
|
234 |
|
|
|
235 |
|
|
if n_segments = 1 then
|
236 |
|
|
return 0;
|
237 |
|
|
elsif segment = 0 then
|
238 |
|
|
-- first segment
|
239 |
|
|
return 0;
|
240 |
|
|
elsif segment = n_segments - 1 then
|
241 |
|
|
return segment*(wrappers_per_seg+2)+wrappers_per_seg;
|
242 |
|
|
else
|
243 |
|
|
-- middle segment
|
244 |
|
|
return segment*(wrappers_per_seg+2)+wrappers_per_seg+1;
|
245 |
|
|
end if;
|
246 |
|
|
|
247 |
|
|
end id_b;
|
248 |
|
|
|
249 |
|
|
|
250 |
|
|
constant wrappers_per_segment_c : integer := n_agents_g / n_segments_g;
|
251 |
|
|
|
252 |
|
|
type bus_data_segments_array is array (0 to n_segments_g-1) of
|
253 |
|
|
std_logic_vector(data_width_g-1 downto 0);
|
254 |
|
|
type bus_comm_segments_array is array (0 to n_segments_g-1) of
|
255 |
|
|
std_logic_vector(comm_width_c-1 downto 0);
|
256 |
|
|
|
257 |
|
|
signal bus_wra_data : bus_data_segments_array;
|
258 |
|
|
signal bus_wra_comm : bus_comm_segments_array;
|
259 |
|
|
signal bus_wra_av : std_logic_vector(n_segments_g-1 downto 0);
|
260 |
|
|
signal bus_wra_full : std_logic_vector(n_segments_g-1 downto 0);
|
261 |
|
|
signal bus_wra_lock : std_logic_vector(n_segments_g-1 downto 0);
|
262 |
|
|
|
263 |
|
|
-- +1, because there might be bridges in the segment. This is not optimal,
|
264 |
|
|
-- but much easier and extra signals should be optimized away in synthesis
|
265 |
|
|
type data_to_bus_type is array (0 to wrappers_per_segment_c+1) of
|
266 |
|
|
std_logic_vector(data_width_g-1 downto 0);
|
267 |
|
|
type comm_to_bus_type is array (0 to wrappers_per_segment_c+1) of
|
268 |
|
|
std_logic_vector(comm_width_c-1 downto 0);
|
269 |
|
|
|
270 |
|
|
type data_segments_array is array (0 to n_segments_g-1) of data_to_bus_type;
|
271 |
|
|
type comm_segments_array is array (0 to n_segments_g-1) of comm_to_bus_type;
|
272 |
|
|
type cntr_segments_array is array (0 to n_segments_g-1) of std_logic_vector
|
273 |
|
|
(wrappers_per_segment_c + 1 downto 0);
|
274 |
|
|
|
275 |
|
|
signal wra_bus_data : data_segments_array;
|
276 |
|
|
signal wra_bus_comm : comm_segments_array;
|
277 |
|
|
signal wra_bus_av : cntr_segments_array;
|
278 |
|
|
signal wra_bus_full : cntr_segments_array;
|
279 |
|
|
signal wra_bus_lock : cntr_segments_array;
|
280 |
|
|
|
281 |
|
|
-------------------------------------------------------------------------------
|
282 |
|
|
begin -- structural
|
283 |
|
|
-------------------------------------------------------------------------------
|
284 |
|
|
|
285 |
|
|
-- if there is more than 1 segment, wrappers must distribute evenly
|
286 |
|
|
assert n_segments_g = 1 or n_agents_g mod n_segments_g = 0
|
287 |
|
|
report "With more than one segment wrappers distribute evenly"
|
288 |
|
|
severity failure;
|
289 |
|
|
|
290 |
|
|
|
291 |
|
|
segments : for seg in 0 to n_segments_g-1 generate
|
292 |
|
|
|
293 |
|
|
wrappers : for wra in 0 to wrappers_per_segment_c-1 generate
|
294 |
|
|
|
295 |
|
|
wrapper : entity work.hibi_wrapper_r4
|
296 |
|
|
generic map (
|
297 |
|
|
id_g => id_agent
|
298 |
|
|
(seg, n_segments_g, wrappers_per_segment_c) + wra,
|
299 |
|
|
addr_g => addresses_lo_c(seg)(wra + 1),
|
300 |
|
|
addr_limit_g => addresses_hi_c(seg)(wra + 1),
|
301 |
|
|
inv_addr_en_g => 0,
|
302 |
|
|
id_width_g => id_width_g,
|
303 |
|
|
addr_width_g => addr_width_g,
|
304 |
|
|
data_width_g => data_width_g,
|
305 |
|
|
separate_addr_g => separate_addr_g,
|
306 |
|
|
comm_width_g => comm_width_g,
|
307 |
|
|
counter_width_g => counter_width_g,
|
308 |
|
|
rel_agent_freq_g => rel_agent_freq_g,
|
309 |
|
|
rel_bus_freq_g => rel_bus_freq_g,
|
310 |
|
|
arb_type_g => arb_type_g,
|
311 |
|
|
fifo_sel_g => fifo_sel_g,
|
312 |
|
|
rx_fifo_depth_g => rx_fifo_depth_g,
|
313 |
|
|
rx_msg_fifo_depth_g => rx_msg_fifo_depth_g,
|
314 |
|
|
tx_fifo_depth_g => tx_fifo_depth_g,
|
315 |
|
|
tx_msg_fifo_depth_g => tx_msg_fifo_depth_g,
|
316 |
|
|
prior_g => wra + 1,
|
317 |
|
|
max_send_g => max_send_g,
|
318 |
|
|
-- n_agents_g should be num of ips + num of bridges in the segment
|
319 |
|
|
n_agents_g => n_agents_in_segment
|
320 |
|
|
(seg, n_segments_g, wrappers_per_segment_c),
|
321 |
|
|
n_cfg_pages_g => n_cfg_pages_g,
|
322 |
|
|
n_time_slots_g => n_time_slots_g,
|
323 |
|
|
keep_slot_g => keep_slot_g,
|
324 |
|
|
n_extra_params_g => n_extra_params_g,
|
325 |
|
|
|
326 |
|
|
cfg_re_g => cfg_re_g,
|
327 |
|
|
cfg_we_g => cfg_we_g,
|
328 |
|
|
debug_width_g => debug_width_g
|
329 |
|
|
)
|
330 |
|
|
port map (
|
331 |
|
|
bus_clk => clk_noc,
|
332 |
|
|
agent_clk => clk_ip,
|
333 |
|
|
bus_sync_clk => clk_noc,
|
334 |
|
|
agent_sync_clk => clk_ip,
|
335 |
|
|
rst_n => rst_n,
|
336 |
|
|
bus_comm_in => bus_wra_comm(seg),
|
337 |
|
|
bus_data_in => bus_wra_data(seg),
|
338 |
|
|
bus_full_in => bus_wra_full(seg),
|
339 |
|
|
bus_lock_in => bus_wra_lock(seg),
|
340 |
|
|
bus_av_in => bus_wra_av(seg),
|
341 |
|
|
agent_comm_in => agent_comm_in((seg*wrappers_per_segment_c+wra+1)*
|
342 |
|
|
comm_width_g-1 downto
|
343 |
|
|
(seg*wrappers_per_segment_c+wra)*
|
344 |
|
|
comm_width_g),
|
345 |
|
|
agent_data_in => agent_data_in((seg*wrappers_per_segment_c+wra+1)*
|
346 |
|
|
data_width_g-1 downto
|
347 |
|
|
(seg*wrappers_per_segment_c+wra)*
|
348 |
|
|
data_width_g),
|
349 |
|
|
agent_av_in => agent_av_in(seg*wrappers_per_segment_c+wra),
|
350 |
|
|
agent_we_in => agent_we_in(seg*wrappers_per_segment_c+wra),
|
351 |
|
|
agent_re_in => agent_re_in(seg*wrappers_per_segment_c+wra),
|
352 |
|
|
bus_comm_out => wra_bus_comm(seg)(wra),
|
353 |
|
|
bus_data_out => wra_bus_data(seg)(wra),
|
354 |
|
|
bus_full_out => wra_bus_full(seg)(wra),
|
355 |
|
|
bus_lock_out => wra_bus_lock(seg)(wra),
|
356 |
|
|
bus_av_out => wra_bus_av(seg)(wra),
|
357 |
|
|
agent_comm_out => agent_comm_out((seg*wrappers_per_segment_c+wra+1)*
|
358 |
|
|
comm_width_g-1 downto
|
359 |
|
|
(seg*wrappers_per_segment_c+wra)*
|
360 |
|
|
comm_width_g),
|
361 |
|
|
agent_data_out => agent_data_out((seg*wrappers_per_segment_c+wra+1)*
|
362 |
|
|
data_width_g-1 downto
|
363 |
|
|
(seg*wrappers_per_segment_c+wra)*
|
364 |
|
|
data_width_g),
|
365 |
|
|
agent_av_out => agent_av_out(seg*wrappers_per_segment_c+wra),
|
366 |
|
|
agent_full_out => agent_full_out(seg*wrappers_per_segment_c+wra),
|
367 |
|
|
agent_one_p_out => agent_one_p_out(seg*wrappers_per_segment_c+wra),
|
368 |
|
|
agent_empty_out => agent_empty_out(seg*wrappers_per_segment_c+wra),
|
369 |
|
|
agent_one_d_out => agent_one_d_out(seg*wrappers_per_segment_c+wra)
|
370 |
|
|
-- synthesis translate_off
|
371 |
|
|
,
|
372 |
|
|
debug_out => open,
|
373 |
|
|
debug_in => (others => '0')
|
374 |
|
|
-- synthesis translate_on
|
375 |
|
|
);
|
376 |
|
|
|
377 |
|
|
|
378 |
|
|
end generate wrappers;
|
379 |
|
|
|
380 |
|
|
|
381 |
|
|
bridge_needed : if seg > 0 generate
|
382 |
|
|
|
383 |
|
|
i_bridge : entity work.hibi_bridge
|
384 |
|
|
generic map (
|
385 |
|
|
a_id_g =>
|
386 |
|
|
id_a(seg-1, n_segments_g, wrappers_per_segment_c),
|
387 |
|
|
a_addr_g => bridge_a_addr_base_c(seg-1),
|
388 |
|
|
a_inv_addr_en_g => bridge_a_inv_addr_c(seg-1),
|
389 |
|
|
a_id_width_g => id_width_g,
|
390 |
|
|
a_addr_width_g => addr_width_g,
|
391 |
|
|
a_data_width_g => data_width_g,
|
392 |
|
|
a_separate_addr_g => separate_addr_g,
|
393 |
|
|
a_comm_width_g => comm_width_g,
|
394 |
|
|
a_counter_width_g => counter_width_g,
|
395 |
|
|
a_rx_fifo_depth_g => rx_fifo_depth_g,
|
396 |
|
|
a_tx_fifo_depth_g => tx_fifo_depth_g,
|
397 |
|
|
a_rx_msg_fifo_depth_g => rx_msg_fifo_depth_g,
|
398 |
|
|
a_tx_msg_fifo_depth_g => tx_msg_fifo_depth_g,
|
399 |
|
|
a_arb_type_g => arb_type_g,
|
400 |
|
|
a_fifo_sel_g => fifo_sel_g,
|
401 |
|
|
|
402 |
|
|
a_debug_width_g => debug_width_g,
|
403 |
|
|
a_prior_g =>
|
404 |
|
|
priority_a(seg-1, n_segments_g, wrappers_per_segment_c),
|
405 |
|
|
a_max_send_g => max_send_g,
|
406 |
|
|
a_n_agents_g =>
|
407 |
|
|
n_agents_in_segment(seg-1, n_segments_g, wrappers_per_segment_c),
|
408 |
|
|
a_n_cfg_pages_g => n_cfg_pages_g,
|
409 |
|
|
a_n_time_slots_g => n_time_slots_g,
|
410 |
|
|
a_n_extra_params_g => n_extra_params_g,
|
411 |
|
|
a_cfg_re_g => cfg_re_g,
|
412 |
|
|
a_cfg_we_g => cfg_we_g,
|
413 |
|
|
|
414 |
|
|
b_id_g =>
|
415 |
|
|
id_b(seg, n_segments_g, wrappers_per_segment_c),
|
416 |
|
|
b_addr_g => bridge_b_addr_base_c(seg-1),
|
417 |
|
|
b_inv_addr_en_g => bridge_b_inv_addr_c(seg-1),
|
418 |
|
|
b_id_width_g => id_width_g,
|
419 |
|
|
b_addr_width_g => addr_width_g,
|
420 |
|
|
b_data_width_g => data_width_g,
|
421 |
|
|
b_separate_addr_g => separate_addr_g,
|
422 |
|
|
b_comm_width_g => comm_width_g,
|
423 |
|
|
b_counter_width_g => counter_width_g,
|
424 |
|
|
b_rx_fifo_depth_g => rx_fifo_depth_g,
|
425 |
|
|
b_tx_fifo_depth_g => tx_fifo_depth_g,
|
426 |
|
|
b_rx_msg_fifo_depth_g => rx_msg_fifo_depth_g,
|
427 |
|
|
b_tx_msg_fifo_depth_g => tx_msg_fifo_depth_g,
|
428 |
|
|
b_arb_type_g => arb_type_g,
|
429 |
|
|
b_fifo_sel_g => fifo_sel_g,
|
430 |
|
|
|
431 |
|
|
b_debug_width_g => debug_width_g,
|
432 |
|
|
b_prior_g =>
|
433 |
|
|
priority_b(seg, n_segments_g, wrappers_per_segment_c),
|
434 |
|
|
b_max_send_g => max_send_g,
|
435 |
|
|
b_n_agents_g =>
|
436 |
|
|
n_agents_in_segment(seg, n_segments_g, wrappers_per_segment_c),
|
437 |
|
|
b_n_cfg_pages_g => n_cfg_pages_g,
|
438 |
|
|
b_n_time_slots_g => n_time_slots_g,
|
439 |
|
|
b_n_extra_params_g => n_extra_params_g,
|
440 |
|
|
b_cfg_re_g => cfg_re_g,
|
441 |
|
|
b_cfg_we_g => cfg_we_g,
|
442 |
|
|
|
443 |
|
|
a_id_min_g => bridge_a_id_min_c(seg-1),
|
444 |
|
|
a_id_max_g => bridge_a_id_max_c(seg-1),
|
445 |
|
|
a_addr_limit_g => bridge_a_addr_limit_c(seg-1),
|
446 |
|
|
|
447 |
|
|
b_id_min_g => bridge_b_id_min_c(seg-1),
|
448 |
|
|
b_id_max_g => bridge_b_id_max_c(seg-1),
|
449 |
|
|
b_addr_limit_g => bridge_b_addr_limit_c(seg-1)
|
450 |
|
|
|
451 |
|
|
)
|
452 |
|
|
port map (
|
453 |
|
|
a_clk => clk_noc,
|
454 |
|
|
a_rst_n => rst_n,
|
455 |
|
|
b_clk => clk_noc,
|
456 |
|
|
b_rst_n => rst_n,
|
457 |
|
|
a_bus_av_in => bus_wra_av(seg-1),
|
458 |
|
|
a_bus_data_in => bus_wra_data(seg-1),
|
459 |
|
|
a_bus_comm_in => bus_wra_comm(seg-1),
|
460 |
|
|
a_bus_full_in => bus_wra_full(seg-1),
|
461 |
|
|
a_bus_lock_in => bus_wra_lock(seg-1),
|
462 |
|
|
b_bus_av_in => bus_wra_av(seg),
|
463 |
|
|
b_bus_data_in => bus_wra_data(seg),
|
464 |
|
|
b_bus_comm_in => bus_wra_comm(seg),
|
465 |
|
|
b_bus_full_in => bus_wra_full(seg),
|
466 |
|
|
b_bus_lock_in => bus_wra_lock(seg),
|
467 |
|
|
a_bus_av_out => wra_bus_av(seg-1)(wrappers_per_segment_c),
|
468 |
|
|
a_bus_data_out => wra_bus_data(seg-1)(wrappers_per_segment_c),
|
469 |
|
|
a_bus_comm_out => wra_bus_comm(seg-1)(wrappers_per_segment_c),
|
470 |
|
|
a_bus_lock_out => wra_bus_lock(seg-1)(wrappers_per_segment_c),
|
471 |
|
|
a_bus_full_out => wra_bus_full(seg-1)(wrappers_per_segment_c),
|
472 |
|
|
b_bus_av_out => wra_bus_av(seg)(wrappers_per_segment_c+1),
|
473 |
|
|
b_bus_data_out => wra_bus_data(seg)(wrappers_per_segment_c+1),
|
474 |
|
|
b_bus_comm_out => wra_bus_comm(seg)(wrappers_per_segment_c+1),
|
475 |
|
|
b_bus_lock_out => wra_bus_lock(seg)(wrappers_per_segment_c+1),
|
476 |
|
|
b_bus_full_out => wra_bus_full(seg)(wrappers_per_segment_c+1)
|
477 |
|
|
-- synthesis translate_off
|
478 |
|
|
,
|
479 |
|
|
a_debug_out => open,
|
480 |
|
|
a_debug_in => (others => '0'),
|
481 |
|
|
b_debug_out => open,
|
482 |
|
|
b_debug_in => (others => '0')
|
483 |
|
|
-- synthesis translate_on
|
484 |
|
|
);
|
485 |
|
|
|
486 |
|
|
-- nullify extra signals
|
487 |
|
|
nullify_first_seg : if seg = 1 generate
|
488 |
|
|
-- no b-side on the first segment
|
489 |
|
|
wra_bus_av(seg-1)(wrappers_per_segment_c+1) <= '0';
|
490 |
|
|
wra_bus_full(seg-1)(wrappers_per_segment_c+1) <= '0';
|
491 |
|
|
wra_bus_lock(seg-1)(wrappers_per_segment_c+1) <= '0';
|
492 |
|
|
wra_bus_comm(seg-1)(wrappers_per_segment_c+1) <= (others => '0');
|
493 |
|
|
wra_bus_data(seg-1)(wrappers_per_segment_c+1) <= (others => '0');
|
494 |
|
|
end generate nullify_first_seg;
|
495 |
|
|
|
496 |
|
|
nullify_last_seg : if seg = n_segments_g-1 generate
|
497 |
|
|
-- no a-side here
|
498 |
|
|
wra_bus_av(seg)(wrappers_per_segment_c) <= '0';
|
499 |
|
|
wra_bus_full(seg)(wrappers_per_segment_c) <= '0';
|
500 |
|
|
wra_bus_lock(seg)(wrappers_per_segment_c) <= '0';
|
501 |
|
|
wra_bus_comm(seg)(wrappers_per_segment_c) <= (others => '0');
|
502 |
|
|
wra_bus_data(seg)(wrappers_per_segment_c) <= (others => '0');
|
503 |
|
|
end generate nullify_last_seg;
|
504 |
|
|
|
505 |
|
|
end generate bridge_needed;
|
506 |
|
|
|
507 |
|
|
|
508 |
|
|
no_bridges : if n_segments_g = 1 generate
|
509 |
|
|
|
510 |
|
|
-- no bridges, nullify extra all signals
|
511 |
|
|
wra_bus_av(seg)(wrappers_per_segment_c) <= '0';
|
512 |
|
|
wra_bus_full(seg)(wrappers_per_segment_c) <= '0';
|
513 |
|
|
wra_bus_lock(seg)(wrappers_per_segment_c) <= '0';
|
514 |
|
|
wra_bus_comm(seg)(wrappers_per_segment_c) <= (others => '0');
|
515 |
|
|
wra_bus_data(seg)(wrappers_per_segment_c) <= (others => '0');
|
516 |
|
|
wra_bus_av(seg)(wrappers_per_segment_c+1) <= '0';
|
517 |
|
|
wra_bus_full(seg)(wrappers_per_segment_c+1) <= '0';
|
518 |
|
|
wra_bus_lock(seg)(wrappers_per_segment_c+1) <= '0';
|
519 |
|
|
wra_bus_comm(seg)(wrappers_per_segment_c+1) <= (others => '0');
|
520 |
|
|
wra_bus_data(seg)(wrappers_per_segment_c+1) <= (others => '0');
|
521 |
|
|
|
522 |
|
|
end generate no_bridges;
|
523 |
|
|
|
524 |
|
|
|
525 |
|
|
end generate segments;
|
526 |
|
|
|
527 |
|
|
|
528 |
|
|
-- making the bus
|
529 |
|
|
form_bus : process (wra_bus_data, wra_bus_comm, wra_bus_av,
|
530 |
|
|
wra_bus_full, wra_bus_lock)
|
531 |
|
|
variable tmp_data_v : bus_data_segments_array;
|
532 |
|
|
variable tmp_comm_v : bus_comm_segments_array;
|
533 |
|
|
variable tmp_av_v : std_logic_vector(n_segments_g-1 downto 0);
|
534 |
|
|
variable tmp_full_v : std_logic_vector(n_segments_g-1 downto 0);
|
535 |
|
|
variable tmp_lock_v : std_logic_vector(n_segments_g-1 downto 0);
|
536 |
|
|
begin -- process form_bus
|
537 |
|
|
|
538 |
|
|
for seg in 0 to n_segments_g-1 loop
|
539 |
|
|
|
540 |
|
|
tmp_data_v(seg) := wra_bus_data(seg)(0);
|
541 |
|
|
tmp_comm_v(seg) := wra_bus_comm(seg)(0);
|
542 |
|
|
tmp_av_v(seg) := wra_bus_av(seg)(0);
|
543 |
|
|
tmp_full_v(seg) := wra_bus_full(seg)(0);
|
544 |
|
|
tmp_lock_v(seg) := wra_bus_lock(seg)(0);
|
545 |
|
|
|
546 |
|
|
for n in 1 to wrappers_per_segment_c+1 loop
|
547 |
|
|
|
548 |
|
|
tmp_data_v(seg) := wra_bus_data(seg)(n) or tmp_data_v(seg);
|
549 |
|
|
tmp_comm_v(seg) := wra_bus_comm(seg)(n) or tmp_comm_v(seg);
|
550 |
|
|
tmp_av_v(seg) := wra_bus_av(seg)(n) or tmp_av_v(seg);
|
551 |
|
|
tmp_full_v(seg) := wra_bus_full(seg)(n) or tmp_full_v(seg);
|
552 |
|
|
tmp_lock_v(seg) := wra_bus_lock(seg)(n) or tmp_lock_v(seg);
|
553 |
|
|
|
554 |
|
|
end loop; -- n
|
555 |
|
|
|
556 |
|
|
bus_wra_data(seg) <= tmp_data_v(seg);
|
557 |
|
|
bus_wra_comm(seg) <= tmp_comm_v(seg);
|
558 |
|
|
bus_wra_av(seg) <= tmp_av_v(seg);
|
559 |
|
|
bus_wra_full(seg) <= tmp_full_v(seg);
|
560 |
|
|
bus_wra_lock(seg) <= tmp_lock_v(seg);
|
561 |
|
|
|
562 |
|
|
end loop; -- seg
|
563 |
|
|
|
564 |
|
|
end process form_bus;
|
565 |
|
|
|
566 |
|
|
end structural;
|