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