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