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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 56 alirezamon
 
2 54 alirezamon
`include "pronoc_def.v"
3 48 alirezamon
/****************************************************************************
4
 * pronoc_pkg.sv
5
 ****************************************************************************/
6
 
7 56 alirezamon
`ifdef PRONOC_PKG
8
 
9
`ifdef IMPORT_PRONOC_PCK
10 48 alirezamon
package pronoc_pkg;
11 56 alirezamon
`endif
12 54 alirezamon
 
13
 
14 56 alirezamon
 
15 48 alirezamon
 
16
`define NOC_LOCAL_PARAM
17
`include "noc_localparam.v"
18 54 alirezamon
 
19
 
20
 
21 48 alirezamon
 
22
`define  INCLUDE_TOPOLOGY_LOCALPARAM
23
`include "topology_localparam.v"
24
 
25
 
26 54 alirezamon
 
27 48 alirezamon
localparam
28
        Vw=  log2(V),
29
        Cw=  (C==0)? 1 : log2(C),
30
        NEw = log2(NE),
31
        Bw  = log2(B),
32
        WRRA_CONFIG_INDEX=0,
33
        SMART_EN = (SMART_MAX !=0),
34
        SMART_NUM= (SMART_EN) ? SMART_MAX : 1,
35
        NEV  = NE * V,
36
        T4 = 0,
37 54 alirezamon
        BEw = (BYTE_EN)? log2(Fpay/8) : 1;
38
 
39 48 alirezamon
 
40
 
41
 localparam CONGw= (CONGESTION_INDEX==3)?  3:
42
                      (CONGESTION_INDEX==5)?  3:
43
                      (CONGESTION_INDEX==7)?  3:
44
                      (CONGESTION_INDEX==9)?  3:
45
                      (CONGESTION_INDEX==10)? 4:
46
                      (CONGESTION_INDEX==12)? 3:2;
47
 
48
 
49
 localparam
50
        E_SRC_LSB =0,                   E_SRC_MSB = E_SRC_LSB + EAw-1,
51 54 alirezamon
        E_DST_LSB = E_SRC_MSB +1,       E_DST_MSB = E_DST_LSB + DAw-1,
52 48 alirezamon
        DST_P_LSB = E_DST_MSB + 1,      DST_P_MSB = DST_P_LSB + DSTPw-1,
53
        CLASS_LSB = DST_P_MSB + 1,      CLASS_MSB = CLASS_LSB + Cw -1,
54
        MSB_CLASS = (C>1)? CLASS_MSB : DST_P_MSB,
55
        WEIGHT_LSB= MSB_CLASS + 1,      WEIGHT_MSB = WEIGHT_LSB + WEIGHTw -1,
56
        /* verilator lint_off WIDTH */
57
        MSB_W = (SWA_ARBITER_TYPE== "WRRA")? WEIGHT_MSB : MSB_CLASS,
58
        /* verilator lint_on WIDTH */
59
        BE_LSB =  MSB_W + 1,            BE_MSB = BE_LSB+ BEw-1,
60
        MSB_BE = (BYTE_EN==1)?   BE_MSB  : MSB_W,
61
        /* verilator lint_off WIDTH */
62
        //the maximum data width that can be carried out with header flit
63
        HDR_MAX_DATw = (PCK_TYPE == "SINGLE_FLIT")? Fpay : Fpay - MSB_BE -1;
64
        /* verilator lint_on WIDTH */
65
 
66
        /* verilator lint_off WIDTH */
67
localparam
68
        DISTw =  (TOPOLOGY=="FATTREE" || TOPOLOGY=="TREE" ) ? log2(2*L+1): log2(NR+1),
69 55 alirezamon
        OVC_ALLOC_MODE= ((V==1 || B<=4) )?   1'b1 : 1'b0;
70 48 alirezamon
        /* verilator lint_on WIDTH */
71
 
72
        // 0: The new ovc is allocated only if its not nearly full. Results in a simpler sw_mask_gen logic
73
        // 1: The new ovc is allocated only if its not full. Results in a little more complex sw_mask_gen logic
74
 
75
 
76
 /******************
77
 *   vsa : Virtual channel & Switch allocator
78
 *   local two-stage router allocator
79
 *****************/
80
        typedef struct packed {
81
                logic [V-1 : 0] ovc_is_allocated;
82
                logic [V-1 : 0] ovc_is_released;
83
                logic [V-1 : 0] ivc_num_getting_sw_grant;
84
                logic [V-1 : 0] ivc_num_getting_ovc_grant;
85
                logic [V-1 : 0] ivc_reset;
86
                logic [V-1 : 0] buff_space_decreased;
87
                logic [V*V-1: 0] ivc_granted_ovc_num;
88
        } vsa_ctrl_t;
89
        localparam  VSA_CTRL_w = $bits(vsa_ctrl_t);
90
 
91
/*********************
92
*       ssa : static straight allocator:
93
*             enable single cycle latency for flits goes to the same direction
94
**********************/
95
 
96
        typedef struct packed {
97
                logic [V-1 : 0] ovc_is_allocated;
98
                logic [V-1 : 0] ovc_is_released;
99
                logic [V-1 : 0] ivc_num_getting_sw_grant;
100
                logic [V-1 : 0] ivc_num_getting_ovc_grant;
101
                logic [V-1 : 0] ivc_reset;
102
                logic [V-1 : 0] buff_space_decreased;
103
                logic [V-1 : 0] ivc_single_flit_pck;
104
                logic [V-1 : 0] ovc_single_flit_pck;
105
                bit                     ssa_flit_wr;
106
                logic [V*V-1: 0] ivc_granted_ovc_num;
107
        } ssa_ctrl_t;
108
        localparam  SSA_CTRL_w = $bits(ssa_ctrl_t);
109
 
110
 
111
/*********************
112
*    smart : straight bypass allocator:
113
*    enable multihub bypassing for flits goes to the same direction
114
*********************/
115
        typedef struct packed {
116
                logic [EAw-1 : 0] dest_e_addr;
117
                logic ovc_is_assigned;
118
                logic [Vw-1   : 0] assigned_ovc_bin;
119
        } smart_ivc_info_t;
120
        localparam SMART_IVC_w = $bits(smart_ivc_info_t);
121
 
122
 
123
 
124
        typedef struct packed {
125
                bit             smart_en;
126
                bit     hdr_flit_req;
127
                logic   [V-1 : 0]        ivc_smart_en;
128
                logic   [DSTPw-1  :   0] lk_destport;
129
                logic   [DSTPw-1  :   0] destport;
130
                logic   [V-1 : 0] credit_out;
131
                logic   [V-1 : 0] buff_space_decreased;
132
                logic   [V-1 : 0] ovc_is_allocated;
133
                logic   [V-1 : 0] ovc_is_released;
134
                logic   [V-1 : 0] ivc_num_getting_ovc_grant;
135
                logic   [V-1 : 0] ivc_reset;
136
                logic   [V-1 : 0] mask_available_ovc;
137
                logic   [V-1 : 0] ivc_single_flit_pck;
138
                logic   [V-1 : 0] ovc_single_flit_pck;
139
                logic   [V*V-1: 0] ivc_granted_ovc_num;
140
        } smart_ctrl_t;
141
        localparam  SMART_CTRL_w = $bits(smart_ctrl_t);
142
 
143
        /*****************
144
         * port_info
145
         * **************/
146
        typedef struct packed {
147
                logic [V-1 : 0] ivc_req; // input vc is not empty
148
                logic [V-1 : 0] swa_first_level_grant;// The vc number (one-hot) in an input port which get the first level switch allocator grant
149
                logic [V-1 : 0] swa_grant; // The VC number in an input port which got the swa grant
150
                logic [MAX_P-1 : 0] granted_oport_one_hot;      //The granted output port num (one-hot) for an input port
151
                logic any_ivc_get_swa_grant;
152
 
153
        } iport_info_t;
154
        localparam  IPORT_INFO_w = $bits(iport_info_t);
155
 
156
        typedef struct packed {
157
                logic [V-1 : 0] non_smart_ovc_is_allocated;
158
                //logic [V-1 : 0] ovc_is_released;
159
                //logic [V-1 : 0] ovc_credit_increased;
160
                //logic [V-1 : 0] ovc_credit_decreased;
161
                //logic [V-1 : 0] ovc_avalable;
162
                bit any_ovc_granted;
163
                //bit crossbar_flit_wr;
164
 
165
        }oport_info_t;
166
        localparam  OPORT_INFO_w = $bits(oport_info_t);
167
 
168
 
169
 
170
 
171
 
172
        /*********************
173
         * ivc
174
         *******************/
175
 
176
 
177
        typedef struct packed {
178
                //ivc
179
                logic [EAw-1 : 0] dest_e_addr;
180
                logic ovc_is_assigned;
181
                logic [V-1   : 0] assigned_ovc_num;
182
                logic [Vw-1  : 0] assigned_ovc_bin;
183
                logic [MAX_P-1   : 0] destport_one_hot;
184
                logic [DSTPw-1 : 0]  dest_port_encoded;
185
                logic ivc_req; // input vc is not empty
186
                logic flit_is_tail;
187
                logic assigned_ovc_not_full;
188
                logic [V-1  : 0] candidate_ovc;
189 54 alirezamon
                logic [Cw-1 : 0] class_num;
190
                logic single_flit_pck;
191 48 alirezamon
 
192
        } ivc_info_t;
193
        localparam  IVC_INFO_w = $bits( ivc_info_t);
194
 
195
        localparam      CREDITw  = (LB>B)?  log2(LB+1) : log2(B+1);
196
 
197
        //ovc info
198
        typedef struct packed {
199
                bit avalable;
200
                bit status; //1 : is allocated 0 : not_allocated
201
                logic [CREDITw-1 : 0] credit;//available credit in OVC
202
                bit full;
203
                bit nearly_full;
204
                bit empty;
205
        }ovc_info_t;
206
        localparam  OVC_INFO_w = $bits( ovc_info_t);
207
 
208 54 alirezamon
 
209
 
210 48 alirezamon
 
211 54 alirezamon
 
212 48 alirezamon
/*********************
213
* router_chanels
214
*********************/
215
 
216
        typedef struct packed {
217
                logic [EAw-1    : 0] src_e_addr;
218 54 alirezamon
                logic [DAw-1    : 0] dest_e_addr;
219 48 alirezamon
                logic [DSTPw-1  : 0] destport;
220
                logic [Cw-1             : 0] message_class;
221
                logic [WEIGHTw-1: 0] weight;
222
                logic [BEw-1    : 0] be;
223
        } hdr_flit_t;
224
        localparam HDR_FLIT_w = $bits(hdr_flit_t);
225
 
226
        /* verilator lint_off WIDTH */
227
        localparam FPAYw = (PCK_TYPE == "SINGLE_FLIT")?   Fpay + MSB_BE: Fpay;
228
        /* verilator lint_on WIDTH */
229
 
230
        typedef struct packed {
231
                bit hdr_flag;
232
                bit tail_flag;
233
                logic [V-1 : 0] vc;
234
                logic [FPAYw-1 : 0] payload;
235
        } flit_t;
236
        localparam FLIT_w = $bits(flit_t);
237
 
238
        localparam
239
                Fw = FLIT_w,
240
                NEFw = NE *Fw;
241
 
242
        typedef struct packed {
243
                logic  flit_wr;
244
                logic  [V-1 :  0]  credit;
245
                flit_t  flit;
246
                logic  [CONGw-1 :  0]  congestion;
247
        } flit_chanel_t;
248
        localparam FLIT_CHANEL_w = $bits(flit_chanel_t);
249
 
250 54 alirezamon
        localparam BYPASSw = log2(SMART_NUM+1);
251 48 alirezamon
        typedef struct packed {
252
                logic [SMART_NUM-1: 0] requests;
253
                logic [V-1      : 0] ovc;
254
                logic [EAw-1    : 0] dest_e_addr;
255
                bit   hdr_flit;
256 54 alirezamon
                bit   flit_in_bypassed;
257
                logic [BYPASSw-1 : 0] bypassed_num;
258 48 alirezamon
        } smart_chanel_t;
259
        localparam SMART_CHANEL_w = $bits(smart_chanel_t);
260
 
261
 
262
        localparam CRDTw = (B>LB) ? log2(B+1) : log2(LB+1);
263
        typedef struct packed {
264 54 alirezamon
                bit    endp_port;  // if it is one, it means the corresponding port is connected o an endpoint
265 48 alirezamon
                logic [RAw-1:   0]  neighbors_r_addr;
266 54 alirezamon
                logic [V-1  :0] [CRDTw-1: 0] credit_init_val; // the connected port initial credit value. It is taken at reset time
267 56 alirezamon
                logic [V-1  :0] credit_release_en;
268 48 alirezamon
        } ctrl_chanel_t;
269
        localparam CTRL_CHANEL_w = $bits(ctrl_chanel_t);
270
 
271 54 alirezamon
 
272
 
273 48 alirezamon
        typedef struct packed {
274
                flit_chanel_t    flit_chanel;
275
                smart_chanel_t   smart_chanel;
276
                ctrl_chanel_t    ctrl_chanel;
277
        } smartflit_chanel_t;
278
        localparam SMARTFLIT_CHANEL_w = $bits(smartflit_chanel_t);
279
 
280
 
281
 
282
 
283
/***********
284
 * simulation
285
 * **********/
286 54 alirezamon
 
287 56 alirezamon
        localparam DELAYw = 9; //Injector start delay counter width. 10 to 500 clk cycles delay randomly selected
288 54 alirezamon
 
289 48 alirezamon
        typedef struct packed {
290
                integer   ip_num;
291
                bit send_enable;
292
                integer  percentage; // x10
293
        } hotspot_t;
294
 
295
        typedef struct packed {
296
                integer value;
297
                integer percentage;
298
        }rnd_discrete_t;
299
 
300
        //packet injector interface
301
        localparam PCK_INJ_Dw =64;//TODO to be defined by user
302 56 alirezamon
        localparam PCK_SIZw= log2(MAX_PCK_SIZ+1);
303 48 alirezamon
 
304
 
305
 
306
        typedef struct packed {
307
                logic [PCK_INJ_Dw-1 : 0] data;
308
                logic [PCK_SIZw-1 : 0] size;
309 54 alirezamon
                logic [DAw-1 : 0] endp_addr;
310 48 alirezamon
                logic [Cw-1  : 0] class_num;
311
                logic [WEIGHTw-1   : 0] init_weight;
312
                logic [V-1   : 0] vc;
313
                bit   pck_wr;
314
                bit   [V-1   : 0] ready;
315
                logic [DISTw-1 : 0] distance;
316
                logic [15: 0]  h2t_delay;
317
    }   pck_injct_t;
318
    localparam PCK_INJCT_w = $bits(pck_injct_t);
319
 
320 54 alirezamon
    typedef struct packed {
321
        logic [BYPASSw-1 : 0] bypassed_num;
322
        bit flit_wr_i;
323
        bit pck_wr_i;
324
        bit flit_wr_o;
325
        bit pck_wr_o;
326 56 alirezamon
        bit flit_in_bypassed;
327
        bit active_high_reset; // if asserted means ProNoC is configured with active high reset
328 54 alirezamon
    } router_event_t;
329
    localparam ROUTER_EVENT_w = $bits(router_event_t);
330
 
331 56 alirezamon
 
332
`ifdef IMPORT_PRONOC_PCK
333 48 alirezamon
endpackage : pronoc_pkg
334 56 alirezamon
`endif
335 48 alirezamon
 
336 56 alirezamon
`endif

powered by: WebSVN 2.1.0

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