[189] | 1 | ///////////////////////////////////////////////////////////////////////// |
---|
| 2 | // File: top.cpp |
---|
| 3 | // Author: Alain Greiner |
---|
| 4 | // Copyright: UPMC/LIP6 |
---|
[255] | 5 | // Date : august 2012 |
---|
[189] | 6 | // This program is released under the GNU public license |
---|
| 7 | ///////////////////////////////////////////////////////////////////////// |
---|
| 8 | // This file define a generic TSAR architecture with virtual memory. |
---|
[263] | 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 | // |
---|
[189] | 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 |
---|
[255] | 17 | // - It contains one vci_xicu and one vci_multi_dma per cluster. |
---|
| 18 | // |
---|
[263] | 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 | // |
---|
[189] | 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 | // |
---|
[255] | 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 | // |
---|
[263] | 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 |
---|
[189] | 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 | /////////////////////////////////////////////////// |
---|
[249] | 85 | // OS |
---|
[189] | 86 | /////////////////////////////////////////////////// |
---|
[247] | 87 | #define USE_ALMOS 0 |
---|
[189] | 88 | |
---|
[257] | 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 | |
---|
[189] | 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) |
---|
[263] | 103 | #define cluster(x,y) (y + CLUSTER_Y*x) |
---|
[189] | 104 | |
---|
| 105 | // flit widths for the DSPIN network |
---|
[249] | 106 | #define cmd_width 40 |
---|
| 107 | #define rsp_width 33 |
---|
[189] | 108 | |
---|
| 109 | // VCI format |
---|
[249] | 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 |
---|
[189] | 120 | |
---|
[263] | 121 | //////////////////////////////////////////////////////////// |
---|
| 122 | // Main Hardware Parameters values |
---|
| 123 | //////////////////////i///////////////////////////////////// |
---|
[189] | 124 | |
---|
[263] | 125 | #include "/Users/alain/Documents/licence/almo_svn_2011/soft/giet_vm/hard_config.h" |
---|
[189] | 126 | |
---|
[263] | 127 | //////////////////////////////////////////////////////////// |
---|
| 128 | // Secondary Hardware Parameters values |
---|
| 129 | //////////////////////i///////////////////////////////////// |
---|
[189] | 130 | |
---|
[255] | 131 | #define XRAM_LATENCY 0 |
---|
[189] | 132 | |
---|
[255] | 133 | #define MEMC_WAYS 16 |
---|
| 134 | #define MEMC_SETS 256 |
---|
[189] | 135 | |
---|
[255] | 136 | #define L1_IWAYS 4 |
---|
| 137 | #define L1_ISETS 64 |
---|
[189] | 138 | |
---|
[255] | 139 | #define L1_DWAYS 4 |
---|
| 140 | #define L1_DSETS 64 |
---|
[189] | 141 | |
---|
[255] | 142 | #define FBUF_X_SIZE 128 |
---|
| 143 | #define FBUF_Y_SIZE 128 |
---|
[189] | 144 | |
---|
[255] | 145 | #define BDEV_SECTOR_SIZE 512 |
---|
[263] | 146 | #define BDEV_IMAGE_NAME "/Users/alain/Documents/licence/almo_svn_2011/soft/giet_vm/display/images.raw" |
---|
[189] | 147 | |
---|
[263] | 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 |
---|
[189] | 151 | |
---|
[263] | 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 | |
---|
[255] | 162 | #define MAX_FROZEN_CYCLES 10000 |
---|
| 163 | |
---|
| 164 | #define TRACE_MEMC_ID 1000000 |
---|
| 165 | #define TRACE_PROC_ID 1000000 |
---|
| 166 | |
---|
[189] | 167 | ///////////////////////////////////////////////////////// |
---|
[249] | 168 | // Physical segments definition |
---|
[189] | 169 | ///////////////////////////////////////////////////////// |
---|
[263] | 170 | // There is 3 segments replicated in all clusters |
---|
| 171 | // and 5 specific segments in the "IO" cluster |
---|
[189] | 172 | // (containing address 0xBF000000) |
---|
[263] | 173 | ///////////////////////////////////////////////////////// |
---|
[189] | 174 | |
---|
[255] | 175 | // specific segments in "IO" cluster : absolute physical address |
---|
[189] | 176 | |
---|
| 177 | #define BROM_BASE 0xBFC00000 |
---|
[263] | 178 | #define BROM_SIZE 0x00100000 // 1 Mbytes |
---|
[189] | 179 | |
---|
[263] | 180 | #define FBUF_BASE 0xBFD00000 |
---|
| 181 | #define FBUF_SIZE 0x00200000 // 2 Mbytes |
---|
[189] | 182 | |
---|
[263] | 183 | #define BDEV_BASE 0xBFF10000 |
---|
| 184 | #define BDEV_SIZE 0x00001000 // 4 Kbytes |
---|
[189] | 185 | |
---|
[263] | 186 | #define MTTY_BASE 0xBFF20000 |
---|
| 187 | #define MTTY_SIZE 0x00001000 // 4 Kbytes |
---|
[189] | 188 | |
---|
[263] | 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 |
---|
[255] | 193 | // offset = cluster(x,y) << (address_width-x_width-y_width); |
---|
[189] | 194 | |
---|
| 195 | #define MEMC_BASE 0x00000000 |
---|
[263] | 196 | #define MEMC_SIZE 0x00C00000 // 12 Mbytes |
---|
[189] | 197 | |
---|
| 198 | #define XICU_BASE 0x00F00000 |
---|
[263] | 199 | #define XICU_SIZE 0x00001000 // 4 Kbytes |
---|
[189] | 200 | |
---|
| 201 | #define CDMA_BASE 0x00F30000 |
---|
[263] | 202 | #define CDMA_SIZE 0x00001000 * NB_DMAS_MAX // 4 Kbytes per channel |
---|
[189] | 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 |
---|
[263] | 216 | #define MNIC_TGTID 7 |
---|
[189] | 217 | |
---|
| 218 | ///////////////////////////////// |
---|
| 219 | int _main(int argc, char *argv[]) |
---|
| 220 | { |
---|
[249] | 221 | using namespace sc_core; |
---|
| 222 | using namespace soclib::caba; |
---|
| 223 | using namespace soclib::common; |
---|
[189] | 224 | |
---|
| 225 | |
---|
[263] | 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 |
---|
[189] | 238 | |
---|
[249] | 239 | ////////////// command line arguments ////////////////////// |
---|
[255] | 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 | { |
---|
[249] | 246 | ncycles = atoi(argv[n+1]); |
---|
| 247 | } |
---|
[255] | 248 | else if ((strcmp(argv[n],"-SOFT") == 0) && (n+1<argc) ) |
---|
| 249 | { |
---|
[249] | 250 | strcpy(soft_name, argv[n+1]); |
---|
| 251 | } |
---|
[255] | 252 | else if ((strcmp(argv[n],"-DISK") == 0) && (n+1<argc) ) |
---|
| 253 | { |
---|
[249] | 254 | strcpy(disk_name, argv[n+1]); |
---|
| 255 | } |
---|
[263] | 256 | else if ((strcmp(argv[n],"-DEBUG") == 0) && (n+1<argc) ) |
---|
[257] | 257 | { |
---|
[255] | 258 | debug_ok = true; |
---|
| 259 | debug_from = atoi(argv[n+1]); |
---|
[249] | 260 | } |
---|
[255] | 261 | else if ((strcmp(argv[n],"-MEMCID") == 0) && (n+1<argc) ) |
---|
| 262 | { |
---|
| 263 | debug_memc_id = atoi(argv[n+1]); |
---|
[263] | 264 | assert( (debug_memc_id < (CLUSTER_X*CLUSTER_Y) ) && |
---|
[255] | 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]); |
---|
[263] | 270 | assert( (debug_proc_id < (CLUSTER_X * CLUSTER_Y * NB_PROCS_MAX) ) && |
---|
| 271 | "debug_proc_id larger than XMAX * YMAX * NB_PROCS" ); |
---|
[255] | 272 | } |
---|
[257] | 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 | } |
---|
[255] | 278 | else if ((strcmp(argv[n], "-FROZEN") == 0) && (n+1 < argc)) |
---|
| 279 | { |
---|
[249] | 280 | frozen_cycles = atoi(argv[n+1]); |
---|
| 281 | } |
---|
[255] | 282 | else if ((strcmp(argv[n], "-PERIOD") == 0) && (n+1 < argc)) |
---|
| 283 | { |
---|
| 284 | debug_period = atoi(argv[n+1]); |
---|
[249] | 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; |
---|
[263] | 294 | std::cout << " -DEBUG debug_start_cycle" << std::endl; |
---|
[257] | 295 | std::cout << " -THREADS simulator's threads number" << std::endl; |
---|
[249] | 296 | std::cout << " -FROZEN max_number_of_lines" << std::endl; |
---|
| 297 | std::cout << " -PERIOD number_of_cycles between trace" << std::endl; |
---|
[255] | 298 | std::cout << " -MEMCID index_memc_to_be_traced" << std::endl; |
---|
| 299 | std::cout << " -PROCID index_proc_to_be_traced" << std::endl; |
---|
[249] | 300 | exit(0); |
---|
| 301 | } |
---|
| 302 | } |
---|
| 303 | } |
---|
| 304 | |
---|
[263] | 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 | |
---|
[249] | 327 | std::cout << std::endl; |
---|
[263] | 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; |
---|
[249] | 338 | |
---|
| 339 | std::cout << std::endl; |
---|
| 340 | |
---|
[189] | 341 | #if USE_OPENMP |
---|
[249] | 342 | omp_set_dynamic(false); |
---|
| 343 | omp_set_num_threads(threads_nr); |
---|
| 344 | std::cerr << "Built with openmp version " << _OPENMP << std::endl; |
---|
[189] | 345 | #endif |
---|
| 346 | |
---|
[249] | 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; |
---|
[189] | 358 | |
---|
[255] | 359 | // Define parameters depending on mesh size |
---|
| 360 | size_t cluster_io_id; |
---|
[249] | 361 | size_t x_width; |
---|
| 362 | size_t y_width; |
---|
[189] | 363 | |
---|
[263] | 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; |
---|
[189] | 369 | |
---|
[263] | 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; |
---|
[189] | 375 | |
---|
[255] | 376 | cluster_io_id = 0xBF >> (8 - x_width - y_width); |
---|
[189] | 377 | |
---|
[249] | 378 | ///////////////////// |
---|
| 379 | // Mapping Tables |
---|
| 380 | ///////////////////// |
---|
[189] | 381 | |
---|
[249] | 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); |
---|
[189] | 387 | |
---|
[263] | 388 | for (size_t x = 0; x < CLUSTER_X; x++) |
---|
[255] | 389 | { |
---|
[263] | 390 | for (size_t y = 0; y < CLUSTER_Y; y++) |
---|
[255] | 391 | { |
---|
[249] | 392 | sc_uint<address_width> offset = cluster(x,y) << (address_width-x_width-y_width); |
---|
[189] | 393 | |
---|
[249] | 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)); |
---|
[189] | 397 | |
---|
[249] | 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)); |
---|
[189] | 401 | |
---|
[249] | 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)); |
---|
[189] | 405 | |
---|
[255] | 406 | if ( cluster(x,y) == cluster_io_id ) |
---|
[249] | 407 | { |
---|
[255] | 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)); |
---|
[263] | 411 | maptabd.add(Segment("d_seg_mnic", MNIC_BASE, MNIC_SIZE, IntTab(cluster(x,y),MNIC_TGTID), false)); |
---|
[255] | 412 | maptabd.add(Segment("d_seg_brom", BROM_BASE, BROM_SIZE, IntTab(cluster(x,y),BROM_TGTID), true)); |
---|
[249] | 413 | } |
---|
| 414 | } |
---|
| 415 | } |
---|
| 416 | std::cout << maptabd << std::endl; |
---|
[189] | 417 | |
---|
[249] | 418 | // coherence network |
---|
| 419 | // - tgtid_c_proc = srcid_c_proc = local procid |
---|
[263] | 420 | // - tgtid_c_memc = srcid_c_memc = NB_PROCS_MAX |
---|
[249] | 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); |
---|
[189] | 425 | |
---|
[263] | 426 | for (size_t x = 0; x < CLUSTER_X; x++) |
---|
[255] | 427 | { |
---|
[263] | 428 | for (size_t y = 0; y < CLUSTER_Y; y++) |
---|
[255] | 429 | { |
---|
[249] | 430 | sc_uint<address_width> offset = cluster(x,y) << (address_width-x_width-y_width); |
---|
[189] | 431 | |
---|
[255] | 432 | // cleanup requests must be routed to the memory cache |
---|
[249] | 433 | std::ostringstream sh; |
---|
| 434 | sh << "c_seg_memc_" << x << "_" << y; |
---|
[263] | 435 | maptabc.add(Segment(sh.str(), (NB_PROCS_MAX << (address_width - srcid_width)) + offset, |
---|
| 436 | 0x10, IntTab(cluster(x,y), NB_PROCS_MAX), false)); |
---|
[189] | 437 | |
---|
[249] | 438 | // update & invalidate requests must be routed to the proper processor |
---|
[263] | 439 | for ( size_t p = 0 ; p < NB_PROCS_MAX ; p++) |
---|
[255] | 440 | { |
---|
[249] | 441 | std::ostringstream sp; |
---|
| 442 | sp << "c_seg_proc_" << x << "_" << y << "_" << p; |
---|
[255] | 443 | maptabc.add( Segment( sp.str() , (p << (address_width - srcid_width)) + offset , |
---|
| 444 | 0x10 , IntTab(cluster(x,y), p) , false)); |
---|
[249] | 445 | } |
---|
| 446 | } |
---|
| 447 | } |
---|
| 448 | std::cout << maptabc << std::endl; |
---|
[189] | 449 | |
---|
[249] | 450 | // external network |
---|
| 451 | MappingTable maptabx(address_width, IntTab(1), IntTab(x_width+y_width), 0xF0000000); |
---|
[189] | 452 | |
---|
[263] | 453 | for (size_t x = 0; x < CLUSTER_X; x++) |
---|
[255] | 454 | { |
---|
[263] | 455 | for (size_t y = 0; y < CLUSTER_Y ; y++) |
---|
[255] | 456 | { |
---|
[249] | 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; |
---|
[255] | 460 | maptabx.add(Segment(sh.str(), MEMC_BASE+offset, |
---|
| 461 | MEMC_SIZE, IntTab(cluster(x,y)), false)); |
---|
[249] | 462 | } |
---|
| 463 | } |
---|
| 464 | std::cout << maptabx << std::endl; |
---|
[189] | 465 | |
---|
[249] | 466 | //////////////////// |
---|
| 467 | // Signals |
---|
| 468 | /////////////////// |
---|
[189] | 469 | |
---|
[249] | 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 = |
---|
[263] | 475 | alloc_elems<DspinSignals<cmd_width> >("signal_dspin_h_cmd_inc", CLUSTER_X-1, CLUSTER_Y, 2); |
---|
[249] | 476 | DspinSignals<cmd_width>*** signal_dspin_h_cmd_dec = |
---|
[263] | 477 | alloc_elems<DspinSignals<cmd_width> >("signal_dspin_h_cmd_dec", CLUSTER_X-1, CLUSTER_Y, 2); |
---|
[249] | 478 | DspinSignals<rsp_width>*** signal_dspin_h_rsp_inc = |
---|
[263] | 479 | alloc_elems<DspinSignals<rsp_width> >("signal_dspin_h_rsp_inc", CLUSTER_X-1, CLUSTER_Y, 2); |
---|
[249] | 480 | DspinSignals<rsp_width>*** signal_dspin_h_rsp_dec = |
---|
[263] | 481 | alloc_elems<DspinSignals<rsp_width> >("signal_dspin_h_rsp_dec", CLUSTER_X-1, CLUSTER_Y, 2); |
---|
[189] | 482 | |
---|
[249] | 483 | // Vertical inter-clusters DSPIN signals |
---|
| 484 | DspinSignals<cmd_width>*** signal_dspin_v_cmd_inc = |
---|
[263] | 485 | alloc_elems<DspinSignals<cmd_width> >("signal_dspin_v_cmd_inc", CLUSTER_X, CLUSTER_Y-1, 2); |
---|
[249] | 486 | DspinSignals<cmd_width>*** signal_dspin_v_cmd_dec = |
---|
[263] | 487 | alloc_elems<DspinSignals<cmd_width> >("signal_dspin_v_cmd_dec", CLUSTER_X, CLUSTER_Y-1, 2); |
---|
[249] | 488 | DspinSignals<rsp_width>*** signal_dspin_v_rsp_inc = |
---|
[263] | 489 | alloc_elems<DspinSignals<rsp_width> >("signal_dspin_v_rsp_inc", CLUSTER_X, CLUSTER_Y-1, 2); |
---|
[249] | 490 | DspinSignals<rsp_width>*** signal_dspin_v_rsp_dec = |
---|
[263] | 491 | alloc_elems<DspinSignals<rsp_width> >("signal_dspin_v_rsp_dec", CLUSTER_X, CLUSTER_Y-1, 2); |
---|
[189] | 492 | |
---|
[249] | 493 | // Mesh boundaries DSPIN signals |
---|
| 494 | DspinSignals<cmd_width>**** signal_dspin_false_cmd_in = |
---|
[263] | 495 | alloc_elems<DspinSignals<cmd_width> >("signal_dspin_false_cmd_in", CLUSTER_X, CLUSTER_Y, 2, 4); |
---|
[249] | 496 | DspinSignals<cmd_width>**** signal_dspin_false_cmd_out = |
---|
[263] | 497 | alloc_elems<DspinSignals<cmd_width> >("signal_dspin_false_cmd_out", CLUSTER_X, CLUSTER_Y, 2, 4); |
---|
[249] | 498 | DspinSignals<rsp_width>**** signal_dspin_false_rsp_in = |
---|
[263] | 499 | alloc_elems<DspinSignals<rsp_width> >("signal_dspin_false_rsp_in", CLUSTER_X, CLUSTER_Y, 2, 4); |
---|
[249] | 500 | DspinSignals<rsp_width>**** signal_dspin_false_rsp_out = |
---|
[263] | 501 | alloc_elems<DspinSignals<rsp_width> >("signal_dspin_false_rsp_out", CLUSTER_X, CLUSTER_Y, 2, 4); |
---|
[189] | 502 | |
---|
| 503 | |
---|
[249] | 504 | //////////////////////////// |
---|
[263] | 505 | // Loader |
---|
[249] | 506 | //////////////////////////// |
---|
[189] | 507 | |
---|
| 508 | #if USE_ALMOS |
---|
[249] | 509 | soclib::common::Loader loader(almos_bootloader_pathname, |
---|
[263] | 510 | almos_archinfo_pathname, |
---|
| 511 | almos_kernel_pathname); |
---|
[189] | 512 | #else |
---|
[249] | 513 | soclib::common::Loader loader(soft_name); |
---|
[189] | 514 | #endif |
---|
| 515 | |
---|
[249] | 516 | typedef soclib::common::GdbServer<soclib::common::Mips32ElIss> proc_iss; |
---|
| 517 | proc_iss::set_loader(loader); |
---|
[189] | 518 | |
---|
[263] | 519 | //////////////////////////// |
---|
| 520 | // Clusters construction |
---|
| 521 | //////////////////////////// |
---|
[189] | 522 | |
---|
[263] | 523 | TsarV4ClusterMmu<vci_param, proc_iss, cmd_width, rsp_width>* clusters[CLUSTER_X][CLUSTER_Y]; |
---|
| 524 | |
---|
[189] | 525 | #if USE_OPENMP |
---|
| 526 | #pragma omp parallel |
---|
[263] | 527 | { |
---|
[189] | 528 | #pragma omp for |
---|
[263] | 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 |
---|
[255] | 536 | #pragma omp critical |
---|
[263] | 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 | ); |
---|
[189] | 585 | |
---|
[263] | 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 |
---|
[255] | 594 | |
---|
[249] | 595 | /////////////////////////////////////////////////////////////// |
---|
| 596 | // Net-list |
---|
| 597 | /////////////////////////////////////////////////////////////// |
---|
[189] | 598 | |
---|
[249] | 599 | // Clock & RESET |
---|
[263] | 600 | for (size_t x = 0; x < (CLUSTER_X); x++){ |
---|
| 601 | for (size_t y = 0; y < CLUSTER_Y; y++){ |
---|
[249] | 602 | clusters[x][y]->p_clk (signal_clk); |
---|
| 603 | clusters[x][y]->p_resetn (signal_resetn); |
---|
| 604 | } |
---|
| 605 | } |
---|
| 606 | |
---|
| 607 | // Inter Clusters horizontal connections |
---|
[263] | 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++){ |
---|
[249] | 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]); |
---|
[189] | 620 | } |
---|
[249] | 621 | } |
---|
| 622 | } |
---|
| 623 | } |
---|
[263] | 624 | std::cout << std::endl << "Horizontal connections established" << std::endl; |
---|
[189] | 625 | |
---|
[249] | 626 | // Inter Clusters vertical connections |
---|
[263] | 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++){ |
---|
[249] | 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]); |
---|
[189] | 639 | } |
---|
[249] | 640 | } |
---|
| 641 | } |
---|
| 642 | } |
---|
| 643 | std::cout << "Vertical connections established" << std::endl; |
---|
[189] | 644 | |
---|
[249] | 645 | // East & West boundary cluster connections |
---|
[263] | 646 | for (size_t y = 0; y < CLUSTER_Y; y++) |
---|
[255] | 647 | { |
---|
| 648 | for (size_t k = 0; k < 2; k++) |
---|
| 649 | { |
---|
[249] | 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]); |
---|
[189] | 654 | |
---|
[263] | 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]); |
---|
[249] | 659 | } |
---|
| 660 | } |
---|
[189] | 661 | |
---|
[249] | 662 | // North & South boundary clusters connections |
---|
[263] | 663 | for (size_t x = 0; x < CLUSTER_X; x++) |
---|
[255] | 664 | { |
---|
| 665 | for (size_t k = 0; k < 2; k++) |
---|
| 666 | { |
---|
[249] | 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]); |
---|
[189] | 671 | |
---|
[263] | 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]); |
---|
[249] | 676 | } |
---|
| 677 | } |
---|
[189] | 678 | |
---|
[249] | 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 |
---|
[263] | 688 | for (size_t x = 0; x < CLUSTER_X ; x++){ |
---|
| 689 | for (size_t y = 0; y < CLUSTER_Y ; y++){ |
---|
[249] | 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; |
---|
[189] | 701 | } |
---|
[249] | 702 | } |
---|
| 703 | } |
---|
| 704 | } |
---|
[189] | 705 | |
---|
[249] | 706 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
| 707 | signal_resetn = true; |
---|
[189] | 708 | |
---|
[255] | 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 | { |
---|
[249] | 714 | std::cout << "****************** cycle " << std::dec << n ; |
---|
| 715 | std::cout << " ************************************************" << std::endl; |
---|
[189] | 716 | |
---|
[255] | 717 | // trace proc[debug_proc_id] |
---|
[263] | 718 | if ( debug_proc_id < (CLUSTER_X * CLUSTER_Y * NB_PROCS_MAX) ) |
---|
[255] | 719 | { |
---|
[263] | 720 | size_t proc_x = debug_proc_id / CLUSTER_Y; |
---|
| 721 | size_t proc_y = debug_proc_id % CLUSTER_Y; |
---|
[189] | 722 | |
---|
[255] | 723 | clusters[proc_x][proc_y]->proc[0]->print_trace(); |
---|
[189] | 724 | |
---|
[255] | 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 | } |
---|
[189] | 729 | |
---|
[255] | 730 | // trace memc[debug_memc_id] |
---|
[263] | 731 | if ( debug_memc_id < (CLUSTER_X * CLUSTER_Y) ) |
---|
[255] | 732 | { |
---|
[263] | 733 | size_t memc_x = debug_memc_id / CLUSTER_Y; |
---|
| 734 | size_t memc_y = debug_memc_id % CLUSTER_Y; |
---|
[189] | 735 | |
---|
[255] | 736 | clusters[memc_x][memc_y]->memc->print_trace(); |
---|
[189] | 737 | |
---|
[255] | 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 | } |
---|
[189] | 742 | |
---|
[263] | 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"); |
---|
[249] | 747 | |
---|
[263] | 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; |
---|
[255] | 752 | |
---|
[263] | 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 "); |
---|
[255] | 759 | |
---|
[263] | 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 | |
---|
[249] | 764 | } |
---|
| 765 | |
---|
| 766 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
| 767 | } |
---|
| 768 | return EXIT_SUCCESS; |
---|
[189] | 769 | } |
---|
| 770 | |
---|
| 771 | int sc_main (int argc, char *argv[]) |
---|
| 772 | { |
---|
[249] | 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; |
---|
[189] | 782 | } |
---|
[249] | 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 | |
---|