OpenCores
URL https://opencores.org/ocsvn/an-fpga-implementation-of-low-latency-noc-based-mpsoc/an-fpga-implementation-of-low-latency-noc-based-mpsoc/trunk

Subversion Repositories an-fpga-implementation-of-low-latency-noc-based-mpsoc

[/] [an-fpga-implementation-of-low-latency-noc-based-mpsoc/] [trunk/] [mpsoc/] [rtl/] [src_noc/] [ss_allocator.sv] - Blame information for rev 56

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 54 alirezamon
`include "pronoc_def.v"
2 48 alirezamon
 
3
/**********************************************************************
4
**      File:  ss_allocator.v
5
**      Date:2016-06-19
6
**
7
**      Copyright (C) 2014-2019  Alireza Monemi
8
**
9
**      This file is part of ProNoC
10
**
11
**      ProNoC ( stands for Prototype Network-on-chip)  is free software:
12
**      you can redistribute it and/or modify it under the terms of the GNU
13
**      Lesser General Public License as published by the Free Software Foundation,
14
**      either version 2 of the License, or (at your option) any later version.
15
**
16
**      ProNoC is distributed in the hope that it will be useful, but WITHOUT
17
**      ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
18
**      or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
19
**      Public License for more details.
20
**
21
**      You should have received a copy of the GNU Lesser General Public
22
**      License along with ProNoC. If not, see .
23
**
24
**
25
**      Description:
26
**      static straight allocator : The incoming packet targeting output port located in same direction
27
**      will be forwarded with one clock cycle latency if the following conditions met in current clock cycle:
28
**      1) If no ivc is granted in the input port
29
**      2) The ss output port is not granted for any other input port
30
**      3) Packet destination port match with ss port
31
**      4) The requested output VC is available in ss port
32
**         The ss ports for each input potrt must be different with the rest
33
**         This result in one clock cycle latency
34
***************************************/
35
 
36
 
37 56 alirezamon
module  ss_allocator #(
38
    parameter NOC_ID=0,
39
    parameter P=5
40
)(
41 48 alirezamon
                clk,
42
                reset,
43
                flit_in_wr_all,
44
        flit_in_all,
45
        any_ovc_granted_in_outport_all ,
46
        any_ivc_sw_request_granted_all ,
47
        ovc_avalable_all,
48 54 alirezamon
       // assigned_ovc_not_full_all,
49
       // dest_port_encoded_all,
50
       // assigned_ovc_num_all,
51
       // ovc_is_assigned_all,
52 56 alirezamon
        ivc_info,
53 55 alirezamon
        ovc_info,
54 48 alirezamon
        ssa_ctrl_o
55
   );
56
 
57
 
58 56 alirezamon
        `NOC_CONF
59
 
60 48 alirezamon
    localparam  PV          =   V   *   P,
61
                        VV                      =   V * V,
62
                PVV         =   PV  *   V,
63
                PVDSTPw= PV * DSTPw,
64
                PFw         =   P   *   Fw;
65
 
66
    localparam    DISABLED = P;
67 56 alirezamon
 
68 48 alirezamon
 
69
    input   [PFw-1          :   0]  flit_in_all;
70
    input   [P-1            :   0]  flit_in_wr_all;
71
    input   [P-1            :   0]  any_ovc_granted_in_outport_all;
72
    input   [P-1            :   0]  any_ivc_sw_request_granted_all;
73
    input   [PV-1           :   0]  ovc_avalable_all;
74 54 alirezamon
 
75
 
76 48 alirezamon
    input   reset,clk;
77 54 alirezamon
    input   ivc_info_t   ivc_info   [P-1 : 0][V-1 : 0];
78 55 alirezamon
    input   ovc_info_t   ovc_info   [P-1 : 0][V-1 : 0];
79 48 alirezamon
    output  ssa_ctrl_t   ssa_ctrl_o [P-1 : 0];
80
 
81
 
82
    wire   [PV-1      :   0] ovc_allocated_all;
83
    wire   [PV-1      :   0] ovc_released_all;
84
    wire   [PVV-1     :   0] granted_ovc_num_all;
85
    wire   [PV-1      :   0] ivc_num_getting_sw_grant_all;
86
    wire   [PV-1      :   0] ivc_num_getting_ovc_grant_all;
87
    wire   [PV-1      :   0] ivc_reset_all;
88
    wire   [PV-1      :   0] single_flit_pck_all,ovc_single_flit_pck_all;
89
    wire   [PV-1      :   0] decreased_credit_in_ss_ovc_all;
90 54 alirezamon
    wire   [P-1       :   0] ssa_flit_wr_all;
91 48 alirezamon
 
92
 
93
    wire [PV-1   :   0] any_ovc_granted_in_ss_port;
94
    wire [PV-1   :   0] ovc_avalable_in_ss_port;
95
    wire [PV-1   :   0] ovc_allocated_in_ss_port;
96
    wire [PV-1   :   0] ovc_released_in_ss_port;
97
    wire [PV-1   :   0] decreased_credit_in_ss_ovc;
98
    wire [PV-1   :   0] ivc_num_getting_sw_grantin_SS_all;
99
 
100 54 alirezamon
    wire [PV-1       : 0] ivc_request_all;
101
    wire [PV-1       : 0] assigned_ovc_not_full_all;
102
    wire [PVDSTPw-1  : 0] dest_port_encoded_all;
103
    wire [PVV-1      : 0] assigned_ovc_num_all;
104
    wire [PV-1       : 0] ovc_is_assigned_all;
105 55 alirezamon
    wire [MAX_P-1     : 0] destport_one_hot [PV-1 : 0];
106 56 alirezamon
 
107 48 alirezamon
        genvar i;
108
    // there is no ssa for local port in 5 and 3 port routers
109
    generate
110
    for (i=0; i
111
 
112
        localparam  C_PORT  = i/V;
113
        localparam  SS_PORT = strieght_port (P,C_PORT);
114 54 alirezamon
 
115
        assign ivc_request_all[i] = ivc_info[C_PORT][i%V].ivc_req;
116 55 alirezamon
        assign assigned_ovc_not_full_all[i] = ~ovc_info[SS_PORT][i%V].full;
117
        //assign assigned_ovc_not_full_all[i] = ivc_info[C_PORT][i%V].assigned_ovc_not_full;
118
 
119 54 alirezamon
        assign dest_port_encoded_all [(i+1)*DSTPw-1 : i*DSTPw] = ivc_info[C_PORT][i%V].dest_port_encoded;
120
        assign assigned_ovc_num_all[(i+1)*V-1 : i*V] = ivc_info[C_PORT][i%V].assigned_ovc_num;
121
        assign ovc_is_assigned_all[i] = ivc_info[C_PORT][i%V].ovc_is_assigned;
122
 
123 55 alirezamon
        assign destport_one_hot[i] = ivc_info[C_PORT][i%V].destport_one_hot;
124 54 alirezamon
 
125 48 alirezamon
 
126
        if (SS_PORT == DISABLED)begin : no_prefrable
127
 
128
 
129
            assign   ovc_allocated_all[i]= 1'b0;
130
            assign   ovc_released_all [i]= 1'b0;
131
            assign   granted_ovc_num_all[(i+1)*V-1   :   i*V]= {V{1'b0}};
132
            assign   ivc_num_getting_sw_grant_all [i]= 1'b0;
133
            assign   ivc_num_getting_ovc_grant_all [i]= 1'b0;
134
            assign   ivc_reset_all [i]= 1'b0;
135
            assign   decreased_credit_in_ss_ovc_all[i]=1'b0;
136
            assign   single_flit_pck_all[i]= 1'b0;
137
            assign   ovc_single_flit_pck_all [i] =1'b0;
138
            assign   ivc_num_getting_sw_grantin_SS_all[i]=1'b0;
139
 
140
           // assign   predict_flit_wr_all [i]=1'b0;
141
 
142
 
143
       end else begin : ssa
144
 
145
            assign   any_ovc_granted_in_ss_port[i]=any_ovc_granted_in_outport_all[SS_PORT];
146
            assign   ovc_avalable_in_ss_port[i]=ovc_avalable_all[(SS_PORT*V)+(i%V)];
147
            assign   ovc_allocated_all[(SS_PORT*V)+(i%V)]=ovc_allocated_in_ss_port[i];
148
            assign   ovc_released_all[(SS_PORT*V)+(i%V)]=ovc_released_in_ss_port[i];
149
            assign   decreased_credit_in_ss_ovc_all[(SS_PORT*V)+(i%V)]=decreased_credit_in_ss_ovc[i];
150
            assign   ivc_num_getting_sw_grantin_SS_all[i]=  ivc_num_getting_sw_grant_all[(SS_PORT*V)+(i%V)];
151
            assign   ovc_single_flit_pck_all [i] =  single_flit_pck_all[(SS_PORT*V)+(i%V)];
152
 
153
 
154
 
155
            ssa_per_vc #(
156 56 alirezamon
                .NOC_ID(NOC_ID),
157 48 alirezamon
                .SS_PORT(SS_PORT),
158
                .V_GLOBAL(i),
159
                .P(P)
160
            )
161
            the_ssa_per_vc
162
            (
163
                .flit_in_wr(flit_in_wr_all[(i/V)]),
164
                .flit_in(flit_in_all[((i/V)+1)*Fw-1 :   (i/V)*Fw]),
165
                .any_ivc_sw_request_granted(any_ivc_sw_request_granted_all[(i/V)]),
166
                .any_ovc_granted_in_ss_port(any_ovc_granted_in_ss_port[i]),
167
                .ovc_avalable_in_ss_port(ovc_avalable_in_ss_port[i]),
168
                .ivc_request(ivc_request_all[i]),
169
                .assigned_ovc_not_full(assigned_ovc_not_full_all[i]),
170
                .destport_encoded(dest_port_encoded_all[(i+1)*DSTPw-1 :   i*DSTPw]),
171
                .assigned_to_ssovc(assigned_ovc_num_all[(i*V)+(i%V)]),
172
                .ovc_is_assigned(ovc_is_assigned_all[i]),
173
                .ovc_allocated(ovc_allocated_in_ss_port[i]),
174
                .ovc_released(ovc_released_in_ss_port[i]),
175
                .granted_ovc_num(granted_ovc_num_all[(i+1)*V-1 : i*V]),
176
                .ivc_num_getting_sw_grant(ivc_num_getting_sw_grant_all[i]),
177
                .ivc_num_getting_ovc_grant(ivc_num_getting_ovc_grant_all[i]),
178
                .ivc_reset(ivc_reset_all[i]),
179
                .single_flit_pck(single_flit_pck_all[i]),
180 55 alirezamon
                .destport_one_hot(destport_one_hot[i]),
181 48 alirezamon
                .decreased_credit_in_ss_ovc(decreased_credit_in_ss_ovc[i])
182
                //synthesis translate_off
183
                //synopsys  translate_off
184
                ,.clk(clk)
185
                //synopsys  translate_on
186
                //synthesis translate_on
187
 
188
            );
189
 
190
        end//ssa
191
    end// vc_loop
192
 
193
 
194 54 alirezamon
    for(i=0;i
195
 
196
 
197
        pronoc_register #(.W(1)) reg1 (
198
                        .in(|ivc_num_getting_sw_grantin_SS_all[(i+1)*V-1    :   i*V] ),
199
                        .out(ssa_flit_wr_all[i]),
200
                        .reset(reset),
201
                        .clk(clk));
202
 
203
 
204 48 alirezamon
 
205
 
206
            assign ssa_ctrl_o[i].ovc_is_allocated =ovc_allocated_all [(i+1)*V-1  : i*V];
207
            assign ssa_ctrl_o[i].ovc_is_released = ovc_released_all  [(i+1)*V-1  : i*V];
208
            assign ssa_ctrl_o[i].ivc_num_getting_sw_grant = ivc_num_getting_sw_grant_all[(i+1)*V-1  : i*V];
209
            assign ssa_ctrl_o[i].ivc_num_getting_ovc_grant= ivc_num_getting_ovc_grant_all[(i+1)*V-1  : i*V];
210
            assign ssa_ctrl_o[i].ivc_reset= ivc_reset_all[(i+1)*V-1  : i*V];
211
            assign ssa_ctrl_o[i].buff_space_decreased = decreased_credit_in_ss_ovc_all[(i+1)*V-1  : i*V];
212
            assign ssa_ctrl_o[i].ivc_single_flit_pck = single_flit_pck_all [(i+1)*V-1  : i*V];
213
            assign ssa_ctrl_o[i].ovc_single_flit_pck = ovc_single_flit_pck_all [(i+1)*V-1  : i*V];
214
            assign ssa_ctrl_o[i].ssa_flit_wr = ssa_flit_wr_all[i] ;
215
            assign ssa_ctrl_o[i].ivc_granted_ovc_num = granted_ovc_num_all[(i+1)*VV-1  : i*VV];
216
 
217
 
218
 
219
 
220
        end// port_lp
221
 
222
 
223
 
224
 
225
    endgenerate
226
 
227
 
228
endmodule
229
 
230
 
231
 
232
 
233
/*************
234
 *  ssa_per_vc
235
 * ***********/
236
 
237 56 alirezamon
module ssa_per_vc #(
238
    parameter NOC_ID=0,
239
    parameter P=5,
240 48 alirezamon
    parameter SS_PORT = "WEST",
241 56 alirezamon
    parameter V_GLOBAL = 1
242
)
243 48 alirezamon
    (
244
        flit_in_wr,
245
        flit_in,
246
        any_ovc_granted_in_ss_port,
247
        any_ivc_sw_request_granted,
248
        ovc_avalable_in_ss_port,
249
        ivc_request,
250
        assigned_ovc_not_full,
251
        granted_ovc_num,
252
        ivc_num_getting_sw_grant,
253
        ivc_num_getting_ovc_grant,
254
        assigned_to_ssovc,
255
        ovc_is_assigned,
256
        destport_encoded,
257
        ovc_released,
258
        ovc_allocated,
259
        decreased_credit_in_ss_ovc,
260
        single_flit_pck,
261 55 alirezamon
        destport_one_hot,
262 48 alirezamon
        ivc_reset
263
//synthesis translate_off
264
//synopsys  translate_off
265
        ,clk
266
//synopsys  translate_on
267
//synthesis translate_on
268
 
269
 
270 56 alirezamon
   );
271
 
272
 
273
    `NOC_CONF
274 48 alirezamon
 
275
 
276
    //header packet filds width
277
    localparam  SW_LOC             =V_GLOBAL/V,
278
                V_LOCAL            =V_GLOBAL%V;
279
 
280
    /* verilator lint_off WIDTH */
281 56 alirezamon
    localparam SSA_EN_IN_PORT = ((TOPOLOGY== "MESH" || TOPOLOGY == "TORUS") && (ROUTE_TYPE == "FULL_ADAPTIVE") && (SS_PORT==2 || SS_PORT == 4) && ((1<
282 48 alirezamon
    /* verilator lint_on WIDTH */
283
 
284
 
285
 
286
    input   [Fw-1          :   0]  flit_in;
287
    input                          flit_in_wr;
288
    input                          any_ovc_granted_in_ss_port;
289
    input                          any_ivc_sw_request_granted;
290
    input                          ovc_avalable_in_ss_port;
291
    input                          ivc_request;
292
    input                          assigned_ovc_not_full;
293
    input   [DSTPw-1      :    0]  destport_encoded;//exsited packet destination port
294
    input                          assigned_to_ssovc;
295
    input                          ovc_is_assigned;
296 55 alirezamon
    input   [MAX_P-1       :    0]  destport_one_hot;
297 48 alirezamon
 
298
    output reg [V-1          :   0]  granted_ovc_num;
299
    output                        ivc_num_getting_sw_grant;
300
    output                        ivc_num_getting_ovc_grant;
301
    output                        ovc_released;
302
    output                        ovc_allocated;
303
    output                        ivc_reset;
304
    output                        decreased_credit_in_ss_ovc;
305
    output                        single_flit_pck;
306
 
307
//synthesis translate_off
308
//synopsys  translate_off
309
    input clk;
310
//synopsys  translate_on
311
//synthesis translate_on
312
 
313
 
314
 
315
 
316
/*
317
*    1) If no ivc is granted in the input port
318
*    2) The ss output port is not granted for any other input port
319
*    3) Incomming packet destionation port match with ss port
320
*    4) In non-atomic Vc reallocation check if IVC is empty
321
*    5) The requested output VC is available in ss port
322
* The predicted ports for each input potrt must be diffrent with the rest
323
*/
324
 
325
 
326
 
327
 
328
    wire    [DSTPw-1 : 0] destport_in_encoded;//incomming packet destination port
329
    wire    [V-1 : 0] vc_num_in;
330
    wire    hdr_flg;
331
    wire    tail_flg;
332
    /* verilator lint_off WIDTH */
333
    assign  single_flit_pck =
334
        (PCK_TYPE == "SINGLE_FLIT")? 1'b1 :
335
        (MIN_PCK_SIZE==1)?  hdr_flg & tail_flg : 1'b0;
336
    /* verilator lint_on WIDTH */
337
 
338
 
339 56 alirezamon
    wire   condition_1_2_valid;
340 55 alirezamon
    wire [DAw-1 : 0]  dest_e_addr_in;
341 48 alirezamon
 
342
    extract_header_flit_info #(
343 56 alirezamon
        .NOC_ID(NOC_ID),
344 48 alirezamon
        .DATA_w(0)
345 56 alirezamon
    ) extractor (
346 48 alirezamon
        .flit_in(flit_in),
347
        .flit_in_wr(flit_in_wr),
348
        .class_o(),
349
        .destport_o(destport_in_encoded),
350
        .src_e_addr_o( ),
351 55 alirezamon
        .dest_e_addr_o(dest_e_addr_in ),
352 48 alirezamon
        .vc_num_o(vc_num_in),
353
        .hdr_flit_wr_o( ),
354
        .hdr_flg_o(hdr_flg),
355
        .tail_flg_o(tail_flg),
356
        .weight_o( ),
357
        .be_o( ),
358
        .data_o( )
359 56 alirezamon
    );
360 48 alirezamon
 
361
 
362
 
363
// check condition 1 & 2
364
assign condition_1_2_valid = ~(any_ovc_granted_in_ss_port  | any_ivc_sw_request_granted);
365
 
366
 
367
//check destination port is ss
368
wire ss_port_hdr_flit, ss_port_nonhdr_flit;
369
 
370 55 alirezamon
ssa_check_destport #(
371 56 alirezamon
    .NOC_ID(NOC_ID),
372 48 alirezamon
    .SW_LOC(SW_LOC),
373 56 alirezamon
    .P(P),
374 48 alirezamon
    .SS_PORT(SS_PORT)
375
)
376
 check_destport
377
(
378
    .destport_encoded(destport_encoded),
379
    .destport_in_encoded(destport_in_encoded),
380 55 alirezamon
    .destport_one_hot(destport_one_hot),
381 48 alirezamon
    .ss_port_hdr_flit(ss_port_hdr_flit),
382 55 alirezamon
    .dest_e_addr_in(dest_e_addr_in),
383
 
384 48 alirezamon
    .ss_port_nonhdr_flit(ss_port_nonhdr_flit)
385
//synthesis translate_off
386
//synopsys  translate_off
387
    ,.clk(clk),
388
    .ivc_num_getting_sw_grant(ivc_num_getting_sw_grant),
389
    .hdr_flg(hdr_flg)
390
//synopsys  translate_on
391
//synthesis translate_on
392
 
393
);
394
 
395
 
396
// check if ss_ovc is ready
397
wire ss_ovc_ready;
398
 
399
wire assigned_ss_ovc_ready;
400
assign assigned_ss_ovc_ready= ss_port_nonhdr_flit & assigned_to_ssovc & assigned_ovc_not_full;
401
assign ss_ovc_ready = (ovc_is_assigned)?assigned_ss_ovc_ready : ovc_avalable_in_ss_port;
402
 
403
// check if ssa is permited by input port
404
 
405
wire ssa_permited_by_iport;
406
 
407
 
408
generate
409 56 alirezamon
if (SSA_EN_IN_PORT) begin : enable
410 48 alirezamon
    assign ssa_permited_by_iport = ss_ovc_ready & (~ivc_request) & condition_1_2_valid;
411
end else begin : disabled
412
    assign ssa_permited_by_iport = 1'b0;
413
end
414
 
415
endgenerate
416
 
417
/*********************************
418
 check incomming packet conditions
419
 *****************************/
420
 wire ss_vc_wr, decrease_credit_pre,allocate_ss_ovc_pre,release_ss_ovc_pre;
421
 assign ss_vc_wr = flit_in_wr & vc_num_in[V_LOCAL];
422
 assign decrease_credit_pre= ~(hdr_flg & (~ss_port_hdr_flit));
423
 assign allocate_ss_ovc_pre= hdr_flg & ss_port_hdr_flit;
424
 assign release_ss_ovc_pre= (single_flit_pck)? decrease_credit_pre : tail_flg;
425
 
426
 
427
// generate output signals
428
assign ivc_reset =  release_ss_ovc_pre & ss_vc_wr & ssa_permited_by_iport  ;
429
assign decreased_credit_in_ss_ovc= decrease_credit_pre & ss_vc_wr & ssa_permited_by_iport;
430
assign ivc_num_getting_sw_grant= decreased_credit_in_ss_ovc;
431
assign ivc_num_getting_ovc_grant= allocate_ss_ovc_pre & ss_vc_wr & ssa_permited_by_iport;
432
assign ovc_released = ivc_reset & ~single_flit_pck;
433
assign ovc_allocated= ivc_num_getting_ovc_grant & ~single_flit_pck;
434
 
435
 
436
 always @(*)begin
437
    granted_ovc_num={V{1'b0}};
438
    granted_ovc_num[V_LOCAL]= ivc_num_getting_ovc_grant;
439
 end
440
 
441
 
442
 
443
endmodule
444
 
445
 
446
 
447 56 alirezamon
module ssa_check_destport #(
448
    parameter NOC_ID=0,
449 48 alirezamon
    parameter SW_LOC = 0,
450 56 alirezamon
    parameter P=5,
451 48 alirezamon
    parameter SS_PORT=0
452 56 alirezamon
)
453
        (
454 48 alirezamon
    destport_encoded, //non header flit dest port
455
    destport_in_encoded, // header flit packet dest port
456
    ss_port_hdr_flit, // asserted if the header incomming flit goes to ss port
457 55 alirezamon
    ss_port_nonhdr_flit, // assert if the body or tail incomming flit goes to ss port
458
    dest_e_addr_in,
459
    destport_one_hot
460
 
461 48 alirezamon
//synthesis translate_off
462
//synopsys  translate_off
463
    ,clk,
464
    ivc_num_getting_sw_grant,
465
    hdr_flg
466
//synopsys  translate_on
467
//synthesis translate_on
468
);
469 56 alirezamon
 
470 48 alirezamon
 
471 56 alirezamon
        `NOC_CONF
472
 
473
 
474
 
475
 
476 48 alirezamon
//synthesis translate_off
477
//synopsys  translate_off
478
    input clk,   ivc_num_getting_sw_grant, hdr_flg;
479
//synopsys  translate_on
480
//synthesis translate_on
481
 
482
    input [DSTPw-1 : 0] destport_encoded, destport_in_encoded;
483 55 alirezamon
    input [MAX_P-1 : 0] destport_one_hot; // buffered flit destination port
484
    input [DAw-1 : 0]  dest_e_addr_in;
485 48 alirezamon
    output ss_port_hdr_flit, ss_port_nonhdr_flit;
486
 
487
    generate
488
    /* verilator lint_off WIDTH */
489
    if(TOPOLOGY == "FATTREE") begin : fat
490
    /* verilator lint_on WIDTH */
491
 
492
       fattree_ssa_check_destport #(
493
        .DSTPw(DSTPw),
494
        .SS_PORT(SS_PORT)
495
       )
496
       check_destport
497
       (
498
        .destport_encoded(destport_encoded),
499
        .destport_in_encoded(destport_in_encoded),
500
        .ss_port_hdr_flit(ss_port_hdr_flit),
501
        .ss_port_nonhdr_flit(ss_port_nonhdr_flit)
502
       );
503
     /* verilator lint_off WIDTH */
504 55 alirezamon
    end else if (TOPOLOGY == "MESH" || TOPOLOGY == "TORUS" ) begin : mesh
505 48 alirezamon
    /* verilator lint_on WIDTH */
506
 
507
        mesh_torus_ssa_check_destport #(
508
            .ROUTE_TYPE(ROUTE_TYPE),
509
            .SW_LOC(SW_LOC),
510
            .P(P),
511
            .DEBUG_EN(DEBUG_EN),
512
            .DSTPw(DSTPw),
513
            .SS_PORT(SS_PORT)
514
        )
515
        destport_check
516
        (
517
            .destport_encoded(destport_encoded),
518
            .destport_in_encoded(destport_in_encoded),
519
            .ss_port_hdr_flit(ss_port_hdr_flit),
520
            .ss_port_nonhdr_flit(ss_port_nonhdr_flit)
521
            //synthesis translate_off
522
            //synopsys  translate_off
523
            ,.clk(clk),
524
            .ivc_num_getting_sw_grant(ivc_num_getting_sw_grant),
525
            .hdr_flg(hdr_flg)
526
            //synopsys  translate_on
527
            //synthesis translate_on
528
 
529 56 alirezamon
        );
530 55 alirezamon
    /* verilator lint_off WIDTH */
531
    end else if (TOPOLOGY == "FMESH") begin :fmesh
532
    /* verilator lint_on WIDTH */
533
        localparam
534
                ELw = log2(T3),
535
                Pw  = log2(P),
536
                PLw = (TOPOLOGY == "FMESH") ? Pw : ELw;
537
 
538
        wire [Pw-1 : 0] endp_p_in;
539
        wire [MAX_P-1 : 0] destport_one_hot_in;
540
 
541
        fmesh_endp_addr_decode #(
542
                        .T1(T1),
543
                        .T2(T2),
544
                        .T3(T3),
545
                        .EAw(EAw)
546
                )
547
                endp_addr_decode
548
                (
549
                        .e_addr(dest_e_addr_in),
550
                        .ex(),
551
                        .ey(),
552
                        .ep(endp_p_in),
553
                        .valid()
554
                );
555
 
556
        destp_generator #(
557
                        .TOPOLOGY(TOPOLOGY),
558
                        .ROUTE_NAME(ROUTE_NAME),
559
                        .ROUTE_TYPE(ROUTE_TYPE),
560
                        .T1(T1),
561
                        .NL(T3),
562
                        .P(P),
563
                        .DSTPw(DSTPw),
564
                        .PLw(PLw),
565
                        .PPSw(PPSw),
566
                        .SELF_LOOP_EN (SELF_LOOP_EN),
567
                        .SW_LOC(SW_LOC),
568
                        .CAST_TYPE(CAST_TYPE)
569
                )
570
                decoder
571
                (
572
                        .destport_one_hot (destport_one_hot_in),
573
                        .dest_port_encoded(destport_in_encoded),
574
                        .dest_port_out( ),
575
                        .endp_localp_num(endp_p_in),
576
                        .swap_port_presel(1'b0),
577
                        .port_pre_sel({PPSw{1'b0}}),
578
                        .odd_column(1'b0)
579
                );
580
 
581
 
582
    assign ss_port_nonhdr_flit = destport_one_hot [SS_PORT];
583
    assign ss_port_hdr_flit    = destport_one_hot_in [SS_PORT];
584
 
585 56 alirezamon
        end else begin : line
586 48 alirezamon
            line_ring_ssa_check_destport #(
587
               .ROUTE_TYPE(ROUTE_TYPE),
588
                .SW_LOC(SW_LOC),
589
                .P(P),
590
                .DEBUG_EN(DEBUG_EN),
591
                .DSTPw(DSTPw),
592
                .SS_PORT(SS_PORT)
593
            )
594
            destport_check
595
            (
596
                .destport_encoded(destport_encoded),
597
                .destport_in_encoded(destport_in_encoded),
598
                .ss_port_hdr_flit(ss_port_hdr_flit),
599
                .ss_port_nonhdr_flit(ss_port_nonhdr_flit)
600
            );
601
 
602
     end
603
    endgenerate
604
 
605
 
606
endmodule
607
 
608
 
609
/**************************
610
            add_ss_port
611
If no output is granted replace the output port with ss one
612
**************************/
613
 
614
 
615 56 alirezamon
module add_ss_port #(
616
    parameter NOC_ID=0,
617
    parameter SW_LOC=0,
618
        parameter P=5
619 48 alirezamon
)(
620
    destport_in,
621
    destport_out
622
);
623
 
624 56 alirezamon
 
625
        `NOC_CONF
626
 
627
 
628 48 alirezamon
        localparam SS_PORT = strieght_port(P,SW_LOC);
629
        localparam DISABLED = P;
630
    localparam P_1     =   ( SELF_LOOP_EN=="NO")?  P-1 : P;
631
 
632
    input  [P_1-1  :   0] destport_in;
633
    output [P_1-1  :   0] destport_out;
634
 
635
    generate
636
    if(SS_PORT == DISABLED) begin :no_ss
637
        assign destport_out = destport_in;
638
    end else begin : ss
639
        reg [P_1-1  :   0] destport_temp;
640
        /* verilator lint_off WIDTH */
641
        if( SELF_LOOP_EN=="YES") begin : slp
642
        /* verilator lint_on WIDTH */
643
                always @(*)begin
644
                                destport_temp=destport_in;
645
                                if(destport_in=={P_1{1'b0}}) destport_temp[SS_PORT]= 1'b1;
646
                end
647
                assign destport_out = destport_temp;
648
        end else begin : nslp
649
                localparam SS_PORT_CODE = (SW_LOC>SS_PORT) ? SS_PORT : SS_PORT-1;
650
                always @(*)begin
651
                        destport_temp=destport_in;
652
                        if(destport_in=={P_1{1'b0}}) begin
653
                                destport_temp[SS_PORT_CODE]= 1'b1;
654
                        end
655
                end
656
                assign destport_out = destport_temp;
657
        end
658
    end //ss
659
    endgenerate
660
 
661
endmodule
662
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.