1 |
145 |
lanttu |
-------------------------------------------------------------------------------
|
2 |
|
|
-- Funbase IP library Copyright (C) 2011 TUT Department of Computer Systems
|
3 |
|
|
--
|
4 |
|
|
-- This source file may be used and distributed without
|
5 |
|
|
-- restriction provided that this copyright statement is not
|
6 |
|
|
-- removed from the file and that any derivative work contains
|
7 |
|
|
-- the original copyright notice and the associated disclaimer.
|
8 |
|
|
--
|
9 |
|
|
-- This source file is free software; you can redistribute it
|
10 |
|
|
-- and/or modify it under the terms of the GNU Lesser General
|
11 |
|
|
-- Public License as published by the Free Software Foundation;
|
12 |
|
|
-- either version 2.1 of the License, or (at your option) any
|
13 |
|
|
-- later version.
|
14 |
|
|
--
|
15 |
|
|
-- This source is distributed in the hope that it will be
|
16 |
|
|
-- useful, but WITHOUT ANY WARRANTY; without even the implied
|
17 |
|
|
-- warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
18 |
|
|
-- PURPOSE. See the GNU Lesser General Public License for more
|
19 |
|
|
-- details.
|
20 |
|
|
--
|
21 |
|
|
-- You should have received a copy of the GNU Lesser General
|
22 |
|
|
-- Public License along with this source; if not, download it
|
23 |
|
|
-- from http://www.opencores.org/lgpl.shtml
|
24 |
|
|
-------------------------------------------------------------------------------
|
25 |
|
|
-------------------------------------------------------------------------------
|
26 |
|
|
-- File : hibi_wrapper.vhdl
|
27 |
|
|
-- Description : HIBI bus wrapper that has all the possible choises
|
28 |
|
|
-- Implementation can be chosen with generics
|
29 |
|
|
-- Author : Vesa Lahtinen
|
30 |
|
|
-- e-mail : erno.salminen@tut.fi
|
31 |
|
|
-- Project : mikälie
|
32 |
|
|
-- Design : Do not use term design when you mean system
|
33 |
|
|
-- Date : 07.04.2003
|
34 |
|
|
-- Modified :
|
35 |
|
|
--
|
36 |
|
|
-- 12.04.03 Fifo_Depth generic removed from transmitter
|
37 |
|
|
-- 13.04 message stuff removed from receiver and transmitter, es
|
38 |
|
|
--
|
39 |
|
|
-- 15.12.04 names changed
|
40 |
|
|
-- 07.02.05 ES new generics, cfg_rom_en_g will be obsolete
|
41 |
|
|
-- 28.02.2005 ES cfg_rom_en_g removed, cfg_re and cfg_we added
|
42 |
|
|
-- 16.12.2005 ES Removed generics "page_addr_width_g" and "param_addr_with_g"
|
43 |
|
|
-------------------------------------------------------------------------------
|
44 |
|
|
library ieee;
|
45 |
|
|
use ieee.std_logic_1164.all;
|
46 |
|
|
use ieee.std_logic_arith.all;
|
47 |
|
|
use ieee.std_logic_unsigned.all;
|
48 |
|
|
use work.hibiv2_pkg.all;
|
49 |
|
|
|
50 |
|
|
|
51 |
|
|
|
52 |
|
|
entity hibi_wrapper_r1 is
|
53 |
|
|
generic (
|
54 |
|
|
-- Note: n_ = number of,
|
55 |
|
|
-- lte = less than or equal,
|
56 |
|
|
-- gte = greater than or equal
|
57 |
|
|
|
58 |
|
|
-- Structural settings.
|
59 |
|
|
-- All widths are given in bits
|
60 |
|
|
addr_width_g : integer := 32; -- lte data_width
|
61 |
|
|
data_width_g : integer := 32;
|
62 |
|
|
comm_width_g : integer := 3; -- practically always 3
|
63 |
|
|
counter_width_g : integer := 7; -- gte (n_agents, max_send...)
|
64 |
|
|
debug_width_g : integer := 0; -- for special monitors
|
65 |
|
|
|
66 |
|
|
-- All FIFO depths are given in words
|
67 |
|
|
-- Allowed values 0,2,3... words.
|
68 |
|
|
-- Prefix msg refers to hi-prior data
|
69 |
|
|
rx_fifo_depth_g : integer := 5;
|
70 |
|
|
tx_fifo_depth_g : integer := 5;
|
71 |
|
|
rx_msg_fifo_depth_g : integer := 5;
|
72 |
|
|
tx_msg_fifo_depth_g : integer := 5;
|
73 |
|
|
|
74 |
|
|
-- Clocking and synchronization
|
75 |
|
|
-- fifo_sel: 0 synch multiclk, 1 basic GALS,
|
76 |
|
|
-- 2 Gray FIFO (depth=2^n!), 3 mixed clock pausible
|
77 |
|
|
fifo_sel_g : integer := 0; -- use 0 for synchronous systems
|
78 |
|
|
-- E.g. Synch_multiclk FIFOs must know the ratio of frequencies
|
79 |
|
|
rel_agent_freq_g : integer := 1;
|
80 |
|
|
rel_bus_freq_g : integer := 1;
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
-- Functional: addressing settings
|
84 |
|
|
addr_g : integer := 46; -- unique for each wrapper
|
85 |
|
|
inv_addr_en_g : integer := 0; -- only for bridges
|
86 |
|
|
multicast_en_g : integer := 0; -- enable special addressing
|
87 |
|
|
|
88 |
|
|
-- Functional: arbitration
|
89 |
|
|
-- arb_type 0 round-robin, 1 priority, 2 combined, 3 DAA.
|
90 |
|
|
-- TDMA is enabled by setting n_time_slots > 0
|
91 |
|
|
-- Ensure that all wrappers in a segment agree on arb_type,
|
92 |
|
|
-- n_agents, and n_slots. Max_send can be wrapper-specific.
|
93 |
|
|
n_agents_g : integer := 4; -- within one segment
|
94 |
|
|
prior_g : integer := 2; -- lte n_agents
|
95 |
|
|
max_send_g : integer := 50; -- in words, 0 means unlimited
|
96 |
|
|
n_time_slots_g : integer := 0; -- for TDMA
|
97 |
|
|
arb_type_g : integer := 0;
|
98 |
|
|
keep_slot_g : integer := 1; -- for TDMA
|
99 |
|
|
|
100 |
|
|
-- Func/Stuctural: (Run-time re)configuration memory
|
101 |
|
|
id_g : integer := 5; -- used instead of addr in recfg
|
102 |
|
|
id_width_g : integer := 4; -- gte(log2(id_g))
|
103 |
|
|
base_id_g : integer := 5; -- only for bridges
|
104 |
|
|
cfg_re_g : integer := 0; -- enable reading config
|
105 |
|
|
cfg_we_g : integer := 0; -- enable writing config
|
106 |
|
|
n_extra_params_g : integer := 0; -- app-specific registers
|
107 |
|
|
-- Having multiple pages allows fast reconfig
|
108 |
|
|
n_cfg_pages_g : integer := 1
|
109 |
|
|
-- Note that cfg memory initialization is done with separate
|
110 |
|
|
-- package if you have many time slots or configuration pages
|
111 |
|
|
|
112 |
|
|
);
|
113 |
|
|
|
114 |
|
|
port (
|
115 |
|
|
bus_clk : in std_logic;
|
116 |
|
|
agent_clk : in std_logic;
|
117 |
|
|
-- pulsed clocks as used in pausible clock scheme
|
118 |
|
|
-- IF fifo 1 and fast synch is used, sync clocks is used as the
|
119 |
|
|
-- HIBI synch clock
|
120 |
|
|
bus_sync_clk : in std_logic;
|
121 |
|
|
agent_sync_clk : in std_logic;
|
122 |
|
|
rst_n : in std_logic;
|
123 |
|
|
|
124 |
|
|
bus_av_in : in std_logic;
|
125 |
|
|
bus_data_in : in std_logic_vector (data_width_g-1 downto 0);
|
126 |
|
|
bus_comm_in : in std_logic_vector (comm_width_g-1 downto 0);
|
127 |
|
|
bus_full_in : in std_logic;
|
128 |
|
|
bus_lock_in : in std_logic;
|
129 |
|
|
|
130 |
|
|
agent_av_in : in std_logic;
|
131 |
|
|
agent_data_in : in std_logic_vector (data_width_g-1 downto 0);
|
132 |
|
|
agent_comm_in : in std_logic_vector (comm_width_g-1 downto 0);
|
133 |
|
|
agent_we_in : in std_logic;
|
134 |
|
|
agent_re_in : in std_logic;
|
135 |
|
|
|
136 |
|
|
agent_msg_av_in : in std_logic;
|
137 |
|
|
agent_msg_data_in : in std_logic_vector (data_width_g-1 downto 0);
|
138 |
|
|
agent_msg_comm_in : in std_logic_vector (comm_width_g-1 downto 0);
|
139 |
|
|
agent_msg_we_in : in std_logic;
|
140 |
|
|
agent_msg_re_in : in std_logic;
|
141 |
|
|
|
142 |
|
|
bus_av_out : out std_logic;
|
143 |
|
|
bus_data_out : out std_logic_vector (data_width_g-1 downto 0);
|
144 |
|
|
bus_comm_out : out std_logic_vector (comm_width_g-1 downto 0);
|
145 |
|
|
bus_lock_out : out std_logic;
|
146 |
|
|
bus_full_out : out std_logic;
|
147 |
|
|
|
148 |
|
|
agent_av_out : out std_logic;
|
149 |
|
|
agent_data_out : out std_logic_vector (data_width_g-1 downto 0);
|
150 |
|
|
agent_comm_out : out std_logic_vector (comm_width_g-1 downto 0);
|
151 |
|
|
agent_empty_out : out std_logic;
|
152 |
|
|
agent_one_d_out : out std_logic;
|
153 |
|
|
agent_full_out : out std_logic;
|
154 |
|
|
agent_one_p_out : out std_logic;
|
155 |
|
|
|
156 |
|
|
agent_msg_av_out : out std_logic;
|
157 |
|
|
agent_msg_data_out : out std_logic_vector (data_width_g-1 downto 0);
|
158 |
|
|
agent_msg_comm_out : out std_logic_vector (comm_width_g-1 downto 0);
|
159 |
|
|
agent_msg_empty_out : out std_logic;
|
160 |
|
|
agent_msg_one_d_out : out std_logic;
|
161 |
|
|
agent_msg_full_out : out std_logic;
|
162 |
|
|
agent_msg_one_p_out : out std_logic
|
163 |
|
|
|
164 |
|
|
-- synthesis translate_off
|
165 |
|
|
;
|
166 |
|
|
debug_out : out std_logic_vector(debug_width_g-1 downto 0);
|
167 |
|
|
debug_in : in std_logic_vector(debug_width_g-1 downto 0)
|
168 |
|
|
-- synthesis translate_on
|
169 |
|
|
|
170 |
|
|
);
|
171 |
|
|
end hibi_wrapper_r1;
|
172 |
|
|
|
173 |
|
|
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
architecture structural of hibi_wrapper_r1 is
|
177 |
|
|
|
178 |
|
|
component double_fifo_mux_rd
|
179 |
|
|
generic (
|
180 |
|
|
fifo_sel_g : integer := 0;
|
181 |
|
|
re_freq_g : integer := 1;
|
182 |
|
|
we_freq_g : integer := 1;
|
183 |
|
|
depth_0_g : integer := 0;
|
184 |
|
|
depth_1_g : integer := 0;
|
185 |
|
|
data_width_g : integer := 0;
|
186 |
|
|
debug_width_g : integer := 0;
|
187 |
|
|
comm_width_g : integer := 0
|
188 |
|
|
);
|
189 |
|
|
port (
|
190 |
|
|
clk_re : in std_logic;
|
191 |
|
|
clk_we : in std_logic;
|
192 |
|
|
clk_re_pls : in std_logic;
|
193 |
|
|
clk_we_pls : in std_logic;
|
194 |
|
|
rst_n : in std_logic;
|
195 |
|
|
|
196 |
|
|
av_0_in : in std_logic;
|
197 |
|
|
data_0_in : in std_logic_vector (data_width_g-1 downto 0);
|
198 |
|
|
comm_0_in : in std_logic_vector (comm_width_g-1 downto 0);
|
199 |
|
|
we_0_in : in std_logic;
|
200 |
|
|
one_p_0_out : out std_logic;
|
201 |
|
|
full_0_out : out std_logic;
|
202 |
|
|
|
203 |
|
|
av_1_in : in std_logic;
|
204 |
|
|
data_1_in : in std_logic_vector (data_width_g-1 downto 0);
|
205 |
|
|
comm_1_in : in std_logic_vector (comm_width_g-1 downto 0);
|
206 |
|
|
we_1_in : in std_logic;
|
207 |
|
|
full_1_out : out std_logic;
|
208 |
|
|
one_p_1_out : out std_logic;
|
209 |
|
|
|
210 |
|
|
re_in : in std_logic;
|
211 |
|
|
av_out : out std_logic;
|
212 |
|
|
data_out : out std_logic_vector (data_width_g-1 downto 0);
|
213 |
|
|
comm_out : out std_logic_vector (comm_width_g-1 downto 0);
|
214 |
|
|
empty_out : out std_logic;
|
215 |
|
|
one_d_out : out std_logic;
|
216 |
|
|
debug_out : out std_logic_vector(debug_width_g downto 0)
|
217 |
|
|
);
|
218 |
|
|
end component; --double_fifo_mux_rd
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
component double_fifo_demux_wr
|
223 |
|
|
generic (
|
224 |
|
|
fifo_sel_g : integer := 0;
|
225 |
|
|
re_freq_g : integer := 1;
|
226 |
|
|
we_freq_g : integer := 1;
|
227 |
|
|
depth_0_g : integer := 0;
|
228 |
|
|
depth_1_g : integer := 0;
|
229 |
|
|
data_width_g : integer := 0;
|
230 |
|
|
debug_width_g : integer := 0;
|
231 |
|
|
comm_width_g : integer := 0
|
232 |
|
|
);
|
233 |
|
|
port (
|
234 |
|
|
clk_re : in std_logic;
|
235 |
|
|
clk_we : in std_logic;
|
236 |
|
|
clk_re_pls : in std_logic;
|
237 |
|
|
clk_we_pls : in std_logic;
|
238 |
|
|
rst_n : in std_logic;
|
239 |
|
|
|
240 |
|
|
av_in : in std_logic;
|
241 |
|
|
data_in : in std_logic_vector (data_width_g-1 downto 0);
|
242 |
|
|
comm_in : in std_logic_vector (comm_width_g-1 downto 0);
|
243 |
|
|
we_in : in std_logic;
|
244 |
|
|
one_p_out : out std_logic;
|
245 |
|
|
full_out : out std_logic;
|
246 |
|
|
|
247 |
|
|
re_0_in : in std_logic;
|
248 |
|
|
av_0_out : out std_logic;
|
249 |
|
|
data_0_out : out std_logic_vector (data_width_g-1 downto 0);
|
250 |
|
|
comm_0_out : out std_logic_vector (comm_width_g-1 downto 0);
|
251 |
|
|
empty_0_out : out std_logic;
|
252 |
|
|
one_d_0_out : out std_logic;
|
253 |
|
|
|
254 |
|
|
re_1_in : in std_logic;
|
255 |
|
|
av_1_out : out std_logic;
|
256 |
|
|
data_1_out : out std_logic_vector (data_width_g-1 downto 0);
|
257 |
|
|
comm_1_out : out std_logic_vector (comm_width_g-1 downto 0);
|
258 |
|
|
empty_1_out : out std_logic;
|
259 |
|
|
one_d_1_out : out std_logic;
|
260 |
|
|
debug_out : out std_logic_vector(debug_width_g downto 0)
|
261 |
|
|
);
|
262 |
|
|
end component;
|
263 |
|
|
|
264 |
|
|
component receiver
|
265 |
|
|
generic (
|
266 |
|
|
id_g : integer := 5;
|
267 |
|
|
base_id_g : integer := 5;
|
268 |
|
|
addr_g : integer := 46;
|
269 |
|
|
id_width_g : integer := 4;
|
270 |
|
|
data_width_g : integer := 32;
|
271 |
|
|
addr_width_g : integer := 32; -- in bits
|
272 |
|
|
cfg_addr_width_g : integer := 16; -- in bits 04.03.2005
|
273 |
|
|
cfg_re_g : integer := 1; -- 07.02.05
|
274 |
|
|
cfg_we_g : integer := 1; -- 07.02.05
|
275 |
|
|
multicast_en_g : integer := 1; -- 07.02.05
|
276 |
|
|
inv_addr_en_g : integer := 0
|
277 |
|
|
);
|
278 |
|
|
port (
|
279 |
|
|
clk : in std_logic;
|
280 |
|
|
rst_n : in std_logic;
|
281 |
|
|
av_in : in std_logic;
|
282 |
|
|
data_in : in std_logic_vector (data_width_g-1 downto 0);
|
283 |
|
|
comm_in : in std_logic_vector (comm_width_c-1 downto 0);
|
284 |
|
|
cfg_rd_rdy_in : in std_logic;
|
285 |
|
|
av_out : out std_logic;
|
286 |
|
|
data_out : out std_logic_vector (data_width_g-1 downto 0);
|
287 |
|
|
comm_out : out std_logic_vector (comm_width_c-1 downto 0);
|
288 |
|
|
we_out : out std_logic;
|
289 |
|
|
full_in : in std_logic;
|
290 |
|
|
one_p_in : in std_logic;
|
291 |
|
|
cfg_we_out : out std_logic;
|
292 |
|
|
cfg_re_out : out std_logic;
|
293 |
|
|
cfg_data_out : out std_logic_vector (data_width_g -1 downto 0);
|
294 |
|
|
cfg_addr_out : out std_logic_vector (cfg_addr_width_g -1 downto 0);
|
295 |
|
|
cfg_ret_addr_out : out std_logic_vector (addr_width_g -1 downto 0);
|
296 |
|
|
full_out : out std_logic
|
297 |
|
|
);
|
298 |
|
|
end component; --receiver;
|
299 |
|
|
|
300 |
|
|
component transmitter
|
301 |
|
|
generic (
|
302 |
|
|
id_g : integer := 5;
|
303 |
|
|
base_id_g : integer := 5;
|
304 |
|
|
addr_g : integer := 46;
|
305 |
|
|
id_width_g : integer := 4;
|
306 |
|
|
data_width_g : integer := 32; -- in bits
|
307 |
|
|
addr_width_g : integer := 32; -- in bits!
|
308 |
|
|
comm_width_g : integer := 3;
|
309 |
|
|
counter_width_g : integer := 8;
|
310 |
|
|
|
311 |
|
|
cfg_addr_width_g : integer := 2; -- 16.12.05
|
312 |
|
|
arb_type_g : integer := 0;
|
313 |
|
|
prior_g : integer := 2;
|
314 |
|
|
inv_addr_en_g : integer := 0;
|
315 |
|
|
max_send_g : integer := 50;
|
316 |
|
|
n_agents_g : integer := 4;
|
317 |
|
|
n_cfg_pages_g : integer := 1;
|
318 |
|
|
n_time_slots_g : integer := 0;
|
319 |
|
|
keep_slot_g : integer := 1;
|
320 |
|
|
n_extra_params_g : integer := 0;
|
321 |
|
|
cfg_we_g : integer := 0; -- 28.02.05
|
322 |
|
|
cfg_re_g : integer := 0; -- 07.02.05
|
323 |
|
|
debug_width_g : integer := 0
|
324 |
|
|
);
|
325 |
|
|
port (
|
326 |
|
|
clk : in std_logic;
|
327 |
|
|
rst_n : in std_logic;
|
328 |
|
|
-- from bus
|
329 |
|
|
lock_in : in std_logic;
|
330 |
|
|
full_in : in std_logic;
|
331 |
|
|
|
332 |
|
|
-- from rx
|
333 |
|
|
cfg_data_in : in std_logic_vector (data_width_g -1 downto 0);
|
334 |
|
|
cfg_addr_in : in std_logic_vector (cfg_addr_width_g -1 downto 0); -- 16.12.05
|
335 |
|
|
cfg_ret_addr_in : in std_logic_vector (addr_width_g -1 downto 0);
|
336 |
|
|
cfg_re_in : in std_logic;
|
337 |
|
|
cfg_we_in : in std_logic;
|
338 |
|
|
|
339 |
|
|
-- from fifo
|
340 |
|
|
av_in : in std_logic;
|
341 |
|
|
data_in : in std_logic_vector (data_width_g-1 downto 0);
|
342 |
|
|
comm_in : in std_logic_vector (comm_width_g-1 downto 0);
|
343 |
|
|
empty_in : in std_logic;
|
344 |
|
|
one_d_in : in std_logic;
|
345 |
|
|
-- to bus
|
346 |
|
|
av_out : out std_logic;
|
347 |
|
|
data_out : out std_logic_vector (data_width_g-1 downto 0);
|
348 |
|
|
comm_out : out std_logic_vector (comm_width_g-1 downto 0);
|
349 |
|
|
lock_out : out std_logic;
|
350 |
|
|
-- to rx
|
351 |
|
|
cfg_rd_rdy_out : out std_logic;
|
352 |
|
|
|
353 |
|
|
-- to fifo
|
354 |
|
|
re_out : out std_logic
|
355 |
|
|
|
356 |
|
|
-- synthesis translate_off
|
357 |
|
|
;
|
358 |
|
|
debug_out : out std_logic_vector(debug_width_g-1 downto 0);
|
359 |
|
|
debug_in : in std_logic_vector(debug_width_g-1 downto 0)
|
360 |
|
|
-- synthesis translate_on
|
361 |
|
|
);
|
362 |
|
|
end component; --transmitter;
|
363 |
|
|
|
364 |
|
|
|
365 |
|
|
-- 16.12.05 Poistin genericit param_addr_width_g ja page_addr_width_g
|
366 |
|
|
-- Luodaan vastaavat vakioarvot.
|
367 |
|
|
-- Nykyisellään identtinen koodi on cfg_muistin sisällä! (pitää yrittää, että
|
368 |
|
|
-- olis vain yhdessä paikassa)
|
369 |
|
|
-- Calculate minimum of 1 and "value"
|
370 |
|
|
-- Required for reserving signals for tslots ans extra_params
|
371 |
|
|
-- (Design compiler does not handle empty arrays (e.g. 0 downto -1),
|
372 |
|
|
-- Precision handles them well)
|
373 |
|
|
function max_with_1 (
|
374 |
|
|
constant value : integer)
|
375 |
|
|
return integer is
|
376 |
|
|
begin -- max_with_1
|
377 |
|
|
if value = 0 then
|
378 |
|
|
return 1;
|
379 |
|
|
else
|
380 |
|
|
return value;
|
381 |
|
|
end if;
|
382 |
|
|
end max_with_1;
|
383 |
|
|
|
384 |
|
|
function log2 (
|
385 |
|
|
constant value : integer)
|
386 |
|
|
return integer is
|
387 |
|
|
|
388 |
|
|
variable temp : integer := 1;
|
389 |
|
|
variable counter : integer := 0;
|
390 |
|
|
begin -- log2
|
391 |
|
|
-- Unbounded loops are NOt synthesizable
|
392 |
|
|
|
393 |
|
|
-- while temp < value loop
|
394 |
|
|
-- temp := temp*2;
|
395 |
|
|
-- counter := counter+1;
|
396 |
|
|
-- end loop;
|
397 |
|
|
|
398 |
|
|
temp := 1;
|
399 |
|
|
counter := 0;
|
400 |
|
|
for i in 0 to 31 loop
|
401 |
|
|
if temp < value then
|
402 |
|
|
temp := temp*2;
|
403 |
|
|
counter := counter+1;
|
404 |
|
|
end if;
|
405 |
|
|
end loop;
|
406 |
|
|
|
407 |
|
|
|
408 |
|
|
|
409 |
|
|
return counter;
|
410 |
|
|
end log2;
|
411 |
|
|
|
412 |
|
|
|
413 |
|
|
constant n_time_slots_tmp_c : integer := max_with_1 (n_time_slots_g);
|
414 |
|
|
constant n_extra_params_tmp_c : integer := max_with_1 (n_extra_params_g);
|
415 |
|
|
|
416 |
|
|
-- Calculate the maximum size of configuration
|
417 |
|
|
-- memory page. There are 8 parameters and address (which nowadays requires exactly one
|
418 |
|
|
-- place in mem), each time slots requires 3 parameters (start, stop, owner),
|
419 |
|
|
-- and there may be some application specific extra parameters as well.
|
420 |
|
|
-- E.g. if n_time_slots_g=n_extra_params_g=0 then page_size_c= 8+1+3+1= 13 parameters
|
421 |
|
|
constant page_size_c : integer := 8 + 1 + (n_time_slots_tmp_c * 3) + n_extra_params_tmp_c;
|
422 |
|
|
|
423 |
|
|
constant page_addr_width_c : integer := log2 (page_size_c);
|
424 |
|
|
constant param_addr_width_c : integer := log2 (n_cfg_pages_g) +1;
|
425 |
|
|
constant cfg_addr_width_c : integer := param_addr_width_c + page_addr_width_c;
|
426 |
|
|
-- Signals can be viewed from Modelsim
|
427 |
|
|
signal pag : integer := page_addr_width_c;
|
428 |
|
|
signal par : integer := param_addr_width_c;
|
429 |
|
|
signal cfg_a : integer := cfg_addr_width_c;
|
430 |
|
|
-- 16.12.05 muutokset tästä ylöspäin
|
431 |
|
|
|
432 |
|
|
|
433 |
|
|
|
434 |
|
|
|
435 |
|
|
|
436 |
|
|
-- Signals (Conf. mem => ) Transmitter => Receiver
|
437 |
|
|
-- signal cfg_rom_en_tx_rx : std_logic;
|
438 |
|
|
-- signal id_tx_rx : std_logic_vector ( id_width_g-1 downto 0);
|
439 |
|
|
-- signal base_id_tx_rx : std_logic_vector ( id_width_g -1 downto 0);
|
440 |
|
|
-- signal base_addr_tx_rx : std_logic_vector ( addr_width_g -1 downto 0);
|
441 |
|
|
|
442 |
|
|
-- Tx => Rx
|
443 |
|
|
signal cfg_rd_rdy_tx_rx : std_logic;
|
444 |
|
|
|
445 |
|
|
-- Signals Receiver => Transmitter
|
446 |
|
|
signal cfg_addr_rx_tx : std_logic_vector (cfg_addr_width_c -1 downto 0);
|
447 |
|
|
signal cfg_data_rx_tx : std_logic_vector (data_width_g-1 downto 0);
|
448 |
|
|
signal cfg_ret_addr_rx_tx : std_logic_vector (addr_width_g -1 downto 0);
|
449 |
|
|
signal cfg_re_rx_tx : std_logic;
|
450 |
|
|
signal cfg_we_rx_tx : std_logic;
|
451 |
|
|
|
452 |
|
|
-- Rx => Rx-fifo
|
453 |
|
|
signal av_rx_fifo : std_logic;
|
454 |
|
|
signal data_rx_fifo : std_logic_vector (data_width_g-1 downto 0);
|
455 |
|
|
signal comm_rx_fifo : std_logic_vector (comm_width_g-1 downto 0);
|
456 |
|
|
signal we_rx_fifo : std_logic;
|
457 |
|
|
signal full_fifo_rx : std_logic;
|
458 |
|
|
signal one_p_fifo_rx : std_logic;
|
459 |
|
|
|
460 |
|
|
-- Tx-fifo => Tx
|
461 |
|
|
signal av_fifo_tx : std_logic;
|
462 |
|
|
signal data_fifo_tx : std_logic_vector (data_width_g-1 downto 0);
|
463 |
|
|
signal comm_fifo_tx : std_logic_vector (comm_width_g-1 downto 0);
|
464 |
|
|
signal re_tx_fifo : std_logic;
|
465 |
|
|
signal empty_fifo_tx : std_logic;
|
466 |
|
|
signal one_d_fifo_tx : std_logic;
|
467 |
|
|
|
468 |
|
|
|
469 |
|
|
begin -- structural_muxed_tx_fifos
|
470 |
|
|
|
471 |
|
|
rx_fifo_mux : double_fifo_demux_wr
|
472 |
|
|
generic map(
|
473 |
|
|
fifo_sel_g => fifo_sel_g,
|
474 |
|
|
re_freq_g => rel_agent_freq_g,
|
475 |
|
|
we_freq_g => rel_bus_freq_g,
|
476 |
|
|
depth_0_g => rx_msg_fifo_depth_g,
|
477 |
|
|
depth_1_g => rx_fifo_depth_g,
|
478 |
|
|
data_width_g => data_width_g,
|
479 |
|
|
debug_width_g => 0,
|
480 |
|
|
comm_width_g => comm_width_g
|
481 |
|
|
)
|
482 |
|
|
port map(
|
483 |
|
|
-- re is handled by agent side, we by bus side
|
484 |
|
|
clk_re => agent_clk,
|
485 |
|
|
clk_we => bus_clk,
|
486 |
|
|
clk_re_pls => agent_sync_clk,
|
487 |
|
|
clk_we_pls => bus_sync_clk,
|
488 |
|
|
rst_n => rst_n,
|
489 |
|
|
|
490 |
|
|
av_in => av_rx_fifo,
|
491 |
|
|
data_in => data_rx_fifo,
|
492 |
|
|
comm_in => comm_rx_fifo,
|
493 |
|
|
we_in => we_rx_fifo,
|
494 |
|
|
full_out => full_fifo_rx,
|
495 |
|
|
one_p_out => one_p_fifo_rx,
|
496 |
|
|
|
497 |
|
|
re_0_in => agent_msg_re_in,
|
498 |
|
|
av_0_out => agent_msg_av_out,
|
499 |
|
|
data_0_out => agent_msg_data_out,
|
500 |
|
|
comm_0_out => agent_msg_comm_out,
|
501 |
|
|
empty_0_out => agent_msg_empty_out,
|
502 |
|
|
one_d_0_out => agent_msg_one_d_out,
|
503 |
|
|
|
504 |
|
|
re_1_in => agent_re_in,
|
505 |
|
|
av_1_out => agent_av_out,
|
506 |
|
|
data_1_out => agent_data_out,
|
507 |
|
|
comm_1_out => agent_comm_out,
|
508 |
|
|
empty_1_out => agent_empty_out,
|
509 |
|
|
one_d_1_out => agent_one_d_out
|
510 |
|
|
);
|
511 |
|
|
|
512 |
|
|
|
513 |
|
|
|
514 |
|
|
tx_fifo_mux : double_fifo_mux_rd
|
515 |
|
|
generic map(
|
516 |
|
|
fifo_sel_g => fifo_sel_g,
|
517 |
|
|
re_freq_g => rel_bus_freq_g,
|
518 |
|
|
we_freq_g => rel_agent_freq_g,
|
519 |
|
|
depth_0_g => tx_msg_fifo_depth_g,
|
520 |
|
|
depth_1_g => tx_fifo_depth_g,
|
521 |
|
|
data_width_g => data_width_g,
|
522 |
|
|
debug_width_g => 0,
|
523 |
|
|
comm_width_g => comm_width_g
|
524 |
|
|
)
|
525 |
|
|
port map(
|
526 |
|
|
-- re bus side, we agent side
|
527 |
|
|
clk_re => bus_clk,
|
528 |
|
|
clk_we => agent_clk,
|
529 |
|
|
clk_re_pls => bus_sync_clk,
|
530 |
|
|
clk_we_pls => agent_sync_clk,
|
531 |
|
|
rst_n => rst_n,
|
532 |
|
|
|
533 |
|
|
av_0_in => agent_msg_av_in,
|
534 |
|
|
data_0_in => agent_msg_data_in,
|
535 |
|
|
comm_0_in => agent_msg_comm_in,
|
536 |
|
|
we_0_in => agent_msg_we_in,
|
537 |
|
|
one_p_0_out => agent_msg_one_p_out,
|
538 |
|
|
full_0_out => agent_msg_full_out,
|
539 |
|
|
|
540 |
|
|
data_1_in => agent_data_in,
|
541 |
|
|
comm_1_in => agent_comm_in,
|
542 |
|
|
av_1_in => agent_av_in,
|
543 |
|
|
we_1_in => agent_we_in,
|
544 |
|
|
one_p_1_out => agent_one_p_out,
|
545 |
|
|
full_1_out => agent_full_out,
|
546 |
|
|
|
547 |
|
|
re_in => re_tx_fifo,
|
548 |
|
|
data_out => data_fifo_tx,
|
549 |
|
|
comm_out => comm_fifo_tx,
|
550 |
|
|
av_out => av_fifo_tx,
|
551 |
|
|
empty_out => empty_fifo_tx,
|
552 |
|
|
one_d_out => one_d_fifo_tx
|
553 |
|
|
);
|
554 |
|
|
|
555 |
|
|
rx_unit : receiver
|
556 |
|
|
-- rx_unit : entity work.receiver
|
557 |
|
|
generic map(
|
558 |
|
|
id_g => id_g,
|
559 |
|
|
base_id_g => base_id_g,
|
560 |
|
|
id_width_g => id_width_g,
|
561 |
|
|
addr_g => addr_g,
|
562 |
|
|
data_width_g => data_width_g,
|
563 |
|
|
addr_width_g => addr_width_g,
|
564 |
|
|
cfg_addr_width_g => cfg_addr_width_c,
|
565 |
|
|
cfg_re_g => cfg_re_g,
|
566 |
|
|
cfg_we_g => cfg_we_g,
|
567 |
|
|
multicast_en_g => multicast_en_g,
|
568 |
|
|
inv_addr_en_g => inv_addr_en_g
|
569 |
|
|
)
|
570 |
|
|
port map(
|
571 |
|
|
clk => bus_clk,
|
572 |
|
|
rst_n => rst_n,
|
573 |
|
|
|
574 |
|
|
av_in => bus_av_in,
|
575 |
|
|
data_in => bus_data_in,
|
576 |
|
|
comm_in => bus_comm_in,
|
577 |
|
|
cfg_rd_rdy_in => cfg_rd_rdy_tx_rx,
|
578 |
|
|
full_in => full_fifo_rx,
|
579 |
|
|
one_p_in => one_p_fifo_rx,
|
580 |
|
|
|
581 |
|
|
--id_in => id_tx_rx,
|
582 |
|
|
--base_addr_in => base_addr_tx_rx,
|
583 |
|
|
--inv_addr_en_in => cfg_rom_en_tx_rx,
|
584 |
|
|
|
585 |
|
|
av_out => av_rx_fifo,
|
586 |
|
|
data_out => data_rx_fifo,
|
587 |
|
|
comm_out => comm_rx_fifo,
|
588 |
|
|
we_out => we_rx_fifo,
|
589 |
|
|
|
590 |
|
|
cfg_addr_out => cfg_addr_rx_tx,
|
591 |
|
|
cfg_data_out => cfg_data_rx_tx,
|
592 |
|
|
cfg_ret_addr_out => cfg_ret_addr_rx_tx,
|
593 |
|
|
cfg_we_out => cfg_we_rx_tx,
|
594 |
|
|
cfg_re_out => cfg_re_rx_tx,
|
595 |
|
|
full_out => bus_full_out
|
596 |
|
|
);
|
597 |
|
|
|
598 |
|
|
|
599 |
|
|
|
600 |
|
|
|
601 |
|
|
tx_unit : transmitter
|
602 |
|
|
-- tx_unit : entity work.transmitter
|
603 |
|
|
generic map(
|
604 |
|
|
data_width_g => data_width_g,
|
605 |
|
|
addr_width_g => addr_width_g,
|
606 |
|
|
comm_width_g => comm_width_g,
|
607 |
|
|
counter_width_g => counter_width_g,
|
608 |
|
|
|
609 |
|
|
id_g => id_g,
|
610 |
|
|
id_width_g => id_width_g,
|
611 |
|
|
base_id_g => base_id_g,
|
612 |
|
|
|
613 |
|
|
addr_g => addr_g,
|
614 |
|
|
prior_g => prior_g,
|
615 |
|
|
inv_addr_en_g => inv_addr_en_g,
|
616 |
|
|
max_send_g => max_send_g,
|
617 |
|
|
|
618 |
|
|
cfg_addr_width_g => cfg_addr_width_c,
|
619 |
|
|
-- page_addr_width_g => page_addr_width_g,
|
620 |
|
|
-- param_addr_width_g => param_addr_width_g,
|
621 |
|
|
|
622 |
|
|
arb_type_g => arb_type_g,
|
623 |
|
|
n_agents_g => n_agents_g,
|
624 |
|
|
n_cfg_pages_g => n_cfg_pages_g,
|
625 |
|
|
n_time_slots_g => n_time_slots_g,
|
626 |
|
|
keep_slot_g => keep_slot_g,
|
627 |
|
|
n_extra_params_g => n_extra_params_g,
|
628 |
|
|
cfg_re_g => cfg_re_g,
|
629 |
|
|
cfg_we_g => cfg_we_g,
|
630 |
|
|
debug_width_g => debug_width_g
|
631 |
|
|
)
|
632 |
|
|
port map(
|
633 |
|
|
clk => bus_clk,
|
634 |
|
|
rst_n => rst_n,
|
635 |
|
|
|
636 |
|
|
-- from bus
|
637 |
|
|
lock_in => bus_lock_in,
|
638 |
|
|
full_in => bus_full_in,
|
639 |
|
|
|
640 |
|
|
-- from rx
|
641 |
|
|
cfg_data_in => cfg_data_rx_tx,
|
642 |
|
|
cfg_addr_in => cfg_addr_rx_tx,
|
643 |
|
|
cfg_ret_addr_in => cfg_ret_addr_rx_tx,
|
644 |
|
|
cfg_re_in => cfg_re_rx_tx,
|
645 |
|
|
cfg_we_in => cfg_we_rx_tx,
|
646 |
|
|
|
647 |
|
|
-- from fifo
|
648 |
|
|
av_in => av_fifo_tx,
|
649 |
|
|
data_in => data_fifo_tx,
|
650 |
|
|
comm_in => comm_fifo_tx,
|
651 |
|
|
empty_in => empty_fifo_tx,
|
652 |
|
|
one_d_in => one_d_fifo_tx,
|
653 |
|
|
|
654 |
|
|
-- to bus
|
655 |
|
|
data_out => bus_data_out,
|
656 |
|
|
comm_out => bus_comm_out,
|
657 |
|
|
av_out => bus_av_out,
|
658 |
|
|
lock_out => bus_lock_out,
|
659 |
|
|
|
660 |
|
|
-- to rx
|
661 |
|
|
cfg_rd_rdy_out => cfg_rd_rdy_tx_rx,
|
662 |
|
|
--id_out => id_tx_rx,
|
663 |
|
|
--base_id_out => base_id_tx_rx,
|
664 |
|
|
--base_addr_out => base_addr_tx_rx,
|
665 |
|
|
--inv_addr_en_out => cfg_rom_en_tx_rx,
|
666 |
|
|
|
667 |
|
|
-- to fifo
|
668 |
|
|
re_out => re_tx_fifo
|
669 |
|
|
|
670 |
|
|
--synthesis translate_off
|
671 |
|
|
,
|
672 |
|
|
debug_in => debug_in,
|
673 |
|
|
debug_out => debug_out
|
674 |
|
|
--synthesis translate_on
|
675 |
|
|
);
|
676 |
|
|
|
677 |
|
|
|
678 |
|
|
|
679 |
|
|
end structural;
|