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 55

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

powered by: WebSVN 2.1.0

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