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/] [debug.v] - Blame information for rev 56

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 alirezamon
`timescale 1ns / 1ps
2
 
3
/**************************************
4
* Module: debug
5
* Date:2019-04-01
6
* Author: alireza
7
*
8
* Description: this file contain modules which are used for error checking/debiging of the NoC.
9
***************************************/
10
 
11
//check if flits are recived in correct order in a VC
12
 
13
module check_flit_chanel_type_is_in_order #(
14
    parameter V=4,
15
    parameter PCK_TYPE = "SINGLE_FLIT",
16
    parameter MIN_PCK_SIZE=2
17
)(
18
    hdr_flg_in,
19
    flit_in_wr,
20
    tail_flg_in,
21
    vc_num_in,
22
    clk,
23
    reset
24
 
25
);
26
 
27
    input clk, reset;
28
    input hdr_flg_in, tail_flg_in, flit_in_wr;
29
    input [V-1 : 0] vc_num_in;
30
 
31
 
32
 
33
 
34
    wire [V-1 : 0] vc_num_hdr_wr, vc_num_tail_wr,vc_num_bdy_wr ;
35 54 alirezamon
    wire [V-1 : 0] hdr_passed;
36
    reg  [V-1 : 0] hdr_passed_next;
37 48 alirezamon
    wire [V-1 : 0] single_flit_pck;
38
 
39
    assign  vc_num_hdr_wr =(hdr_flg_in & flit_in_wr) ?    vc_num_in : 0;
40
    assign  vc_num_tail_wr =(tail_flg_in & flit_in_wr)?    vc_num_in : 0;
41
    assign  vc_num_bdy_wr =({hdr_flg_in,tail_flg_in} == 2'b00 && flit_in_wr)?    vc_num_in : 0;
42
    assign  single_flit_pck = vc_num_hdr_wr & vc_num_tail_wr;
43
    always @(*)begin
44
        hdr_passed_next = (hdr_passed | vc_num_hdr_wr) & ~vc_num_tail_wr;
45
    end
46
 
47
    // synthesis translate_off
48 54 alirezamon
 
49
    pronoc_register #(
50
           .W(V)
51
      ) reg2 (
52
           .in(hdr_passed_next),
53
           .reset(reset),
54
           .clk(clk),
55
           .out(hdr_passed)
56
      );
57
 
58
 
59
 
60
    always @ (posedge clk ) begin
61 48 alirezamon
            if(( hdr_passed & vc_num_hdr_wr)>0  )begin
62
                $display("%t ERROR: a header flit is received in  an active IVC %m",$time);
63
                $finish;
64
            end
65
            if((~hdr_passed & vc_num_tail_wr & ~single_flit_pck )>0 ) begin
66
                $display("%t ERROR: a tail flit is received in an inactive IVC %m",$time);
67
                $finish;
68
            end
69
            if ((~hdr_passed & vc_num_bdy_wr    )>0)begin
70
                $display("%t ERROR: a body flit is received in an inactive IVC %m",$time);
71
                $finish;
72
            end
73
            /* verilator lint_off WIDTH */
74
            if((PCK_TYPE == "SINGLE_FLIT") &  flit_in_wr & ~(hdr_flg_in &  tail_flg_in )) begin
75
                $display("%t ERROR: both tail and header flit flags must be asserted in SINGLE_FLIT mode %m",$time);
76
                $finish;
77
            end
78
            /* verilator lint_on WIDTH */
79
            if( (MIN_PCK_SIZE !=1) &  flit_in_wr & hdr_flg_in &  tail_flg_in ) begin
80
                $display("%t ERROR: A single flit packet is injected while the minimum packet size is set to %d.  %m",$time,MIN_PCK_SIZE);
81
                $finish;
82
            end
83 54 alirezamon
            //TODO check that the injected packet size meets the MIN_PCK_SIZE            
84
 
85 48 alirezamon
    end//always
86
    // synthesis translate_on
87
endmodule
88
 
89
 
90
 
91
 
92
 
93
 
94
module debug_mesh_tori_route_ckeck #(
95
    parameter T1=4,
96
    parameter T2=4,
97
    parameter T3=4,
98
    parameter ROUTE_TYPE = "FULL_ADAPTIVE",
99
    parameter V=4,
100
    parameter AVC_ATOMIC_EN=1,
101
    parameter SW_LOC = 0,
102
    parameter [V-1 : 0] ESCAP_VC_MASK= 4'b0001,
103
    parameter TOPOLOGY="MESH",
104
    parameter DSTPw=4,
105
    parameter RAw=4,
106 54 alirezamon
    parameter EAw=4,
107
    parameter DAw=EAw
108 48 alirezamon
)(
109
    reset,
110
    clk,
111
    hdr_flg_in,
112
    flit_in_wr,
113
    flit_is_tail,
114
    ivc_num_getting_sw_grant,
115
    vc_num_in,
116
    current_r_addr,
117
    dest_e_addr_in,
118
    src_e_addr_in,
119
    destport_in
120
);
121
 
122
    function integer log2;
123
        input integer number; begin
124
           log2=(number <=1) ? 1: 0;
125
           while(2**log2<number) begin
126
              log2=log2+1;
127
           end
128
        end
129
    endfunction // log2 
130
 
131
 
132
    input reset,clk;
133
    input hdr_flg_in , flit_in_wr;
134
    input [V-1 : 0] vc_num_in, flit_is_tail,  ivc_num_getting_sw_grant;
135
    input [RAw-1 : 0] current_r_addr;
136 54 alirezamon
    input [DAw-1 : 0] dest_e_addr_in;
137
    input [EAw-1 : 0] src_e_addr_in;
138 48 alirezamon
    input [DSTPw-1 : 0]  destport_in;
139
 
140
    localparam
141
      NX = T1,
142
      NY = T2,
143
      RXw = log2(NX),    // number of node in x axis
144 56 alirezamon
      RYw = (TOPOLOGY=="RING" || TOPOLOGY == "LINE") ? 1 : log2(NY),
145 48 alirezamon
      EXw = log2(NX),    // number of node in x axis
146 56 alirezamon
      EYw = (TOPOLOGY=="RING" || TOPOLOGY == "LINE") ? 1 : log2(NY);   // number of node in y axis
147 48 alirezamon
 
148
 
149
    wire [RXw-1 : 0] current_x;
150
    wire [EXw-1 : 0] x_dst_in,x_src_in;
151
    wire [RYw-1 : 0] current_y;
152
    wire [EYw-1 : 0] y_dst_in,y_src_in;
153
 
154
    mesh_tori_router_addr_decode #(
155
        .TOPOLOGY(TOPOLOGY),
156
        .T1(T1),
157
        .T2(T2),
158
        .T3(T3),
159
        .RAw(RAw)
160
    )
161
    r_addr_decode
162
    (
163
        .r_addr(current_r_addr),
164
        .rx(current_x),
165
        .ry(current_y),
166
        .valid()
167
    );
168
 
169
    mesh_tori_endp_addr_decode #(
170
        .TOPOLOGY(TOPOLOGY),
171
        .T1(T1),
172
        .T2(T2),
173
        .T3(T3),
174
        .EAw(EAw)
175
    )
176
    dst_addr_decode
177
    (
178
        .e_addr(dest_e_addr_in),
179
        .ex(x_dst_in),
180
        .ey(y_dst_in),
181
        .el( ),
182
        .valid()
183
    );
184
 
185
    mesh_tori_endp_addr_decode #(
186
        .TOPOLOGY(TOPOLOGY),
187
        .T1(T1),
188
        .T2(T2),
189
        .T3(T3),
190
        .EAw(EAw)
191
    )
192
    src_addr_decode
193
    (
194
        .e_addr(src_e_addr_in),
195
        .ex(x_src_in),
196
        .ey(y_src_in),
197
        .el( ),
198
        .valid()
199
    );
200
 
201
 
202
localparam
203
    LOCAL =  0,
204
    NORTH =  2,
205
    SOUTH =  4;
206
 // synthesis translate_off 
207
generate
208
 
209
/* verilator lint_off WIDTH */
210
if(ROUTE_TYPE == "DETERMINISTIC")begin :dtrmn
211
/* verilator lint_on WIDTH */
212
 
213
 
214
    always@( posedge clk)begin
215
        if(flit_in_wr & hdr_flg_in )
216
               if( destport_in[1:0]==2'b11) begin
217
                    $display ( "%t\t  ERROR: destport port %x is illegal for determistic routing.  %m",$time,destport_in );
218
                    $finish;
219
               end
220
        end//if
221
    end//always
222
 
223
 
224
/* verilator lint_off WIDTH */
225
if(ROUTE_TYPE == "FULL_ADAPTIVE")begin :full_adpt
226
/* verilator lint_on WIDTH */
227
 
228 54 alirezamon
    wire [V-1 : 0] not_empty;
229
    reg  [V-1 : 0] not_empty_next;
230
 
231
    pronoc_register #(
232
           .W(V)
233
      ) reg2 (
234
           .in(not_empty_next),
235
           .reset(reset),
236
           .clk(clk),
237
           .out(not_empty)
238
      );
239
 
240
     always@(*) begin
241
        not_empty_next = not_empty;
242
        if(hdr_flg_in & flit_in_wr) begin
243
            not_empty_next = not_empty | vc_num_in;
244
        end//hdr_wr_in
245
        if((flit_is_tail & ivc_num_getting_sw_grant)>0)begin
246
            not_empty_next = not_empty & ~ivc_num_getting_sw_grant;
247
        end//tail wr out
248
     end//always
249
 
250
    always@( posedge clk ) begin
251
        if(hdr_flg_in & flit_in_wr) begin
252
            if( ((AVC_ATOMIC_EN==1)&& (SW_LOC!= LOCAL)) || (SW_LOC== NORTH) || (SW_LOC== SOUTH) )begin
253
                if((vc_num_in  & ~ESCAP_VC_MASK)>0) begin // adaptive VCs
254
                    if( (not_empty & vc_num_in)>0) $display("%t  :Error AVC allocated nonatomicly in %d port %m",$time,SW_LOC);
255
                end
256
             end//( AVC_ATOMIC_EN || SW_LOC== NORTH || SW_LOC== SOUTH )
257
             if((vc_num_in  & ESCAP_VC_MASK)>0 && (SW_LOC== SOUTH || SW_LOC== NORTH) )  begin // escape vc
258
                       // if (a & b) $display("%t  :Error EVC allocation violate subfunction routing rules %m",$time);
259
                    if ((current_x - x_dst_in) !=0 && (current_y- y_dst_in) !=0) $display("%t  :Error EVC allocation violate subfunction routing rules src_x=%d src_y=%d dst_x%d   dst_y=%d %m",$time,x_src_in, y_src_in, x_dst_in,y_dst_in);
260
             end
261
         end//hdr_wr_in            
262 48 alirezamon
        end//always
263
    end //SW_LOC
264
 
265
 
266
    /* verilator lint_off WIDTH */
267
    if(TOPOLOGY=="MESH")begin :mesh
268
    /* verilator lint_on WIDTH */
269
        wire  [EXw-1 : 0] low_x,high_x;
270
        wire  [EYw-1 : 0] low_y,high_y;
271
 
272
 
273
 
274
        assign low_x = (x_src_in < x_dst_in)?  x_src_in : x_dst_in;
275
        assign low_y = (y_src_in < y_dst_in)?  y_src_in : y_dst_in;
276
        assign high_x = (x_src_in < x_dst_in)?  x_dst_in : x_src_in;
277
        assign high_y = (y_src_in < y_dst_in)?  y_dst_in : y_src_in;
278
 
279
 
280
        always@( posedge clk)begin
281
               if((current_x <low_x) | (current_x > high_x) | (current_y <low_y) | (current_y > high_y) )
282
                    if(flit_in_wr & hdr_flg_in )begin
283
                        $display ( "%t\t  ERROR: non_minimal routing %m",$time );
284
                        $finish;
285
                    end
286
 
287
        end
288
 
289
 
290
    end// mesh  
291
  endgenerate
292
 
293
  // synthesis translate_on
294
 
295
  endmodule
296
 
297
 
298
 module debug_mesh_edges #(
299
    parameter T1=2,
300
    parameter T2=2,
301
    parameter T3=3,
302
    parameter T4=3,
303
    parameter RAw=4,
304
    parameter P=5
305
 )(
306
    clk,
307
    current_r_addr,
308
    flit_out_wr_all
309
 );
310
 
311
    function integer log2;
312
        input integer number; begin
313
           log2=(number <=1) ? 1: 0;
314
           while(2**log2<number) begin
315
              log2=log2+1;
316
           end
317
        end
318
    endfunction // log2 
319
 
320
    input clk;
321
    input  [RAw-1 :  0]  current_r_addr;
322
    input  [P-1 :  0]  flit_out_wr_all;
323
 
324
    localparam
325
        RXw = log2(T1),    // number of node in x axis
326
        RYw = log2(T2);    // number of node in y axis
327
 
328
 
329
  wire [RXw-1 : 0] current_rx;
330
  wire [RYw-1 : 0] current_ry;
331
 
332
    mesh_tori_router_addr_decode #(
333
        .TOPOLOGY("MESH"),
334
        .T1(T1),
335
        .T2(T2),
336
        .T3(T3),
337
        .RAw(RAw)
338
    )
339
    addr_decode
340
    (
341
        .r_addr(current_r_addr),
342
        .rx(current_rx),
343
        .ry(current_ry),
344
        .valid()
345
    );
346
 
347
 
348
    localparam
349
        EAST = 1,
350
        NORTH = 2,
351
        WEST = 3,
352
        SOUTH = 4;
353
  // synthesis translate_off 
354
        always @(posedge clk) begin
355
        /* verilator lint_off WIDTH */
356
                if(current_rx == {RXw{1'b0}}         && flit_out_wr_all[WEST]) $display ( "%t\t  ERROR: a packet is going to the WEST in a router located in first column in mesh topology %m",$time );
357
                if(current_rx == T1-1     && flit_out_wr_all[EAST]) $display ( "%t\t   ERROR: a packet is going to the EAST in a router located in last column in mesh topology %m",$time );
358
                if(current_ry == {RYw{1'b0}}         && flit_out_wr_all[NORTH])$display ( "%t\t  ERROR: a packet is going to the NORTH in a router located in first row in mesh topology %m",$time );
359
                if(current_ry == T2-1    && flit_out_wr_all[SOUTH])$display ( "%t\t  ERROR: a packet is going to the SOUTH in a router located in last row in mesh topology %m",$time);
360
      /* verilator lint_on WIDTH */
361
        end//always
362
  // synthesis translate_on  
363
endmodule
364
 
365
 
366
/*******************
367
 *
368
 * *****************/
369
 
370
 module check_destination_addr #(
371 56 alirezamon
    parameter NOC_ID=0,
372 48 alirezamon
    parameter TOPOLOGY = "MESH",
373
    parameter T1=2,
374
    parameter T2=2,
375
    parameter T3=2,
376
    parameter T4=2,
377
    parameter EAw=2,
378 54 alirezamon
    parameter DAw=2,
379
    parameter SELF_LOOP_EN="NO",
380
    parameter CAST_TYPE = "UNICAST",
381
    parameter NE=8
382 48 alirezamon
 )(
383
     dest_is_valid,
384
     dest_e_addr,
385
     current_e_addr
386
 );
387
 
388 54 alirezamon
    input [DAw-1 : 0]  dest_e_addr;
389
    input [EAw-1 : 0]  current_e_addr;
390 48 alirezamon
    output dest_is_valid;
391
 
392
    // general rules
393
    /* verilator lint_off WIDTH */
394
    wire valid_dst  = (SELF_LOOP_EN   == "NO")? dest_e_addr  !=  current_e_addr : 1'b1;
395
    /* verilator lint_on WIDTH */
396
    wire valid;
397
    generate
398 54 alirezamon
    if(CAST_TYPE != "UNICAST") begin
399
 
400
            wire [NE-1 : 0] dest_mcast_all_endp;
401
 
402 56 alirezamon
            mcast_dest_list_decode #(
403
                .NOC_ID(NOC_ID)
404
            ) decode (
405 54 alirezamon
                .dest_e_addr(dest_e_addr),
406
                .dest_o(dest_mcast_all_endp),
407
                .row_has_any_dest( ),
408
                .is_unicast()
409
            );
410
        //wire valid_dst_multi_r1  = (SELF_LOOP_EN   == "NO") ? ~(dest_mcast_all_endp[current_e_addr] == 1'b1) : 1'b1;
411
        wire valid_dst_multi_r2  = ~(dest_mcast_all_endp == {NE{1'b0}}); // there should be atleast one asserted destination
412
 
413
        assign  dest_is_valid =  valid_dst_multi_r2;// & valid_dst_multi_r1 ;  
414
    end else
415 48 alirezamon
    /* verilator lint_off WIDTH */
416
    if(TOPOLOGY=="MESH" || TOPOLOGY == "TORUS" || TOPOLOGY=="RING" || TOPOLOGY == "LINE") begin : mesh
417
   /* verilator lint_on WIDTH */
418
        mesh_tori_endp_addr_decode #(
419
                .TOPOLOGY(TOPOLOGY),
420
                .T1(T1),
421
                .T2(T2),
422
                .T3(T3),
423
                .EAw(EAw)
424
        )
425
        mesh_tori_endp_addr_decode(
426
                .e_addr(dest_e_addr),
427
                .ex(),
428
                .ey(),
429
                .el(),
430
                .valid(valid)
431
        );
432
       assign  dest_is_valid = valid_dst & valid;
433
 
434
    end else begin : tree
435
        assign  dest_is_valid = valid_dst;
436
    end
437
    endgenerate
438
 
439
 endmodule
440
 
441
 
442
 
443
module  endp_addr_encoder #(
444
    parameter TOPOLOGY ="MESH",
445
    parameter T1=4,
446
    parameter T2=4,
447
    parameter T3=4,
448
    parameter EAw=4,
449
    parameter NE=16
450
)
451
(
452
    id,
453
    code
454
 );
455
 
456
    function integer log2;
457
      input integer number; begin
458
         log2=(number <=1) ? 1: 0;
459
         while(2**log2<number) begin
460
            log2=log2+1;
461
         end
462
      end
463
    endfunction // log2 
464
 
465
    localparam NEw= log2(NE);
466
 
467
     input [NEw-1 :0] id;
468
     output [EAw-1 : 0] code;
469
 
470
     generate
471
     /* verilator lint_off WIDTH */
472
     if(TOPOLOGY == "FATTREE" || TOPOLOGY == "TREE" ) begin : tree
473
     /* verilator lint_on WIDTH */
474
       fattree_addr_encoder #(
475
        .K(T1),
476
        .L(T2)
477
       )
478
       addr_encoder
479
       (
480
        .id(id),
481
        .code(code)
482
       );
483
 
484
     /* verilator lint_off WIDTH */
485
     end else if  (TOPOLOGY == "MESH" || TOPOLOGY == "TORUS" || TOPOLOGY == "RING" || TOPOLOGY == "LINE") begin :tori
486
     /* verilator lint_on WIDTH */
487
        mesh_tori_addr_encoder #(
488
            .NX(T1),
489
            .NY(T2),
490
            .NL(T3),
491
            .NE(NE),
492
            .EAw(EAw),
493
            .TOPOLOGY(TOPOLOGY)
494
        )
495
        addr_encoder
496
        (
497
            .id(id),
498
            .code(code)
499
        );
500
     end else if (TOPOLOGY == "FMESH") begin :fmesh
501
        fmesh_addr_encoder #(
502
            .NX(T1),
503
            .NY(T2),
504
            .NL(T3),
505
            .NE(NE),
506
            .EAw(EAw)
507
        )
508
        addr_encoder
509
        (
510
        .id(id),
511
        .code(code)
512
        );
513
 
514
     end else begin :custom
515
 
516
        assign code =id;
517
 
518
     end
519
     endgenerate
520
endmodule
521
 
522
 
523
module endp_addr_decoder  #(
524
        parameter TOPOLOGY ="MESH",
525
        parameter T1=4,
526
        parameter T2=4,
527
        parameter T3=4,
528
        parameter EAw=4,
529
        parameter NE=16
530
        )
531
        (
532
        id,
533
        code
534
        );
535
 
536
    function integer log2;
537
        input integer number; begin
538
            log2=(number <=1) ? 1: 0;
539
            while(2**log2<number) begin
540
                log2=log2+1;
541
            end
542
        end
543
    endfunction // log2 
544
 
545
    localparam NEw= log2(NE);
546
 
547
    output [NEw-1 :0] id;
548
    input  [EAw-1 : 0] code;
549
 
550
    generate
551
    /* verilator lint_off WIDTH */
552
    if(TOPOLOGY == "FATTREE" || TOPOLOGY == "TREE" ) begin : tree
553
    /* verilator lint_on WIDTH */
554
        fattree_addr_decoder #(
555
                .K(T1),
556
                .L(T2)
557
 
558
            )decoder(
559
                .id(id),
560
                .code(code)
561
            );
562
    /* verilator lint_off WIDTH */
563
    end else if  (TOPOLOGY == "MESH" || TOPOLOGY == "TORUS" || TOPOLOGY == "RING" || TOPOLOGY == "LINE") begin :tori
564
    /* verilator lint_on WIDTH */
565
        mesh_tori_addr_coder #(
566 56 alirezamon
            .TOPOLOGY(TOPOLOGY),
567 48 alirezamon
            .NX    (T1   ),
568
            .NY    (T2   ),
569
            .NL    (T3   ),
570
            .NE    (NE   ),
571
            .EAw   (EAw  )
572
            ) addr_coder (
573
            .id    (id   ),
574
            .code  (code ));
575 54 alirezamon
      /* verilator lint_off WIDTH */
576 48 alirezamon
     end else if (TOPOLOGY == "FMESH") begin :fmesh
577 54 alirezamon
      /* verilator lint_on WIDTH */
578 48 alirezamon
        fmesh_addr_coder #(
579
            .NX(T1),
580
            .NY(T2),
581
            .NL(T3),
582
            .NE(NE),
583
            .EAw(EAw)
584
        )
585
        addr_coder
586
        (
587
        .id(id),
588
        .code(code)
589
        );
590
 
591
    end else begin :custom
592
 
593
        assign id = code;
594
 
595
    end
596
    endgenerate
597
endmodule
598
 
599
 
600 54 alirezamon
module check_pck_size #(
601 56 alirezamon
    parameter NOC_ID=0,
602 54 alirezamon
    parameter V=2,
603
    parameter MIN_PCK_SIZE=2,
604
    parameter Fw=36,
605
    parameter DAw=4,
606
    parameter CAST_TYPE="UNICAST",
607
    parameter NE=4,
608
    parameter B=4,
609
    parameter LB=4
610
)(
611
    hdr_flg_in,
612
    flit_in_wr,
613
    tail_flg_in,
614
    vc_num_in,
615
    dest_e_addr_in,
616
    clk,
617
    reset
618
 
619
);
620
 
621
    input clk, reset;
622
    input hdr_flg_in, tail_flg_in, flit_in_wr;
623
    input [V-1 : 0] vc_num_in;
624
    input [DAw-1: 0] dest_e_addr_in;
625
 
626
    wire [NE-1 : 0] dest_mcast_all_endp [V-1 : 0];
627
    wire [31 : 0] pck_size_counter [V-1: 0];
628
    reg  [31 : 0] pck_size_counter_next [V-1: 0];
629
    wire [DAw-1 : 0] dest_e_addr [V-1:0];
630
    wire [V-1 : 0] vc_hdr_wr_en;
631
    wire [V-1 : 0] onehot;
632
 
633 56 alirezamon
    localparam MIN_B =  (B<LB)? B : LB;
634 54 alirezamon
 
635 56 alirezamon
    genvar i;
636
    generate
637
    for (i=0;i<V;i=i+1) begin
638 54 alirezamon
 
639
        always @(*) begin
640
            pck_size_counter_next [i] = pck_size_counter [i];
641
            if (vc_num_in == i)begin
642
                if(flit_in_wr) begin
643
                    if(hdr_flg_in) pck_size_counter_next[i]= 1;
644
                    else pck_size_counter_next[i]=pck_size_counter[i]+1;
645
                end
646
            end
647
        end
648
 
649
 
650
        pronoc_register #(.W(32)) reg1(
651
            .in     (pck_size_counter_next[i]),
652
            .reset  (reset ),
653
            .clk    (clk   ),
654
            .out    (pck_size_counter[i]   ));
655
 
656
         always @(posedge clk) begin
657
            if (vc_num_in == i)begin
658
                if(flit_in_wr & tail_flg_in) begin
659
                    if( pck_size_counter_next[i] < MIN_PCK_SIZE) begin
660
                        $display ( "%t\t  ERROR: A packet is injected to the router with packet size (%d flits) that is smaller than MIN_PCK_SIZE (%d flits) parameter  %m",$time,pck_size_counter_next[i],MIN_PCK_SIZE);
661
                        $finish;
662
                    end
663
                end
664
            end
665
         end
666
 
667
        /* verilator lint_off WIDTH */
668
        if(CAST_TYPE!="UNICAST") begin
669
        /* verilator lint_on WIDTH */
670
        //Check that the size of multicast/broadcast packets <= buffer size
671
            assign vc_hdr_wr_en [i] = flit_in_wr & hdr_flg_in & (vc_num_in == i);
672
            pronoc_register_ld_en #(.W(DAw)) reg2(
673
                .in     (dest_e_addr_in),
674
                .reset  (reset ),
675
                .clk    (clk   ),
676
                .ld     (vc_hdr_wr_en [i] ),
677
                .out    (dest_e_addr[i])
678
            );
679
 
680
 
681 56 alirezamon
            mcast_dest_list_decode #(
682
                .NOC_ID(NOC_ID)
683
            ) decode (
684 54 alirezamon
                .dest_e_addr(dest_e_addr[i]),
685
                .dest_o(dest_mcast_all_endp[i]),
686
                .row_has_any_dest(),
687
                .is_unicast()
688
            );
689
 
690
            is_onehot0 #(
691
                .IN_WIDTH(NE)
692
            )
693
            one_h
694
            (
695
                .in(dest_mcast_all_endp[i]),
696
                .result(onehot[i])
697
 
698
            );
699
 
700
 
701
 
702
 
703
            always @(posedge clk) begin
704
                if (vc_num_in == i)begin
705
                    if(flit_in_wr & ~onehot[i])begin
706
                        if(pck_size_counter_next[i]>MIN_B) begin
707
                            $display ( "%t\t  ERROR: A multicast packet is injected to the router with packet size (%d flits) that is larger than the minimum router buffer size (%d flits) parameter  %m",$time,pck_size_counter_next[i],MIN_B);
708
                            $finish;
709
                        end// size
710
                    end//flit_wr
711
                end//vc_num
712
            end//always
713
 
714
        end//multicast
715
 
716
 
717
 
718
 
719
   end  //for
720
   endgenerate
721
 
722
 
723
 
724
endmodule
725
 

powered by: WebSVN 2.1.0

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