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_peripheral/] [ni/] [ni_master.sv] - Blame information for rev 56

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 48 alirezamon
//`define MONITOR_HDR_FLITS
2
//`define MONITOR_DAT_FLITS
3
 
4
/**********************************************************************
5
**      File:  ni.sv
6
**      Date:2017-06-04
7
**
8
**      Copyright (C) 2014-2017  Alireza Monemi
9
**
10
**      This file is part of ProNoC
11
**
12
**      ProNoC ( stands for Prototype Network-on-chip)  is free software:
13
**      you can redistribute it and/or modify it under the terms of the GNU
14
**      Lesser General Public License as published by the Free Software Foundation,
15
**      either version 2 of the License, or (at your option) any later version.
16
**
17
**      ProNoC is distributed in the hope that it will be useful, but WITHOUT
18
**      ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19
**      or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General
20
**      Public License for more details.
21
**
22
**      You should have received a copy of the GNU Lesser General Public
23
**      License along with ProNoC. If not, see .
24
**
25
**
26
**      Description: multi-chanel DMA-based network interface for
27
**  handling packetizing/depacketizing data to/form NoC.
28
**  Can support CRC32
29
**
30
**
31
*******************************************************************/
32
 
33 56 alirezamon
`include "pronoc_def.v"
34 48 alirezamon
 
35
 
36
module  ni_master
37 56 alirezamon
        #(
38
    parameter NOC_ID=0,
39 48 alirezamon
    parameter MAX_TRANSACTION_WIDTH=10, // Maximum transaction size will be 2 power of MAX_DMA_TRANSACTION_WIDTH words
40
    parameter MAX_BURST_SIZE =256, // in words
41
    parameter CRC_EN= "NO",// "YES","NO" if CRC is enable then the CRC32 of all packet data is calculated and sent via tail flit.
42
    parameter HDATA_PRECAPw=0,
43
    // The header Data pre capture width. It Will be enabled when it is larger than zero. The header data can optionally carry a short width Data. This data can be pre-captured (completely/partially)
44
    // by the NI before saving the packet in a memory buffer. This can give some hints to the software regarding the incoming
45
    // packet such as its type, or source port so the software can store the packet in its appropriate buffer.
46
 
47
    //wishbone port parameters
48
    parameter Dw            =   32,
49
    parameter S_Aw          =   7,
50
    parameter M_Aw          =   32,
51
    parameter TAGw          =   3,
52 56 alirezamon
    parameter SELw          =   4
53 48 alirezamon
)
54
(
55
    //general
56
    reset,
57
    clk,
58
 
59
    //noc interface
60
    current_r_addr,
61
    current_e_addr,
62
    chan_in,
63
    chan_out,
64
 
65
    //wishbone slave interface signals
66
    s_dat_i,
67
    s_sel_i,
68
    s_addr_i,
69
    s_cti_i,
70
    s_stb_i,
71
    s_cyc_i,
72
    s_we_i,
73
    s_dat_o,
74
    s_ack_o,
75
 
76
    //wishbone master rd interface signals
77
    m_send_sel_o,
78
    m_send_addr_o,
79
    m_send_cti_o,
80
    m_send_stb_o,
81
    m_send_cyc_o,
82
    m_send_we_o,
83
    m_send_dat_i,
84
    m_send_ack_i,
85
 
86
    //wishbone master wr interface signals
87
    m_receive_sel_o,
88
    m_receive_dat_o,
89
    m_receive_addr_o,
90
    m_receive_cti_o,
91
    m_receive_stb_o,
92
    m_receive_cyc_o,
93
    m_receive_we_o,
94
    m_receive_ack_i,
95
 
96
    //interrupt interface
97
    irq
98
 
99
);
100
 
101 56 alirezamon
   `NOC_CONF
102 48 alirezamon
 
103
 
104
 
105
    input reset,clk;
106
 
107
 
108
     // NOC interfaces
109
    input   [RAw-1   :   0]  current_r_addr;
110
    input   [EAw-1   :   0]  current_e_addr;
111
 
112
    input   smartflit_chanel_t  chan_in;
113
    output  smartflit_chanel_t  chan_out;
114
 
115
 
116
   //wishbone slave interface signals
117
    input   [Dw-1       :   0]      s_dat_i;
118
    input   [SELw-1     :   0]      s_sel_i;
119
    input   [S_Aw-1     :   0]      s_addr_i;
120
    input   [TAGw-1     :   0]      s_cti_i;
121
    input                           s_stb_i;
122
    input                           s_cyc_i;
123
    input                           s_we_i;
124
 
125
    output  reg    [Dw-1       :   0]  s_dat_o;
126
    output  reg                     s_ack_o;
127
 
128
    //wishbone read master interface signals
129
    output  [SELw-1          :   0] m_send_sel_o;
130
    output  [M_Aw-1          :   0] m_send_addr_o;
131
    output  [TAGw-1          :   0] m_send_cti_o;
132
    output                          m_send_stb_o;
133
    output                          m_send_cyc_o;
134
    output                          m_send_we_o;
135
    input   [Dw-1           :  0]   m_send_dat_i;
136
    input                           m_send_ack_i;
137
 
138
     //wishbone write master interface signals
139
    output  [SELw-1          :   0] m_receive_sel_o;
140
    output  [Dw-1            :   0] m_receive_dat_o;
141
    output  [M_Aw-1          :   0] m_receive_addr_o;
142
    output  [TAGw-1          :   0] m_receive_cti_o;
143
    output                          m_receive_stb_o;
144
    output                          m_receive_cyc_o;
145
    output                          m_receive_we_o;
146
    input                           m_receive_ack_i;
147
 
148
      //Interrupt  interface
149
    output                          irq;
150
 
151
    wire                            s_ack_o_next;
152
 
153
 
154
 
155
 
156
    logic  [Fw-1   :   0]  flit_out;
157
    logic                  flit_out_wr;
158
    logic   [V-1    :   0]  credit_in;
159
    logic   [Fw-1   :   0]  flit_in;
160
    logic                   flit_in_wr;
161
    logic  [V-1    :   0]  credit_out;
162
 
163
 
164
    assign      chan_out.flit_chanel.flit = flit_out;
165
    assign  chan_out.flit_chanel.flit_wr = flit_out_wr;
166
    assign  chan_out.flit_chanel.credit = credit_out;
167
 
168
 
169
    assign flit_in   =  chan_in.flit_chanel.flit;
170
    assign flit_in_wr=  chan_in.flit_chanel.flit_wr;
171
    assign credit_in =  chan_in.flit_chanel.credit;
172
 
173 56 alirezamon
    //old ni.v file
174 48 alirezamon
 
175
    localparam
176
        CTRL_FLGw=14,
177
        CHw=log2(V),
178
        BURST_SIZE_w= log2(MAX_BURST_SIZE+1),
179
        STATUS1w=  2 * CHw + 4;
180
 
181
/*   Wishbone bus slave address :
182
 
183
 VC specific registers
184
       address bits
185
 [4+Vw:4]      [3:0]
186
                1  :   CTRL_FLAGS    :  {invalid_send_req_err,burst_size_err_isr,send_data_size_err_isr,crc_miss_match_isr,rcive_buff_ovrflw_err_isr,got_packet_isr, packet_is_saved_isr, packet_is_sent_isr,got_any_errorint_en,got_packet_int_en, packet_is_saved_int_en, packet_is_sent_int_en,receive_is_busy, send_is_busy};
187
 
188
                2  :   SEND_DEST_WB_ADDR        // The destination router address
189
                3  :   SEND_POINTER_WB_ADDR,    // The address of data to be sent in byte
190
 Virtual        4  :   SEND_DATA_SIZE,          // The size of data to be sent in byte
191
 chanel        5  :   SEND_HDR_DATA            // The short width data that can be sent by header flit
192
 number
193
                8  :   RECEIVE_SRC_WB_ADDR       // The source router (the router which is sent this packet).
194
                9  :   RECEIVE_POINTER_WB_ADDR   // The address pointer of receiver memory in byte
195
                10 :   RECEIVE_DATA_SIZE_WB_ADDR // The size of received data in byte
196
                11 :   RECEIVE_MAX_BUFF_SIZ      // The receiver allocated buffer size in words. If the packet size is bigger than the buffer size the rest of it will be discarded
197
                12 :   RECEIVE_START_INDEX_WB_ADDR  // The received data is written on RECEIVE_POINTER_WB_ADDR + RECEIVE_START_INDEX_WB_ADDR. If the write address reach to the end of buffer pointer, it starts at the RECEIVE_POINTER_WB_ADDR.
198
                13 :   RECEIVE_CTRL_WB_ADDR      // The NI receiver control register
199
                14 :   RECEIVE_PRECAP_DATA_ADDR  // The port address to the header flit data which can be pre-captured before buffering the actual data.
200
 
201
 Shared registers for all VCs
202
    address bits
203
      [5:0]
204
       0:    STATUS_WB_ADDR     // status1:  {send_vc_enable_binary, receive_vc_enable_binary, any_err_isr_en,any_got_packet_isr_en,any_packet_is_saved_isr_en,any_packet_is_sent_isr_en}
205
       16:   BURST_SIZE_WB_ADDR  // The burst size in words
206
       32: reserved
207
 
208
*/
209
    localparam
210
        chanel_ADDRw= 4,
211
        chanel_REGw = 4,
212
        GENRL_ADRw=2;
213
 
214
    wire [CHw-1 :   0] vc_addr = s_addr_i [chanel_REGw+CHw-1    :       chanel_REGw];
215
    wire [GENRL_ADRw-1 :   0] genrl_reg_addr = s_addr_i [chanel_REGw+GENRL_ADRw-1  :   chanel_REGw];
216
    wire [chanel_ADDRw-1     :   0] vc_s_addr_i = s_addr_i [chanel_ADDRw-1: 0];
217
 
218
//general registers
219
    localparam [GENRL_ADRw-1  :   0]
220
        STATUS1_WB_ADDR  =   0,          // status1
221
      //  STATUS2_WB_ADDR  =   1,          // status2
222
     //   STATUS3_WB_ADDR  =   3,          // status3
223
        BURST_SIZE_WB_ADDR = 1;
224
 
225
 //Readonly registers per VC
226
    localparam [chanel_ADDRw-1  :   0]
227
        GENERAL_REGS_WB_ADDR=0,
228
        CTRL_FLAGS_WB_ADDR=1,
229
        RECEIVE_SRC_WB_ADDR =8,         // The source router (the router which is sent this packet).
230
        RECEIVE_DATA_SIZE_WB_ADDR = 10,  // The size of received data in byte
231
        RECEIVE_PRECAP_DATA_ADDR=14;
232
 
233
 
234
    localparam
235
        WORLD_SIZE = Dw/8,
236
        OFFSETw= log2(WORLD_SIZE),
237
        HDw = Fpay - (2*EAw) -  DSTPw - WEIGHTw,
238
        PRE_Dw = (HDATA_PRECAPw>0)? HDATA_PRECAPw : 1,
239 56 alirezamon
        MAX_PCK_SIZE_IN_BYTE = MAX_TRANSACTION_WIDTH + log2(Fpay/8);
240 48 alirezamon
 
241
 
242
 
243
    reg [BURST_SIZE_w-1  :   0] burst_size, burst_size_next,burst_counter,burst_counter_next;
244
    wire [V-1 :   0] receive_vc_is_busy, send_vc_is_busy;
245
    wire [V-1 :   0] receive_vc_enable,send_vc_enable,vc_state_reg_enable;
246
    wire [V-1 :   0] vc_burst_counter_ld, vc_burst_counter_dec;
247
    wire [V-1 :   0] vc_fifo_wr, vc_fifo_rd;
248
    wire [V-1 :   0] vc_fifo_full, vc_fifo_nearly_full, vc_fifo_empty;
249
    wire [V-1 :   0] send_vc_is_active,receive_vc_is_active;
250
    wire [CHw-1:  0] send_vc_enable_binary,receive_vc_enable_binary;
251
    wire  [SELw-1    :   0] vc_m_send_sel_o  [V-1 :   0];
252
    wire  [M_Aw-1    :   0] vc_m_send_addr_o [V-1 :   0];
253
    wire  [TAGw-1    :   0] vc_m_send_cti_o  [V-1 :   0];
254
    wire  [V-1 :   0] vc_m_send_stb_o;
255
    wire  [V-1 :   0] vc_m_send_cyc_o;
256
    wire  [V-1 :   0] vc_m_send_we_o;
257
    wire  [V-1 :   0] save_hdr_info;
258
    wire  [SELw-1    :   0] vc_m_receive_sel_o  [V-1 :   0];
259
    wire  [M_Aw-1    :   0] vc_m_receive_addr_o [V-1 :   0];
260
    wire  [TAGw-1    :   0] vc_m_receive_cti_o  [V-1 :   0];
261
    wire  [V-1 :   0] vc_m_receive_stb_o;
262
    wire  [V-1 :   0] vc_m_receive_cyc_o;
263
    wire  [V-1 :   0] vc_m_receive_we_o;
264
    wire  [MAX_PCK_SIZE_IN_BYTE-1    :   0] receive_dat_size_in_byte [V-1 :   0];
265
    wire  [V-1    :   0] send_vc_fsm_is_ideal,receive_vc_fsm_is_ideal;
266
    wire  [Dw-1   :   0] send_vc_pointer_addr [V-1   :  0];
267
    wire  [Dw-1   :   0] receive_vc_pointer_addr [V-1   :  0];
268
    wire  [V-1    :   0] receive_vc_got_packet,receive_vc_got_hdr_flit_at_head;
269
    wire [MAX_TRANSACTION_WIDTH-1    :   0] send_vc_data_size [V-1   :  0];
270
    wire [MAX_TRANSACTION_WIDTH-1    :   0] receive_vc_max_buff_siz [V-1   :  0];
271
    wire [MAX_TRANSACTION_WIDTH-1    :   0] receive_vc_start_index  [V-1   :  0];
272
    wire [OFFSETw-1 : 0] receive_vc_start_index_offset [V-1   :  0];
273
 
274
 
275
 
276
    wire [V-1   :  0]   send_vc_start, receive_vc_start;
277
    wire  received_flit_is_tail,received_flit_is_hdr;
278
    wire [EAw-1  :   0]  vc_dest_e_addr [V-1   :  0];
279
    wire [Cw-1   :   0]  vc_pck_class [V-1   :  0];
280
    wire [WEIGHTw-1 : 0] vc_weight [V-1:0];
281
    wire [BEw-1 : 0 ] vc_be_in  [V-1    :   0];
282
    wire [HDw-1 : 0] vc_hdr_data [V-1:0];
283
    wire [V-1    :   0]  send_vc_send_hdr,send_vc_send_tail;
284
    wire [V-1    :   0]  send_vc_done,receive_vc_done;
285
 
286
    wire [EAw-1   :   0]  dest_e_addr;
287
    wire [Cw-1   :   0]  pck_class;
288
    wire [BEw-1 : 0 ] be_in;
289
    wire send_hdr, send_tail;
290
    wire [Fw-1   :   0] hdr_flit_out;
291
    wire burst_counter_ld = | vc_burst_counter_ld;
292
    wire burst_counter_dec= | vc_burst_counter_dec;
293
    wire fifo_wr = | vc_fifo_wr;
294
    wire fifo_rd = | vc_fifo_rd;
295
 
296
 
297
 
298
 
299
 
300
    wire last_burst = (burst_counter == 1);
301
    wire burst_is_set =  (burst_size>0);
302
    wire [Cw-1   :   0] received_class_next;
303
    wire [EAw-1   :   0] received_src_e_addr_next;
304
    wire [BEw-1 : 0 ] received_be_next;
305
    wire [HDw-1 : 0 ] received_hdr_dat_next;
306
    wire [Fpay-1    :   0] tail_flit_out;
307
    reg [Cw-1  : 0] class_in [V-1    :   0];
308
    reg [EAw-1 : 0] src_e_addr [V-1    :   0];
309
    reg [HDw-1 : 0] rsv_hdr_dat [V-1 : 0];
310
    reg [BEw-1 : 0] receive_vc_be [V-1 : 0];
311
    wire [CTRL_FLGw-1 : 0] vc_ctrl_flags [V-1 : 0];
312
    reg [V-1    :   0] crc_miss_match;
313
 
314
    wire [V-1    :   0] burst_size_err,send_data_size_err,rcive_buff_ovrflw_err;
315
    wire [V-1    :   0] invalid_send_req_err;
316
 
317
    wire [V-1 : 0] vc_irq;
318
 
319
 
320
 
321
    wire  [STATUS1w-1  :0] status1;
322
   // wire  [STATUS2w-1  :0] status2;
323
  //  wire  [STATUS3w-1  :0] status3;
324
 
325
 
326
    wire [DSTPw-1 : 0] destport;
327
    wire [WEIGHTw-1 : 0] weight;
328
    wire [HDw-1 : 0 ] hdr_data;
329
 
330
    wire [V-1 :0] vc_any_err_isr        ;
331
    wire [V-1 :0] vc_got_packet_isr     ;
332
    wire [V-1 :0] vc_packet_is_saved_isr;
333
    wire [V-1 :0] vc_packet_is_sent_isr ;
334
    wire [PRE_Dw-1 : 0 ] recive_vc_precap_data [V-1 : 0];
335
    wire any_err_isr,any_got_packet_isr,any_packet_is_saved_isr,any_packet_is_sent_isr;
336
 
337
    assign any_err_isr = |  vc_any_err_isr         ;
338
    assign any_got_packet_isr = |  vc_got_packet_isr      ;
339
    assign any_packet_is_saved_isr = |  vc_packet_is_saved_isr;
340
    assign any_packet_is_sent_isr  = |  vc_packet_is_sent_isr;
341
  //  assign status1= {vc_got_error_isr, receive_vc_got_packet_isr, receive_vc_packet_is_saved_isr, send_vc_packet_is_sent_isr};
342
 //   assign status2= {vc_got_error_int_en, receive_vc_got_packet_int_en, receive_vc_packet_is_saved_int_en, send_vc_packet_is_sent_int_en};
343
    assign status1= {send_vc_enable_binary, receive_vc_enable_binary, any_err_isr,any_got_packet_isr,any_packet_is_saved_isr,any_packet_is_sent_isr};
344
 
345
 
346
    assign  irq =|vc_irq;
347
 
348
    wire [7: 0] temp;
349
    generate
350
    if (HDw >= 8) assign temp = rsv_hdr_dat [vc_addr][7:0];
351
    else assign temp = {{(8-HDw){1'b0}},rsv_hdr_dat [vc_addr]};
352
    endgenerate
353
 
354
 
355
    //read wb registers
356
    always @(*)begin
357
        s_dat_o ={Dw{1'b0}};
358
        case(vc_s_addr_i)
359
        GENERAL_REGS_WB_ADDR:begin // This is a general address. check the general address filed
360
            case(genrl_reg_addr)
361
            STATUS1_WB_ADDR: begin
362
                s_dat_o = {{(Dw-STATUS1w){1'b0}}, status1};
363
            end
364
            BURST_SIZE_WB_ADDR:begin
365
                s_dat_o = {{(Dw-BURST_SIZE_w){1'b0}}, burst_size};
366
            end
367
            default: begin
368
                s_dat_o ={Dw{1'b0}};
369
            end
370
            endcase
371
        end//0
372
 
373
        CTRL_FLAGS_WB_ADDR: begin
374
             s_dat_o[CTRL_FLGw-1     : 0] = vc_ctrl_flags[vc_addr];
375
        end
376
 
377
        RECEIVE_SRC_WB_ADDR: begin
378
 
379
            s_dat_o[EAw-1: 0]   =   src_e_addr[vc_addr];   // first&second bytes
380
            s_dat_o[Cw+15: 16]  =   class_in[vc_addr];  //third byte
381
            s_dat_o[31: 24] =       temp;   // 4th byte
382
        end
383
 
384
        RECEIVE_DATA_SIZE_WB_ADDR: begin
385
            s_dat_o   [MAX_PCK_SIZE_IN_BYTE-1    :   0] = receive_dat_size_in_byte[vc_addr];
386
        end
387
 
388
        RECEIVE_PRECAP_DATA_ADDR: begin
389
                s_dat_o[PRE_Dw-1 : 0 ] =  (HDATA_PRECAPw>0)? recive_vc_precap_data[vc_addr][PRE_Dw-1 : 0 ]: {{PRE_Dw{1'b0}}};
390
        end
391
        default: begin
392
             s_dat_o ={Dw{1'b0}};
393
        end
394
        endcase
395
    end
396
 
397
 
398
 
399
 
400
    //write wb registers
401
    always @ (*)begin
402
        burst_counter_next=burst_counter;
403
        burst_size_next= burst_size;
404
        if(burst_counter_ld)    burst_counter_next = burst_size;
405
        if(burst_counter_dec)   burst_counter_next= burst_counter- 1'b1;
406
 
407
        if((s_stb_i  &    s_we_i) && (vc_s_addr_i == GENERAL_REGS_WB_ADDR)) begin // This is a general address. check the general address filed
408
            case(genrl_reg_addr)
409
            BURST_SIZE_WB_ADDR: begin
410
                if (send_vc_is_busy == {V{1'b0}}) burst_size_next=s_dat_i [BURST_SIZE_w-1 : 0];
411
            end //BURST_SIZE_WB_ADDR
412
 
413
                    default begin
414
 
415
                    end
416
            endcase
417
        end//  if(s_stb_i  &    s_we_i)
418
 
419
    end
420
 
421
 
422
 
423
 
424
`ifdef SYNC_RESET_MODE
425
    always @ (posedge clk )begin
426
`else
427
    always @ (posedge clk or posedge reset)begin
428
`endif
429
 
430
 
431
 
432
        if(reset) begin
433
            burst_counter <= {BURST_SIZE_w{1'b0}};
434
            burst_size <= {BURST_SIZE_w{1'b1}};
435
            s_ack_o <= 1'b0;
436
 
437
 
438
        end else begin
439
            burst_counter<= burst_counter_next;
440
            burst_size <= burst_size_next;
441
            s_ack_o <= s_ack_o_next;
442
 
443
 
444
        end
445
    end
446
 
447
 
448
    bin_to_one_hot #(
449
        .BIN_WIDTH(CHw),
450
        .ONE_HOT_WIDTH(V)
451
   )
452
   convert
453
   (
454
        .bin_code(vc_addr),
455
        .one_hot_code(vc_state_reg_enable)
456
   );
457
 
458
    assign s_ack_o_next    =   s_stb_i & (~s_ack_o);
459
 
460
 
461
    genvar i;
462
    generate
463
 
464
     wire [V-1 : 0 ] precap_hdr_flit_wr;
465
     wire [HDATA_PRECAPw-1 : 0 ] precap_din;
466
     wire [V-1 : 0] precap_hdr_flit_rd = (fifo_rd & received_flit_is_hdr) ?  receive_vc_enable : {V{1'b0}};
467
     wire [HDATA_PRECAPw-1 : 0 ] precap_dout  [V-1 : 0] ;
468
     wire [V-1 : 0 ] precap_valid;
469
 
470
 
471
    //capture data before saving the actual flit in memory
472 56 alirezamon
    if(HDATA_PRECAPw > 0 ) begin : precap
473 48 alirezamon
 
474 56 alirezamon
        wire [EAw-1 : 0] src_endp_addr;
475 48 alirezamon
 
476
        extract_header_flit_info #(
477 56 alirezamon
            .NOC_ID(NOC_ID),
478 48 alirezamon
            .DATA_w(HDATA_PRECAPw)
479
        )
480
        data_extractor
481
        (
482
            .flit_in(flit_in),
483
            .flit_in_wr(flit_in_wr),
484
            .src_e_addr_o(src_endp_addr ),
485
            .dest_e_addr_o( ),
486
            .destport_o( ),
487
            .class_o( ),
488
            .weight_o( ),
489
            .tail_flg_o( ),
490
            .hdr_flg_o( ),
491
            .vc_num_o( ),
492
            .be_o( ),
493
            .hdr_flit_wr_o(precap_hdr_flit_wr),
494
            .data_o(precap_din)
495
        );
496
 
497
 
498
//synthesis translate_off
499
//synopsys  translate_off
500
`ifdef MONITOR_HDR_FLITS
501
always @(posedge clk) begin
502
 
503
    if(precap_hdr_flit_wr)begin
504
        $display("%t: endp %d got a packet with port address %d from endp %d",$time,current_e_addr,precap_din,src_endp_addr);
505
    end
506
 
507
    if(send_hdr & flit_out_wr)begin
508
        $display("%t: endp %d sends a packet with port address %d to endp %d",$time,current_e_addr,hdr_data,dest_e_addr);
509
    end
510
 
511
 
512
end
513
`endif
514
 
515
`ifdef MONITOR_DAT_FLITS
516
    always @(posedge clk) begin
517
        if(flit_out_wr & ~send_hdr) begin
518
            $display("%t: endp %u V %u sends %h",$time,current_e_addr,  flit_out [Fpay+V-1 : Fpay],  flit_out [Fpay-1 : 0 ]);
519
        end
520
    end
521
`endif
522
 
523
//synopsys  translate_on
524
//synthesis translate_on
525
 
526
 
527
 
528
       for (i=0;i
529
 
530
          fwft_fifo #(
531
            .DATA_WIDTH(HDATA_PRECAPw),
532
            .MAX_DEPTH(LB/MIN_PCK_SIZE),//maximum packet number which can be stored in buffer
533
            .IGNORE_SAME_LOC_RD_WR_WARNING("YES")
534
          )
535
          precap_data_fifo
536
          (
537
            .din(precap_din),
538
            .wr_en(precap_hdr_flit_wr[i]),
539
            .rd_en(precap_hdr_flit_rd[i]),
540
            .dout(precap_dout[i]),
541
            .full( ),
542
            .nearly_full( ),
543
            .recieve_more_than_0(precap_valid[i] ),
544
            .recieve_more_than_1( ),
545
            .reset(reset),
546
            .clk(clk)
547
          );
548
 
549
          assign recive_vc_precap_data[i] = precap_dout[i];
550
 
551
        //synthesis translate_off
552
        //synopsys  translate_off
553
        always @(posedge clk)begin
554
             if(s_stb_i  &  ~s_we_i &  (vc_addr==i) & (vc_s_addr_i == RECEIVE_PRECAP_DATA_ADDR) )begin
555
                    if( precap_valid[i] == 1'b0) $display( "Warning: Reading invalid precap-data %m");
556
             end
557
        end
558
        //synopsys  translate_on
559
        //synthesis translate_on
560
 
561
 
562
        end
563
 
564
    end
565
 
566
 
567
 
568 54 alirezamon
    assign chan_out.ctrl_chanel.endp_port =1'b1;
569 48 alirezamon
 
570
 
571
 
572
    for (i=0;i
573
 
574
 
575
                assign chan_out.ctrl_chanel.credit_init_val[i]= LB;
576
 
577
 
578
 
579
 
580
        ni_vc_wb_slave_regs #(
581
            .MAX_TRANSACTION_WIDTH(MAX_TRANSACTION_WIDTH),
582
            .DEBUG_EN(DEBUG_EN),
583
            .EAw(EAw),
584
            .Fpay(Fpay),
585
            .DSTPw(DSTPw),
586
            .HDw(HDw),
587
            .CTRL_FLGw(CTRL_FLGw),
588
            .C(C),
589
            .Dw(Dw),
590
            .S_Aw(chanel_REGw),
591
            .WEIGHTw(WEIGHTw),
592
            .BYTE_EN(BYTE_EN)
593
 
594
        )
595
        wb_slave_registers
596
        (
597
//synthesis translate_off
598
//synopsys  translate_off
599
            .current_e_addr(current_e_addr),
600
//synopsys  translate_on
601
//synthesis translate_on
602
            .clk(clk),
603
            .reset(reset),
604
            .state_reg_enable(vc_state_reg_enable[i]),
605
            .send_fsm_is_ideal(send_vc_fsm_is_ideal[i]),
606
            .receive_fsm_is_ideal(receive_vc_fsm_is_ideal[i]),
607
            .send_pointer_addr(send_vc_pointer_addr[i]),
608
            .be_in(vc_be_in[i]),
609
            .receive_pointer_addr(receive_vc_pointer_addr[i]),
610
            .receive_start_index(receive_vc_start_index[i]),
611
            .receive_start_index_offset(receive_vc_start_index_offset[i]),
612
            .receive_done(receive_vc_done[i]),
613
            .send_done(send_vc_done[i]),
614
 
615
            .send_data_size(send_vc_data_size[i]),
616
            .receive_max_buff_siz(receive_vc_max_buff_siz[i]),
617
            .dest_e_addr(vc_dest_e_addr[i]),
618
            .pck_class(vc_pck_class[i]),
619
            .weight(vc_weight[i]),
620
            .hdr_data(vc_hdr_data[i]),
621
            .send_start(send_vc_start[i]),
622
            .receive_start(receive_vc_start[i]),
623
            .receive_vc_got_packet(receive_vc_got_packet[i]),
624
 
625
                .burst_size_err(burst_size_err[i]),
626
            .send_data_size_err(send_data_size_err[i]),
627
            .rcive_buff_ovrflw_err(rcive_buff_ovrflw_err[i]),
628
                .crc_miss_match_err( crc_miss_match[i]),
629
                .invalid_send_req_err(invalid_send_req_err[i]),
630
 
631
                .receive_vc_got_hdr_flit_at_head(receive_vc_got_hdr_flit_at_head[i]),
632
                .receive_is_busy(receive_vc_is_busy[i]),
633
                .send_is_busy(send_vc_is_busy[i]),
634
                .ctrl_flags(vc_ctrl_flags[i]),
635
 
636
                .any_err_isr          (vc_any_err_isr        [i]),
637
                .got_packet_isr       (vc_got_packet_isr     [i]),
638
                .packet_is_saved_isr  (vc_packet_is_saved_isr[i]),
639
                .packet_is_sent_isr   (vc_packet_is_sent_isr [i]),
640
 
641
 
642
                .irq(vc_irq[i]),
643
 
644
                .s_dat_i(s_dat_i),
645
            .s_addr_i(s_addr_i[chanel_REGw-1:0]),
646
            .s_stb_i(s_stb_i),
647
            .s_cyc_i(s_cyc_i),
648
            .s_we_i(s_we_i)
649
        );
650
 
651
 
652
        ni_vc_dma #(
653
            .CRC_EN(CRC_EN),
654
            .MAX_TRANSACTION_WIDTH(MAX_TRANSACTION_WIDTH),
655
            .Dw(Dw),
656
            .M_Aw(M_Aw),
657
            .TAGw(TAGw),
658
            .SELw(SELw),
659
            .Fpay(Fpay),
660
            .BYTE_EN(BYTE_EN)
661
        )
662
        vc_dma
663
        (
664
            .reset(reset),
665
            .clk(clk),
666
            .status(),
667
            //active-enable signals
668
            .send_enable(send_vc_enable[i]),
669
            .receive_enable(receive_vc_enable[i]),
670
            .send_is_busy(send_vc_is_busy[i]),
671
            .receive_is_busy(receive_vc_is_busy[i]),
672
            .send_is_active(send_vc_is_active[i]),
673
            .receive_is_active(receive_vc_is_active[i]),
674
            .burst_counter_ld(vc_burst_counter_ld[i]),
675
            .burst_counter_dec(vc_burst_counter_dec[i]),
676
            .burst_size_is_set(burst_is_set),
677
            .last_burst(last_burst),
678
            .send_hdr(send_vc_send_hdr[i]),
679
            .send_tail(send_vc_send_tail[i]),
680
            .receive_dat_size_in_byte(receive_dat_size_in_byte[i]),
681
            .receive_be(receive_vc_be[i]),
682
            .save_hdr_info(save_hdr_info[i]),
683
            .send_done(send_vc_done[i]),
684
            .receive_done(receive_vc_done[i]),
685
            .send_fsm_is_ideal(send_vc_fsm_is_ideal[i]),
686
            .receive_fsm_is_ideal(receive_vc_fsm_is_ideal[i]),
687
            .send_pointer_addr(send_vc_pointer_addr[i]),
688
            .receive_pointer_addr(receive_vc_pointer_addr[i]),
689
            .receive_start_index(receive_vc_start_index[i]),
690
            .receive_start_index_offset(receive_vc_start_index_offset[i]),
691
            .send_data_size(send_vc_data_size[i]),
692
            .receive_max_buff_siz(receive_vc_max_buff_siz[i]),
693
            .send_start(send_vc_start[i]),
694
            .receive_start(receive_vc_start[i]),
695
            .received_flit_is_tail(received_flit_is_tail),
696
            //fifo
697
            .send_fifo_wr(vc_fifo_wr[i]),
698
            .send_fifo_full(vc_fifo_full[i]),
699
            .send_fifo_nearly_full(vc_fifo_nearly_full[i]),
700
            .send_fifo_rd(credit_in[i]),
701
            .receive_fifo_empty(vc_fifo_empty[i]),
702
            .receive_fifo_rd(vc_fifo_rd[i]),
703
 
704
            //errors
705
            .burst_size_err(burst_size_err[i]),
706
            .send_data_size_err(send_data_size_err[i]),
707
            .rcive_buff_ovrflw_err(rcive_buff_ovrflw_err[i]),
708
            .invalid_send_req_err(invalid_send_req_err[i]),
709
            //
710
            .m_send_sel_o(vc_m_send_sel_o[i]),
711
            .m_send_addr_o(vc_m_send_addr_o[i]),
712
            .m_send_cti_o(vc_m_send_cti_o[i]),
713
            .m_send_stb_o(vc_m_send_stb_o[i]),
714
            .m_send_cyc_o(vc_m_send_cyc_o[i]),
715
            .m_send_we_o(vc_m_send_we_o[i]),
716
        //  .m_send_dat_i(m_send_dat_i),
717
            .m_send_ack_i(m_send_ack_i),
718
 
719
            .m_receive_sel_o(vc_m_receive_sel_o[i]),
720
        //  .m_receive_dat_o(vc_m_receive_dat_o[i]),
721
            .m_receive_addr_o(vc_m_receive_addr_o[i]),
722
            .m_receive_cti_o(vc_m_receive_cti_o[i]),
723
            .m_receive_stb_o(vc_m_receive_stb_o[i]),
724
            .m_receive_cyc_o(vc_m_receive_cyc_o[i]),
725
            .m_receive_we_o(vc_m_receive_we_o[i]),
726
            .m_receive_ack_i(m_receive_ack_i)
727
        );
728
 
729
`ifdef SYNC_RESET_MODE
730
    always @ (posedge clk )begin
731
`else
732
    always @ (posedge clk or posedge reset)begin
733
`endif
734
 
735
            if(reset) begin
736
                class_in[i]<= {Cw{1'b0}};
737
                src_e_addr[i]<= {EAw{1'b0}};
738
                rsv_hdr_dat[i]<={HDw{1'b0}};
739
                receive_vc_be[i] <= {BEw{1'b0}};
740
            end else if(save_hdr_info[i])begin
741
                class_in[i]<= received_class_next;
742
                src_e_addr[i]<= received_src_e_addr_next;
743
                rsv_hdr_dat[i]<=received_hdr_dat_next;
744
                receive_vc_be[i]<= received_be_next;
745
            end
746
        end//always
747
 
748
    end  // for loop vc_
749
 
750
/* verilator lint_off WIDTH */
751
    if(  CRC_EN == "YES") begin :crc_blk
752
/* verilator lint_on WIDTH */
753
 
754
      reg fifo_rd_delayed;
755
`ifdef SYNC_RESET_MODE
756
    always @ (posedge clk )begin
757
`else
758
    always @ (posedge clk or posedge reset)begin
759
`endif
760
        if(reset) fifo_rd_delayed <=1'b0;
761
        else fifo_rd_delayed <= fifo_rd;
762
      end
763
 
764
      wire send_crc_enable =  flit_out_wr & ~send_hdr &   ~send_tail;
765
      wire receive_crc_enable =  fifo_rd_delayed & ~ received_flit_is_tail & ~received_flit_is_hdr;
766
      wire [31:0]  send_crc_out,receive_crc_out;
767
 
768
        crc_32_multi_chanel #(
769
            .chanel(V)
770
        )
771
        send_crc
772
        (
773
            .reset(reset),
774
            .clk(clk),
775
            .crc_reset(send_hdr),
776
            .crc_enable(send_crc_enable),
777
            .chanel_in(send_vc_enable_binary),
778
            .data_in(m_send_dat_i [Fpay-1 : 0]),
779
            .crc_out(send_crc_out)
780
        );
781
 
782
        crc_32_multi_chanel #(
783
                .chanel(V)
784
        )
785
         receive_crc
786
         (
787
                .reset(reset),
788
                .clk(clk),
789
                .crc_reset(received_flit_is_hdr),
790
                .crc_enable(receive_crc_enable),
791
                .chanel_in(receive_vc_enable_binary),
792
                .data_in(m_receive_dat_o[Fpay-1 : 0]),
793
                .crc_out(receive_crc_out)
794
        );
795
 
796
        for (i=0;i
797
 
798
`ifdef SYNC_RESET_MODE
799
            always @ (posedge clk )begin
800
`else
801
            always @ (posedge clk or posedge reset)begin
802
`endif
803
 
804
                if(reset) begin
805
                    crc_miss_match[i] <= 1'b0;
806
                end else begin
807
                    if(receive_vc_enable_binary==i && received_flit_is_tail && m_receive_stb_o ) begin
808
                        crc_miss_match[i] <= receive_crc_out[31:0] != m_receive_dat_o[31 : 0];
809
                    end
810
                end
811
 
812
            end
813
        end//for
814
 
815
        assign tail_flit_out[31 : 0]  =  send_crc_out;
816
    end   else begin : no_crc
817
        assign tail_flit_out   =  m_send_dat_i [Fpay-1 : 0];
818
        //always @(*) crc_miss_match = {V{1'b0}};
819
        always @(posedge clk) crc_miss_match <= {V{1'b0}};
820
    end
821
 
822
 
823
    if(V> 1) begin : multi_chanel
824
 
825
        // round roubin arbiter
826
        bus_arbiter # (
827
            .M (V)
828
        )
829
        receive_arbiter
830
        (
831
            .request (receive_vc_is_active),
832
            .grant  (receive_vc_enable),
833
            .clk (clk),
834
            .reset (reset)
835
        );
836
 
837
        bus_arbiter # (
838
            .M (V)
839
        )
840
        send_arbiter
841
        (
842
            .request (send_vc_is_active),
843
            .grant  (send_vc_enable),
844
            .clk (clk),
845
            .reset (reset)
846
        );
847
 
848
 
849
        one_hot_to_bin #(
850
            .ONE_HOT_WIDTH(V),
851
            .BIN_WIDTH(CHw)
852
        )
853
        send_en_conv
854
        (
855
            .one_hot_code(send_vc_enable),
856
            .bin_code(send_vc_enable_binary)
857
        );
858
 
859
 
860
         one_hot_to_bin #(
861
            .ONE_HOT_WIDTH(V),
862
            .BIN_WIDTH(CHw)
863
        )
864
        receive_en_conv
865
        (
866
            .one_hot_code(receive_vc_enable),
867
            .bin_code(receive_vc_enable_binary)
868
        );
869
 
870
 
871
    end else begin : single_chanel // if we have just one chanel there is no need for arbitration
872
        assign receive_vc_enable =  receive_vc_is_active;
873
        assign send_vc_enable =  send_vc_is_active;
874
        assign send_vc_enable_binary = 1'b0;
875
        assign receive_vc_enable_binary = 1'b0;
876
    end
877
    endgenerate
878
 
879
 
880
 
881
    conventional_routing #(
882 56 alirezamon
        .NOC_ID(NOC_ID),
883 48 alirezamon
        .TOPOLOGY(TOPOLOGY),
884
        .ROUTE_NAME(ROUTE_NAME),
885
        .ROUTE_TYPE(ROUTE_TYPE),
886
        .T1(T1),
887
        .T2(T2),
888
        .T3(T3),
889
        .RAw(RAw),
890
        .EAw(EAw),
891
        .DSTPw(DSTPw),
892
        .LOCATED_IN_NI(1)
893 56 alirezamon
    ) route_compute (
894 48 alirezamon
        .reset(reset),
895
        .clk(clk),
896
        .current_r_addr(current_r_addr),
897
        .src_e_addr(current_e_addr),
898
        .dest_e_addr(dest_e_addr),
899
        .destport(destport)
900
    );
901
 
902
 
903
    header_flit_generator #(
904 56 alirezamon
        .NOC_ID(NOC_ID),
905
        .DATA_w(HDw)
906
    ) hdr_flit_gen (
907 48 alirezamon
        .flit_out(hdr_flit_out),
908
        .class_in(pck_class),
909
        .dest_e_addr_in(dest_e_addr),
910
        .src_e_addr_in(current_e_addr),
911
        .destport_in(destport),
912
        .vc_num_in(send_vc_enable),
913
        .weight_in(weight),
914
        .be_in(be_in),
915 56 alirezamon
        .data_in(hdr_data)
916 48 alirezamon
    );
917
 
918
  wire [V-1    :   0] wr_vc_send =  (fifo_wr) ? send_vc_enable : {V{1'b0}};
919
 
920
 
921
  ovc_status #(
922
    .V(V),
923
    .B(LB),
924
    .CRDTw(CRDTw)
925
  )
926
  the_ovc_status
927
  (
928
    .credit_init_val_in ( chan_in.ctrl_chanel.credit_init_val),
929
        .wr_in(wr_vc_send),
930
    .credit_in(credit_in),
931
    .full_vc(vc_fifo_full),
932
    .nearly_full_vc(vc_fifo_nearly_full),
933
    .empty_vc( ),
934
    .clk(clk),
935
    .reset(reset)
936
  );
937
 
938
    // header info mux
939
    assign dest_e_addr = vc_dest_e_addr[send_vc_enable_binary];
940
    assign pck_class  = vc_pck_class[send_vc_enable_binary];
941
    assign weight =   vc_weight[send_vc_enable_binary];
942
    assign hdr_data = vc_hdr_data [send_vc_enable_binary];
943
    assign send_hdr = send_vc_send_hdr[send_vc_enable_binary];
944
    assign send_tail = send_vc_send_tail[send_vc_enable_binary];
945
    assign be_in = vc_be_in[send_vc_enable_binary];
946
 
947
    //wb multiplexors
948
    assign m_send_sel_o  = vc_m_send_sel_o[send_vc_enable_binary];
949
    assign m_send_addr_o = vc_m_send_addr_o[send_vc_enable_binary];
950
    assign m_send_cti_o  = vc_m_send_cti_o[send_vc_enable_binary];
951
    assign m_send_stb_o  = vc_m_send_stb_o[send_vc_enable_binary];
952
    assign m_send_cyc_o  = vc_m_send_cyc_o[send_vc_enable_binary];
953
    assign m_send_we_o   = vc_m_send_we_o[send_vc_enable_binary];
954
 
955
    assign m_receive_sel_o = vc_m_receive_sel_o[receive_vc_enable_binary];
956
    assign m_receive_addr_o= vc_m_receive_addr_o[receive_vc_enable_binary];
957
    assign m_receive_cti_o = vc_m_receive_cti_o[receive_vc_enable_binary];
958
    assign m_receive_stb_o = vc_m_receive_stb_o[receive_vc_enable_binary];
959
    assign m_receive_cyc_o = vc_m_receive_cyc_o[receive_vc_enable_binary];
960
    assign m_receive_we_o  = vc_m_receive_we_o[receive_vc_enable_binary];
961
 
962
    wire [V-1    :   0]  flit_in_vc_num = flit_in [Fpay+V-1    :   Fpay];
963
    wire [V-1    :   0]  ififo_vc_not_empty;
964
    assign vc_fifo_empty = ~ ififo_vc_not_empty;
965
    assign receive_vc_got_packet = ififo_vc_not_empty;
966
    assign receive_vc_got_hdr_flit_at_head=  ififo_vc_not_empty & receive_vc_fsm_is_ideal;
967
 
968
 
969
 
970
 
971
    wire [Fw-1  :   0] fifo_dout;
972
 
973 54 alirezamon
    localparam LBw = log2(LB);
974
 
975 48 alirezamon
    flit_buffer #(
976 56 alirezamon
        .V(V),
977 48 alirezamon
        .B(LB),
978 56 alirezamon
        .SSA_EN("NO"),
979
        .Fw(Fw),
980
                .PCK_TYPE(PCK_TYPE),
981
                .CAST_TYPE(CAST_TYPE),
982
                .DEBUG_EN(DEBUG_EN)
983 48 alirezamon
     )
984
     the_ififo
985
     (
986
        .din(flit_in),     // Data in
987 54 alirezamon
        .vc_num_wr(flit_in_vc_num),//write virtual chanel
988 48 alirezamon
        .wr_en(flit_in_wr),   // Write enable
989 54 alirezamon
        .vc_num_rd(receive_vc_enable),//read virtual chanel
990 48 alirezamon
        .rd_en(fifo_rd),   // Read the next word
991
        .dout(fifo_dout),    // Data out
992
        .vc_not_empty(ififo_vc_not_empty),
993
        .reset(reset),
994
        .clk(clk),
995 54 alirezamon
        .ssa_rd({V{1'b0}}),
996
        .multiple_dest(),
997
        .sub_rd_ptr_ld()
998 48 alirezamon
    );
999
 
1000
   extract_header_flit_info #(
1001 56 alirezamon
        .NOC_ID(NOC_ID),
1002 48 alirezamon
        .DATA_w (HDw)
1003
    )
1004
    extractor
1005
    (
1006
        .flit_in(fifo_dout),
1007
        .flit_in_wr(),
1008
        .class_o(received_class_next),
1009
        .destport_o(),
1010
        .dest_e_addr_o(),
1011
        .src_e_addr_o(received_src_e_addr_next),
1012
        .vc_num_o(),
1013
        .hdr_flit_wr_o( ),
1014
        .hdr_flg_o( ),
1015
        .tail_flg_o( ),
1016
        .weight_o(),
1017
        .be_o(received_be_next),
1018
        .data_o(received_hdr_dat_next)
1019
    );
1020
 
1021
 
1022
 
1023
  assign m_receive_dat_o = fifo_dout[Dw-1   :   0];
1024
  assign received_flit_is_tail = fifo_dout[Fw-2];
1025
  assign received_flit_is_hdr  = fifo_dout[Fw-1];
1026
//  assign any_vc_got_pck = |receive_vc_got_packet;
1027
 
1028
    localparam [1:0]
1029
        HDR_FLAG           =   2'b10,
1030
        BDY_FLAG            =   2'b00,
1031
        TAIL_FLAG          =   2'b01;
1032
 
1033
  assign credit_out = vc_fifo_rd;
1034
  assign flit_out_wr= fifo_wr;
1035
  assign flit_out [Fpay+V-1 : Fpay] = send_vc_enable;
1036
  assign flit_out [Fpay-1   : 0   ] = (send_hdr)?  hdr_flit_out [Fpay-1 : 0] :
1037
                                      (send_tail)? tail_flit_out :  m_send_dat_i [Fpay-1 : 0];
1038
  assign flit_out [Fw-1 : Fw-2] =   (send_hdr)?  HDR_FLAG :
1039
                                    (send_tail)?  TAIL_FLAG    : BDY_FLAG;
1040
endmodule
1041
 
1042
 
1043
 
1044
/******************
1045
*   ovc_status
1046
*******************/
1047
 
1048
 module ovc_status #(
1049
    parameter V     =   4,
1050
    parameter B =   16,
1051
    parameter CRDTw =4
1052
)
1053
(
1054
 
1055
        input   [V-1 : 0] [CRDTw-1 : 0 ] credit_init_val_in,
1056
        input   [V-1            :0] wr_in,
1057
    input   [V-1            :0] credit_in,
1058
    output  [V-1            :0] full_vc,
1059
    output  [V-1            :0] nearly_full_vc,
1060
    output  [V-1            :0] empty_vc,
1061
    input                       clk,
1062
    input                       reset
1063
);
1064
 
1065
 
1066
         function integer log2;
1067
         input integer number; begin
1068
                log2=(number <=1) ? 1: 0;
1069
                while(2**log2
1070
                        log2=log2+1;
1071
                end
1072
         end
1073
         endfunction // log2
1074
 
1075
 
1076
        localparam  DEPTH_WIDTH =   log2(B+1);
1077
 
1078
 
1079
         reg  [DEPTH_WIDTH-1 : 0] credit    [V-1 : 0];
1080
         wire  [V-1 : 0] cand_vc_next;
1081
 
1082
 
1083
         genvar i;
1084
         generate
1085
                for(i=0;i
1086
                `ifdef SYNC_RESET_MODE
1087
                        always @ (posedge clk )begin
1088
                `else
1089
                        always @ (posedge clk or posedge reset)begin
1090
                `endif
1091
                if(reset)begin
1092
                credit[i]<= credit_init_val_in[i][DEPTH_WIDTH-1:0];
1093
            end else begin
1094
                if(  wr_in[i]  && ~credit_in[i])   credit[i] <= credit[i]-1'b1;
1095
                if( ~wr_in[i]  &&  credit_in[i])   credit[i] <= credit[i]+1'b1;
1096
            end //reset
1097
            end//always
1098
 
1099
            assign  full_vc[i]   = (credit[i] == {DEPTH_WIDTH{1'b0}});
1100
            assign  nearly_full_vc[i]=  (credit[i] == 1) |  full_vc[i];
1101
            assign  empty_vc[i]  = (credit[i] == credit_init_val_in[i][DEPTH_WIDTH-1:0]);
1102
      end//for
1103
    endgenerate
1104
endmodule
1105
 
1106
 

powered by: WebSVN 2.1.0

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