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