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/] [iport_reg_base.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
//`define MONITORE_PATH
3
 
4
/**********************************************************************
5
**      File: input_ports.v
6
**
7
**      Copyright (C) 2014-2017  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
**      NoC router input Port. It consists of input buffer, control FIFO
27
**      and request masking/generation control modules
28
**
29
**************************************************************/
30
 
31
 
32
/**************************
33
 
34
    iport_reg_base
35
 
36
**************************/
37
 
38
module iport_reg_base  #(
39 56 alirezamon
    parameter NOC_ID=0,
40 48 alirezamon
    parameter PCK_TYPE = "MULTI_FLIT",
41
    parameter V = 4,     // vc_num_per_port
42
    parameter P = 5,     // router port num
43
    parameter B = 4,     // buffer space :flit per VC
44
    parameter T1= 8,
45
    parameter T2= 8,
46
    parameter T3= 8,
47
    parameter T4= 8,
48
    parameter RAw = 3,
49
    parameter EAw = 3,
50
    parameter C = 4,    //    number of flit class
51
    parameter Fpay = 32,
52
    parameter SW_LOC = 0,
53
    parameter VC_REALLOCATION_TYPE =  "ATOMIC",
54
    parameter COMBINATION_TYPE= "BASELINE",// "BASELINE", "COMB_SPEC1", "COMB_SPEC2", "COMB_NONSPEC"
55
    parameter TOPOLOGY =  "MESH",//"MESH","TORUS"
56
    parameter ROUTE_NAME="XY",// "XY", "TRANC_XY"
57
    parameter ROUTE_TYPE="DETERMINISTIC",// "DETERMINISTIC", "FULL_ADAPTIVE", "PAR_ADAPTIVE"
58
    parameter DEBUG_EN =1,
59
    parameter AVC_ATOMIC_EN= 0,
60
    parameter CVw=(C==0)? V : C * V,
61
    parameter [CVw-1: 0] CLASS_SETTING = {CVw{1'b1}}, // shows how each class can use VCs
62
    parameter [V-1  : 0] ESCAP_VC_MASK = 4'b1000,  // mask scape vc, valid only for full adaptive
63
    parameter DSTPw = P-1,
64
    parameter SSA_EN="YES", // "YES" , "NO"
65
    parameter SWA_ARBITER_TYPE ="RRA",// "RRA","WRRA"
66
    parameter WEIGHTw=4,
67
    parameter WRRA_CONFIG_INDEX=0,
68
    parameter PPSw=4,
69
    parameter MIN_PCK_SIZE=2, //minimum packet size in flits. The minimum value is 1.
70 56 alirezamon
    parameter BYTE_EN=0,
71
    parameter CAST_TYPE= "UNICAST"
72 48 alirezamon
 
73
)(
74
    current_r_addr,
75
    neighbors_r_addr,
76
    ivc_num_getting_sw_grant,// for non spec ivc_num_getting_first_sw_grant,
77
    any_ivc_sw_request_granted,
78
    flit_in,
79
    flit_in_wr,
80
    reset_ivc,
81
    flit_is_tail,
82
    ivc_request,
83
    dest_port_encoded,
84
    dest_port,
85
    candidate_ovcs,
86
    flit_out,
87
    assigned_ovc_num,
88
    sel,
89
    port_pre_sel,
90
    swap_port_presel,
91
    reset,
92
    clk,
93
    nonspec_first_arbiter_granted_ivc,
94
    destport_clear,
95
    ssa_ivc_num_getting_sw_grant,
96
    iport_weight,
97
    oports_weight,
98
    vc_weight_is_consumed,
99
    iport_weight_is_consumed,
100
    refresh_w_counter,
101
    granted_dest_port
102
);
103
 
104
 
105
    function integer log2;
106
      input integer number; begin
107
         log2=(number <=1) ? 1: 0;
108
         while(2**log2
109
            log2=log2+1;
110
         end
111
      end
112
    endfunction // log2
113
 
114
 
115
    localparam
116
        VV = V * V,
117
        VDSTPw = V * DSTPw,
118
        Cw = (C>1)? log2(C): 1,
119
        Fw = 2+V+Fpay,   //flit width;
120
        W = WEIGHTw,
121
        WP = W * P,
122
        P_1=P-1,
123
        VP_1 = V * P_1;
124
 
125
    localparam
126
         /* verilator lint_off WIDTH */
127
         OFFSET = (B%MIN_PCK_SIZE)? 1 :0,
128
         NON_ATOM_PCKS =  (B>MIN_PCK_SIZE)?  (B/MIN_PCK_SIZE)+ OFFSET : 1,
129
         MAX_PCK = (VC_REALLOCATION_TYPE== "ATOMIC")?  1 : NON_ATOM_PCKS;// min packet size is two hence the max packet number in buffer is (B/2)
130
        /* verilator lint_on WIDTH */
131
 
132
     localparam
133
        ELw = log2(T3),
134
        VELw= V * ELw,
135
        PRAw= P * RAw;
136
 
137
 
138
    input reset, clk;
139
    input   [RAw-1 : 0] current_r_addr;
140
    input   [PRAw-1:  0]  neighbors_r_addr;
141
    input   [V-1 : 0] ivc_num_getting_sw_grant;
142
    input                      any_ivc_sw_request_granted;
143
    input   [Fw-1 : 0] flit_in;
144
    input                       flit_in_wr;
145
    input   [V-1 : 0] reset_ivc;
146
    output  [V-1 : 0] flit_is_tail;
147
    output  [V-1 : 0] ivc_request;
148
    output  [VDSTPw-1 : 0] dest_port_encoded;
149
    output  [VP_1-1 : 0] dest_port;
150
    output  [VV-1 : 0] candidate_ovcs;
151
    output  [Fw-1 : 0] flit_out;
152
    input   [VV-1 : 0] assigned_ovc_num;
153
    input   [V-1 : 0] sel;
154
    input   [V-1 : 0] nonspec_first_arbiter_granted_ivc;
155
    input   [V-1 : 0] ssa_ivc_num_getting_sw_grant;
156
    input   [(DSTPw*V)-1 : 0] destport_clear;
157 54 alirezamon
    output  [WEIGHTw-1 : 0] iport_weight;
158 48 alirezamon
    output  [V-1 : 0] vc_weight_is_consumed;
159
    output  iport_weight_is_consumed;
160
    input   refresh_w_counter;
161
    input   [P_1-1 : 0] granted_dest_port;
162
    output  [WP-1 : 0] oports_weight;
163
    input   [PPSw-1 : 0] port_pre_sel;
164
    input   [V-1  : 0]  swap_port_presel;
165
 
166
 
167
 
168
    wire [Cw-1 : 0] class_in;
169
    wire [DSTPw-1 : 0] destport_in,destport_in_encoded;
170
    wire [VDSTPw-1 : 0] lk_destination_encoded;
171
    wire [EAw-1 : 0] dest_e_addr_in;
172
    wire [EAw-1 : 0] src_e_addr_in;
173
    wire [V-1 : 0] vc_num_in;
174
    wire [V-1 : 0] hdr_flit_wr,flit_wr;
175 54 alirezamon
    wire [V-1 : 0] hdr_flit_wr_delayed;
176 48 alirezamon
    wire [V-1 : 0] class_rd_fifo,dst_rd_fifo;
177 54 alirezamon
    wire [V-1 : 0] lk_dst_rd_fifo;
178 48 alirezamon
    wire [DSTPw-1 : 0] lk_destination_in_encoded;
179
    wire [WEIGHTw-1  : 0] weight_in;
180
    wire [Fw-1 : 0] buffer_out;
181
    wire hdr_flg_in,tail_flg_in;
182
    wire [V-1 : 0] ivc_not_empty;
183
    wire [Cw-1 : 0] class_out [V-1 : 0];
184
    wire  [VELw-1 : 0] endp_localp_num;
185
    wire [ELw-1 : 0] endp_l_in;
186 54 alirezamon
    logic  [WEIGHTw-1 : 0] iport_weight_next;
187 48 alirezamon
 
188 56 alirezamon
    //extract header flit info
189 48 alirezamon
    extract_header_flit_info #(
190 56 alirezamon
        .NOC_ID(NOC_ID),
191 48 alirezamon
        .DATA_w(0)
192 56 alirezamon
    ) header_extractor (
193
        .flit_in(flit_in),
194
        .flit_in_wr(flit_in_wr),
195
        .class_o(class_in),
196
        .destport_o(destport_in),
197
        .dest_e_addr_o(dest_e_addr_in),
198
        .src_e_addr_o(src_e_addr_in),
199
        .vc_num_o(vc_num_in),
200
        .hdr_flit_wr_o(hdr_flit_wr),
201
        .hdr_flg_o(hdr_flg_in),
202
        .tail_flg_o(tail_flg_in),
203
        .weight_o(weight_in),
204
        .be_o( ),
205
        .data_o( )
206
    );
207 48 alirezamon
 
208
 
209
    // synopsys  translate_off
210
    // synthesis translate_off
211
     `ifdef MONITORE_PATH
212
 
213
    genvar j;
214
    reg[V-1 :0] t1;
215
    generate
216
    for (j=0;j
217
    always @(posedge clk) begin
218
        if(reset)begin
219
             t1[j]<=1'b0;
220
        end else begin
221
            if(flit_in_wr >0 && vc_num_in[j] && t1[j]==0)begin
222
                $display("%t : Parser: class_in=%x, destport_in=%x, dest_e_addr_in=%x, src_e_addr_in=%x, vc_num_in=%x,hdr_flit_wr=%x, hdr_flg_in=%x,tail_flg_in=%x ",$time,class_in, destport_in, dest_e_addr_in, src_e_addr_in, vc_num_in,hdr_flit_wr, hdr_flg_in,tail_flg_in);
223
                t1[j]<=1;
224
            end
225
        end
226
    end
227
    end
228
    endgenerate
229
    `endif
230
    // synthesis translate_on
231
    // synopsys  translate_on
232
 
233 54 alirezamon
 
234
    pronoc_register #(.W(WEIGHTw), .RESET_TO(1)) reg5(
235
                .in             (iport_weight_next ),
236
                .reset  (reset ),
237
                .clk    (clk   ),
238
                .out    (iport_weight  ));
239
 
240
 
241
    always @ (*)begin
242
        iport_weight_next = iport_weight;
243
        if(hdr_flit_wr != {V{1'b0}})  iport_weight_next = (weight_in=={WEIGHTw{1'b0}})? 1 : weight_in; // the minimum weight is 1
244 48 alirezamon
    end
245
 
246 54 alirezamon
 
247 48 alirezamon
// genrate write enable for lk_routing result with one clock cycle latency after reciveing the flit
248 54 alirezamon
 
249
    pronoc_register #(.W(V)) reg1(
250
                .in             (hdr_flit_wr ),
251
                .reset  (reset ),
252
                .clk    (clk   ),
253
                .out    (hdr_flit_wr_delayed  ));
254 48 alirezamon
 
255
 
256 54 alirezamon
 
257
 
258 48 alirezamon
genvar i;
259
generate
260
    /* verilator lint_off WIDTH */
261
    if (( TOPOLOGY == "RING" || TOPOLOGY == "LINE" || TOPOLOGY == "MESH" || TOPOLOGY == "TORUS") && (T3>1)) begin : multi_local
262
    /* verilator lint_on WIDTH */
263
        mesh_tori_endp_addr_decode #(
264
            .TOPOLOGY("MESH"),
265
            .T1(T1),
266
            .T2(T2),
267
            .T3(T3),
268
            .EAw(EAw)
269
        )
270
        endp_addr_decode
271
        (
272
            .e_addr(dest_e_addr_in),
273
            .ex( ),
274
            .ey( ),
275
            .el(endp_l_in),
276
            .valid( )
277
        );
278
   end
279
 
280
    /* verilator lint_off WIDTH */
281
    if(TOPOLOGY=="FATTREE" && ROUTE_NAME == "NCA_STRAIGHT_UP") begin : fat
282
    /* verilator lint_on WIDTH */
283
 
284
     fattree_destport_up_select #(
285
         .K(T1),
286
         .SW_LOC(SW_LOC)
287
     )
288
     static_sel
289
     (
290
        .destport_in(destport_in),
291
        .destport_o(destport_in_encoded)
292
     );
293
 
294
    end else begin : other
295
        assign destport_in_encoded = destport_in;
296
    end
297
 
298
 
299
      wire odd_column = current_r_addr[0];
300
 
301
    for (i=0;i
302
 
303
        class_ovc_table #(
304
            .CVw(CVw),
305
            .CLASS_SETTING(CLASS_SETTING),
306
            .C(C),
307
            .V(V)
308
        )
309
        class_table
310
        (
311
            .class_in(class_out[i]),
312
            .candidate_ovcs(candidate_ovcs [(i+1)*V-1 : i*V])
313
        );
314
 
315
        //tail fifo
316
        fwft_fifo #(
317
            .DATA_WIDTH(1),
318
            .MAX_DEPTH (B),
319
            .IGNORE_SAME_LOC_RD_WR_WARNING(SSA_EN)
320
        )
321
        tail_fifo
322
        (
323
            .din (tail_flg_in),
324
            .wr_en (flit_wr[i]),   // Write enable
325
            .rd_en (ivc_num_getting_sw_grant[i]),   // Read the next word
326
            .dout (flit_is_tail[i]),    // Data out
327
            .full ( ),
328
            .nearly_full ( ),
329
            .recieve_more_than_0 ( ),
330
            .recieve_more_than_1 ( ),
331
            .reset (reset),
332
            .clk (clk)
333
        );
334
 
335
        //class_fifo
336
        if(C>1)begin :cb1
337
            fwft_fifo #(
338
                .DATA_WIDTH(Cw),
339
                .MAX_DEPTH (MAX_PCK)
340
            )
341
            class_fifo
342
            (
343
                .din (class_in),
344
                .wr_en (hdr_flit_wr[i]),   // Write enable
345
                .rd_en (class_rd_fifo[i]),   // Read the next word
346
                .dout (class_out[i]),    // Data out
347
                .full ( ),
348
                .nearly_full ( ),
349
                .recieve_more_than_0 ( ),
350
                .recieve_more_than_1 ( ),
351
                .reset (reset),
352
                .clk (clk)
353
 
354
            );
355
       end else begin :c_num_1
356
           assign class_out[i] = 1'b0;
357
       end
358
 
359
       //lk_dst_fifo
360
        fwft_fifo #(
361
            .DATA_WIDTH(DSTPw),
362
            .MAX_DEPTH (MAX_PCK)
363
        )
364
        lk_dest_fifo
365
        (
366
             .din (lk_destination_in_encoded),
367
             .wr_en (hdr_flit_wr_delayed [i]),   // Write enable
368
             .rd_en (lk_dst_rd_fifo [i]),   // Read the next word
369
             .dout (lk_destination_encoded  [(i+1)*DSTPw-1 : i*DSTPw]),    // Data out
370
             .full (),
371
             .nearly_full (),
372
             .recieve_more_than_0 (),
373
             .recieve_more_than_1 (),
374
             .reset (reset),
375
             .clk (clk)
376
 
377
        );
378
 
379
        /* verilator lint_off WIDTH */
380
        if( ROUTE_TYPE=="DETERMINISTIC") begin : dtrmn_dest
381
        /* verilator lint_on WIDTH */
382
            //destport_fifo
383
            fwft_fifo #(
384
                 .DATA_WIDTH(DSTPw),
385
                 .MAX_DEPTH (MAX_PCK)
386
            )
387
            dest_fifo
388
            (
389
                 .din(destport_in_encoded),
390
                 .wr_en(hdr_flit_wr[i]),   // Write enable
391
                 .rd_en(dst_rd_fifo[i]),   // Read the next word
392
                 .dout(dest_port_encoded[(i+1)*DSTPw-1 : i*DSTPw]),    // Data out
393
                 .full(),
394
                 .nearly_full(),
395
                 .recieve_more_than_0(),
396
                 .recieve_more_than_1(),
397
                 .reset(reset),
398
                 .clk(clk)
399
            );
400
 
401
        end else begin : adptv_dest
402
 
403
            fwft_fifo_with_output_clear #(
404
                .DATA_WIDTH(DSTPw),
405
                .MAX_DEPTH (MAX_PCK)
406
            )
407
            dest_fifo
408
            (
409
                .din(destport_in_encoded),
410
                .wr_en(hdr_flit_wr[i]),   // Write enable
411
                .rd_en(dst_rd_fifo[i]),   // Read the next word
412
                .dout(dest_port_encoded[(i+1)*DSTPw-1 : i*DSTPw]),    // Data out
413
                .full(),
414
                .nearly_full(),
415
                .recieve_more_than_0(),
416
                .recieve_more_than_1(),
417
                .reset(reset),
418
                .clk(clk),
419
                .clear(destport_clear[(i+1)*DSTPw-1 : i*DSTPw])   // clear other destination ports once one of them is selected
420
            );
421
 
422
 
423
        end
424
 
425
 
426
 
427
        destp_generator #(
428
            .TOPOLOGY(TOPOLOGY),
429
            .ROUTE_NAME(ROUTE_NAME),
430
            .ROUTE_TYPE(ROUTE_TYPE),
431
            .T1(T1),
432
            .NL(T3),
433
            .P(P),
434
            .DSTPw(DSTPw),
435
            .ELw(ELw),
436
            .PPSw(PPSw),
437
            .SW_LOC(SW_LOC)
438
        )
439
        decoder
440
        (
441
            .destport_one_hot(),
442
            .dest_port_encoded(dest_port_encoded[(i+1)*DSTPw-1 : i*DSTPw]),
443
            .dest_port_out(dest_port[(i+1)*P_1-1 : i*P_1]),
444
            .endp_localp_num(endp_localp_num[(i+1)*ELw-1 : i*ELw]),
445
            .swap_port_presel(swap_port_presel[i]),
446
            .port_pre_sel(port_pre_sel),
447
            .odd_column(odd_column)
448
        );
449
 
450
 
451
         /* verilator lint_off WIDTH */
452
        if (( TOPOLOGY == "RING" || TOPOLOGY == "LINE" || TOPOLOGY == "MESH" || TOPOLOGY == "TORUS") && (T3>1)) begin : multi_local
453
          /* verilator lint_on WIDTH */
454
            // the router has multiple local ports. Save the destination local port
455
 
456
 
457
            fwft_fifo #(
458
                 .DATA_WIDTH(ELw),
459
                 .MAX_DEPTH (MAX_PCK)
460
            )
461
            local_dest_fifo
462
            (
463
                 .din(endp_l_in),
464
                 .wr_en(hdr_flit_wr[i]),   // Write enable
465
                 .rd_en(dst_rd_fifo[i]),   // Read the next word
466
                 .dout(endp_localp_num[(i+1)*ELw-1 : i*ELw]),    // Data out
467
                 .full( ),
468
                 .nearly_full( ),
469
                 .recieve_more_than_0(),
470
                 .recieve_more_than_1(),
471
                 .reset(reset),
472
                 .clk(clk)
473
            );
474
 
475
        end else begin : slp
476
            assign endp_localp_num[(i+1)*ELw-1 : i*ELw] = {ELw{1'bx}};
477
        end
478
 
479
        /* verilator lint_off WIDTH */
480
        if(SWA_ARBITER_TYPE != "RRA")begin  : wrra
481
        /* verilator lint_on WIDTH */
482
               /*
483
                weight_control #(
484
                    .WEIGHTw(WEIGHTw)
485
                )
486
                wctrl_per_vc
487
                (
488
                    .sw_is_granted(ivc_num_getting_sw_grant[i]),
489
                    .flit_is_tail(flit_is_tail[i]),
490
                    .weight_is_consumed_o(vc_weight_is_consumed[i]),
491
                    .iport_weight(1),  //(iport_weight),
492
                    .clk(clk),
493
                    .reset(reset)
494
                );
495
                */
496
            assign vc_weight_is_consumed[i] = 1'b1;
497
        end else begin :no_wrra
498
            assign vc_weight_is_consumed[i] = 1'bX;
499
        end
500
 
501
    end//for i
502
 
503
 
504
    /* verilator lint_off WIDTH */
505
    if(SWA_ARBITER_TYPE != "RRA")begin  : wrra
506
    /* verilator lint_on WIDTH */
507
        wire granted_flit_is_tail;
508
 
509
        onehot_mux_1D #(
510
                .W(1),
511
                .N(V)
512
        )
513
        onehot_mux(
514
                .in(flit_is_tail),
515
                .out(granted_flit_is_tail),
516
                .sel(ivc_num_getting_sw_grant)
517
        );
518
 
519
        weight_control#(
520
            .ARBITER_TYPE(SWA_ARBITER_TYPE),
521
            .SW_LOC(SW_LOC),
522
            .WEIGHTw(WEIGHTw),
523
            .WRRA_CONFIG_INDEX(WRRA_CONFIG_INDEX),
524
            .P(P)
525
        )
526
        wctrl_iport
527
        (
528
            .sw_is_granted(any_ivc_sw_request_granted),
529
            .flit_is_tail(granted_flit_is_tail),
530
            .weight_is_consumed_o(iport_weight_is_consumed),
531
            .iport_weight(iport_weight),
532
            .oports_weight(oports_weight),
533
            .granted_dest_port(granted_dest_port),
534
            .refresh_w_counter(refresh_w_counter),
535
            .clk(clk),
536
            .reset(reset)
537
        );
538
 
539
        end else begin :no_wrra
540
            assign iport_weight_is_consumed=1'bX;
541
            assign oports_weight = {WP{1'bX}};
542
        end
543
 
544
    /* verilator lint_off WIDTH */
545
    if(COMBINATION_TYPE == "COMB_NONSPEC") begin  : nonspec
546
    /* verilator lint_on WIDTH */
547
 
548
        flit_buffer #(
549 56 alirezamon
            .V(V),
550 48 alirezamon
            .B(B),   // buffer space :flit per VC
551 56 alirezamon
            .SSA_EN(SSA_EN),
552
                .Fw(Fw),
553
                        .PCK_TYPE(PCK_TYPE),
554
                        .CAST_TYPE(CAST_TYPE),
555
                        .DEBUG_EN(DEBUG_EN)
556
 
557 48 alirezamon
        )
558
        the_flit_buffer
559
        (
560
            .din(flit_in),     // Data in
561
            .vc_num_wr(vc_num_in),//write vertual chanel
562
            .vc_num_rd(nonspec_first_arbiter_granted_ivc),//read vertual chanel
563
            .wr_en(flit_in_wr),   // Write enable
564
            .rd_en(any_ivc_sw_request_granted),     // Read the next word
565
            .dout(buffer_out),    // Data out
566
            .vc_not_empty(ivc_not_empty),
567
            .reset(reset),
568
            .clk(clk),
569 54 alirezamon
            .ssa_rd(ssa_ivc_num_getting_sw_grant),
570
            .multiple_dest(),
571
            .sub_rd_ptr_ld(),
572
            .flit_is_tail()
573 48 alirezamon
        );
574
 
575
 
576
 
577
         localparam VCw = V *Cw;
578
        wire [Fw-1:0] new_buffer_out;
579
        wire [V-1 : 0] new_ivc_not_empty;
580
        wire [VCw-1 : 0] class_all;
581
 
582
 
583
 
584 56 alirezamon
        flit_buffer_reg_base #(
585
            .NOC_ID(NOC_ID),
586 48 alirezamon
            .V(V),
587
            .B(B),
588 56 alirezamon
            .SSA_EN(SSA_EN),
589 48 alirezamon
            .Fpay(Fpay),
590 56 alirezamon
            .DEBUG_EN(DEBUG_EN),
591
            .DSTPw(DSTPw),
592
            .PCK_TYPE(PCK_TYPE),
593
                .CAST_TYPE(CAST_TYPE)
594 48 alirezamon
        )
595
        nn
596
        (
597
            .din(flit_in),
598
            .vc_num_wr(vc_num_in),
599
            .wr_en(flit_in_wr),
600
            .vc_num_rd(nonspec_first_arbiter_granted_ivc),
601
            .rd_en(any_ivc_sw_request_granted),
602
            .dout(new_buffer_out),
603
            .vc_not_empty(new_ivc_not_empty),
604
            .reset(reset),
605
            .clk(clk),
606
            .class_all()
607
        );
608
 
609
        //synthesis translate_off
610
        //synopsys  translate_off
611
        reg check_dout;
612
        always @(posedge clk )begin
613
            check_dout<=any_ivc_sw_request_granted;
614
            if(new_ivc_not_empty != ivc_not_empty) begin
615
                $display("%t: Error: new_iv_not_empty (%h) != iv_not_empty (%h)",$time, new_ivc_not_empty, ivc_not_empty);
616
                $stop;
617
            end
618
 
619
           if( check_dout & ( new_buffer_out[Fpay-1 : 0] != buffer_out[Fpay-1 : 0])) begin
620
                $display("%t: Error: new_buffer_out (%h) != buffer_out (%h)",$time, new_buffer_out, buffer_out);
621
                $stop;
622
           end
623
        end
624
        //synopsys  translate_on
625
        //synthesis translate_on
626
 
627
 
628
 
629
 
630
        // for (i=0;i
631
 
632
        // end
633
 
634
 
635
 
636
    end else begin :spec//not nonspec comb
637
 
638
 
639
        flit_buffer #(
640 56 alirezamon
            .V(V),
641 48 alirezamon
            .B(B),   // buffer space :flit per VC
642 56 alirezamon
            .SSA_EN(SSA_EN),
643
                .Fw(Fw),
644
                        .PCK_TYPE(PCK_TYPE),
645
                        .CAST_TYPE(CAST_TYPE),
646
                        .DEBUG_EN(DEBUG_EN)
647 48 alirezamon
        )
648
        the_flit_buffer
649
        (
650
            .din(flit_in),     // Data in
651
            .vc_num_wr(vc_num_in),//write vertual chanel
652
            .vc_num_rd(ivc_num_getting_sw_grant),//read vertual chanel
653
            .wr_en(flit_in_wr),   // Write enable
654
            .rd_en(any_ivc_sw_request_granted),     // Read the next word
655
            .dout(buffer_out),    // Data out
656
            .vc_not_empty(ivc_not_empty),
657
            .reset(reset),
658
            .clk(clk),
659 54 alirezamon
            .ssa_rd(ssa_ivc_num_getting_sw_grant),
660
            .multiple_dest(),
661
            .sub_rd_ptr_ld(),
662
            .flit_is_tail()
663
 
664 48 alirezamon
        );
665
 
666
    end
667
endgenerate
668
 
669
    look_ahead_routing #(
670
        .T1(T1),
671
        .T2(T2),
672
        .T3(T3),
673
        .T4(T4),
674
        .P(P),
675
        .RAw(RAw),
676
        .EAw(EAw),
677
        .DSTPw(DSTPw),
678
        .SW_LOC(SW_LOC),
679
        .TOPOLOGY(TOPOLOGY),
680
        .ROUTE_NAME(ROUTE_NAME),
681
        .ROUTE_TYPE(ROUTE_TYPE)
682 56 alirezamon
    ) lk_routing (
683 48 alirezamon
        .current_r_addr(current_r_addr),
684
        .neighbors_r_addr(neighbors_r_addr),
685
        .dest_e_addr(dest_e_addr_in),
686
        .src_e_addr(src_e_addr_in),
687
        .destport_encoded(destport_in_encoded),
688
        .lkdestport_encoded(lk_destination_in_encoded),
689
        .reset(reset),
690
        .clk(clk)
691
     );
692
 
693
    header_flit_update_lk_route_ovc #(
694 56 alirezamon
        .NOC_ID(NOC_ID),
695
        .P(P)
696
    ) the_flit_update (
697 48 alirezamon
        .flit_in (buffer_out),
698
        .flit_out (flit_out),
699
        .vc_num_in(ivc_num_getting_sw_grant),
700
        .lk_dest_all_in (lk_destination_encoded),
701
        .assigned_ovc_num (assigned_ovc_num),
702
        .any_ivc_sw_request_granted(any_ivc_sw_request_granted),
703
        .lk_dest_not_registered(lk_destination_in_encoded),
704
        .sel (sel),
705
        .reset (reset),
706
        .clk (clk)
707
    );
708
 
709
    assign flit_wr =(flit_in_wr )? vc_num_in : {V{1'b0}};
710
 
711
 
712 54 alirezamon
    pronoc_register #(.W(V)) reg2(
713
                .in             (dst_rd_fifo ),
714
                .reset  (reset ),
715
                .clk    (clk   ),
716
                .out    (lk_dst_rd_fifo  ));
717
 
718
 
719 48 alirezamon
    assign    dst_rd_fifo = reset_ivc;
720
    assign    class_rd_fifo = (C>1)? reset_ivc : {V{1'bx}};
721
    assign    ivc_request = ivc_not_empty;
722
 
723
//synthesis translate_off
724
//synopsys  translate_off
725
generate
726
if(DEBUG_EN) begin :dbg
727
 
728
    debug_IVC_flit_type_order_check #(
729
        .V(V)
730
    )
731
    IVC_flit_type_check
732
    (
733
        .clk(clk),
734
        .reset(reset),
735
        .hdr_flg_in(hdr_flg_in),
736
        .tail_flg_in(tail_flg_in),
737
        .flit_in_wr(flit_in_wr),
738
        .vc_num_in(vc_num_in),
739
        .reset_all_errors(1'b0),
740
        .active_IVC_hdr_flit_received_err( ),
741
        .inactive_IVC_tail_flit_received_err( ),
742
        .inactive_IVC_body_flit_received_err( )
743
    );
744
 
745
     /* verilator lint_off WIDTH */
746
     if (( TOPOLOGY == "RING" || TOPOLOGY == "LINE" || TOPOLOGY == "MESH" || TOPOLOGY == "TORUS")) begin : mesh_based
747
     /* verilator lint_on WIDTH */
748
 
749
        debug_mesh_tori_route_ckeck #(
750
            .T1(T1),
751
            .T2(T2),
752
            .T3(T3),
753
            .ROUTE_TYPE(ROUTE_TYPE),
754
            .V(V),
755
            .AVC_ATOMIC_EN(AVC_ATOMIC_EN),
756
            .SW_LOC(SW_LOC),
757
            .ESCAP_VC_MASK(ESCAP_VC_MASK),
758
            .TOPOLOGY(TOPOLOGY),
759
            .DSTPw(DSTPw),
760
            .RAw(RAw),
761
            .EAw(EAw)
762
        )
763
        route_ckeck
764
        (
765
            .reset(reset),
766
            .clk(clk),
767
            .hdr_flg_in(hdr_flg_in),
768
            .flit_in_wr(flit_in_wr),
769
            .vc_num_in(vc_num_in),
770
            .flit_is_tail(flit_is_tail),
771
            .ivc_num_getting_sw_grant(ivc_num_getting_sw_grant),
772
            .current_r_addr(current_r_addr),
773
            .dest_e_addr_in(dest_e_addr_in),
774
            .src_e_addr_in(src_e_addr_in),
775
            .destport_in(destport_in)
776
        );
777
    end//mesh
778
end//DEBUG_EN
779
endgenerate
780
//synopsys  translate_on
781
//synthesis translate_on
782
 
783
 
784 54 alirezamon
endmodule

powered by: WebSVN 2.1.0

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