| [621] | 1 | ///////////////////////////////////////////////////////////////////////// | 
|---|
| [664] | 2 | // File: top.cpp (for tsar_generic_leti) | 
|---|
| [621] | 3 | // Author: Alain Greiner  | 
|---|
 | 4 | // Copyright: UPMC/LIP6 | 
|---|
| [628] | 5 | // Date : february 2014 | 
|---|
| [621] | 6 | // This program is released under the GNU public license | 
|---|
 | 7 | ///////////////////////////////////////////////////////////////////////// | 
|---|
| [681] | 8 | // This file define a generic TSAR architecture, fully compatible | 
|---|
 | 9 | // with the VLSI Hardware prototype developped by CEA-LETI and LIP6 | 
|---|
 | 10 | // in the framework of the SHARP project. | 
|---|
 | 11 | //  | 
|---|
| [621] | 12 | // The processor is a MIPS32 processor wrapped in a GDB server | 
|---|
 | 13 | // (this is defined in the tsar_xbar_cluster). | 
|---|
 | 14 | //  | 
|---|
| [681] | 15 | // It does not use an external ROM, as the boot code is (pre)loaded | 
|---|
 | 16 | // in cluster (0,0) memory at address 0x0. | 
|---|
| [621] | 17 | // | 
|---|
 | 18 | // The physical address space is 40 bits. | 
|---|
 | 19 | // The 8 address MSB bits define the cluster index. | 
|---|
 | 20 | // | 
|---|
| [681] | 21 | // The main hardware parameters are the mesh size (X_SIZE & Y_SIZE), | 
|---|
 | 22 | // and the number of processors per cluster (NB_PROCS_MAX). | 
|---|
 | 23 | // The number of clusters cannot be larger than 128. | 
|---|
| [621] | 24 | // The number of processors per cluster cannot be larger than 4. | 
|---|
 | 25 | //  | 
|---|
| [628] | 26 | // Each cluster contains: | 
|---|
 | 27 | // - 5 dspin_local_crossbar (local interconnect) | 
|---|
 | 28 | // - 5 dspin_router (global interconnect) | 
|---|
 | 29 | // - up to 4 vci_cc_vcache wrapping a MIPS32 processor | 
|---|
 | 30 | // - 1 vci_mem_cache | 
|---|
 | 31 | // - 1 vci_xicu | 
|---|
 | 32 | // - 1 vci_simple_ram (to model the L3 cache). | 
|---|
| [621] | 33 | // | 
|---|
| [681] | 34 | // Each processor receives 4 consecutive IRQ lines from the local XICU. | 
|---|
| [664] | 35 | // | 
|---|
| [628] | 36 | // In all clusters, the MEMC IRQ line (signaling a late write error) | 
|---|
 | 37 | // is connected to XICU HWI[8] | 
|---|
| [681] | 38 | // The cluster (0,0) contains two "backup" peripherals: | 
|---|
| [628] | 39 | // - one block device controller, whose IRQ is connected to XICU HWI[9]. | 
|---|
 | 40 | // - one single channel TTY controller, whose IRQ is connected to XICU HWI[10]. | 
|---|
| [621] | 41 | // | 
|---|
| [628] | 42 | // The cluster internal architecture is defined in file tsar_leti_cluster, | 
|---|
 | 43 | // that must be considered as an extension of this top.cpp file. | 
|---|
| [621] | 44 | // | 
|---|
| [664] | 45 | // Besides the hardware components in clusters, "external" peripherals  | 
|---|
| [628] | 46 | // are connected to an external IO bus (implemented as a vci_local_crossbar): | 
|---|
 | 47 | // - one disk controller  | 
|---|
 | 48 | // - one multi-channel ethernet controller  | 
|---|
 | 49 | // - one multi-channel chained buffer dma controller | 
|---|
 | 50 | // - one multi-channel tty controller  | 
|---|
 | 51 | // - one frame buffer controller  | 
|---|
| [664] | 52 | // - one 32 channels iopic controller | 
|---|
| [628] | 53 | // | 
|---|
 | 54 | // This IOBUS is connected to the north  port of the DIR_CMD  | 
|---|
| [681] | 55 | // and DIR_RSP routers, in cluster(X_SIZE-1, Y_SIZE-1). | 
|---|
| [628] | 56 | // For all external peripherals, the hardware interrupts (HWI) are | 
|---|
| [664] | 57 | // translated to write interrupts (WTI) by the iopic component: | 
|---|
 | 58 | // - IOPIC HWI[1:0]     connected to IRQ_NIC_RX[1:0] | 
|---|
 | 59 | // - IOPIC HWI[3:2]     connected to IRQ_NIC_TX[1:0]       | 
|---|
 | 60 | // - IOPIC HWI[7:4]     connected to IRQ_CMA_TX[3:0]] | 
|---|
 | 61 | // - IOPIC HWI[8]       connected to IRQ_BDEV | 
|---|
 | 62 | // - IOPIC HWI[15:9]    unused       (grounded) | 
|---|
 | 63 | // - IOPIC HWI[23:16]   connected to IRQ_TTY_RX[7:0]] | 
|---|
 | 64 | // - IOPIC HWI[31:24]   connected to IRQ_TTY_TX[7:0]] | 
|---|
| [628] | 65 | //////////////////////////////////////////////////////////////////////////// | 
|---|
 | 66 | // The following parameters must be defined in the hard_config.h file : | 
|---|
| [621] | 67 | // - X_WIDTH          : number of bits for x coordinate (must be 4) | 
|---|
 | 68 | // - Y_WIDTH          : number of bits for y coordinate (must be 4) | 
|---|
| [681] | 69 | // - X_SIZE           : number of clusters in a row (1,2,4,8,16) | 
|---|
 | 70 | // - Y_SIZE           : number of clusters in a column (1,2,4,8) | 
|---|
| [628] | 71 | // - NB_PROCS_MAX     : number of processors per cluster (1, 2 or 4) | 
|---|
| [664] | 72 | // - NB_CMA_CHANNELS  : number of CMA channels in I/0 cluster (4 max) | 
|---|
 | 73 | // - NB_TTY_CHANNELS  : number of TTY channels in I/O cluster (8 max) | 
|---|
| [628] | 74 | // - NB_NIC_CHANNELS  : number of NIC channels in I/O cluster (2 max) | 
|---|
| [621] | 75 | //  | 
|---|
 | 76 | // Some other hardware parameters are not used when compiling the OS, | 
|---|
| [628] | 77 | // and are only defined in this top.cpp file: | 
|---|
| [621] | 78 | // - XRAM_LATENCY     : external ram latency  | 
|---|
 | 79 | // - MEMC_WAYS        : L2 cache number of ways | 
|---|
 | 80 | // - MEMC_SETS        : L2 cache number of sets | 
|---|
| [628] | 81 | // - L1_IWAYS         : L1 cache instruction number of ways | 
|---|
 | 82 | // - L1_ISETS         : L1 cache instruction number of sets | 
|---|
 | 83 | // - L1_DWAYS         : L1 cache data number of ways | 
|---|
 | 84 | // - L1_DSETS         : L1 cache data number of sets | 
|---|
| [621] | 85 | // - FBUF_X_SIZE      : width of frame buffer (pixels) | 
|---|
 | 86 | // - FBUF_Y_SIZE      : heigth of frame buffer (lines) | 
|---|
 | 87 | // - BDEV_IMAGE_NAME  : file pathname for block device  | 
|---|
 | 88 | // - NIC_RX_NAME      : file pathname for NIC received packets | 
|---|
 | 89 | // - NIC_TX_NAME      : file pathname for NIC transmited packets | 
|---|
| [628] | 90 | // - NIC_MAC4         : MAC address | 
|---|
 | 91 | // - NIC_MAC2         : MAC address | 
|---|
| [621] | 92 | ///////////////////////////////////////////////////////////////////////// | 
|---|
 | 93 | // General policy for 40 bits physical address decoding: | 
|---|
 | 94 | // All physical segments base addresses are multiple of 1 Mbytes | 
|---|
 | 95 | // (=> the 24 LSB bits = 0, and the 16 MSB bits define the target)  | 
|---|
 | 96 | // The (X_WIDTH + Y_WIDTH) MSB bits (left aligned) define | 
|---|
 | 97 | // the cluster index, and the LADR bits define the local index: | 
|---|
 | 98 | //      |X_ID|Y_ID|  LADR |     OFFSET          | | 
|---|
 | 99 | //      |  4 |  4 |   8   |       24            | | 
|---|
 | 100 | ///////////////////////////////////////////////////////////////////////// | 
|---|
 | 101 | // General policy for 14 bits SRCID decoding: | 
|---|
 | 102 | // Each component is identified by (x_id, y_id, l_id) tuple. | 
|---|
 | 103 | //      |X_ID|Y_ID| L_ID | | 
|---|
 | 104 | //      |  4 |  4 |  6   | | 
|---|
 | 105 | ///////////////////////////////////////////////////////////////////////// | 
|---|
 | 106 |  | 
|---|
 | 107 | #include <systemc> | 
|---|
 | 108 | #include <sys/time.h> | 
|---|
 | 109 | #include <iostream> | 
|---|
 | 110 | #include <sstream> | 
|---|
 | 111 | #include <cstdlib> | 
|---|
 | 112 | #include <cstdarg> | 
|---|
 | 113 | #include <stdint.h> | 
|---|
 | 114 |  | 
|---|
 | 115 | #include "gdbserver.h" | 
|---|
 | 116 | #include "mapping_table.h" | 
|---|
 | 117 | #include "tsar_leti_cluster.h" | 
|---|
| [628] | 118 | #include "vci_local_crossbar.h" | 
|---|
 | 119 | #include "vci_dspin_initiator_wrapper.h" | 
|---|
 | 120 | #include "vci_dspin_target_wrapper.h" | 
|---|
 | 121 | #include "vci_multi_tty.h" | 
|---|
 | 122 | #include "vci_multi_nic.h" | 
|---|
 | 123 | #include "vci_chbuf_dma.h" | 
|---|
 | 124 | #include "vci_block_device_tsar.h" | 
|---|
 | 125 | #include "vci_framebuffer.h" | 
|---|
 | 126 | #include "vci_iopic.h" | 
|---|
| [621] | 127 | #include "alloc_elems.h" | 
|---|
 | 128 |  | 
|---|
| [664] | 129 | ////////////////////////////////////////////////////////////////////////////////////////// | 
|---|
 | 130 | //    Parameters depending on the OS and software application          | 
|---|
 | 131 | //    - path to hard_config file | 
|---|
 | 132 | //    - path to binary code for the RAM loader | 
|---|
 | 133 | //    - path to disk image for RAMDISK loader | 
|---|
 | 134 | //    - path to disk image for IOC device | 
|---|
 | 135 | ////////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [621] | 136 |  | 
|---|
| [664] | 137 | #define USE_GIET_VM     1 | 
|---|
 | 138 | #define USE_GIET_TSAR   0 | 
|---|
| [621] | 139 |  | 
|---|
 | 140 | #if ( USE_GIET_VM and USE_GIET_TSAR ) | 
|---|
 | 141 | #error "Can't use Two different OS" | 
|---|
 | 142 | #endif | 
|---|
 | 143 |  | 
|---|
 | 144 | #if ( (not USE_GIET_VM) and (not USE_GIET_TSAR) ) | 
|---|
 | 145 | #error "You need to specify one OS" | 
|---|
 | 146 | #endif | 
|---|
 | 147 |  | 
|---|
| [664] | 148 | #if USE_GIET_TSAR | 
|---|
| [692] | 149 | #include                         "hard_config.h" | 
|---|
| [664] | 150 | #define BINARY_PATH_FOR_LOADER   "../../softs/soft_transpose_giet/bin.soft" | 
|---|
 | 151 | #define DISK_IMAGE_PATH_FOR_IOC  "../../softs/soft_transpose_giet/images.raw" | 
|---|
| [708] | 152 | #define RAMDISK_PATH_FOR_LOADER  DISK_IMAGE_PATH_FOR_IOC "@0x00800000:" | 
|---|
| [664] | 153 | #endif | 
|---|
 | 154 |  | 
|---|
 | 155 | #if USE_GIET_VM | 
|---|
| [692] | 156 | #include                         "hard_config.h" | 
|---|
| [664] | 157 | #define BINARY_PATH_FOR_LOADER   "../../softs/tsar_boot/preloader.elf" | 
|---|
 | 158 | #define DISK_IMAGE_PATH_FOR_IOC  "../../../giet_vm/hdd/virt_hdd.dmg"         | 
|---|
| [708] | 159 | #define RAMDISK_PATH_FOR_LOADER  DISK_IMAGE_PATH_FOR_IOC "@0x02000000:" | 
|---|
| [664] | 160 | #endif | 
|---|
 | 161 |  | 
|---|
| [621] | 162 | /////////////////////////////////////////////////// | 
|---|
 | 163 | //               Parallelisation | 
|---|
 | 164 | /////////////////////////////////////////////////// | 
|---|
| [708] | 165 | #define USE_OPENMP _OPENMP | 
|---|
| [621] | 166 |  | 
|---|
 | 167 | #if USE_OPENMP | 
|---|
 | 168 | #include <omp.h> | 
|---|
 | 169 | #endif | 
|---|
 | 170 |  | 
|---|
 | 171 | /////////////////////////////////////////////////// | 
|---|
 | 172 | //  cluster index (from x,y coordinates) | 
|---|
 | 173 | /////////////////////////////////////////////////// | 
|---|
 | 174 |  | 
|---|
| [692] | 175 | #define cluster(x,y)   ((y) + ((x) << Y_WIDTH)) | 
|---|
| [621] | 176 |  | 
|---|
 | 177 | /////////////////////////////////////////////////////////// | 
|---|
 | 178 | //          DSPIN parameters            | 
|---|
 | 179 | /////////////////////////////////////////////////////////// | 
|---|
 | 180 |  | 
|---|
 | 181 | #define dspin_cmd_width      39 | 
|---|
 | 182 | #define dspin_rsp_width      32 | 
|---|
 | 183 |  | 
|---|
 | 184 | /////////////////////////////////////////////////////////// | 
|---|
 | 185 | //          VCI parameters            | 
|---|
 | 186 | /////////////////////////////////////////////////////////// | 
|---|
 | 187 |  | 
|---|
 | 188 | #define vci_cell_width_int    4 | 
|---|
 | 189 | #define vci_cell_width_ext    8 | 
|---|
 | 190 | #define vci_address_width     40 | 
|---|
 | 191 | #define vci_plen_width        8 | 
|---|
 | 192 | #define vci_rerror_width      1 | 
|---|
 | 193 | #define vci_clen_width        1 | 
|---|
 | 194 | #define vci_rflag_width       1 | 
|---|
 | 195 | #define vci_srcid_width       14 | 
|---|
 | 196 | #define vci_pktid_width       4 | 
|---|
 | 197 | #define vci_trdid_width       4 | 
|---|
 | 198 | #define vci_wrplen_width      1 | 
|---|
 | 199 |  | 
|---|
 | 200 |  | 
|---|
| [664] | 201 | ///////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [621] | 202 | //    Secondary Hardware Parameters          | 
|---|
| [664] | 203 | ///////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [621] | 204 |  | 
|---|
 | 205 | #define RESET_ADDRESS         0x0 | 
|---|
 | 206 |  | 
|---|
| [664] | 207 | #define MAX_TTY_CHANNELS      8 | 
|---|
 | 208 | #define MAX_CMA_CHANNELS      4 | 
|---|
 | 209 | #define MAX_NIC_CHANNELS      2 | 
|---|
 | 210 |  | 
|---|
| [621] | 211 | #define XRAM_LATENCY          0 | 
|---|
| [664] | 212 | #define XRAM_SIZE             0x04000000    // 64 Mbytes per cluster | 
|---|
| [621] | 213 |  | 
|---|
 | 214 | #define MEMC_WAYS             16 | 
|---|
 | 215 | #define MEMC_SETS             256 | 
|---|
 | 216 |  | 
|---|
 | 217 | #define L1_IWAYS              4 | 
|---|
 | 218 | #define L1_ISETS              64 | 
|---|
 | 219 |  | 
|---|
 | 220 | #define L1_DWAYS              4 | 
|---|
 | 221 | #define L1_DSETS              64 | 
|---|
 | 222 |  | 
|---|
 | 223 | #define FBUF_X_SIZE           128 | 
|---|
 | 224 | #define FBUF_Y_SIZE           128 | 
|---|
 | 225 |  | 
|---|
| [628] | 226 | #define NIC_MAC4              0XBABEF00D | 
|---|
 | 227 | #define NIC_MAC2              0xBEEF | 
|---|
| [708] | 228 | #define NIC_RX_NAME           "/dev/null" | 
|---|
 | 229 | #define NIC_TX_NAME           "/dev/null" | 
|---|
| [621] | 230 |  | 
|---|
 | 231 | #define NORTH                 0 | 
|---|
 | 232 | #define SOUTH                 1 | 
|---|
 | 233 | #define EAST                  2 | 
|---|
 | 234 | #define WEST                  3 | 
|---|
 | 235 |  | 
|---|
| [664] | 236 | /////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [621] | 237 | //     DEBUG Parameters default values          | 
|---|
| [664] | 238 | /////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [621] | 239 |  | 
|---|
| [681] | 240 | #define MAX_FROZEN_CYCLES     500000 | 
|---|
| [621] | 241 |  | 
|---|
| [664] | 242 | /////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [628] | 243 | //     LOCAL TGTID & SRCID definition  | 
|---|
| [621] | 244 | // For all components:  global TGTID = global SRCID = cluster_index | 
|---|
| [664] | 245 | /////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [621] | 246 |  | 
|---|
| [664] | 247 | #define MEMC_TGTID            0 | 
|---|
 | 248 | #define XICU_TGTID            1 | 
|---|
 | 249 | #define MTTY_TGTID            2 | 
|---|
 | 250 | #define BDEV_TGTID            3 | 
|---|
 | 251 | #define FBUF_TGTID            4 | 
|---|
 | 252 | #define MNIC_TGTID            5 | 
|---|
 | 253 | #define CDMA_TGTID            6 | 
|---|
 | 254 | #define IOPI_TGTID            7 | 
|---|
| [621] | 255 |  | 
|---|
| [664] | 256 | #define BDEV_SRCID            NB_PROCS_MAX | 
|---|
 | 257 | #define CDMA_SRCID            NB_PROCS_MAX + 1 | 
|---|
 | 258 | #define IOPI_SRCID            NB_PROCS_MAX + 2 | 
|---|
| [628] | 259 |  | 
|---|
| [664] | 260 | ////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [621] | 261 | //    Physical segments definition | 
|---|
| [664] | 262 | ////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [628] | 263 | // - 3 segments are replicated in all clusters | 
|---|
| [681] | 264 | // - 2 segments are only in cluster[0,0]  | 
|---|
 | 265 | // - 4 segments are only in cluster [X_SIZE-1,Y_SIZE]  | 
|---|
| [628] | 266 | // The following values are for segments in cluster 0, | 
|---|
 | 267 | // and these 32 bits values must be concatenate with the cluster  | 
|---|
| [621] | 268 | // index (on 8 bits) to obtain the 40 bits address. | 
|---|
| [664] | 269 | ////////////////////////////////////////////////////////////////////////////////////// | 
|---|
| [621] | 270 |  | 
|---|
| [692] | 271 | // in cluster [0,0] & [X_SIZE-1,Y_SIZE]  | 
|---|
| [621] | 272 |  | 
|---|
| [692] | 273 | #define MTTY_BASE    0xF4000000 | 
|---|
 | 274 | #define MTTY_SIZE    0x00001000   // 4 Kbytes | 
|---|
| [621] | 275 |  | 
|---|
| [692] | 276 | #define BDEV_BASE    0xF2000000 | 
|---|
 | 277 | #define BDEV_SIZE    0x00001000   // 4 Kbytes | 
|---|
| [621] | 278 |  | 
|---|
| [692] | 279 | // in cluster [X_SIZE-1,Y_SIZE] | 
|---|
| [621] | 280 |  | 
|---|
| [692] | 281 | #define FBUF_BASE    0xF3000000 | 
|---|
 | 282 | #define FBUF_SIZE    (FBUF_X_SIZE * FBUF_Y_SIZE * 2) | 
|---|
| [628] | 283 |  | 
|---|
| [692] | 284 | #define MNIC_BASE    0xF7000000 | 
|---|
 | 285 | #define MNIC_SIZE    0x00800000   // 512 Kbytes (for 8 channels) | 
|---|
| [621] | 286 |  | 
|---|
| [692] | 287 | #define CDMA_BASE    0xF8000000 | 
|---|
 | 288 | #define CDMA_SIZE    0x00004000 * NB_CMA_CHANNELS | 
|---|
| [621] | 289 |  | 
|---|
| [692] | 290 | #define IOPI_BASE    0xF9000000 | 
|---|
 | 291 | #define IOPI_SIZE    0x00001000   // 4 Kbytes  | 
|---|
| [621] | 292 |  | 
|---|
| [692] | 293 | // replicated segments : address is extended to 40 bits by cluster_xy | 
|---|
| [621] | 294 |  | 
|---|
| [692] | 295 | #define MEMC_BASE    0x00000000 | 
|---|
 | 296 | #define MEMC_SIZE    XRAM_SIZE | 
|---|
| [628] | 297 |  | 
|---|
| [692] | 298 | #define MCFG_BASE    0xE0000000 | 
|---|
 | 299 | #define MCFG_SIZE    0x00001000   // 4 Kbytes | 
|---|
| [621] | 300 |  | 
|---|
| [692] | 301 | #define XICU_BASE    0xF0000000 | 
|---|
 | 302 | #define XICU_SIZE    0x00001000   // 4 Kbytes | 
|---|
 | 303 |  | 
|---|
| [621] | 304 | bool stop_called = false; | 
|---|
 | 305 |  | 
|---|
 | 306 | ///////////////////////////////// | 
|---|
 | 307 | int _main(int argc, char *argv[]) | 
|---|
 | 308 | { | 
|---|
 | 309 |    using namespace sc_core; | 
|---|
 | 310 |    using namespace soclib::caba; | 
|---|
 | 311 |    using namespace soclib::common; | 
|---|
 | 312 |  | 
|---|
| [692] | 313 |    uint32_t ncycles           = 0xFFFFFFFF; // max simulated cycles | 
|---|
 | 314 |    size_t   threads           = 1;          // simulator's threads number | 
|---|
 | 315 |    bool     trace_ok          = false;      // trace activated | 
|---|
 | 316 |    uint32_t trace_from        = 0;          // trace start cycle | 
|---|
 | 317 |    bool     trace_proc_ok     = false;      // detailed proc trace activated | 
|---|
 | 318 |    size_t   trace_memc_ok     = false;      // detailed memc trace activated | 
|---|
 | 319 |    size_t   trace_memc_id     = 0;          // index of memc to be traced  | 
|---|
 | 320 |    size_t   trace_proc_id     = 0;          // index of proc to be traced | 
|---|
 | 321 |    uint32_t frozen_cycles     = MAX_FROZEN_CYCLES; | 
|---|
 | 322 |    char     soft_name[256]    = BINARY_PATH_FOR_LOADER; | 
|---|
 | 323 |    char     disk_name[256]    = DISK_IMAGE_PATH_FOR_IOC; | 
|---|
 | 324 |    char     ramdisk_name[256] = RAMDISK_PATH_FOR_LOADER; | 
|---|
| [621] | 325 |    struct   timeval t1,t2; | 
|---|
 | 326 |    uint64_t ms1,ms2; | 
|---|
 | 327 |  | 
|---|
 | 328 |    ////////////// command line arguments ////////////////////// | 
|---|
 | 329 |    if (argc > 1) | 
|---|
 | 330 |    { | 
|---|
 | 331 |       for (int n = 1; n < argc; n = n + 2) | 
|---|
 | 332 |       { | 
|---|
 | 333 |          if ((strcmp(argv[n], "-NCYCLES") == 0) && (n + 1 < argc)) | 
|---|
 | 334 |          { | 
|---|
 | 335 |             ncycles = (uint64_t) strtol(argv[n + 1], NULL, 0); | 
|---|
 | 336 |          } | 
|---|
 | 337 |          else if ((strcmp(argv[n],"-DEBUG") == 0) && (n + 1 < argc)) | 
|---|
 | 338 |          { | 
|---|
 | 339 |             trace_ok = true; | 
|---|
 | 340 |             trace_from = (uint32_t) strtol(argv[n + 1], NULL, 0); | 
|---|
 | 341 |          } | 
|---|
 | 342 |          else if ((strcmp(argv[n], "-MEMCID") == 0) && (n + 1 < argc)) | 
|---|
 | 343 |          { | 
|---|
 | 344 |             trace_memc_ok = true; | 
|---|
 | 345 |             trace_memc_id = (size_t) strtol(argv[n + 1], NULL, 0); | 
|---|
 | 346 |             size_t x = trace_memc_id >> Y_WIDTH; | 
|---|
 | 347 |             size_t y = trace_memc_id & ((1<<Y_WIDTH)-1); | 
|---|
 | 348 |  | 
|---|
| [681] | 349 |             assert( (x < X_SIZE) and (y < (Y_SIZE)) and | 
|---|
| [621] | 350 |                   "MEMCID parameter refers a not valid memory cache"); | 
|---|
 | 351 |          } | 
|---|
 | 352 |          else if ((strcmp(argv[n], "-PROCID") == 0) && (n + 1 < argc)) | 
|---|
 | 353 |          { | 
|---|
 | 354 |             trace_proc_ok = true; | 
|---|
 | 355 |             trace_proc_id = (size_t) strtol(argv[n + 1], NULL, 0); | 
|---|
 | 356 |             size_t cluster_xy = trace_proc_id / NB_PROCS_MAX ; | 
|---|
 | 357 |             size_t x          = cluster_xy >> Y_WIDTH; | 
|---|
 | 358 |             size_t y          = cluster_xy & ((1<<Y_WIDTH)-1); | 
|---|
| [664] | 359 |             size_t l          = trace_proc_id % NB_PROCS_MAX ; | 
|---|
| [621] | 360 |  | 
|---|
| [692] | 361 |             assert( (x < X_SIZE) and (y < Y_SIZE) and (l < NB_PROCS_MAX) and | 
|---|
| [621] | 362 |                   "PROCID parameter refers a not valid processor"); | 
|---|
 | 363 |          } | 
|---|
| [692] | 364 |          else if ((strcmp(argv[n], "-SOFT") == 0) && ((n + 1) < argc)) | 
|---|
 | 365 |          { | 
|---|
 | 366 |             strcpy(soft_name, argv[n + 1]);  | 
|---|
 | 367 |          } | 
|---|
 | 368 |          else if ((strcmp(argv[n], "-DISK") == 0) && ((n + 1) < argc)) | 
|---|
 | 369 |          { | 
|---|
 | 370 |             strcpy(disk_name, argv[n + 1]); | 
|---|
 | 371 |          } | 
|---|
 | 372 |          else if ((strcmp(argv[n], "-RAMDISK") == 0) && ((n + 1) < argc)) | 
|---|
 | 373 |          { | 
|---|
 | 374 |             strcpy(ramdisk_name, argv[n + 1]);  | 
|---|
 | 375 |          } | 
|---|
| [621] | 376 |          else if ((strcmp(argv[n], "-THREADS") == 0) && ((n + 1) < argc)) | 
|---|
 | 377 |          { | 
|---|
| [628] | 378 |             threads = (size_t) strtol(argv[n + 1], NULL, 0); | 
|---|
 | 379 |             threads = (threads < 1) ? 1 : threads; | 
|---|
| [621] | 380 |          } | 
|---|
 | 381 |          else if ((strcmp(argv[n], "-FROZEN") == 0) && (n + 1 < argc)) | 
|---|
 | 382 |          { | 
|---|
 | 383 |             frozen_cycles = (uint32_t) strtol(argv[n + 1], NULL, 0); | 
|---|
 | 384 |          } | 
|---|
 | 385 |          else | 
|---|
 | 386 |          { | 
|---|
 | 387 |             std::cout << "   Arguments are (key,value) couples." << std::endl; | 
|---|
 | 388 |             std::cout << "   The order is not important." << std::endl; | 
|---|
 | 389 |             std::cout << "   Accepted arguments are :" << std::endl << std::endl; | 
|---|
 | 390 |             std::cout << "     -NCYCLES number_of_simulated_cycles" << std::endl; | 
|---|
 | 391 |             std::cout << "     -DEBUG debug_start_cycle" << std::endl; | 
|---|
| [692] | 392 |             std::cout << "     -SOFT path to soft" << std::endl; | 
|---|
 | 393 |             std::cout << "     -DISK path to disk image" << std::endl; | 
|---|
 | 394 |             std::cout << "     -RAMDISK path to ramdisk image" << std::endl; | 
|---|
| [621] | 395 |             std::cout << "     -THREADS simulator's threads number" << std::endl; | 
|---|
 | 396 |             std::cout << "     -FROZEN max_number_of_lines" << std::endl; | 
|---|
 | 397 |             std::cout << "     -PERIOD number_of_cycles between trace" << std::endl; | 
|---|
 | 398 |             std::cout << "     -MEMCID index_memc_to_be_traced" << std::endl; | 
|---|
 | 399 |             std::cout << "     -PROCID index_proc_to_be_traced" << std::endl; | 
|---|
 | 400 |             exit(0); | 
|---|
 | 401 |          } | 
|---|
 | 402 |       } | 
|---|
 | 403 |    } | 
|---|
 | 404 |  | 
|---|
 | 405 |     // checking hardware parameters | 
|---|
| [681] | 406 |     assert( ((X_SIZE==1) or (X_SIZE==2) or (X_SIZE==4) or (X_SIZE==8) or (X_SIZE==16)) and  | 
|---|
 | 407 |             "Illegal X_SIZE parameter" ); | 
|---|
| [621] | 408 |  | 
|---|
| [681] | 409 |     assert( ((Y_SIZE==1) or (Y_SIZE==2) or (Y_SIZE==4) or (Y_SIZE==8)) and  | 
|---|
 | 410 |             "Illegal Y_SIZE parameter" ); | 
|---|
| [621] | 411 |  | 
|---|
| [664] | 412 |     assert( (NB_PROCS_MAX <= 4) and | 
|---|
| [681] | 413 |             "Illegal NB_PROCS_MAX parameter" ); | 
|---|
| [621] | 414 |  | 
|---|
| [664] | 415 |     assert( (NB_CMA_CHANNELS <= MAX_CMA_CHANNELS) and | 
|---|
| [628] | 416 |             "The NB_CMA_CHANNELS parameter cannot be larger than 4" ); | 
|---|
| [621] | 417 |  | 
|---|
| [664] | 418 |     assert( (NB_TTY_CHANNELS <= MAX_TTY_CHANNELS) and | 
|---|
 | 419 |             "The NB_TTY_CHANNELS parameter cannot be larger than 8" ); | 
|---|
| [621] | 420 |  | 
|---|
| [664] | 421 |     assert( (NB_NIC_CHANNELS <= MAX_NIC_CHANNELS) and | 
|---|
| [628] | 422 |             "The NB_NIC_CHANNELS parameter cannot be larger than 2" ); | 
|---|
| [621] | 423 |  | 
|---|
 | 424 |     assert( (vci_address_width == 40) and | 
|---|
 | 425 |             "VCI address width with the GIET must be 40 bits" ); | 
|---|
 | 426 |  | 
|---|
 | 427 |     assert( (X_WIDTH == 4) and (Y_WIDTH == 4) and | 
|---|
 | 428 |             "ERROR: you must have X_WIDTH == Y_WIDTH == 4"); | 
|---|
 | 429 |   | 
|---|
 | 430 |     std::cout << std::endl; | 
|---|
 | 431 |  | 
|---|
 | 432 |     std::cout << " - X_SIZE           = " << X_SIZE << std::endl; | 
|---|
 | 433 |     std::cout << " - Y_SIZE           = " << Y_SIZE << std::endl; | 
|---|
 | 434 |     std::cout << " - NB_PROCS_MAX     = " << NB_PROCS_MAX <<  std::endl; | 
|---|
 | 435 |     std::cout << " - NB_DMA_CHANNELS  = " << NB_DMA_CHANNELS <<  std::endl; | 
|---|
 | 436 |     std::cout << " - NB_TTY_CHANNELS  = " << NB_TTY_CHANNELS <<  std::endl; | 
|---|
 | 437 |     std::cout << " - NB_NIC_CHANNELS  = " << NB_NIC_CHANNELS <<  std::endl; | 
|---|
 | 438 |     std::cout << " - MEMC_WAYS        = " << MEMC_WAYS << std::endl; | 
|---|
 | 439 |     std::cout << " - MEMC_SETS        = " << MEMC_SETS << std::endl; | 
|---|
 | 440 |     std::cout << " - RAM_LATENCY      = " << XRAM_LATENCY << std::endl; | 
|---|
 | 441 |     std::cout << " - MAX_FROZEN       = " << frozen_cycles << std::endl; | 
|---|
 | 442 |     std::cout << " - MAX_CYCLES       = " << ncycles << std::endl; | 
|---|
 | 443 |     std::cout << " - RESET_ADDRESS    = " << RESET_ADDRESS << std::endl; | 
|---|
| [692] | 444 |     std::cout << " - SOFT_FILENAME    = " << soft_name << std::endl; | 
|---|
 | 445 |     std::cout << " - DISK_IMAGENAME   = " << disk_name << std::endl; | 
|---|
 | 446 |     std::cout << " - RAMDISK_FILENAME = " << ramdisk_name << std::endl; | 
|---|
 | 447 |     std::cout << " - OPENMP THREADS   = " << threads << std::endl; | 
|---|
| [621] | 448 |  | 
|---|
 | 449 |     std::cout << std::endl; | 
|---|
 | 450 |  | 
|---|
 | 451 |     // Internal and External VCI parameters definition | 
|---|
 | 452 |     typedef soclib::caba::VciParams<vci_cell_width_int, | 
|---|
 | 453 |                                     vci_plen_width, | 
|---|
 | 454 |                                     vci_address_width, | 
|---|
 | 455 |                                     vci_rerror_width, | 
|---|
 | 456 |                                     vci_clen_width, | 
|---|
 | 457 |                                     vci_rflag_width, | 
|---|
 | 458 |                                     vci_srcid_width, | 
|---|
 | 459 |                                     vci_pktid_width, | 
|---|
 | 460 |                                     vci_trdid_width, | 
|---|
 | 461 |                                     vci_wrplen_width> vci_param_int; | 
|---|
 | 462 |  | 
|---|
 | 463 |     typedef soclib::caba::VciParams<vci_cell_width_ext, | 
|---|
 | 464 |                                     vci_plen_width, | 
|---|
 | 465 |                                     vci_address_width, | 
|---|
 | 466 |                                     vci_rerror_width, | 
|---|
 | 467 |                                     vci_clen_width, | 
|---|
 | 468 |                                     vci_rflag_width, | 
|---|
 | 469 |                                     vci_srcid_width, | 
|---|
 | 470 |                                     vci_pktid_width, | 
|---|
 | 471 |                                     vci_trdid_width, | 
|---|
 | 472 |                                     vci_wrplen_width> vci_param_ext; | 
|---|
 | 473 |  | 
|---|
 | 474 | #if USE_OPENMP | 
|---|
 | 475 |    omp_set_dynamic(false); | 
|---|
| [628] | 476 |    omp_set_num_threads(threads); | 
|---|
| [621] | 477 |    std::cerr << "Built with openmp version " << _OPENMP << std::endl; | 
|---|
 | 478 | #endif | 
|---|
 | 479 |  | 
|---|
 | 480 |  | 
|---|
| [628] | 481 |    /////////////////////////////////////// | 
|---|
 | 482 |    //  Direct Network Mapping Table | 
|---|
 | 483 |    /////////////////////////////////////// | 
|---|
| [621] | 484 |  | 
|---|
 | 485 |    MappingTable maptabd(vci_address_width,  | 
|---|
 | 486 |                         IntTab(X_WIDTH + Y_WIDTH, 16 - X_WIDTH - Y_WIDTH),  | 
|---|
 | 487 |                         IntTab(X_WIDTH + Y_WIDTH, vci_srcid_width - X_WIDTH - Y_WIDTH),  | 
|---|
| [628] | 488 |                         0x00FF000000ULL); | 
|---|
| [621] | 489 |  | 
|---|
| [628] | 490 |    // replicated segments | 
|---|
| [621] | 491 |    for (size_t x = 0; x < X_SIZE; x++) | 
|---|
 | 492 |    { | 
|---|
| [681] | 493 |       for (size_t y = 0; y < (Y_SIZE) ; y++) | 
|---|
| [621] | 494 |       { | 
|---|
 | 495 |          sc_uint<vci_address_width> offset; | 
|---|
| [628] | 496 |          offset = ((sc_uint<vci_address_width>)cluster(x,y)) << 32; | 
|---|
| [621] | 497 |  | 
|---|
 | 498 |          std::ostringstream    si; | 
|---|
 | 499 |          si << "seg_xicu_" << x << "_" << y; | 
|---|
 | 500 |          maptabd.add(Segment(si.str(), XICU_BASE + offset, XICU_SIZE,  | 
|---|
 | 501 |                   IntTab(cluster(x,y),XICU_TGTID), false)); | 
|---|
 | 502 |  | 
|---|
 | 503 |          std::ostringstream    sd; | 
|---|
| [628] | 504 |          sd << "seg_mcfg_" << x << "_" << y; | 
|---|
 | 505 |          maptabd.add(Segment(sd.str(), MCFG_BASE + offset, MCFG_SIZE,  | 
|---|
 | 506 |                   IntTab(cluster(x,y),MEMC_TGTID), false)); | 
|---|
| [621] | 507 |  | 
|---|
 | 508 |          std::ostringstream    sh; | 
|---|
 | 509 |          sh << "seg_memc_" << x << "_" << y; | 
|---|
 | 510 |          maptabd.add(Segment(sh.str(), MEMC_BASE + offset, MEMC_SIZE,  | 
|---|
 | 511 |                   IntTab(cluster(x,y),MEMC_TGTID), true)); | 
|---|
 | 512 |       } | 
|---|
 | 513 |    } | 
|---|
| [628] | 514 |  | 
|---|
| [664] | 515 |    // segments for peripherals in cluster(0,0) | 
|---|
| [628] | 516 |    maptabd.add(Segment("seg_tty0", MTTY_BASE, MTTY_SIZE,  | 
|---|
 | 517 |                IntTab(cluster(0,0),MTTY_TGTID), false)); | 
|---|
 | 518 |  | 
|---|
 | 519 |    maptabd.add(Segment("seg_ioc0", BDEV_BASE, BDEV_SIZE,  | 
|---|
 | 520 |                IntTab(cluster(0,0),BDEV_TGTID), false)); | 
|---|
 | 521 |  | 
|---|
| [681] | 522 |    // segments for peripherals in cluster_io (X_SIZE-1,Y_SIZE) | 
|---|
| [628] | 523 |    sc_uint<vci_address_width> offset; | 
|---|
| [681] | 524 |    offset = ((sc_uint<vci_address_width>)cluster(X_SIZE-1,Y_SIZE)) << 32; | 
|---|
| [628] | 525 |  | 
|---|
 | 526 |    maptabd.add(Segment("seg_mtty", MTTY_BASE + offset, MTTY_SIZE,  | 
|---|
| [681] | 527 |                IntTab(cluster(X_SIZE-1, Y_SIZE),MTTY_TGTID), false)); | 
|---|
| [628] | 528 |  | 
|---|
 | 529 |    maptabd.add(Segment("seg_fbuf", FBUF_BASE + offset, FBUF_SIZE,  | 
|---|
| [681] | 530 |                IntTab(cluster(X_SIZE-1, Y_SIZE),FBUF_TGTID), false)); | 
|---|
| [628] | 531 |  | 
|---|
 | 532 |    maptabd.add(Segment("seg_bdev", BDEV_BASE + offset, BDEV_SIZE,  | 
|---|
| [681] | 533 |                IntTab(cluster(X_SIZE-1, Y_SIZE),BDEV_TGTID), false)); | 
|---|
| [628] | 534 |  | 
|---|
 | 535 |    maptabd.add(Segment("seg_mnic", MNIC_BASE + offset, MNIC_SIZE,  | 
|---|
| [681] | 536 |                IntTab(cluster(X_SIZE-1, Y_SIZE),MNIC_TGTID), false)); | 
|---|
| [628] | 537 |  | 
|---|
 | 538 |    maptabd.add(Segment("seg_cdma", CDMA_BASE + offset, CDMA_SIZE,  | 
|---|
| [681] | 539 |                IntTab(cluster(X_SIZE-1, Y_SIZE),CDMA_TGTID), false)); | 
|---|
| [628] | 540 |  | 
|---|
 | 541 |    maptabd.add(Segment("seg_iopi", IOPI_BASE + offset, IOPI_SIZE,  | 
|---|
| [681] | 542 |                IntTab(cluster(X_SIZE-1, Y_SIZE),IOPI_TGTID), false)); | 
|---|
| [628] | 543 |  | 
|---|
| [621] | 544 |    std::cout << maptabd << std::endl; | 
|---|
 | 545 |  | 
|---|
| [628] | 546 |     ///////////////////////////////////////////////// | 
|---|
 | 547 |     // Ram network mapping table | 
|---|
 | 548 |     ///////////////////////////////////////////////// | 
|---|
| [621] | 549 |  | 
|---|
| [628] | 550 |     MappingTable maptabx(vci_address_width,  | 
|---|
 | 551 |                          IntTab(X_WIDTH+Y_WIDTH),  | 
|---|
 | 552 |                          IntTab(X_WIDTH+Y_WIDTH),  | 
|---|
 | 553 |                          0x00FF000000ULL); | 
|---|
| [621] | 554 |  | 
|---|
| [628] | 555 |     for (size_t x = 0; x < X_SIZE; x++) | 
|---|
 | 556 |     { | 
|---|
| [681] | 557 |         for (size_t y = 0; y < (Y_SIZE) ; y++) | 
|---|
| [628] | 558 |         {  | 
|---|
 | 559 |             sc_uint<vci_address_width> offset; | 
|---|
 | 560 |             offset = (sc_uint<vci_address_width>)cluster(x,y)  | 
|---|
 | 561 |                       << (vci_address_width-X_WIDTH-Y_WIDTH); | 
|---|
| [621] | 562 |  | 
|---|
| [628] | 563 |             std::ostringstream sh; | 
|---|
 | 564 |             sh << "x_seg_memc_" << x << "_" << y; | 
|---|
| [621] | 565 |  | 
|---|
| [628] | 566 |             maptabx.add(Segment(sh.str(), MEMC_BASE + offset,  | 
|---|
| [621] | 567 |                      MEMC_SIZE, IntTab(cluster(x,y)), false)); | 
|---|
| [628] | 568 |         } | 
|---|
 | 569 |     } | 
|---|
 | 570 |     std::cout << maptabx << std::endl; | 
|---|
| [621] | 571 |  | 
|---|
| [628] | 572 |     //////////////////// | 
|---|
 | 573 |     // Signals | 
|---|
 | 574 |     /////////////////// | 
|---|
| [621] | 575 |  | 
|---|
| [628] | 576 |     sc_clock                          signal_clk("clk"); | 
|---|
 | 577 |     sc_signal<bool>                   signal_resetn("resetn"); | 
|---|
| [621] | 578 |  | 
|---|
| [628] | 579 |     // IRQs from external peripherals | 
|---|
 | 580 |     sc_signal<bool>                   signal_irq_bdev; | 
|---|
 | 581 |     sc_signal<bool>                   signal_irq_mnic_rx[NB_NIC_CHANNELS]; | 
|---|
 | 582 |     sc_signal<bool>                   signal_irq_mnic_tx[NB_NIC_CHANNELS]; | 
|---|
| [664] | 583 |     sc_signal<bool>                   signal_irq_mtty_rx[NB_TTY_CHANNELS]; | 
|---|
 | 584 | //  sc_signal<bool>                   signal_irq_mtty_tx[NB_TTY_CHANNELS]; | 
|---|
| [628] | 585 |     sc_signal<bool>                   signal_irq_cdma[NB_CMA_CHANNELS]; | 
|---|
 | 586 |     sc_signal<bool>                   signal_irq_false; | 
|---|
 | 587 |  | 
|---|
| [621] | 588 |    // Horizontal inter-clusters DSPIN signals | 
|---|
| [628] | 589 |    DspinSignals<dspin_cmd_width>** signal_dspin_h_cmd_inc = | 
|---|
| [681] | 590 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_inc", X_SIZE-1, Y_SIZE); | 
|---|
| [628] | 591 |    DspinSignals<dspin_cmd_width>** signal_dspin_h_cmd_dec = | 
|---|
| [681] | 592 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cmd_dec", X_SIZE-1, Y_SIZE); | 
|---|
| [621] | 593 |  | 
|---|
| [628] | 594 |    DspinSignals<dspin_rsp_width>** signal_dspin_h_rsp_inc = | 
|---|
| [681] | 595 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_rsp_inc", X_SIZE-1, Y_SIZE); | 
|---|
| [628] | 596 |    DspinSignals<dspin_rsp_width>** signal_dspin_h_rsp_dec = | 
|---|
| [681] | 597 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_rsp_dec", X_SIZE-1, Y_SIZE); | 
|---|
| [628] | 598 |  | 
|---|
 | 599 |    DspinSignals<dspin_cmd_width>** signal_dspin_h_m2p_inc = | 
|---|
| [681] | 600 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_m2p_inc", X_SIZE-1, Y_SIZE); | 
|---|
| [628] | 601 |    DspinSignals<dspin_cmd_width>** signal_dspin_h_m2p_dec = | 
|---|
| [681] | 602 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_m2p_dec", X_SIZE-1, Y_SIZE); | 
|---|
| [628] | 603 |  | 
|---|
 | 604 |    DspinSignals<dspin_rsp_width>** signal_dspin_h_p2m_inc = | 
|---|
| [681] | 605 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_p2m_inc", X_SIZE-1, Y_SIZE); | 
|---|
| [628] | 606 |    DspinSignals<dspin_rsp_width>** signal_dspin_h_p2m_dec = | 
|---|
| [681] | 607 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_h_p2m_dec", X_SIZE-1, Y_SIZE); | 
|---|
| [628] | 608 |  | 
|---|
 | 609 |    DspinSignals<dspin_cmd_width>** signal_dspin_h_cla_inc = | 
|---|
| [681] | 610 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cla_inc", X_SIZE-1, Y_SIZE); | 
|---|
| [628] | 611 |    DspinSignals<dspin_cmd_width>** signal_dspin_h_cla_dec = | 
|---|
| [681] | 612 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_h_cla_dec", X_SIZE-1, Y_SIZE); | 
|---|
| [628] | 613 |  | 
|---|
| [621] | 614 |    // Vertical inter-clusters DSPIN signals | 
|---|
| [628] | 615 |    DspinSignals<dspin_cmd_width>** signal_dspin_v_cmd_inc = | 
|---|
| [681] | 616 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_inc", X_SIZE, Y_SIZE-1); | 
|---|
| [628] | 617 |    DspinSignals<dspin_cmd_width>** signal_dspin_v_cmd_dec = | 
|---|
| [681] | 618 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cmd_dec", X_SIZE, Y_SIZE-1); | 
|---|
| [621] | 619 |  | 
|---|
| [628] | 620 |    DspinSignals<dspin_rsp_width>** signal_dspin_v_rsp_inc = | 
|---|
| [681] | 621 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_rsp_inc", X_SIZE, Y_SIZE-1); | 
|---|
| [628] | 622 |    DspinSignals<dspin_rsp_width>** signal_dspin_v_rsp_dec = | 
|---|
| [681] | 623 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_rsp_dec", X_SIZE, Y_SIZE-1); | 
|---|
| [621] | 624 |  | 
|---|
| [628] | 625 |    DspinSignals<dspin_cmd_width>** signal_dspin_v_m2p_inc = | 
|---|
| [681] | 626 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_m2p_inc", X_SIZE, Y_SIZE-1); | 
|---|
| [628] | 627 |    DspinSignals<dspin_cmd_width>** signal_dspin_v_m2p_dec = | 
|---|
| [681] | 628 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_m2p_dec", X_SIZE, Y_SIZE-1); | 
|---|
| [621] | 629 |  | 
|---|
| [628] | 630 |    DspinSignals<dspin_rsp_width>** signal_dspin_v_p2m_inc = | 
|---|
| [681] | 631 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_p2m_inc", X_SIZE, Y_SIZE-1); | 
|---|
| [628] | 632 |    DspinSignals<dspin_rsp_width>** signal_dspin_v_p2m_dec = | 
|---|
| [681] | 633 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_v_p2m_dec", X_SIZE, Y_SIZE-1); | 
|---|
| [628] | 634 |  | 
|---|
 | 635 |    DspinSignals<dspin_cmd_width>** signal_dspin_v_cla_inc = | 
|---|
| [681] | 636 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cla_inc", X_SIZE, Y_SIZE-1); | 
|---|
| [628] | 637 |    DspinSignals<dspin_cmd_width>** signal_dspin_v_cla_dec = | 
|---|
| [681] | 638 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_v_cla_dec", X_SIZE, Y_SIZE-1); | 
|---|
| [628] | 639 |  | 
|---|
 | 640 |    // Mesh boundaries DSPIN signals (Most of those signals are not used...) | 
|---|
 | 641 |    DspinSignals<dspin_cmd_width>*** signal_dspin_bound_cmd_in = | 
|---|
| [681] | 642 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cmd_in" , X_SIZE, Y_SIZE, 4); | 
|---|
| [628] | 643 |    DspinSignals<dspin_cmd_width>*** signal_dspin_bound_cmd_out = | 
|---|
| [681] | 644 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cmd_out", X_SIZE, Y_SIZE, 4); | 
|---|
| [628] | 645 |  | 
|---|
 | 646 |    DspinSignals<dspin_rsp_width>*** signal_dspin_bound_rsp_in = | 
|---|
| [681] | 647 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_rsp_in" , X_SIZE, Y_SIZE, 4); | 
|---|
| [628] | 648 |    DspinSignals<dspin_rsp_width>*** signal_dspin_bound_rsp_out = | 
|---|
| [681] | 649 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_rsp_out", X_SIZE, Y_SIZE, 4); | 
|---|
| [628] | 650 |  | 
|---|
 | 651 |    DspinSignals<dspin_cmd_width>*** signal_dspin_bound_m2p_in = | 
|---|
| [681] | 652 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_m2p_in" , X_SIZE, Y_SIZE, 4); | 
|---|
| [628] | 653 |    DspinSignals<dspin_cmd_width>*** signal_dspin_bound_m2p_out = | 
|---|
| [681] | 654 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_m2p_out", X_SIZE, Y_SIZE, 4); | 
|---|
| [628] | 655 |  | 
|---|
 | 656 |    DspinSignals<dspin_rsp_width>*** signal_dspin_bound_p2m_in = | 
|---|
| [681] | 657 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_p2m_in" , X_SIZE, Y_SIZE, 4); | 
|---|
| [628] | 658 |    DspinSignals<dspin_rsp_width>*** signal_dspin_bound_p2m_out = | 
|---|
| [681] | 659 |       alloc_elems<DspinSignals<dspin_rsp_width> >("signal_dspin_bound_p2m_out", X_SIZE, Y_SIZE, 4); | 
|---|
| [628] | 660 |  | 
|---|
 | 661 |    DspinSignals<dspin_cmd_width>*** signal_dspin_bound_cla_in = | 
|---|
| [681] | 662 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cla_in" , X_SIZE, Y_SIZE, 4); | 
|---|
| [628] | 663 |    DspinSignals<dspin_cmd_width>*** signal_dspin_bound_cla_out = | 
|---|
| [681] | 664 |       alloc_elems<DspinSignals<dspin_cmd_width> >("signal_dspin_bound_cla_out", X_SIZE, Y_SIZE, 4); | 
|---|
| [628] | 665 |  | 
|---|
 | 666 |    // VCI signals for iobus and peripherals | 
|---|
 | 667 |    VciSignals<vci_param_int>    signal_vci_ini_bdev("signal_vci_ini_bdev"); | 
|---|
 | 668 |    VciSignals<vci_param_int>    signal_vci_ini_cdma("signal_vci_ini_cdma"); | 
|---|
 | 669 |    VciSignals<vci_param_int>    signal_vci_ini_iopi("signal_vci_ini_iopi"); | 
|---|
 | 670 |  | 
|---|
 | 671 |    VciSignals<vci_param_int>*   signal_vci_ini_proc =  | 
|---|
 | 672 |        alloc_elems<VciSignals<vci_param_int> >("signal_vci_ini_proc", NB_PROCS_MAX ); | 
|---|
 | 673 |  | 
|---|
 | 674 |    VciSignals<vci_param_int>    signal_vci_tgt_memc("signal_vci_tgt_memc"); | 
|---|
 | 675 |    VciSignals<vci_param_int>    signal_vci_tgt_xicu("signal_vci_tgt_xicu"); | 
|---|
 | 676 |    VciSignals<vci_param_int>    signal_vci_tgt_bdev("signal_vci_tgt_bdev"); | 
|---|
 | 677 |    VciSignals<vci_param_int>    signal_vci_tgt_mtty("signal_vci_tgt_mtty"); | 
|---|
 | 678 |    VciSignals<vci_param_int>    signal_vci_tgt_fbuf("signal_vci_tgt_fbuf"); | 
|---|
 | 679 |    VciSignals<vci_param_int>    signal_vci_tgt_mnic("signal_vci_tgt_mnic"); | 
|---|
 | 680 |    VciSignals<vci_param_int>    signal_vci_tgt_cdma("signal_vci_tgt_cdma"); | 
|---|
 | 681 |    VciSignals<vci_param_int>    signal_vci_tgt_iopi("signal_vci_tgt_iopi"); | 
|---|
 | 682 |  | 
|---|
 | 683 |    VciSignals<vci_param_int>    signal_vci_cmd_to_noc("signal_vci_cmd_to_noc"); | 
|---|
 | 684 |    VciSignals<vci_param_int>    signal_vci_cmd_from_noc("signal_vci_cmd_from_noc"); | 
|---|
 | 685 |     | 
|---|
| [621] | 686 |    //////////////////////////// | 
|---|
 | 687 |    //      Loader     | 
|---|
 | 688 |    //////////////////////////// | 
|---|
 | 689 |  | 
|---|
| [664] | 690 | #if USE_IOC_RDK | 
|---|
| [692] | 691 |    soclib::common::Loader loader( soft_name, ramdisk_name ); | 
|---|
| [664] | 692 | #else | 
|---|
| [692] | 693 |    soclib::common::Loader loader( soft_name ); | 
|---|
| [664] | 694 | #endif | 
|---|
| [708] | 695 |    loader.memory_default(0xAA); | 
|---|
| [621] | 696 |  | 
|---|
| [630] | 697 |    /////////////////////////// | 
|---|
 | 698 |    //  processor iss | 
|---|
 | 699 |    /////////////////////////// | 
|---|
 | 700 |  | 
|---|
| [621] | 701 |    typedef soclib::common::GdbServer<soclib::common::Mips32ElIss> proc_iss; | 
|---|
| [630] | 702 |    proc_iss::set_loader( loader ); | 
|---|
| [621] | 703 |  | 
|---|
| [664] | 704 |    ////////////////////////////////////////////////////////////// | 
|---|
| [681] | 705 |    // mesh construction: only (X_SIZE) * (Y_SIZE) clusters | 
|---|
| [664] | 706 |    ////////////////////////////////////////////////////////////// | 
|---|
| [621] | 707 |  | 
|---|
 | 708 |    TsarLetiCluster<dspin_cmd_width, | 
|---|
 | 709 |                    dspin_rsp_width, | 
|---|
 | 710 |                    vci_param_int, | 
|---|
| [681] | 711 |                    vci_param_ext>*          clusters[X_SIZE][Y_SIZE]; | 
|---|
| [621] | 712 |  | 
|---|
 | 713 | #if USE_OPENMP | 
|---|
 | 714 | #pragma omp parallel | 
|---|
 | 715 |     { | 
|---|
 | 716 | #pragma omp for | 
|---|
 | 717 | #endif | 
|---|
| [681] | 718 |         for (size_t i = 0; i  < (X_SIZE * (Y_SIZE)); i++) | 
|---|
| [621] | 719 |         { | 
|---|
| [681] | 720 |             size_t x = i / (Y_SIZE); | 
|---|
 | 721 |             size_t y = i % (Y_SIZE); | 
|---|
| [621] | 722 |  | 
|---|
 | 723 | #if USE_OPENMP | 
|---|
 | 724 | #pragma omp critical | 
|---|
 | 725 |             { | 
|---|
 | 726 | #endif | 
|---|
 | 727 |             std::cout << std::endl; | 
|---|
| [628] | 728 |             std::cout << "Cluster_" << std::dec << x << "_" << y  | 
|---|
 | 729 |                       << " with cluster_xy = " << std::hex << cluster(x,y) << std::endl; | 
|---|
| [621] | 730 |             std::cout << std::endl; | 
|---|
 | 731 |  | 
|---|
| [664] | 732 |             std::ostringstream cluster_name; | 
|---|
 | 733 |             cluster_name <<  "cluster_" << std::dec << x << "_" << y; | 
|---|
 | 734 |  | 
|---|
| [621] | 735 |             clusters[x][y] = new TsarLetiCluster<dspin_cmd_width, | 
|---|
 | 736 |                                                  dspin_rsp_width, | 
|---|
 | 737 |                                                  vci_param_int, | 
|---|
 | 738 |                                                  vci_param_ext> | 
|---|
 | 739 |             ( | 
|---|
| [664] | 740 |                 cluster_name.str().c_str(), | 
|---|
| [621] | 741 |                 NB_PROCS_MAX, | 
|---|
 | 742 |                 x, | 
|---|
 | 743 |                 y, | 
|---|
 | 744 |                 cluster(x,y), | 
|---|
 | 745 |                 maptabd, | 
|---|
 | 746 |                 maptabx, | 
|---|
 | 747 |                 RESET_ADDRESS, | 
|---|
 | 748 |                 X_WIDTH, | 
|---|
 | 749 |                 Y_WIDTH, | 
|---|
 | 750 |                 vci_srcid_width - X_WIDTH - Y_WIDTH,   // l_id width, | 
|---|
 | 751 |                 MEMC_TGTID, | 
|---|
 | 752 |                 XICU_TGTID, | 
|---|
 | 753 |                 MTTY_TGTID, | 
|---|
 | 754 |                 BDEV_TGTID, | 
|---|
| [692] | 755 |                 disk_name, | 
|---|
| [621] | 756 |                 MEMC_WAYS, | 
|---|
 | 757 |                 MEMC_SETS, | 
|---|
 | 758 |                 L1_IWAYS, | 
|---|
 | 759 |                 L1_ISETS, | 
|---|
 | 760 |                 L1_DWAYS, | 
|---|
 | 761 |                 L1_DSETS, | 
|---|
 | 762 |                 XRAM_LATENCY, | 
|---|
 | 763 |                 loader, | 
|---|
 | 764 |                 frozen_cycles, | 
|---|
 | 765 |                 trace_from, | 
|---|
 | 766 |                 trace_proc_ok,  | 
|---|
 | 767 |                 trace_proc_id, | 
|---|
 | 768 |                 trace_memc_ok,  | 
|---|
 | 769 |                 trace_memc_id | 
|---|
 | 770 |             ); | 
|---|
 | 771 |  | 
|---|
 | 772 | #if USE_OPENMP | 
|---|
 | 773 |             } // end critical | 
|---|
 | 774 | #endif | 
|---|
 | 775 |         } // end for | 
|---|
 | 776 | #if USE_OPENMP | 
|---|
 | 777 |     } | 
|---|
 | 778 | #endif | 
|---|
 | 779 |  | 
|---|
| [628] | 780 |     ////////////////////////////////////////////////////////////////// | 
|---|
 | 781 |     // IO bus and external peripherals in cluster[X_SIZE-1,Y_SIZE] | 
|---|
| [664] | 782 |     // - 6 local targets    : FBF, TTY, CMA, NIC, PIC, IOC | 
|---|
 | 783 |     // - 3 local initiators : IOC, CMA, PIC | 
|---|
 | 784 |     // There is no PROC, no MEMC and no XICU in this cluster, | 
|---|
 | 785 |     // but the crossbar has (NB_PROCS_MAX + 3) intiators and | 
|---|
 | 786 |     // 8 targets, in order to use the same SRCID and TGTID space | 
|---|
 | 787 |     // (same mapping table for the internal components,  | 
|---|
 | 788 |     //  and for the external peripherals)  | 
|---|
| [628] | 789 |     ////////////////////////////////////////////////////////////////// | 
|---|
| [621] | 790 |  | 
|---|
| [664] | 791 |     std::cout << std::endl; | 
|---|
 | 792 |     std::cout << " Building IO cluster (external peripherals)" << std::endl; | 
|---|
 | 793 |     std::cout << std::endl; | 
|---|
 | 794 |    | 
|---|
| [681] | 795 |     size_t cluster_io = cluster(X_SIZE-1, Y_SIZE); | 
|---|
| [621] | 796 |  | 
|---|
| [628] | 797 |     //////////// vci_local_crossbar   | 
|---|
 | 798 |     VciLocalCrossbar<vci_param_int>* | 
|---|
 | 799 |     iobus = new VciLocalCrossbar<vci_param_int>( | 
|---|
 | 800 |                 "iobus", | 
|---|
 | 801 |                 maptabd,                      // mapping table | 
|---|
 | 802 |                 cluster_io,                   // cluster_xy | 
|---|
 | 803 |                 NB_PROCS_MAX + 3,             // number of local initiators | 
|---|
 | 804 |                 8,                            // number of local targets | 
|---|
 | 805 |                 BDEV_TGTID );                 // default target index | 
|---|
| [621] | 806 |  | 
|---|
| [628] | 807 |     //////////// vci_framebuffer                         | 
|---|
 | 808 |     VciFrameBuffer<vci_param_int>* | 
|---|
 | 809 |     fbuf = new VciFrameBuffer<vci_param_int>( | 
|---|
 | 810 |                 "fbuf", | 
|---|
 | 811 |                 IntTab(cluster_io, FBUF_TGTID), | 
|---|
 | 812 |                 maptabd, | 
|---|
 | 813 |                 FBUF_X_SIZE, FBUF_Y_SIZE ); | 
|---|
| [621] | 814 |  | 
|---|
| [628] | 815 |     ////////////  vci_block_device                | 
|---|
 | 816 |     VciBlockDeviceTsar<vci_param_int>* | 
|---|
 | 817 |     bdev = new VciBlockDeviceTsar<vci_param_int>( | 
|---|
 | 818 |                 "bdev", | 
|---|
 | 819 |                 maptabd, | 
|---|
 | 820 |                 IntTab(cluster_io, BDEV_SRCID), | 
|---|
 | 821 |                 IntTab(cluster_io, BDEV_TGTID), | 
|---|
| [692] | 822 |                 disk_name, | 
|---|
| [628] | 823 |                 512,                          // block size | 
|---|
 | 824 |                 64 );                         // burst size | 
|---|
 | 825 |  | 
|---|
 | 826 |     //////////// vci_multi_nic                | 
|---|
 | 827 |     VciMultiNic<vci_param_int>* | 
|---|
 | 828 |     mnic = new VciMultiNic<vci_param_int>( | 
|---|
| [681] | 829 |              "mnic", | 
|---|
| [628] | 830 |                 IntTab(cluster_io, MNIC_TGTID), | 
|---|
 | 831 |                 maptabd, | 
|---|
 | 832 |                 NB_NIC_CHANNELS, | 
|---|
 | 833 |                 NIC_MAC4, | 
|---|
 | 834 |                 NIC_MAC2, | 
|---|
 | 835 |                 NIC_RX_NAME, | 
|---|
 | 836 |                 NIC_TX_NAME ); | 
|---|
 | 837 |  | 
|---|
 | 838 |     ///////////// vci_chbuf_dma                    | 
|---|
 | 839 |     VciChbufDma<vci_param_int>* | 
|---|
 | 840 |     cdma = new VciChbufDma<vci_param_int>( | 
|---|
 | 841 |                 "cdma", | 
|---|
 | 842 |                 maptabd, | 
|---|
 | 843 |                 IntTab(cluster_io, CDMA_SRCID), | 
|---|
 | 844 |                 IntTab(cluster_io, CDMA_TGTID), | 
|---|
 | 845 |                 64,                          // burst size | 
|---|
 | 846 |                 NB_CMA_CHANNELS );  | 
|---|
 | 847 |  | 
|---|
 | 848 |     ////////////// vci_multi_tty | 
|---|
 | 849 |     std::vector<std::string> vect_names; | 
|---|
 | 850 |     for (size_t id = 0; id < NB_TTY_CHANNELS; id++) | 
|---|
 | 851 |     { | 
|---|
 | 852 |         std::ostringstream term_name; | 
|---|
 | 853 |         term_name <<  "ext_" << id; | 
|---|
 | 854 |         vect_names.push_back(term_name.str().c_str()); | 
|---|
 | 855 |     } | 
|---|
 | 856 |  | 
|---|
 | 857 |     VciMultiTty<vci_param_int>*  | 
|---|
 | 858 |     mtty = new VciMultiTty<vci_param_int>( | 
|---|
 | 859 |                 "mtty", | 
|---|
 | 860 |                 IntTab(cluster_io, MTTY_TGTID), | 
|---|
 | 861 |                 maptabd, | 
|---|
 | 862 |                 vect_names ); | 
|---|
 | 863 |  | 
|---|
 | 864 |     ///////////// vci_iopic | 
|---|
 | 865 |     VciIopic<vci_param_int>* | 
|---|
 | 866 |     iopic = new VciIopic<vci_param_int>( | 
|---|
 | 867 |                 "iopic", | 
|---|
 | 868 |                 maptabd, | 
|---|
 | 869 |                 IntTab(cluster_io, IOPI_SRCID), | 
|---|
 | 870 |                 IntTab(cluster_io, IOPI_TGTID), | 
|---|
| [664] | 871 |                 32, | 
|---|
| [681] | 872 |                 5000 ); | 
|---|
| [628] | 873 |  | 
|---|
 | 874 |     ////////////// vci_dspin wrappers  | 
|---|
 | 875 |     VciDspinTargetWrapper<vci_param_int, dspin_cmd_width, dspin_rsp_width>* | 
|---|
 | 876 |     wt_iobus = new VciDspinTargetWrapper<vci_param_int, dspin_cmd_width, dspin_rsp_width>( | 
|---|
 | 877 |                 "wt_bdev", | 
|---|
 | 878 |                 vci_srcid_width ); | 
|---|
 | 879 |  | 
|---|
 | 880 |     VciDspinInitiatorWrapper<vci_param_int, dspin_cmd_width, dspin_rsp_width>* | 
|---|
 | 881 |     wi_iobus = new VciDspinInitiatorWrapper<vci_param_int, dspin_cmd_width, dspin_rsp_width>( | 
|---|
 | 882 |                 "wi_bdev", | 
|---|
 | 883 |                 vci_srcid_width ); | 
|---|
 | 884 |  | 
|---|
 | 885 |     /////////////////////////////////////////////////////////////// | 
|---|
 | 886 |     //     Net-list  | 
|---|
 | 887 |     /////////////////////////////////////////////////////////////// | 
|---|
 | 888 |  | 
|---|
 | 889 |     // iobus  | 
|---|
 | 890 |     iobus->p_clk                       (signal_clk);   | 
|---|
 | 891 |     iobus->p_resetn                    (signal_resetn); | 
|---|
 | 892 |  | 
|---|
 | 893 |     iobus->p_target_to_up              (signal_vci_cmd_from_noc); | 
|---|
 | 894 |     iobus->p_initiator_to_up           (signal_vci_cmd_to_noc); | 
|---|
 | 895 |  | 
|---|
 | 896 |     iobus->p_to_target[MEMC_TGTID]     (signal_vci_tgt_memc); | 
|---|
 | 897 |     iobus->p_to_target[XICU_TGTID]     (signal_vci_tgt_xicu); | 
|---|
 | 898 |     iobus->p_to_target[MTTY_TGTID]     (signal_vci_tgt_mtty); | 
|---|
 | 899 |     iobus->p_to_target[FBUF_TGTID]     (signal_vci_tgt_fbuf); | 
|---|
 | 900 |     iobus->p_to_target[MNIC_TGTID]     (signal_vci_tgt_mnic); | 
|---|
 | 901 |     iobus->p_to_target[BDEV_TGTID]     (signal_vci_tgt_bdev); | 
|---|
 | 902 |     iobus->p_to_target[CDMA_TGTID]     (signal_vci_tgt_cdma); | 
|---|
 | 903 |     iobus->p_to_target[IOPI_TGTID]     (signal_vci_tgt_iopi); | 
|---|
 | 904 |  | 
|---|
 | 905 |     for( size_t p=0 ; p<NB_PROCS_MAX ; p++ ) | 
|---|
 | 906 |     { | 
|---|
 | 907 |         iobus->p_to_initiator[p]       (signal_vci_ini_proc[p]); | 
|---|
 | 908 |     } | 
|---|
 | 909 |     iobus->p_to_initiator[BDEV_SRCID]  (signal_vci_ini_bdev); | 
|---|
 | 910 |     iobus->p_to_initiator[CDMA_SRCID]  (signal_vci_ini_cdma); | 
|---|
 | 911 |     iobus->p_to_initiator[IOPI_SRCID]  (signal_vci_ini_iopi); | 
|---|
 | 912 |  | 
|---|
 | 913 |     std::cout << "  - IOBUS connected" << std::endl; | 
|---|
 | 914 |  | 
|---|
 | 915 |     // block_device | 
|---|
 | 916 |     bdev->p_clk                        (signal_clk); | 
|---|
 | 917 |     bdev->p_resetn                     (signal_resetn); | 
|---|
 | 918 |     bdev->p_vci_target                 (signal_vci_tgt_bdev); | 
|---|
 | 919 |     bdev->p_vci_initiator              (signal_vci_ini_bdev); | 
|---|
 | 920 |     bdev->p_irq                        (signal_irq_bdev); | 
|---|
 | 921 |  | 
|---|
 | 922 |     std::cout << "  - BDEV connected" << std::endl; | 
|---|
 | 923 |  | 
|---|
 | 924 |     // frame_buffer | 
|---|
 | 925 |     fbuf->p_clk                        (signal_clk); | 
|---|
 | 926 |     fbuf->p_resetn                     (signal_resetn); | 
|---|
 | 927 |     fbuf->p_vci                        (signal_vci_tgt_fbuf); | 
|---|
 | 928 |  | 
|---|
 | 929 |     std::cout << "  - FBUF connected" << std::endl; | 
|---|
 | 930 |  | 
|---|
 | 931 |     // multi_nic | 
|---|
 | 932 |     mnic->p_clk                        (signal_clk); | 
|---|
 | 933 |     mnic->p_resetn                     (signal_resetn); | 
|---|
 | 934 |     mnic->p_vci                        (signal_vci_tgt_mnic); | 
|---|
 | 935 |     for ( size_t i=0 ; i<NB_NIC_CHANNELS ; i++ ) | 
|---|
 | 936 |     { | 
|---|
 | 937 |          mnic->p_rx_irq[i]             (signal_irq_mnic_rx[i]); | 
|---|
 | 938 |          mnic->p_tx_irq[i]             (signal_irq_mnic_tx[i]); | 
|---|
 | 939 |     } | 
|---|
 | 940 |  | 
|---|
 | 941 |     std::cout << "  - MNIC connected" << std::endl; | 
|---|
 | 942 |  | 
|---|
 | 943 |     // chbuf_dma | 
|---|
 | 944 |     cdma->p_clk                        (signal_clk); | 
|---|
 | 945 |     cdma->p_resetn                     (signal_resetn); | 
|---|
 | 946 |     cdma->p_vci_target                 (signal_vci_tgt_cdma); | 
|---|
 | 947 |     cdma->p_vci_initiator              (signal_vci_ini_cdma); | 
|---|
 | 948 |     for ( size_t i=0 ; i<NB_CMA_CHANNELS ; i++) | 
|---|
 | 949 |     { | 
|---|
 | 950 |         cdma->p_irq[i]                 (signal_irq_cdma[i]); | 
|---|
 | 951 |     } | 
|---|
 | 952 |  | 
|---|
 | 953 |     std::cout << "  - CDMA connected" << std::endl; | 
|---|
 | 954 |  | 
|---|
 | 955 |     // multi_tty | 
|---|
 | 956 |     mtty->p_clk                        (signal_clk); | 
|---|
 | 957 |     mtty->p_resetn                     (signal_resetn); | 
|---|
 | 958 |     mtty->p_vci                        (signal_vci_tgt_mtty); | 
|---|
 | 959 |     for ( size_t i=0 ; i<NB_TTY_CHANNELS ; i++ ) | 
|---|
 | 960 |     { | 
|---|
| [664] | 961 |         mtty->p_irq[i]                  (signal_irq_mtty_rx[i]); | 
|---|
| [628] | 962 |     } | 
|---|
 | 963 |  | 
|---|
 | 964 |     std::cout << "  - MTTY connected" << std::endl; | 
|---|
 | 965 |  | 
|---|
 | 966 |     // iopic | 
|---|
| [664] | 967 |     // NB_NIC_CHANNELS <= 2 | 
|---|
 | 968 |     // NB_CMA_CHANNELS <= 4 | 
|---|
 | 969 |     // NB_TTY_CHANNELS <= 8 | 
|---|
| [628] | 970 |     iopic->p_clk                       (signal_clk); | 
|---|
 | 971 |     iopic->p_resetn                    (signal_resetn); | 
|---|
 | 972 |     iopic->p_vci_target                (signal_vci_tgt_iopi); | 
|---|
 | 973 |     iopic->p_vci_initiator             (signal_vci_ini_iopi); | 
|---|
| [664] | 974 |     for ( size_t i=0 ; i<32 ; i++) | 
|---|
| [628] | 975 |     { | 
|---|
 | 976 |        if     (i < NB_NIC_CHANNELS)    iopic->p_hwi[i] (signal_irq_mnic_rx[i]); | 
|---|
 | 977 |        else if(i < 2 )                 iopic->p_hwi[i] (signal_irq_false); | 
|---|
 | 978 |        else if(i < 2+NB_NIC_CHANNELS)  iopic->p_hwi[i] (signal_irq_mnic_tx[i-2]); | 
|---|
 | 979 |        else if(i < 4 )                 iopic->p_hwi[i] (signal_irq_false); | 
|---|
 | 980 |        else if(i < 4+NB_CMA_CHANNELS)  iopic->p_hwi[i] (signal_irq_cdma[i-4]); | 
|---|
| [664] | 981 |        else if(i < 8)                  iopic->p_hwi[i] (signal_irq_false); | 
|---|
 | 982 |        else if(i == 8)                 iopic->p_hwi[i] (signal_irq_bdev); | 
|---|
 | 983 |        else if(i < 16)                 iopic->p_hwi[i] (signal_irq_false); | 
|---|
 | 984 |        else if(i < 16+NB_TTY_CHANNELS) iopic->p_hwi[i] (signal_irq_mtty_rx[i-16]); | 
|---|
 | 985 |        else if(i < 24)                 iopic->p_hwi[i] (signal_irq_false); | 
|---|
 | 986 |        else if(i < 24+NB_TTY_CHANNELS) iopic->p_hwi[i] (signal_irq_false); | 
|---|
 | 987 | //     else if(i < 24+NB_TTY_CHANNELS) iopic->p_hwi[i] (signal_irq_mtty_tx[i-24]); | 
|---|
| [628] | 988 |        else                            iopic->p_hwi[i] (signal_irq_false); | 
|---|
 | 989 |     } | 
|---|
 | 990 |  | 
|---|
| [664] | 991 |     std::cout << "  - IOPIC connected" << std::endl; | 
|---|
 | 992 |  | 
|---|
| [628] | 993 |     // vci/dspin wrappers | 
|---|
 | 994 |     wi_iobus->p_clk                    (signal_clk); | 
|---|
 | 995 |     wi_iobus->p_resetn                 (signal_resetn); | 
|---|
 | 996 |     wi_iobus->p_vci                    (signal_vci_cmd_to_noc); | 
|---|
| [681] | 997 |     wi_iobus->p_dspin_cmd              (signal_dspin_bound_cmd_in[X_SIZE-1][Y_SIZE-1][NORTH]); | 
|---|
 | 998 |     wi_iobus->p_dspin_rsp              (signal_dspin_bound_rsp_out[X_SIZE-1][Y_SIZE-1][NORTH]); | 
|---|
| [628] | 999 |  | 
|---|
 | 1000 |     // vci/dspin wrappers | 
|---|
 | 1001 |     wt_iobus->p_clk                    (signal_clk); | 
|---|
 | 1002 |     wt_iobus->p_resetn                 (signal_resetn); | 
|---|
 | 1003 |     wt_iobus->p_vci                    (signal_vci_cmd_from_noc); | 
|---|
| [681] | 1004 |     wt_iobus->p_dspin_cmd              (signal_dspin_bound_cmd_out[X_SIZE-1][Y_SIZE-1][NORTH]); | 
|---|
 | 1005 |     wt_iobus->p_dspin_rsp              (signal_dspin_bound_rsp_in[X_SIZE-1][Y_SIZE-1][NORTH]); | 
|---|
| [628] | 1006 |  | 
|---|
 | 1007 |     // Clock & RESET for clusters | 
|---|
 | 1008 |     for (size_t x = 0; x < (X_SIZE); x++) | 
|---|
 | 1009 |     { | 
|---|
| [681] | 1010 |         for (size_t y = 0; y < (Y_SIZE); y++) | 
|---|
| [628] | 1011 |         { | 
|---|
 | 1012 |             clusters[x][y]->p_clk                    (signal_clk); | 
|---|
 | 1013 |             clusters[x][y]->p_resetn                 (signal_resetn); | 
|---|
 | 1014 |         } | 
|---|
 | 1015 |     } | 
|---|
 | 1016 |  | 
|---|
 | 1017 |     // Inter Clusters horizontal connections | 
|---|
 | 1018 |     if (X_SIZE > 1) | 
|---|
 | 1019 |     { | 
|---|
 | 1020 |         for (size_t x = 0; x < (X_SIZE-1); x++) | 
|---|
 | 1021 |         { | 
|---|
| [681] | 1022 |             for (size_t y = 0; y < (Y_SIZE); y++) | 
|---|
| [628] | 1023 |             { | 
|---|
 | 1024 |                 clusters[x][y]->p_cmd_out[EAST]      (signal_dspin_h_cmd_inc[x][y]); | 
|---|
 | 1025 |                 clusters[x+1][y]->p_cmd_in[WEST]     (signal_dspin_h_cmd_inc[x][y]); | 
|---|
 | 1026 |                 clusters[x][y]->p_cmd_in[EAST]       (signal_dspin_h_cmd_dec[x][y]); | 
|---|
 | 1027 |                 clusters[x+1][y]->p_cmd_out[WEST]    (signal_dspin_h_cmd_dec[x][y]); | 
|---|
 | 1028 |  | 
|---|
 | 1029 |                 clusters[x][y]->p_rsp_out[EAST]      (signal_dspin_h_rsp_inc[x][y]); | 
|---|
 | 1030 |                 clusters[x+1][y]->p_rsp_in[WEST]     (signal_dspin_h_rsp_inc[x][y]); | 
|---|
 | 1031 |                 clusters[x][y]->p_rsp_in[EAST]       (signal_dspin_h_rsp_dec[x][y]); | 
|---|
 | 1032 |                 clusters[x+1][y]->p_rsp_out[WEST]    (signal_dspin_h_rsp_dec[x][y]); | 
|---|
 | 1033 |  | 
|---|
 | 1034 |                 clusters[x][y]->p_m2p_out[EAST]      (signal_dspin_h_m2p_inc[x][y]); | 
|---|
 | 1035 |                 clusters[x+1][y]->p_m2p_in[WEST]     (signal_dspin_h_m2p_inc[x][y]); | 
|---|
 | 1036 |                 clusters[x][y]->p_m2p_in[EAST]       (signal_dspin_h_m2p_dec[x][y]); | 
|---|
 | 1037 |                 clusters[x+1][y]->p_m2p_out[WEST]    (signal_dspin_h_m2p_dec[x][y]); | 
|---|
 | 1038 |  | 
|---|
 | 1039 |                 clusters[x][y]->p_p2m_out[EAST]      (signal_dspin_h_p2m_inc[x][y]); | 
|---|
 | 1040 |                 clusters[x+1][y]->p_p2m_in[WEST]     (signal_dspin_h_p2m_inc[x][y]); | 
|---|
 | 1041 |                 clusters[x][y]->p_p2m_in[EAST]       (signal_dspin_h_p2m_dec[x][y]); | 
|---|
 | 1042 |                 clusters[x+1][y]->p_p2m_out[WEST]    (signal_dspin_h_p2m_dec[x][y]); | 
|---|
 | 1043 |  | 
|---|
 | 1044 |                 clusters[x][y]->p_cla_out[EAST]      (signal_dspin_h_cla_inc[x][y]); | 
|---|
 | 1045 |                 clusters[x+1][y]->p_cla_in[WEST]     (signal_dspin_h_cla_inc[x][y]); | 
|---|
 | 1046 |                 clusters[x][y]->p_cla_in[EAST]       (signal_dspin_h_cla_dec[x][y]); | 
|---|
 | 1047 |                 clusters[x+1][y]->p_cla_out[WEST]    (signal_dspin_h_cla_dec[x][y]); | 
|---|
| [621] | 1048 |             } | 
|---|
| [628] | 1049 |         } | 
|---|
 | 1050 |     } | 
|---|
 | 1051 |     std::cout << std::endl << "Horizontal connections done" << std::endl;    | 
|---|
| [621] | 1052 |  | 
|---|
| [628] | 1053 |     // Inter Clusters vertical connections | 
|---|
| [681] | 1054 |     if (Y_SIZE > 1)  | 
|---|
| [628] | 1055 |     { | 
|---|
| [681] | 1056 |         for (size_t y = 0; y < (Y_SIZE-1); y++) | 
|---|
| [628] | 1057 |         { | 
|---|
 | 1058 |             for (size_t x = 0; x < X_SIZE; x++) | 
|---|
 | 1059 |             { | 
|---|
 | 1060 |                 clusters[x][y]->p_cmd_out[NORTH]     (signal_dspin_v_cmd_inc[x][y]); | 
|---|
 | 1061 |                 clusters[x][y+1]->p_cmd_in[SOUTH]    (signal_dspin_v_cmd_inc[x][y]); | 
|---|
 | 1062 |                 clusters[x][y]->p_cmd_in[NORTH]      (signal_dspin_v_cmd_dec[x][y]); | 
|---|
 | 1063 |                 clusters[x][y+1]->p_cmd_out[SOUTH]   (signal_dspin_v_cmd_dec[x][y]); | 
|---|
 | 1064 |  | 
|---|
 | 1065 |                 clusters[x][y]->p_rsp_out[NORTH]     (signal_dspin_v_rsp_inc[x][y]); | 
|---|
 | 1066 |                 clusters[x][y+1]->p_rsp_in[SOUTH]    (signal_dspin_v_rsp_inc[x][y]); | 
|---|
 | 1067 |                 clusters[x][y]->p_rsp_in[NORTH]      (signal_dspin_v_rsp_dec[x][y]); | 
|---|
 | 1068 |                 clusters[x][y+1]->p_rsp_out[SOUTH]   (signal_dspin_v_rsp_dec[x][y]); | 
|---|
 | 1069 |  | 
|---|
 | 1070 |                 clusters[x][y]->p_m2p_out[NORTH]     (signal_dspin_v_m2p_inc[x][y]); | 
|---|
 | 1071 |                 clusters[x][y+1]->p_m2p_in[SOUTH]    (signal_dspin_v_m2p_inc[x][y]); | 
|---|
 | 1072 |                 clusters[x][y]->p_m2p_in[NORTH]      (signal_dspin_v_m2p_dec[x][y]); | 
|---|
 | 1073 |                 clusters[x][y+1]->p_m2p_out[SOUTH]   (signal_dspin_v_m2p_dec[x][y]); | 
|---|
 | 1074 |  | 
|---|
 | 1075 |                 clusters[x][y]->p_p2m_out[NORTH]     (signal_dspin_v_p2m_inc[x][y]); | 
|---|
 | 1076 |                 clusters[x][y+1]->p_p2m_in[SOUTH]    (signal_dspin_v_p2m_inc[x][y]); | 
|---|
 | 1077 |                 clusters[x][y]->p_p2m_in[NORTH]      (signal_dspin_v_p2m_dec[x][y]); | 
|---|
 | 1078 |                 clusters[x][y+1]->p_p2m_out[SOUTH]   (signal_dspin_v_p2m_dec[x][y]); | 
|---|
 | 1079 |  | 
|---|
 | 1080 |                 clusters[x][y]->p_cla_out[NORTH]     (signal_dspin_v_cla_inc[x][y]); | 
|---|
 | 1081 |                 clusters[x][y+1]->p_cla_in[SOUTH]    (signal_dspin_v_cla_inc[x][y]); | 
|---|
 | 1082 |                 clusters[x][y]->p_cla_in[NORTH]      (signal_dspin_v_cla_dec[x][y]); | 
|---|
 | 1083 |                 clusters[x][y+1]->p_cla_out[SOUTH]   (signal_dspin_v_cla_dec[x][y]); | 
|---|
| [621] | 1084 |             } | 
|---|
| [628] | 1085 |         } | 
|---|
 | 1086 |     } | 
|---|
 | 1087 |     std::cout << std::endl << "Vertical connections done" << std::endl; | 
|---|
| [621] | 1088 |  | 
|---|
| [628] | 1089 |     // East & West boundary cluster connections | 
|---|
| [681] | 1090 |     for (size_t y = 0; y < (Y_SIZE); y++) | 
|---|
| [628] | 1091 |     { | 
|---|
 | 1092 |         clusters[0][y]->p_cmd_in[WEST]           (signal_dspin_bound_cmd_in[0][y][WEST]); | 
|---|
 | 1093 |         clusters[0][y]->p_cmd_out[WEST]          (signal_dspin_bound_cmd_out[0][y][WEST]); | 
|---|
 | 1094 |         clusters[X_SIZE-1][y]->p_cmd_in[EAST]    (signal_dspin_bound_cmd_in[X_SIZE-1][y][EAST]); | 
|---|
 | 1095 |         clusters[X_SIZE-1][y]->p_cmd_out[EAST]   (signal_dspin_bound_cmd_out[X_SIZE-1][y][EAST]); | 
|---|
| [621] | 1096 |  | 
|---|
| [628] | 1097 |         clusters[0][y]->p_rsp_in[WEST]           (signal_dspin_bound_rsp_in[0][y][WEST]); | 
|---|
 | 1098 |         clusters[0][y]->p_rsp_out[WEST]          (signal_dspin_bound_rsp_out[0][y][WEST]); | 
|---|
 | 1099 |         clusters[X_SIZE-1][y]->p_rsp_in[EAST]    (signal_dspin_bound_rsp_in[X_SIZE-1][y][EAST]); | 
|---|
 | 1100 |         clusters[X_SIZE-1][y]->p_rsp_out[EAST]   (signal_dspin_bound_rsp_out[X_SIZE-1][y][EAST]); | 
|---|
| [621] | 1101 |  | 
|---|
| [628] | 1102 |         clusters[0][y]->p_m2p_in[WEST]           (signal_dspin_bound_m2p_in[0][y][WEST]); | 
|---|
 | 1103 |         clusters[0][y]->p_m2p_out[WEST]          (signal_dspin_bound_m2p_out[0][y][WEST]); | 
|---|
 | 1104 |         clusters[X_SIZE-1][y]->p_m2p_in[EAST]    (signal_dspin_bound_m2p_in[X_SIZE-1][y][EAST]); | 
|---|
 | 1105 |         clusters[X_SIZE-1][y]->p_m2p_out[EAST]   (signal_dspin_bound_m2p_out[X_SIZE-1][y][EAST]); | 
|---|
| [621] | 1106 |  | 
|---|
| [628] | 1107 |         clusters[0][y]->p_p2m_in[WEST]           (signal_dspin_bound_p2m_in[0][y][WEST]); | 
|---|
 | 1108 |         clusters[0][y]->p_p2m_out[WEST]          (signal_dspin_bound_p2m_out[0][y][WEST]); | 
|---|
 | 1109 |         clusters[X_SIZE-1][y]->p_p2m_in[EAST]    (signal_dspin_bound_p2m_in[X_SIZE-1][y][EAST]); | 
|---|
 | 1110 |         clusters[X_SIZE-1][y]->p_p2m_out[EAST]   (signal_dspin_bound_p2m_out[X_SIZE-1][y][EAST]); | 
|---|
| [621] | 1111 |  | 
|---|
| [628] | 1112 |         clusters[0][y]->p_cla_in[WEST]           (signal_dspin_bound_cla_in[0][y][WEST]); | 
|---|
 | 1113 |         clusters[0][y]->p_cla_out[WEST]          (signal_dspin_bound_cla_out[0][y][WEST]); | 
|---|
 | 1114 |         clusters[X_SIZE-1][y]->p_cla_in[EAST]    (signal_dspin_bound_cla_in[X_SIZE-1][y][EAST]); | 
|---|
 | 1115 |         clusters[X_SIZE-1][y]->p_cla_out[EAST]   (signal_dspin_bound_cla_out[X_SIZE-1][y][EAST]); | 
|---|
 | 1116 |     } | 
|---|
| [621] | 1117 |  | 
|---|
| [664] | 1118 |     std::cout << std::endl << "West & East boundaries connections done" << std::endl; | 
|---|
 | 1119 |  | 
|---|
| [628] | 1120 |     // North & South boundary clusters connections | 
|---|
 | 1121 |     for (size_t x = 0; x < X_SIZE; x++) | 
|---|
 | 1122 |     { | 
|---|
 | 1123 |         clusters[x][0]->p_cmd_in[SOUTH]          (signal_dspin_bound_cmd_in[x][0][SOUTH]); | 
|---|
 | 1124 |         clusters[x][0]->p_cmd_out[SOUTH]         (signal_dspin_bound_cmd_out[x][0][SOUTH]); | 
|---|
| [681] | 1125 |         clusters[x][Y_SIZE-1]->p_cmd_in[NORTH]   (signal_dspin_bound_cmd_in[x][Y_SIZE-1][NORTH]); | 
|---|
 | 1126 |         clusters[x][Y_SIZE-1]->p_cmd_out[NORTH]  (signal_dspin_bound_cmd_out[x][Y_SIZE-1][NORTH]); | 
|---|
| [621] | 1127 |  | 
|---|
| [628] | 1128 |         clusters[x][0]->p_rsp_in[SOUTH]          (signal_dspin_bound_rsp_in[x][0][SOUTH]); | 
|---|
 | 1129 |         clusters[x][0]->p_rsp_out[SOUTH]         (signal_dspin_bound_rsp_out[x][0][SOUTH]); | 
|---|
| [681] | 1130 |         clusters[x][Y_SIZE-1]->p_rsp_in[NORTH]   (signal_dspin_bound_rsp_in[x][Y_SIZE-1][NORTH]); | 
|---|
 | 1131 |         clusters[x][Y_SIZE-1]->p_rsp_out[NORTH]  (signal_dspin_bound_rsp_out[x][Y_SIZE-1][NORTH]); | 
|---|
| [621] | 1132 |  | 
|---|
| [628] | 1133 |         clusters[x][0]->p_m2p_in[SOUTH]          (signal_dspin_bound_m2p_in[x][0][SOUTH]); | 
|---|
 | 1134 |         clusters[x][0]->p_m2p_out[SOUTH]         (signal_dspin_bound_m2p_out[x][0][SOUTH]); | 
|---|
| [681] | 1135 |         clusters[x][Y_SIZE-1]->p_m2p_in[NORTH]   (signal_dspin_bound_m2p_in[x][Y_SIZE-1][NORTH]); | 
|---|
 | 1136 |         clusters[x][Y_SIZE-1]->p_m2p_out[NORTH]  (signal_dspin_bound_m2p_out[x][Y_SIZE-1][NORTH]); | 
|---|
| [621] | 1137 |  | 
|---|
| [628] | 1138 |         clusters[x][0]->p_p2m_in[SOUTH]          (signal_dspin_bound_p2m_in[x][0][SOUTH]); | 
|---|
 | 1139 |         clusters[x][0]->p_p2m_out[SOUTH]         (signal_dspin_bound_p2m_out[x][0][SOUTH]); | 
|---|
| [681] | 1140 |         clusters[x][Y_SIZE-1]->p_p2m_in[NORTH]   (signal_dspin_bound_p2m_in[x][Y_SIZE-1][NORTH]); | 
|---|
 | 1141 |         clusters[x][Y_SIZE-1]->p_p2m_out[NORTH]  (signal_dspin_bound_p2m_out[x][Y_SIZE-1][NORTH]); | 
|---|
| [628] | 1142 |  | 
|---|
 | 1143 |         clusters[x][0]->p_cla_in[SOUTH]          (signal_dspin_bound_cla_in[x][0][SOUTH]); | 
|---|
 | 1144 |         clusters[x][0]->p_cla_out[SOUTH]         (signal_dspin_bound_cla_out[x][0][SOUTH]); | 
|---|
| [681] | 1145 |         clusters[x][Y_SIZE-1]->p_cla_in[NORTH]   (signal_dspin_bound_cla_in[x][Y_SIZE-1][NORTH]); | 
|---|
 | 1146 |         clusters[x][Y_SIZE-1]->p_cla_out[NORTH]  (signal_dspin_bound_cla_out[x][Y_SIZE-1][NORTH]); | 
|---|
| [628] | 1147 |     } | 
|---|
 | 1148 |  | 
|---|
| [664] | 1149 |     std::cout << std::endl << "North & South boundaries connections done" << std::endl; | 
|---|
 | 1150 |  | 
|---|
| [628] | 1151 |     std::cout << std::endl; | 
|---|
 | 1152 |  | 
|---|
 | 1153 |     //////////////////////////////////////////////////////// | 
|---|
 | 1154 |     //   Simulation | 
|---|
 | 1155 |     /////////////////////////////////////////////////////// | 
|---|
 | 1156 |  | 
|---|
 | 1157 |     sc_start(sc_core::sc_time(0, SC_NS)); | 
|---|
 | 1158 |     signal_resetn    = false; | 
|---|
 | 1159 |     signal_irq_false = false; | 
|---|
 | 1160 |  | 
|---|
 | 1161 |     // set network boundaries signals default values | 
|---|
 | 1162 |     // for all boundary clusters but the IO cluster | 
|---|
 | 1163 |     for (size_t x = 0; x < X_SIZE ; x++) | 
|---|
 | 1164 |     { | 
|---|
| [681] | 1165 |         for (size_t y = 0; y < Y_SIZE ; y++) | 
|---|
| [628] | 1166 |         { | 
|---|
 | 1167 |             for (size_t face = 0; face < 4; face++) | 
|---|
 | 1168 |             { | 
|---|
| [681] | 1169 |                 if ( (x != X_SIZE-1) or (y != Y_SIZE-1) or (face != NORTH) ) | 
|---|
| [628] | 1170 |                 { | 
|---|
 | 1171 |                     signal_dspin_bound_cmd_in [x][y][face].write = false; | 
|---|
 | 1172 |                     signal_dspin_bound_cmd_in [x][y][face].read  = true; | 
|---|
 | 1173 |                     signal_dspin_bound_cmd_out[x][y][face].write = false; | 
|---|
 | 1174 |                     signal_dspin_bound_cmd_out[x][y][face].read  = true; | 
|---|
 | 1175 |  | 
|---|
 | 1176 |                     signal_dspin_bound_rsp_in [x][y][face].write = false; | 
|---|
 | 1177 |                     signal_dspin_bound_rsp_in [x][y][face].read  = true; | 
|---|
 | 1178 |                     signal_dspin_bound_rsp_out[x][y][face].write = false; | 
|---|
 | 1179 |                     signal_dspin_bound_rsp_out[x][y][face].read  = true; | 
|---|
 | 1180 |                 } | 
|---|
 | 1181 |  | 
|---|
 | 1182 |                 signal_dspin_bound_m2p_in [x][y][face].write = false; | 
|---|
 | 1183 |                 signal_dspin_bound_m2p_in [x][y][face].read  = true; | 
|---|
 | 1184 |                 signal_dspin_bound_m2p_out[x][y][face].write = false; | 
|---|
 | 1185 |                 signal_dspin_bound_m2p_out[x][y][face].read  = true; | 
|---|
 | 1186 |  | 
|---|
 | 1187 |                 signal_dspin_bound_p2m_in [x][y][face].write = false; | 
|---|
 | 1188 |                 signal_dspin_bound_p2m_in [x][y][face].read  = true; | 
|---|
 | 1189 |                 signal_dspin_bound_p2m_out[x][y][face].write = false; | 
|---|
 | 1190 |                 signal_dspin_bound_p2m_out[x][y][face].read  = true; | 
|---|
 | 1191 |  | 
|---|
 | 1192 |                 signal_dspin_bound_cla_in [x][y][face].write = false; | 
|---|
 | 1193 |                 signal_dspin_bound_cla_in [x][y][face].read  = true; | 
|---|
 | 1194 |                 signal_dspin_bound_cla_out[x][y][face].write = false; | 
|---|
 | 1195 |                 signal_dspin_bound_cla_out[x][y][face].read  = true; | 
|---|
| [621] | 1196 |             } | 
|---|
| [628] | 1197 |         } | 
|---|
 | 1198 |     } | 
|---|
| [621] | 1199 |  | 
|---|
| [664] | 1200 |     // set default values for VCI signals connected to unused ports on iobus  | 
|---|
 | 1201 |     signal_vci_tgt_memc.rspval = false; | 
|---|
 | 1202 |     signal_vci_tgt_xicu.rspval = false; | 
|---|
 | 1203 |     for ( size_t p = 0 ; p < NB_PROCS_MAX ; p++ ) signal_vci_ini_proc[p].cmdval = false; | 
|---|
 | 1204 |  | 
|---|
| [628] | 1205 |     sc_start(sc_core::sc_time(1, SC_NS)); | 
|---|
 | 1206 |     signal_resetn = true; | 
|---|
| [621] | 1207 |  | 
|---|
| [628] | 1208 |     if (gettimeofday(&t1, NULL) != 0)  | 
|---|
 | 1209 |     { | 
|---|
 | 1210 |         perror("gettimeofday"); | 
|---|
 | 1211 |         return EXIT_FAILURE; | 
|---|
 | 1212 |     } | 
|---|
| [621] | 1213 |  | 
|---|
| [664] | 1214 |     // variable used for IRQ trace | 
|---|
 | 1215 |     bool prev_irq_bdev = false; | 
|---|
 | 1216 |     bool prev_irq_mtty_rx[8]; | 
|---|
 | 1217 |     bool prev_irq_proc[16][16][4]; | 
|---|
| [621] | 1218 |  | 
|---|
| [664] | 1219 |     for( size_t x = 0 ; x<8  ; x++ ) prev_irq_mtty_rx[x] = false; | 
|---|
| [621] | 1220 |  | 
|---|
| [664] | 1221 |     for( size_t x = 0 ; x<16 ; x++ ) | 
|---|
 | 1222 |     for( size_t y = 0 ; y<16 ; y++ ) | 
|---|
 | 1223 |     for( size_t i = 0 ; i<4  ; i++ ) prev_irq_proc[x][y][i] = false; | 
|---|
| [621] | 1224 |  | 
|---|
| [664] | 1225 |     for (uint64_t n = 1; n < ncycles && !stop_called; n++) | 
|---|
 | 1226 |     { | 
|---|
 | 1227 |         // Monitor a specific address for L1 & L2 caches | 
|---|
 | 1228 |         // clusters[0][0]->proc[0]->cache_monitor(0x110002C078ULL); | 
|---|
 | 1229 |         // clusters[1][1]->memc->cache_monitor(0x110002c078ULL); | 
|---|
| [621] | 1230 |  | 
|---|
| [664] | 1231 |         // stats display | 
|---|
 | 1232 |         if( (n % 5000000) == 0) | 
|---|
 | 1233 |         { | 
|---|
| [621] | 1234 |  | 
|---|
| [664] | 1235 |             if (gettimeofday(&t2, NULL) != 0)  | 
|---|
 | 1236 |             { | 
|---|
 | 1237 |                 perror("gettimeofday"); | 
|---|
 | 1238 |                 return EXIT_FAILURE; | 
|---|
 | 1239 |             } | 
|---|
| [621] | 1240 |  | 
|---|
| [664] | 1241 |             ms1 = (uint64_t) t1.tv_sec * 1000ULL + (uint64_t) t1.tv_usec / 1000; | 
|---|
 | 1242 |             ms2 = (uint64_t) t2.tv_sec * 1000ULL + (uint64_t) t2.tv_usec / 1000; | 
|---|
 | 1243 |             std::cerr << "platform clock frequency "  | 
|---|
 | 1244 |                       << (double) 5000000 / (double) (ms2 - ms1) << "Khz" << std::endl; | 
|---|
| [621] | 1245 |  | 
|---|
| [664] | 1246 |             if (gettimeofday(&t1, NULL) != 0)  | 
|---|
 | 1247 |             { | 
|---|
 | 1248 |                 perror("gettimeofday"); | 
|---|
 | 1249 |                 return EXIT_FAILURE; | 
|---|
 | 1250 |             } | 
|---|
 | 1251 |         } | 
|---|
| [621] | 1252 |  | 
|---|
| [664] | 1253 |         // trace display | 
|---|
 | 1254 |         if ( trace_ok and (n > trace_from) ) | 
|---|
 | 1255 |         { | 
|---|
 | 1256 |             std::cout << "****************** cycle " << std::dec << n ; | 
|---|
 | 1257 |             std::cout << " ************************************************" << std::endl; | 
|---|
| [621] | 1258 |  | 
|---|
| [664] | 1259 |             size_t l = 0; | 
|---|
 | 1260 |             size_t x = 0; | 
|---|
 | 1261 |             size_t y = 0; | 
|---|
| [621] | 1262 |  | 
|---|
| [664] | 1263 |             if ( trace_proc_ok ) | 
|---|
 | 1264 |             { | 
|---|
 | 1265 |                 l = trace_proc_id % NB_PROCS_MAX ; | 
|---|
 | 1266 |                 x = (trace_proc_id / NB_PROCS_MAX) >> Y_WIDTH ; | 
|---|
 | 1267 |                 y = (trace_proc_id / NB_PROCS_MAX) & ((1<<Y_WIDTH) - 1); | 
|---|
| [621] | 1268 |  | 
|---|
| [664] | 1269 |                 std::ostringstream proc_signame; | 
|---|
 | 1270 |                 proc_signame << "[SIG]PROC_" << x << "_" << y << "_" << l ; | 
|---|
| [681] | 1271 |                 clusters[x][y]->proc[l]->print_trace(1); | 
|---|
| [664] | 1272 |                 clusters[x][y]->signal_vci_ini_proc[l].print_trace(proc_signame.str()); | 
|---|
| [628] | 1273 |  | 
|---|
| [664] | 1274 |                 std::ostringstream xicu_signame; | 
|---|
 | 1275 |                 xicu_signame << "[SIG]XICU_" << x << "_" << y ; | 
|---|
 | 1276 |                 clusters[x][y]->xicu->print_trace(0); | 
|---|
 | 1277 |                 clusters[x][y]->signal_vci_tgt_xicu.print_trace(xicu_signame.str()); | 
|---|
 | 1278 |             } | 
|---|
| [628] | 1279 |  | 
|---|
| [664] | 1280 |             if ( trace_memc_ok ) | 
|---|
 | 1281 |             { | 
|---|
 | 1282 |                 x = trace_memc_id >> Y_WIDTH; | 
|---|
 | 1283 |                 y = trace_memc_id & ((1<<Y_WIDTH) - 1); | 
|---|
 | 1284 |  | 
|---|
 | 1285 |                 std::ostringstream smemc; | 
|---|
 | 1286 |                 smemc << "[SIG]MEMC_" << x << "_" << y; | 
|---|
 | 1287 |                 std::ostringstream sxram; | 
|---|
 | 1288 |                 sxram << "[SIG]XRAM_" << x << "_" << y; | 
|---|
 | 1289 |  | 
|---|
 | 1290 |                 clusters[x][y]->memc->print_trace(); | 
|---|
 | 1291 |                 clusters[x][y]->signal_vci_tgt_memc.print_trace(smemc.str()); | 
|---|
 | 1292 |                 clusters[x][y]->signal_vci_xram.print_trace(sxram.str()); | 
|---|
 | 1293 |             }    | 
|---|
 | 1294 |  | 
|---|
 | 1295 |             // trace coherence signals | 
|---|
 | 1296 |             // clusters[0][0]->signal_dspin_m2p_proc[0].print_trace("[CC_M2P_0_0]"); | 
|---|
 | 1297 |             // clusters[0][1]->signal_dspin_m2p_proc[0].print_trace("[CC_M2P_0_1]"); | 
|---|
 | 1298 |             // clusters[1][0]->signal_dspin_m2p_proc[0].print_trace("[CC_M2P_1_0]"); | 
|---|
 | 1299 |             // clusters[1][1]->signal_dspin_m2p_proc[0].print_trace("[CC_M2P_1_1]"); | 
|---|
 | 1300 |  | 
|---|
 | 1301 |             // clusters[0][0]->signal_dspin_p2m_proc[0].print_trace("[CC_P2M_0_0]"); | 
|---|
 | 1302 |             // clusters[0][1]->signal_dspin_p2m_proc[0].print_trace("[CC_P2M_0_1]"); | 
|---|
 | 1303 |             // clusters[1][0]->signal_dspin_p2m_proc[0].print_trace("[CC_P2M_1_0]"); | 
|---|
 | 1304 |             // clusters[1][1]->signal_dspin_p2m_proc[0].print_trace("[CC_P2M_1_1]"); | 
|---|
 | 1305 |  | 
|---|
 | 1306 |             // trace xbar(s) m2p | 
|---|
 | 1307 |             // clusters[0][0]->xbar_m2p->print_trace(); | 
|---|
 | 1308 |             // clusters[1][0]->xbar_m2p->print_trace(); | 
|---|
 | 1309 |             // clusters[0][1]->xbar_m2p->print_trace(); | 
|---|
 | 1310 |             // clusters[1][1]->xbar_m2p->print_trace(); | 
|---|
| [621] | 1311 |          | 
|---|
| [664] | 1312 |             // trace router(s) m2p | 
|---|
 | 1313 |             // clusters[0][0]->router_m2p->print_trace(); | 
|---|
 | 1314 |             // clusters[1][0]->router_m2p->print_trace(); | 
|---|
 | 1315 |             // clusters[0][1]->router_m2p->print_trace(); | 
|---|
 | 1316 |             // clusters[1][1]->router_m2p->print_trace(); | 
|---|
| [628] | 1317 |          | 
|---|
| [664] | 1318 |             // trace external ioc | 
|---|
 | 1319 |             bdev->print_trace(); | 
|---|
 | 1320 |             signal_vci_tgt_bdev.print_trace("[SIG]BDEV_TGT"); | 
|---|
 | 1321 |             signal_vci_ini_bdev.print_trace("[SIG]BDEV_INI"); | 
|---|
| [621] | 1322 |  | 
|---|
| [664] | 1323 |             // trace external iopic | 
|---|
 | 1324 |             iopic->print_trace(); | 
|---|
 | 1325 |             signal_vci_tgt_iopi.print_trace("[SIG]IOPI_TGT"); | 
|---|
 | 1326 |             signal_vci_ini_iopi.print_trace("[SIG]IOPI_INI"); | 
|---|
| [621] | 1327 |  | 
|---|
| [664] | 1328 |             // trace internal tty | 
|---|
 | 1329 |             // clusters[0][0]->mtty->print_trace(); | 
|---|
 | 1330 |             // clusters[0][0]->signal_vci_tgt_mtty.print_trace("[SIG]MTTY"); | 
|---|
| [628] | 1331 |  | 
|---|
| [664] | 1332 |         }  // end trace | 
|---|
| [621] | 1333 |  | 
|---|
| [664] | 1334 |         if (0) | 
|---|
 | 1335 |         { | 
|---|
 | 1336 |             // trace BDV interrupts events | 
|---|
 | 1337 |             if ( signal_irq_bdev.read() != prev_irq_bdev )  | 
|---|
 | 1338 |             { | 
|---|
 | 1339 |                 prev_irq_bdev = signal_irq_bdev.read(); | 
|---|
 | 1340 |                 std::cout << std::dec << "@@@ IRQ_BDEV = " << signal_irq_bdev.read() | 
|---|
 | 1341 |                           << " at cycle " << n << std::endl; | 
|---|
 | 1342 |             } | 
|---|
 | 1343 |          | 
|---|
 | 1344 |             // trace TTY interrupts events | 
|---|
 | 1345 |             for ( size_t x = 0 ; x < 8 ; x++ ) | 
|---|
 | 1346 |             { | 
|---|
 | 1347 |                 if ( signal_irq_mtty_rx[x].read() != prev_irq_mtty_rx[x] )  | 
|---|
 | 1348 |                 { | 
|---|
 | 1349 |                     prev_irq_mtty_rx[x] = signal_irq_mtty_rx[x].read(); | 
|---|
 | 1350 |                     std::cout << std::dec << "@@@ IRQ_MTTY["<<x<<"] = "  | 
|---|
 | 1351 |                               << signal_irq_mtty_rx[x].read() | 
|---|
 | 1352 |                               << " at cycle " << n << std::endl; | 
|---|
 | 1353 |                 } | 
|---|
 | 1354 |             } | 
|---|
| [621] | 1355 |  | 
|---|
| [664] | 1356 |             // trace processor interrupts events | 
|---|
| [681] | 1357 |             for ( size_t x = 0 ; x < X_SIZE ; x++ ) | 
|---|
 | 1358 |             for ( size_t y = 0 ; y < Y_SIZE ; y++ ) | 
|---|
 | 1359 |             for ( size_t i = 0 ; i < NB_PROCS_MAX ; i++ ) | 
|---|
| [664] | 1360 |             { | 
|---|
 | 1361 |                 if ( clusters[x][y]->signal_proc_irq[i] != prev_irq_proc[x][y][i] ) | 
|---|
 | 1362 |                 {  | 
|---|
 | 1363 |                     prev_irq_proc[x][y][i] = clusters[x][y]->signal_proc_irq[i]; | 
|---|
 | 1364 |                     std::cout << std::dec << "@@@ IRQ_PROC["<<x<<","<<y<<","<<i<<"] = " | 
|---|
 | 1365 |                               << clusters[x][y]->signal_proc_irq[i] | 
|---|
 | 1366 |                               << " at cycle " << n << std::endl; | 
|---|
 | 1367 |                 } | 
|---|
 | 1368 |             } | 
|---|
 | 1369 |  | 
|---|
 | 1370 |             // trace VCI transactions on IOPIC and XCU(0,0) | 
|---|
 | 1371 |             signal_vci_tgt_iopi.print_trace("@@@ IOPI_TGT"); | 
|---|
 | 1372 |             signal_vci_ini_iopi.print_trace("@@@ IOPI_INI"); | 
|---|
 | 1373 |             clusters[0][0]->signal_vci_tgt_xicu.print_trace("@@@ XCU_0_0"); | 
|---|
 | 1374 |         } | 
|---|
 | 1375 |  | 
|---|
 | 1376 |         sc_start(sc_core::sc_time(1, SC_NS)); | 
|---|
 | 1377 |     } | 
|---|
 | 1378 |     // Free memory | 
|---|
| [681] | 1379 |     for (size_t i = 0 ; i  < (X_SIZE * Y_SIZE) ; i++) | 
|---|
| [664] | 1380 |     { | 
|---|
| [681] | 1381 |         size_t x = i / (Y_SIZE); | 
|---|
 | 1382 |         size_t y = i % (Y_SIZE); | 
|---|
| [664] | 1383 |         delete clusters[x][y]; | 
|---|
 | 1384 |     } | 
|---|
 | 1385 |  | 
|---|
 | 1386 |     return EXIT_SUCCESS; | 
|---|
| [621] | 1387 | } | 
|---|
 | 1388 |  | 
|---|
 | 1389 |  | 
|---|
| [628] | 1390 | void handler(int dummy = 0)  | 
|---|
 | 1391 | { | 
|---|
| [621] | 1392 |    stop_called = true; | 
|---|
 | 1393 |    sc_stop(); | 
|---|
 | 1394 | } | 
|---|
 | 1395 |  | 
|---|
 | 1396 | void voidhandler(int dummy = 0) {} | 
|---|
 | 1397 |  | 
|---|
 | 1398 | int sc_main (int argc, char *argv[]) | 
|---|
 | 1399 | { | 
|---|
 | 1400 |    signal(SIGINT, handler); | 
|---|
 | 1401 |    signal(SIGPIPE, voidhandler); | 
|---|
 | 1402 |  | 
|---|
 | 1403 |    try { | 
|---|
 | 1404 |       return _main(argc, argv); | 
|---|
 | 1405 |    } catch (std::exception &e) { | 
|---|
 | 1406 |       std::cout << e.what() << std::endl; | 
|---|
 | 1407 |    } catch (...) { | 
|---|
 | 1408 |       std::cout << "Unknown exception occured" << std::endl; | 
|---|
 | 1409 |       throw; | 
|---|
 | 1410 |    } | 
|---|
 | 1411 |    return 1; | 
|---|
 | 1412 | } | 
|---|
 | 1413 |  | 
|---|
 | 1414 |  | 
|---|
 | 1415 | // Local Variables: | 
|---|
 | 1416 | // tab-width: 3 | 
|---|
 | 1417 | // c-basic-offset: 3 | 
|---|
 | 1418 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) | 
|---|
 | 1419 | // indent-tabs-mode: nil | 
|---|
 | 1420 | // End: | 
|---|
 | 1421 |  | 
|---|
 | 1422 | // vim: filetype=cpp:expandtab:shiftwidth=3:tabstop=3:softtabstop=3 | 
|---|