| 1 | /////////////////////////////////////////////////////////////////////////////// | 
|---|
| 2 | // File: top.cpp  (for tsar_generic_iob platform) | 
|---|
| 3 | // Author: Alain Greiner | 
|---|
| 4 | // Copyright: UPMC/LIP6 | 
|---|
| 5 | // Date : august 2013 | 
|---|
| 6 | // This program is released under the GNU public license | 
|---|
| 7 | // | 
|---|
| 8 | // Modified by: Cesar Fuguet | 
|---|
| 9 | /////////////////////////////////////////////////////////////////////////////// | 
|---|
| 10 | // This file define a generic TSAR architecture with an IO network emulating | 
|---|
| 11 | // an external bus (i.e. Hypertransport) to access 7 external peripherals: | 
|---|
| 12 | // | 
|---|
| 13 | // - FBUF : Frame Buffer | 
|---|
| 14 | // - MTTY : multi TTY (one channel) | 
|---|
| 15 | // - MNIC : Network controller (up to 2 channels) | 
|---|
| 16 | // - CDMA : Chained Buffer DMA controller (up to 4 channels) | 
|---|
| 17 | // - BDEV : Dlock Device controler (one channel) | 
|---|
| 18 | // - IOPI : HWI to SWI translator. | 
|---|
| 19 | // - SIMH : Simulation Helper | 
|---|
| 20 | // | 
|---|
| 21 | // The internal physical address space is 40 bits, and the cluster index | 
|---|
| 22 | // is defined by the 8 MSB bits, using a fixed format: X is encoded on 4 bits, | 
|---|
| 23 | // Y is encodes on 4 bits, whatever the actual mesh size. | 
|---|
| 24 | // => at most 16 * 16 clusters. Each cluster contains up to 4 processors. | 
|---|
| 25 | // | 
|---|
| 26 | // It contains 3 networks: | 
|---|
| 27 | // | 
|---|
| 28 | // 1) the "INT" network supports Read/Write transactions | 
|---|
| 29 | //    between processors and L2 caches or peripherals. | 
|---|
| 30 | //    (VCI ADDDRESS = 40 bits / VCI DATA width = 32 bits) | 
|---|
| 31 | //    It supports also coherence transactions between L1 & L2 caches. | 
|---|
| 32 | // 3) the "RAM" network emulates the 3D network between L2 caches | 
|---|
| 33 | //    and L3 caches, and is implemented as a 2D mesh between the L2 caches, | 
|---|
| 34 | //    the two IO bridges and the physical RAMs disributed in all clusters. | 
|---|
| 35 | //    (VCI ADDRESS = 40 bits / VCI DATA = 64 bits) | 
|---|
| 36 | // 4) the IOX network connects the two IO bridge components to the | 
|---|
| 37 | //    7 external peripheral controllers. | 
|---|
| 38 | //    (VCI ADDDRESS = 40 bits / VCI DATA width = 64 bits) | 
|---|
| 39 | // | 
|---|
| 40 | // The external peripherals HWI IRQs are translated to WTI IRQs by the | 
|---|
| 41 | // external IOPIC component, that must be configured by the OS to route | 
|---|
| 42 | // these WTI IRQS to one or several internal XICU components. | 
|---|
| 43 | // - IOPIC HWI[1:0]     connected to IRQ_NIC_RX[1:0] | 
|---|
| 44 | // - IOPIC HWI[3:2]     connected to IRQ_NIC_TX[1:0] | 
|---|
| 45 | // - IOPIC HWI[7:4]     connected to IRQ_CMA_TX[3:0]] | 
|---|
| 46 | // - IOPIC HWI[8]       connected to IRQ_BDEV | 
|---|
| 47 | // - IOPIC HWI[31:16]   connected to IRQ_TTY_RX[15:0] | 
|---|
| 48 | // | 
|---|
| 49 | // Besides the external peripherals, each cluster contains one XICU component, | 
|---|
| 50 | // and one multi channels DMA component. | 
|---|
| 51 | // The XICU component is mainly used to handle WTI IRQs, as only 5 HWI IRQs | 
|---|
| 52 | // are connected to XICU in each cluster: | 
|---|
| 53 | // - IRQ_IN[0] : MMC | 
|---|
| 54 | // - IRQ_IN[1] : DMA channel 0 | 
|---|
| 55 | // - IRQ_IN[2] : DMA channel 1 | 
|---|
| 56 | // - IRQ_IN[3] : DMA channel 2 | 
|---|
| 57 | // - IRQ_IN[4] : DMA channel 3 | 
|---|
| 58 | // | 
|---|
| 59 | // All clusters are identical, but cluster(0, 0) and cluster(X_SIZE-1, Y_SIZE-1) | 
|---|
| 60 | // contain an extra IO bridge component. These IOB0 & IOB1 components are | 
|---|
| 61 | // connected to the three networks (INT, RAM, IOX). | 
|---|
| 62 | // | 
|---|
| 63 | // - It uses two dspin_local_crossbar per cluster to implement the | 
|---|
| 64 | //   local interconnect correponding to the INT network. | 
|---|
| 65 | // - It uses three dspin_local_crossbar per cluster to implement the | 
|---|
| 66 | //   local interconnect correponding to the coherence INT network. | 
|---|
| 67 | // - It uses two virtual_dspin_router per cluster to implement | 
|---|
| 68 | //   the INT network (routing both the direct and coherence trafic). | 
|---|
| 69 | // - It uses two dspin_router per cluster to implement the RAM network. | 
|---|
| 70 | // - It uses the vci_cc_vcache_wrapper. | 
|---|
| 71 | // - It uses the vci_mem_cache. | 
|---|
| 72 | // - It contains one vci_xicu and one vci_multi_dma per cluster. | 
|---|
| 73 | // - It contains one vci_simple ram per cluster to model the L3 cache. | 
|---|
| 74 | // | 
|---|
| 75 | // The TsarIobCluster component is defined in files | 
|---|
| 76 | // tsar_iob_cluster.* (with * = cpp, h, sd) | 
|---|
| 77 | // | 
|---|
| 78 | // The main hardware parameters must be defined in the hard_config.h file : | 
|---|
| 79 | // - X_SIZE           : number of clusters in a row | 
|---|
| 80 | // - Y_SIZE           : number of clusters in a column | 
|---|
| 81 | // - NB_PROCS_MAX     : number of processors per cluster (power of 2) | 
|---|
| 82 | // - NB_TTY_CHANNELS  : number of TTY channels in I/O network (up to 16) | 
|---|
| 83 | // - NB_NIC_CHANNELS  : number of NIC channels in I/O network (up to 2) | 
|---|
| 84 | // - NB_CMA_CHANNELS  : number of CMA channels in I/O network (up to 4) | 
|---|
| 85 | // - FBUF_X_SIZE      : width of frame buffer (pixels) | 
|---|
| 86 | // - FBUF_Y_SIZE      : heigth of frame buffer (lines) | 
|---|
| 87 | // - XCU_NB_INPUTS    : number of HWIs = number of WTIs = number of PTIs | 
|---|
| 88 | // | 
|---|
| 89 | // Some secondary hardware parameters must be defined in this top.cpp file: | 
|---|
| 90 | // - XRAM_LATENCY     : external ram latency | 
|---|
| 91 | // - MEMC_WAYS        : L2 cache number of ways | 
|---|
| 92 | // - MEMC_SETS        : L2 cache number of sets | 
|---|
| 93 | // - L1_IWAYS | 
|---|
| 94 | // - L1_ISETS | 
|---|
| 95 | // - L1_DWAYS | 
|---|
| 96 | // - L1_DSETS | 
|---|
| 97 | // - BDEV_IMAGE_NAME  : file pathname for block device | 
|---|
| 98 | // - NIC_TIMEOUT      : max number of cycles before closing a container | 
|---|
| 99 | // | 
|---|
| 100 | // General policy for 40 bits physical address decoding: | 
|---|
| 101 | // All physical segments base addresses are multiple of 1 Mbytes | 
|---|
| 102 | // (=> the 24 LSB bits = 0, and the 16 MSB bits define the target) | 
|---|
| 103 | // The (X_WIDTH + Y_WIDTH) MSB bits (left aligned) define | 
|---|
| 104 | // the cluster index, and the LADR bits define the local index: | 
|---|
| 105 | //      |X_ID|Y_ID|  LADR  |     OFFSET          | | 
|---|
| 106 | //      |  4 |  4 |   8    |       24            | | 
|---|
| 107 | // | 
|---|
| 108 | // General policy for 14 bits SRCID decoding: | 
|---|
| 109 | // Each component is identified by (x_id, y_id, l_id) tuple. | 
|---|
| 110 | //      |X_ID|Y_ID| L_ID | | 
|---|
| 111 | //      |  4 |  4 |  6   | | 
|---|
| 112 | ///////////////////////////////////////////////////////////////////////// | 
|---|
| 113 |  | 
|---|
| 114 | #include <systemc> | 
|---|
| 115 | #include <sys/time.h> | 
|---|
| 116 | #include <iostream> | 
|---|
| 117 | #include <sstream> | 
|---|
| 118 | #include <cstdlib> | 
|---|
| 119 | #include <cstdarg> | 
|---|
| 120 | #include <climits> | 
|---|
| 121 | #include <stdint.h> | 
|---|
| 122 | #include <vector> | 
|---|
| 123 |  | 
|---|
| 124 | #include "gdbserver.h" | 
|---|
| 125 | #include "mapping_table.h" | 
|---|
| 126 |  | 
|---|
| 127 | #include "tsar_iob_cluster.h" | 
|---|
| 128 | #include "vci_chbuf_dma.h" | 
|---|
| 129 | #include "vci_multi_tty.h" | 
|---|
| 130 | #include "vci_multi_nic.h" | 
|---|
| 131 | #include "vci_simple_rom.h" | 
|---|
| 132 | #include "vci_block_device_tsar.h" | 
|---|
| 133 | #include "vci_framebuffer.h" | 
|---|
| 134 | #include "vci_iox_network.h" | 
|---|
| 135 | #include "vci_iopic.h" | 
|---|
| 136 | #include "vci_simhelper.h" | 
|---|
| 137 |  | 
|---|
| 138 | #include "alloc_elems.h" | 
|---|
| 139 |  | 
|---|
| 140 | /////////////////////////////////////////////////// | 
|---|
| 141 | //      OS | 
|---|
| 142 | /////////////////////////////////////////////////// | 
|---|
| 143 | #define USE_ALMOS 0 | 
|---|
| 144 |  | 
|---|
| 145 | #define almos_bootloader_pathname "bootloader.bin" | 
|---|
| 146 | #define almos_kernel_pathname     "kernel-soclib.bin@0xbfc10000:D" | 
|---|
| 147 | #define almos_archinfo_pathname   "arch-info.bin@0xBFC08000:D" | 
|---|
| 148 |  | 
|---|
| 149 | /////////////////////////////////////////////////// | 
|---|
| 150 | //               Parallelisation | 
|---|
| 151 | /////////////////////////////////////////////////// | 
|---|
| 152 | #if USE_OPENMP | 
|---|
| 153 | #include <omp.h> | 
|---|
| 154 | #endif | 
|---|
| 155 |  | 
|---|
| 156 | /////////////////////////////////////////////////////////// | 
|---|
| 157 | //          DSPIN parameters | 
|---|
| 158 | /////////////////////////////////////////////////////////// | 
|---|
| 159 |  | 
|---|
| 160 | #define dspin_int_cmd_width   39 | 
|---|
| 161 | #define dspin_int_rsp_width   32 | 
|---|
| 162 |  | 
|---|
| 163 | #define dspin_ram_cmd_width   64 | 
|---|
| 164 | #define dspin_ram_rsp_width   64 | 
|---|
| 165 |  | 
|---|
| 166 | /////////////////////////////////////////////////////////// | 
|---|
| 167 | //         VCI fields width  for the 3 VCI networks | 
|---|
| 168 | /////////////////////////////////////////////////////////// | 
|---|
| 169 |  | 
|---|
| 170 | #define vci_cell_width_int    4 | 
|---|
| 171 | #define vci_cell_width_ext    8 | 
|---|
| 172 |  | 
|---|
| 173 | #define vci_plen_width        8 | 
|---|
| 174 | #define vci_address_width     40 | 
|---|
| 175 | #define vci_rerror_width      1 | 
|---|
| 176 | #define vci_clen_width        1 | 
|---|
| 177 | #define vci_rflag_width       1 | 
|---|
| 178 | #define vci_srcid_width       14 | 
|---|
| 179 | #define vci_pktid_width       4 | 
|---|
| 180 | #define vci_trdid_width       4 | 
|---|
| 181 | #define vci_wrplen_width      1 | 
|---|
| 182 |  | 
|---|
| 183 | //////////////////////////////////////////////////////////// | 
|---|
| 184 | //    Main Hardware Parameters values | 
|---|
| 185 | //////////////////////i///////////////////////////////////// | 
|---|
| 186 |  | 
|---|
| 187 | #include "hard_config.h" | 
|---|
| 188 |  | 
|---|
| 189 | //////////////////////////////////////////////////////////// | 
|---|
| 190 | //    Secondary Hardware Parameters values | 
|---|
| 191 | //////////////////////i///////////////////////////////////// | 
|---|
| 192 |  | 
|---|
| 193 | #define XRAM_LATENCY          0 | 
|---|
| 194 |  | 
|---|
| 195 | #define MEMC_WAYS             16 | 
|---|
| 196 | #define MEMC_SETS             256 | 
|---|
| 197 |  | 
|---|
| 198 | #define L1_IWAYS              4 | 
|---|
| 199 | #define L1_ISETS              64 | 
|---|
| 200 |  | 
|---|
| 201 | #define L1_DWAYS              4 | 
|---|
| 202 | #define L1_DSETS              64 | 
|---|
| 203 |  | 
|---|
| 204 | #define BDEV_IMAGE_NAME       "../../../giet_vm/hdd/virt_hdd.dmg" | 
|---|
| 205 |  | 
|---|
| 206 | #define NIC_TIMEOUT           10000 | 
|---|
| 207 |  | 
|---|
| 208 | #define NORTH                 0 | 
|---|
| 209 | #define SOUTH                 1 | 
|---|
| 210 | #define EAST                  2 | 
|---|
| 211 | #define WEST                  3 | 
|---|
| 212 |  | 
|---|
| 213 | #define cluster(x, y)   ((y) + ((x) << Y_WIDTH)) | 
|---|
| 214 |  | 
|---|
| 215 | //////////////////////////////////////////////////////////// | 
|---|
| 216 | //     DEBUG Parameters default values | 
|---|
| 217 | //////////////////////i///////////////////////////////////// | 
|---|
| 218 |  | 
|---|
| 219 | #define MAX_FROZEN_CYCLES     200000 | 
|---|
| 220 |  | 
|---|
| 221 | ///////////////////////////////////////////////////////// | 
|---|
| 222 | //    Physical segments definition | 
|---|
| 223 | ///////////////////////////////////////////////////////// | 
|---|
| 224 |  | 
|---|
| 225 | // All physical segments base addresses and sizes are defined | 
|---|
| 226 | // in the hard_config.h file. For replicated segments, the | 
|---|
| 227 | // base address is incremented by a cluster offset: | 
|---|
| 228 | // offset  = cluster(x, y) << (address_width-X_WIDTH-Y_WIDTH); | 
|---|
| 229 |  | 
|---|
| 230 | //////////////////////////////////////////////////////////////////////// | 
|---|
| 231 | //          SRCID definition | 
|---|
| 232 | //////////////////////////////////////////////////////////////////////// | 
|---|
| 233 | // All initiators are in the same indexing space (14 bits). | 
|---|
| 234 | // The SRCID is structured in two fields: | 
|---|
| 235 | // - The 8 MSB bits define the cluster index (left aligned) | 
|---|
| 236 | // - The 6 LSB bits define the local index. | 
|---|
| 237 | // Two different initiators cannot have the same SRCID, but a given | 
|---|
| 238 | // initiator can have two alias SRCIDs: | 
|---|
| 239 | // - Internal initiators (procs, mdma) are replicated in all clusters, | 
|---|
| 240 | //   and each initiator has one single SRCID. | 
|---|
| 241 | // - External initiators (bdev, cdma) are not replicated, but can be | 
|---|
| 242 | //   accessed in 2 clusters : cluster_iob0 and cluster_iob1. | 
|---|
| 243 | //   They have the same local index, but two different cluster indexes. | 
|---|
| 244 | // | 
|---|
| 245 | // As cluster_iob0 and cluster_iob1 contain both internal initiators | 
|---|
| 246 | // and external initiators, they must have different local indexes. | 
|---|
| 247 | // Consequence: For a local interconnect, the INI_ID port index | 
|---|
| 248 | // is NOT equal to the SRCID local index, and the local interconnect | 
|---|
| 249 | // must make a translation: SRCID => INI_ID | 
|---|
| 250 | //////////////////////////////////////////////////////////////////////// | 
|---|
| 251 |  | 
|---|
| 252 | #define PROC_LOCAL_SRCID             0x0    // from 0 to 7 | 
|---|
| 253 | #define MDMA_LOCAL_SRCID             0x8 | 
|---|
| 254 | #define IOBX_LOCAL_SRCID             0x9 | 
|---|
| 255 | #define MEMC_LOCAL_SRCID             0xA | 
|---|
| 256 | #define CDMA_LOCAL_SRCID             0xB | 
|---|
| 257 | #define BDEV_LOCAL_SRCID             0xC | 
|---|
| 258 | #define IOPI_LOCAL_SRCID             0xD | 
|---|
| 259 |  | 
|---|
| 260 | /////////////////////////////////////////////////////////////////////// | 
|---|
| 261 | //     TGT_ID and INI_ID port indexing for INT local interconnect | 
|---|
| 262 | /////////////////////////////////////////////////////////////////////// | 
|---|
| 263 |  | 
|---|
| 264 | #define INT_MEMC_TGT_ID              0 | 
|---|
| 265 | #define INT_XICU_TGT_ID              1 | 
|---|
| 266 | #define INT_MDMA_TGT_ID              2 | 
|---|
| 267 | #define INT_DROM_TGT_ID              3 | 
|---|
| 268 | #define INT_IOBX_TGT_ID              4 | 
|---|
| 269 |  | 
|---|
| 270 | #define INT_PROC_INI_ID              0   // from 0 to (NB_PROCS_MAX-1) | 
|---|
| 271 | #define INT_MDMA_INI_ID              (NB_PROCS_MAX) | 
|---|
| 272 | #define INT_IOBX_INI_ID              (NB_PROCS_MAX+1) | 
|---|
| 273 |  | 
|---|
| 274 | /////////////////////////////////////////////////////////////////////// | 
|---|
| 275 | //     TGT_ID and INI_ID port indexing for RAM local interconnect | 
|---|
| 276 | /////////////////////////////////////////////////////////////////////// | 
|---|
| 277 |  | 
|---|
| 278 | #define RAM_XRAM_TGT_ID              0 | 
|---|
| 279 |  | 
|---|
| 280 | #define RAM_MEMC_INI_ID              0 | 
|---|
| 281 | #define RAM_IOBX_INI_ID              1 | 
|---|
| 282 |  | 
|---|
| 283 | /////////////////////////////////////////////////////////////////////// | 
|---|
| 284 | //     TGT_ID and INI_ID port indexing for I0X local interconnect | 
|---|
| 285 | /////////////////////////////////////////////////////////////////////// | 
|---|
| 286 |  | 
|---|
| 287 | #define IOX_FBUF_TGT_ID              0 | 
|---|
| 288 | #define IOX_BDEV_TGT_ID              1 | 
|---|
| 289 | #define IOX_MNIC_TGT_ID              2 | 
|---|
| 290 | #define IOX_CDMA_TGT_ID              3 | 
|---|
| 291 | #define IOX_MTTY_TGT_ID              4 | 
|---|
| 292 | #define IOX_IOPI_TGT_ID              5 | 
|---|
| 293 | #define IOX_SIMH_TGT_ID              6 | 
|---|
| 294 | #define IOX_ROM_TGT_ID               7 | 
|---|
| 295 | #define IOX_IOB0_TGT_ID              8 | 
|---|
| 296 | #define IOX_IOB1_TGT_ID              9 | 
|---|
| 297 |  | 
|---|
| 298 | #define IOX_BDEV_INI_ID              0 | 
|---|
| 299 | #define IOX_CDMA_INI_ID              1 | 
|---|
| 300 | #define IOX_IOPI_INI_ID              2 | 
|---|
| 301 | #define IOX_IOB0_INI_ID              3 | 
|---|
| 302 | #define IOX_IOB1_INI_ID              4 | 
|---|
| 303 |  | 
|---|
| 304 | //////////////////////////////////////////////////////////////////////// | 
|---|
| 305 | int _main(int argc, char *argv[]) | 
|---|
| 306 | //////////////////////////////////////////////////////////////////////// | 
|---|
| 307 | { | 
|---|
| 308 | using namespace sc_core; | 
|---|
| 309 | using namespace soclib::caba; | 
|---|
| 310 | using namespace soclib::common; | 
|---|
| 311 |  | 
|---|
| 312 |  | 
|---|
| 313 | char     dsoft_name[256]  = "";                // pathname: binary code | 
|---|
| 314 | char     soft_name[256]   = "";                // pathname: binary code | 
|---|
| 315 | size_t   ncycles          = UINT_MAX;          // simulated cycles | 
|---|
| 316 | char     disk_name[256]   = BDEV_IMAGE_NAME;   // pathname: disk image | 
|---|
| 317 | ssize_t  threads_nr       = 1;                 // simulator's threads number | 
|---|
| 318 | size_t   faulty_mask      = 0x1F;              // interface mask for the faulty router | 
|---|
| 319 | bool     debug_ok         = false;             // trace activated | 
|---|
| 320 | size_t   debug_period     = 1;                 // trace period | 
|---|
| 321 | size_t   debug_memc_id    = 0xFFFFFFFF;        // index of traced memc | 
|---|
| 322 | size_t   debug_proc_id    = 0xFFFFFFFF;        // index of traced proc | 
|---|
| 323 | size_t   debug_xram_id    = 0xFFFFFFFF;        // index of traced xram | 
|---|
| 324 | bool     debug_iob        = false;             // trace iob0 & iob1 when true | 
|---|
| 325 | uint32_t debug_from       = 0;                 // trace start cycle | 
|---|
| 326 | uint32_t frozen_cycles    = MAX_FROZEN_CYCLES; // monitoring frozen processor | 
|---|
| 327 |  | 
|---|
| 328 | std::vector<size_t> faulty_routers; | 
|---|
| 329 |  | 
|---|
| 330 | assert( (X_WIDTH == 4) and (Y_WIDTH == 4) and | 
|---|
| 331 | "ERROR: we must have X_WIDTH == Y_WIDTH == 4"); | 
|---|
| 332 |  | 
|---|
| 333 | ////////////// command line arguments ////////////////////// | 
|---|
| 334 | if (argc > 1) | 
|---|
| 335 | { | 
|---|
| 336 | for (int n = 1; n < argc; n = n + 2) | 
|---|
| 337 | { | 
|---|
| 338 | if ((strcmp(argv[n], "-NCYCLES") == 0) && (n+1<argc)) | 
|---|
| 339 | { | 
|---|
| 340 | ncycles = strtol(argv[n+1], NULL, 0); | 
|---|
| 341 | } | 
|---|
| 342 | else if ((strcmp(argv[n], "-SOFT") == 0) && (n+1<argc) ) | 
|---|
| 343 | { | 
|---|
| 344 | strcpy(soft_name, argv[n+1]); | 
|---|
| 345 | } | 
|---|
| 346 | else if ((strcmp(argv[n], "-DSOFT") == 0) && (n+1<argc) ) | 
|---|
| 347 | { | 
|---|
| 348 | strcpy(dsoft_name, argv[n+1]); | 
|---|
| 349 | } | 
|---|
| 350 | else if ((strcmp(argv[n], "-DEBUG") == 0) && (n+1<argc) ) | 
|---|
| 351 | { | 
|---|
| 352 | debug_ok = true; | 
|---|
| 353 | debug_from = strtol(argv[n+1], NULL, 0); | 
|---|
| 354 | } | 
|---|
| 355 | else if ((strcmp(argv[n], "-DISK") == 0) && (n+1<argc) ) | 
|---|
| 356 | { | 
|---|
| 357 | strcpy(disk_name, argv[n+1]); | 
|---|
| 358 | } | 
|---|
| 359 | else if ((strcmp(argv[n], "-MEMCID") == 0) && (n+1<argc) ) | 
|---|
| 360 | { | 
|---|
| 361 | debug_memc_id = strtol(argv[n+1], NULL, 0); | 
|---|
| 362 | size_t x = debug_memc_id >> Y_WIDTH; | 
|---|
| 363 | size_t y = debug_memc_id & ((1 << Y_WIDTH) - 1); | 
|---|
| 364 | if( (x>=X_SIZE) || (y>=Y_SIZE) ) | 
|---|
| 365 | { | 
|---|
| 366 | std::cout << "MEMCID parameter does'nt fit X_SIZE/Y_SIZE" << std::endl; | 
|---|
| 367 | exit(0); | 
|---|
| 368 | } | 
|---|
| 369 | } | 
|---|
| 370 | else if ((strcmp(argv[n], "-XRAMID") == 0) && (n+1<argc) ) | 
|---|
| 371 | { | 
|---|
| 372 | debug_xram_id = strtol(argv[n+1], NULL, 0); | 
|---|
| 373 | size_t x = debug_xram_id >> Y_WIDTH; | 
|---|
| 374 | size_t y = debug_xram_id & ((1 << Y_WIDTH) - 1); | 
|---|
| 375 | if( (x>=X_SIZE) || (y>=Y_SIZE) ) | 
|---|
| 376 | { | 
|---|
| 377 | std::cout << "XRAMID parameter does'nt fit X_SIZE/Y_SIZE" << std::endl; | 
|---|
| 378 | exit(0); | 
|---|
| 379 | } | 
|---|
| 380 | } | 
|---|
| 381 | else if ((strcmp(argv[n], "-IOB") == 0) && (n+1<argc) ) | 
|---|
| 382 | { | 
|---|
| 383 | debug_iob = strtol(argv[n+1], NULL, 0); | 
|---|
| 384 | } | 
|---|
| 385 | else if ((strcmp(argv[n], "-PROCID") == 0) && (n+1<argc) ) | 
|---|
| 386 | { | 
|---|
| 387 | debug_proc_id     = strtol(argv[n+1], NULL, 0); | 
|---|
| 388 | size_t cluster_xy = debug_proc_id >> P_WIDTH; | 
|---|
| 389 | size_t x          = cluster_xy >> Y_WIDTH; | 
|---|
| 390 | size_t y          = cluster_xy & ((1 << Y_WIDTH) - 1); | 
|---|
| 391 | if( (x>=X_SIZE) || (y>=Y_SIZE) ) | 
|---|
| 392 | { | 
|---|
| 393 | std::cout << "PROCID parameter does'nt fit X_SIZE/Y_SIZE" << std::endl; | 
|---|
| 394 | exit(0); | 
|---|
| 395 | } | 
|---|
| 396 | } | 
|---|
| 397 | else if ((strcmp(argv[n], "-THREADS") == 0) && ((n+1) < argc)) | 
|---|
| 398 | { | 
|---|
| 399 | threads_nr = strtol(argv[n+1], NULL, 0); | 
|---|
| 400 | threads_nr = (threads_nr < 1) ? 1 : threads_nr; | 
|---|
| 401 | } | 
|---|
| 402 | else if ((strcmp(argv[n], "-FROZEN") == 0) && (n+1 < argc)) | 
|---|
| 403 | { | 
|---|
| 404 | frozen_cycles = strtol(argv[n+1], NULL, 0); | 
|---|
| 405 | } | 
|---|
| 406 | else if ((strcmp(argv[n], "-PERIOD") == 0) && (n+1 < argc)) | 
|---|
| 407 | { | 
|---|
| 408 | debug_period = strtol(argv[n+1], NULL, 0); | 
|---|
| 409 | } | 
|---|
| 410 | else if ((strcmp(argv[n], "-FAULTY_ROUTER") == 0) && (n+3 < argc) ) | 
|---|
| 411 | { | 
|---|
| 412 | size_t t = strtol(argv[n+1], NULL, 0); | 
|---|
| 413 | size_t x = strtol(argv[n+2], NULL, 0); | 
|---|
| 414 | size_t y = strtol(argv[n+3], NULL, 0); | 
|---|
| 415 | n+=2; | 
|---|
| 416 | if( (t > 4) ) | 
|---|
| 417 | { | 
|---|
| 418 | std::cout << "FAULTY_ROUTER NoC index is too big (index > 4)" << std::endl; | 
|---|
| 419 | exit(0); | 
|---|
| 420 | } | 
|---|
| 421 | if( (x>=X_SIZE) || (y>=Y_SIZE) ) | 
|---|
| 422 | { | 
|---|
| 423 | std::cout << "FAULTY_ROUTER parameter doesn't fit X_SIZE/Y_SIZE" << std::endl; | 
|---|
| 424 | exit(0); | 
|---|
| 425 | } | 
|---|
| 426 | faulty_routers.push_back((t << (X_WIDTH + Y_WIDTH)) | | 
|---|
| 427 | (x << (Y_WIDTH)) | | 
|---|
| 428 | (y)); | 
|---|
| 429 | } | 
|---|
| 430 | else if ((strcmp(argv[n], "-FAULTY_MASK") == 0) && (n+1 < argc) ) | 
|---|
| 431 | { | 
|---|
| 432 | faulty_mask = strtol(argv[n+1], NULL, 0); | 
|---|
| 433 | if( faulty_mask > 0x1F ) | 
|---|
| 434 | { | 
|---|
| 435 | std::cout << "FAULTY_MASK parameter max value is 0x1F" << std::endl; | 
|---|
| 436 | exit(0); | 
|---|
| 437 | } | 
|---|
| 438 | } | 
|---|
| 439 | else | 
|---|
| 440 | { | 
|---|
| 441 | std::cout << "   Arguments are (key, value) couples." << std::endl; | 
|---|
| 442 | std::cout << "   The order is not important." << std::endl; | 
|---|
| 443 | std::cout << "   Accepted arguments are :" << std::endl << std::endl; | 
|---|
| 444 | std::cout << "     -SOFT pathname_for_embedded_soft" << std::endl; | 
|---|
| 445 | std::cout << "     -DSOFT pathname_for_distributed_embedded_soft" << std::endl; | 
|---|
| 446 | std::cout << "     -DISK pathname_for_disk_image" << std::endl; | 
|---|
| 447 | std::cout << "     -NCYCLES number_of_simulated_cycles" << std::endl; | 
|---|
| 448 | std::cout << "     -DEBUG debug_start_cycle" << std::endl; | 
|---|
| 449 | std::cout << "     -THREADS simulator's threads number" << std::endl; | 
|---|
| 450 | std::cout << "     -FROZEN max_number_of_lines" << std::endl; | 
|---|
| 451 | std::cout << "     -PERIOD number_of_cycles between trace" << std::endl; | 
|---|
| 452 | std::cout << "     -MEMCID index_memc_to_be_traced" << std::endl; | 
|---|
| 453 | std::cout << "     -XRAMID index_xram_to_be_traced" << std::endl; | 
|---|
| 454 | std::cout << "     -PROCID index_proc_to_be_traced" << std::endl; | 
|---|
| 455 | std::cout << "     -IOB    non_zero_value" << std::endl; | 
|---|
| 456 | exit(0); | 
|---|
| 457 | } | 
|---|
| 458 | } | 
|---|
| 459 | } | 
|---|
| 460 |  | 
|---|
| 461 | // Activate Distributed Boot (set by environment variable) | 
|---|
| 462 | // When this is activated, every processor boots with its instruction and data | 
|---|
| 463 | // physical address extension register initialized to its cluster index | 
|---|
| 464 | // (X_LOCAL, Y_LOCAL). To support this feature, a distributed ROM is | 
|---|
| 465 | // implemented in each cluster. | 
|---|
| 466 |  | 
|---|
| 467 | const bool distributed_boot = (getenv("DISTRIBUTED_BOOT") != NULL); | 
|---|
| 468 |  | 
|---|
| 469 | // checking hardware parameters | 
|---|
| 470 | assert( (X_SIZE <= (1 << X_WIDTH)) and | 
|---|
| 471 | "The X_SIZE parameter cannot be larger than 16" ); | 
|---|
| 472 |  | 
|---|
| 473 | assert( (Y_SIZE <= (1 << Y_WIDTH)) and | 
|---|
| 474 | "The Y_SIZE parameter cannot be larger than 16" ); | 
|---|
| 475 |  | 
|---|
| 476 | assert( (NB_PROCS_MAX <= (1 << P_WIDTH)) and | 
|---|
| 477 | "NB_PROCS_MAX parameter cannot be larger than 2^P_WIDTH" ); | 
|---|
| 478 |  | 
|---|
| 479 | assert( (NB_DMA_CHANNELS <= 4) and | 
|---|
| 480 | "The NB_DMA_CHANNELS parameter cannot be larger than 4" ); | 
|---|
| 481 |  | 
|---|
| 482 | assert( (NB_TTY_CHANNELS >= 1) and (NB_TTY_CHANNELS <= 16) and | 
|---|
| 483 | "The NB_TTY_CHANNELS parameter cannot be larger than 16" ); | 
|---|
| 484 |  | 
|---|
| 485 | assert( (NB_NIC_CHANNELS == 2) and | 
|---|
| 486 | "The NB_NIC_CHANNELS parameter must be 2" ); | 
|---|
| 487 |  | 
|---|
| 488 | std::cout << std::endl << std::dec | 
|---|
| 489 | << " - X_SIZE          = " << X_SIZE << std::endl | 
|---|
| 490 | << " - Y_SIZE          = " << Y_SIZE << std::endl | 
|---|
| 491 | << " - NB_PROCS_MAX    = " << NB_PROCS_MAX <<  std::endl | 
|---|
| 492 | << " - NB_TTY_CHANNELS = " << NB_TTY_CHANNELS <<  std::endl | 
|---|
| 493 | << " - NB_DMA_CHANNELS = " << NB_DMA_CHANNELS <<  std::endl | 
|---|
| 494 | << " - NB_NIC_CHANNELS = " << NB_NIC_CHANNELS <<  std::endl | 
|---|
| 495 | << " - MEMC_WAYS       = " << MEMC_WAYS << std::endl | 
|---|
| 496 | << " - MEMC_SETS       = " << MEMC_SETS << std::endl | 
|---|
| 497 | << " - RAM_LATENCY     = " << XRAM_LATENCY << std::endl | 
|---|
| 498 | << " - MAX_FROZEN      = " << frozen_cycles << std::endl | 
|---|
| 499 | << " - DIST_BOOT       = " << distributed_boot << std::endl | 
|---|
| 500 | << " - DEBUG_PROCID    = " << debug_proc_id << std::endl | 
|---|
| 501 | << " - DEBUG_MEMCID    = " << debug_memc_id << std::endl | 
|---|
| 502 | << " - DEBUG_XRAMID    = " << debug_xram_id << std::endl; | 
|---|
| 503 |  | 
|---|
| 504 | std::cout << std::endl; | 
|---|
| 505 |  | 
|---|
| 506 | #if USE_OPENMP | 
|---|
| 507 | omp_set_dynamic(false); | 
|---|
| 508 | omp_set_num_threads(threads_nr); | 
|---|
| 509 | std::cerr << "Built with openmp version " << _OPENMP | 
|---|
| 510 | << " / numthreads = " << threads_nr << std::endl; | 
|---|
| 511 | #endif | 
|---|
| 512 |  | 
|---|
| 513 | // Define VciParams objects | 
|---|
| 514 | typedef soclib::caba::VciParams<vci_cell_width_int, | 
|---|
| 515 | vci_plen_width, | 
|---|
| 516 | vci_address_width, | 
|---|
| 517 | vci_rerror_width, | 
|---|
| 518 | vci_clen_width, | 
|---|
| 519 | vci_rflag_width, | 
|---|
| 520 | vci_srcid_width, | 
|---|
| 521 | vci_pktid_width, | 
|---|
| 522 | vci_trdid_width, | 
|---|
| 523 | vci_wrplen_width> vci_param_int; | 
|---|
| 524 |  | 
|---|
| 525 | typedef soclib::caba::VciParams<vci_cell_width_ext, | 
|---|
| 526 | vci_plen_width, | 
|---|
| 527 | vci_address_width, | 
|---|
| 528 | vci_rerror_width, | 
|---|
| 529 | vci_clen_width, | 
|---|
| 530 | vci_rflag_width, | 
|---|
| 531 | vci_srcid_width, | 
|---|
| 532 | vci_pktid_width, | 
|---|
| 533 | vci_trdid_width, | 
|---|
| 534 | vci_wrplen_width> vci_param_ext; | 
|---|
| 535 |  | 
|---|
| 536 | const size_t cluster_iob0 = cluster(0, 0);               // cluster containing IOB0 | 
|---|
| 537 | const size_t cluster_iob1 = cluster(X_SIZE-1, Y_SIZE-1); // cluster containing IOB1 | 
|---|
| 538 |  | 
|---|
| 539 | ///////////////////////////////////////////////////////////////////// | 
|---|
| 540 | // INT network mapping table | 
|---|
| 541 | // - two levels address decoding for commands | 
|---|
| 542 | // - two levels srcid decoding for responses | 
|---|
| 543 | // - NB_PROCS_MAX + 2 (MDMA, IOBX) local initiators per cluster | 
|---|
| 544 | // - 4 local targets (MEMC, XICU, MDMA, IOBX) per cluster | 
|---|
| 545 | ///////////////////////////////////////////////////////////////////// | 
|---|
| 546 | MappingTable maptab_int( vci_address_width, | 
|---|
| 547 | IntTab(X_WIDTH + Y_WIDTH, 16 - X_WIDTH - Y_WIDTH), | 
|---|
| 548 | IntTab(X_WIDTH + Y_WIDTH, vci_srcid_width - X_WIDTH - Y_WIDTH), | 
|---|
| 549 | 0x00FF000000); | 
|---|
| 550 |  | 
|---|
| 551 | for (size_t x = 0; x < X_SIZE; x++) | 
|---|
| 552 | { | 
|---|
| 553 | for (size_t y = 0; y < Y_SIZE; y++) | 
|---|
| 554 | { | 
|---|
| 555 | uint64_t offset = ((uint64_t)cluster(x, y)) | 
|---|
| 556 | << (vci_address_width-X_WIDTH-Y_WIDTH); | 
|---|
| 557 | bool config    = true; | 
|---|
| 558 | bool cacheable = true; | 
|---|
| 559 |  | 
|---|
| 560 | // the four following segments are defined in all clusters | 
|---|
| 561 |  | 
|---|
| 562 | std::ostringstream    smemc_conf; | 
|---|
| 563 | smemc_conf << "int_seg_memc_conf_" << x << "_" << y; | 
|---|
| 564 | maptab_int.add(Segment(smemc_conf.str(), SEG_MMC_BASE+offset, SEG_MMC_SIZE, | 
|---|
| 565 | IntTab(cluster(x, y), INT_MEMC_TGT_ID), not cacheable, config )); | 
|---|
| 566 |  | 
|---|
| 567 | std::ostringstream    smemc_xram; | 
|---|
| 568 | smemc_xram << "int_seg_memc_xram_" << x << "_" << y; | 
|---|
| 569 | maptab_int.add(Segment(smemc_xram.str(), SEG_RAM_BASE+offset, SEG_RAM_SIZE, | 
|---|
| 570 | IntTab(cluster(x, y), INT_MEMC_TGT_ID), cacheable)); | 
|---|
| 571 |  | 
|---|
| 572 | std::ostringstream    sxicu; | 
|---|
| 573 | sxicu << "int_seg_xicu_" << x << "_" << y; | 
|---|
| 574 | maptab_int.add(Segment(sxicu.str(), SEG_XCU_BASE+offset, SEG_XCU_SIZE, | 
|---|
| 575 | IntTab(cluster(x, y), INT_XICU_TGT_ID), not cacheable)); | 
|---|
| 576 |  | 
|---|
| 577 | std::ostringstream    smdma; | 
|---|
| 578 | smdma << "int_seg_mdma_" << x << "_" << y; | 
|---|
| 579 | maptab_int.add(Segment(smdma.str(), SEG_DMA_BASE+offset, SEG_DMA_SIZE, | 
|---|
| 580 | IntTab(cluster(x, y), INT_MDMA_TGT_ID), not cacheable)); | 
|---|
| 581 |  | 
|---|
| 582 | std::ostringstream    sdrom; | 
|---|
| 583 | sdrom << "int_seg_drom_" << x << "_" << y; | 
|---|
| 584 | maptab_int.add(Segment(sdrom.str(), SEG_DROM_BASE+offset, SEG_DROM_SIZE, | 
|---|
| 585 | IntTab(cluster(x, y), INT_DROM_TGT_ID), cacheable)); | 
|---|
| 586 |  | 
|---|
| 587 | // the following segments are only defined in cluster_iob0 or in cluster_iob1 | 
|---|
| 588 |  | 
|---|
| 589 | if ( (cluster(x, y) == cluster_iob0) or (cluster(x, y) == cluster_iob1) ) | 
|---|
| 590 | { | 
|---|
| 591 | std::ostringstream    siobx; | 
|---|
| 592 | siobx << "int_seg_iobx_" << x << "_" << y; | 
|---|
| 593 | maptab_int.add(Segment(siobx.str(), SEG_IOB_BASE+offset, SEG_IOB_SIZE, | 
|---|
| 594 | IntTab(cluster(x, y), INT_IOBX_TGT_ID), not cacheable, config )); | 
|---|
| 595 |  | 
|---|
| 596 | std::ostringstream    stty; | 
|---|
| 597 | stty << "int_seg_mtty_" << x << "_" << y; | 
|---|
| 598 | maptab_int.add(Segment(stty.str(), SEG_TTY_BASE+offset, SEG_TTY_SIZE, | 
|---|
| 599 | IntTab(cluster(x, y), INT_IOBX_TGT_ID), not cacheable)); | 
|---|
| 600 |  | 
|---|
| 601 | std::ostringstream    sfbf; | 
|---|
| 602 | sfbf << "int_seg_fbuf_" << x << "_" << y; | 
|---|
| 603 | maptab_int.add(Segment(sfbf.str(), SEG_FBF_BASE+offset, SEG_FBF_SIZE, | 
|---|
| 604 | IntTab(cluster(x, y), INT_IOBX_TGT_ID), not cacheable)); | 
|---|
| 605 |  | 
|---|
| 606 | std::ostringstream    sbdv; | 
|---|
| 607 | sbdv << "int_seg_bdev_" << x << "_" << y; | 
|---|
| 608 | maptab_int.add(Segment(sbdv.str(), SEG_IOC_BASE+offset, SEG_IOC_SIZE, | 
|---|
| 609 | IntTab(cluster(x, y), INT_IOBX_TGT_ID), not cacheable)); | 
|---|
| 610 |  | 
|---|
| 611 | std::ostringstream    snic; | 
|---|
| 612 | snic << "int_seg_mnic_" << x << "_" << y; | 
|---|
| 613 | maptab_int.add(Segment(snic.str(), SEG_NIC_BASE+offset, SEG_NIC_SIZE, | 
|---|
| 614 | IntTab(cluster(x, y), INT_IOBX_TGT_ID), not cacheable)); | 
|---|
| 615 |  | 
|---|
| 616 | std::ostringstream    sdma; | 
|---|
| 617 | sdma << "int_seg_cdma_" << x << "_" << y; | 
|---|
| 618 | maptab_int.add(Segment(sdma.str(), SEG_CMA_BASE+offset, SEG_CMA_SIZE, | 
|---|
| 619 | IntTab(cluster(x, y), INT_IOBX_TGT_ID), not cacheable)); | 
|---|
| 620 |  | 
|---|
| 621 | std::ostringstream    spic; | 
|---|
| 622 | spic << "int_seg_iopi_" << x << "_" << y; | 
|---|
| 623 | maptab_int.add(Segment(spic.str(), SEG_PIC_BASE+offset, SEG_PIC_SIZE, | 
|---|
| 624 | IntTab(cluster(x, y), INT_IOBX_TGT_ID), not cacheable)); | 
|---|
| 625 |  | 
|---|
| 626 | std::ostringstream    ssim; | 
|---|
| 627 | ssim << "int_seg_simh_" << x << "_" << y; | 
|---|
| 628 | maptab_int.add(Segment(ssim.str(), SEG_SIM_BASE+offset, SEG_SIM_SIZE, | 
|---|
| 629 | IntTab(cluster(x, y), INT_IOBX_TGT_ID), not cacheable)); | 
|---|
| 630 |  | 
|---|
| 631 | std::ostringstream    srom; | 
|---|
| 632 | srom << "int_seg_rom_" << x << "_" << y; | 
|---|
| 633 | maptab_int.add(Segment(srom.str(), SEG_ROM_BASE+offset, SEG_ROM_SIZE, | 
|---|
| 634 | IntTab(cluster(x, y), INT_IOBX_TGT_ID), cacheable)); | 
|---|
| 635 | } | 
|---|
| 636 |  | 
|---|
| 637 | // This define the mapping between the SRCIDs | 
|---|
| 638 | // and the port index on the local interconnect. | 
|---|
| 639 |  | 
|---|
| 640 | maptab_int.srcid_map( IntTab( cluster(x, y), MDMA_LOCAL_SRCID ), | 
|---|
| 641 | IntTab( cluster(x, y), INT_MDMA_INI_ID ) ); | 
|---|
| 642 |  | 
|---|
| 643 | maptab_int.srcid_map( IntTab( cluster(x, y), IOBX_LOCAL_SRCID ), | 
|---|
| 644 | IntTab( cluster(x, y), INT_IOBX_INI_ID ) ); | 
|---|
| 645 |  | 
|---|
| 646 | maptab_int.srcid_map( IntTab( cluster(x, y), IOPI_LOCAL_SRCID ), | 
|---|
| 647 | IntTab( cluster(x, y), INT_IOBX_INI_ID ) ); | 
|---|
| 648 |  | 
|---|
| 649 | for ( size_t p = 0 ; p < NB_PROCS_MAX ; p++ ) | 
|---|
| 650 | maptab_int.srcid_map( IntTab( cluster(x, y), PROC_LOCAL_SRCID+p ), | 
|---|
| 651 | IntTab( cluster(x, y), INT_PROC_INI_ID+p ) ); | 
|---|
| 652 | } | 
|---|
| 653 | } | 
|---|
| 654 | std::cout << "INT network " << maptab_int << std::endl; | 
|---|
| 655 |  | 
|---|
| 656 | ///////////////////////////////////////////////////////////////////////// | 
|---|
| 657 | // RAM network mapping table | 
|---|
| 658 | // - two levels address decoding for commands | 
|---|
| 659 | // - two levels srcid decoding for responses | 
|---|
| 660 | // - 2 local initiators (MEMC, IOBX) per cluster | 
|---|
| 661 | //   (IOBX component only in cluster_iob0 and cluster_iob1) | 
|---|
| 662 | // - 1 local target (XRAM) per cluster | 
|---|
| 663 | //////////////////////////////////////////////////////////////////////// | 
|---|
| 664 | MappingTable maptab_ram( vci_address_width, | 
|---|
| 665 | IntTab(X_WIDTH+Y_WIDTH, 0), | 
|---|
| 666 | IntTab(X_WIDTH+Y_WIDTH, vci_srcid_width - X_WIDTH - Y_WIDTH), | 
|---|
| 667 | 0x00FF000000); | 
|---|
| 668 |  | 
|---|
| 669 | for (size_t x = 0; x < X_SIZE; x++) | 
|---|
| 670 | { | 
|---|
| 671 | for (size_t y = 0; y < Y_SIZE ; y++) | 
|---|
| 672 | { | 
|---|
| 673 | uint64_t offset = ((uint64_t)cluster(x, y)) | 
|---|
| 674 | << (vci_address_width-X_WIDTH-Y_WIDTH); | 
|---|
| 675 |  | 
|---|
| 676 | std::ostringstream sxram; | 
|---|
| 677 | sxram << "ext_seg_xram_" << x << "_" << y; | 
|---|
| 678 | maptab_ram.add(Segment(sxram.str(), SEG_RAM_BASE+offset, | 
|---|
| 679 | SEG_RAM_SIZE, IntTab(cluster(x, y), RAM_XRAM_TGT_ID), false)); | 
|---|
| 680 | } | 
|---|
| 681 | } | 
|---|
| 682 |  | 
|---|
| 683 | // This define the mapping between the initiators SRCID | 
|---|
| 684 | // and the port index on the RAM local interconnect. | 
|---|
| 685 | // External initiator have two alias SRCID (iob0 / iob1) | 
|---|
| 686 |  | 
|---|
| 687 | maptab_ram.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ), | 
|---|
| 688 | IntTab( cluster_iob0, RAM_IOBX_INI_ID ) ); | 
|---|
| 689 |  | 
|---|
| 690 | maptab_ram.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ), | 
|---|
| 691 | IntTab( cluster_iob1, RAM_IOBX_INI_ID ) ); | 
|---|
| 692 |  | 
|---|
| 693 | maptab_ram.srcid_map( IntTab( cluster_iob0, BDEV_LOCAL_SRCID ), | 
|---|
| 694 | IntTab( cluster_iob0, RAM_IOBX_INI_ID ) ); | 
|---|
| 695 |  | 
|---|
| 696 | maptab_ram.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ), | 
|---|
| 697 | IntTab( cluster_iob1, RAM_IOBX_INI_ID ) ); | 
|---|
| 698 |  | 
|---|
| 699 | maptab_ram.srcid_map( IntTab( cluster_iob0, IOPI_LOCAL_SRCID ), | 
|---|
| 700 | IntTab( cluster_iob0, RAM_IOBX_INI_ID ) ); | 
|---|
| 701 |  | 
|---|
| 702 | maptab_ram.srcid_map( IntTab( cluster_iob1, IOPI_LOCAL_SRCID ), | 
|---|
| 703 | IntTab( cluster_iob1, RAM_IOBX_INI_ID ) ); | 
|---|
| 704 |  | 
|---|
| 705 | maptab_ram.srcid_map( IntTab( cluster_iob0, MEMC_LOCAL_SRCID ), | 
|---|
| 706 | IntTab( cluster_iob0, RAM_MEMC_INI_ID ) ); | 
|---|
| 707 |  | 
|---|
| 708 | maptab_ram.srcid_map( IntTab( cluster_iob1, MEMC_LOCAL_SRCID ), | 
|---|
| 709 | IntTab( cluster_iob1, RAM_MEMC_INI_ID ) ); | 
|---|
| 710 |  | 
|---|
| 711 | std::cout << "RAM network " << maptab_ram << std::endl; | 
|---|
| 712 |  | 
|---|
| 713 | /////////////////////////////////////////////////////////////////////// | 
|---|
| 714 | // IOX network mapping table | 
|---|
| 715 | // - two levels address decoding for commands (9, 7) bits | 
|---|
| 716 | // - two levels srcid decoding for responses | 
|---|
| 717 | // - 5 initiators (IOB0, IOB1, BDEV, CDMA, IOPI) | 
|---|
| 718 | // - 9 targets (IOB0, IOB1, BDEV, CDMA, MTTY, FBUF, ROM, MNIC, IOPI) | 
|---|
| 719 | // | 
|---|
| 720 | // Address bit 32 is used to determine if a command must be routed to | 
|---|
| 721 | // IOB0 or IOB1. | 
|---|
| 722 | /////////////////////////////////////////////////////////////////////// | 
|---|
| 723 | MappingTable maptab_iox( | 
|---|
| 724 | vci_address_width, | 
|---|
| 725 | IntTab(X_WIDTH + Y_WIDTH - 1, 16 - X_WIDTH - Y_WIDTH + 1), | 
|---|
| 726 | IntTab(X_WIDTH + Y_WIDTH    , vci_param_ext::S - X_WIDTH - Y_WIDTH), | 
|---|
| 727 | 0x00FF000000); | 
|---|
| 728 |  | 
|---|
| 729 | // External peripherals segments | 
|---|
| 730 | // When there is more than one cluster, external peripherals can be accessed | 
|---|
| 731 | // through two segments, depending on the used IOB (IOB0 or IOB1). | 
|---|
| 732 |  | 
|---|
| 733 | const uint64_t iob0_base = ((uint64_t)cluster_iob0) | 
|---|
| 734 | << (vci_address_width - X_WIDTH - Y_WIDTH); | 
|---|
| 735 |  | 
|---|
| 736 | maptab_iox.add(Segment("iox_seg_mtty_0", SEG_TTY_BASE + iob0_base, SEG_TTY_SIZE, | 
|---|
| 737 | IntTab(0, IOX_MTTY_TGT_ID), false)); | 
|---|
| 738 | maptab_iox.add(Segment("iox_seg_fbuf_0", SEG_FBF_BASE + iob0_base, SEG_FBF_SIZE, | 
|---|
| 739 | IntTab(0, IOX_FBUF_TGT_ID), false)); | 
|---|
| 740 | maptab_iox.add(Segment("iox_seg_bdev_0", SEG_IOC_BASE + iob0_base, SEG_IOC_SIZE, | 
|---|
| 741 | IntTab(0, IOX_BDEV_TGT_ID), false)); | 
|---|
| 742 | maptab_iox.add(Segment("iox_seg_mnic_0", SEG_NIC_BASE + iob0_base, SEG_NIC_SIZE, | 
|---|
| 743 | IntTab(0, IOX_MNIC_TGT_ID), false)); | 
|---|
| 744 | maptab_iox.add(Segment("iox_seg_cdma_0", SEG_CMA_BASE + iob0_base, SEG_CMA_SIZE, | 
|---|
| 745 | IntTab(0, IOX_CDMA_TGT_ID), false)); | 
|---|
| 746 | maptab_iox.add(Segment("iox_seg_iopi_0", SEG_PIC_BASE + iob0_base, SEG_PIC_SIZE, | 
|---|
| 747 | IntTab(0, IOX_IOPI_TGT_ID), false)); | 
|---|
| 748 | maptab_iox.add(Segment("iox_seg_simh_0", SEG_SIM_BASE + iob0_base, SEG_SIM_SIZE, | 
|---|
| 749 | IntTab(0, IOX_SIMH_TGT_ID), false)); | 
|---|
| 750 | maptab_iox.add(Segment("iox_seg_rom_0", SEG_ROM_BASE + iob0_base, SEG_ROM_SIZE, | 
|---|
| 751 | IntTab(0, IOX_ROM_TGT_ID), false)); | 
|---|
| 752 |  | 
|---|
| 753 | if ( cluster_iob0 != cluster_iob1 ) | 
|---|
| 754 | { | 
|---|
| 755 | const uint64_t iob1_base = ((uint64_t)cluster_iob1) | 
|---|
| 756 | << (vci_address_width - X_WIDTH - Y_WIDTH); | 
|---|
| 757 |  | 
|---|
| 758 | maptab_iox.add(Segment("iox_seg_mtty_1", SEG_TTY_BASE + iob1_base, SEG_TTY_SIZE, | 
|---|
| 759 | IntTab(0, IOX_MTTY_TGT_ID), false)); | 
|---|
| 760 | maptab_iox.add(Segment("iox_seg_fbuf_1", SEG_FBF_BASE + iob1_base, SEG_FBF_SIZE, | 
|---|
| 761 | IntTab(0, IOX_FBUF_TGT_ID), false)); | 
|---|
| 762 | maptab_iox.add(Segment("iox_seg_bdev_1", SEG_IOC_BASE + iob1_base, SEG_IOC_SIZE, | 
|---|
| 763 | IntTab(0, IOX_BDEV_TGT_ID), false)); | 
|---|
| 764 | maptab_iox.add(Segment("iox_seg_mnic_1", SEG_NIC_BASE + iob1_base, SEG_NIC_SIZE, | 
|---|
| 765 | IntTab(0, IOX_MNIC_TGT_ID), false)); | 
|---|
| 766 | maptab_iox.add(Segment("iox_seg_cdma_1", SEG_CMA_BASE + iob1_base, SEG_CMA_SIZE, | 
|---|
| 767 | IntTab(0, IOX_CDMA_TGT_ID), false)); | 
|---|
| 768 | maptab_iox.add(Segment("iox_seg_iopi_1", SEG_PIC_BASE + iob1_base, SEG_PIC_SIZE, | 
|---|
| 769 | IntTab(0, IOX_IOPI_TGT_ID), false)); | 
|---|
| 770 | maptab_iox.add(Segment("iox_seg_simh_1", SEG_SIM_BASE + iob1_base, SEG_SIM_SIZE, | 
|---|
| 771 | IntTab(0, IOX_SIMH_TGT_ID), false)); | 
|---|
| 772 | maptab_iox.add(Segment("iox_seg_rom_1", SEG_ROM_BASE + iob1_base, SEG_ROM_SIZE, | 
|---|
| 773 | IntTab(0, IOX_ROM_TGT_ID), false)); | 
|---|
| 774 | } | 
|---|
| 775 |  | 
|---|
| 776 | // If there is more than one cluster, external peripherals | 
|---|
| 777 | // can access RAM through two segments (IOB0 / IOB1). | 
|---|
| 778 | // As IOMMU is not activated, addresses are 40 bits (physical addresses), | 
|---|
| 779 | // and the choice depends on address bit A[32]. | 
|---|
| 780 | for (size_t x = 0; x < X_SIZE; x++) | 
|---|
| 781 | { | 
|---|
| 782 | for (size_t y = 0; y < Y_SIZE ; y++) | 
|---|
| 783 | { | 
|---|
| 784 | const bool wti       = true; | 
|---|
| 785 | const bool cacheable = true; | 
|---|
| 786 |  | 
|---|
| 787 | const uint64_t offset = ((uint64_t)cluster(x, y)) | 
|---|
| 788 | << (vci_address_width-X_WIDTH-Y_WIDTH); | 
|---|
| 789 |  | 
|---|
| 790 | const uint64_t xicu_base = SEG_XCU_BASE + offset; | 
|---|
| 791 |  | 
|---|
| 792 | if ( (y & 0x1) == 0 ) // use IOB0 | 
|---|
| 793 | { | 
|---|
| 794 | std::ostringstream sxcu0; | 
|---|
| 795 | sxcu0 << "iox_seg_xcu0_" << x << "_" << y; | 
|---|
| 796 | maptab_iox.add(Segment(sxcu0.str(), xicu_base, SEG_XCU_SIZE, | 
|---|
| 797 | IntTab(0, IOX_IOB0_TGT_ID), not cacheable, wti)); | 
|---|
| 798 |  | 
|---|
| 799 | std::ostringstream siob0; | 
|---|
| 800 | siob0 << "iox_seg_ram0_" << x << "_" << y; | 
|---|
| 801 | maptab_iox.add(Segment(siob0.str(), offset, SEG_XCU_BASE, | 
|---|
| 802 | IntTab(0, IOX_IOB0_TGT_ID), not cacheable, not wti)); | 
|---|
| 803 | } | 
|---|
| 804 | else                  // USE IOB1 | 
|---|
| 805 | { | 
|---|
| 806 | std::ostringstream sxcu1; | 
|---|
| 807 | sxcu1 << "iox_seg_xcu1_" << x << "_" << y; | 
|---|
| 808 | maptab_iox.add(Segment(sxcu1.str(), xicu_base, SEG_XCU_SIZE, | 
|---|
| 809 | IntTab(0, IOX_IOB1_TGT_ID), not cacheable, wti)); | 
|---|
| 810 |  | 
|---|
| 811 | std::ostringstream siob1; | 
|---|
| 812 | siob1 << "iox_seg_ram1_" << x << "_" << y; | 
|---|
| 813 | maptab_iox.add(Segment(siob1.str(), offset, SEG_XCU_BASE, | 
|---|
| 814 | IntTab(0, IOX_IOB1_TGT_ID), not cacheable, not wti)); | 
|---|
| 815 | } | 
|---|
| 816 | } | 
|---|
| 817 | } | 
|---|
| 818 |  | 
|---|
| 819 | // This define the mapping between the external initiators (SRCID) | 
|---|
| 820 | // and the port index on the IOX local interconnect. | 
|---|
| 821 |  | 
|---|
| 822 | maptab_iox.srcid_map( IntTab( 0, CDMA_LOCAL_SRCID ) , | 
|---|
| 823 | IntTab( 0, IOX_CDMA_INI_ID  ) ); | 
|---|
| 824 | maptab_iox.srcid_map( IntTab( 0, BDEV_LOCAL_SRCID ) , | 
|---|
| 825 | IntTab( 0, IOX_BDEV_INI_ID  ) ); | 
|---|
| 826 | maptab_iox.srcid_map( IntTab( 0, IOPI_LOCAL_SRCID ) , | 
|---|
| 827 | IntTab( 0, IOX_IOPI_INI_ID  ) ); | 
|---|
| 828 | maptab_iox.srcid_map( IntTab( 0, IOX_IOB0_INI_ID  ) , | 
|---|
| 829 | IntTab( 0, IOX_IOB0_INI_ID  ) ); | 
|---|
| 830 |  | 
|---|
| 831 | if ( cluster_iob0 != cluster_iob1 ) | 
|---|
| 832 | { | 
|---|
| 833 | maptab_iox.srcid_map( IntTab( 0, IOX_IOB1_INI_ID ) , | 
|---|
| 834 | IntTab( 0, IOX_IOB1_INI_ID ) ); | 
|---|
| 835 | } | 
|---|
| 836 |  | 
|---|
| 837 | std::cout << "IOX network " << maptab_iox << std::endl; | 
|---|
| 838 |  | 
|---|
| 839 | //////////////////// | 
|---|
| 840 | // Signals | 
|---|
| 841 | /////////////////// | 
|---|
| 842 |  | 
|---|
| 843 | sc_clock                          signal_clk("clk"); | 
|---|
| 844 | sc_signal<bool>                   signal_resetn("resetn"); | 
|---|
| 845 |  | 
|---|
| 846 | sc_signal<bool>                   signal_irq_false; | 
|---|
| 847 | sc_signal<bool>                   signal_irq_bdev; | 
|---|
| 848 | sc_signal<bool>                   signal_irq_mtty_rx[NB_TTY_CHANNELS]; | 
|---|
| 849 | sc_signal<bool>                   signal_irq_mnic_rx[NB_NIC_CHANNELS]; | 
|---|
| 850 | sc_signal<bool>                   signal_irq_mnic_tx[NB_NIC_CHANNELS]; | 
|---|
| 851 | sc_signal<bool>                   signal_irq_cdma[NB_CMA_CHANNELS]; | 
|---|
| 852 |  | 
|---|
| 853 | // VCI signals for IOX network | 
|---|
| 854 | VciSignals<vci_param_ext>         signal_vci_ini_iob0("signal_vci_ini_iob0"); | 
|---|
| 855 | VciSignals<vci_param_ext>         signal_vci_ini_iob1("signal_vci_ini_iob1"); | 
|---|
| 856 | VciSignals<vci_param_ext>         signal_vci_ini_bdev("signal_vci_ini_bdev"); | 
|---|
| 857 | VciSignals<vci_param_ext>         signal_vci_ini_cdma("signal_vci_ini_cdma"); | 
|---|
| 858 | VciSignals<vci_param_ext>         signal_vci_ini_iopi("signal_vci_ini_iopi"); | 
|---|
| 859 |  | 
|---|
| 860 | VciSignals<vci_param_ext>         signal_vci_tgt_iob0("signal_vci_tgt_iob0"); | 
|---|
| 861 | VciSignals<vci_param_ext>         signal_vci_tgt_iob1("signal_vci_tgt_iob1"); | 
|---|
| 862 | VciSignals<vci_param_ext>         signal_vci_tgt_mtty("signal_vci_tgt_mtty"); | 
|---|
| 863 | VciSignals<vci_param_ext>         signal_vci_tgt_fbuf("signal_vci_tgt_fbuf"); | 
|---|
| 864 | VciSignals<vci_param_ext>         signal_vci_tgt_mnic("signal_vci_tgt_mnic"); | 
|---|
| 865 | VciSignals<vci_param_ext>         signal_vci_tgt_bdev("signal_vci_tgt_bdev"); | 
|---|
| 866 | VciSignals<vci_param_ext>         signal_vci_tgt_cdma("signal_vci_tgt_cdma"); | 
|---|
| 867 | VciSignals<vci_param_ext>         signal_vci_tgt_iopi("signal_vci_ini_iopi"); | 
|---|
| 868 | VciSignals<vci_param_ext>         signal_vci_tgt_simh("signal_vci_ini_simh"); | 
|---|
| 869 | VciSignals<vci_param_ext>         signal_vci_tgt_rom("signal_vci_ini_rom"); | 
|---|
| 870 |  | 
|---|
| 871 | // Horizontal inter-clusters INT network DSPIN | 
|---|
| 872 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_h_inc = | 
|---|
| 873 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_h_inc", X_SIZE-1, Y_SIZE, 3); | 
|---|
| 874 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_h_dec = | 
|---|
| 875 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_h_dec", X_SIZE-1, Y_SIZE, 3); | 
|---|
| 876 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_h_inc = | 
|---|
| 877 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_h_inc", X_SIZE-1, Y_SIZE, 2); | 
|---|
| 878 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_h_dec = | 
|---|
| 879 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_h_dec", X_SIZE-1, Y_SIZE, 2); | 
|---|
| 880 |  | 
|---|
| 881 | // Vertical inter-clusters INT network DSPIN | 
|---|
| 882 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_v_inc = | 
|---|
| 883 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_v_inc", X_SIZE, Y_SIZE-1, 3); | 
|---|
| 884 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_v_dec = | 
|---|
| 885 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_v_dec", X_SIZE, Y_SIZE-1, 3); | 
|---|
| 886 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_v_inc = | 
|---|
| 887 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_v_inc", X_SIZE, Y_SIZE-1, 2); | 
|---|
| 888 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_v_dec = | 
|---|
| 889 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_v_dec", X_SIZE, Y_SIZE-1, 2); | 
|---|
| 890 |  | 
|---|
| 891 | // Mesh boundaries INT network DSPIN | 
|---|
| 892 | DspinSignals<dspin_int_cmd_width>**** signal_dspin_false_int_cmd_in = | 
|---|
| 893 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_false_int_cmd_in", X_SIZE, Y_SIZE, 4, 3); | 
|---|
| 894 | DspinSignals<dspin_int_cmd_width>**** signal_dspin_false_int_cmd_out = | 
|---|
| 895 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_false_int_cmd_out", X_SIZE, Y_SIZE, 4, 3); | 
|---|
| 896 | DspinSignals<dspin_int_rsp_width>**** signal_dspin_false_int_rsp_in = | 
|---|
| 897 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_false_int_rsp_in", X_SIZE, Y_SIZE, 4, 2); | 
|---|
| 898 | DspinSignals<dspin_int_rsp_width>**** signal_dspin_false_int_rsp_out = | 
|---|
| 899 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_false_int_rsp_out", X_SIZE, Y_SIZE, 4, 2); | 
|---|
| 900 |  | 
|---|
| 901 |  | 
|---|
| 902 | // Horizontal inter-clusters RAM network DSPIN | 
|---|
| 903 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_h_inc = | 
|---|
| 904 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_h_inc", X_SIZE-1, Y_SIZE); | 
|---|
| 905 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_h_dec = | 
|---|
| 906 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_h_dec", X_SIZE-1, Y_SIZE); | 
|---|
| 907 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_h_inc = | 
|---|
| 908 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_h_inc", X_SIZE-1, Y_SIZE); | 
|---|
| 909 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_h_dec = | 
|---|
| 910 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_h_dec", X_SIZE-1, Y_SIZE); | 
|---|
| 911 |  | 
|---|
| 912 | // Vertical inter-clusters RAM network DSPIN | 
|---|
| 913 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_v_inc = | 
|---|
| 914 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_v_inc", X_SIZE, Y_SIZE-1); | 
|---|
| 915 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_v_dec = | 
|---|
| 916 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_v_dec", X_SIZE, Y_SIZE-1); | 
|---|
| 917 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_v_inc = | 
|---|
| 918 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_v_inc", X_SIZE, Y_SIZE-1); | 
|---|
| 919 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_v_dec = | 
|---|
| 920 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_v_dec", X_SIZE, Y_SIZE-1); | 
|---|
| 921 |  | 
|---|
| 922 | // Mesh boundaries RAM network DSPIN | 
|---|
| 923 | DspinSignals<dspin_ram_cmd_width>*** signal_dspin_false_ram_cmd_in = | 
|---|
| 924 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_false_ram_cmd_in", X_SIZE, Y_SIZE, 4); | 
|---|
| 925 | DspinSignals<dspin_ram_cmd_width>*** signal_dspin_false_ram_cmd_out = | 
|---|
| 926 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_false_ram_cmd_out", X_SIZE, Y_SIZE, 4); | 
|---|
| 927 | DspinSignals<dspin_ram_rsp_width>*** signal_dspin_false_ram_rsp_in = | 
|---|
| 928 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_false_ram_rsp_in", X_SIZE, Y_SIZE, 4); | 
|---|
| 929 | DspinSignals<dspin_ram_rsp_width>*** signal_dspin_false_ram_rsp_out = | 
|---|
| 930 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_false_ram_rsp_out", X_SIZE, Y_SIZE, 4); | 
|---|
| 931 |  | 
|---|
| 932 | //////////////////////////// | 
|---|
| 933 | //      Loader | 
|---|
| 934 | //////////////////////////// | 
|---|
| 935 | soclib::common::Loader *loader; | 
|---|
| 936 |  | 
|---|
| 937 | #if USE_ALMOS | 
|---|
| 938 | loader = new soclib::common::Loader (almos_bootloader_pathname, | 
|---|
| 939 | almos_archinfo_pathname, | 
|---|
| 940 | almos_kernel_pathname); | 
|---|
| 941 | #else | 
|---|
| 942 | if (strcmp(soft_name, "") == 0) | 
|---|
| 943 | { | 
|---|
| 944 | loader = new soclib::common::Loader (dsoft_name); | 
|---|
| 945 | } | 
|---|
| 946 | else | 
|---|
| 947 | { | 
|---|
| 948 | loader = new soclib::common::Loader (soft_name, dsoft_name); | 
|---|
| 949 | } | 
|---|
| 950 | #endif | 
|---|
| 951 |  | 
|---|
| 952 | // initialize memory with a value different than 0 (expose software errors | 
|---|
| 953 | // dues to uninitialized data) | 
|---|
| 954 | loader->memory_default(0xA0); | 
|---|
| 955 |  | 
|---|
| 956 | typedef soclib::common::GdbServer<soclib::common::Mips32ElIss> proc_iss; | 
|---|
| 957 | proc_iss::set_loader(loader); | 
|---|
| 958 |  | 
|---|
| 959 | //////////////////////////////////////// | 
|---|
| 960 | //  Instanciated Hardware Components | 
|---|
| 961 | //////////////////////////////////////// | 
|---|
| 962 |  | 
|---|
| 963 | std::cout << std::endl << "External Bus and Peripherals" << std::endl << std::endl; | 
|---|
| 964 |  | 
|---|
| 965 | const size_t nb_iox_initiators = (cluster_iob0 != cluster_iob1) ? 5 : 4; | 
|---|
| 966 | const size_t nb_iox_targets = (cluster_iob0 != cluster_iob1) ? 10 : 9; | 
|---|
| 967 |  | 
|---|
| 968 | // IOX network | 
|---|
| 969 | VciIoxNetwork<vci_param_ext>* iox_network; | 
|---|
| 970 | iox_network = new VciIoxNetwork<vci_param_ext>( "iox_network", | 
|---|
| 971 | maptab_iox, | 
|---|
| 972 | nb_iox_targets, | 
|---|
| 973 | nb_iox_initiators ); | 
|---|
| 974 |  | 
|---|
| 975 | // Network Controller | 
|---|
| 976 | VciMultiNic<vci_param_ext>*  mnic; | 
|---|
| 977 | mnic = new VciMultiNic<vci_param_ext>( "mnic", | 
|---|
| 978 | IntTab(0, IOX_MNIC_TGT_ID), | 
|---|
| 979 | maptab_iox, | 
|---|
| 980 | NB_NIC_CHANNELS, | 
|---|
| 981 | 0,                // mac_4 address | 
|---|
| 982 | 0,                // mac_2 address | 
|---|
| 983 | 1 );              // NIC_MODE_SYNTHESIS | 
|---|
| 984 |  | 
|---|
| 985 | // Frame Buffer | 
|---|
| 986 | VciFrameBuffer<vci_param_ext>*  fbuf; | 
|---|
| 987 | fbuf = new VciFrameBuffer<vci_param_ext>( "fbuf", | 
|---|
| 988 | IntTab(0, IOX_FBUF_TGT_ID), | 
|---|
| 989 | maptab_iox, | 
|---|
| 990 | FBUF_X_SIZE, FBUF_Y_SIZE ); | 
|---|
| 991 |  | 
|---|
| 992 | // Block Device | 
|---|
| 993 | // for AHCI | 
|---|
| 994 | // std::vector<std::string> filenames; | 
|---|
| 995 | // filenames.push_back(disk_name);            // one single disk | 
|---|
| 996 | VciBlockDeviceTsar<vci_param_ext>*  bdev; | 
|---|
| 997 | bdev = new VciBlockDeviceTsar<vci_param_ext>( "bdev", | 
|---|
| 998 | maptab_iox, | 
|---|
| 999 | IntTab(0, BDEV_LOCAL_SRCID), | 
|---|
| 1000 | IntTab(0, IOX_BDEV_TGT_ID), | 
|---|
| 1001 | disk_name, | 
|---|
| 1002 | 512,        // block size | 
|---|
| 1003 | 64,         // burst size (bytes) | 
|---|
| 1004 | 0 );        // disk latency | 
|---|
| 1005 |  | 
|---|
| 1006 | // Chained Buffer DMA controller | 
|---|
| 1007 | VciChbufDma<vci_param_ext>*  cdma; | 
|---|
| 1008 | cdma = new VciChbufDma<vci_param_ext>( "cdma", | 
|---|
| 1009 | maptab_iox, | 
|---|
| 1010 | IntTab(0, CDMA_LOCAL_SRCID), | 
|---|
| 1011 | IntTab(0, IOX_CDMA_TGT_ID), | 
|---|
| 1012 | 64,          // burst size (bytes) | 
|---|
| 1013 | 2*NB_NIC_CHANNELS ); | 
|---|
| 1014 | // Multi-TTY controller | 
|---|
| 1015 | std::vector<std::string> vect_names; | 
|---|
| 1016 | for( size_t tid = 0 ; tid < NB_TTY_CHANNELS ; tid++ ) | 
|---|
| 1017 | { | 
|---|
| 1018 | std::ostringstream term_name; | 
|---|
| 1019 | term_name <<  "term" << tid; | 
|---|
| 1020 | vect_names.push_back(term_name.str().c_str()); | 
|---|
| 1021 | } | 
|---|
| 1022 | VciMultiTty<vci_param_ext>*  mtty; | 
|---|
| 1023 | mtty = new VciMultiTty<vci_param_ext>( "mtty", | 
|---|
| 1024 | IntTab(0, IOX_MTTY_TGT_ID), | 
|---|
| 1025 | maptab_iox, | 
|---|
| 1026 | vect_names); | 
|---|
| 1027 |  | 
|---|
| 1028 | // IOPIC | 
|---|
| 1029 | VciIopic<vci_param_ext>* iopi; | 
|---|
| 1030 | iopi = new VciIopic<vci_param_ext>( "iopi", | 
|---|
| 1031 | maptab_iox, | 
|---|
| 1032 | IntTab(0, IOPI_LOCAL_SRCID), | 
|---|
| 1033 | IntTab(0, IOX_IOPI_TGT_ID), | 
|---|
| 1034 | 32 );        // number of input HWI | 
|---|
| 1035 |  | 
|---|
| 1036 | // Simhelper | 
|---|
| 1037 | VciSimhelper<vci_param_ext>* simh; | 
|---|
| 1038 | simh = new VciSimhelper<vci_param_ext>("simh", | 
|---|
| 1039 | IntTab(0, IOX_SIMH_TGT_ID), | 
|---|
| 1040 | maptab_iox ); | 
|---|
| 1041 |  | 
|---|
| 1042 | // External ROM | 
|---|
| 1043 | VciSimpleRom<vci_param_ext>* rom; | 
|---|
| 1044 | rom = new VciSimpleRom<vci_param_ext>("rom", | 
|---|
| 1045 | IntTab(0, IOX_ROM_TGT_ID), | 
|---|
| 1046 | maptab_iox, | 
|---|
| 1047 | *loader, | 
|---|
| 1048 | X_WIDTH + Y_WIDTH ); | 
|---|
| 1049 |  | 
|---|
| 1050 | // Clusters | 
|---|
| 1051 | TsarIobCluster<vci_param_int, | 
|---|
| 1052 | vci_param_ext, | 
|---|
| 1053 | dspin_int_cmd_width, | 
|---|
| 1054 | dspin_int_rsp_width, | 
|---|
| 1055 | dspin_ram_cmd_width, | 
|---|
| 1056 | dspin_ram_rsp_width>* clusters[X_SIZE][Y_SIZE]; | 
|---|
| 1057 |  | 
|---|
| 1058 | #if USE_OPENMP | 
|---|
| 1059 | #pragma omp parallel | 
|---|
| 1060 | { | 
|---|
| 1061 | #pragma omp for | 
|---|
| 1062 | #endif | 
|---|
| 1063 | for(size_t i = 0; i  < (X_SIZE * Y_SIZE); i++) | 
|---|
| 1064 | { | 
|---|
| 1065 | size_t x = i / Y_SIZE; | 
|---|
| 1066 | size_t y = i % Y_SIZE; | 
|---|
| 1067 |  | 
|---|
| 1068 | #if USE_OPENMP | 
|---|
| 1069 | #pragma omp critical | 
|---|
| 1070 | { | 
|---|
| 1071 | #endif | 
|---|
| 1072 | std::cout << std::endl; | 
|---|
| 1073 | std::cout << "Cluster_" << std::dec << x << "_" << y << std::endl; | 
|---|
| 1074 | std::cout << std::endl; | 
|---|
| 1075 |  | 
|---|
| 1076 | const bool is_iob0 = (cluster(x, y) == cluster_iob0); | 
|---|
| 1077 | const bool is_iob1 = (cluster(x, y) == cluster_iob1); | 
|---|
| 1078 | const bool is_io_cluster = is_iob0 || is_iob1; | 
|---|
| 1079 |  | 
|---|
| 1080 | const int iox_iob_ini_id = is_iob0 ? | 
|---|
| 1081 | IOX_IOB0_INI_ID : | 
|---|
| 1082 | IOX_IOB1_INI_ID ; | 
|---|
| 1083 | const int iox_iob_tgt_id = is_iob0 ? | 
|---|
| 1084 | IOX_IOB0_TGT_ID : | 
|---|
| 1085 | IOX_IOB1_TGT_ID ; | 
|---|
| 1086 |  | 
|---|
| 1087 | std::ostringstream sc; | 
|---|
| 1088 | sc << "cluster_" << x << "_" << y; | 
|---|
| 1089 | clusters[x][y] = new TsarIobCluster<vci_param_int, | 
|---|
| 1090 | vci_param_ext, | 
|---|
| 1091 | dspin_int_cmd_width, | 
|---|
| 1092 | dspin_int_rsp_width, | 
|---|
| 1093 | dspin_ram_cmd_width, | 
|---|
| 1094 | dspin_ram_rsp_width> | 
|---|
| 1095 | ( | 
|---|
| 1096 | sc.str().c_str(), | 
|---|
| 1097 | NB_PROCS_MAX, | 
|---|
| 1098 | NB_DMA_CHANNELS, | 
|---|
| 1099 | x, | 
|---|
| 1100 | y, | 
|---|
| 1101 | X_SIZE, | 
|---|
| 1102 | Y_SIZE, | 
|---|
| 1103 |  | 
|---|
| 1104 | P_WIDTH, | 
|---|
| 1105 |  | 
|---|
| 1106 | maptab_int, | 
|---|
| 1107 | maptab_ram, | 
|---|
| 1108 | maptab_iox, | 
|---|
| 1109 |  | 
|---|
| 1110 | X_WIDTH, | 
|---|
| 1111 | Y_WIDTH, | 
|---|
| 1112 | vci_srcid_width - X_WIDTH - Y_WIDTH,            // l_id width, | 
|---|
| 1113 |  | 
|---|
| 1114 | INT_MEMC_TGT_ID, | 
|---|
| 1115 | INT_XICU_TGT_ID, | 
|---|
| 1116 | INT_MDMA_TGT_ID, | 
|---|
| 1117 | INT_DROM_TGT_ID, | 
|---|
| 1118 | INT_IOBX_TGT_ID, | 
|---|
| 1119 |  | 
|---|
| 1120 | INT_PROC_INI_ID, | 
|---|
| 1121 | INT_MDMA_INI_ID, | 
|---|
| 1122 | INT_IOBX_INI_ID, | 
|---|
| 1123 |  | 
|---|
| 1124 | RAM_XRAM_TGT_ID, | 
|---|
| 1125 |  | 
|---|
| 1126 | RAM_MEMC_INI_ID, | 
|---|
| 1127 | RAM_IOBX_INI_ID, | 
|---|
| 1128 |  | 
|---|
| 1129 | is_io_cluster, | 
|---|
| 1130 | iox_iob_tgt_id, | 
|---|
| 1131 | iox_iob_ini_id, | 
|---|
| 1132 |  | 
|---|
| 1133 | MEMC_WAYS, | 
|---|
| 1134 | MEMC_SETS, | 
|---|
| 1135 | L1_IWAYS, | 
|---|
| 1136 | L1_ISETS, | 
|---|
| 1137 | L1_DWAYS, | 
|---|
| 1138 | L1_DSETS, | 
|---|
| 1139 | XRAM_LATENCY, | 
|---|
| 1140 | XCU_NB_INPUTS, | 
|---|
| 1141 |  | 
|---|
| 1142 | distributed_boot, | 
|---|
| 1143 |  | 
|---|
| 1144 | *loader, | 
|---|
| 1145 |  | 
|---|
| 1146 | frozen_cycles, | 
|---|
| 1147 | debug_from, | 
|---|
| 1148 | debug_ok and (cluster(x, y) == debug_memc_id), | 
|---|
| 1149 | debug_ok and (cluster(x, y) == (debug_proc_id >> P_WIDTH)), | 
|---|
| 1150 | debug_ok and debug_iob | 
|---|
| 1151 | ); | 
|---|
| 1152 |  | 
|---|
| 1153 | #if USE_OPENMP | 
|---|
| 1154 | } // end critical | 
|---|
| 1155 | #endif | 
|---|
| 1156 | } // end for | 
|---|
| 1157 | #if USE_OPENMP | 
|---|
| 1158 | } | 
|---|
| 1159 | #endif | 
|---|
| 1160 |  | 
|---|
| 1161 | // disable all interfaces of the faulty CMD routers | 
|---|
| 1162 | std::cout << "\n*** List of deactivated routers ***\n"; | 
|---|
| 1163 | for (std::vector<size_t>::iterator it = faulty_routers.begin(); | 
|---|
| 1164 | it != faulty_routers.end(); | 
|---|
| 1165 | ++it) | 
|---|
| 1166 | { | 
|---|
| 1167 | int ry = (*it) & ((1 << Y_WIDTH) - 1); | 
|---|
| 1168 | int rx = (*it >> Y_WIDTH) & ((1 << X_WIDTH) - 1); | 
|---|
| 1169 | int rt = (*it) >> (X_WIDTH + Y_WIDTH); | 
|---|
| 1170 |  | 
|---|
| 1171 | if (rt == 0) | 
|---|
| 1172 | { | 
|---|
| 1173 | std::cout << "Deactivate CMD router (" << rx << "," << ry << ")" | 
|---|
| 1174 | << std::endl; | 
|---|
| 1175 | clusters[rx][ry]->int_router_cmd[0]->set_disable_mask(faulty_mask); | 
|---|
| 1176 | continue; | 
|---|
| 1177 | } | 
|---|
| 1178 | if (rt == 1) | 
|---|
| 1179 | { | 
|---|
| 1180 | std::cout << "Deactivate RSP router (" << rx << "," << ry << ")" | 
|---|
| 1181 | << std::endl; | 
|---|
| 1182 | clusters[rx][ry]->int_router_rsp[0]->set_disable_mask(faulty_mask); | 
|---|
| 1183 | continue; | 
|---|
| 1184 | } | 
|---|
| 1185 | if (rt == 2) | 
|---|
| 1186 | { | 
|---|
| 1187 | std::cout << "Deactivate M2P router (" << rx << "," << ry << ")" | 
|---|
| 1188 | << std::endl; | 
|---|
| 1189 | clusters[rx][ry]->int_router_cmd[1]->set_disable_mask(faulty_mask); | 
|---|
| 1190 | continue; | 
|---|
| 1191 | } | 
|---|
| 1192 | if (rt == 3) | 
|---|
| 1193 | { | 
|---|
| 1194 | std::cout << "Deactivate P2M router (" << rx << "," << ry << ")" | 
|---|
| 1195 | << std::endl; | 
|---|
| 1196 | clusters[rx][ry]->int_router_rsp[1]->set_disable_mask(faulty_mask); | 
|---|
| 1197 | continue; | 
|---|
| 1198 | } | 
|---|
| 1199 | if (rt == 4) | 
|---|
| 1200 | { | 
|---|
| 1201 | std::cout << "Deactivate CLACK router (" << rx << "," << ry << ")" | 
|---|
| 1202 | << std::endl; | 
|---|
| 1203 | clusters[rx][ry]->int_router_cmd[2]->set_disable_mask(faulty_mask); | 
|---|
| 1204 | continue; | 
|---|
| 1205 | } | 
|---|
| 1206 | } | 
|---|
| 1207 |  | 
|---|
| 1208 | std::cout << std::endl; | 
|---|
| 1209 |  | 
|---|
| 1210 | /////////////////////////////////////////////////////////////////////////////// | 
|---|
| 1211 | //     Net-list | 
|---|
| 1212 | /////////////////////////////////////////////////////////////////////////////// | 
|---|
| 1213 |  | 
|---|
| 1214 | // IOX network connexion | 
|---|
| 1215 | iox_network->p_clk                                   (signal_clk); | 
|---|
| 1216 | iox_network->p_resetn                                (signal_resetn); | 
|---|
| 1217 | iox_network->p_to_ini[IOX_IOB0_INI_ID]               (signal_vci_ini_iob0); | 
|---|
| 1218 | iox_network->p_to_ini[IOX_BDEV_INI_ID]               (signal_vci_ini_bdev); | 
|---|
| 1219 | iox_network->p_to_ini[IOX_CDMA_INI_ID]               (signal_vci_ini_cdma); | 
|---|
| 1220 | iox_network->p_to_ini[IOX_IOPI_INI_ID]               (signal_vci_ini_iopi); | 
|---|
| 1221 |  | 
|---|
| 1222 | iox_network->p_to_tgt[IOX_IOB0_TGT_ID]               (signal_vci_tgt_iob0); | 
|---|
| 1223 | iox_network->p_to_tgt[IOX_MTTY_TGT_ID]               (signal_vci_tgt_mtty); | 
|---|
| 1224 | iox_network->p_to_tgt[IOX_FBUF_TGT_ID]               (signal_vci_tgt_fbuf); | 
|---|
| 1225 | iox_network->p_to_tgt[IOX_MNIC_TGT_ID]               (signal_vci_tgt_mnic); | 
|---|
| 1226 | iox_network->p_to_tgt[IOX_BDEV_TGT_ID]               (signal_vci_tgt_bdev); | 
|---|
| 1227 | iox_network->p_to_tgt[IOX_CDMA_TGT_ID]               (signal_vci_tgt_cdma); | 
|---|
| 1228 | iox_network->p_to_tgt[IOX_IOPI_TGT_ID]               (signal_vci_tgt_iopi); | 
|---|
| 1229 | iox_network->p_to_tgt[IOX_SIMH_TGT_ID]               (signal_vci_tgt_simh); | 
|---|
| 1230 | iox_network->p_to_tgt[IOX_ROM_TGT_ID]                (signal_vci_tgt_rom); | 
|---|
| 1231 |  | 
|---|
| 1232 | if (cluster_iob0 != cluster_iob1) | 
|---|
| 1233 | { | 
|---|
| 1234 | iox_network->p_to_ini[IOX_IOB1_INI_ID]           (signal_vci_ini_iob1); | 
|---|
| 1235 | iox_network->p_to_tgt[IOX_IOB1_TGT_ID]           (signal_vci_tgt_iob1); | 
|---|
| 1236 | } | 
|---|
| 1237 |  | 
|---|
| 1238 | // BDEV connexion | 
|---|
| 1239 | bdev->p_clk                                          (signal_clk); | 
|---|
| 1240 | bdev->p_resetn                                       (signal_resetn); | 
|---|
| 1241 | bdev->p_irq                                          (signal_irq_bdev); | 
|---|
| 1242 | bdev->p_vci_target                                   (signal_vci_tgt_bdev); | 
|---|
| 1243 | bdev->p_vci_initiator                                (signal_vci_ini_bdev); | 
|---|
| 1244 |  | 
|---|
| 1245 | std::cout << "  - BDEV connected" << std::endl; | 
|---|
| 1246 |  | 
|---|
| 1247 | // FBUF connexion | 
|---|
| 1248 | fbuf->p_clk                                          (signal_clk); | 
|---|
| 1249 | fbuf->p_resetn                                       (signal_resetn); | 
|---|
| 1250 | fbuf->p_vci                                          (signal_vci_tgt_fbuf); | 
|---|
| 1251 |  | 
|---|
| 1252 | std::cout << "  - FBUF connected" << std::endl; | 
|---|
| 1253 |  | 
|---|
| 1254 | // MNIC connexion | 
|---|
| 1255 | mnic->p_clk                                          (signal_clk); | 
|---|
| 1256 | mnic->p_resetn                                       (signal_resetn); | 
|---|
| 1257 | mnic->p_vci                                          (signal_vci_tgt_mnic); | 
|---|
| 1258 | for ( size_t i=0 ; i<NB_NIC_CHANNELS ; i++ ) | 
|---|
| 1259 | { | 
|---|
| 1260 | mnic->p_rx_irq[i]                               (signal_irq_mnic_rx[i]); | 
|---|
| 1261 | mnic->p_tx_irq[i]                               (signal_irq_mnic_tx[i]); | 
|---|
| 1262 | } | 
|---|
| 1263 |  | 
|---|
| 1264 | std::cout << "  - MNIC connected" << std::endl; | 
|---|
| 1265 |  | 
|---|
| 1266 | // MTTY connexion | 
|---|
| 1267 | mtty->p_clk                                          (signal_clk); | 
|---|
| 1268 | mtty->p_resetn                                       (signal_resetn); | 
|---|
| 1269 | mtty->p_vci                                          (signal_vci_tgt_mtty); | 
|---|
| 1270 | for ( size_t i=0 ; i<NB_TTY_CHANNELS ; i++ ) | 
|---|
| 1271 | { | 
|---|
| 1272 | mtty->p_irq[i]                                   (signal_irq_mtty_rx[i]); | 
|---|
| 1273 | } | 
|---|
| 1274 | std::cout << "  - MTTY connected" << std::endl; | 
|---|
| 1275 |  | 
|---|
| 1276 | // CDMA connexion | 
|---|
| 1277 | cdma->p_clk                                          (signal_clk); | 
|---|
| 1278 | cdma->p_resetn                                       (signal_resetn); | 
|---|
| 1279 | cdma->p_vci_target                                   (signal_vci_tgt_cdma); | 
|---|
| 1280 | cdma->p_vci_initiator                                (signal_vci_ini_cdma); | 
|---|
| 1281 | for ( size_t i=0 ; i<(NB_NIC_CHANNELS*2) ; i++) | 
|---|
| 1282 | { | 
|---|
| 1283 | cdma->p_irq[i]                                   (signal_irq_cdma[i]); | 
|---|
| 1284 | } | 
|---|
| 1285 |  | 
|---|
| 1286 | std::cout << "  - CDMA connected" << std::endl; | 
|---|
| 1287 |  | 
|---|
| 1288 | // IOPI connexion | 
|---|
| 1289 | iopi->p_clk                                          (signal_clk); | 
|---|
| 1290 | iopi->p_resetn                                       (signal_resetn); | 
|---|
| 1291 | iopi->p_vci_target                                   (signal_vci_tgt_iopi); | 
|---|
| 1292 | iopi->p_vci_initiator                                (signal_vci_ini_iopi); | 
|---|
| 1293 | for ( size_t i=0 ; i<32 ; i++) | 
|---|
| 1294 | { | 
|---|
| 1295 | if     (i < NB_NIC_CHANNELS)    iopi->p_hwi[i] (signal_irq_mnic_rx[i]); | 
|---|
| 1296 | else if(i < 2 )                 iopi->p_hwi[i] (signal_irq_false); | 
|---|
| 1297 | else if(i < 2+NB_NIC_CHANNELS)  iopi->p_hwi[i] (signal_irq_mnic_tx[i-2]); | 
|---|
| 1298 | else if(i < 4 )                 iopi->p_hwi[i] (signal_irq_false); | 
|---|
| 1299 | else if(i < 4+NB_CMA_CHANNELS)  iopi->p_hwi[i] (signal_irq_cdma[i-4]); | 
|---|
| 1300 | else if(i < 8)                  iopi->p_hwi[i] (signal_irq_false); | 
|---|
| 1301 | else if(i < 9)                  iopi->p_hwi[i] (signal_irq_bdev); | 
|---|
| 1302 | else if(i < 16)                 iopi->p_hwi[i] (signal_irq_false); | 
|---|
| 1303 | else if(i < 16+NB_TTY_CHANNELS) iopi->p_hwi[i] (signal_irq_mtty_rx[i-16]); | 
|---|
| 1304 | else                            iopi->p_hwi[i] (signal_irq_false); | 
|---|
| 1305 | } | 
|---|
| 1306 |  | 
|---|
| 1307 | std::cout << "  - IOPIC connected" << std::endl; | 
|---|
| 1308 |  | 
|---|
| 1309 | // Simhelper connexion | 
|---|
| 1310 | simh->p_clk(signal_clk); | 
|---|
| 1311 | simh->p_resetn(signal_resetn); | 
|---|
| 1312 | simh->p_vci(signal_vci_tgt_simh); | 
|---|
| 1313 |  | 
|---|
| 1314 | // External ROM connexion | 
|---|
| 1315 | rom->p_clk(signal_clk); | 
|---|
| 1316 | rom->p_resetn(signal_resetn); | 
|---|
| 1317 | rom->p_vci(signal_vci_tgt_rom); | 
|---|
| 1318 |  | 
|---|
| 1319 | // IOB0 cluster connexion to IOX network | 
|---|
| 1320 | (*clusters[0][0]->p_vci_iob_iox_ini) (signal_vci_ini_iob0); | 
|---|
| 1321 | (*clusters[0][0]->p_vci_iob_iox_tgt) (signal_vci_tgt_iob0); | 
|---|
| 1322 |  | 
|---|
| 1323 | // IOB1 cluster connexion to IOX network | 
|---|
| 1324 | // (only when there is more than 1 cluster) | 
|---|
| 1325 | if ( cluster_iob0 != cluster_iob1 ) | 
|---|
| 1326 | { | 
|---|
| 1327 | (*clusters[X_SIZE-1][Y_SIZE-1]->p_vci_iob_iox_ini) (signal_vci_ini_iob1); | 
|---|
| 1328 | (*clusters[X_SIZE-1][Y_SIZE-1]->p_vci_iob_iox_tgt) (signal_vci_tgt_iob1); | 
|---|
| 1329 | } | 
|---|
| 1330 |  | 
|---|
| 1331 | // All clusters Clock & RESET connexions | 
|---|
| 1332 | for ( size_t x = 0; x < (X_SIZE); x++ ) | 
|---|
| 1333 | { | 
|---|
| 1334 | for (size_t y = 0; y < Y_SIZE; y++) | 
|---|
| 1335 | { | 
|---|
| 1336 | clusters[x][y]->p_clk     (signal_clk); | 
|---|
| 1337 | clusters[x][y]->p_resetn  (signal_resetn); | 
|---|
| 1338 | } | 
|---|
| 1339 | } | 
|---|
| 1340 |  | 
|---|
| 1341 | // Inter Clusters horizontal connections | 
|---|
| 1342 | if (X_SIZE > 1) | 
|---|
| 1343 | { | 
|---|
| 1344 | for (size_t x = 0; x < (X_SIZE-1); x++) | 
|---|
| 1345 | { | 
|---|
| 1346 | for (size_t y = 0; y < Y_SIZE; y++) | 
|---|
| 1347 | { | 
|---|
| 1348 | for (size_t k = 0; k < 3; k++) | 
|---|
| 1349 | { | 
|---|
| 1350 | clusters[x][y]->p_dspin_int_cmd_out[EAST][k]      (signal_dspin_int_cmd_h_inc[x][y][k]); | 
|---|
| 1351 | clusters[x+1][y]->p_dspin_int_cmd_in[WEST][k]     (signal_dspin_int_cmd_h_inc[x][y][k]); | 
|---|
| 1352 | clusters[x][y]->p_dspin_int_cmd_in[EAST][k]       (signal_dspin_int_cmd_h_dec[x][y][k]); | 
|---|
| 1353 | clusters[x+1][y]->p_dspin_int_cmd_out[WEST][k]    (signal_dspin_int_cmd_h_dec[x][y][k]); | 
|---|
| 1354 | } | 
|---|
| 1355 |  | 
|---|
| 1356 | for (size_t k = 0; k < 2; k++) | 
|---|
| 1357 | { | 
|---|
| 1358 | clusters[x][y]->p_dspin_int_rsp_out[EAST][k]      (signal_dspin_int_rsp_h_inc[x][y][k]); | 
|---|
| 1359 | clusters[x+1][y]->p_dspin_int_rsp_in[WEST][k]     (signal_dspin_int_rsp_h_inc[x][y][k]); | 
|---|
| 1360 | clusters[x][y]->p_dspin_int_rsp_in[EAST][k]       (signal_dspin_int_rsp_h_dec[x][y][k]); | 
|---|
| 1361 | clusters[x+1][y]->p_dspin_int_rsp_out[WEST][k]    (signal_dspin_int_rsp_h_dec[x][y][k]); | 
|---|
| 1362 | } | 
|---|
| 1363 |  | 
|---|
| 1364 | clusters[x][y]->p_dspin_ram_cmd_out[EAST]      (signal_dspin_ram_cmd_h_inc[x][y]); | 
|---|
| 1365 | clusters[x+1][y]->p_dspin_ram_cmd_in[WEST]     (signal_dspin_ram_cmd_h_inc[x][y]); | 
|---|
| 1366 | clusters[x][y]->p_dspin_ram_cmd_in[EAST]       (signal_dspin_ram_cmd_h_dec[x][y]); | 
|---|
| 1367 | clusters[x+1][y]->p_dspin_ram_cmd_out[WEST]    (signal_dspin_ram_cmd_h_dec[x][y]); | 
|---|
| 1368 | clusters[x][y]->p_dspin_ram_rsp_out[EAST]      (signal_dspin_ram_rsp_h_inc[x][y]); | 
|---|
| 1369 | clusters[x+1][y]->p_dspin_ram_rsp_in[WEST]     (signal_dspin_ram_rsp_h_inc[x][y]); | 
|---|
| 1370 | clusters[x][y]->p_dspin_ram_rsp_in[EAST]       (signal_dspin_ram_rsp_h_dec[x][y]); | 
|---|
| 1371 | clusters[x+1][y]->p_dspin_ram_rsp_out[WEST]    (signal_dspin_ram_rsp_h_dec[x][y]); | 
|---|
| 1372 | } | 
|---|
| 1373 | } | 
|---|
| 1374 | } | 
|---|
| 1375 |  | 
|---|
| 1376 | std::cout << std::endl << "Horizontal connections established" << std::endl; | 
|---|
| 1377 |  | 
|---|
| 1378 | // Inter Clusters vertical connections | 
|---|
| 1379 | if (Y_SIZE > 1) | 
|---|
| 1380 | { | 
|---|
| 1381 | for (size_t y = 0; y < (Y_SIZE-1); y++) | 
|---|
| 1382 | { | 
|---|
| 1383 | for (size_t x = 0; x < X_SIZE; x++) | 
|---|
| 1384 | { | 
|---|
| 1385 | for (size_t k = 0; k < 3; k++) | 
|---|
| 1386 | { | 
|---|
| 1387 | clusters[x][y]->p_dspin_int_cmd_out[NORTH][k]     (signal_dspin_int_cmd_v_inc[x][y][k]); | 
|---|
| 1388 | clusters[x][y+1]->p_dspin_int_cmd_in[SOUTH][k]    (signal_dspin_int_cmd_v_inc[x][y][k]); | 
|---|
| 1389 | clusters[x][y]->p_dspin_int_cmd_in[NORTH][k]      (signal_dspin_int_cmd_v_dec[x][y][k]); | 
|---|
| 1390 | clusters[x][y+1]->p_dspin_int_cmd_out[SOUTH][k]   (signal_dspin_int_cmd_v_dec[x][y][k]); | 
|---|
| 1391 | } | 
|---|
| 1392 |  | 
|---|
| 1393 | for (size_t k = 0; k < 2; k++) | 
|---|
| 1394 | { | 
|---|
| 1395 | clusters[x][y]->p_dspin_int_rsp_out[NORTH][k]     (signal_dspin_int_rsp_v_inc[x][y][k]); | 
|---|
| 1396 | clusters[x][y+1]->p_dspin_int_rsp_in[SOUTH][k]    (signal_dspin_int_rsp_v_inc[x][y][k]); | 
|---|
| 1397 | clusters[x][y]->p_dspin_int_rsp_in[NORTH][k]      (signal_dspin_int_rsp_v_dec[x][y][k]); | 
|---|
| 1398 | clusters[x][y+1]->p_dspin_int_rsp_out[SOUTH][k]   (signal_dspin_int_rsp_v_dec[x][y][k]); | 
|---|
| 1399 | } | 
|---|
| 1400 |  | 
|---|
| 1401 | clusters[x][y]->p_dspin_ram_cmd_out[NORTH]     (signal_dspin_ram_cmd_v_inc[x][y]); | 
|---|
| 1402 | clusters[x][y+1]->p_dspin_ram_cmd_in[SOUTH]    (signal_dspin_ram_cmd_v_inc[x][y]); | 
|---|
| 1403 | clusters[x][y]->p_dspin_ram_cmd_in[NORTH]      (signal_dspin_ram_cmd_v_dec[x][y]); | 
|---|
| 1404 | clusters[x][y+1]->p_dspin_ram_cmd_out[SOUTH]   (signal_dspin_ram_cmd_v_dec[x][y]); | 
|---|
| 1405 | clusters[x][y]->p_dspin_ram_rsp_out[NORTH]     (signal_dspin_ram_rsp_v_inc[x][y]); | 
|---|
| 1406 | clusters[x][y+1]->p_dspin_ram_rsp_in[SOUTH]    (signal_dspin_ram_rsp_v_inc[x][y]); | 
|---|
| 1407 | clusters[x][y]->p_dspin_ram_rsp_in[NORTH]      (signal_dspin_ram_rsp_v_dec[x][y]); | 
|---|
| 1408 | clusters[x][y+1]->p_dspin_ram_rsp_out[SOUTH]   (signal_dspin_ram_rsp_v_dec[x][y]); | 
|---|
| 1409 | } | 
|---|
| 1410 | } | 
|---|
| 1411 | } | 
|---|
| 1412 |  | 
|---|
| 1413 | std::cout << "Vertical connections established" << std::endl; | 
|---|
| 1414 |  | 
|---|
| 1415 | // East & West boundary cluster connections | 
|---|
| 1416 | for (size_t y = 0; y < Y_SIZE; y++) | 
|---|
| 1417 | { | 
|---|
| 1418 | for (size_t k = 0; k < 3; k++) | 
|---|
| 1419 | { | 
|---|
| 1420 | clusters[0][y]->p_dspin_int_cmd_in[WEST][k]          (signal_dspin_false_int_cmd_in[0][y][WEST][k]); | 
|---|
| 1421 | clusters[0][y]->p_dspin_int_cmd_out[WEST][k]         (signal_dspin_false_int_cmd_out[0][y][WEST][k]); | 
|---|
| 1422 | clusters[X_SIZE-1][y]->p_dspin_int_cmd_in[EAST][k]   (signal_dspin_false_int_cmd_in[X_SIZE-1][y][EAST][k]); | 
|---|
| 1423 | clusters[X_SIZE-1][y]->p_dspin_int_cmd_out[EAST][k]  (signal_dspin_false_int_cmd_out[X_SIZE-1][y][EAST][k]); | 
|---|
| 1424 | } | 
|---|
| 1425 |  | 
|---|
| 1426 | for (size_t k = 0; k < 2; k++) | 
|---|
| 1427 | { | 
|---|
| 1428 | clusters[0][y]->p_dspin_int_rsp_in[WEST][k]          (signal_dspin_false_int_rsp_in[0][y][WEST][k]); | 
|---|
| 1429 | clusters[0][y]->p_dspin_int_rsp_out[WEST][k]         (signal_dspin_false_int_rsp_out[0][y][WEST][k]); | 
|---|
| 1430 | clusters[X_SIZE-1][y]->p_dspin_int_rsp_in[EAST][k]   (signal_dspin_false_int_rsp_in[X_SIZE-1][y][EAST][k]); | 
|---|
| 1431 | clusters[X_SIZE-1][y]->p_dspin_int_rsp_out[EAST][k]  (signal_dspin_false_int_rsp_out[X_SIZE-1][y][EAST][k]); | 
|---|
| 1432 | } | 
|---|
| 1433 |  | 
|---|
| 1434 | clusters[0][y]->p_dspin_ram_cmd_in[WEST]       (signal_dspin_false_ram_cmd_in[0][y][WEST]); | 
|---|
| 1435 | clusters[0][y]->p_dspin_ram_cmd_out[WEST]      (signal_dspin_false_ram_cmd_out[0][y][WEST]); | 
|---|
| 1436 | clusters[0][y]->p_dspin_ram_rsp_in[WEST]       (signal_dspin_false_ram_rsp_in[0][y][WEST]); | 
|---|
| 1437 | clusters[0][y]->p_dspin_ram_rsp_out[WEST]      (signal_dspin_false_ram_rsp_out[0][y][WEST]); | 
|---|
| 1438 |  | 
|---|
| 1439 | clusters[X_SIZE-1][y]->p_dspin_ram_cmd_in[EAST]  (signal_dspin_false_ram_cmd_in[X_SIZE-1][y][EAST]); | 
|---|
| 1440 | clusters[X_SIZE-1][y]->p_dspin_ram_cmd_out[EAST] (signal_dspin_false_ram_cmd_out[X_SIZE-1][y][EAST]); | 
|---|
| 1441 | clusters[X_SIZE-1][y]->p_dspin_ram_rsp_in[EAST]  (signal_dspin_false_ram_rsp_in[X_SIZE-1][y][EAST]); | 
|---|
| 1442 | clusters[X_SIZE-1][y]->p_dspin_ram_rsp_out[EAST] (signal_dspin_false_ram_rsp_out[X_SIZE-1][y][EAST]); | 
|---|
| 1443 | } | 
|---|
| 1444 |  | 
|---|
| 1445 | std::cout << "East & West boundaries established" << std::endl; | 
|---|
| 1446 |  | 
|---|
| 1447 | // North & South boundary clusters connections | 
|---|
| 1448 | for (size_t x = 0; x < X_SIZE; x++) | 
|---|
| 1449 | { | 
|---|
| 1450 | for (size_t k = 0; k < 3; k++) | 
|---|
| 1451 | { | 
|---|
| 1452 | clusters[x][0]->p_dspin_int_cmd_in[SOUTH][k]         (signal_dspin_false_int_cmd_in[x][0][SOUTH][k]); | 
|---|
| 1453 | clusters[x][0]->p_dspin_int_cmd_out[SOUTH][k]        (signal_dspin_false_int_cmd_out[x][0][SOUTH][k]); | 
|---|
| 1454 | clusters[x][Y_SIZE-1]->p_dspin_int_cmd_in[NORTH][k]  (signal_dspin_false_int_cmd_in[x][Y_SIZE-1][NORTH][k]); | 
|---|
| 1455 | clusters[x][Y_SIZE-1]->p_dspin_int_cmd_out[NORTH][k] (signal_dspin_false_int_cmd_out[x][Y_SIZE-1][NORTH][k]); | 
|---|
| 1456 | } | 
|---|
| 1457 |  | 
|---|
| 1458 | for (size_t k = 0; k < 2; k++) | 
|---|
| 1459 | { | 
|---|
| 1460 | clusters[x][0]->p_dspin_int_rsp_in[SOUTH][k]         (signal_dspin_false_int_rsp_in[x][0][SOUTH][k]); | 
|---|
| 1461 | clusters[x][0]->p_dspin_int_rsp_out[SOUTH][k]        (signal_dspin_false_int_rsp_out[x][0][SOUTH][k]); | 
|---|
| 1462 | clusters[x][Y_SIZE-1]->p_dspin_int_rsp_in[NORTH][k]  (signal_dspin_false_int_rsp_in[x][Y_SIZE-1][NORTH][k]); | 
|---|
| 1463 | clusters[x][Y_SIZE-1]->p_dspin_int_rsp_out[NORTH][k] (signal_dspin_false_int_rsp_out[x][Y_SIZE-1][NORTH][k]); | 
|---|
| 1464 | } | 
|---|
| 1465 |  | 
|---|
| 1466 | clusters[x][0]->p_dspin_ram_cmd_in[SOUTH]       (signal_dspin_false_ram_cmd_in[x][0][SOUTH]); | 
|---|
| 1467 | clusters[x][0]->p_dspin_ram_cmd_out[SOUTH]      (signal_dspin_false_ram_cmd_out[x][0][SOUTH]); | 
|---|
| 1468 | clusters[x][0]->p_dspin_ram_rsp_in[SOUTH]       (signal_dspin_false_ram_rsp_in[x][0][SOUTH]); | 
|---|
| 1469 | clusters[x][0]->p_dspin_ram_rsp_out[SOUTH]      (signal_dspin_false_ram_rsp_out[x][0][SOUTH]); | 
|---|
| 1470 |  | 
|---|
| 1471 | clusters[x][Y_SIZE-1]->p_dspin_ram_cmd_in[NORTH]  (signal_dspin_false_ram_cmd_in[x][Y_SIZE-1][NORTH]); | 
|---|
| 1472 | clusters[x][Y_SIZE-1]->p_dspin_ram_cmd_out[NORTH] (signal_dspin_false_ram_cmd_out[x][Y_SIZE-1][NORTH]); | 
|---|
| 1473 | clusters[x][Y_SIZE-1]->p_dspin_ram_rsp_in[NORTH]  (signal_dspin_false_ram_rsp_in[x][Y_SIZE-1][NORTH]); | 
|---|
| 1474 | clusters[x][Y_SIZE-1]->p_dspin_ram_rsp_out[NORTH] (signal_dspin_false_ram_rsp_out[x][Y_SIZE-1][NORTH]); | 
|---|
| 1475 | } | 
|---|
| 1476 |  | 
|---|
| 1477 | std::cout << "North & South boundaries established" << std::endl << std::endl; | 
|---|
| 1478 |  | 
|---|
| 1479 | //////////////////////////////////////////////////////// | 
|---|
| 1480 | //   Simulation | 
|---|
| 1481 | /////////////////////////////////////////////////////// | 
|---|
| 1482 |  | 
|---|
| 1483 | sc_start(sc_core::sc_time(0, SC_NS)); | 
|---|
| 1484 |  | 
|---|
| 1485 | signal_resetn = false; | 
|---|
| 1486 | signal_irq_false = false; | 
|---|
| 1487 |  | 
|---|
| 1488 | // network boundaries signals | 
|---|
| 1489 | for (size_t x = 0; x < X_SIZE ; x++) | 
|---|
| 1490 | { | 
|---|
| 1491 | for (size_t y = 0; y < Y_SIZE ; y++) | 
|---|
| 1492 | { | 
|---|
| 1493 | for (size_t a = 0; a < 4; a++) | 
|---|
| 1494 | { | 
|---|
| 1495 | for (size_t k = 0; k < 3; k++) | 
|---|
| 1496 | { | 
|---|
| 1497 | signal_dspin_false_int_cmd_in[x][y][a][k].write = false; | 
|---|
| 1498 | signal_dspin_false_int_cmd_in[x][y][a][k].read = true; | 
|---|
| 1499 | signal_dspin_false_int_cmd_out[x][y][a][k].write = false; | 
|---|
| 1500 | signal_dspin_false_int_cmd_out[x][y][a][k].read = true; | 
|---|
| 1501 | } | 
|---|
| 1502 |  | 
|---|
| 1503 | for (size_t k = 0; k < 2; k++) | 
|---|
| 1504 | { | 
|---|
| 1505 | signal_dspin_false_int_rsp_in[x][y][a][k].write = false; | 
|---|
| 1506 | signal_dspin_false_int_rsp_in[x][y][a][k].read = true; | 
|---|
| 1507 | signal_dspin_false_int_rsp_out[x][y][a][k].write = false; | 
|---|
| 1508 | signal_dspin_false_int_rsp_out[x][y][a][k].read = true; | 
|---|
| 1509 | } | 
|---|
| 1510 |  | 
|---|
| 1511 | signal_dspin_false_ram_cmd_in[x][y][a].write = false; | 
|---|
| 1512 | signal_dspin_false_ram_cmd_in[x][y][a].read = true; | 
|---|
| 1513 | signal_dspin_false_ram_cmd_out[x][y][a].write = false; | 
|---|
| 1514 | signal_dspin_false_ram_cmd_out[x][y][a].read = true; | 
|---|
| 1515 |  | 
|---|
| 1516 | signal_dspin_false_ram_rsp_in[x][y][a].write = false; | 
|---|
| 1517 | signal_dspin_false_ram_rsp_in[x][y][a].read = true; | 
|---|
| 1518 | signal_dspin_false_ram_rsp_out[x][y][a].write = false; | 
|---|
| 1519 | signal_dspin_false_ram_rsp_out[x][y][a].read = true; | 
|---|
| 1520 | } | 
|---|
| 1521 | } | 
|---|
| 1522 | } | 
|---|
| 1523 |  | 
|---|
| 1524 | sc_start(sc_core::sc_time(1, SC_NS)); | 
|---|
| 1525 | signal_resetn = true; | 
|---|
| 1526 |  | 
|---|
| 1527 | // simulation loop | 
|---|
| 1528 | struct timeval t1, t2; | 
|---|
| 1529 |  | 
|---|
| 1530 | // cycles between stats | 
|---|
| 1531 | const size_t stats_period = 150000; | 
|---|
| 1532 | const size_t simul_period = debug_ok ? debug_period : stats_period; | 
|---|
| 1533 |  | 
|---|
| 1534 | for (size_t n = 0; n < ncycles; n += simul_period) | 
|---|
| 1535 | { | 
|---|
| 1536 | // stats display | 
|---|
| 1537 | if((n % stats_period) == 0) | 
|---|
| 1538 | { | 
|---|
| 1539 | if (n > 0) | 
|---|
| 1540 | { | 
|---|
| 1541 | gettimeofday(&t2, NULL); | 
|---|
| 1542 |  | 
|---|
| 1543 | uint64_t ms1 = (uint64_t) t1.tv_sec  * 1000ULL + | 
|---|
| 1544 | (uint64_t) t1.tv_usec / 1000; | 
|---|
| 1545 | uint64_t ms2 = (uint64_t) t2.tv_sec  * 1000ULL + | 
|---|
| 1546 | (uint64_t) t2.tv_usec / 1000; | 
|---|
| 1547 | std::cerr << "### cycle = " << std::dec << n << " / frequency (Khz) = " | 
|---|
| 1548 | << (double) stats_period / (double) (ms2 - ms1) << std::endl; | 
|---|
| 1549 | } | 
|---|
| 1550 |  | 
|---|
| 1551 | gettimeofday(&t1, NULL); | 
|---|
| 1552 | } | 
|---|
| 1553 |  | 
|---|
| 1554 | // Monitor a specific address for one L1 cache | 
|---|
| 1555 | // clusters[1][1]->proc[0]->cache_monitor(0x50090ULL); | 
|---|
| 1556 |  | 
|---|
| 1557 | // Monitor a specific address for one L2 cache | 
|---|
| 1558 | // clusters[0][0]->memc->cache_monitor( 0x170000ULL); | 
|---|
| 1559 |  | 
|---|
| 1560 | // Monitor a specific address for one XRAM | 
|---|
| 1561 | // if (n == 3000000) clusters[0][0]->xram->start_monitor( 0x170000ULL , 64); | 
|---|
| 1562 |  | 
|---|
| 1563 | if (debug_ok and (n > debug_from) and (n % debug_period == 0)) | 
|---|
| 1564 | { | 
|---|
| 1565 | std::cout << "****************** cycle " << std::dec << n ; | 
|---|
| 1566 | std::cout << " ************************************************" << std::endl; | 
|---|
| 1567 |  | 
|---|
| 1568 | #if 0 | 
|---|
| 1569 | for (int x = 0; x < X_SIZE; ++x) | 
|---|
| 1570 | { | 
|---|
| 1571 | for (int y = 0; y < Y_SIZE; ++y) | 
|---|
| 1572 | { | 
|---|
| 1573 | clusters[x][y]->int_router_cmd[0]->print_trace(); | 
|---|
| 1574 | clusters[x][y]->int_router_rsp[0]->print_trace(); | 
|---|
| 1575 | } | 
|---|
| 1576 | } | 
|---|
| 1577 | #endif | 
|---|
| 1578 |  | 
|---|
| 1579 | // trace proc[debug_proc_id] | 
|---|
| 1580 | if ( debug_proc_id != 0xFFFFFFFF ) | 
|---|
| 1581 | { | 
|---|
| 1582 | size_t l          = debug_proc_id & ((1 << P_WIDTH) - 1); | 
|---|
| 1583 | size_t cluster_xy = debug_proc_id >> P_WIDTH ; | 
|---|
| 1584 | size_t x          = cluster_xy >> Y_WIDTH; | 
|---|
| 1585 | size_t y          = cluster_xy & ((1 << Y_WIDTH) - 1); | 
|---|
| 1586 |  | 
|---|
| 1587 | clusters[x][y]->proc[l]->print_trace(1); | 
|---|
| 1588 | std::ostringstream proc_signame; | 
|---|
| 1589 | proc_signame << "[SIG]PROC_" << x << "_" << y << "_" << l ; | 
|---|
| 1590 | clusters[x][y]->signal_int_vci_ini_proc[l].print_trace(proc_signame.str()); | 
|---|
| 1591 |  | 
|---|
| 1592 | clusters[x][y]->xicu->print_trace(l); | 
|---|
| 1593 | std::ostringstream xicu_signame; | 
|---|
| 1594 | xicu_signame << "[SIG]XICU_" << x << "_" << y; | 
|---|
| 1595 | clusters[x][y]->signal_int_vci_tgt_xicu.print_trace(xicu_signame.str()); | 
|---|
| 1596 |  | 
|---|
| 1597 | //              clusters[x][y]->mdma->print_trace(); | 
|---|
| 1598 | //              std::ostringstream mdma_signame; | 
|---|
| 1599 | //              mdma_signame << "[SIG]MDMA_" << x << "_" << y; | 
|---|
| 1600 | //              clusters[x][y]->signal_int_vci_tgt_mdma.print_trace(mdma_signame.str()); | 
|---|
| 1601 |  | 
|---|
| 1602 | if( clusters[x][y]->signal_proc_it[l].read() ) | 
|---|
| 1603 | std::cout << "### IRQ_PROC_" << std::dec | 
|---|
| 1604 | << x << "_" << y << "_" << l << " ACTIVE" << std::endl; | 
|---|
| 1605 | } | 
|---|
| 1606 |  | 
|---|
| 1607 | // trace memc[debug_memc_id] | 
|---|
| 1608 | if ( debug_memc_id != 0xFFFFFFFF ) | 
|---|
| 1609 | { | 
|---|
| 1610 | size_t x = debug_memc_id >> Y_WIDTH; | 
|---|
| 1611 | size_t y = debug_memc_id & ((1 << Y_WIDTH) - 1); | 
|---|
| 1612 |  | 
|---|
| 1613 | clusters[x][y]->memc->print_trace(0); | 
|---|
| 1614 | std::ostringstream smemc_tgt; | 
|---|
| 1615 | smemc_tgt << "[SIG]MEMC_TGT_" << x << "_" << y; | 
|---|
| 1616 | clusters[x][y]->signal_int_vci_tgt_memc.print_trace(smemc_tgt.str()); | 
|---|
| 1617 | std::ostringstream smemc_ini; | 
|---|
| 1618 | smemc_ini << "[SIG]MEMC_INI_" << x << "_" << y; | 
|---|
| 1619 | clusters[x][y]->signal_ram_vci_ini_memc.print_trace(smemc_ini.str()); | 
|---|
| 1620 |  | 
|---|
| 1621 | clusters[x][y]->xram->print_trace(); | 
|---|
| 1622 | std::ostringstream sxram_tgt; | 
|---|
| 1623 | sxram_tgt << "[SIG]XRAM_TGT_" << x << "_" << y; | 
|---|
| 1624 | clusters[x][y]->signal_ram_vci_tgt_xram.print_trace(sxram_tgt.str()); | 
|---|
| 1625 | } | 
|---|
| 1626 |  | 
|---|
| 1627 |  | 
|---|
| 1628 | // trace XRAM and XRAM network routers in cluster[debug_xram_id] | 
|---|
| 1629 | if ( debug_xram_id != 0xFFFFFFFF ) | 
|---|
| 1630 | { | 
|---|
| 1631 | size_t x = debug_xram_id >> Y_WIDTH; | 
|---|
| 1632 | size_t y = debug_xram_id & ((1 << Y_WIDTH) - 1); | 
|---|
| 1633 |  | 
|---|
| 1634 | clusters[x][y]->xram->print_trace(); | 
|---|
| 1635 | std::ostringstream sxram_tgt; | 
|---|
| 1636 | sxram_tgt << "[SIG]XRAM_TGT_" << x << "_" << y; | 
|---|
| 1637 | clusters[x][y]->signal_ram_vci_tgt_xram.print_trace(sxram_tgt.str()); | 
|---|
| 1638 |  | 
|---|
| 1639 | clusters[x][y]->ram_router_cmd->print_trace(); | 
|---|
| 1640 | clusters[x][y]->ram_router_rsp->print_trace(); | 
|---|
| 1641 | } | 
|---|
| 1642 |  | 
|---|
| 1643 | // trace iob, iox and external peripherals | 
|---|
| 1644 | if ( debug_iob ) | 
|---|
| 1645 | { | 
|---|
| 1646 | clusters[0][0]->iob->print_trace(); | 
|---|
| 1647 | clusters[X_SIZE-1][Y_SIZE-1]->iob->print_trace(); | 
|---|
| 1648 | //              clusters[0][0]->signal_int_vci_tgt_iobx.print_trace( "[SIG]IOB0_INT_TGT"); | 
|---|
| 1649 | //              clusters[0][0]->signal_int_vci_ini_iobx.print_trace( "[SIG]IOB0_INT_INI"); | 
|---|
| 1650 | //              clusters[0][0]->signal_ram_vci_ini_iobx.print_trace( "[SIG]IOB0_RAM_INI"); | 
|---|
| 1651 |  | 
|---|
| 1652 | signal_vci_ini_iob0.print_trace("[SIG]IOB0_IOX_INI"); | 
|---|
| 1653 | signal_vci_tgt_iob0.print_trace("[SIG]IOB0_IOX_TGT"); | 
|---|
| 1654 |  | 
|---|
| 1655 | //              cdma->print_trace(); | 
|---|
| 1656 | //              signal_vci_tgt_cdma.print_trace("[SIG]IOX_CDMA_TGT"); | 
|---|
| 1657 | //              signal_vci_ini_cdma.print_trace("[SIG]IOX_CDMA_INI"); | 
|---|
| 1658 |  | 
|---|
| 1659 | //              mtty->print_trace(); | 
|---|
| 1660 | //              signal_vci_tgt_mtty.print_trace("[SIG]IOX_MTTY_TGT"); | 
|---|
| 1661 |  | 
|---|
| 1662 | bdev->print_trace(); | 
|---|
| 1663 | signal_vci_tgt_bdev.print_trace("[SIG]BDEV_TGT"); | 
|---|
| 1664 | signal_vci_ini_bdev.print_trace("[SIG]BDEV_INI"); | 
|---|
| 1665 |  | 
|---|
| 1666 | mnic->print_trace(); | 
|---|
| 1667 | signal_vci_tgt_mnic.print_trace("[SIG]MNIC_TGT"); | 
|---|
| 1668 |  | 
|---|
| 1669 | //              fbuf->print_trace(); | 
|---|
| 1670 | //              signal_vci_tgt_fbuf.print_trace("[SIG]FBUF"); | 
|---|
| 1671 |  | 
|---|
| 1672 | iopi->print_trace(); | 
|---|
| 1673 | signal_vci_ini_iopi.print_trace("[SIG]IOPI_INI"); | 
|---|
| 1674 | signal_vci_tgt_iopi.print_trace("[SIG]IOPI_TGT"); | 
|---|
| 1675 |  | 
|---|
| 1676 | signal_vci_tgt_simh.print_trace("[SIG]SIMH_TGT"); | 
|---|
| 1677 |  | 
|---|
| 1678 | iox_network->print_trace(); | 
|---|
| 1679 |  | 
|---|
| 1680 | // interrupts | 
|---|
| 1681 | if (signal_irq_bdev)       std::cout << "### IRQ_BDEV ACTIVE"       << std::endl; | 
|---|
| 1682 | if (signal_irq_mtty_rx[0]) std::cout << "### IRQ_MTTY ACTIVE"       << std::endl; | 
|---|
| 1683 | if (signal_irq_mnic_rx[0]) std::cout << "### IRQ_MNIC_RX[0] ACTIVE" << std::endl; | 
|---|
| 1684 | if (signal_irq_mnic_rx[1]) std::cout << "### IRQ_MNIC_RX[1] ACTIVE" << std::endl; | 
|---|
| 1685 | if (signal_irq_mnic_tx[0]) std::cout << "### IRQ_MNIC_TX[0] ACTIVE" << std::endl; | 
|---|
| 1686 | if (signal_irq_mnic_tx[1]) std::cout << "### IRQ_MNIC_TX[1] ACTIVE" << std::endl; | 
|---|
| 1687 | } | 
|---|
| 1688 | } | 
|---|
| 1689 |  | 
|---|
| 1690 | sc_start(sc_core::sc_time(simul_period, SC_NS)); | 
|---|
| 1691 | } | 
|---|
| 1692 | return EXIT_SUCCESS; | 
|---|
| 1693 | } | 
|---|
| 1694 |  | 
|---|
| 1695 | int sc_main (int argc, char *argv[]) | 
|---|
| 1696 | { | 
|---|
| 1697 | try { | 
|---|
| 1698 | return _main(argc, argv); | 
|---|
| 1699 | } catch (soclib::exception::RunTimeError &e) { | 
|---|
| 1700 | std::cout << "RunTimeError: " << e.what() << std::endl; | 
|---|
| 1701 | } catch (std::exception &e) { | 
|---|
| 1702 | std::cout << e.what() << std::endl; | 
|---|
| 1703 | } catch (...) { | 
|---|
| 1704 | std::cout << "Unknown exception occured" << std::endl; | 
|---|
| 1705 | throw; | 
|---|
| 1706 | } | 
|---|
| 1707 | return 1; | 
|---|
| 1708 | } | 
|---|
| 1709 |  | 
|---|
| 1710 |  | 
|---|
| 1711 | // Local Variables: | 
|---|
| 1712 | // tab-width: 3 | 
|---|
| 1713 | // c-basic-offset: 3 | 
|---|
| 1714 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) | 
|---|
| 1715 | // indent-tabs-mode: nil | 
|---|
| 1716 | // End: | 
|---|
| 1717 |  | 
|---|
| 1718 | // vim: filetype=cpp:expandtab:shiftwidth=3:tabstop=3:softtabstop=3 | 
|---|