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