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