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 48

Go to most recent revision | Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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