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