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