1 | ///////////////////////////////////////////////////////////////////////// |
---|
2 | // File: top.cpp |
---|
3 | // Author: Alain Greiner |
---|
4 | // Copyright: UPMC/LIP6 |
---|
5 | // Date : may 2013 |
---|
6 | // This program is released under the GNU public license |
---|
7 | ///////////////////////////////////////////////////////////////////////// |
---|
8 | // This file define a generic TSAR architecture. |
---|
9 | // The physical address space is 40 bits. |
---|
10 | // |
---|
11 | // The number of clusters cannot be larger than 256. |
---|
12 | // The number of processors per cluster cannot be larger than 8. |
---|
13 | // |
---|
14 | // - It uses four dspin_local_crossbar per cluster as local interconnect |
---|
15 | // - It uses two virtual_dspin routers per cluster as global interconnect |
---|
16 | // - It uses the vci_cc_vcache_wrapper |
---|
17 | // - It uses the vci_mem_cache |
---|
18 | // - It contains one vci_xicu per cluster. |
---|
19 | // - It contains one vci_multi_dma per cluster. |
---|
20 | // - It contains one vci_simple_ram per cluster to model the L3 cache. |
---|
21 | // |
---|
22 | // The communication between the MemCache and the Xram is 64 bits. |
---|
23 | // |
---|
24 | // All clusters are identical, but the cluster 0 (called io_cluster), |
---|
25 | // contains 6 extra components: |
---|
26 | // - the boot rom (BROM) |
---|
27 | // - the disk controller (BDEV) |
---|
28 | // - the multi-channel network controller (MNIC) |
---|
29 | // - the multi-channel chained buffer dma controller (CDMA) |
---|
30 | // - the multi-channel tty controller (MTTY) |
---|
31 | // - the frame buffer controller (FBUF) |
---|
32 | // |
---|
33 | // It is build with one single component implementing a cluster, |
---|
34 | // defined in files tsar_xbar_cluster.* (with * = cpp, h, sd) |
---|
35 | // |
---|
36 | // The IRQs are connected to XICUs as follow: |
---|
37 | // - The IRQ_IN[0] to IRQ_IN[7] ports are not used in all clusters. |
---|
38 | // - The DMA IRQs are connected to IRQ_IN[8] to IRQ_IN[15] in all clusters. |
---|
39 | // - The TTY IRQs are connected to IRQ_IN[16] to IRQ_IN[30] in I/O cluster. |
---|
40 | // - The BDEV IRQ is connected to IRQ_IN[31] in I/O cluster. |
---|
41 | // |
---|
42 | // Some hardware parameters are used when compiling the OS, and are used |
---|
43 | // by this top.cpp file. They must be defined in the hard_config.h file : |
---|
44 | // - CLUSTER_X : number of clusters in a row (power of 2) |
---|
45 | // - CLUSTER_Y : number of clusters in a column (power of 2) |
---|
46 | // - CLUSTER_SIZE : size of the segment allocated to a cluster |
---|
47 | // - NB_PROCS_MAX : number of processors per cluster (power of 2) |
---|
48 | // - NB_DMA_CHANNELS : number of DMA channels per cluster (< 9) |
---|
49 | // - NB_TTY_CHANNELS : number of TTY channels in I/O cluster (< 16) |
---|
50 | // - NB_NIC_CHANNELS : number of NIC channels in I/O cluster (< 9) |
---|
51 | // |
---|
52 | // Some other hardware parameters are not used when compiling the OS, |
---|
53 | // and can be directly defined in this top.cpp file: |
---|
54 | // - XRAM_LATENCY : external ram latency |
---|
55 | // - MEMC_WAYS : L2 cache number of ways |
---|
56 | // - MEMC_SETS : L2 cache number of sets |
---|
57 | // - L1_IWAYS |
---|
58 | // - L1_ISETS |
---|
59 | // - L1_DWAYS |
---|
60 | // - L1_DSETS |
---|
61 | // - FBUF_X_SIZE : width of frame buffer (pixels) |
---|
62 | // - FBUF_Y_SIZE : heigth of frame buffer (lines) |
---|
63 | // - BDEV_SECTOR_SIZE : block size for block drvice |
---|
64 | // - BDEV_IMAGE_NAME : file pathname for block device |
---|
65 | // - NIC_RX_NAME : file pathname for NIC received packets |
---|
66 | // - NIC_TX_NAME : file pathname for NIC transmited packets |
---|
67 | // - NIC_TIMEOUT : max number of cycles before closing a container |
---|
68 | ///////////////////////////////////////////////////////////////////////// |
---|
69 | // General policy for 40 bits physical address decoding: |
---|
70 | // All physical segments base addresses are multiple of 1 Mbytes |
---|
71 | // (=> the 24 LSB bits = 0, and the 16 MSB bits define the target) |
---|
72 | // The (x_width + y_width) MSB bits (left aligned) define |
---|
73 | // the cluster index, and the LADR bits define the local index: |
---|
74 | // | X_ID | Y_ID |---| LADR | OFFSET | |
---|
75 | // |x_width|y_width|---| 8 | 24 | |
---|
76 | ///////////////////////////////////////////////////////////////////////// |
---|
77 | // General policy for 14 bits SRCID decoding: |
---|
78 | // Each component is identified by (x_id, y_id, l_id) tuple. |
---|
79 | // | X_ID | Y_ID |---| L_ID | |
---|
80 | // |x_width|y_width|---| 6 | |
---|
81 | ///////////////////////////////////////////////////////////////////////// |
---|
82 | |
---|
83 | #include <systemc> |
---|
84 | #include <sys/time.h> |
---|
85 | #include <iostream> |
---|
86 | #include <sstream> |
---|
87 | #include <cstdlib> |
---|
88 | #include <cstdarg> |
---|
89 | #include <stdint.h> |
---|
90 | |
---|
91 | #include "gdbserver.h" |
---|
92 | #include "mapping_table.h" |
---|
93 | #include "tsar_xbar_cluster.h" |
---|
94 | #include "alloc_elems.h" |
---|
95 | |
---|
96 | /////////////////////////////////////////////////// |
---|
97 | // OS |
---|
98 | /////////////////////////////////////////////////// |
---|
99 | |
---|
100 | //#define USE_ALMOS |
---|
101 | #define USE_GIET |
---|
102 | |
---|
103 | #ifdef USE_ALMOS |
---|
104 | #ifdef USE_GIET |
---|
105 | #error "Can't use Two different OS" |
---|
106 | #endif |
---|
107 | #endif |
---|
108 | |
---|
109 | #ifndef USE_ALMOS |
---|
110 | #ifndef USE_GIET |
---|
111 | #error "You need to specify one OS" |
---|
112 | #endif |
---|
113 | #endif |
---|
114 | |
---|
115 | /////////////////////////////////////////////////// |
---|
116 | // Parallelisation |
---|
117 | /////////////////////////////////////////////////// |
---|
118 | #define USE_OPENMP 0 |
---|
119 | |
---|
120 | #if USE_OPENMP |
---|
121 | #include <omp.h> |
---|
122 | #endif |
---|
123 | |
---|
124 | // cluster index (computed from x,y coordinates) |
---|
125 | #define cluster(x,y) (y + YMAX*x) |
---|
126 | |
---|
127 | /////////////////////////////////////////////////////////// |
---|
128 | // DSPIN parameters |
---|
129 | /////////////////////////////////////////////////////////// |
---|
130 | |
---|
131 | #define dspin_cmd_width 39 |
---|
132 | #define dspin_rsp_width 32 |
---|
133 | |
---|
134 | /////////////////////////////////////////////////////////// |
---|
135 | // VCI parameters |
---|
136 | /////////////////////////////////////////////////////////// |
---|
137 | |
---|
138 | #define vci_cell_width_int 4 |
---|
139 | #define vci_cell_width_ext 8 |
---|
140 | |
---|
141 | #define vci_plen_width 8 |
---|
142 | #define vci_address_width 40 |
---|
143 | #define vci_rerror_width 1 |
---|
144 | #define vci_clen_width 1 |
---|
145 | #define vci_rflag_width 1 |
---|
146 | #define vci_srcid_width 14 |
---|
147 | #define vci_pktid_width 4 |
---|
148 | #define vci_trdid_width 4 |
---|
149 | #define vci_wrplen_width 1 |
---|
150 | |
---|
151 | //////////////////////////////////////////////////////////// |
---|
152 | // Main Hardware Parameters values |
---|
153 | //////////////////////i///////////////////////////////////// |
---|
154 | |
---|
155 | #ifdef USE_ALMOS |
---|
156 | #include "almos/hard_config.h" |
---|
157 | #define PREFIX_OS "almos/" |
---|
158 | #endif |
---|
159 | #ifdef USE_GIET |
---|
160 | #include "giet_vm/hard_config.h" |
---|
161 | #define PREFIX_OS "giet_vm/" |
---|
162 | #endif |
---|
163 | |
---|
164 | //////////////////////////////////////////////////////////// |
---|
165 | // Secondary Hardware Parameters |
---|
166 | //////////////////////i///////////////////////////////////// |
---|
167 | |
---|
168 | #define XMAX CLUSTER_X |
---|
169 | #define YMAX CLUSTER_Y |
---|
170 | |
---|
171 | #define XRAM_LATENCY 0 |
---|
172 | |
---|
173 | #define MEMC_WAYS 16 |
---|
174 | #define MEMC_SETS 256 |
---|
175 | |
---|
176 | #define L1_IWAYS 4 |
---|
177 | #define L1_ISETS 64 |
---|
178 | |
---|
179 | #define L1_DWAYS 4 |
---|
180 | #define L1_DSETS 64 |
---|
181 | |
---|
182 | #ifdef USE_ALMOS |
---|
183 | #define FBUF_X_SIZE 512 |
---|
184 | #define FBUF_Y_SIZE 512 |
---|
185 | #endif |
---|
186 | #ifdef USE_GIET |
---|
187 | #define FBUF_X_SIZE 128 |
---|
188 | #define FBUF_Y_SIZE 128 |
---|
189 | #endif |
---|
190 | |
---|
191 | #ifdef USE_GIET |
---|
192 | #define BDEV_SECTOR_SIZE 512 |
---|
193 | #define BDEV_IMAGE_NAME PREFIX_OS"display/images.raw" |
---|
194 | #endif |
---|
195 | #ifdef USE_ALMOS |
---|
196 | #define BDEV_SECTOR_SIZE 4096 |
---|
197 | #define BDEV_IMAGE_NAME PREFIX_OS"hdd-img.bin" |
---|
198 | #endif |
---|
199 | |
---|
200 | #define NIC_RX_NAME PREFIX_OS"nic/rx_packets.txt" |
---|
201 | #define NIC_TX_NAME PREFIX_OS"nic/tx_packets.txt" |
---|
202 | #define NIC_TIMEOUT 10000 |
---|
203 | |
---|
204 | #define NORTH 0 |
---|
205 | #define SOUTH 1 |
---|
206 | #define EAST 2 |
---|
207 | #define WEST 3 |
---|
208 | |
---|
209 | //////////////////////////////////////////////////////////// |
---|
210 | // Software to be loaded in ROM & RAM |
---|
211 | //////////////////////i///////////////////////////////////// |
---|
212 | |
---|
213 | #ifdef USE_ALMOS |
---|
214 | #define soft_name PREFIX_OS"bootloader.bin",\ |
---|
215 | PREFIX_OS"kernel-soclib.bin@0xbfc10000:D",\ |
---|
216 | PREFIX_OS"arch-info.bib@0xBFC08000:D" |
---|
217 | #endif |
---|
218 | #ifdef USE_GIET |
---|
219 | #define soft_pathname PREFIX_OS"soft.elf" |
---|
220 | #endif |
---|
221 | |
---|
222 | //////////////////////////////////////////////////////////// |
---|
223 | // DEBUG Parameters default values |
---|
224 | //////////////////////i///////////////////////////////////// |
---|
225 | |
---|
226 | #define MAX_FROZEN_CYCLES 10000 |
---|
227 | |
---|
228 | ///////////////////////////////////////////////////////// |
---|
229 | // Physical segments definition |
---|
230 | ///////////////////////////////////////////////////////// |
---|
231 | // There is 3 segments replicated in all clusters |
---|
232 | // and 5 specific segments in the "IO" cluster |
---|
233 | // (containing address 0xBF000000) |
---|
234 | ///////////////////////////////////////////////////////// |
---|
235 | |
---|
236 | // specific segments in "IO" cluster : absolute physical address |
---|
237 | |
---|
238 | #define BROM_BASE 0x00BFC00000 |
---|
239 | #define BROM_SIZE 0x0000100000 // 1 Mbytes |
---|
240 | |
---|
241 | #define FBUF_BASE 0x00B2000000 |
---|
242 | #define FBUF_SIZE FBUF_X_SIZE * FBUF_Y_SIZE * 2 |
---|
243 | |
---|
244 | #define BDEV_BASE 0x00B3000000 |
---|
245 | #define BDEV_SIZE 0x0000001000 // 4 Kbytes |
---|
246 | |
---|
247 | #define MTTY_BASE 0x00B4000000 |
---|
248 | #define MTTY_SIZE 0x0000001000 // 4 Kbytes |
---|
249 | |
---|
250 | #define MNIC_BASE 0x00B5000000 |
---|
251 | #define MNIC_SIZE 0x0000080000 // 512 Kbytes (for 8 channels) |
---|
252 | |
---|
253 | #define CDMA_BASE 0x00B6000000 |
---|
254 | #define CDMA_SIZE 0x0000004000 * NB_CMA_CHANNELS |
---|
255 | |
---|
256 | // replicated segments : address is incremented by a cluster offset |
---|
257 | // offset = cluster(x,y) << (address_width-x_width-y_width); |
---|
258 | |
---|
259 | #define MEMC_BASE 0x0000000000 |
---|
260 | #define MEMC_SIZE 0x0010000000 // 256 Mbytes per cluster |
---|
261 | |
---|
262 | #define XICU_BASE 0x00B0000000 |
---|
263 | #define XICU_SIZE 0x0000001000 // 4 Kbytes |
---|
264 | |
---|
265 | #define MDMA_BASE 0x00B1000000 |
---|
266 | #define MDMA_SIZE 0x0000001000 * NB_DMA_CHANNELS // 4 Kbytes per channel |
---|
267 | |
---|
268 | //////////////////////////////////////////////////////////////////// |
---|
269 | // TGTID definition in direct space |
---|
270 | // For all components: global TGTID = global SRCID = cluster_index |
---|
271 | //////////////////////////////////////////////////////////////////// |
---|
272 | |
---|
273 | #define MEMC_TGTID 0 |
---|
274 | #define XICU_TGTID 1 |
---|
275 | #define MDMA_TGTID 2 |
---|
276 | #define MTTY_TGTID 3 |
---|
277 | #define FBUF_TGTID 4 |
---|
278 | #define BDEV_TGTID 5 |
---|
279 | #define MNIC_TGTID 6 |
---|
280 | #define BROM_TGTID 7 |
---|
281 | #define CDMA_TGTID 8 |
---|
282 | |
---|
283 | ///////////////////////////////// |
---|
284 | int _main(int argc, char *argv[]) |
---|
285 | { |
---|
286 | using namespace sc_core; |
---|
287 | using namespace soclib::caba; |
---|
288 | using namespace soclib::common; |
---|
289 | |
---|
290 | #ifdef USE_GIET |
---|
291 | char soft_name[256] = soft_pathname; // pathname to binary code |
---|
292 | #endif |
---|
293 | uint64_t ncycles = 1000000000; // simulated cycles |
---|
294 | char disk_name[256] = BDEV_IMAGE_NAME; // pathname to the disk image |
---|
295 | char nic_rx_name[256] = NIC_RX_NAME; // pathname to the rx packets file |
---|
296 | char nic_tx_name[256] = NIC_TX_NAME; // pathname to the tx packets file |
---|
297 | ssize_t threads_nr = 1; // simulator's threads number |
---|
298 | bool debug_ok = false; // trace activated |
---|
299 | size_t debug_period = 1; // trace period |
---|
300 | size_t debug_memc_id = 0; // index of memc to be traced |
---|
301 | size_t debug_proc_id = 0; // index of proc to be traced |
---|
302 | uint32_t debug_from = 0; // trace start cycle |
---|
303 | uint32_t frozen_cycles = MAX_FROZEN_CYCLES; // monitoring frozen processor |
---|
304 | size_t cluster_io_id = 0; // index of cluster containing IOs |
---|
305 | struct timeval t1,t2; |
---|
306 | uint64_t ms1,ms2; |
---|
307 | |
---|
308 | ////////////// command line arguments ////////////////////// |
---|
309 | if (argc > 1) |
---|
310 | { |
---|
311 | for (int n = 1; n < argc; n = n + 2) |
---|
312 | { |
---|
313 | if ((strcmp(argv[n],"-NCYCLES") == 0) && (n+1<argc)) |
---|
314 | { |
---|
315 | ncycles = atoi(argv[n+1]); |
---|
316 | } |
---|
317 | else if ((strcmp(argv[n],"-SOFT") == 0) && (n+1<argc) ) |
---|
318 | { |
---|
319 | #ifdef USE_ALMOS |
---|
320 | assert( 0 && "Can't define almos soft name" ); |
---|
321 | #endif |
---|
322 | #ifdef USE_GIET |
---|
323 | strcpy(soft_name, argv[n+1]); |
---|
324 | #endif |
---|
325 | } |
---|
326 | else if ((strcmp(argv[n],"-DISK") == 0) && (n+1<argc) ) |
---|
327 | { |
---|
328 | strcpy(disk_name, argv[n+1]); |
---|
329 | } |
---|
330 | else if ((strcmp(argv[n],"-DEBUG") == 0) && (n+1<argc) ) |
---|
331 | { |
---|
332 | debug_ok = true; |
---|
333 | debug_from = atoi(argv[n+1]); |
---|
334 | } |
---|
335 | else if ((strcmp(argv[n],"-MEMCID") == 0) && (n+1<argc) ) |
---|
336 | { |
---|
337 | debug_memc_id = atoi(argv[n+1]); |
---|
338 | assert( (debug_memc_id < (XMAX*YMAX) ) && |
---|
339 | "debug_memc_id larger than XMAX * YMAX" ); |
---|
340 | } |
---|
341 | else if ((strcmp(argv[n],"-PROCID") == 0) && (n+1<argc) ) |
---|
342 | { |
---|
343 | debug_proc_id = atoi(argv[n+1]); |
---|
344 | assert( (debug_proc_id < (XMAX * YMAX * NB_PROCS_MAX) ) && |
---|
345 | "debug_proc_id larger than XMAX * YMAX * NB_PROCS" ); |
---|
346 | } |
---|
347 | else if ((strcmp(argv[n], "-THREADS") == 0) && ((n+1) < argc)) |
---|
348 | { |
---|
349 | threads_nr = atoi(argv[n+1]); |
---|
350 | threads_nr = (threads_nr < 1) ? 1 : threads_nr; |
---|
351 | } |
---|
352 | else if ((strcmp(argv[n], "-FROZEN") == 0) && (n+1 < argc)) |
---|
353 | { |
---|
354 | frozen_cycles = atoi(argv[n+1]); |
---|
355 | } |
---|
356 | else if ((strcmp(argv[n], "-PERIOD") == 0) && (n+1 < argc)) |
---|
357 | { |
---|
358 | debug_period = atoi(argv[n+1]); |
---|
359 | } |
---|
360 | else |
---|
361 | { |
---|
362 | std::cout << " Arguments are (key,value) couples." << std::endl; |
---|
363 | std::cout << " The order is not important." << std::endl; |
---|
364 | std::cout << " Accepted arguments are :" << std::endl << std::endl; |
---|
365 | std::cout << " -SOFT pathname_for_embedded_soft" << std::endl; |
---|
366 | std::cout << " -DISK pathname_for_disk_image" << std::endl; |
---|
367 | std::cout << " -NCYCLES number_of_simulated_cycles" << std::endl; |
---|
368 | std::cout << " -DEBUG debug_start_cycle" << std::endl; |
---|
369 | std::cout << " -THREADS simulator's threads number" << std::endl; |
---|
370 | std::cout << " -FROZEN max_number_of_lines" << std::endl; |
---|
371 | std::cout << " -PERIOD number_of_cycles between trace" << std::endl; |
---|
372 | std::cout << " -MEMCID index_memc_to_be_traced" << std::endl; |
---|
373 | std::cout << " -PROCID index_proc_to_be_traced" << std::endl; |
---|
374 | exit(0); |
---|
375 | } |
---|
376 | } |
---|
377 | } |
---|
378 | |
---|
379 | // checking hardware parameters |
---|
380 | assert( ( (XMAX == 1) or (XMAX == 2) or (XMAX == 4) or |
---|
381 | (XMAX == 8) or (XMAX == 16) ) and |
---|
382 | "The XMAX parameter must be 1, 2, 4, 8 or 16" ); |
---|
383 | |
---|
384 | assert( ( (YMAX == 1) or (YMAX == 2) or (YMAX == 4) or |
---|
385 | (YMAX == 8) or (YMAX == 16) ) and |
---|
386 | "The YMAX parameter must be 1, 2, 4, 8 or 16" ); |
---|
387 | |
---|
388 | assert( ( (NB_PROCS_MAX == 1) or (NB_PROCS_MAX == 2) or |
---|
389 | (NB_PROCS_MAX == 4) or (NB_PROCS_MAX == 8) ) and |
---|
390 | "The NB_PROCS_MAX parameter must be 1, 2, 4 or 8" ); |
---|
391 | |
---|
392 | assert( (NB_DMA_CHANNELS < 9) and |
---|
393 | "The NB_DMA_CHANNELS parameter must be smaller than 9" ); |
---|
394 | |
---|
395 | assert( (NB_TTY_CHANNELS < 15) and |
---|
396 | "The NB_TTY_CHANNELS parameter must be smaller than 15" ); |
---|
397 | |
---|
398 | assert( (NB_NIC_CHANNELS < 9) and |
---|
399 | "The NB_NIC_CHANNELS parameter must be smaller than 9" ); |
---|
400 | |
---|
401 | #ifdef USE_GIET |
---|
402 | assert( (vci_address_width == 40) and |
---|
403 | "VCI address width must be 40 bits" ); |
---|
404 | #endif |
---|
405 | |
---|
406 | std::cout << std::endl; |
---|
407 | std::cout << " - XMAX = " << XMAX << std::endl; |
---|
408 | std::cout << " - YMAX = " << YMAX << std::endl; |
---|
409 | std::cout << " - NB_PROCS_MAX = " << NB_PROCS_MAX << std::endl; |
---|
410 | std::cout << " - NB_DMA_CHANNELS = " << NB_DMA_CHANNELS << std::endl; |
---|
411 | std::cout << " - NB_TTY_CHANNELS = " << NB_TTY_CHANNELS << std::endl; |
---|
412 | std::cout << " - NB_NIC_CHANNELS = " << NB_NIC_CHANNELS << std::endl; |
---|
413 | std::cout << " - MEMC_WAYS = " << MEMC_WAYS << std::endl; |
---|
414 | std::cout << " - MEMC_SETS = " << MEMC_SETS << std::endl; |
---|
415 | std::cout << " - RAM_LATENCY = " << XRAM_LATENCY << std::endl; |
---|
416 | std::cout << " - MAX_FROZEN = " << frozen_cycles << std::endl; |
---|
417 | |
---|
418 | std::cout << std::endl; |
---|
419 | // Internal and External VCI parameters definition |
---|
420 | typedef soclib::caba::VciParams<vci_cell_width_int, |
---|
421 | vci_plen_width, |
---|
422 | vci_address_width, |
---|
423 | vci_rerror_width, |
---|
424 | vci_clen_width, |
---|
425 | vci_rflag_width, |
---|
426 | vci_srcid_width, |
---|
427 | vci_pktid_width, |
---|
428 | vci_trdid_width, |
---|
429 | vci_wrplen_width> vci_param_int; |
---|
430 | |
---|
431 | typedef soclib::caba::VciParams<vci_cell_width_ext, |
---|
432 | vci_plen_width, |
---|
433 | vci_address_width, |
---|
434 | vci_rerror_width, |
---|
435 | vci_clen_width, |
---|
436 | vci_rflag_width, |
---|
437 | vci_srcid_width, |
---|
438 | vci_pktid_width, |
---|
439 | vci_trdid_width, |
---|
440 | vci_wrplen_width> vci_param_ext; |
---|
441 | |
---|
442 | #if USE_OPENMP |
---|
443 | omp_set_dynamic(false); |
---|
444 | omp_set_num_threads(threads_nr); |
---|
445 | std::cerr << "Built with openmp version " << _OPENMP << std::endl; |
---|
446 | #endif |
---|
447 | |
---|
448 | // Define parameters depending on mesh size |
---|
449 | size_t x_width; |
---|
450 | size_t y_width; |
---|
451 | |
---|
452 | if (XMAX == 1) x_width = 0; |
---|
453 | else if (XMAX == 2) x_width = 1; |
---|
454 | else if (XMAX <= 4) x_width = 2; |
---|
455 | else if (XMAX <= 8) x_width = 3; |
---|
456 | else x_width = 4; |
---|
457 | |
---|
458 | if (YMAX == 1) y_width = 0; |
---|
459 | else if (YMAX == 2) y_width = 1; |
---|
460 | else if (YMAX <= 4) y_width = 2; |
---|
461 | else if (YMAX <= 8) y_width = 3; |
---|
462 | else y_width = 4; |
---|
463 | |
---|
464 | ///////////////////// |
---|
465 | // Mapping Tables |
---|
466 | ///////////////////// |
---|
467 | |
---|
468 | // internal network |
---|
469 | MappingTable maptabd(vci_address_width, |
---|
470 | IntTab(x_width + y_width, 16 - x_width - y_width), |
---|
471 | IntTab(x_width + y_width, vci_srcid_width - x_width - y_width), |
---|
472 | 0x00FF000000); |
---|
473 | |
---|
474 | for (size_t x = 0; x < XMAX; x++) |
---|
475 | { |
---|
476 | for (size_t y = 0; y < YMAX; y++) |
---|
477 | { |
---|
478 | sc_uint<vci_address_width> offset; |
---|
479 | offset = (sc_uint<vci_address_width>)cluster(x,y) |
---|
480 | << (vci_address_width-x_width-y_width); |
---|
481 | |
---|
482 | std::ostringstream sh; |
---|
483 | sh << "seg_memc_" << x << "_" << y; |
---|
484 | maptabd.add(Segment(sh.str(), MEMC_BASE+offset, MEMC_SIZE, |
---|
485 | IntTab(cluster(x,y),MEMC_TGTID), true)); |
---|
486 | |
---|
487 | std::ostringstream si; |
---|
488 | si << "seg_xicu_" << x << "_" << y; |
---|
489 | maptabd.add(Segment(si.str(), XICU_BASE+offset, XICU_SIZE, |
---|
490 | IntTab(cluster(x,y),XICU_TGTID), false)); |
---|
491 | |
---|
492 | std::ostringstream sd; |
---|
493 | sd << "seg_mdma_" << x << "_" << y; |
---|
494 | maptabd.add(Segment(sd.str(), MDMA_BASE+offset, MDMA_SIZE, |
---|
495 | IntTab(cluster(x,y),MDMA_TGTID), false)); |
---|
496 | |
---|
497 | if ( cluster(x,y) == cluster_io_id ) |
---|
498 | { |
---|
499 | maptabd.add(Segment("seg_mtty", MTTY_BASE, MTTY_SIZE, |
---|
500 | IntTab(cluster(x,y),MTTY_TGTID), false)); |
---|
501 | maptabd.add(Segment("seg_fbuf", FBUF_BASE, FBUF_SIZE, |
---|
502 | IntTab(cluster(x,y),FBUF_TGTID), false)); |
---|
503 | maptabd.add(Segment("seg_bdev", BDEV_BASE, BDEV_SIZE, |
---|
504 | IntTab(cluster(x,y),BDEV_TGTID), false)); |
---|
505 | maptabd.add(Segment("seg_mnic", MNIC_BASE, MNIC_SIZE, |
---|
506 | IntTab(cluster(x,y),MNIC_TGTID), false)); |
---|
507 | maptabd.add(Segment("seg_cdma", CDMA_BASE, CDMA_SIZE, |
---|
508 | IntTab(cluster(x,y),CDMA_TGTID), false)); |
---|
509 | maptabd.add(Segment("seg_brom", BROM_BASE, BROM_SIZE, |
---|
510 | IntTab(cluster(x,y),BROM_TGTID), true)); |
---|
511 | } |
---|
512 | } |
---|
513 | } |
---|
514 | std::cout << maptabd << std::endl; |
---|
515 | |
---|
516 | // external network |
---|
517 | MappingTable maptabx(vci_address_width, |
---|
518 | IntTab(x_width+y_width), |
---|
519 | IntTab(x_width+y_width), |
---|
520 | 0xFFFF000000ULL); |
---|
521 | |
---|
522 | for (size_t x = 0; x < XMAX; x++) |
---|
523 | { |
---|
524 | for (size_t y = 0; y < YMAX ; y++) |
---|
525 | { |
---|
526 | |
---|
527 | sc_uint<vci_address_width> offset; |
---|
528 | offset = (sc_uint<vci_address_width>)cluster(x,y) |
---|
529 | << (vci_address_width-x_width-y_width); |
---|
530 | |
---|
531 | std::ostringstream sh; |
---|
532 | sh << "x_seg_memc_" << x << "_" << y; |
---|
533 | |
---|
534 | maptabx.add(Segment(sh.str(), MEMC_BASE+offset, |
---|
535 | MEMC_SIZE, IntTab(cluster(x,y)), false)); |
---|
536 | } |
---|
537 | } |
---|
538 | std::cout << maptabx << std::endl; |
---|
539 | |
---|
540 | //////////////////// |
---|
541 | // Signals |
---|
542 | /////////////////// |
---|
543 | |
---|
544 | sc_clock signal_clk("clk"); |
---|
545 | sc_signal<bool> signal_resetn("resetn"); |
---|
546 | |
---|
547 | // Horizontal inter-clusters DSPIN signals |
---|
548 | DspinSignals<dspin_cmd_width>*** signal_dspin_h_cmd_inc = |
---|
549 | alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_inc", XMAX-1, YMAX, 3); |
---|
550 | DspinSignals<dspin_cmd_width>*** signal_dspin_h_cmd_dec = |
---|
551 | alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_dec", XMAX-1, YMAX, 3); |
---|
552 | DspinSignals<dspin_rsp_width>*** signal_dspin_h_rsp_inc = |
---|
553 | alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_rsp_inc", XMAX-1, YMAX, 2); |
---|
554 | DspinSignals<dspin_rsp_width>*** signal_dspin_h_rsp_dec = |
---|
555 | alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_rsp_dec", XMAX-1, YMAX, 2); |
---|
556 | |
---|
557 | // Vertical inter-clusters DSPIN signals |
---|
558 | DspinSignals<dspin_cmd_width>*** signal_dspin_v_cmd_inc = |
---|
559 | alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_inc", XMAX, YMAX-1, 3); |
---|
560 | DspinSignals<dspin_cmd_width>*** signal_dspin_v_cmd_dec = |
---|
561 | alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_dec", XMAX, YMAX-1, 3); |
---|
562 | DspinSignals<dspin_rsp_width>*** signal_dspin_v_rsp_inc = |
---|
563 | alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_rsp_inc", XMAX, YMAX-1, 2); |
---|
564 | DspinSignals<dspin_rsp_width>*** signal_dspin_v_rsp_dec = |
---|
565 | alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_rsp_dec", XMAX, YMAX-1, 2); |
---|
566 | |
---|
567 | // Mesh boundaries DSPIN signals |
---|
568 | DspinSignals<dspin_cmd_width>**** signal_dspin_false_cmd_in = |
---|
569 | alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_false_cmd_in" , XMAX, YMAX, 4, 3); |
---|
570 | DspinSignals<dspin_cmd_width>**** signal_dspin_false_cmd_out = |
---|
571 | alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_false_cmd_out", XMAX, YMAX, 4, 3); |
---|
572 | DspinSignals<dspin_rsp_width>**** signal_dspin_false_rsp_in = |
---|
573 | alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_false_rsp_in" , XMAX, YMAX, 4, 2); |
---|
574 | DspinSignals<dspin_rsp_width>**** signal_dspin_false_rsp_out = |
---|
575 | alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_false_rsp_out", XMAX, YMAX, 4, 2); |
---|
576 | |
---|
577 | |
---|
578 | //////////////////////////// |
---|
579 | // Loader |
---|
580 | //////////////////////////// |
---|
581 | |
---|
582 | soclib::common::Loader loader(soft_name); |
---|
583 | |
---|
584 | typedef soclib::common::GdbServer<soclib::common::Mips32ElIss> proc_iss; |
---|
585 | proc_iss::set_loader(loader); |
---|
586 | |
---|
587 | //////////////////////////// |
---|
588 | // Clusters construction |
---|
589 | //////////////////////////// |
---|
590 | |
---|
591 | TsarXbarCluster<dspin_cmd_width, |
---|
592 | dspin_rsp_width, |
---|
593 | vci_param_int, |
---|
594 | vci_param_ext>* clusters[XMAX][YMAX]; |
---|
595 | |
---|
596 | #if USE_OPENMP |
---|
597 | #pragma omp parallel |
---|
598 | { |
---|
599 | #pragma omp for |
---|
600 | #endif |
---|
601 | for(size_t i = 0; i < (XMAX * YMAX); i++) |
---|
602 | { |
---|
603 | size_t x = i / YMAX; |
---|
604 | size_t y = i % YMAX; |
---|
605 | |
---|
606 | #if USE_OPENMP |
---|
607 | #pragma omp critical |
---|
608 | { |
---|
609 | #endif |
---|
610 | std::cout << std::endl; |
---|
611 | std::cout << "Cluster_" << x << "_" << y << std::endl; |
---|
612 | std::cout << std::endl; |
---|
613 | |
---|
614 | std::ostringstream sc; |
---|
615 | sc << "cluster_" << x << "_" << y; |
---|
616 | clusters[x][y] = new TsarXbarCluster<dspin_cmd_width, |
---|
617 | dspin_rsp_width, |
---|
618 | vci_param_int, |
---|
619 | vci_param_ext> |
---|
620 | ( |
---|
621 | sc.str().c_str(), |
---|
622 | NB_PROCS_MAX, |
---|
623 | NB_TTY_CHANNELS, |
---|
624 | NB_DMA_CHANNELS, |
---|
625 | x, |
---|
626 | y, |
---|
627 | cluster(x,y), |
---|
628 | maptabd, |
---|
629 | maptabx, |
---|
630 | x_width, |
---|
631 | y_width, |
---|
632 | vci_srcid_width - x_width - y_width, // l_id width, |
---|
633 | MEMC_TGTID, |
---|
634 | XICU_TGTID, |
---|
635 | MDMA_TGTID, |
---|
636 | FBUF_TGTID, |
---|
637 | MTTY_TGTID, |
---|
638 | BROM_TGTID, |
---|
639 | MNIC_TGTID, |
---|
640 | CDMA_TGTID, |
---|
641 | BDEV_TGTID, |
---|
642 | MEMC_WAYS, |
---|
643 | MEMC_SETS, |
---|
644 | L1_IWAYS, |
---|
645 | L1_ISETS, |
---|
646 | L1_DWAYS, |
---|
647 | L1_DSETS, |
---|
648 | XRAM_LATENCY, |
---|
649 | (cluster(x,y) == cluster_io_id), |
---|
650 | FBUF_X_SIZE, |
---|
651 | FBUF_Y_SIZE, |
---|
652 | disk_name, |
---|
653 | BDEV_SECTOR_SIZE, |
---|
654 | NB_NIC_CHANNELS, |
---|
655 | nic_rx_name, |
---|
656 | nic_tx_name, |
---|
657 | NIC_TIMEOUT, |
---|
658 | NB_CMA_CHANNELS, |
---|
659 | loader, |
---|
660 | frozen_cycles, |
---|
661 | debug_from , |
---|
662 | debug_ok and (cluster(x,y) == debug_memc_id), |
---|
663 | debug_ok and (cluster(x,y) == debug_proc_id) |
---|
664 | ); |
---|
665 | |
---|
666 | #if USE_OPENMP |
---|
667 | } // end critical |
---|
668 | #endif |
---|
669 | } // end for |
---|
670 | #if USE_OPENMP |
---|
671 | } |
---|
672 | #endif |
---|
673 | |
---|
674 | /////////////////////////////////////////////////////////////// |
---|
675 | // Net-list |
---|
676 | /////////////////////////////////////////////////////////////// |
---|
677 | |
---|
678 | // Clock & RESET |
---|
679 | for (size_t x = 0; x < (XMAX); x++){ |
---|
680 | for (size_t y = 0; y < YMAX; y++){ |
---|
681 | clusters[x][y]->p_clk (signal_clk); |
---|
682 | clusters[x][y]->p_resetn (signal_resetn); |
---|
683 | } |
---|
684 | } |
---|
685 | |
---|
686 | // Inter Clusters horizontal connections |
---|
687 | if (XMAX > 1){ |
---|
688 | for (size_t x = 0; x < (XMAX-1); x++){ |
---|
689 | for (size_t y = 0; y < YMAX; y++){ |
---|
690 | for (size_t k = 0; k < 3; k++){ |
---|
691 | clusters[x][y]->p_cmd_out[EAST][k] (signal_dspin_h_cmd_inc[x][y][k]); |
---|
692 | clusters[x+1][y]->p_cmd_in[WEST][k] (signal_dspin_h_cmd_inc[x][y][k]); |
---|
693 | clusters[x][y]->p_cmd_in[EAST][k] (signal_dspin_h_cmd_dec[x][y][k]); |
---|
694 | clusters[x+1][y]->p_cmd_out[WEST][k] (signal_dspin_h_cmd_dec[x][y][k]); |
---|
695 | } |
---|
696 | |
---|
697 | for (size_t k = 0; k < 2; k++){ |
---|
698 | clusters[x][y]->p_rsp_out[EAST][k] (signal_dspin_h_rsp_inc[x][y][k]); |
---|
699 | clusters[x+1][y]->p_rsp_in[WEST][k] (signal_dspin_h_rsp_inc[x][y][k]); |
---|
700 | clusters[x][y]->p_rsp_in[EAST][k] (signal_dspin_h_rsp_dec[x][y][k]); |
---|
701 | clusters[x+1][y]->p_rsp_out[WEST][k] (signal_dspin_h_rsp_dec[x][y][k]); |
---|
702 | } |
---|
703 | } |
---|
704 | } |
---|
705 | } |
---|
706 | std::cout << std::endl << "Horizontal connections established" << std::endl; |
---|
707 | |
---|
708 | // Inter Clusters vertical connections |
---|
709 | if (YMAX > 1) { |
---|
710 | for (size_t y = 0; y < (YMAX-1); y++){ |
---|
711 | for (size_t x = 0; x < XMAX; x++){ |
---|
712 | for (size_t k = 0; k < 3; k++){ |
---|
713 | clusters[x][y]->p_cmd_out[NORTH][k] (signal_dspin_v_cmd_inc[x][y][k]); |
---|
714 | clusters[x][y+1]->p_cmd_in[SOUTH][k] (signal_dspin_v_cmd_inc[x][y][k]); |
---|
715 | clusters[x][y]->p_cmd_in[NORTH][k] (signal_dspin_v_cmd_dec[x][y][k]); |
---|
716 | clusters[x][y+1]->p_cmd_out[SOUTH][k] (signal_dspin_v_cmd_dec[x][y][k]); |
---|
717 | } |
---|
718 | |
---|
719 | for (size_t k = 0; k < 2; k++){ |
---|
720 | clusters[x][y]->p_rsp_out[NORTH][k] (signal_dspin_v_rsp_inc[x][y][k]); |
---|
721 | clusters[x][y+1]->p_rsp_in[SOUTH][k] (signal_dspin_v_rsp_inc[x][y][k]); |
---|
722 | clusters[x][y]->p_rsp_in[NORTH][k] (signal_dspin_v_rsp_dec[x][y][k]); |
---|
723 | clusters[x][y+1]->p_rsp_out[SOUTH][k] (signal_dspin_v_rsp_dec[x][y][k]); |
---|
724 | } |
---|
725 | } |
---|
726 | } |
---|
727 | } |
---|
728 | std::cout << "Vertical connections established" << std::endl; |
---|
729 | |
---|
730 | // East & West boundary cluster connections |
---|
731 | for (size_t y = 0; y < YMAX; y++) |
---|
732 | { |
---|
733 | for (size_t k = 0; k < 3; k++) |
---|
734 | { |
---|
735 | clusters[0][y]->p_cmd_in[WEST][k] (signal_dspin_false_cmd_in[0][y][WEST][k]); |
---|
736 | clusters[0][y]->p_cmd_out[WEST][k] (signal_dspin_false_cmd_out[0][y][WEST][k]); |
---|
737 | clusters[XMAX-1][y]->p_cmd_in[EAST][k] (signal_dspin_false_cmd_in[XMAX-1][y][EAST][k]); |
---|
738 | clusters[XMAX-1][y]->p_cmd_out[EAST][k] (signal_dspin_false_cmd_out[XMAX-1][y][EAST][k]); |
---|
739 | } |
---|
740 | |
---|
741 | for (size_t k = 0; k < 2; k++) |
---|
742 | { |
---|
743 | clusters[0][y]->p_rsp_in[WEST][k] (signal_dspin_false_rsp_in[0][y][WEST][k]); |
---|
744 | clusters[0][y]->p_rsp_out[WEST][k] (signal_dspin_false_rsp_out[0][y][WEST][k]); |
---|
745 | clusters[XMAX-1][y]->p_rsp_in[EAST][k] (signal_dspin_false_rsp_in[XMAX-1][y][EAST][k]); |
---|
746 | clusters[XMAX-1][y]->p_rsp_out[EAST][k] (signal_dspin_false_rsp_out[XMAX-1][y][EAST][k]); |
---|
747 | } |
---|
748 | } |
---|
749 | |
---|
750 | // North & South boundary clusters connections |
---|
751 | for (size_t x = 0; x < XMAX; x++) |
---|
752 | { |
---|
753 | for (size_t k = 0; k < 3; k++) |
---|
754 | { |
---|
755 | clusters[x][0]->p_cmd_in[SOUTH][k] (signal_dspin_false_cmd_in[x][0][SOUTH][k]); |
---|
756 | clusters[x][0]->p_cmd_out[SOUTH][k] (signal_dspin_false_cmd_out[x][0][SOUTH][k]); |
---|
757 | clusters[x][YMAX-1]->p_cmd_in[NORTH][k] (signal_dspin_false_cmd_in[x][YMAX-1][NORTH][k]); |
---|
758 | clusters[x][YMAX-1]->p_cmd_out[NORTH][k] (signal_dspin_false_cmd_out[x][YMAX-1][NORTH][k]); |
---|
759 | } |
---|
760 | |
---|
761 | for (size_t k = 0; k < 2; k++) |
---|
762 | { |
---|
763 | clusters[x][0]->p_rsp_in[SOUTH][k] (signal_dspin_false_rsp_in[x][0][SOUTH][k]); |
---|
764 | clusters[x][0]->p_rsp_out[SOUTH][k] (signal_dspin_false_rsp_out[x][0][SOUTH][k]); |
---|
765 | clusters[x][YMAX-1]->p_rsp_in[NORTH][k] (signal_dspin_false_rsp_in[x][YMAX-1][NORTH][k]); |
---|
766 | clusters[x][YMAX-1]->p_rsp_out[NORTH][k] (signal_dspin_false_rsp_out[x][YMAX-1][NORTH][k]); |
---|
767 | } |
---|
768 | } |
---|
769 | std::cout << "North, South, West, East connections established" << std::endl; |
---|
770 | std::cout << std::endl; |
---|
771 | |
---|
772 | |
---|
773 | //////////////////////////////////////////////////////// |
---|
774 | // Simulation |
---|
775 | /////////////////////////////////////////////////////// |
---|
776 | |
---|
777 | sc_start(sc_core::sc_time(0, SC_NS)); |
---|
778 | signal_resetn = false; |
---|
779 | |
---|
780 | // network boundaries signals |
---|
781 | for (size_t x = 0; x < XMAX ; x++){ |
---|
782 | for (size_t y = 0; y < YMAX ; y++){ |
---|
783 | for (size_t a = 0; a < 4; a++){ |
---|
784 | for (size_t k = 0; k < 3; k++){ |
---|
785 | signal_dspin_false_cmd_in [x][y][a][k].write = false; |
---|
786 | signal_dspin_false_cmd_in [x][y][a][k].read = true; |
---|
787 | signal_dspin_false_cmd_out[x][y][a][k].write = false; |
---|
788 | signal_dspin_false_cmd_out[x][y][a][k].read = true; |
---|
789 | } |
---|
790 | |
---|
791 | for (size_t k = 0; k < 2; k++){ |
---|
792 | signal_dspin_false_rsp_in [x][y][a][k].write = false; |
---|
793 | signal_dspin_false_rsp_in [x][y][a][k].read = true; |
---|
794 | signal_dspin_false_rsp_out[x][y][a][k].write = false; |
---|
795 | signal_dspin_false_rsp_out[x][y][a][k].read = true; |
---|
796 | } |
---|
797 | } |
---|
798 | } |
---|
799 | } |
---|
800 | |
---|
801 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
802 | signal_resetn = true; |
---|
803 | |
---|
804 | if (gettimeofday(&t1, NULL) != 0) |
---|
805 | { |
---|
806 | perror("gettimeofday"); |
---|
807 | return EXIT_FAILURE; |
---|
808 | } |
---|
809 | |
---|
810 | for (uint64_t n = 1; n < ncycles; n++) |
---|
811 | { |
---|
812 | // Monitor a specific address for L1 & L2 caches |
---|
813 | //clusters[0][0]->proc[0]->cache_monitor(0x800002c000ULL); |
---|
814 | //clusters[1][0]->memc->copies_monitor(0x800002C000ULL); |
---|
815 | |
---|
816 | if( (n % 5000000) == 0) |
---|
817 | { |
---|
818 | |
---|
819 | if (gettimeofday(&t2, NULL) != 0) |
---|
820 | { |
---|
821 | perror("gettimeofday"); |
---|
822 | return EXIT_FAILURE; |
---|
823 | } |
---|
824 | |
---|
825 | ms1 = (uint64_t)t1.tv_sec * 1000ULL + (uint64_t)t1.tv_usec / 1000; |
---|
826 | ms2 = (uint64_t)t2.tv_sec * 1000ULL + (uint64_t)t2.tv_usec / 1000; |
---|
827 | std::cerr << "platform clock frequency " << (double)5000000 / (double)(ms2 - ms1) << "Khz" << std::endl; |
---|
828 | |
---|
829 | if (gettimeofday(&t1, NULL) != 0) |
---|
830 | { |
---|
831 | perror("gettimeofday"); |
---|
832 | return EXIT_FAILURE; |
---|
833 | } |
---|
834 | } |
---|
835 | |
---|
836 | if (debug_ok and (n > debug_from) and (n % debug_period == 0)) |
---|
837 | { |
---|
838 | std::cout << "****************** cycle " << std::dec << n ; |
---|
839 | std::cout << " ************************************************" << std::endl; |
---|
840 | |
---|
841 | // trace proc[debug_proc_id] |
---|
842 | size_t l = debug_proc_id % NB_PROCS_MAX ; |
---|
843 | size_t y = (debug_proc_id / NB_PROCS_MAX) % YMAX ; |
---|
844 | size_t x = debug_proc_id / (YMAX * NB_PROCS_MAX) ; |
---|
845 | |
---|
846 | std::ostringstream proc_signame; |
---|
847 | proc_signame << "[SIG]PROC_" << x << "_" << y << "_" << l ; |
---|
848 | std::ostringstream p2m_signame; |
---|
849 | p2m_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " P2M" ; |
---|
850 | std::ostringstream m2p_signame; |
---|
851 | m2p_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " M2P" ; |
---|
852 | std::ostringstream p_cmd_signame; |
---|
853 | p_cmd_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " CMD" ; |
---|
854 | std::ostringstream p_rsp_signame; |
---|
855 | p_rsp_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " RSP" ; |
---|
856 | |
---|
857 | clusters[x][y]->proc[l]->print_trace(); |
---|
858 | clusters[x][y]->wi_proc[l]->print_trace(); |
---|
859 | clusters[x][y]->signal_vci_ini_proc[l].print_trace(proc_signame.str()); |
---|
860 | clusters[x][y]->signal_dspin_p2m_proc[l].print_trace(p2m_signame.str()); |
---|
861 | clusters[x][y]->signal_dspin_m2p_proc[l].print_trace(m2p_signame.str()); |
---|
862 | clusters[x][y]->signal_dspin_cmd_proc_i[l].print_trace(p_cmd_signame.str()); |
---|
863 | clusters[x][y]->signal_dspin_rsp_proc_i[l].print_trace(p_rsp_signame.str()); |
---|
864 | |
---|
865 | clusters[x][y]->xbar_rsp_d->print_trace(); |
---|
866 | clusters[x][y]->xbar_cmd_d->print_trace(); |
---|
867 | clusters[x][y]->signal_dspin_cmd_l2g_d.print_trace("[SIG]L2G CMD"); |
---|
868 | clusters[x][y]->signal_dspin_cmd_g2l_d.print_trace("[SIG]G2L CMD"); |
---|
869 | clusters[x][y]->signal_dspin_rsp_l2g_d.print_trace("[SIG]L2G RSP"); |
---|
870 | clusters[x][y]->signal_dspin_rsp_g2l_d.print_trace("[SIG]G2L RSP"); |
---|
871 | |
---|
872 | // trace memc[debug_memc_id] |
---|
873 | x = debug_memc_id / YMAX; |
---|
874 | y = debug_memc_id % YMAX; |
---|
875 | |
---|
876 | std::ostringstream smemc; |
---|
877 | smemc << "[SIG]MEMC_" << x << "_" << y; |
---|
878 | std::ostringstream sxram; |
---|
879 | sxram << "[SIG]XRAM_" << x << "_" << y; |
---|
880 | std::ostringstream sm2p; |
---|
881 | sm2p << "[SIG]MEMC_" << x << "_" << y << " M2P" ; |
---|
882 | std::ostringstream sp2m; |
---|
883 | sp2m << "[SIG]MEMC_" << x << "_" << y << " P2M" ; |
---|
884 | std::ostringstream m_cmd_signame; |
---|
885 | m_cmd_signame << "[SIG]MEMC_" << x << "_" << y << " CMD" ; |
---|
886 | std::ostringstream m_rsp_signame; |
---|
887 | m_rsp_signame << "[SIG]MEMC_" << x << "_" << y << " RSP" ; |
---|
888 | |
---|
889 | clusters[x][y]->memc->print_trace(); |
---|
890 | clusters[x][y]->wt_memc->print_trace(); |
---|
891 | clusters[x][y]->signal_vci_tgt_memc.print_trace(smemc.str()); |
---|
892 | clusters[x][y]->signal_vci_xram.print_trace(sxram.str()); |
---|
893 | clusters[x][y]->signal_dspin_p2m_memc.print_trace(sp2m.str()); |
---|
894 | clusters[x][y]->signal_dspin_m2p_memc.print_trace(sm2p.str()); |
---|
895 | clusters[x][y]->signal_dspin_cmd_memc_t.print_trace(m_cmd_signame.str()); |
---|
896 | clusters[x][y]->signal_dspin_rsp_memc_t.print_trace(m_rsp_signame.str()); |
---|
897 | |
---|
898 | // trace replicated peripherals |
---|
899 | // clusters[1][1]->mdma->print_trace(); |
---|
900 | // clusters[1][1]->signal_vci_tgt_mdma.print_trace("[SIG]MDMA_TGT_1_1"); |
---|
901 | // clusters[1][1]->signal_vci_ini_mdma.print_trace("[SIG]MDMA_INI_1_1"); |
---|
902 | |
---|
903 | |
---|
904 | // trace external peripherals |
---|
905 | size_t io_x = cluster_io_id / YMAX; |
---|
906 | size_t io_y = cluster_io_id % YMAX; |
---|
907 | |
---|
908 | clusters[io_x][io_y]->brom->print_trace(); |
---|
909 | clusters[io_x][io_y]->wt_brom->print_trace(); |
---|
910 | clusters[io_x][io_y]->signal_vci_tgt_brom.print_trace("[SIG]BROM"); |
---|
911 | clusters[io_x][io_y]->signal_dspin_cmd_brom_t.print_trace("[SIG]BROM CMD"); |
---|
912 | clusters[io_x][io_y]->signal_dspin_rsp_brom_t.print_trace("[SIG]BROM RSP"); |
---|
913 | |
---|
914 | // clusters[io_x][io_y]->bdev->print_trace(); |
---|
915 | // clusters[io_x][io_y]->signal_vci_tgt_bdev.print_trace("[SIG]BDEV_TGT"); |
---|
916 | // clusters[io_x][io_y]->signal_vci_ini_bdev.print_trace("[SIG]BDEV_INI"); |
---|
917 | } |
---|
918 | |
---|
919 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
920 | } |
---|
921 | return EXIT_SUCCESS; |
---|
922 | } |
---|
923 | |
---|
924 | int sc_main (int argc, char *argv[]) |
---|
925 | { |
---|
926 | try { |
---|
927 | return _main(argc, argv); |
---|
928 | } catch (std::exception &e) { |
---|
929 | std::cout << e.what() << std::endl; |
---|
930 | } catch (...) { |
---|
931 | std::cout << "Unknown exception occured" << std::endl; |
---|
932 | throw; |
---|
933 | } |
---|
934 | return 1; |
---|
935 | } |
---|
936 | |
---|
937 | |
---|
938 | // Local Variables: |
---|
939 | // tab-width: 3 |
---|
940 | // c-basic-offset: 3 |
---|
941 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
942 | // indent-tabs-mode: nil |
---|
943 | // End: |
---|
944 | |
---|
945 | // vim: filetype=cpp:expandtab:shiftwidth=3:tabstop=3:softtabstop=3 |
---|