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