1 |
34 |
alirezamon |
#######################################################################
|
2 |
|
|
## File: ni_master.IP
|
3 |
|
|
##
|
4 |
48 |
alirezamon |
## Copyright (C) 2014-2019 Alireza Monemi
|
5 |
34 |
alirezamon |
##
|
6 |
48 |
alirezamon |
## This file is part of ProNoC 1.9.1
|
7 |
34 |
alirezamon |
##
|
8 |
|
|
## WARNING: THIS IS AN AUTO-GENERATED FILE. CHANGES TO IT
|
9 |
48 |
alirezamon |
## MAY CAUSE UNEXPECTED BEHAVIOR.
|
10 |
34 |
alirezamon |
################################################################################
|
11 |
|
|
|
12 |
38 |
alirezamon |
$ipgen = bless( {
|
13 |
48 |
alirezamon |
'ports_order' => [
|
14 |
|
|
'reset',
|
15 |
|
|
'clk',
|
16 |
|
|
'current_e_addr',
|
17 |
|
|
'current_r_addr',
|
18 |
|
|
'chan_out',
|
19 |
|
|
'chan_in',
|
20 |
|
|
's_dat_i',
|
21 |
|
|
's_sel_i',
|
22 |
|
|
's_addr_i',
|
23 |
|
|
's_cti_i',
|
24 |
|
|
's_stb_i',
|
25 |
|
|
's_cyc_i',
|
26 |
|
|
's_we_i',
|
27 |
|
|
's_dat_o',
|
28 |
|
|
's_ack_o',
|
29 |
|
|
'm_send_sel_o',
|
30 |
|
|
'm_send_addr_o',
|
31 |
|
|
'm_send_cti_o',
|
32 |
|
|
'm_send_stb_o',
|
33 |
|
|
'm_send_cyc_o',
|
34 |
|
|
'm_send_we_o',
|
35 |
|
|
'm_send_dat_i',
|
36 |
|
|
'm_send_ack_i',
|
37 |
|
|
'm_receive_sel_o',
|
38 |
|
|
'm_receive_dat_o',
|
39 |
|
|
'm_receive_addr_o',
|
40 |
|
|
'm_receive_cti_o',
|
41 |
|
|
'm_receive_stb_o',
|
42 |
|
|
'm_receive_cyc_o',
|
43 |
|
|
'm_receive_we_o',
|
44 |
|
|
'm_receive_ack_i',
|
45 |
|
|
'irq'
|
46 |
|
|
],
|
47 |
|
|
'parameters' => {
|
48 |
|
|
'CRC_EN' => {
|
49 |
|
|
'redefine_param' => 1,
|
50 |
|
|
'default' => '"NO"',
|
51 |
|
|
'global_param' => 'Localparam',
|
52 |
|
|
'info' => 'The parameter can be selected as "YES" or "NO".
|
53 |
|
|
If CRC is enabled, then two CRC32 generator modules will be added to the NI. One CRC generator for calculating CRC of sending packets and another for receiving packets. The CRC32 value of each packet is send via tail flit and at destination NI, is will be compared with received packet generated CRC32. The matching results can be used for error-detection and can be read via NI slave interface. ',
|
54 |
|
|
'content' => '"YES","NO"',
|
55 |
|
|
'type' => 'Combo-box'
|
56 |
|
|
},
|
57 |
|
|
'SELw' => {
|
58 |
|
|
'info' => 'Parameter',
|
59 |
|
|
'content' => '',
|
60 |
|
|
'global_param' => 'Localparam',
|
61 |
|
|
'redefine_param' => 1,
|
62 |
|
|
'default' => '4',
|
63 |
|
|
'type' => 'Fixed'
|
64 |
|
|
},
|
65 |
|
|
'MAX_TRANSACTION_WIDTH' => {
|
66 |
|
|
'type' => 'Spin-button',
|
67 |
|
|
'global_param' => 'Localparam',
|
68 |
|
|
'redefine_param' => 1,
|
69 |
|
|
'default' => '13',
|
70 |
|
|
'info' => 'maximum packet size width in words.
|
71 |
|
|
The maximum data that can be sent via one packet will be 2 power of MAX_DMA_TRANSACTION_WIDTH in words.',
|
72 |
|
|
'content' => '4,32,1'
|
73 |
|
|
},
|
74 |
|
|
'EAw' => {
|
75 |
|
|
'type' => 'Fixed',
|
76 |
|
|
'default' => '16',
|
77 |
|
|
'redefine_param' => 0,
|
78 |
|
|
'global_param' => 'Parameter',
|
79 |
|
|
'content' => '',
|
80 |
|
|
'info' => undef
|
81 |
|
|
},
|
82 |
|
|
'S_Aw' => {
|
83 |
|
|
'type' => 'Fixed',
|
84 |
|
|
'content' => '',
|
85 |
|
|
'info' => 'Parameter',
|
86 |
|
|
'default' => '8',
|
87 |
|
|
'redefine_param' => 1,
|
88 |
|
|
'global_param' => 'Localparam'
|
89 |
|
|
},
|
90 |
|
|
'TAGw' => {
|
91 |
|
|
'type' => 'Fixed',
|
92 |
|
|
'global_param' => 'Localparam',
|
93 |
|
|
'redefine_param' => 1,
|
94 |
|
|
'default' => '3',
|
95 |
|
|
'info' => 'Parameter',
|
96 |
|
|
'content' => ''
|
97 |
|
|
},
|
98 |
|
|
'Dw' => {
|
99 |
|
|
'info' => 'wishbone_bus data width in bits.',
|
100 |
|
|
'content' => '32,256,8',
|
101 |
|
|
'global_param' => 'Localparam',
|
102 |
|
|
'default' => '32',
|
103 |
|
|
'redefine_param' => 1,
|
104 |
|
|
'type' => 'Spin-button'
|
105 |
|
|
},
|
106 |
|
|
'M_Aw' => {
|
107 |
|
|
'type' => 'Fixed',
|
108 |
|
|
'info' => 'Parameter',
|
109 |
|
|
'content' => 'Dw',
|
110 |
|
|
'redefine_param' => 1,
|
111 |
|
|
'default' => '32',
|
112 |
|
|
'global_param' => 'Localparam'
|
113 |
|
|
},
|
114 |
|
|
'MAX_BURST_SIZE' => {
|
115 |
|
|
'default' => '16',
|
116 |
|
|
'redefine_param' => 1,
|
117 |
|
|
'global_param' => 'Localparam',
|
118 |
|
|
'info' => 'Maximum burst size in words.
|
119 |
|
|
The NI releases the wishbone bus each time one burst is completed or when the VC\'s internal FIFO becomes full. The bus will be released for one clock cycle. Then in case, there are other active VCs, another active VC will get access to the bus using round robin arbiter. This process will be continued until all of the desired data is transferred. ',
|
120 |
|
|
'content' => '2,4,8,16,32,64,128,256,512,1024,2048',
|
121 |
|
|
'type' => 'Combo-box'
|
122 |
|
|
},
|
123 |
|
|
'RAw' => {
|
124 |
|
|
'type' => 'Fixed',
|
125 |
|
|
'redefine_param' => 0,
|
126 |
|
|
'default' => '16',
|
127 |
|
|
'global_param' => 'Parameter',
|
128 |
|
|
'content' => '',
|
129 |
|
|
'info' => undef
|
130 |
|
|
},
|
131 |
|
|
'HDATA_PRECAPw' => {
|
132 |
|
|
'type' => 'Spin-button',
|
133 |
|
|
'info' => ' The headr 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) by the NI before saving the packet in a memory buffer. This can give some hints to the software regarding the incoming packet such as its type, or source port so the software can store the packet in its appropriate buffer.',
|
134 |
|
|
'content' => '0,8,1',
|
135 |
|
|
'global_param' => 'Localparam',
|
136 |
|
|
'default' => '0',
|
137 |
|
|
'redefine_param' => 1
|
138 |
|
|
}
|
139 |
|
|
},
|
140 |
|
|
'plugs' => {
|
141 |
|
|
'reset' => {
|
142 |
|
|
'type' => 'num',
|
143 |
|
|
'value' => 1,
|
144 |
|
|
'0' => {
|
145 |
|
|
'name' => 'reset'
|
146 |
|
|
},
|
147 |
|
|
'reset' => {}
|
148 |
|
|
},
|
149 |
|
|
'wb_slave' => {
|
150 |
|
|
'type' => 'num',
|
151 |
|
|
'0' => {
|
152 |
|
|
'name' => 'wb_slave',
|
153 |
|
|
'addr' => '0xb800_0000 0xbfff_ffff custom devices',
|
154 |
|
|
'width' => 10
|
155 |
|
|
},
|
156 |
|
|
'wb_slave' => {},
|
157 |
|
|
'value' => 1
|
158 |
|
|
},
|
159 |
|
|
'wb_master' => {
|
160 |
|
|
'1' => {
|
161 |
|
|
'name' => 'wb_receive'
|
162 |
|
|
},
|
163 |
|
|
'wb_master' => {},
|
164 |
|
|
'type' => 'num',
|
165 |
|
|
'0' => {
|
166 |
|
|
'name' => 'wb_send'
|
167 |
|
|
},
|
168 |
|
|
'value' => 2
|
169 |
|
|
},
|
170 |
|
|
'interrupt_peripheral' => {
|
171 |
|
|
'value' => 1,
|
172 |
|
|
'0' => {
|
173 |
|
|
'name' => 'interrupt'
|
174 |
|
|
},
|
175 |
|
|
'type' => 'num',
|
176 |
|
|
'interrupt_peripheral' => {}
|
177 |
|
|
},
|
178 |
|
|
'clk' => {
|
179 |
|
|
'clk' => {},
|
180 |
|
|
'type' => 'num',
|
181 |
|
|
'0' => {
|
182 |
|
|
'name' => 'clk'
|
183 |
|
|
},
|
184 |
|
|
'value' => 1
|
185 |
|
|
}
|
186 |
|
|
},
|
187 |
42 |
alirezamon |
'ports' => {
|
188 |
48 |
alirezamon |
'm_send_stb_o' => {
|
189 |
|
|
'intfc_port' => 'stb_o',
|
190 |
|
|
'range' => '',
|
191 |
|
|
'type' => 'output',
|
192 |
42 |
alirezamon |
'intfc_name' => 'plug:wb_master[0]'
|
193 |
|
|
},
|
194 |
48 |
alirezamon |
'm_send_cti_o' => {
|
195 |
|
|
'range' => 'TAGw-1 : 0',
|
196 |
|
|
'intfc_port' => 'cti_o',
|
197 |
|
|
'intfc_name' => 'plug:wb_master[0]',
|
198 |
|
|
'type' => 'output'
|
199 |
|
|
},
|
200 |
|
|
'chan_in' => {
|
201 |
|
|
'range' => 'smartflit_chanel_t',
|
202 |
|
|
'intfc_port' => 'chan_in',
|
203 |
|
|
'type' => 'input',
|
204 |
|
|
'intfc_name' => 'socket:ni[0]'
|
205 |
|
|
},
|
206 |
43 |
alirezamon |
'm_receive_sel_o' => {
|
207 |
42 |
alirezamon |
'type' => 'output',
|
208 |
48 |
alirezamon |
'intfc_name' => 'plug:wb_master[1]',
|
209 |
43 |
alirezamon |
'range' => 'SELw-1 : 0',
|
210 |
|
|
'intfc_port' => 'sel_o'
|
211 |
42 |
alirezamon |
},
|
212 |
48 |
alirezamon |
'm_send_sel_o' => {
|
213 |
|
|
'intfc_port' => 'sel_o',
|
214 |
|
|
'range' => 'SELw-1 : 0',
|
215 |
43 |
alirezamon |
'type' => 'output',
|
216 |
42 |
alirezamon |
'intfc_name' => 'plug:wb_master[0]'
|
217 |
|
|
},
|
218 |
48 |
alirezamon |
'current_e_addr' => {
|
219 |
|
|
'intfc_name' => 'socket:ni[0]',
|
220 |
|
|
'type' => 'input',
|
221 |
|
|
'intfc_port' => 'current_e_addr',
|
222 |
|
|
'range' => 'EAw-1 : 0'
|
223 |
|
|
},
|
224 |
|
|
'chan_out' => {
|
225 |
|
|
'type' => 'output',
|
226 |
|
|
'intfc_name' => 'socket:ni[0]',
|
227 |
|
|
'intfc_port' => 'chan_out',
|
228 |
|
|
'range' => 'smartflit_chanel_t'
|
229 |
|
|
},
|
230 |
|
|
'm_send_we_o' => {
|
231 |
|
|
'intfc_name' => 'plug:wb_master[0]',
|
232 |
|
|
'type' => 'output',
|
233 |
|
|
'intfc_port' => 'we_o',
|
234 |
|
|
'range' => ''
|
235 |
|
|
},
|
236 |
43 |
alirezamon |
's_cyc_i' => {
|
237 |
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
238 |
|
|
'type' => 'input',
|
239 |
48 |
alirezamon |
'range' => '',
|
240 |
|
|
'intfc_port' => 'cyc_i'
|
241 |
43 |
alirezamon |
},
|
242 |
48 |
alirezamon |
'irq' => {
|
243 |
|
|
'intfc_name' => 'plug:interrupt_peripheral[0]',
|
244 |
|
|
'type' => 'output',
|
245 |
|
|
'range' => '',
|
246 |
|
|
'intfc_port' => 'int_o'
|
247 |
|
|
},
|
248 |
43 |
alirezamon |
'm_receive_ack_i' => {
|
249 |
48 |
alirezamon |
'intfc_port' => 'ack_i',
|
250 |
|
|
'range' => '',
|
251 |
43 |
alirezamon |
'intfc_name' => 'plug:wb_master[1]',
|
252 |
48 |
alirezamon |
'type' => 'input'
|
253 |
43 |
alirezamon |
},
|
254 |
42 |
alirezamon |
'reset' => {
|
255 |
|
|
'range' => '',
|
256 |
|
|
'intfc_port' => 'reset_i',
|
257 |
48 |
alirezamon |
'intfc_name' => 'plug:reset[0]',
|
258 |
|
|
'type' => 'input'
|
259 |
42 |
alirezamon |
},
|
260 |
48 |
alirezamon |
'clk' => {
|
261 |
|
|
'intfc_name' => 'plug:clk[0]',
|
262 |
|
|
'type' => 'input',
|
263 |
|
|
'intfc_port' => 'clk_i',
|
264 |
|
|
'range' => ''
|
265 |
|
|
},
|
266 |
|
|
'm_receive_addr_o' => {
|
267 |
|
|
'intfc_name' => 'plug:wb_master[1]',
|
268 |
|
|
'type' => 'output',
|
269 |
|
|
'intfc_port' => 'adr_o',
|
270 |
|
|
'range' => 'M_Aw-1 : 0'
|
271 |
|
|
},
|
272 |
|
|
's_dat_o' => {
|
273 |
|
|
'type' => 'output',
|
274 |
43 |
alirezamon |
'intfc_name' => 'plug:wb_slave[0]',
|
275 |
|
|
'range' => 'Dw-1 : 0',
|
276 |
48 |
alirezamon |
'intfc_port' => 'dat_o'
|
277 |
43 |
alirezamon |
},
|
278 |
48 |
alirezamon |
'm_receive_cyc_o' => {
|
279 |
43 |
alirezamon |
'type' => 'output',
|
280 |
48 |
alirezamon |
'intfc_name' => 'plug:wb_master[1]',
|
281 |
|
|
'range' => '',
|
282 |
|
|
'intfc_port' => 'cyc_o'
|
283 |
43 |
alirezamon |
},
|
284 |
42 |
alirezamon |
'm_receive_we_o' => {
|
285 |
|
|
'range' => '',
|
286 |
48 |
alirezamon |
'intfc_port' => 'we_o',
|
287 |
43 |
alirezamon |
'intfc_name' => 'plug:wb_master[1]',
|
288 |
48 |
alirezamon |
'type' => 'output'
|
289 |
42 |
alirezamon |
},
|
290 |
43 |
alirezamon |
'm_receive_dat_o' => {
|
291 |
|
|
'type' => 'output',
|
292 |
48 |
alirezamon |
'intfc_name' => 'plug:wb_master[1]',
|
293 |
43 |
alirezamon |
'intfc_port' => 'dat_o',
|
294 |
48 |
alirezamon |
'range' => 'Dw-1 : 0'
|
295 |
43 |
alirezamon |
},
|
296 |
48 |
alirezamon |
's_dat_i' => {
|
297 |
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
298 |
43 |
alirezamon |
'type' => 'input',
|
299 |
48 |
alirezamon |
'intfc_port' => 'dat_i',
|
300 |
|
|
'range' => 'Dw-1 : 0'
|
301 |
43 |
alirezamon |
},
|
302 |
48 |
alirezamon |
'm_send_addr_o' => {
|
303 |
|
|
'range' => 'M_Aw-1 : 0',
|
304 |
|
|
'intfc_port' => 'adr_o',
|
305 |
|
|
'intfc_name' => 'plug:wb_master[0]',
|
306 |
|
|
'type' => 'output'
|
307 |
|
|
},
|
308 |
43 |
alirezamon |
's_we_i' => {
|
309 |
48 |
alirezamon |
'intfc_port' => 'we_i',
|
310 |
|
|
'range' => '',
|
311 |
43 |
alirezamon |
'intfc_name' => 'plug:wb_slave[0]',
|
312 |
48 |
alirezamon |
'type' => 'input'
|
313 |
43 |
alirezamon |
},
|
314 |
48 |
alirezamon |
's_addr_i' => {
|
315 |
|
|
'range' => 'S_Aw-1 : 0',
|
316 |
|
|
'intfc_port' => 'adr_i',
|
317 |
|
|
'type' => 'input',
|
318 |
|
|
'intfc_name' => 'plug:wb_slave[0]'
|
319 |
|
|
},
|
320 |
|
|
's_ack_o' => {
|
321 |
|
|
'type' => 'output',
|
322 |
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
323 |
|
|
'range' => '',
|
324 |
|
|
'intfc_port' => 'ack_o'
|
325 |
|
|
},
|
326 |
42 |
alirezamon |
'm_receive_stb_o' => {
|
327 |
48 |
alirezamon |
'range' => '',
|
328 |
42 |
alirezamon |
'intfc_port' => 'stb_o',
|
329 |
43 |
alirezamon |
'intfc_name' => 'plug:wb_master[1]',
|
330 |
|
|
'type' => 'output'
|
331 |
42 |
alirezamon |
},
|
332 |
48 |
alirezamon |
's_sel_i' => {
|
333 |
|
|
'range' => 'SELw-1 : 0',
|
334 |
|
|
'intfc_port' => 'sel_i',
|
335 |
|
|
'type' => 'input',
|
336 |
|
|
'intfc_name' => 'plug:wb_slave[0]'
|
337 |
|
|
},
|
338 |
|
|
's_cti_i' => {
|
339 |
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
340 |
|
|
'type' => 'input',
|
341 |
|
|
'intfc_port' => 'cti_i',
|
342 |
|
|
'range' => 'TAGw-1 : 0'
|
343 |
|
|
},
|
344 |
|
|
'm_send_dat_i' => {
|
345 |
|
|
'intfc_name' => 'plug:wb_master[0]',
|
346 |
|
|
'type' => 'input',
|
347 |
|
|
'range' => 'Dw-1 : 0',
|
348 |
|
|
'intfc_port' => 'dat_i'
|
349 |
|
|
},
|
350 |
42 |
alirezamon |
'm_send_cyc_o' => {
|
351 |
|
|
'range' => '',
|
352 |
48 |
alirezamon |
'intfc_port' => 'cyc_o',
|
353 |
43 |
alirezamon |
'intfc_name' => 'plug:wb_master[0]',
|
354 |
48 |
alirezamon |
'type' => 'output'
|
355 |
42 |
alirezamon |
},
|
356 |
48 |
alirezamon |
'm_receive_cti_o' => {
|
357 |
|
|
'intfc_name' => 'plug:wb_master[1]',
|
358 |
|
|
'type' => 'output',
|
359 |
|
|
'intfc_port' => 'cti_o',
|
360 |
|
|
'range' => 'TAGw-1 : 0'
|
361 |
|
|
},
|
362 |
|
|
'm_send_ack_i' => {
|
363 |
|
|
'type' => 'input',
|
364 |
|
|
'intfc_name' => 'plug:wb_master[0]',
|
365 |
|
|
'intfc_port' => 'ack_i',
|
366 |
|
|
'range' => ''
|
367 |
|
|
},
|
368 |
|
|
'current_r_addr' => {
|
369 |
|
|
'range' => 'RAw-1 : 0',
|
370 |
|
|
'intfc_port' => 'current_r_addr',
|
371 |
|
|
'type' => 'input',
|
372 |
|
|
'intfc_name' => 'socket:ni[0]'
|
373 |
|
|
},
|
374 |
|
|
's_stb_i' => {
|
375 |
|
|
'range' => '',
|
376 |
|
|
'intfc_port' => 'stb_i',
|
377 |
|
|
'intfc_name' => 'plug:wb_slave[0]',
|
378 |
|
|
'type' => 'input'
|
379 |
|
|
}
|
380 |
38 |
alirezamon |
},
|
381 |
48 |
alirezamon |
'unused' => {
|
382 |
|
|
'plug:wb_slave[0]' => [
|
383 |
|
|
'tag_i',
|
384 |
|
|
'err_o',
|
385 |
|
|
'bte_i',
|
386 |
|
|
'rty_o'
|
387 |
|
|
],
|
388 |
|
|
'plug:wb_master[0]' => [
|
389 |
|
|
'rty_i',
|
390 |
|
|
'dat_o',
|
391 |
|
|
'tag_o',
|
392 |
|
|
'err_i',
|
393 |
|
|
'bte_o'
|
394 |
|
|
],
|
395 |
|
|
'plug:wb_master[1]' => [
|
396 |
|
|
'dat_i',
|
397 |
|
|
'rty_i',
|
398 |
|
|
'tag_o',
|
399 |
|
|
'err_i',
|
400 |
|
|
'bte_o'
|
401 |
|
|
]
|
402 |
|
|
},
|
403 |
42 |
alirezamon |
'parameters_order' => [
|
404 |
|
|
'MAX_TRANSACTION_WIDTH',
|
405 |
|
|
'MAX_BURST_SIZE',
|
406 |
|
|
'Dw',
|
407 |
|
|
'S_Aw',
|
408 |
|
|
'M_Aw',
|
409 |
|
|
'TAGw',
|
410 |
|
|
'SELw',
|
411 |
43 |
alirezamon |
'CRC_EN',
|
412 |
|
|
'RAw',
|
413 |
48 |
alirezamon |
'EAw',
|
414 |
|
|
'HDATA_PRECAPw'
|
415 |
42 |
alirezamon |
],
|
416 |
48 |
alirezamon |
'module_name' => 'ni_master',
|
417 |
|
|
'description' => '',
|
418 |
|
|
'ip_name' => 'ni_master',
|
419 |
|
|
'hdl_files' => [
|
420 |
|
|
'/mpsoc/rtl/src_peripheral/ni/ni_vc_dma.v',
|
421 |
|
|
'/mpsoc/rtl/src_peripheral/ni/ni_vc_wb_slave_regs.v',
|
422 |
|
|
'/mpsoc/rtl/src_peripheral/ni/ni_master.sv',
|
423 |
|
|
'/mpsoc/rtl/src_peripheral/ni/ni_crc32.v',
|
424 |
|
|
'/mpsoc/rtl/main_comp.v',
|
425 |
|
|
'/mpsoc/rtl/arbiter.v',
|
426 |
54 |
alirezamon |
'/mpsoc/rtl/pronoc_def.v',
|
427 |
48 |
alirezamon |
'/mpsoc/rtl/src_topolgy/',
|
428 |
|
|
'/mpsoc/rtl/src_noc/'
|
429 |
|
|
],
|
430 |
|
|
'file_name' => 'mpsoc/rtl/src_peripheral/ni/ni_master.v',
|
431 |
|
|
'system_c' => '/*
|
432 |
|
|
The NI initializing function.
|
433 |
|
|
The burst_size must be <= $MAX_BURST_SIZE
|
434 |
|
|
send_int_en :1: enable the intrrupt when a packet is sent 0 : This intrrupt is disabled
|
435 |
|
|
save_int_en : 1: enable the intrrupt when a recived packet is saved on internal buffer 0 : This intrrupt is disabled
|
436 |
|
|
got_pck_int_en : 1: enable the intrrupt when a packet is recived in NI. 0 : This intrrupt is disabled
|
437 |
|
|
|
438 |
|
|
*/
|
439 |
|
|
void ${IP}_initial (unsigned int burst_size, unsigned char errors_int_en, unsigned char send_done_int_en, unsigned char save_done_int_en, unsigned char got_pck_int_en) {
|
440 |
|
|
${IP}_BURST_SIZE_REG = burst_size;
|
441 |
|
|
int i;
|
442 |
|
|
for (i=0; i<${IP}_NUM_VCs;i++){
|
443 |
|
|
if(send_done_int_en) ${IP}_send_done_int_en(i); else ${IP}_send_done_int_disable(i);
|
444 |
|
|
if(save_done_int_en) ${IP}_save_done_int_en(i); else ${IP}_save_done_int_disable(i);
|
445 |
|
|
if(got_pck_int_en) ${IP}_got_pckt_int_en(i); else ${IP}_got_pckt_int_disable(i);
|
446 |
|
|
if(errors_int_en) ${IP}_error_int_en(i); else ${IP}_error_int_disable(i);
|
447 |
|
|
|
448 |
|
|
}
|
449 |
|
|
}
|
450 |
|
|
|
451 |
|
|
/*
|
452 |
|
|
The NI message sent function:
|
453 |
|
|
v: virtual chanel number which this packet should be sent to
|
454 |
|
|
class_num: message class number. Diffrent message classes can be sent via isolated network resources to avoid protocol deadlock
|
455 |
|
|
data_start_addr : The address pointer to the start location of the packet to be sent in the memory
|
456 |
|
|
data_size: the message data size in words
|
457 |
|
|
dest_phy_addr: the destination endpoint physical address. check phy_adr.h file for knowing each endpoint physical address
|
458 |
|
|
|
459 |
|
|
*/
|
460 |
|
|
|
461 |
|
|
void ${IP}_transfer (unsigned int init_weight, unsigned int v, unsigned int class_num, unsigned char hdr_data, unsigned int data_start_addr, unsigned int data_size, unsigned int dest_phy_addr){
|
462 |
|
|
while (${IP}_send_is_busy(v)); // wait until VC is busy sending previous packet
|
463 |
|
|
${IP}_SEND_HDR_DATA_REG(v) = hdr_data;
|
464 |
|
|
${IP}_SEND_DATA_SIZE_REG(v) = data_size;
|
465 |
|
|
${IP}_SEND_ADDR_POINTER_REG(v) = data_start_addr;
|
466 |
|
|
${IP}_SEND_DEST_REG(v) = dest_phy_addr | (class_num<<16) | (init_weight<<24);
|
467 |
|
|
|
468 |
|
|
}
|
469 |
|
|
|
470 |
|
|
/*
|
471 |
|
|
The NI message receiver function:
|
472 |
|
|
v: virtual chanel number of the received packet
|
473 |
|
|
data_start_addr : The address pointer to the start location of the memory where the newly arrived packet must be stored by NI in.
|
474 |
|
|
max_buffer_size : The allocated receive-memory buffer size in words.
|
475 |
|
|
*/
|
476 |
|
|
|
477 |
|
|
void ${IP}_receive (unsigned int v, unsigned int data_start_addr, unsigned int max_buffer_size, unsigned int start_index){
|
478 |
|
|
while (${IP}_receive_is_busy(v)); // wait until VC is busy saving previous packet
|
479 |
|
|
${IP}_RECEIVE_ADDR_POINTER_REG(v) = data_start_addr;
|
480 |
|
|
${IP}_RECEIVE_SATRT_INDEX_REG(v) = start_index ;
|
481 |
|
|
${IP}_RECEIVE_MAX_BUFF_SIZ_REG(v) = max_buffer_size;
|
482 |
|
|
${IP}_RECEIVE_CTRL_REG(v) = 1;
|
483 |
|
|
}',
|
484 |
43 |
alirezamon |
'system_h' => '#include
|
485 |
48 |
alirezamon |
#ifdef MULTI_CORE
|
486 |
|
|
#include "../phy_addr.h"
|
487 |
|
|
#endif
|
488 |
|
|
|
489 |
|
|
/* NI wb registers addresses
|
490 |
|
|
|
491 |
|
|
VC specefic registers
|
492 |
|
|
address bits
|
493 |
|
|
[4+Vw:4] [3:0]
|
494 |
|
|
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,
|
495 |
|
|
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,
|
496 |
|
|
receive_is_busy, send_is_busy};
|
497 |
|
|
2 : SEND_DEST_WB_ADDR The destination router address
|
498 |
|
|
3 : SEND_POINTER_WB_ADDR, The address of data to be sent in byte
|
499 |
|
|
Virtual 4 : SEND_DATA_SIZE_WB_ADDR, The size of data to be sent in byte
|
500 |
|
|
chanel 5 : SEND_HDR_DATA_WB_ADDR The heder data address
|
501 |
|
|
number
|
502 |
|
|
8 : RECEIVE_SRC_WB_ADDR The source router (the router which is sent this packet).
|
503 |
|
|
9 : RECEIVE_POINTER_WB_ADDR The address pointer of reciever memory in byte
|
504 |
|
|
10 : RECEIVE_DATA_SIZE_WB_ADDR The size of recieved data in byte
|
505 |
|
|
11 : RECEIVE_MAX_BUFF_SIZ The reciver allocated buffer size in words. If the packet size is bigger than the buffer size the rest of ot will be discarred
|
506 |
|
|
12 : RECEIVE_SATRT_INDEX_WB_ADDR The recived data is wrriten on RECEIVE_POINTER_WB_ADDR + RECEIVE_SATRT_INDEX_WB_ADDR.
|
507 |
|
|
If the write address reach to the end of buffer pointer, it starts at the RECEIVE_POINTER_WB_ADDR.
|
508 |
|
|
13 : RECEIVE_CTRL_WB_ADDR The NI reciever control register
|
509 |
|
|
14 : RECEIVE_PRECAP_DATA_ADDR The address to the header filit data which can be precaptured befor buffering the actual data.
|
510 |
43 |
alirezamon |
|
511 |
48 |
alirezamon |
Shared registers for all VCs
|
512 |
|
|
address bits
|
513 |
|
|
[5:0]
|
514 |
|
|
0: STATUS1_WB_ADDR // status1: {send_vc_enable_binary, receive_vc_enable_binary, receive_vc_is_busy, send_vc_is_busy};
|
515 |
|
|
16: BURST_SIZE_WB_ADDR // The busrt size in words
|
516 |
|
|
32: reserved
|
517 |
|
|
|
518 |
34 |
alirezamon |
*/
|
519 |
48 |
alirezamon |
|
520 |
|
|
|
521 |
|
|
|
522 |
43 |
alirezamon |
#define COREID ${CORE_ID}
|
523 |
|
|
#define CORE_PHY_ADDR PHY_ADDR_ENDP_${CORE_ID}
|
524 |
48 |
alirezamon |
#define ${IP}_NUM_VCs ${V}
|
525 |
|
|
#define ${IP}_HDATA_PRECAPw ${HDATA_PRECAPw}
|
526 |
|
|
#define ${IP}_BYTE_EN ${BYTE_EN}
|
527 |
34 |
alirezamon |
|
528 |
48 |
alirezamon |
//general registers
|
529 |
|
|
#define ${IP}_STATUS1_REG (*((volatile unsigned int *) ($BASE))) //0
|
530 |
|
|
#define ${IP}_BURST_SIZE_REG (*((volatile unsigned int *) ($BASE+64))) //16
|
531 |
34 |
alirezamon |
|
532 |
48 |
alirezamon |
//VC contro registerl
|
533 |
|
|
#define ${IP}_CTRL_FLAGS_REG(v) (*((volatile unsigned int *) ($BASE+4+(v<<6)))) //1
|
534 |
34 |
alirezamon |
|
535 |
48 |
alirezamon |
//Send VC registers
|
536 |
|
|
#define ${IP}_SEND_DEST_REG(v) (*((volatile unsigned int *) ($BASE+8+(v<<6)))) //2
|
537 |
|
|
#define ${IP}_SEND_ADDR_POINTER_REG(v) (*((volatile unsigned int *) ($BASE+12+(v<<6)))) //3
|
538 |
|
|
#define ${IP}_SEND_DATA_SIZE_REG(v) (*((volatile unsigned int *) ($BASE+16+(v<<6)))) //4
|
539 |
|
|
#define ${IP}_SEND_HDR_DATA_REG(v) (*((volatile unsigned int *) ($BASE+20+(v<<6)))) //5
|
540 |
34 |
alirezamon |
|
541 |
48 |
alirezamon |
//Receives VC registers
|
542 |
|
|
#define ${IP}_RECEIVE_SRC_REG(v) (*((volatile unsigned int *) ($BASE+32+(v<<6)))) //8
|
543 |
|
|
#define ${IP}_RECEIVE_ADDR_POINTER_REG(v) (*((volatile unsigned int *) ($BASE+36+(v<<6)))) //9
|
544 |
|
|
#define ${IP}_RECEIVE_DATA_SIZE_REG(v) (*((volatile unsigned int *) ($BASE+40+(v<<6)))) //10
|
545 |
|
|
#define ${IP}_RECEIVE_MAX_BUFF_SIZ_REG(v) (*((volatile unsigned int *) ($BASE+44+(v<<6)))) //11
|
546 |
|
|
#define ${IP}_RECEIVE_SATRT_INDEX_REG(v) (*((volatile unsigned int *) ($BASE+48+(v<<6)))) //12
|
547 |
|
|
#define ${IP}_RECEIVE_CTRL_REG(v) (*((volatile unsigned int *) ($BASE+52+(v<<6)))) //13
|
548 |
|
|
#define ${IP}_RECEIVE_PRECAP_DATA_REG(v) (*((volatile unsigned int *) ($BASE+56+(v<<6)))) //14
|
549 |
34 |
alirezamon |
|
550 |
48 |
alirezamon |
//STATUS FLGs
|
551 |
|
|
#define ANY_SENT_DONE_ISR_FLG (1<<0)
|
552 |
|
|
#define ANY_SAVE_DONE_ISR_FLG (1<<1)
|
553 |
|
|
#define ANY_GOT_PCK_ISR_FLG (1<<2)
|
554 |
|
|
#define ANY_ERR_ISR_FLG (1<<3)
|
555 |
34 |
alirezamon |
|
556 |
48 |
alirezamon |
#define ${IP}_any_sent_done_isr_is_asserted() (( ${IP}_STATUS1_REG & ANY_SENT_DONE_ISR_FLG )!=0)
|
557 |
|
|
#define ${IP}_any_save_done_isr_is_asserted() (( ${IP}_STATUS1_REG & ANY_SAVE_DONE_ISR_FLG )!=0)
|
558 |
|
|
#define ${IP}_any_got_pck_isr_is_asserted() (( ${IP}_STATUS1_REG & ANY_GOT_PCK_ISR_FLG)!=0)
|
559 |
|
|
#define ${IP}_any_err_isr_is_asserted() (( ${IP}_STATUS1_REG & ANY_ERR_ISR_FLG)!=0)
|
560 |
34 |
alirezamon |
|
561 |
|
|
|
562 |
|
|
|
563 |
48 |
alirezamon |
//CTRL FLGs:
|
564 |
|
|
#define SEND_IS_BUSY_FLG (1<<0)
|
565 |
|
|
#define RCV_IS_BUSY_FLG (1<<1)
|
566 |
34 |
alirezamon |
|
567 |
48 |
alirezamon |
#define SEND_DONE_INT_EN_FLG (1<<2)
|
568 |
|
|
#define SAVE_DONE_INT_EN_FLG (1<<3)
|
569 |
|
|
#define GOT_PCK_INT_EN_FLG (1<<4)
|
570 |
|
|
#define ANY_ERR_INT_EN_FLG (1<<5)
|
571 |
34 |
alirezamon |
|
572 |
48 |
alirezamon |
#define SEND_DONE_ISR_FLG (1<<6)
|
573 |
|
|
#define SAVE_DONE_ISR_FLG (1<<7)
|
574 |
|
|
#define GOT_PCK_ISR_FLG (1<<8)
|
575 |
34 |
alirezamon |
|
576 |
48 |
alirezamon |
#define BUFF_OVFLOW_ERR_ISR_FLG (1<<9) // This error happens when the receiver allocated buffer size is smaller than the received packet size
|
577 |
|
|
#define CRC_MISS_MATCH_ISR_FLG (1<<10) // This error happens when the received packet CRC miss match
|
578 |
|
|
#define SEND_DSIZE_ERR_ISR_FLG (1<<11) // This error happens when the send data size is not set
|
579 |
|
|
#define BURST_SIZE_ERR_ISR_FLG (1<<12) // This error happens when the burst size is not set
|
580 |
|
|
#define INVALID_SEND_REQ_ISR_FLG (1<<13) // This error happens when a new send request is received while the DMA is still busy sending previous packet
|
581 |
34 |
alirezamon |
|
582 |
48 |
alirezamon |
#define ALL_INT_EN (SEND_DONE_INT_EN_FLG | SAVE_DONE_INT_EN_FLG | GOT_PCK_INT_EN_FLG | ANY_ERR_INT_EN_FLG)
|
583 |
42 |
alirezamon |
|
584 |
|
|
|
585 |
48 |
alirezamon |
#define ${IP}_send_is_busy(v) ((${IP}_CTRL_FLAGS_REG(v) & SEND_IS_BUSY_FLG)!=0)
|
586 |
|
|
#define ${IP}_send_is_free(v) ((${IP}_CTRL_FLAGS_REG(v) & SEND_IS_BUSY_FLG)==0)
|
587 |
42 |
alirezamon |
|
588 |
48 |
alirezamon |
#define ${IP}_receive_is_busy(v) ((${IP}_CTRL_FLAGS_REG(v) & RCV_IS_BUSY_FLG)!=0)
|
589 |
|
|
#define ${IP}_receive_is_free(v) ((${IP}_CTRL_FLAGS_REG(v) & RCV_IS_BUSY_FLG)==0)
|
590 |
42 |
alirezamon |
|
591 |
|
|
|
592 |
|
|
|
593 |
48 |
alirezamon |
|
594 |
|
|
|
595 |
|
|
#define ${IP}_send_done_int_en(v) (${IP}_CTRL_FLAGS_REG(v) |= SEND_DONE_INT_EN_FLG)
|
596 |
|
|
#define ${IP}_send_done_int_disable(v) (${IP}_CTRL_FLAGS_REG(v) &= ~SEND_DONE_INT_EN_FLG)
|
597 |
|
|
#define ${IP}_save_done_int_en(v) (${IP}_CTRL_FLAGS_REG(v) |= SAVE_DONE_INT_EN_FLG)
|
598 |
|
|
#define ${IP}_save_done_int_disable(v) (${IP}_CTRL_FLAGS_REG(v) &= ~SAVE_DONE_INT_EN_FLG)
|
599 |
|
|
#define ${IP}_got_pckt_int_en(v) (${IP}_CTRL_FLAGS_REG(v) |= GOT_PCK_INT_EN_FLG)
|
600 |
|
|
#define ${IP}_got_pckt_int_disable(v) (${IP}_CTRL_FLAGS_REG(v) &= ~GOT_PCK_INT_EN_FLG)
|
601 |
|
|
#define ${IP}_error_int_en(v) (${IP}_CTRL_FLAGS_REG(v) |= ANY_ERR_INT_EN_FLG)
|
602 |
|
|
#define ${IP}_error_int_disable(v) (${IP}_CTRL_FLAGS_REG(v) &= ~ANY_ERR_INT_EN_FLG)
|
603 |
|
|
|
604 |
|
|
|
605 |
|
|
|
606 |
|
|
#define ${IP}_packet_is_sent(v) ((${IP}_CTRL_FLAGS_REG(v) & SEND_DONE_ISR_FLG)!=0)
|
607 |
|
|
#define ${IP}_packet_is_saved(v) ((${IP}_CTRL_FLAGS_REG(v) & SAVE_DONE_ISR_FLG )!=0)
|
608 |
|
|
#define ${IP}_got_packet(v) ((${IP}_CTRL_FLAGS_REG(v) & GOT_PCK_ISR_FLG)!=0)
|
609 |
|
|
|
610 |
|
|
#define ${IP}_got_buff_ovf(v) ((${IP}_CTRL_FLAGS_REG(v) & BUFF_OVFLOW_ERR_ISR_FLG)!=0)
|
611 |
|
|
#define ${IP}_got_crc_mismatch(v) ((${IP}_CTRL_FLAGS_REG(v) & CRC_MISS_MATCH_ISR_FLG)!=0)
|
612 |
|
|
#define ${IP}_got_send_dsize_err(v) ((${IP}_CTRL_FLAGS_REG(v) & SEND_DSIZE_ERR_ISR_FLG)!=0)
|
613 |
|
|
#define ${IP}_got_burst_size_err(v) ((${IP}_CTRL_FLAGS_REG(v) & BURST_SIZE_ERR_ISR_FLG)!=0)
|
614 |
|
|
#define ${IP}_got_invalid_send_req(v) ((${IP}_CTRL_FLAGS_REG(v) & INVALID_SEND_REQ_ISR_FLG)!=0)
|
615 |
|
|
|
616 |
|
|
|
617 |
|
|
|
618 |
|
|
//intrrupts ack functions
|
619 |
|
|
#define ${IP}_ack_send_done_isr(v) (${IP}_CTRL_FLAGS_REG(v) &= (ALL_INT_EN | SEND_DONE_ISR_FLG))
|
620 |
|
|
#define ${IP}_ack_save_done_isr(v) (${IP}_CTRL_FLAGS_REG(v) &= (ALL_INT_EN | SAVE_DONE_ISR_FLG))
|
621 |
|
|
#define ${IP}_ack_got_pck_isr(v) (${IP}_CTRL_FLAGS_REG(v) &= (ALL_INT_EN | GOT_PCK_ISR_FLG))
|
622 |
|
|
|
623 |
|
|
#define ${IP}_ack_buff_ovf_isr(v) (${IP}_CTRL_FLAGS_REG(v) &= (ALL_INT_EN | BUFF_OVFLOW_ERR_ISR_FLG))
|
624 |
|
|
#define ${IP}_ack_crc_mismatch_isr(v) (${IP}_CTRL_FLAGS_REG(v) &= (ALL_INT_EN | CRC_MISS_MATCH_ISR_FLG))
|
625 |
|
|
#define ${IP}_ack_send_dsize_err_isr(v) (${IP}_CTRL_FLAGS_REG(v) &= (ALL_INT_EN | SEND_DSIZE_ERR_ISR_FLG))
|
626 |
|
|
#define ${IP}_ack_burst_size_err_isr(v) (${IP}_CTRL_FLAGS_REG(v) &= (ALL_INT_EN | BURST_SIZE_ERR_ISR_FLG))
|
627 |
|
|
#define ${IP}_ack_invalid_send_req_isr(v) (${IP}_CTRL_FLAGS_REG(v) &= (ALL_INT_EN | INVALID_SEND_REQ_ISR_FLG))
|
628 |
|
|
|
629 |
|
|
|
630 |
|
|
#define ${IP}_ack_all_isr(v) (${IP}_CTRL_FLAGS_REG(v) = ${IP}_CTRL_FLAGS_REG(v))
|
631 |
|
|
|
632 |
|
|
|
633 |
42 |
alirezamon |
struct SRC_INFOS{
|
634 |
|
|
unsigned char r; // reserved
|
635 |
|
|
unsigned char c; // message class
|
636 |
43 |
alirezamon |
int16_t addr; // phy_addr
|
637 |
42 |
alirezamon |
} ;
|
638 |
|
|
|
639 |
48 |
alirezamon |
static inline struct SRC_INFOS get_src_info(unsigned char v){
|
640 |
|
|
struct SRC_INFOS src_info =*(struct SRC_INFOS *) (&${IP}_RECEIVE_SRC_REG(v));
|
641 |
42 |
alirezamon |
return src_info;
|
642 |
|
|
}
|
643 |
|
|
|
644 |
|
|
/*
|
645 |
|
|
The NI initializing function.
|
646 |
|
|
The burst_size must be <= $MAX_BURST_SIZE
|
647 |
|
|
send_int_en :1: enable the intrrupt when a packet is sent 0 : This intrrupt is disabled
|
648 |
|
|
save_int_en : 1: enable the intrrupt when a recived packet is saved on internal buffer 0 : This intrrupt is disabled
|
649 |
|
|
got_pck_int_en : 1: enable the intrrupt when a packet is recived in NI. 0 : This intrrupt is disabled
|
650 |
|
|
|
651 |
|
|
*/
|
652 |
48 |
alirezamon |
void ${IP}_initial (unsigned int burst_size, unsigned char errors_int_en, unsigned char send_done_int_en, unsigned char save_done_int_en, unsigned char got_pck_int_en) ;
|
653 |
34 |
alirezamon |
|
654 |
42 |
alirezamon |
/*
|
655 |
|
|
The NI message sent function:
|
656 |
48 |
alirezamon |
v: virtual chanel number which this packet should be sent to
|
657 |
42 |
alirezamon |
class_num: message class number. Diffrent message classes can be sent via isolated network resources to avoid protocol deadlock
|
658 |
|
|
data_start_addr : The address pointer to the start location of the packet to be sent in the memory
|
659 |
|
|
data_size: the message data size in words
|
660 |
43 |
alirezamon |
dest_phy_addr: the destination endpoint physical address. check phy_adr.h file for knowing each endpoint physical address
|
661 |
34 |
alirezamon |
|
662 |
42 |
alirezamon |
*/
|
663 |
|
|
|
664 |
48 |
alirezamon |
void ${IP}_transfer (unsigned int init_weight, unsigned int v, unsigned int class_num, unsigned char hdr_data, unsigned int data_start_addr, unsigned int data_size, unsigned int dest_phy_addr);
|
665 |
34 |
alirezamon |
|
666 |
42 |
alirezamon |
/*
|
667 |
|
|
The NI message receiver function:
|
668 |
48 |
alirezamon |
v: virtual chanel number of the received packet
|
669 |
42 |
alirezamon |
data_start_addr : The address pointer to the start location of the memory where the newly arrived packet must be stored by NI in.
|
670 |
|
|
max_buffer_size : The allocated receive-memory buffer size in words.
|
671 |
|
|
*/
|
672 |
|
|
|
673 |
48 |
alirezamon |
void ${IP}_receive (unsigned int v, unsigned int data_start_addr, unsigned int max_buffer_size, unsigned int start_index);',
|
674 |
|
|
'gui_status' => {
|
675 |
|
|
'status' => 'ideal',
|
676 |
|
|
'timeout' => 0
|
677 |
43 |
alirezamon |
},
|
678 |
48 |
alirezamon |
'system_v' => '`define INCLUDE_TOPOLOGY_LOCALPARAM
|
679 |
|
|
`include "topology_localparam.v"',
|
680 |
|
|
'modules' => {
|
681 |
|
|
'ni_master' => {},
|
682 |
|
|
'ovc_status' => {},
|
683 |
|
|
'vc_wb_slave_registers' => {},
|
684 |
|
|
'ni_vc_dma' => {},
|
685 |
|
|
'header_flit_generator' => {}
|
686 |
|
|
},
|
687 |
|
|
'version' => 84,
|
688 |
|
|
'description_pdf' => '/mpsoc/rtl/src_peripheral/ni/NI.pdf',
|
689 |
|
|
'category' => 'NoC',
|
690 |
43 |
alirezamon |
'sockets' => {
|
691 |
|
|
'ni' => {
|
692 |
|
|
'0' => {
|
693 |
|
|
'name' => 'ni'
|
694 |
|
|
},
|
695 |
48 |
alirezamon |
'ni' => {},
|
696 |
|
|
'value' => 1,
|
697 |
|
|
'connection_num' => 'single connection',
|
698 |
43 |
alirezamon |
'type' => 'num'
|
699 |
|
|
}
|
700 |
48 |
alirezamon |
}
|
701 |
38 |
alirezamon |
}, 'ip_gen' );
|