1 |
54 |
alirezamon |
`include "pronoc_def.v"
|
2 |
|
|
/**********************************************************************
|
3 |
|
|
** File: combined_vc_sw_alloc.v
|
4 |
|
|
**
|
5 |
|
|
** Copyright (C) 2014-2017 Alireza Monemi
|
6 |
|
|
**
|
7 |
|
|
** This file is part of ProNoC
|
8 |
|
|
**
|
9 |
|
|
** ProNoC ( stands for Prototype Network-on-chip) is free software:
|
10 |
|
|
** you can redistribute it and/or modify it under the terms of the GNU
|
11 |
|
|
** Lesser General Public License as published by the Free Software Foundation,
|
12 |
|
|
** either version 2 of the License, or (at your option) any later version.
|
13 |
|
|
**
|
14 |
|
|
** ProNoC is distributed in the hope that it will be useful, but WITHOUT
|
15 |
|
|
** ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
16 |
|
|
** or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General
|
17 |
|
|
** Public License for more details.
|
18 |
|
|
**
|
19 |
|
|
** You should have received a copy of the GNU Lesser General Public
|
20 |
|
|
** License along with ProNoC. If not, see .
|
21 |
|
|
**
|
22 |
|
|
**
|
23 |
|
|
** Description:
|
24 |
|
|
** combined VC/SW allocator. VC allocation is done in parallel with swich allocator
|
25 |
|
|
** for header flits which are successfully get sw grant
|
26 |
|
|
*************************************/
|
27 |
|
|
|
28 |
|
|
|
29 |
56 |
alirezamon |
module combined_vc_sw_alloc #(
|
30 |
|
|
parameter NOC_ID=0,
|
31 |
54 |
alirezamon |
parameter P = 5 //port number
|
32 |
56 |
alirezamon |
)(
|
33 |
54 |
alirezamon |
ivc_info,
|
34 |
|
|
dest_port_all,
|
35 |
|
|
masked_ovc_request_all,
|
36 |
|
|
ovc_allocated_all,
|
37 |
|
|
granted_ovc_num_all,
|
38 |
|
|
ivc_num_getting_ovc_grant,
|
39 |
|
|
ivc_num_getting_sw_grant,
|
40 |
|
|
spec_first_arbiter_granted_ivc_all,
|
41 |
|
|
nonspec_first_arbiter_granted_ivc_all,
|
42 |
|
|
granted_dest_port_all,
|
43 |
|
|
nonspec_granted_dest_port_all,
|
44 |
|
|
spec_granted_dest_port_all,
|
45 |
|
|
any_ivc_sw_request_granted_all,
|
46 |
|
|
any_ovc_granted_in_outport_all,
|
47 |
|
|
spec_ovc_num_all,
|
48 |
|
|
vc_weight_is_consumed_all,
|
49 |
|
|
iport_weight_is_consumed_all,
|
50 |
|
|
granted_dst_is_from_a_single_flit_pck,
|
51 |
|
|
clk,
|
52 |
|
|
reset
|
53 |
|
|
|
54 |
|
|
);
|
55 |
56 |
alirezamon |
`NOC_CONF
|
56 |
54 |
alirezamon |
|
57 |
|
|
localparam
|
58 |
|
|
PV = V * P,
|
59 |
|
|
PVV = PV * V,
|
60 |
|
|
P_1 = (SELF_LOOP_EN == "NO")? P-1 : P,
|
61 |
|
|
PP_1 = P_1 * P,
|
62 |
56 |
alirezamon |
PVP_1 = PV * P_1;
|
63 |
54 |
alirezamon |
|
64 |
|
|
input ivc_info_t ivc_info [P-1 : 0][V-1 : 0];
|
65 |
|
|
input [PVP_1-1 : 0] dest_port_all;
|
66 |
56 |
alirezamon |
input [PVV-1 : 0] masked_ovc_request_all;
|
67 |
54 |
alirezamon |
|
68 |
|
|
|
69 |
|
|
output [PV-1 : 0] ovc_allocated_all;
|
70 |
|
|
output [PVV-1 : 0] granted_ovc_num_all;
|
71 |
|
|
output [PV-1 : 0] ivc_num_getting_ovc_grant;
|
72 |
|
|
output [PV-1 : 0] ivc_num_getting_sw_grant;
|
73 |
|
|
output [PV-1 : 0] nonspec_first_arbiter_granted_ivc_all;
|
74 |
|
|
output [PV-1 : 0] spec_first_arbiter_granted_ivc_all;
|
75 |
|
|
output [P-1 : 0] any_ivc_sw_request_granted_all;
|
76 |
|
|
output [P-1 : 0] any_ovc_granted_in_outport_all;
|
77 |
|
|
output [PP_1-1 : 0] granted_dest_port_all;
|
78 |
|
|
output [PP_1-1 : 0] nonspec_granted_dest_port_all;
|
79 |
|
|
output [PP_1-1 : 0] spec_granted_dest_port_all;
|
80 |
|
|
output [PVV-1 : 0] spec_ovc_num_all;
|
81 |
56 |
alirezamon |
|
82 |
54 |
alirezamon |
input [PV-1 : 0] vc_weight_is_consumed_all;
|
83 |
|
|
input [P-1 : 0] iport_weight_is_consumed_all;
|
84 |
|
|
|
85 |
|
|
output [P-1 : 0] granted_dst_is_from_a_single_flit_pck;
|
86 |
|
|
|
87 |
|
|
input clk,reset;
|
88 |
|
|
|
89 |
|
|
wire [PV-1 : 0] ivc_request_all;
|
90 |
|
|
wire [PV-1 : 0] assigned_ovc_not_full_all;
|
91 |
|
|
wire [PV-1 : 0] ovc_is_assigned_all;
|
92 |
|
|
wire [PV-1 : 0] pck_is_single_flit_all;
|
93 |
|
|
|
94 |
|
|
genvar i;
|
95 |
|
|
generate
|
96 |
|
|
for (i=0; i
|
97 |
|
|
|
98 |
|
|
localparam C_PORT = i/V;
|
99 |
|
|
|
100 |
|
|
assign ivc_request_all[i] = ivc_info[C_PORT][i%V].ivc_req;
|
101 |
|
|
assign assigned_ovc_not_full_all[i] = ivc_info[C_PORT][i%V].assigned_ovc_not_full;
|
102 |
|
|
assign ovc_is_assigned_all[i] = ivc_info[C_PORT][i%V].ovc_is_assigned;
|
103 |
|
|
assign pck_is_single_flit_all[i] =ivc_info[C_PORT][i%V].single_flit_pck;
|
104 |
|
|
|
105 |
|
|
end//for
|
106 |
|
|
|
107 |
|
|
|
108 |
|
|
|
109 |
|
|
/* verilator lint_off WIDTH */
|
110 |
|
|
if(COMBINATION_TYPE == "BASELINE") begin : canonical_comb_gen
|
111 |
|
|
/* verilator lint_on WIDTH */
|
112 |
|
|
baseline_allocator #(
|
113 |
|
|
.V(V),
|
114 |
|
|
.P(P),
|
115 |
|
|
.TREE_ARBITER_EN(1),
|
116 |
|
|
.DEBUG_EN(DEBUG_EN),
|
117 |
|
|
.SWA_ARBITER_TYPE (SWA_ARBITER_TYPE),
|
118 |
|
|
.SELF_LOOP_EN(SELF_LOOP_EN)
|
119 |
|
|
)
|
120 |
|
|
the_base_line
|
121 |
|
|
(
|
122 |
|
|
.dest_port_all(dest_port_all),
|
123 |
|
|
.masked_ovc_request_all(masked_ovc_request_all),
|
124 |
|
|
.ovc_is_assigned_all(ovc_is_assigned_all),
|
125 |
|
|
.ivc_request_all(ivc_request_all),
|
126 |
|
|
.assigned_ovc_not_full_all(assigned_ovc_not_full_all),
|
127 |
|
|
.ovc_allocated_all(ovc_allocated_all),
|
128 |
|
|
.granted_ovc_num_all(granted_ovc_num_all),
|
129 |
|
|
.ivc_num_getting_ovc_grant(ivc_num_getting_ovc_grant),
|
130 |
|
|
.ivc_num_getting_sw_grant(ivc_num_getting_sw_grant),
|
131 |
|
|
.spec_first_arbiter_granted_ivc_all(spec_first_arbiter_granted_ivc_all),
|
132 |
|
|
.nonspec_first_arbiter_granted_ivc_all(nonspec_first_arbiter_granted_ivc_all),
|
133 |
|
|
.granted_dest_port_all(granted_dest_port_all),
|
134 |
|
|
.nonspec_granted_dest_port_all(nonspec_granted_dest_port_all),
|
135 |
|
|
.spec_granted_dest_port_all(spec_granted_dest_port_all),
|
136 |
|
|
.any_ivc_sw_request_granted_all(any_ivc_sw_request_granted_all),
|
137 |
|
|
.spec_ovc_num_all(spec_ovc_num_all),
|
138 |
|
|
.vc_weight_is_consumed_all(vc_weight_is_consumed_all),
|
139 |
|
|
.iport_weight_is_consumed_all(iport_weight_is_consumed_all),
|
140 |
|
|
.clk(clk),
|
141 |
|
|
.reset(reset)
|
142 |
|
|
|
143 |
|
|
);
|
144 |
|
|
/* verilator lint_off WIDTH */
|
145 |
|
|
end else if(COMBINATION_TYPE == "COMB_SPEC1") begin : spec1
|
146 |
|
|
/* verilator lint_on WIDTH */
|
147 |
|
|
comb_spec1_allocator #(
|
148 |
|
|
.V(V),
|
149 |
|
|
.P(P),
|
150 |
|
|
.DEBUG_EN(DEBUG_EN),
|
151 |
|
|
.SWA_ARBITER_TYPE (SWA_ARBITER_TYPE),
|
152 |
|
|
.MIN_PCK_SIZE(MIN_PCK_SIZE),
|
153 |
|
|
.SELF_LOOP_EN(SELF_LOOP_EN)
|
154 |
|
|
|
155 |
|
|
)
|
156 |
|
|
the_comb_spec1
|
157 |
|
|
(
|
158 |
|
|
.dest_port_all(dest_port_all),
|
159 |
|
|
.masked_ovc_request_all(masked_ovc_request_all),
|
160 |
|
|
.ovc_is_assigned_all(ovc_is_assigned_all),
|
161 |
|
|
.ivc_request_all(ivc_request_all),
|
162 |
|
|
.assigned_ovc_not_full_all(assigned_ovc_not_full_all),
|
163 |
|
|
.ovc_allocated_all(ovc_allocated_all),
|
164 |
|
|
.granted_ovc_num_all(granted_ovc_num_all),
|
165 |
|
|
.ivc_num_getting_ovc_grant(ivc_num_getting_ovc_grant),
|
166 |
|
|
.ivc_num_getting_sw_grant(ivc_num_getting_sw_grant),
|
167 |
|
|
.spec_first_arbiter_granted_ivc_all(spec_first_arbiter_granted_ivc_all),
|
168 |
|
|
.nonspec_first_arbiter_granted_ivc_all(nonspec_first_arbiter_granted_ivc_all),
|
169 |
|
|
.granted_dest_port_all(granted_dest_port_all),
|
170 |
|
|
.nonspec_granted_dest_port_all(nonspec_granted_dest_port_all),
|
171 |
|
|
.any_ivc_sw_request_granted_all(any_ivc_sw_request_granted_all),
|
172 |
|
|
.vc_weight_is_consumed_all(vc_weight_is_consumed_all),
|
173 |
|
|
.iport_weight_is_consumed_all(iport_weight_is_consumed_all),
|
174 |
|
|
.pck_is_single_flit_all(pck_is_single_flit_all),
|
175 |
|
|
.granted_dst_is_from_a_single_flit_pck(granted_dst_is_from_a_single_flit_pck),
|
176 |
|
|
.clk(clk),
|
177 |
|
|
.reset(reset)
|
178 |
|
|
);
|
179 |
|
|
|
180 |
|
|
assign spec_granted_dest_port_all = {PP_1{1'bx}};
|
181 |
|
|
assign spec_ovc_num_all = {PVV{1'bx}};
|
182 |
|
|
/* verilator lint_off WIDTH */
|
183 |
|
|
end else if (COMBINATION_TYPE == "COMB_SPEC2") begin :spec2
|
184 |
|
|
/* verilator lint_on WIDTH */
|
185 |
|
|
comb_spec2_allocator #(
|
186 |
|
|
.V(V),
|
187 |
|
|
.P(P),
|
188 |
|
|
.DEBUG_EN(DEBUG_EN),
|
189 |
|
|
.SWA_ARBITER_TYPE (SWA_ARBITER_TYPE),
|
190 |
|
|
.MIN_PCK_SIZE(MIN_PCK_SIZE),
|
191 |
|
|
.SELF_LOOP_EN(SELF_LOOP_EN)
|
192 |
|
|
)
|
193 |
|
|
the_comb_spec2
|
194 |
|
|
(
|
195 |
|
|
.dest_port_all(dest_port_all),
|
196 |
|
|
.masked_ovc_request_all(masked_ovc_request_all),
|
197 |
|
|
.ovc_is_assigned_all(ovc_is_assigned_all),
|
198 |
|
|
.ivc_request_all(ivc_request_all),
|
199 |
|
|
.assigned_ovc_not_full_all(assigned_ovc_not_full_all),
|
200 |
|
|
.ovc_allocated_all(ovc_allocated_all),
|
201 |
|
|
.granted_ovc_num_all(granted_ovc_num_all),
|
202 |
|
|
.ivc_num_getting_ovc_grant(ivc_num_getting_ovc_grant),
|
203 |
|
|
.ivc_num_getting_sw_grant(ivc_num_getting_sw_grant),
|
204 |
|
|
.spec_first_arbiter_granted_ivc_all(spec_first_arbiter_granted_ivc_all),
|
205 |
|
|
.nonspec_first_arbiter_granted_ivc_all(nonspec_first_arbiter_granted_ivc_all),
|
206 |
|
|
.granted_dest_port_all(granted_dest_port_all),
|
207 |
|
|
.nonspec_granted_dest_port_all(nonspec_granted_dest_port_all),
|
208 |
|
|
.any_ivc_sw_request_granted_all(any_ivc_sw_request_granted_all),
|
209 |
|
|
.vc_weight_is_consumed_all(vc_weight_is_consumed_all),
|
210 |
|
|
.iport_weight_is_consumed_all(iport_weight_is_consumed_all),
|
211 |
|
|
.pck_is_single_flit_all(pck_is_single_flit_all),
|
212 |
|
|
.granted_dst_is_from_a_single_flit_pck(granted_dst_is_from_a_single_flit_pck),
|
213 |
|
|
.clk(clk),
|
214 |
|
|
.reset(reset)
|
215 |
|
|
);
|
216 |
|
|
|
217 |
|
|
assign spec_granted_dest_port_all = {PP_1{1'bx}};
|
218 |
|
|
assign spec_ovc_num_all = {PVV{1'bx}};
|
219 |
|
|
|
220 |
|
|
|
221 |
|
|
end else begin : nonspec
|
222 |
|
|
if(V>7)begin :cmb_v2
|
223 |
|
|
|
224 |
|
|
comb_nonspec_v2_allocator #(
|
225 |
|
|
.V(V),
|
226 |
|
|
.P(P),
|
227 |
|
|
.FIRST_ARBITER_EXT_P_EN(FIRST_ARBITER_EXT_P_EN),
|
228 |
|
|
.SWA_ARBITER_TYPE (SWA_ARBITER_TYPE),
|
229 |
|
|
.MIN_PCK_SIZE(MIN_PCK_SIZE),
|
230 |
|
|
.SELF_LOOP_EN(SELF_LOOP_EN)
|
231 |
|
|
)
|
232 |
|
|
nonspec_comb
|
233 |
|
|
(
|
234 |
|
|
.dest_port_all(dest_port_all),
|
235 |
|
|
.masked_ovc_request_all(masked_ovc_request_all),
|
236 |
|
|
.ovc_is_assigned_all(ovc_is_assigned_all),
|
237 |
|
|
.ivc_request_all(ivc_request_all),
|
238 |
|
|
.assigned_ovc_not_full_all(assigned_ovc_not_full_all),
|
239 |
|
|
.ovc_allocated_all(ovc_allocated_all),
|
240 |
|
|
.granted_ovc_num_all(granted_ovc_num_all),
|
241 |
|
|
.ivc_num_getting_ovc_grant(ivc_num_getting_ovc_grant),
|
242 |
|
|
.ivc_num_getting_sw_grant(ivc_num_getting_sw_grant),
|
243 |
|
|
.nonspec_first_arbiter_granted_ivc_all(nonspec_first_arbiter_granted_ivc_all),
|
244 |
|
|
.granted_dest_port_all(granted_dest_port_all),
|
245 |
|
|
.any_ivc_sw_request_granted_all(any_ivc_sw_request_granted_all),
|
246 |
|
|
.any_ovc_granted_in_outport_all(any_ovc_granted_in_outport_all),
|
247 |
|
|
.vc_weight_is_consumed_all(vc_weight_is_consumed_all),
|
248 |
|
|
.iport_weight_is_consumed_all(iport_weight_is_consumed_all),
|
249 |
|
|
.pck_is_single_flit_all(pck_is_single_flit_all),
|
250 |
|
|
.granted_dst_is_from_a_single_flit_pck(granted_dst_is_from_a_single_flit_pck),
|
251 |
|
|
.clk(clk),
|
252 |
|
|
.reset(reset)
|
253 |
|
|
);
|
254 |
|
|
|
255 |
|
|
end else begin :cmb_v1
|
256 |
|
|
|
257 |
|
|
comb_nonspec_allocator #(
|
258 |
56 |
alirezamon |
.NOC_ID(NOC_ID),
|
259 |
|
|
.P(P)
|
260 |
54 |
alirezamon |
)
|
261 |
|
|
nonspec_comb
|
262 |
|
|
(
|
263 |
|
|
.ivc_info(ivc_info),
|
264 |
|
|
.dest_port_all(dest_port_all),
|
265 |
|
|
.masked_ovc_request_all(masked_ovc_request_all),
|
266 |
|
|
.ovc_allocated_all(ovc_allocated_all),
|
267 |
|
|
.granted_ovc_num_all(granted_ovc_num_all),
|
268 |
|
|
.ivc_num_getting_ovc_grant(ivc_num_getting_ovc_grant),
|
269 |
|
|
.ivc_num_getting_sw_grant(ivc_num_getting_sw_grant),
|
270 |
|
|
.nonspec_first_arbiter_granted_ivc_all(nonspec_first_arbiter_granted_ivc_all),
|
271 |
|
|
.granted_dest_port_all(granted_dest_port_all),
|
272 |
|
|
.any_ivc_sw_request_granted_all(any_ivc_sw_request_granted_all),
|
273 |
|
|
.any_ovc_granted_in_outport_all(any_ovc_granted_in_outport_all),
|
274 |
|
|
.vc_weight_is_consumed_all(vc_weight_is_consumed_all),
|
275 |
|
|
.iport_weight_is_consumed_all(iport_weight_is_consumed_all),
|
276 |
|
|
.pck_is_single_flit_all(pck_is_single_flit_all),
|
277 |
|
|
.granted_dst_is_from_a_single_flit_pck(granted_dst_is_from_a_single_flit_pck),
|
278 |
|
|
.clk(clk),
|
279 |
|
|
.reset(reset)
|
280 |
|
|
);
|
281 |
|
|
end
|
282 |
|
|
|
283 |
|
|
assign nonspec_granted_dest_port_all = granted_dest_port_all;
|
284 |
|
|
assign spec_granted_dest_port_all = {PP_1{1'bx}};
|
285 |
|
|
assign spec_ovc_num_all = {PVV{1'bx}};
|
286 |
|
|
assign spec_first_arbiter_granted_ivc_all = nonspec_first_arbiter_granted_ivc_all ;
|
287 |
|
|
end
|
288 |
|
|
endgenerate
|
289 |
|
|
endmodule
|