1 |
48 |
alirezamon |
`timescale 1ns/1ps
|
2 |
|
|
|
3 |
|
|
//`define MONITORE_PATH
|
4 |
|
|
|
5 |
|
|
/***********************************************************************
|
6 |
|
|
** File: router.v
|
7 |
|
|
**
|
8 |
|
|
** Copyright (C) 2014-2017 Alireza Monemi
|
9 |
|
|
**
|
10 |
|
|
** This file is part of ProNoC
|
11 |
|
|
**
|
12 |
|
|
** ProNoC ( stands for Prototype Network-on-chip) is free software:
|
13 |
|
|
** you can redistribute it and/or modify it under the terms of the GNU
|
14 |
|
|
** Lesser General Public License as published by the Free Software Foundation,
|
15 |
|
|
** either version 2 of the License, or (at your option) any later version.
|
16 |
|
|
**
|
17 |
|
|
** ProNoC is distributed in the hope that it will be useful, but WITHOUT
|
18 |
|
|
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
19 |
|
|
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
20 |
|
|
** Public License for more details.
|
21 |
|
|
**
|
22 |
|
|
** You should have received a copy of the GNU Lesser General Public
|
23 |
|
|
** License along with ProNoC. If not, see .
|
24 |
|
|
**
|
25 |
|
|
**
|
26 |
|
|
** Description:
|
27 |
|
|
** A two stage router
|
28 |
|
|
** stage1: lk-route,sw/VC allocation
|
29 |
|
|
** stage2: switch-traversal
|
30 |
|
|
**************************************************************/
|
31 |
|
|
|
32 |
|
|
|
33 |
|
|
module router_two_stage
|
34 |
|
|
import pronoc_pkg::*;
|
35 |
|
|
|
36 |
|
|
# (
|
37 |
|
|
parameter P = 6 // router port num
|
38 |
|
|
)(
|
39 |
|
|
current_r_addr,// connected to constant parameter
|
40 |
|
|
|
41 |
|
|
chan_in,
|
42 |
|
|
chan_out,
|
43 |
|
|
|
44 |
|
|
ctrl_in,
|
45 |
|
|
ctrl_out,
|
46 |
|
|
|
47 |
|
|
//internal router status
|
48 |
|
|
ivc_info,
|
49 |
|
|
ovc_info,
|
50 |
|
|
iport_info,
|
51 |
|
|
oport_info,
|
52 |
|
|
|
53 |
|
|
smart_ctrl_in,
|
54 |
|
|
|
55 |
|
|
clk,
|
56 |
|
|
reset
|
57 |
|
|
|
58 |
|
|
);
|
59 |
|
|
|
60 |
|
|
|
61 |
|
|
|
62 |
|
|
// The current/neighbor routers addresses/port. These values are fixed in each router and they are supposed to be given as parameter.
|
63 |
|
|
// However, in order to give an identical RTL code to each router, they are given as input ports. The identical RTL code reduces the
|
64 |
|
|
// compilation time. Note that they wont be implemented as input ports in the final synthesized code.
|
65 |
|
|
|
66 |
|
|
input [RAw-1 : 0] current_r_addr;
|
67 |
|
|
|
68 |
|
|
input flit_chanel_t chan_in [P-1 : 0];
|
69 |
|
|
output flit_chanel_t chan_out [P-1 : 0];
|
70 |
|
|
input ctrl_chanel_t ctrl_in [P-1 : 0];
|
71 |
|
|
output ctrl_chanel_t ctrl_out [P-1 : 0];
|
72 |
|
|
input clk,reset;
|
73 |
|
|
|
74 |
|
|
|
75 |
|
|
output ivc_info_t ivc_info [P-1 : 0][V-1 : 0];
|
76 |
|
|
output ovc_info_t ovc_info [P-1 : 0][V-1 : 0];
|
77 |
|
|
output iport_info_t iport_info [P-1 : 0];
|
78 |
|
|
output oport_info_t oport_info [P-1 : 0];
|
79 |
|
|
|
80 |
|
|
input smart_ctrl_t smart_ctrl_in [P-1 : 0];
|
81 |
|
|
|
82 |
|
|
|
83 |
|
|
vsa_ctrl_t vsa_ctrl [P-1 : 0];
|
84 |
|
|
|
85 |
|
|
localparam
|
86 |
|
|
PV = V * P,
|
87 |
|
|
VV = V*V,
|
88 |
|
|
PVV = PV * V,
|
89 |
|
|
P_1 = ( SELF_LOOP_EN=="NO")? P-1 : P,
|
90 |
|
|
PP_1 = P_1 * P,
|
91 |
|
|
PVP_1 = PV * P_1,
|
92 |
|
|
PFw = P*Fw,
|
93 |
|
|
CONG_ALw = CONGw* P, // congestion width per router
|
94 |
|
|
W = WEIGHTw,
|
95 |
|
|
WP = W * P,
|
96 |
|
|
WPP= WP * P,
|
97 |
|
|
PRAw= P * RAw;
|
98 |
|
|
|
99 |
|
|
|
100 |
|
|
|
101 |
|
|
|
102 |
|
|
|
103 |
|
|
|
104 |
|
|
wire [PFw-1 : 0] flit_in_all;
|
105 |
|
|
wire [P-1 : 0] flit_in_wr_all;
|
106 |
|
|
wire [PV-1 : 0] credit_out_all;
|
107 |
|
|
wire [CONG_ALw-1 : 0] congestion_in_all;
|
108 |
|
|
|
109 |
|
|
wire [PFw-1 : 0] flit_out_all;
|
110 |
|
|
wire [P-1 : 0] flit_out_wr_all;
|
111 |
|
|
wire [PV-1 : 0] credit_in_all;
|
112 |
|
|
wire [CONG_ALw-1 : 0] congestion_out_all;
|
113 |
|
|
|
114 |
|
|
|
115 |
|
|
|
116 |
|
|
|
117 |
|
|
// old router verilog code
|
118 |
|
|
|
119 |
|
|
|
120 |
|
|
|
121 |
|
|
//internal wires
|
122 |
|
|
wire [PV-1 : 0] ovc_allocated_all;
|
123 |
|
|
wire [PVV-1 : 0] granted_ovc_num_all;
|
124 |
|
|
wire [PV-1 : 0] ivc_num_getting_sw_grant;
|
125 |
|
|
wire [PV-1 : 0] ivc_num_getting_ovc_grant;
|
126 |
|
|
wire [PVV-1 : 0] spec_ovc_num_all;
|
127 |
|
|
wire [PV-1 : 0] nonspec_first_arbiter_granted_ivc_all;
|
128 |
|
|
wire [PV-1 : 0] spec_first_arbiter_granted_ivc_all;
|
129 |
|
|
wire [PP_1-1 : 0] nonspec_granted_dest_port_all;
|
130 |
|
|
wire [PP_1-1 : 0] spec_granted_dest_port_all;
|
131 |
|
|
wire [PP_1-1 : 0] granted_dest_port_all;
|
132 |
|
|
wire [P-1 : 0] any_ivc_sw_request_granted_all;
|
133 |
|
|
wire [P-1 : 0] any_ovc_granted_in_outport_all;
|
134 |
|
|
wire [P-1 : 0] granted_dst_is_from_a_single_flit_pck;
|
135 |
|
|
// to vc/sw allocator
|
136 |
|
|
wire [PVP_1-1 : 0] dest_port_all;
|
137 |
|
|
wire [PV-1 : 0] ovc_is_assigned_all;
|
138 |
|
|
wire [PV-1 : 0] ivc_request_all;
|
139 |
|
|
wire [PV-1 : 0] assigned_ovc_not_full_all;
|
140 |
|
|
wire [PVV-1: 0] masked_ovc_request_all;
|
141 |
|
|
wire [PV-1 : 0] pck_is_single_flit_all;
|
142 |
|
|
wire [PV-1 : 0] vc_weight_is_consumed_all;
|
143 |
|
|
wire [P-1 : 0] iport_weight_is_consumed_all;
|
144 |
|
|
wire [PV-1 : 0] vsa_ovc_released_all;
|
145 |
|
|
wire [PV-1 : 0] vsa_credit_decreased_all;
|
146 |
|
|
|
147 |
|
|
// to/from the crossbar
|
148 |
|
|
wire [PFw-1 : 0] iport_flit_out_all;
|
149 |
|
|
wire [P-1 : 0] ssa_flit_wr_all;
|
150 |
|
|
reg [PP_1-1 : 0] granted_dest_port_all_delayed;
|
151 |
|
|
wire [PFw-1 : 0] crossbar_flit_out_all;
|
152 |
|
|
wire [P-1 : 0] crossbar_flit_out_wr_all;
|
153 |
|
|
wire [PFw-1 : 0] link_flit_out_all;
|
154 |
|
|
wire [P-1 : 0] link_flit_out_wr_all;
|
155 |
|
|
wire [PV-1 : 0] flit_is_tail_all;
|
156 |
|
|
|
157 |
|
|
|
158 |
|
|
//to weight control
|
159 |
|
|
wire [WP-1 : 0] iport_weight_all;
|
160 |
|
|
wire [WPP-1: 0] oports_weight_all;
|
161 |
|
|
wire refresh_w_counter;
|
162 |
|
|
|
163 |
|
|
|
164 |
|
|
//ctrl port
|
165 |
|
|
wire [PRAw-1 : 0] neighbors_r_addr;
|
166 |
|
|
wire [CRDTw-1 : 0 ] credit_init_val_in [P-1 : 0][V-1 : 0];
|
167 |
|
|
wire [CRDTw-1 : 0 ] credit_init_val_out [P-1 : 0][V-1 : 0];
|
168 |
|
|
|
169 |
|
|
|
170 |
|
|
|
171 |
|
|
genvar i,j;
|
172 |
|
|
generate for (i=0; i
|
173 |
|
|
assign neighbors_r_addr [(i+1)*RAw-1: i*RAw] = ctrl_in[i].neighbors_r_addr;
|
174 |
|
|
assign flit_in_all [(i+1)*Fw-1: i*Fw] = chan_in[i].flit;
|
175 |
|
|
assign flit_in_wr_all [i] = chan_in[i].flit_wr;
|
176 |
|
|
assign credit_in_all [(i+1)*V-1: i*V] = chan_in[i].credit;
|
177 |
|
|
assign congestion_in_all [(i+1)*CONGw-1: i*CONGw] = chan_in[i].congestion;
|
178 |
|
|
|
179 |
|
|
assign ctrl_out[i].neighbors_r_addr = current_r_addr;
|
180 |
|
|
assign chan_out[i].flit= flit_out_all [(i+1)*Fw-1: i*Fw];
|
181 |
|
|
assign chan_out[i].flit_wr= flit_out_wr_all [i];
|
182 |
|
|
assign chan_out[i].credit= credit_out_all [(i+1)*V-1: i*V];
|
183 |
|
|
assign chan_out[i].congestion= congestion_out_all [(i+1)*CONGw-1: i*CONGw];
|
184 |
|
|
|
185 |
|
|
assign iport_info[i].swa_first_level_grant =nonspec_first_arbiter_granted_ivc_all[(i+1)*V-1: i*V];
|
186 |
|
|
assign iport_info[i].swa_grant = ivc_num_getting_sw_grant[(i+1)*V-1: i*V];
|
187 |
|
|
assign iport_info[i].any_ivc_get_swa_grant= any_ivc_sw_request_granted_all[i];
|
188 |
|
|
assign iport_info[i].ivc_req = ivc_request_all [(i+1)*V-1: i*V];
|
189 |
|
|
|
190 |
|
|
assign vsa_ctrl[i].ovc_is_allocated = ovc_allocated_all [(i+1)*V-1: i*V];
|
191 |
|
|
assign vsa_ctrl[i].ovc_is_released = vsa_ovc_released_all[(i+1)*V-1: i*V];
|
192 |
|
|
assign vsa_ctrl[i].ivc_num_getting_sw_grant = ivc_num_getting_sw_grant [(i+1)*V-1: i*V];
|
193 |
|
|
assign vsa_ctrl[i].ivc_num_getting_ovc_grant=ivc_num_getting_ovc_grant [(i+1)*V-1: i*V];
|
194 |
|
|
assign vsa_ctrl[i].ivc_reset=flit_is_tail_all[(i+1)*V-1: i*V] & ivc_num_getting_sw_grant[(i+1)*V-1: i*V];
|
195 |
|
|
assign vsa_ctrl[i].buff_space_decreased = vsa_credit_decreased_all[(i+1)*V-1: i*V];
|
196 |
|
|
assign vsa_ctrl[i].ivc_granted_ovc_num = granted_ovc_num_all[(i+1)*VV-1: i*VV];
|
197 |
|
|
|
198 |
|
|
if(SELF_LOOP_EN == "NO") begin :nslp
|
199 |
|
|
add_sw_loc_one_hot #(
|
200 |
|
|
.P(P),
|
201 |
|
|
.SW_LOC(i)
|
202 |
|
|
)add
|
203 |
|
|
(
|
204 |
|
|
.destport_in(granted_dest_port_all[(i+1)*P_1-1: i*P_1]),
|
205 |
|
|
.destport_out(iport_info[i].granted_oport_one_hot[P-1 : 0])
|
206 |
|
|
);
|
207 |
|
|
end else begin :slp
|
208 |
|
|
assign iport_info[i].granted_oport_one_hot[P-1 : 0] = granted_dest_port_all[(i+1)*P_1-1: i*P_1];
|
209 |
|
|
end
|
210 |
|
|
|
211 |
|
|
for (j=0;j
|
212 |
|
|
assign credit_init_val_in[i][j] = ctrl_in[i].credit_init_val[j];
|
213 |
|
|
assign ctrl_out[i].credit_init_val[j] = credit_init_val_out [i][j];
|
214 |
|
|
end
|
215 |
|
|
|
216 |
|
|
end
|
217 |
|
|
endgenerate
|
218 |
|
|
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
|
222 |
|
|
inout_ports
|
223 |
|
|
#(
|
224 |
|
|
.P(P)
|
225 |
|
|
)
|
226 |
|
|
the_inout_ports
|
227 |
|
|
(
|
228 |
|
|
.current_r_addr(current_r_addr),
|
229 |
|
|
.neighbors_r_addr(neighbors_r_addr),
|
230 |
|
|
.flit_in_all(flit_in_all),
|
231 |
|
|
.flit_in_wr_all(flit_in_wr_all),
|
232 |
|
|
.credit_out_all(credit_out_all),
|
233 |
|
|
.credit_in_all(credit_in_all),
|
234 |
|
|
.masked_ovc_request_all(masked_ovc_request_all),
|
235 |
|
|
.pck_is_single_flit_all(pck_is_single_flit_all),
|
236 |
|
|
.granted_dst_is_from_a_single_flit_pck(granted_dst_is_from_a_single_flit_pck),
|
237 |
|
|
.vsa_ovc_allocated_all(ovc_allocated_all),
|
238 |
|
|
.granted_ovc_num_all(granted_ovc_num_all),
|
239 |
|
|
.ivc_num_getting_ovc_grant(ivc_num_getting_ovc_grant),
|
240 |
|
|
.spec_ovc_num_all(spec_ovc_num_all),
|
241 |
|
|
.nonspec_first_arbiter_granted_ivc_all(nonspec_first_arbiter_granted_ivc_all),
|
242 |
|
|
.spec_first_arbiter_granted_ivc_all(spec_first_arbiter_granted_ivc_all),
|
243 |
|
|
.nonspec_granted_dest_port_all(nonspec_granted_dest_port_all),
|
244 |
|
|
.spec_granted_dest_port_all(spec_granted_dest_port_all),
|
245 |
|
|
.granted_dest_port_all(granted_dest_port_all),
|
246 |
|
|
.any_ivc_sw_request_granted_all(any_ivc_sw_request_granted_all),
|
247 |
|
|
.any_ovc_granted_in_outport_all(any_ovc_granted_in_outport_all),
|
248 |
|
|
.dest_port_all(dest_port_all),
|
249 |
|
|
.ovc_is_assigned_all(ovc_is_assigned_all),
|
250 |
|
|
.ivc_request_all(ivc_request_all),
|
251 |
|
|
.assigned_ovc_not_full_all(assigned_ovc_not_full_all),
|
252 |
|
|
.flit_out_all(iport_flit_out_all),
|
253 |
|
|
.congestion_in_all(congestion_in_all),
|
254 |
|
|
.congestion_out_all(congestion_out_all),
|
255 |
|
|
// .lk_destination_all(lk_destination_all),
|
256 |
|
|
.ssa_flit_wr_all(ssa_flit_wr_all),
|
257 |
|
|
.iport_weight_all(iport_weight_all),
|
258 |
|
|
.oports_weight_all(oports_weight_all),
|
259 |
|
|
.vc_weight_is_consumed_all(vc_weight_is_consumed_all),
|
260 |
|
|
.iport_weight_is_consumed_all(iport_weight_is_consumed_all),
|
261 |
|
|
.refresh_w_counter(refresh_w_counter),
|
262 |
|
|
.clk(clk),
|
263 |
|
|
.reset(reset),
|
264 |
|
|
.ivc_info(ivc_info),
|
265 |
|
|
.ovc_info(ovc_info),
|
266 |
|
|
.oport_info(oport_info),
|
267 |
|
|
.smart_ctrl_in(smart_ctrl_in),
|
268 |
|
|
.vsa_ctrl_in(vsa_ctrl),
|
269 |
|
|
.credit_init_val_in (credit_init_val_in),
|
270 |
|
|
.credit_init_val_out (credit_init_val_out),
|
271 |
|
|
.flit_is_tail_all(flit_is_tail_all),
|
272 |
|
|
.crossbar_flit_out_wr_all(crossbar_flit_out_wr_all),
|
273 |
|
|
.vsa_ovc_released_all(vsa_ovc_released_all),
|
274 |
|
|
.vsa_credit_decreased_all(vsa_credit_decreased_all)
|
275 |
|
|
);
|
276 |
|
|
|
277 |
|
|
|
278 |
|
|
combined_vc_sw_alloc #(
|
279 |
|
|
.V(V),
|
280 |
|
|
.P(P),
|
281 |
|
|
.COMBINATION_TYPE(COMBINATION_TYPE),
|
282 |
|
|
.FIRST_ARBITER_EXT_P_EN (FIRST_ARBITER_EXT_P_EN),
|
283 |
|
|
.SWA_ARBITER_TYPE (SWA_ARBITER_TYPE ),
|
284 |
|
|
.DEBUG_EN(DEBUG_EN),
|
285 |
|
|
.MIN_PCK_SIZE(MIN_PCK_SIZE),
|
286 |
|
|
.SELF_LOOP_EN(SELF_LOOP_EN)
|
287 |
|
|
)
|
288 |
|
|
vsa
|
289 |
|
|
(
|
290 |
|
|
.dest_port_all(dest_port_all),
|
291 |
|
|
.masked_ovc_request_all(masked_ovc_request_all),
|
292 |
|
|
.ovc_is_assigned_all(ovc_is_assigned_all),
|
293 |
|
|
.ivc_request_all(ivc_request_all),
|
294 |
|
|
.assigned_ovc_not_full_all(assigned_ovc_not_full_all),
|
295 |
|
|
.pck_is_single_flit_all(pck_is_single_flit_all),
|
296 |
|
|
.granted_dst_is_from_a_single_flit_pck(granted_dst_is_from_a_single_flit_pck),
|
297 |
|
|
.ovc_allocated_all(ovc_allocated_all),
|
298 |
|
|
.granted_ovc_num_all(granted_ovc_num_all),
|
299 |
|
|
.ivc_num_getting_ovc_grant(ivc_num_getting_ovc_grant),
|
300 |
|
|
.ivc_num_getting_sw_grant(ivc_num_getting_sw_grant),
|
301 |
|
|
.spec_first_arbiter_granted_ivc_all(spec_first_arbiter_granted_ivc_all),
|
302 |
|
|
.nonspec_first_arbiter_granted_ivc_all(nonspec_first_arbiter_granted_ivc_all),
|
303 |
|
|
.nonspec_granted_dest_port_all(nonspec_granted_dest_port_all),
|
304 |
|
|
.spec_granted_dest_port_all(spec_granted_dest_port_all),
|
305 |
|
|
.granted_dest_port_all(granted_dest_port_all),
|
306 |
|
|
.any_ivc_sw_request_granted_all(any_ivc_sw_request_granted_all),
|
307 |
|
|
.any_ovc_granted_in_outport_all(any_ovc_granted_in_outport_all),
|
308 |
|
|
.spec_ovc_num_all(spec_ovc_num_all),
|
309 |
|
|
// .lk_destination_all(lk_destination_all),
|
310 |
|
|
.vc_weight_is_consumed_all(vc_weight_is_consumed_all),
|
311 |
|
|
.iport_weight_is_consumed_all(iport_weight_is_consumed_all),
|
312 |
|
|
.clk(clk),
|
313 |
|
|
.reset(reset)
|
314 |
|
|
);
|
315 |
|
|
|
316 |
|
|
|
317 |
|
|
|
318 |
|
|
|
319 |
|
|
|
320 |
|
|
`ifdef SYNC_RESET_MODE
|
321 |
|
|
always @ (posedge clk )begin
|
322 |
|
|
`else
|
323 |
|
|
always @ (posedge clk or posedge reset)begin
|
324 |
|
|
`endif
|
325 |
|
|
if(reset) begin
|
326 |
|
|
granted_dest_port_all_delayed<= {PP_1{1'b0}};
|
327 |
|
|
end else begin
|
328 |
|
|
granted_dest_port_all_delayed<= granted_dest_port_all;
|
329 |
|
|
end
|
330 |
|
|
end//always
|
331 |
|
|
|
332 |
|
|
crossbar #(
|
333 |
|
|
|
334 |
|
|
.TOPOLOGY(TOPOLOGY),
|
335 |
|
|
.V (V), // vc_num_per_port
|
336 |
|
|
.P (P), // router port num
|
337 |
|
|
.Fw (Fw),
|
338 |
|
|
.MUX_TYPE (MUX_TYPE),
|
339 |
|
|
.SSA_EN (SSA_EN),
|
340 |
|
|
.SELF_LOOP_EN(SELF_LOOP_EN)
|
341 |
|
|
|
342 |
|
|
)
|
343 |
|
|
the_crossbar
|
344 |
|
|
(
|
345 |
|
|
.granted_dest_port_all (granted_dest_port_all_delayed),
|
346 |
|
|
.flit_in_all (iport_flit_out_all),
|
347 |
|
|
.ssa_flit_wr_all (ssa_flit_wr_all),
|
348 |
|
|
.flit_out_all (crossbar_flit_out_all),
|
349 |
|
|
.flit_out_wr_all (crossbar_flit_out_wr_all)
|
350 |
|
|
|
351 |
|
|
);
|
352 |
|
|
|
353 |
|
|
//link reg
|
354 |
|
|
generate
|
355 |
|
|
//if( ADD_PIPREG_AFTER_CROSSBAR == 1 || SMART_EN == 1) begin :link_reg
|
356 |
|
|
if( ADD_PIPREG_AFTER_CROSSBAR == 1 ) begin :link_reg
|
357 |
|
|
|
358 |
|
|
|
359 |
|
|
reg [PFw-1 : 0] flit_out_all_pipe;
|
360 |
|
|
reg [P-1 : 0] flit_out_wr_all_pipe;
|
361 |
|
|
|
362 |
|
|
`ifdef SYNC_RESET_MODE
|
363 |
|
|
always @ (posedge clk )begin
|
364 |
|
|
`else
|
365 |
|
|
always @ (posedge clk or posedge reset)begin
|
366 |
|
|
`endif
|
367 |
|
|
if(reset)begin
|
368 |
|
|
flit_out_all_pipe <= {PFw{1'b0}};
|
369 |
|
|
flit_out_wr_all_pipe <= {P{1'b0}};
|
370 |
|
|
end else begin
|
371 |
|
|
flit_out_all_pipe <= crossbar_flit_out_all;
|
372 |
|
|
flit_out_wr_all_pipe <= crossbar_flit_out_wr_all;
|
373 |
|
|
end
|
374 |
|
|
end
|
375 |
|
|
|
376 |
|
|
assign link_flit_out_all = flit_out_all_pipe;
|
377 |
|
|
assign link_flit_out_wr_all = flit_out_wr_all_pipe;
|
378 |
|
|
|
379 |
|
|
|
380 |
|
|
end else begin :no_link_reg
|
381 |
|
|
|
382 |
|
|
assign link_flit_out_all = crossbar_flit_out_all;
|
383 |
|
|
assign link_flit_out_wr_all = crossbar_flit_out_wr_all;
|
384 |
|
|
|
385 |
|
|
end
|
386 |
|
|
|
387 |
|
|
|
388 |
|
|
/* verilator lint_off WIDTH */
|
389 |
|
|
if (SWA_ARBITER_TYPE != "RRA" ) begin : wrra_
|
390 |
|
|
/* verilator lint_on WIDTH */
|
391 |
|
|
|
392 |
|
|
wire [WP-1 : 0] contention_all;
|
393 |
|
|
wire [WP-1 : 0] limited_oport_weight_all;
|
394 |
|
|
|
395 |
|
|
wrra_contention_gen #(
|
396 |
|
|
.WEIGHTw(WEIGHTw),
|
397 |
|
|
.WRRA_CONFIG_INDEX(WRRA_CONFIG_INDEX),
|
398 |
|
|
.V(V),
|
399 |
|
|
.P(P),
|
400 |
|
|
.SELF_LOOP_EN(SELF_LOOP_EN)
|
401 |
|
|
)
|
402 |
|
|
contention_gen
|
403 |
|
|
(
|
404 |
|
|
.limited_oport_weight_all(limited_oport_weight_all),
|
405 |
|
|
.dest_port_all(dest_port_all),
|
406 |
|
|
.ivc_request_all(ivc_request_all),
|
407 |
|
|
.ovc_is_assigned_all(ovc_is_assigned_all),
|
408 |
|
|
.contention_all(contention_all),
|
409 |
|
|
.iport_weight_all(iport_weight_all),
|
410 |
|
|
.oports_weight_all(oports_weight_all)
|
411 |
|
|
|
412 |
|
|
);
|
413 |
|
|
|
414 |
|
|
weights_update #(
|
415 |
|
|
.ARBITER_TYPE(SWA_ARBITER_TYPE),
|
416 |
|
|
.V(V),
|
417 |
|
|
.P(P),
|
418 |
|
|
.Fw(Fw),
|
419 |
|
|
.WEIGHTw(WEIGHTw),
|
420 |
|
|
.WRRA_CONFIG_INDEX(WRRA_CONFIG_INDEX),
|
421 |
|
|
.C(C),
|
422 |
|
|
.TOPOLOGY(TOPOLOGY),
|
423 |
|
|
.EAw(EAw),
|
424 |
|
|
.DSTPw(DSTPw),
|
425 |
|
|
.ADD_PIPREG_AFTER_CROSSBAR(ADD_PIPREG_AFTER_CROSSBAR)
|
426 |
|
|
|
427 |
|
|
)
|
428 |
|
|
updater
|
429 |
|
|
(
|
430 |
|
|
.limited_oports_weight(limited_oport_weight_all),
|
431 |
|
|
.refresh_w_counter(refresh_w_counter),
|
432 |
|
|
.iport_weight_all(iport_weight_all),
|
433 |
|
|
.contention_all(contention_all),
|
434 |
|
|
.flit_in_all(link_flit_out_all),
|
435 |
|
|
.flit_out_all(flit_out_all),
|
436 |
|
|
.flit_out_wr_all(flit_out_wr_all),
|
437 |
|
|
.clk(clk),
|
438 |
|
|
.reset(reset)
|
439 |
|
|
);
|
440 |
|
|
|
441 |
|
|
end // WRRA
|
442 |
|
|
else begin : rra_
|
443 |
|
|
assign flit_out_all = link_flit_out_all;
|
444 |
|
|
assign refresh_w_counter = 1'b0;
|
445 |
|
|
end
|
446 |
|
|
endgenerate
|
447 |
|
|
assign flit_out_wr_all = link_flit_out_wr_all;
|
448 |
|
|
|
449 |
|
|
|
450 |
|
|
//synthesis translate_off
|
451 |
|
|
//synopsys translate_off
|
452 |
|
|
generate
|
453 |
|
|
/* verilator lint_off WIDTH */
|
454 |
|
|
if(DEBUG_EN && TOPOLOGY == "MESH")begin :dbg
|
455 |
|
|
/* verilator lint_on WIDTH */
|
456 |
|
|
debug_mesh_edges #(
|
457 |
|
|
.T1(T1),
|
458 |
|
|
.T2(T2),
|
459 |
|
|
.T3(T3),
|
460 |
|
|
.T4(T4),
|
461 |
|
|
.RAw(RAw),
|
462 |
|
|
.P(P)
|
463 |
|
|
)
|
464 |
|
|
debug_edges
|
465 |
|
|
(
|
466 |
|
|
.clk(clk),
|
467 |
|
|
.current_r_addr(current_r_addr),
|
468 |
|
|
.flit_out_wr_all(flit_out_wr_all)
|
469 |
|
|
);
|
470 |
|
|
end// DEBUG
|
471 |
|
|
endgenerate
|
472 |
|
|
// synopsys translate_on
|
473 |
|
|
// synthesis translate_on
|
474 |
|
|
|
475 |
|
|
|
476 |
|
|
|
477 |
|
|
// for testing the route path
|
478 |
|
|
|
479 |
|
|
|
480 |
|
|
|
481 |
|
|
// synthesis translate_off
|
482 |
|
|
// synopsys translate_off
|
483 |
|
|
`ifdef MONITORE_PATH
|
484 |
|
|
|
485 |
|
|
|
486 |
|
|
reg[P-1 :0] t1,t2;
|
487 |
|
|
generate
|
488 |
|
|
for (i=0;i
|
489 |
|
|
|
490 |
|
|
|
491 |
|
|
always @(posedge clk) begin
|
492 |
|
|
if(reset)begin
|
493 |
|
|
t1[i]<=1'b0;
|
494 |
|
|
t2[i]<=1'b0;
|
495 |
|
|
end else begin
|
496 |
|
|
if(flit_in_wr_all[i]>0 && t1[i]==0)begin
|
497 |
|
|
$display("%t :In router (addr=%h, port=%d), flitin=%h",$time,current_r_addr,i,flit_in_all[(i+1)*Fw-1 : i*Fw]);
|
498 |
|
|
t1[i]<=1;
|
499 |
|
|
end
|
500 |
|
|
if(flit_out_wr_all[i]>0 && t2[i]==0)begin
|
501 |
|
|
$display("%t :Out router (addr=%h, port=%d), flitout=%h",$time,current_r_addr,i,flit_out_all[(i+1)*Fw-1 : i*Fw]);
|
502 |
|
|
t2[i]<=1;
|
503 |
|
|
end
|
504 |
|
|
|
505 |
|
|
|
506 |
|
|
end
|
507 |
|
|
end
|
508 |
|
|
end
|
509 |
|
|
endgenerate
|
510 |
|
|
`endif
|
511 |
|
|
|
512 |
|
|
|
513 |
|
|
|
514 |
|
|
/*
|
515 |
|
|
|
516 |
|
|
|
517 |
|
|
|
518 |
|
|
reg [10 : 0] counter;
|
519 |
|
|
reg [31 : 0] flit_counter;
|
520 |
|
|
|
521 |
|
|
always @(posedge clk or posedge reset) begin
|
522 |
|
|
if(reset) begin
|
523 |
|
|
flit_counter <=0;
|
524 |
|
|
counter <= 0;
|
525 |
|
|
end else begin
|
526 |
|
|
if(flit_in_wr_all>0 )begin
|
527 |
|
|
counter <=0;
|
528 |
|
|
flit_counter<=flit_counter+1'b1;
|
529 |
|
|
|
530 |
|
|
end else begin
|
531 |
|
|
counter <= counter+1'b1;
|
532 |
|
|
if( counter == 512 ) $display("%t : total flits received in (x=%d,Y=%d) is %d ",$time,current_r_addr,current_y,flit_counter);
|
533 |
|
|
end
|
534 |
|
|
end
|
535 |
|
|
end
|
536 |
|
|
*/
|
537 |
|
|
|
538 |
|
|
|
539 |
|
|
//synopsys translate_on
|
540 |
|
|
//synthesis translate_on
|
541 |
|
|
|
542 |
|
|
|
543 |
|
|
endmodule
|
544 |
|
|
|