1 |
4 |
schelleg |
|
2 |
|
|
-----------------------------------------------------------------------------
|
3 |
|
|
-- NoCem -- Network on Chip Emulation Tool for System on Chip Research
|
4 |
|
|
-- and Implementations
|
5 |
|
|
--
|
6 |
|
|
-- Copyright (C) 2006 Graham Schelle, Dirk Grunwald
|
7 |
|
|
--
|
8 |
|
|
-- This program is free software; you can redistribute it and/or
|
9 |
|
|
-- modify it under the terms of the GNU General Public License
|
10 |
|
|
-- as published by the Free Software Foundation; either version 2
|
11 |
|
|
-- of the License, or (at your option) any later version.
|
12 |
|
|
--
|
13 |
|
|
-- This program is distributed in the hope that it will be useful,
|
14 |
|
|
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
|
15 |
|
|
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
16 |
|
|
-- GNU General Public License for more details.
|
17 |
|
|
--
|
18 |
|
|
-- You should have received a copy of the GNU General Public License
|
19 |
|
|
-- along with this program; if not, write to the Free Software
|
20 |
|
|
-- Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
21 |
|
|
-- 02110-1301, USA.
|
22 |
|
|
--
|
23 |
|
|
-- The authors can be contacted by email: <schelleg,grunwald>@cs.colorado.edu
|
24 |
|
|
--
|
25 |
|
|
-- or by mail: Campus Box 430, Department of Computer Science,
|
26 |
|
|
-- University of Colorado at Boulder, Boulder, Colorado 80309
|
27 |
|
|
--------------------------------------------------------------------------------
|
28 |
|
|
|
29 |
|
|
|
30 |
|
|
--
|
31 |
2 |
schelleg |
-- Filename: vc_node.vhd
|
32 |
4 |
schelleg |
--
|
33 |
2 |
schelleg |
-- Description: vc_node toplevel instantiation
|
34 |
4 |
schelleg |
--
|
35 |
2 |
schelleg |
|
36 |
|
|
|
37 |
4 |
schelleg |
|
38 |
|
|
|
39 |
2 |
schelleg |
--A Virtual Channel node is connected to Virtual Channels on its input and output ports.
|
40 |
|
|
--This node will do normal data switching, but will also manage allocation
|
41 |
|
|
--of the virtual channels themselves.
|
42 |
|
|
|
43 |
|
|
library IEEE;
|
44 |
|
|
|
45 |
|
|
use IEEE.STD_LOGIC_1164.ALL;
|
46 |
|
|
use IEEE.STD_LOGIC_UNSIGNED.ALL;
|
47 |
|
|
use IEEE.STD_LOGIC_ARITH.ALL;
|
48 |
|
|
|
49 |
|
|
---- Uncomment the following library declaration if instantiating
|
50 |
|
|
---- any Xilinx primitives in this code.
|
51 |
|
|
--library UNISIM;
|
52 |
|
|
--use UNISIM.VComponents.all;
|
53 |
|
|
|
54 |
|
|
|
55 |
|
|
use work.pkg_nocem.all;
|
56 |
|
|
|
57 |
|
|
entity vc_node is
|
58 |
|
|
|
59 |
|
|
Port (
|
60 |
|
|
local_arb_addr : std_logic_vector(NOCEM_AW-1 downto 0);
|
61 |
|
|
|
62 |
|
|
n_datain : in data_word;
|
63 |
|
|
n_pkt_cntrl_in : in pkt_cntrl_word;
|
64 |
|
|
|
65 |
|
|
n_dataout : out data_word;
|
66 |
|
|
n_pkt_cntrl_out : out pkt_cntrl_word;
|
67 |
|
|
|
68 |
|
|
n_channel_cntrl_in : in channel_cntrl_word;
|
69 |
|
|
n_channel_cntrl_out : out channel_cntrl_word;
|
70 |
|
|
|
71 |
|
|
s_datain : in data_word;
|
72 |
|
|
s_pkt_cntrl_in : in pkt_cntrl_word;
|
73 |
|
|
|
74 |
|
|
s_dataout : out data_word;
|
75 |
|
|
s_pkt_cntrl_out : out pkt_cntrl_word;
|
76 |
|
|
|
77 |
|
|
s_channel_cntrl_in : in channel_cntrl_word;
|
78 |
|
|
s_channel_cntrl_out : out channel_cntrl_word;
|
79 |
|
|
|
80 |
|
|
|
81 |
|
|
e_datain : in data_word;
|
82 |
|
|
e_pkt_cntrl_in : in pkt_cntrl_word;
|
83 |
|
|
|
84 |
|
|
e_dataout : out data_word;
|
85 |
|
|
e_pkt_cntrl_out : out pkt_cntrl_word;
|
86 |
|
|
|
87 |
|
|
e_channel_cntrl_in : in channel_cntrl_word;
|
88 |
|
|
e_channel_cntrl_out : out channel_cntrl_word;
|
89 |
|
|
|
90 |
|
|
|
91 |
|
|
w_datain : in data_word;
|
92 |
|
|
w_pkt_cntrl_in : in pkt_cntrl_word;
|
93 |
|
|
|
94 |
|
|
w_dataout : out data_word;
|
95 |
|
|
w_pkt_cntrl_out : out pkt_cntrl_word;
|
96 |
|
|
|
97 |
|
|
w_channel_cntrl_in : in channel_cntrl_word;
|
98 |
|
|
w_channel_cntrl_out : out channel_cntrl_word;
|
99 |
|
|
|
100 |
|
|
ap_datain : in data_word;
|
101 |
|
|
ap_pkt_cntrl_in : in pkt_cntrl_word;
|
102 |
|
|
|
103 |
|
|
ap_dataout : out data_word;
|
104 |
|
|
ap_pkt_cntrl_out : out pkt_cntrl_word;
|
105 |
|
|
|
106 |
|
|
ap_channel_cntrl_in : in channel_cntrl_word;
|
107 |
|
|
ap_channel_cntrl_out : out channel_cntrl_word;
|
108 |
|
|
|
109 |
|
|
clk : in std_logic;
|
110 |
|
|
rst : in std_logic
|
111 |
|
|
|
112 |
|
|
);
|
113 |
|
|
end vc_node;
|
114 |
|
|
|
115 |
|
|
architecture Behavioral of vc_node is
|
116 |
|
|
|
117 |
|
|
-- lots of signals, but needed for the various blocks that write channel control words
|
118 |
|
|
signal n_channel_cntrl_out_vcalloc_n : channel_cntrl_word;
|
119 |
|
|
signal n_channel_cntrl_out_vcalloc_s : channel_cntrl_word;
|
120 |
|
|
signal n_channel_cntrl_out_vcalloc_e : channel_cntrl_word;
|
121 |
|
|
signal n_channel_cntrl_out_vcalloc_w : channel_cntrl_word;
|
122 |
|
|
signal n_channel_cntrl_out_vcalloc_ap : channel_cntrl_word;
|
123 |
|
|
|
124 |
|
|
signal s_channel_cntrl_out_vcalloc_n : channel_cntrl_word;
|
125 |
|
|
signal s_channel_cntrl_out_vcalloc_s : channel_cntrl_word;
|
126 |
|
|
signal s_channel_cntrl_out_vcalloc_e : channel_cntrl_word;
|
127 |
|
|
signal s_channel_cntrl_out_vcalloc_w : channel_cntrl_word;
|
128 |
|
|
signal s_channel_cntrl_out_vcalloc_ap : channel_cntrl_word;
|
129 |
|
|
|
130 |
|
|
signal e_channel_cntrl_out_vcalloc_n : channel_cntrl_word;
|
131 |
|
|
signal e_channel_cntrl_out_vcalloc_s : channel_cntrl_word;
|
132 |
|
|
signal e_channel_cntrl_out_vcalloc_e : channel_cntrl_word;
|
133 |
|
|
signal e_channel_cntrl_out_vcalloc_w : channel_cntrl_word;
|
134 |
|
|
signal e_channel_cntrl_out_vcalloc_ap : channel_cntrl_word;
|
135 |
|
|
|
136 |
|
|
signal w_channel_cntrl_out_vcalloc_n : channel_cntrl_word;
|
137 |
|
|
signal w_channel_cntrl_out_vcalloc_s : channel_cntrl_word;
|
138 |
|
|
signal w_channel_cntrl_out_vcalloc_e : channel_cntrl_word;
|
139 |
|
|
signal w_channel_cntrl_out_vcalloc_w : channel_cntrl_word;
|
140 |
|
|
signal w_channel_cntrl_out_vcalloc_ap : channel_cntrl_word;
|
141 |
|
|
|
142 |
|
|
signal ap_channel_cntrl_out_vcalloc_n : channel_cntrl_word;
|
143 |
|
|
signal ap_channel_cntrl_out_vcalloc_s : channel_cntrl_word;
|
144 |
|
|
signal ap_channel_cntrl_out_vcalloc_e : channel_cntrl_word;
|
145 |
|
|
signal ap_channel_cntrl_out_vcalloc_w : channel_cntrl_word;
|
146 |
|
|
signal ap_channel_cntrl_out_vcalloc_ap : channel_cntrl_word;
|
147 |
|
|
|
148 |
|
|
|
149 |
|
|
signal n_channel_cntrl_out_ch_arb : channel_cntrl_word;
|
150 |
|
|
signal s_channel_cntrl_out_ch_arb : channel_cntrl_word;
|
151 |
|
|
signal e_channel_cntrl_out_ch_arb : channel_cntrl_word;
|
152 |
|
|
signal w_channel_cntrl_out_ch_arb : channel_cntrl_word;
|
153 |
|
|
signal ap_channel_cntrl_out_ch_arb : channel_cntrl_word;
|
154 |
|
|
|
155 |
|
|
|
156 |
|
|
signal arb_grant_output : arb_decision_array(4 downto 0);
|
157 |
|
|
|
158 |
|
|
|
159 |
|
|
signal local_ch_addr_converted : std_logic_vector(4 downto 0);
|
160 |
4 |
schelleg |
|
161 |
2 |
schelleg |
signal channel_word_z : channel_cntrl_word;
|
162 |
|
|
|
163 |
4 |
schelleg |
|
164 |
|
|
|
165 |
2 |
schelleg |
begin
|
166 |
|
|
|
167 |
|
|
|
168 |
|
|
channel_word_z <= (others => '0');
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
|
172 |
|
|
|
173 |
|
|
local_ch_addr_converted <= CONV_STD_LOGIC_VECTOR(2**NOCEM_NORTH_IX,5);
|
174 |
|
|
|
175 |
|
|
|
176 |
|
|
-- VC ALLOCATION BLOCKS (one per outgoing channel)
|
177 |
|
|
I_vc_alloc_n: vc_node_vc_allocator PORT MAP(
|
178 |
|
|
local_ch_addr => ARB_NORTH,
|
179 |
|
|
outoing_vc_status => n_channel_cntrl_in(NOCEM_CHFIFO_VC_EOP_RD_HIX downto NOCEM_CHFIFO_VC_EOP_RD_LIX),
|
180 |
|
|
n_channel_cntrl_in => channel_word_z, --n_channel_cntrl_in,
|
181 |
|
|
n_channel_cntrl_out => open, --n_channel_cntrl_out_vcalloc_n,
|
182 |
|
|
s_channel_cntrl_in => s_channel_cntrl_in,
|
183 |
|
|
s_channel_cntrl_out => s_channel_cntrl_out_vcalloc_n,
|
184 |
|
|
e_channel_cntrl_in => e_channel_cntrl_in,
|
185 |
|
|
e_channel_cntrl_out => e_channel_cntrl_out_vcalloc_n,
|
186 |
|
|
w_channel_cntrl_in => w_channel_cntrl_in,
|
187 |
|
|
w_channel_cntrl_out => w_channel_cntrl_out_vcalloc_n,
|
188 |
|
|
ap_channel_cntrl_in => ap_channel_cntrl_in,
|
189 |
|
|
ap_channel_cntrl_out => ap_channel_cntrl_out_vcalloc_n,
|
190 |
|
|
clk => clk,
|
191 |
|
|
rst => rst
|
192 |
|
|
);
|
193 |
|
|
|
194 |
|
|
I_vc_alloc_s: vc_node_vc_allocator PORT MAP(
|
195 |
|
|
local_ch_addr => ARB_SOUTH,
|
196 |
|
|
outoing_vc_status => s_channel_cntrl_in(NOCEM_CHFIFO_VC_EOP_RD_HIX downto NOCEM_CHFIFO_VC_EOP_RD_LIX),
|
197 |
|
|
n_channel_cntrl_in => n_channel_cntrl_in,
|
198 |
|
|
n_channel_cntrl_out => n_channel_cntrl_out_vcalloc_s,
|
199 |
|
|
s_channel_cntrl_in => channel_word_z, --s_channel_cntrl_in,
|
200 |
|
|
s_channel_cntrl_out => open, --s_channel_cntrl_out_vcalloc_s,
|
201 |
|
|
e_channel_cntrl_in => e_channel_cntrl_in,
|
202 |
|
|
e_channel_cntrl_out => e_channel_cntrl_out_vcalloc_s,
|
203 |
|
|
w_channel_cntrl_in => w_channel_cntrl_in,
|
204 |
|
|
w_channel_cntrl_out => w_channel_cntrl_out_vcalloc_s,
|
205 |
|
|
ap_channel_cntrl_in => ap_channel_cntrl_in,
|
206 |
|
|
ap_channel_cntrl_out => ap_channel_cntrl_out_vcalloc_s,
|
207 |
|
|
clk => clk,
|
208 |
|
|
rst => rst
|
209 |
|
|
);
|
210 |
|
|
|
211 |
|
|
I_vc_alloc_e: vc_node_vc_allocator PORT MAP(
|
212 |
|
|
local_ch_addr => ARB_EAST,
|
213 |
|
|
outoing_vc_status => e_channel_cntrl_in(NOCEM_CHFIFO_VC_EOP_RD_HIX downto NOCEM_CHFIFO_VC_EOP_RD_LIX),
|
214 |
|
|
n_channel_cntrl_in => n_channel_cntrl_in,
|
215 |
|
|
n_channel_cntrl_out => n_channel_cntrl_out_vcalloc_e,
|
216 |
|
|
s_channel_cntrl_in => s_channel_cntrl_in,
|
217 |
|
|
s_channel_cntrl_out => s_channel_cntrl_out_vcalloc_e,
|
218 |
|
|
e_channel_cntrl_in => channel_word_z, --e_channel_cntrl_in,
|
219 |
|
|
e_channel_cntrl_out => open, --e_channel_cntrl_out_vcalloc_e,
|
220 |
|
|
w_channel_cntrl_in => w_channel_cntrl_in,
|
221 |
|
|
w_channel_cntrl_out => w_channel_cntrl_out_vcalloc_e,
|
222 |
|
|
ap_channel_cntrl_in => ap_channel_cntrl_in,
|
223 |
|
|
ap_channel_cntrl_out => ap_channel_cntrl_out_vcalloc_e,
|
224 |
|
|
clk => clk,
|
225 |
|
|
rst => rst
|
226 |
|
|
);
|
227 |
|
|
|
228 |
|
|
I_vc_alloc_w: vc_node_vc_allocator PORT MAP(
|
229 |
|
|
local_ch_addr => ARB_WEST,
|
230 |
|
|
outoing_vc_status => w_channel_cntrl_in(NOCEM_CHFIFO_VC_EOP_RD_HIX downto NOCEM_CHFIFO_VC_EOP_RD_LIX),
|
231 |
|
|
n_channel_cntrl_in => n_channel_cntrl_in,
|
232 |
|
|
n_channel_cntrl_out => n_channel_cntrl_out_vcalloc_w,
|
233 |
|
|
s_channel_cntrl_in => s_channel_cntrl_in,
|
234 |
|
|
s_channel_cntrl_out => s_channel_cntrl_out_vcalloc_w,
|
235 |
|
|
e_channel_cntrl_in => e_channel_cntrl_in,
|
236 |
|
|
e_channel_cntrl_out => e_channel_cntrl_out_vcalloc_w,
|
237 |
|
|
w_channel_cntrl_in => channel_word_z, --w_channel_cntrl_in,
|
238 |
|
|
w_channel_cntrl_out => open, --w_channel_cntrl_out_vcalloc_w,
|
239 |
|
|
ap_channel_cntrl_in => ap_channel_cntrl_in,
|
240 |
|
|
ap_channel_cntrl_out => ap_channel_cntrl_out_vcalloc_w,
|
241 |
|
|
clk => clk,
|
242 |
|
|
rst => rst
|
243 |
|
|
);
|
244 |
|
|
|
245 |
|
|
I_vc_alloc_ap: vc_node_vc_allocator PORT MAP(
|
246 |
|
|
local_ch_addr => ARB_AP,
|
247 |
|
|
outoing_vc_status => ap_channel_cntrl_in(NOCEM_CHFIFO_VC_EOP_RD_HIX downto NOCEM_CHFIFO_VC_EOP_RD_LIX),
|
248 |
|
|
n_channel_cntrl_in => n_channel_cntrl_in,
|
249 |
|
|
n_channel_cntrl_out => n_channel_cntrl_out_vcalloc_ap,
|
250 |
|
|
s_channel_cntrl_in => s_channel_cntrl_in,
|
251 |
|
|
s_channel_cntrl_out => s_channel_cntrl_out_vcalloc_ap,
|
252 |
|
|
e_channel_cntrl_in => e_channel_cntrl_in,
|
253 |
|
|
e_channel_cntrl_out => e_channel_cntrl_out_vcalloc_ap,
|
254 |
|
|
w_channel_cntrl_in => w_channel_cntrl_in,
|
255 |
|
|
w_channel_cntrl_out => w_channel_cntrl_out_vcalloc_ap,
|
256 |
|
|
ap_channel_cntrl_in => channel_word_z, --ap_channel_cntrl_in,
|
257 |
|
|
ap_channel_cntrl_out => open, --ap_channel_cntrl_out_vcalloc_ap,
|
258 |
|
|
clk => clk,
|
259 |
|
|
rst => rst
|
260 |
|
|
);
|
261 |
|
|
|
262 |
|
|
-- ROUTER / PHYSICAL CHANNEL ARBITER
|
263 |
|
|
I_ch_arbiter: vc_node_ch_arbiter PORT MAP(
|
264 |
|
|
arb_grant_output => arb_grant_output,
|
265 |
|
|
n_channel_cntrl_in => n_channel_cntrl_in,
|
266 |
|
|
n_channel_cntrl_out => n_channel_cntrl_out_ch_arb,
|
267 |
|
|
s_channel_cntrl_in => s_channel_cntrl_in,
|
268 |
|
|
s_channel_cntrl_out => s_channel_cntrl_out_ch_arb,
|
269 |
|
|
e_channel_cntrl_in => e_channel_cntrl_in,
|
270 |
|
|
e_channel_cntrl_out => e_channel_cntrl_out_ch_arb,
|
271 |
|
|
w_channel_cntrl_in => w_channel_cntrl_in,
|
272 |
|
|
w_channel_cntrl_out => w_channel_cntrl_out_ch_arb,
|
273 |
|
|
ap_channel_cntrl_in => ap_channel_cntrl_in,
|
274 |
|
|
ap_channel_cntrl_out => ap_channel_cntrl_out_ch_arb,
|
275 |
|
|
clk => clk,
|
276 |
|
|
rst => rst
|
277 |
|
|
);
|
278 |
|
|
|
279 |
|
|
|
280 |
|
|
-- THE SWITCH ITSELF
|
281 |
|
|
I_vc_switch : simple_pkt_local_switch PORT MAP(
|
282 |
|
|
arb_grant_output => arb_grant_output,
|
283 |
|
|
ap_datain => ap_datain,
|
284 |
|
|
ap_dataout => ap_dataout,
|
285 |
|
|
n_datain => n_datain,
|
286 |
|
|
n_dataout => n_dataout,
|
287 |
|
|
s_datain => s_datain,
|
288 |
|
|
s_dataout => s_dataout,
|
289 |
|
|
e_datain => e_datain,
|
290 |
|
|
e_dataout => e_dataout,
|
291 |
|
|
w_datain => w_datain,
|
292 |
|
|
w_dataout => w_dataout,
|
293 |
|
|
n_pkt_cntrl_in => n_pkt_cntrl_in,
|
294 |
|
|
n_pkt_cntrl_out => n_pkt_cntrl_out,
|
295 |
|
|
s_pkt_cntrl_in => s_pkt_cntrl_in,
|
296 |
|
|
s_pkt_cntrl_out => s_pkt_cntrl_out,
|
297 |
|
|
e_pkt_cntrl_in => e_pkt_cntrl_in,
|
298 |
|
|
e_pkt_cntrl_out => e_pkt_cntrl_out,
|
299 |
|
|
w_pkt_cntrl_in => w_pkt_cntrl_in,
|
300 |
|
|
w_pkt_cntrl_out => w_pkt_cntrl_out,
|
301 |
|
|
ap_pkt_cntrl_in => ap_pkt_cntrl_in,
|
302 |
|
|
ap_pkt_cntrl_out => ap_pkt_cntrl_out,
|
303 |
|
|
clk => clk,
|
304 |
|
|
rst => rst
|
305 |
|
|
);
|
306 |
|
|
|
307 |
|
|
|
308 |
|
|
------------------------------------------------------------------------------
|
309 |
|
|
------------------------------------------------------------------------------
|
310 |
|
|
-- OR TOGETHER THE CHANNEL CONTROL OUT SINGALS (JUST FOR SYNTACTICAL -----
|
311 |
|
|
-- PURPOSES, "TRIM LOGIC" WILL EAT MOST IF NOT ALL OF THESE OR'D SIGNALS -----
|
312 |
|
|
------------------------------------------------------------------------------
|
313 |
|
|
------------------------------------------------------------------------------
|
314 |
|
|
|
315 |
|
|
ap_channel_cntrl_out <= ap_channel_cntrl_out_ch_arb or
|
316 |
|
|
ap_channel_cntrl_out_vcalloc_n or
|
317 |
|
|
ap_channel_cntrl_out_vcalloc_s or
|
318 |
|
|
ap_channel_cntrl_out_vcalloc_e or
|
319 |
|
|
ap_channel_cntrl_out_vcalloc_w;-- or
|
320 |
|
|
--ap_channel_cntrl_out_vcalloc_ap;
|
321 |
|
|
|
322 |
|
|
n_channel_cntrl_out <= n_channel_cntrl_out_ch_arb or
|
323 |
|
|
--n_channel_cntrl_out_vcalloc_n or
|
324 |
|
|
n_channel_cntrl_out_vcalloc_s or
|
325 |
|
|
n_channel_cntrl_out_vcalloc_e or
|
326 |
|
|
n_channel_cntrl_out_vcalloc_w or
|
327 |
|
|
n_channel_cntrl_out_vcalloc_ap;
|
328 |
|
|
|
329 |
|
|
s_channel_cntrl_out <= s_channel_cntrl_out_ch_arb or
|
330 |
|
|
s_channel_cntrl_out_vcalloc_n or
|
331 |
|
|
--s_channel_cntrl_out_vcalloc_s or
|
332 |
|
|
s_channel_cntrl_out_vcalloc_e or
|
333 |
|
|
s_channel_cntrl_out_vcalloc_w or
|
334 |
|
|
s_channel_cntrl_out_vcalloc_ap;
|
335 |
|
|
|
336 |
|
|
e_channel_cntrl_out <= e_channel_cntrl_out_ch_arb or
|
337 |
|
|
e_channel_cntrl_out_vcalloc_n or
|
338 |
|
|
e_channel_cntrl_out_vcalloc_s or
|
339 |
|
|
--e_channel_cntrl_out_vcalloc_e or
|
340 |
|
|
e_channel_cntrl_out_vcalloc_w or
|
341 |
|
|
e_channel_cntrl_out_vcalloc_ap;
|
342 |
|
|
|
343 |
|
|
w_channel_cntrl_out <= w_channel_cntrl_out_ch_arb or
|
344 |
|
|
w_channel_cntrl_out_vcalloc_n or
|
345 |
|
|
w_channel_cntrl_out_vcalloc_s or
|
346 |
|
|
w_channel_cntrl_out_vcalloc_e or
|
347 |
|
|
--w_channel_cntrl_out_vcalloc_w or
|
348 |
|
|
w_channel_cntrl_out_vcalloc_ap;
|
349 |
|
|
|
350 |
|
|
|
351 |
|
|
|
352 |
|
|
end Behavioral;
|