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 54

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

powered by: WebSVN 2.1.0

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