[450] | 1 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 2 | // File: top.cpp |
---|
| 3 | // Author: Alain Greiner |
---|
| 4 | // Copyright: UPMC/LIP6 |
---|
| 5 | // Date : august 2013 |
---|
| 6 | // This program is released under the GNU public license |
---|
| 7 | /////////////////////////////////////////////////////////////////////////////// |
---|
[472] | 8 | // This file define a generic TSAR architecture with an IO network emulating |
---|
[450] | 9 | // an external bus (i.e. Hypertransport) to access external peripherals: |
---|
| 10 | // |
---|
[472] | 11 | // - BROM : boot ROM |
---|
| 12 | // - FBUF : Frame Buffer |
---|
| 13 | // - MTTY : multi TTY (up to 15 channels) |
---|
| 14 | // - MNIC : Network controller (up to 2 channels) |
---|
[498] | 15 | // - CDMA : Chained Buffer DMA controller (up to 4 channels) |
---|
[472] | 16 | // - BDEV : Dlock Device controler (1 channel) |
---|
[450] | 17 | // |
---|
| 18 | // The internal physical address space is 40 bits. |
---|
| 19 | // |
---|
[472] | 20 | // It contains a 2D mesh of XMAX*YMAX clusters, and 3 networks: |
---|
[450] | 21 | // |
---|
| 22 | // 1) the INT network supports Read/Write transactions |
---|
| 23 | // between processors and L2 caches or peripherals. |
---|
| 24 | // (VCI ADDDRESS = 40 bits / VCI DATA width = 32 bits) |
---|
| 25 | // It supports also coherence transactions between L1 & L2 caches. |
---|
| 26 | // 3) the RAM network is emulating the 3D network between L2 caches |
---|
[472] | 27 | // and L3 caches, and is implemented as a 2D mesh between the L2 caches, |
---|
| 28 | // the two IO bridges and the physical RAMs disributed in all clusters. |
---|
[450] | 29 | // (VCI ADDRESS = 40 bits / VCI DATA = 64 bits) |
---|
| 30 | // 4) the IOX network connects the two IO bridge components to the |
---|
| 31 | // 6 external peripheral controllers. |
---|
| 32 | // (VCI ADDDRESS = 40 bits / VCI DATA width = 64 bits) |
---|
| 33 | // |
---|
[472] | 34 | // The external peripherals IRQs are connected to the XICU component |
---|
| 35 | // in cluster(0,0): therefore, the number of channels for the external |
---|
| 36 | // peripherals (MTTY, MNIC, CDMA) is limited by the number of IRQ ports... |
---|
[450] | 37 | // |
---|
[472] | 38 | // In all clusters, the IRQs are connected to XICU as follow: |
---|
| 39 | // - IRQ_IN[0] to IRQ_IN[3] not connected (reserved for context switch) |
---|
| 40 | // - IRQ_IN[4] to IRQ_IN[7] are connected to 4 MDMA channels |
---|
| 41 | // |
---|
| 42 | // In external peripheral IRQs are connected in cluster(0,0) only: |
---|
| 43 | // - IRQ_IN[8] to IRQ_IN[9] are connected to 2 NIC_RX channels. |
---|
| 44 | // - IRQ_IN[10] to IRQ_IN[11] are connected to 2 NIC_TX channels. |
---|
| 45 | // - IRQ_IN[12] to IRQ_IN[15] are connected to 4 CDMA channels |
---|
| 46 | // - IRQ_IN[16] to IRQ_IN[30] are connected to 15 TTY channels |
---|
| 47 | // - IRQ_IN[31] is connected to BDEV |
---|
| 48 | // |
---|
[450] | 49 | // All clusters are identical, but cluster(0,0) and cluster(XMAX-1,YMAX-1) |
---|
| 50 | // contain an extra IO bridge component. These IOB0 & IOB1 components are |
---|
| 51 | // connected to the three networks (INT, RAM, IOX). |
---|
| 52 | // The number of clusters cannot be larger than 256. |
---|
[472] | 53 | // The number of processors per cluster cannot be larger than 4. |
---|
[450] | 54 | // |
---|
| 55 | // - It uses two dspin_local_crossbar per cluster to implement the |
---|
| 56 | // local interconnect correponding to the INT network. |
---|
| 57 | // - It uses two dspin_local_crossbar per cluster to implement the |
---|
| 58 | // local interconnect correponding to the coherence INT network. |
---|
| 59 | // - It uses two virtual_dspin_router per cluster to implement |
---|
| 60 | // the INT network (routing both the direct and coherence trafic). |
---|
| 61 | // - It uses two dspin_router per cluster to implement the RAM network. |
---|
| 62 | // - It uses the vci_cc_vcache_wrapper. |
---|
| 63 | // - It uses the vci_mem_cache. |
---|
| 64 | // - It contains one vci_xicu and one vci_multi_dma per cluster. |
---|
| 65 | // - It contains one vci_simple ram per cluster to model the L3 cache. |
---|
| 66 | // |
---|
| 67 | // The TsarIobCluster component is defined in files |
---|
| 68 | // tsar_iob_cluster.* (with * = cpp, h, sd) |
---|
| 69 | // |
---|
| 70 | // The main hardware parameters must be defined in the hard_config.h file : |
---|
| 71 | // - XMAX : number of clusters in a row (power of 2) |
---|
| 72 | // - YMAX : number of clusters in a column (power of 2) |
---|
| 73 | // - CLUSTER_SIZE : size of the segment allocated to a cluster |
---|
| 74 | // - NB_PROCS_MAX : number of processors per cluster (power of 2) |
---|
| 75 | // - NB_DMA_CHANNELS : number of DMA channels per cluster (< 9) |
---|
| 76 | // - NB_TTY_CHANNELS : number of TTY channels in I/O network (< 16) |
---|
| 77 | // - NB_NIC_CHANNELS : number of NIC channels in I/O network (< 9) |
---|
| 78 | // |
---|
| 79 | // Some secondary hardware parameters must be defined in this top.cpp file: |
---|
| 80 | // - XRAM_LATENCY : external ram latency |
---|
| 81 | // - MEMC_WAYS : L2 cache number of ways |
---|
| 82 | // - MEMC_SETS : L2 cache number of sets |
---|
| 83 | // - L1_IWAYS |
---|
| 84 | // - L1_ISETS |
---|
| 85 | // - L1_DWAYS |
---|
| 86 | // - L1_DSETS |
---|
| 87 | // - FBUF_X_SIZE : width of frame buffer (pixels) |
---|
| 88 | // - FBUF_Y_SIZE : heigth of frame buffer (lines) |
---|
| 89 | // - BDEV_SECTOR_SIZE : block size for block drvice |
---|
| 90 | // - BDEV_IMAGE_NAME : file pathname for block device |
---|
| 91 | // - NIC_RX_NAME : file pathname for NIC received packets |
---|
| 92 | // - NIC_TX_NAME : file pathname for NIC transmited packets |
---|
| 93 | // - NIC_TIMEOUT : max number of cycles before closing a container |
---|
| 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 | // |x_width|y_width|---| 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 | // |x_width|y_width|---| 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_iob_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 | |
---|
| 129 | #include "alloc_elems.h" |
---|
| 130 | |
---|
| 131 | /////////////////////////////////////////////////// |
---|
| 132 | // OS |
---|
| 133 | /////////////////////////////////////////////////// |
---|
| 134 | #define USE_ALMOS 0 |
---|
| 135 | |
---|
| 136 | #define almos_bootloader_pathname "bootloader.bin" |
---|
| 137 | #define almos_kernel_pathname "kernel-soclib.bin@0xbfc10000:D" |
---|
| 138 | #define almos_archinfo_pathname "arch-info.bin@0xBFC08000:D" |
---|
| 139 | |
---|
| 140 | /////////////////////////////////////////////////// |
---|
| 141 | // Parallelisation |
---|
| 142 | /////////////////////////////////////////////////// |
---|
| 143 | #define USE_OPENMP 0 |
---|
| 144 | |
---|
| 145 | #if USE_OPENMP |
---|
| 146 | #include <omp.h> |
---|
| 147 | #endif |
---|
| 148 | |
---|
| 149 | /////////////////////////////////////////////////////////// |
---|
| 150 | // DSPIN parameters |
---|
| 151 | /////////////////////////////////////////////////////////// |
---|
| 152 | |
---|
| 153 | #define dspin_int_cmd_width 39 |
---|
| 154 | #define dspin_int_rsp_width 32 |
---|
| 155 | |
---|
| 156 | #define dspin_ram_cmd_width 64 |
---|
| 157 | #define dspin_ram_rsp_width 64 |
---|
| 158 | |
---|
| 159 | /////////////////////////////////////////////////////////// |
---|
| 160 | // VCI fields width for the 3 VCI networks |
---|
| 161 | /////////////////////////////////////////////////////////// |
---|
| 162 | |
---|
| 163 | #define vci_cell_width_int 4 |
---|
| 164 | #define vci_cell_width_ext 8 |
---|
| 165 | |
---|
| 166 | #define vci_plen_width 8 |
---|
| 167 | #define vci_address_width 40 |
---|
| 168 | #define vci_rerror_width 1 |
---|
| 169 | #define vci_clen_width 1 |
---|
| 170 | #define vci_rflag_width 1 |
---|
| 171 | #define vci_srcid_width 14 |
---|
| 172 | #define vci_pktid_width 4 |
---|
| 173 | #define vci_trdid_width 4 |
---|
| 174 | #define vci_wrplen_width 1 |
---|
| 175 | |
---|
| 176 | //////////////////////////////////////////////////////////// |
---|
| 177 | // Main Hardware Parameters values |
---|
| 178 | //////////////////////i///////////////////////////////////// |
---|
| 179 | |
---|
| 180 | #include "giet_vm/hard_config.h" |
---|
| 181 | |
---|
| 182 | //////////////////////////////////////////////////////////// |
---|
| 183 | // Secondary Hardware Parameters values |
---|
| 184 | //////////////////////i///////////////////////////////////// |
---|
| 185 | |
---|
| 186 | #define XMAX CLUSTER_X |
---|
| 187 | #define YMAX CLUSTER_Y |
---|
| 188 | |
---|
| 189 | #define XRAM_LATENCY 0 |
---|
| 190 | |
---|
| 191 | #define MEMC_WAYS 16 |
---|
| 192 | #define MEMC_SETS 256 |
---|
| 193 | |
---|
| 194 | #define L1_IWAYS 4 |
---|
| 195 | #define L1_ISETS 64 |
---|
| 196 | |
---|
| 197 | #define L1_DWAYS 4 |
---|
| 198 | #define L1_DSETS 64 |
---|
| 199 | |
---|
| 200 | #define FBUF_X_SIZE 128 |
---|
| 201 | #define FBUF_Y_SIZE 128 |
---|
| 202 | |
---|
| 203 | #define BDEV_SECTOR_SIZE 512 |
---|
| 204 | #define BDEV_IMAGE_NAME "giet_vm/display/images.raw" |
---|
| 205 | |
---|
| 206 | #define NIC_RX_NAME "giet_vm/nic/rx_packets.txt" |
---|
| 207 | #define NIC_TX_NAME "giet_vm/nic/tx_packets.txt" |
---|
| 208 | #define NIC_TIMEOUT 10000 |
---|
| 209 | |
---|
| 210 | #define NORTH 0 |
---|
| 211 | #define SOUTH 1 |
---|
| 212 | #define EAST 2 |
---|
| 213 | #define WEST 3 |
---|
| 214 | |
---|
| 215 | #define cluster(x,y) ((y) + YMAX*(x)) |
---|
| 216 | |
---|
| 217 | //////////////////////////////////////////////////////////// |
---|
| 218 | // Software to be loaded in ROM & RAM |
---|
| 219 | //////////////////////i///////////////////////////////////// |
---|
| 220 | |
---|
| 221 | #define BOOT_SOFT_NAME "giet_vm/soft.elf" |
---|
| 222 | |
---|
| 223 | //////////////////////////////////////////////////////////// |
---|
| 224 | // DEBUG Parameters default values |
---|
| 225 | //////////////////////i///////////////////////////////////// |
---|
| 226 | |
---|
| 227 | #define MAX_FROZEN_CYCLES 10000 |
---|
| 228 | |
---|
| 229 | ///////////////////////////////////////////////////////// |
---|
| 230 | // Physical segments definition |
---|
| 231 | ///////////////////////////////////////////////////////// |
---|
| 232 | |
---|
| 233 | // Non replicated peripherals |
---|
| 234 | |
---|
| 235 | #define BROM_BASE 0x00BFC00000 |
---|
| 236 | #define BROM_SIZE 0x0000100000 // 1 M Kbytes |
---|
| 237 | |
---|
| 238 | #define IOBX_BASE 0x00BE000000 |
---|
| 239 | #define IOBX_SIZE 0x0000001000 // 4 K Kbytes |
---|
| 240 | |
---|
| 241 | #define BDEV_BASE 0x00B3000000 |
---|
| 242 | #define BDEV_SIZE 0x0000001000 // 4 Kbytes |
---|
| 243 | |
---|
| 244 | #define MTTY_BASE 0x00B4000000 |
---|
| 245 | #define MTTY_SIZE 0x0000001000 * NB_TTY_CHANNELS // 4 Kbytes |
---|
| 246 | |
---|
| 247 | #define MNIC_BASE 0x00B5000000 |
---|
| 248 | #define MNIC_SIZE 0x0000080000 // 512 Kbytes |
---|
| 249 | |
---|
| 250 | #define CDMA_BASE 0x00B6000000 |
---|
| 251 | #define CDMA_SIZE 0x0000001000 * (NB_NIC_CHANNELS * 2) // 4 Kbytes per channel |
---|
| 252 | |
---|
| 253 | #define FBUF_BASE 0x00B7000000 |
---|
| 254 | #define FBUF_SIZE FBUF_X_SIZE * FBUF_Y_SIZE |
---|
| 255 | |
---|
| 256 | // replicated segments : address is incremented by a cluster offset |
---|
| 257 | // offset = cluster(x,y) << (address_width-x_width-y_width); |
---|
| 258 | |
---|
| 259 | #define XRAM_BASE 0x0000000000 |
---|
| 260 | #define XRAM_SIZE 0x0010000000 // 256 Mbytes |
---|
| 261 | |
---|
| 262 | #define XICU_BASE 0x00B0000000 |
---|
| 263 | #define XICU_SIZE 0x0000001000 // 4 Kbytes |
---|
| 264 | |
---|
| 265 | #define MDMA_BASE 0x00B1000000 |
---|
| 266 | #define MDMA_SIZE 0x0000001000 * NB_DMA_CHANNELS // 4 Kbytes per channel |
---|
| 267 | |
---|
| 268 | #define MEMC_BASE 0x00B2000000 |
---|
| 269 | #define MEMC_SIZE 0x0000001000 // 4 Kbytes |
---|
| 270 | |
---|
| 271 | |
---|
| 272 | //////////////////////////////////////////////////////////////////////// |
---|
| 273 | // SRCID definition |
---|
| 274 | //////////////////////////////////////////////////////////////////////// |
---|
| 275 | // All initiators are in the same indexing space (14 bits). |
---|
| 276 | // The SRCID is structured in two fields: |
---|
| 277 | // - The 10 MSB bits define the cluster index (left aligned) |
---|
| 278 | // - The 4 LSB bits define the local index. |
---|
| 279 | // Two different initiators cannot have the same SRCID, but a given |
---|
| 280 | // initiator can have two alias SRCIDs: |
---|
| 281 | // - Internal initiators (procs, mdma) are replicated in all clusters, |
---|
| 282 | // and each initiator has one single SRCID. |
---|
| 283 | // - External initiators (bdev, cdma) are not replicated, but can be |
---|
| 284 | // accessed in 2 clusters : cluster_iob0 and cluster_iob1. |
---|
| 285 | // They have the same local index, but two different cluster indexes. |
---|
| 286 | // As cluster_iob0 and cluster_iob1 contain both internal initiators |
---|
| 287 | // and external initiators, they must have different local indexes. |
---|
| 288 | // Consequence: For a local interconnect, the INI_ID port index |
---|
| 289 | // is NOT equal to the SRCID local index, and the local interconnect |
---|
| 290 | // must make a translation: SRCID => INI_ID (port index) |
---|
| 291 | //////////////////////////////////////////////////////////////////////// |
---|
| 292 | |
---|
| 293 | #define PROC_LOCAL_SRCID 0 // from 0 to 7 |
---|
| 294 | #define MDMA_LOCAL_SRCID 8 |
---|
| 295 | #define IOBX_LOCAL_SRCID 9 |
---|
| 296 | #define BDEV_LOCAL_SRCID 10 |
---|
| 297 | #define CDMA_LOCAL_SRCID 11 |
---|
| 298 | #define MEMC_LOCAL_SRCID 12 |
---|
| 299 | |
---|
| 300 | //////////////////////////////////////////////////////////////////// |
---|
| 301 | // TGT_ID and INI_ID port indexing for INT local interconnect |
---|
| 302 | //////////////////////////////////////////////////////////////////// |
---|
| 303 | |
---|
| 304 | #define INT_MEMC_TGT_ID 0 |
---|
| 305 | #define INT_XICU_TGT_ID 1 |
---|
| 306 | #define INT_MDMA_TGT_ID 2 |
---|
| 307 | #define INT_IOBX_TGT_ID 3 |
---|
| 308 | |
---|
| 309 | #define INT_PROC_INI_ID 0 // from 0 to (NB_PROCS_MAX-1) |
---|
| 310 | #define INT_MDMA_INI_ID NB_PROCS_MAX |
---|
| 311 | #define INT_IOBX_INI_ID (NB_PROCS_MAX+1) |
---|
| 312 | |
---|
| 313 | //////////////////////////////////////////////////////////////////// |
---|
| 314 | // TGT_ID and INI_ID port indexing for RAM local interconnect |
---|
| 315 | //////////////////////////////////////////////////////////////////// |
---|
| 316 | |
---|
| 317 | #define RAM_XRAM_TGT_ID 0 |
---|
| 318 | |
---|
| 319 | #define RAM_MEMC_INI_ID 0 |
---|
| 320 | #define RAM_IOBX_INI_ID 1 |
---|
| 321 | |
---|
| 322 | //////////////////////////////////////////////////////////////////// |
---|
| 323 | // TGT_ID and INI_ID port indexing for I0X local interconnect |
---|
| 324 | //////////////////////////////////////////////////////////////////// |
---|
| 325 | |
---|
| 326 | #define IOX_IOB0_TGT_ID 0 // don't change this value |
---|
| 327 | #define IOX_IOB1_TGT_ID 1 // don't change this value |
---|
| 328 | #define IOX_FBUF_TGT_ID 2 |
---|
| 329 | #define IOX_BDEV_TGT_ID 3 |
---|
| 330 | #define IOX_MNIC_TGT_ID 4 |
---|
| 331 | #define IOX_CDMA_TGT_ID 5 |
---|
| 332 | #define IOX_BROM_TGT_ID 6 |
---|
| 333 | #define IOX_MTTY_TGT_ID 7 |
---|
| 334 | |
---|
| 335 | #define IOX_IOB0_INI_ID 0 // Don't change this value |
---|
| 336 | #define IOX_IOB1_INI_ID 1 // Don't change this value |
---|
| 337 | #define IOX_BDEV_INI_ID 2 |
---|
| 338 | #define IOX_CDMA_INI_ID 3 |
---|
| 339 | |
---|
| 340 | ///////////////////////////////////////////////////////////////////// |
---|
| 341 | int _main(int argc, char *argv[]) |
---|
| 342 | ///////////////////////////////////////////////////////////////////// |
---|
| 343 | { |
---|
| 344 | using namespace sc_core; |
---|
| 345 | using namespace soclib::caba; |
---|
| 346 | using namespace soclib::common; |
---|
| 347 | |
---|
| 348 | |
---|
| 349 | char soft_name[256] = BOOT_SOFT_NAME; // pathname: binary code |
---|
| 350 | size_t ncycles = 1000000000; // simulated cycles |
---|
| 351 | char disk_name[256] = BDEV_IMAGE_NAME; // pathname: disk image |
---|
| 352 | char nic_rx_name[256] = NIC_RX_NAME; // pathname: rx packets file |
---|
| 353 | char nic_tx_name[256] = NIC_TX_NAME; // pathname: tx packets file |
---|
| 354 | ssize_t threads_nr = 1; // simulator's threads number |
---|
| 355 | bool debug_ok = false; // trace activated |
---|
| 356 | size_t debug_period = 1; // trace period |
---|
| 357 | size_t debug_memc_id = 0xFFFFFFFF; // index of traced memc |
---|
| 358 | size_t debug_proc_id = 0xFFFFFFFF; // index of traced proc |
---|
| 359 | bool debug_iob = false; // trace iob0 & iob1 when true |
---|
| 360 | uint32_t debug_from = 0; // trace start cycle |
---|
| 361 | uint32_t frozen_cycles = MAX_FROZEN_CYCLES; // monitoring frozen processor |
---|
| 362 | size_t cluster_iob0 = cluster(0,0); // cluster containing IOB0 |
---|
| 363 | size_t cluster_iob1 = cluster(XMAX-1,YMAX-1); // cluster containing IOB1 |
---|
| 364 | size_t block_size = BDEV_SECTOR_SIZE; // disk block size |
---|
| 365 | |
---|
| 366 | ////////////// command line arguments ////////////////////// |
---|
| 367 | if (argc > 1) |
---|
| 368 | { |
---|
| 369 | for (int n = 1; n < argc; n = n + 2) |
---|
| 370 | { |
---|
| 371 | if ((strcmp(argv[n],"-NCYCLES") == 0) && (n+1<argc)) |
---|
| 372 | { |
---|
| 373 | ncycles = atoi(argv[n+1]); |
---|
| 374 | } |
---|
| 375 | else if ((strcmp(argv[n],"-SOFT") == 0) && (n+1<argc) ) |
---|
| 376 | { |
---|
| 377 | strcpy(soft_name, argv[n+1]); |
---|
| 378 | } |
---|
| 379 | else if ((strcmp(argv[n],"-DEBUG") == 0) && (n+1<argc) ) |
---|
| 380 | { |
---|
| 381 | debug_ok = true; |
---|
| 382 | debug_from = atoi(argv[n+1]); |
---|
| 383 | } |
---|
| 384 | else if ((strcmp(argv[n],"-DISK") == 0) && (n+1<argc) ) |
---|
| 385 | { |
---|
| 386 | strcpy(disk_name, argv[n+1]); |
---|
| 387 | } |
---|
| 388 | else if ((strcmp(argv[n],"-MEMCID") == 0) && (n+1<argc) ) |
---|
| 389 | { |
---|
| 390 | debug_memc_id = atoi(argv[n+1]); |
---|
| 391 | assert( (debug_memc_id < (XMAX*YMAX) ) && |
---|
| 392 | "debug_memc_id larger than XMAX * YMAX" ); |
---|
| 393 | } |
---|
| 394 | else if ((strcmp(argv[n],"-IOB") == 0) && (n+1<argc) ) |
---|
| 395 | { |
---|
| 396 | debug_iob = atoi(argv[n+1]); |
---|
| 397 | } |
---|
| 398 | else if ((strcmp(argv[n],"-PROCID") == 0) && (n+1<argc) ) |
---|
| 399 | { |
---|
| 400 | debug_proc_id = atoi(argv[n+1]); |
---|
| 401 | assert( (debug_proc_id < (XMAX * YMAX * NB_PROCS_MAX) ) && |
---|
| 402 | "debug_proc_id larger than XMAX * YMAX * NB_PROCS" ); |
---|
| 403 | } |
---|
| 404 | else if ((strcmp(argv[n], "-THREADS") == 0) && ((n+1) < argc)) |
---|
| 405 | { |
---|
| 406 | threads_nr = atoi(argv[n+1]); |
---|
| 407 | threads_nr = (threads_nr < 1) ? 1 : threads_nr; |
---|
| 408 | } |
---|
| 409 | else if ((strcmp(argv[n], "-FROZEN") == 0) && (n+1 < argc)) |
---|
| 410 | { |
---|
| 411 | frozen_cycles = atoi(argv[n+1]); |
---|
| 412 | } |
---|
| 413 | else if ((strcmp(argv[n], "-PERIOD") == 0) && (n+1 < argc)) |
---|
| 414 | { |
---|
| 415 | debug_period = atoi(argv[n+1]); |
---|
| 416 | } |
---|
| 417 | else |
---|
| 418 | { |
---|
| 419 | std::cout << " Arguments are (key,value) couples." << std::endl; |
---|
| 420 | std::cout << " The order is not important." << std::endl; |
---|
| 421 | std::cout << " Accepted arguments are :" << std::endl << std::endl; |
---|
| 422 | std::cout << " -SOFT pathname_for_embedded_soft" << std::endl; |
---|
| 423 | std::cout << " -DISK pathname_for_disk_image" << std::endl; |
---|
| 424 | std::cout << " -NCYCLES number_of_simulated_cycles" << std::endl; |
---|
| 425 | std::cout << " -DEBUG debug_start_cycle" << std::endl; |
---|
| 426 | std::cout << " -THREADS simulator's threads number" << std::endl; |
---|
| 427 | std::cout << " -FROZEN max_number_of_lines" << std::endl; |
---|
| 428 | std::cout << " -PERIOD number_of_cycles between trace" << std::endl; |
---|
| 429 | std::cout << " -MEMCID index_memc_to_be_traced" << std::endl; |
---|
| 430 | std::cout << " -PROCID index_proc_to_be_traced" << std::endl; |
---|
| 431 | std::cout << " -IOBID index_iob_to_be_traced" << std::endl; |
---|
| 432 | exit(0); |
---|
| 433 | } |
---|
| 434 | } |
---|
| 435 | } |
---|
| 436 | |
---|
| 437 | // checking hardware parameters |
---|
| 438 | assert( ( (XMAX == 1) or (XMAX == 2) or (XMAX == 4) or |
---|
| 439 | (XMAX == 8) or (XMAX == 16) ) and |
---|
| 440 | "The XMAX parameter must be 1, 2, 4, 8 or 16" ); |
---|
| 441 | |
---|
| 442 | assert( ( (YMAX == 1) or (YMAX == 2) or (YMAX == 4) or |
---|
| 443 | (YMAX == 8) or (YMAX == 16) ) and |
---|
| 444 | "The YMAX parameter must be 1, 2, 4, 8 or 16" ); |
---|
| 445 | |
---|
| 446 | assert( ( (NB_PROCS_MAX == 1) or (NB_PROCS_MAX == 2) or (NB_PROCS_MAX == 4) ) and |
---|
| 447 | "The NB_PROCS_MAX parameter must be 1, 2, 4" ); |
---|
| 448 | |
---|
| 449 | assert( (NB_DMA_CHANNELS == 4) and |
---|
| 450 | "The NB_DMA_CHANNELS parameter must be 4" ); |
---|
| 451 | |
---|
[472] | 452 | assert( (NB_TTY_CHANNELS < 16) and |
---|
| 453 | "The NB_TTY_CHANNELS parameter must be smaller than 16" ); |
---|
[450] | 454 | |
---|
| 455 | assert( (NB_NIC_CHANNELS == 2) and |
---|
| 456 | "The NB_NIC_CHANNELS parameter must be 2" ); |
---|
| 457 | |
---|
| 458 | std::cout << std::endl; |
---|
| 459 | std::cout << " - XMAX = " << XMAX << std::endl; |
---|
| 460 | std::cout << " - YMAX = " << YMAX << std::endl; |
---|
| 461 | std::cout << " - NB_PROCS_MAX = " << NB_PROCS_MAX << std::endl; |
---|
| 462 | std::cout << " - NB_DMA_CHANNELS = " << NB_DMA_CHANNELS << std::endl; |
---|
| 463 | std::cout << " - NB_TTY_CHANNELS = " << NB_TTY_CHANNELS << std::endl; |
---|
| 464 | std::cout << " - NB_NIC_CHANNELS = " << NB_NIC_CHANNELS << std::endl; |
---|
| 465 | std::cout << " - MEMC_WAYS = " << MEMC_WAYS << std::endl; |
---|
| 466 | std::cout << " - MEMC_SETS = " << MEMC_SETS << std::endl; |
---|
| 467 | std::cout << " - RAM_LATENCY = " << XRAM_LATENCY << std::endl; |
---|
| 468 | std::cout << " - MAX_FROZEN = " << frozen_cycles << std::endl; |
---|
| 469 | |
---|
| 470 | std::cout << std::endl; |
---|
| 471 | |
---|
| 472 | #if USE_OPENMP |
---|
| 473 | omp_set_dynamic(false); |
---|
| 474 | omp_set_num_threads(threads_nr); |
---|
| 475 | std::cerr << "Built with openmp version " << _OPENMP << std::endl; |
---|
| 476 | #endif |
---|
| 477 | |
---|
| 478 | // Define VciParams objects |
---|
| 479 | typedef soclib::caba::VciParams<vci_cell_width_int, |
---|
| 480 | vci_plen_width, |
---|
| 481 | vci_address_width, |
---|
| 482 | vci_rerror_width, |
---|
| 483 | vci_clen_width, |
---|
| 484 | vci_rflag_width, |
---|
| 485 | vci_srcid_width, |
---|
| 486 | vci_pktid_width, |
---|
| 487 | vci_trdid_width, |
---|
| 488 | vci_wrplen_width> vci_param_int; |
---|
| 489 | |
---|
| 490 | typedef soclib::caba::VciParams<vci_cell_width_ext, |
---|
| 491 | vci_plen_width, |
---|
| 492 | vci_address_width, |
---|
| 493 | vci_rerror_width, |
---|
| 494 | vci_clen_width, |
---|
| 495 | vci_rflag_width, |
---|
| 496 | vci_srcid_width, |
---|
| 497 | vci_pktid_width, |
---|
| 498 | vci_trdid_width, |
---|
| 499 | vci_wrplen_width> vci_param_ext; |
---|
| 500 | |
---|
| 501 | // Define parameters depending on mesh size |
---|
| 502 | size_t x_width; |
---|
| 503 | size_t y_width; |
---|
| 504 | |
---|
| 505 | if (XMAX == 1) x_width = 0; |
---|
| 506 | else if (XMAX == 2) x_width = 1; |
---|
| 507 | else if (XMAX <= 4) x_width = 2; |
---|
| 508 | else if (XMAX <= 8) x_width = 3; |
---|
| 509 | else x_width = 4; |
---|
| 510 | |
---|
| 511 | if (YMAX == 1) y_width = 0; |
---|
| 512 | else if (YMAX == 2) y_width = 1; |
---|
| 513 | else if (YMAX <= 4) y_width = 2; |
---|
| 514 | else if (YMAX <= 8) y_width = 3; |
---|
| 515 | else y_width = 4; |
---|
| 516 | |
---|
| 517 | ///////////////////////////////////////////////////////////////////// |
---|
| 518 | // INT network mapping table |
---|
| 519 | // - two levels address decoding for commands |
---|
| 520 | // - two levels srcid decoding for responses |
---|
| 521 | // - NB_PROCS_MAX + 2 (MDMA, IOBX) local initiators per cluster |
---|
| 522 | // - 4 local targets (MEMC, XICU, MDMA, IOBX) per cluster |
---|
| 523 | ///////////////////////////////////////////////////////////////////// |
---|
| 524 | MappingTable maptab_int( vci_address_width, |
---|
| 525 | IntTab(x_width + y_width, 16 - x_width - y_width), |
---|
| 526 | IntTab(x_width + y_width, vci_srcid_width - x_width - y_width), |
---|
| 527 | 0x00FF000000); |
---|
| 528 | |
---|
| 529 | for (size_t x = 0; x < XMAX; x++) |
---|
| 530 | { |
---|
| 531 | for (size_t y = 0; y < YMAX; y++) |
---|
| 532 | { |
---|
| 533 | uint64_t offset = ((uint64_t)cluster(x,y)) |
---|
| 534 | << (vci_address_width-x_width-y_width); |
---|
| 535 | bool config = true; |
---|
| 536 | |
---|
| 537 | // the four following segments are defined in all clusters |
---|
| 538 | |
---|
| 539 | std::ostringstream smemc_conf; |
---|
| 540 | smemc_conf << "int_seg_memc_conf_" << x << "_" << y; |
---|
| 541 | maptab_int.add(Segment(smemc_conf.str(), MEMC_BASE+offset, MEMC_SIZE, |
---|
| 542 | IntTab(cluster(x,y),INT_MEMC_TGT_ID), true, config )); |
---|
| 543 | |
---|
| 544 | std::ostringstream smemc_xram; |
---|
| 545 | smemc_xram << "int_seg_memc_xram_" << x << "_" << y; |
---|
| 546 | maptab_int.add(Segment(smemc_xram.str(), XRAM_BASE+offset, XRAM_SIZE, |
---|
| 547 | IntTab(cluster(x,y),INT_MEMC_TGT_ID), true)); |
---|
| 548 | |
---|
| 549 | std::ostringstream sxicu; |
---|
| 550 | sxicu << "int_seg_xicu_" << x << "_" << y; |
---|
| 551 | maptab_int.add(Segment(sxicu.str(), XICU_BASE+offset, XICU_SIZE, |
---|
| 552 | IntTab(cluster(x,y),INT_XICU_TGT_ID), false)); |
---|
| 553 | |
---|
| 554 | std::ostringstream smdma; |
---|
| 555 | smdma << "int_seg_mdma_" << x << "_" << y; |
---|
| 556 | maptab_int.add(Segment(smdma.str(), MDMA_BASE+offset, MDMA_SIZE, |
---|
| 557 | IntTab(cluster(x,y),INT_MDMA_TGT_ID), false)); |
---|
| 558 | |
---|
| 559 | // the following segments are only defined in cluster_iob0 or in cluster_iob1 |
---|
| 560 | |
---|
| 561 | if ( (cluster(x,y) == cluster_iob0) or (cluster(x,y) == cluster_iob1) ) |
---|
| 562 | { |
---|
| 563 | std::ostringstream siobx; |
---|
| 564 | siobx << "int_seg_iobx_" << x << "_" << y; |
---|
| 565 | maptab_int.add(Segment(siobx.str(), IOBX_BASE+offset, IOBX_SIZE, |
---|
| 566 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), false, config )); |
---|
| 567 | |
---|
| 568 | std::ostringstream stty; |
---|
| 569 | stty << "int_seg_mtty_" << x << "_" << y; |
---|
| 570 | maptab_int.add(Segment(stty.str(), MTTY_BASE+offset, MTTY_SIZE, |
---|
| 571 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), false)); |
---|
| 572 | |
---|
| 573 | std::ostringstream sfbf; |
---|
| 574 | sfbf << "int_seg_fbuf_" << x << "_" << y; |
---|
| 575 | maptab_int.add(Segment(sfbf.str(), FBUF_BASE+offset, FBUF_SIZE, |
---|
| 576 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), false)); |
---|
| 577 | |
---|
| 578 | std::ostringstream sbdv; |
---|
| 579 | sbdv << "int_seg_bdev_" << x << "_" << y; |
---|
| 580 | maptab_int.add(Segment(sbdv.str(), BDEV_BASE+offset, BDEV_SIZE, |
---|
| 581 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), false)); |
---|
| 582 | |
---|
| 583 | std::ostringstream snic; |
---|
| 584 | snic << "int_seg_mnic_" << x << "_" << y; |
---|
| 585 | maptab_int.add(Segment(snic.str(), MNIC_BASE+offset, MNIC_SIZE, |
---|
| 586 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), false)); |
---|
| 587 | |
---|
| 588 | std::ostringstream srom; |
---|
| 589 | srom << "int_seg_brom_" << x << "_" << y; |
---|
| 590 | maptab_int.add(Segment(srom.str(), BROM_BASE+offset, BROM_SIZE, |
---|
| 591 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), true)); |
---|
| 592 | |
---|
| 593 | std::ostringstream sdma; |
---|
| 594 | sdma << "int_seg_cdma_" << x << "_" << y; |
---|
| 595 | maptab_int.add(Segment(sdma.str(), CDMA_BASE+offset, CDMA_SIZE, |
---|
| 596 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), false)); |
---|
| 597 | } |
---|
| 598 | |
---|
| 599 | // This define the mapping between the SRCIDs |
---|
| 600 | // and the port index on the local interconnect. |
---|
| 601 | |
---|
| 602 | maptab_int.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ), INT_MDMA_INI_ID ); |
---|
| 603 | |
---|
| 604 | maptab_int.srcid_map( IntTab( cluster(x,y), IOBX_LOCAL_SRCID ), INT_IOBX_INI_ID ); |
---|
| 605 | |
---|
| 606 | for ( size_t p = 0 ; p < NB_PROCS_MAX ; p++ ) |
---|
| 607 | maptab_int.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+p ), INT_PROC_INI_ID+p ); |
---|
| 608 | } |
---|
| 609 | } |
---|
| 610 | std::cout << "INT network " << maptab_int << std::endl; |
---|
| 611 | |
---|
| 612 | ///////////////////////////////////////////////////////////////////////// |
---|
| 613 | // RAM network mapping table |
---|
| 614 | // - two levels address decoding for commands |
---|
| 615 | // - two levels srcid decoding for responses |
---|
| 616 | // - 2 local initiators (MEMC, IOBX) per cluster |
---|
| 617 | // (IOBX component only in cluster_iob0 and cluster_iob1) |
---|
| 618 | // - 1 local target (XRAM) per cluster |
---|
| 619 | //////////////////////////////////////////////////////////////////////// |
---|
| 620 | MappingTable maptab_ram( vci_address_width, |
---|
| 621 | IntTab(x_width+y_width, 16 - x_width - y_width), |
---|
| 622 | IntTab(x_width+y_width, vci_srcid_width - x_width - y_width), |
---|
| 623 | 0x00FF000000); |
---|
| 624 | |
---|
| 625 | for (size_t x = 0; x < XMAX; x++) |
---|
| 626 | { |
---|
| 627 | for (size_t y = 0; y < YMAX ; y++) |
---|
| 628 | { |
---|
| 629 | uint64_t offset = ((uint64_t)cluster(x,y)) |
---|
| 630 | << (vci_address_width-x_width-y_width); |
---|
| 631 | |
---|
| 632 | std::ostringstream sxram; |
---|
| 633 | sxram << "ext_seg_xram_" << x << "_" << y; |
---|
| 634 | maptab_ram.add(Segment(sxram.str(), XRAM_BASE+offset, |
---|
| 635 | XRAM_SIZE, IntTab(cluster(x,y), 0), false)); |
---|
| 636 | } |
---|
| 637 | } |
---|
| 638 | |
---|
| 639 | // This define the mapping between the initiators (identified by their |
---|
| 640 | // global SRCID) and the port index on the RAM local interconnect. |
---|
| 641 | // External initiator have two alias SRCID (iob0 / iob1) |
---|
| 642 | |
---|
| 643 | maptab_ram.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ), RAM_IOBX_INI_ID ); |
---|
| 644 | maptab_ram.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ), RAM_IOBX_INI_ID ); |
---|
| 645 | |
---|
| 646 | maptab_ram.srcid_map( IntTab( cluster_iob0, BDEV_LOCAL_SRCID ), RAM_IOBX_INI_ID ); |
---|
| 647 | maptab_ram.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ), RAM_IOBX_INI_ID ); |
---|
| 648 | |
---|
| 649 | maptab_ram.srcid_map( IntTab( cluster_iob1, MEMC_LOCAL_SRCID ), RAM_MEMC_INI_ID ); |
---|
| 650 | |
---|
| 651 | std::cout << "RAM network " << maptab_ram << std::endl; |
---|
| 652 | |
---|
| 653 | /////////////////////////////////////////////////////////////////////// |
---|
| 654 | // IOX network mapping table |
---|
| 655 | // - two levels address decoding for commands |
---|
| 656 | // - two levels srcid decoding for responses |
---|
| 657 | // - 4 initiators (IOB0, IOB1, BDEV, CDMA) |
---|
| 658 | // - 8 targets (IOB0, IOB1, BDEV, CDMA, MTTY, FBUF, BROM, MNIC) |
---|
| 659 | /////////////////////////////////////////////////////////////////////// |
---|
| 660 | MappingTable maptab_iox( vci_address_width, |
---|
| 661 | IntTab(x_width+y_width, 16 - x_width - y_width), |
---|
| 662 | IntTab(x_width+y_width, vci_srcid_width - x_width - y_width), |
---|
| 663 | 0x00FF000000); |
---|
| 664 | |
---|
| 665 | // compute base addresses for cluster_iob0 and cluster_iob1 |
---|
| 666 | uint64_t iob0_base = ((uint64_t)cluster_iob0) << (vci_address_width - x_width - y_width); |
---|
| 667 | uint64_t iob1_base = ((uint64_t)cluster_iob1) << (vci_address_width - x_width - y_width); |
---|
| 668 | |
---|
| 669 | // Each peripheral can be accessed through two segments, |
---|
| 670 | // depending on the used IOB (IOB0 or IOB1). |
---|
| 671 | maptab_iox.add(Segment("iox_seg_mtty_0", MTTY_BASE + iob0_base, MTTY_SIZE, |
---|
| 672 | IntTab(cluster_iob0,IOX_MTTY_TGT_ID), false)); |
---|
| 673 | maptab_iox.add(Segment("iox_seg_mtty_1", MTTY_BASE + iob1_base, MTTY_SIZE, |
---|
| 674 | IntTab(cluster_iob1,IOX_MTTY_TGT_ID), false)); |
---|
| 675 | |
---|
| 676 | maptab_iox.add(Segment("iox_seg_fbuf_0", FBUF_BASE + iob0_base, FBUF_SIZE, |
---|
| 677 | IntTab(cluster_iob0,IOX_FBUF_TGT_ID), false)); |
---|
| 678 | maptab_iox.add(Segment("iox_seg_fbuf_1", FBUF_BASE + iob1_base, FBUF_SIZE, |
---|
| 679 | IntTab(cluster_iob1,IOX_FBUF_TGT_ID), false)); |
---|
| 680 | |
---|
| 681 | maptab_iox.add(Segment("iox_seg_bdev_0", BDEV_BASE + iob0_base, BDEV_SIZE, |
---|
| 682 | IntTab(cluster_iob0,IOX_BDEV_TGT_ID), false)); |
---|
| 683 | maptab_iox.add(Segment("iox_seg_bdev_1", BDEV_BASE + iob1_base, BDEV_SIZE, |
---|
| 684 | IntTab(cluster_iob1,IOX_BDEV_TGT_ID), false)); |
---|
| 685 | |
---|
| 686 | maptab_iox.add(Segment("iox_seg_mnic_0", MNIC_BASE + iob0_base, MNIC_SIZE, |
---|
| 687 | IntTab(cluster_iob0,IOX_MNIC_TGT_ID), false)); |
---|
| 688 | maptab_iox.add(Segment("iox_seg_mnic_1", MNIC_BASE + iob1_base, MNIC_SIZE, |
---|
| 689 | IntTab(cluster_iob1,IOX_MNIC_TGT_ID), false)); |
---|
| 690 | |
---|
| 691 | maptab_iox.add(Segment("iox_seg_cdma_0", CDMA_BASE + iob0_base, CDMA_SIZE, |
---|
| 692 | IntTab(cluster_iob0,IOX_CDMA_TGT_ID), false)); |
---|
| 693 | maptab_iox.add(Segment("iox_seg_cdma_1", CDMA_BASE + iob1_base, CDMA_SIZE, |
---|
| 694 | IntTab(cluster_iob1,IOX_CDMA_TGT_ID), false)); |
---|
| 695 | |
---|
| 696 | maptab_iox.add(Segment("iox_seg_brom_0", BROM_BASE + iob0_base, BROM_SIZE, |
---|
| 697 | IntTab(cluster_iob0,IOX_BROM_TGT_ID), false)); |
---|
| 698 | maptab_iox.add(Segment("iox_seg_brom_1", BROM_BASE + iob1_base, BROM_SIZE, |
---|
| 699 | IntTab(cluster_iob1,IOX_BROM_TGT_ID), false)); |
---|
| 700 | |
---|
| 701 | // Each physical RAM can be accessed through IOB0, or through IOB1. |
---|
| 702 | // if IOMMU is not activated, addresses are 40 bits (physical addresses), |
---|
| 703 | // and the choice depends on on address bit A[39]. |
---|
| 704 | // if IOMMU is activated the addresses use only 32 bits (virtual addresses), |
---|
| 705 | // and the choice depends on address bit A[31]. |
---|
| 706 | for (size_t x = 0; x < XMAX; x++) |
---|
| 707 | { |
---|
| 708 | for (size_t y = 0; y < YMAX ; y++) |
---|
| 709 | { |
---|
| 710 | uint64_t offset = ((uint64_t)cluster(x,y)) |
---|
| 711 | << (vci_address_width-x_width-y_width); |
---|
| 712 | |
---|
| 713 | if ( x < (XMAX/2) ) // send command to XRAM through IOB0 |
---|
| 714 | { |
---|
| 715 | std::ostringstream siob0; |
---|
| 716 | siob0 << "iox_seg_xram_" << x << "_" << y; |
---|
| 717 | maptab_iox.add(Segment(siob0.str(), offset, 0x80000000, |
---|
| 718 | IntTab(cluster_iob0,IOX_IOB0_TGT_ID), false)); |
---|
| 719 | } |
---|
| 720 | else // send command to XRAM through IOB1 |
---|
| 721 | { |
---|
| 722 | std::ostringstream siob1; |
---|
| 723 | siob1 << "iox_seg_xram_" << x << "_" << y; |
---|
| 724 | maptab_iox.add(Segment(siob1.str(), offset, 0x80000000, |
---|
| 725 | IntTab(cluster_iob1,IOX_IOB1_TGT_ID), false)); |
---|
| 726 | } |
---|
| 727 | } |
---|
| 728 | } |
---|
| 729 | // useful when IOMMU activated |
---|
| 730 | maptab_iox.add(Segment("iox_seg_xram ", 0xc0000000, 0x40000000, |
---|
| 731 | IntTab(cluster_iob1,IOX_IOB1_TGT_ID), false)); |
---|
| 732 | |
---|
| 733 | // This define the mapping between the initiators (identified by the SRCID) |
---|
| 734 | // and the port index on the IOX local interconnect. |
---|
| 735 | // External initiator have two alias SRCID (iob0 / iob1 access) |
---|
| 736 | |
---|
| 737 | maptab_iox.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ), IOX_CDMA_INI_ID ); |
---|
| 738 | maptab_iox.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ), IOX_CDMA_INI_ID ); |
---|
| 739 | |
---|
| 740 | maptab_iox.srcid_map( IntTab( cluster_iob0, BDEV_LOCAL_SRCID ), IOX_BDEV_INI_ID ); |
---|
| 741 | maptab_iox.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ), IOX_BDEV_INI_ID ); |
---|
| 742 | |
---|
| 743 | for (size_t x = 0; x < XMAX; x++) |
---|
| 744 | { |
---|
| 745 | for (size_t y = 0; y < YMAX ; y++) |
---|
| 746 | { |
---|
| 747 | if ( x < (XMAX/2) ) // send response to proc or mdma through IOB0 |
---|
| 748 | { |
---|
| 749 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID ), IOX_IOB0_INI_ID ); |
---|
| 750 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+1 ), IOX_IOB0_INI_ID ); |
---|
| 751 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+2 ), IOX_IOB0_INI_ID ); |
---|
| 752 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+3 ), IOX_IOB0_INI_ID ); |
---|
| 753 | maptab_iox.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ), IOX_IOB0_INI_ID ); |
---|
| 754 | } |
---|
| 755 | else // send response to proc or mdma through IOB1 |
---|
| 756 | { |
---|
| 757 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID ), IOX_IOB1_INI_ID ); |
---|
| 758 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+1 ), IOX_IOB1_INI_ID ); |
---|
| 759 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+2 ), IOX_IOB1_INI_ID ); |
---|
| 760 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+3 ), IOX_IOB1_INI_ID ); |
---|
| 761 | maptab_iox.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ), IOX_IOB1_INI_ID ); |
---|
| 762 | } |
---|
| 763 | } |
---|
| 764 | } |
---|
| 765 | |
---|
| 766 | std::cout << "IOX network " << maptab_iox << std::endl; |
---|
| 767 | |
---|
| 768 | //////////////////// |
---|
| 769 | // Signals |
---|
| 770 | /////////////////// |
---|
| 771 | |
---|
| 772 | sc_clock signal_clk("clk"); |
---|
| 773 | sc_signal<bool> signal_resetn("resetn"); |
---|
| 774 | |
---|
| 775 | sc_signal<bool> signal_unused_irq[32]; |
---|
| 776 | sc_signal<bool> signal_irq_bdev; |
---|
| 777 | sc_signal<bool> signal_irq_mnic_rx[NB_NIC_CHANNELS]; |
---|
| 778 | sc_signal<bool> signal_irq_mnic_tx[NB_NIC_CHANNELS]; |
---|
| 779 | sc_signal<bool> signal_irq_mtty[NB_TTY_CHANNELS]; |
---|
| 780 | sc_signal<bool> signal_irq_cdma[NB_NIC_CHANNELS*2]; |
---|
| 781 | |
---|
| 782 | // VCI signals for IOX network |
---|
| 783 | VciSignals<vci_param_ext> signal_vci_ini_iob0("signal_vci_ini_iob0"); |
---|
| 784 | VciSignals<vci_param_ext> signal_vci_ini_iob1("signal_vci_ini_iob1"); |
---|
| 785 | VciSignals<vci_param_ext> signal_vci_ini_bdev("signal_vci_ini_bdev"); |
---|
| 786 | VciSignals<vci_param_ext> signal_vci_ini_cdma("signal_vci_ini_cdma"); |
---|
| 787 | |
---|
| 788 | VciSignals<vci_param_ext> signal_vci_tgt_iob0("signal_vci_tgt_iob0"); |
---|
| 789 | VciSignals<vci_param_ext> signal_vci_tgt_iob1("signal_vci_tgt_iob1"); |
---|
| 790 | VciSignals<vci_param_ext> signal_vci_tgt_mtty("signal_vci_tgt_mtty"); |
---|
| 791 | VciSignals<vci_param_ext> signal_vci_tgt_fbuf("signal_vci_tgt_fbuf"); |
---|
| 792 | VciSignals<vci_param_ext> signal_vci_tgt_mnic("signal_vci_tgt_mnic"); |
---|
| 793 | VciSignals<vci_param_ext> signal_vci_tgt_brom("signal_vci_tgt_brom"); |
---|
| 794 | VciSignals<vci_param_ext> signal_vci_tgt_bdev("signal_vci_tgt_bdev"); |
---|
| 795 | VciSignals<vci_param_ext> signal_vci_tgt_cdma("signal_vci_tgt_cdma"); |
---|
| 796 | |
---|
| 797 | // Horizontal inter-clusters INT network DSPIN |
---|
| 798 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_h_inc = |
---|
[468] | 799 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_h_inc", XMAX-1, YMAX, 3); |
---|
[450] | 800 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_h_dec = |
---|
[468] | 801 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_h_dec", XMAX-1, YMAX, 3); |
---|
[450] | 802 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_h_inc = |
---|
| 803 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_h_inc", XMAX-1, YMAX, 2); |
---|
| 804 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_h_dec = |
---|
| 805 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_h_dec", XMAX-1, YMAX, 2); |
---|
| 806 | |
---|
| 807 | // Vertical inter-clusters INT network DSPIN |
---|
| 808 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_v_inc = |
---|
[468] | 809 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_v_inc", XMAX, YMAX-1, 3); |
---|
[450] | 810 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_v_dec = |
---|
[468] | 811 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_v_dec", XMAX, YMAX-1, 3); |
---|
[450] | 812 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_v_inc = |
---|
| 813 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_v_inc", XMAX, YMAX-1, 2); |
---|
| 814 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_v_dec = |
---|
| 815 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_v_dec", XMAX, YMAX-1, 2); |
---|
| 816 | |
---|
| 817 | // Mesh boundaries INT network DSPIN |
---|
| 818 | DspinSignals<dspin_int_cmd_width>**** signal_dspin_false_int_cmd_in = |
---|
[468] | 819 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_false_int_cmd_in", XMAX, YMAX, 4, 3); |
---|
[450] | 820 | DspinSignals<dspin_int_cmd_width>**** signal_dspin_false_int_cmd_out = |
---|
[468] | 821 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_false_int_cmd_out", XMAX, YMAX, 4, 3); |
---|
[450] | 822 | DspinSignals<dspin_int_rsp_width>**** signal_dspin_false_int_rsp_in = |
---|
[468] | 823 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_false_int_rsp_in", XMAX, YMAX, 4, 2); |
---|
[450] | 824 | DspinSignals<dspin_int_rsp_width>**** signal_dspin_false_int_rsp_out = |
---|
[468] | 825 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_false_int_rsp_out", XMAX, YMAX, 4, 2); |
---|
[450] | 826 | |
---|
| 827 | |
---|
| 828 | // Horizontal inter-clusters RAM network DSPIN |
---|
| 829 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_h_inc = |
---|
| 830 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_h_inc", XMAX-1, YMAX); |
---|
| 831 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_h_dec = |
---|
| 832 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_h_dec", XMAX-1, YMAX); |
---|
| 833 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_h_inc = |
---|
| 834 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_h_inc", XMAX-1, YMAX); |
---|
| 835 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_h_dec = |
---|
| 836 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_h_dec", XMAX-1, YMAX); |
---|
| 837 | |
---|
| 838 | // Vertical inter-clusters RAM network DSPIN |
---|
| 839 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_v_inc = |
---|
| 840 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_v_inc", XMAX, YMAX-1); |
---|
| 841 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_v_dec = |
---|
| 842 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_v_dec", XMAX, YMAX-1); |
---|
| 843 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_v_inc = |
---|
| 844 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_v_inc", XMAX, YMAX-1); |
---|
| 845 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_v_dec = |
---|
| 846 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_v_dec", XMAX, YMAX-1); |
---|
| 847 | |
---|
| 848 | // Mesh boundaries RAM network DSPIN |
---|
| 849 | DspinSignals<dspin_ram_cmd_width>*** signal_dspin_false_ram_cmd_in = |
---|
| 850 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_false_ram_cmd_in", XMAX, YMAX, 4); |
---|
| 851 | DspinSignals<dspin_ram_cmd_width>*** signal_dspin_false_ram_cmd_out = |
---|
| 852 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_false_ram_cmd_out", XMAX, YMAX, 4); |
---|
| 853 | DspinSignals<dspin_ram_rsp_width>*** signal_dspin_false_ram_rsp_in = |
---|
| 854 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_false_ram_rsp_in", XMAX, YMAX, 4); |
---|
| 855 | DspinSignals<dspin_ram_rsp_width>*** signal_dspin_false_ram_rsp_out = |
---|
| 856 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_false_ram_rsp_out", XMAX, YMAX, 4); |
---|
| 857 | |
---|
| 858 | //////////////////////////// |
---|
| 859 | // Loader |
---|
| 860 | //////////////////////////// |
---|
| 861 | |
---|
| 862 | #if USE_ALMOS |
---|
| 863 | soclib::common::Loader loader(almos_bootloader_pathname, |
---|
| 864 | almos_archinfo_pathname, |
---|
| 865 | almos_kernel_pathname); |
---|
| 866 | #else |
---|
| 867 | soclib::common::Loader loader(soft_name); |
---|
| 868 | #endif |
---|
| 869 | |
---|
| 870 | typedef soclib::common::GdbServer<soclib::common::Mips32ElIss> proc_iss; |
---|
| 871 | proc_iss::set_loader(loader); |
---|
| 872 | |
---|
| 873 | //////////////////////////////////////// |
---|
| 874 | // Instanciated Hardware Components |
---|
| 875 | //////////////////////////////////////// |
---|
| 876 | |
---|
| 877 | std::cout << std::endl << "External Bus and Peripherals" << std::endl << std::endl; |
---|
| 878 | |
---|
| 879 | // IOX network |
---|
| 880 | VciIoxNetwork<vci_param_ext>* iox_network; |
---|
| 881 | iox_network = new VciIoxNetwork<vci_param_ext>( "iox_network", |
---|
| 882 | maptab_iox, |
---|
| 883 | 0, // cluster_id |
---|
| 884 | 8, // number of targets |
---|
| 885 | 4 ); // number of initiators |
---|
| 886 | // boot ROM |
---|
| 887 | VciSimpleRom<vci_param_ext>* iox_brom; |
---|
| 888 | iox_brom = new VciSimpleRom<vci_param_ext>( "iox_brom", |
---|
| 889 | IntTab(0, IOX_BROM_TGT_ID), |
---|
| 890 | maptab_iox, |
---|
| 891 | loader ); |
---|
| 892 | // Network Controller |
---|
| 893 | VciMultiNic<vci_param_ext>* iox_mnic; |
---|
| 894 | iox_mnic = new VciMultiNic<vci_param_ext>( "iox_mnic", |
---|
| 895 | IntTab(0, IOX_MNIC_TGT_ID), |
---|
| 896 | maptab_iox, |
---|
| 897 | NB_NIC_CHANNELS, |
---|
| 898 | nic_rx_name, |
---|
| 899 | nic_tx_name, |
---|
| 900 | 0, // mac_4 address |
---|
| 901 | 0 ); // mac_2 address |
---|
| 902 | |
---|
| 903 | // Frame Buffer |
---|
| 904 | VciFrameBuffer<vci_param_ext>* iox_fbuf; |
---|
| 905 | iox_fbuf = new VciFrameBuffer<vci_param_ext>( "iox_fbuf", |
---|
| 906 | IntTab(0, IOX_FBUF_TGT_ID), |
---|
| 907 | maptab_iox, |
---|
| 908 | FBUF_X_SIZE, FBUF_Y_SIZE ); |
---|
| 909 | |
---|
| 910 | // Block Device |
---|
| 911 | VciBlockDeviceTsar<vci_param_ext>* iox_bdev; |
---|
| 912 | iox_bdev = new VciBlockDeviceTsar<vci_param_ext>( "iox_bdev", |
---|
| 913 | maptab_iox, |
---|
| 914 | IntTab(0, BDEV_LOCAL_SRCID), |
---|
| 915 | IntTab(0, IOX_BDEV_TGT_ID), |
---|
| 916 | disk_name, |
---|
| 917 | block_size, |
---|
| 918 | 64); // burst size (bytes) |
---|
| 919 | |
---|
| 920 | // Chained Buffer DMA controller |
---|
| 921 | VciChbufDma<vci_param_ext>* iox_cdma; |
---|
| 922 | iox_cdma = new VciChbufDma<vci_param_ext>( "iox_cdma", |
---|
| 923 | maptab_iox, |
---|
| 924 | IntTab(0, CDMA_LOCAL_SRCID), |
---|
| 925 | IntTab(0, IOX_CDMA_TGT_ID), |
---|
| 926 | 64, // burst size (bytes) |
---|
| 927 | 2*NB_NIC_CHANNELS ); |
---|
| 928 | // Multi-TTY controller |
---|
| 929 | std::vector<std::string> vect_names; |
---|
| 930 | for( size_t tid = 0 ; tid < NB_TTY_CHANNELS ; tid++ ) |
---|
| 931 | { |
---|
| 932 | std::ostringstream term_name; |
---|
| 933 | term_name << "term" << tid; |
---|
| 934 | vect_names.push_back(term_name.str().c_str()); |
---|
| 935 | } |
---|
| 936 | VciMultiTty<vci_param_ext>* iox_mtty; |
---|
| 937 | iox_mtty = new VciMultiTty<vci_param_ext>( "iox_mtty", |
---|
| 938 | IntTab(0, IOX_MTTY_TGT_ID), |
---|
| 939 | maptab_iox, |
---|
| 940 | vect_names); |
---|
| 941 | // Clusters |
---|
| 942 | TsarIobCluster<vci_param_int, |
---|
| 943 | vci_param_ext, |
---|
| 944 | dspin_int_cmd_width, |
---|
| 945 | dspin_int_rsp_width, |
---|
| 946 | dspin_ram_cmd_width, |
---|
| 947 | dspin_ram_rsp_width>* clusters[XMAX][YMAX]; |
---|
| 948 | |
---|
| 949 | #if USE_OPENMP |
---|
| 950 | #pragma omp parallel |
---|
| 951 | { |
---|
| 952 | #pragma omp for |
---|
| 953 | #endif |
---|
| 954 | for(size_t i = 0; i < (XMAX * YMAX); i++) |
---|
| 955 | { |
---|
| 956 | size_t x = i / YMAX; |
---|
| 957 | size_t y = i % YMAX; |
---|
| 958 | |
---|
| 959 | #if USE_OPENMP |
---|
| 960 | #pragma omp critical |
---|
| 961 | { |
---|
| 962 | #endif |
---|
| 963 | std::cout << std::endl; |
---|
| 964 | std::cout << "Cluster_" << std::dec << x << "_" << y << std::endl; |
---|
| 965 | std::cout << std::endl; |
---|
| 966 | |
---|
| 967 | std::ostringstream sc; |
---|
| 968 | sc << "cluster_" << x << "_" << y; |
---|
| 969 | clusters[x][y] = new TsarIobCluster<vci_param_int, |
---|
| 970 | vci_param_ext, |
---|
| 971 | dspin_int_cmd_width, |
---|
| 972 | dspin_int_rsp_width, |
---|
| 973 | dspin_ram_cmd_width, |
---|
| 974 | dspin_ram_rsp_width> |
---|
| 975 | ( |
---|
| 976 | sc.str().c_str(), |
---|
| 977 | NB_PROCS_MAX, |
---|
| 978 | NB_DMA_CHANNELS, |
---|
| 979 | x, |
---|
| 980 | y, |
---|
| 981 | XMAX, |
---|
| 982 | YMAX, |
---|
| 983 | |
---|
| 984 | maptab_int, |
---|
| 985 | maptab_ram, |
---|
| 986 | maptab_iox, |
---|
| 987 | |
---|
| 988 | x_width, |
---|
| 989 | y_width, |
---|
| 990 | vci_srcid_width - x_width - y_width, // l_id width, |
---|
| 991 | |
---|
| 992 | INT_MEMC_TGT_ID, |
---|
| 993 | INT_XICU_TGT_ID, |
---|
| 994 | INT_MDMA_TGT_ID, |
---|
| 995 | INT_IOBX_TGT_ID, |
---|
| 996 | |
---|
| 997 | INT_PROC_INI_ID, |
---|
| 998 | INT_MDMA_INI_ID, |
---|
| 999 | INT_IOBX_INI_ID, |
---|
| 1000 | |
---|
| 1001 | RAM_XRAM_TGT_ID, |
---|
| 1002 | |
---|
| 1003 | RAM_MEMC_INI_ID, |
---|
| 1004 | RAM_MEMC_INI_ID, |
---|
| 1005 | |
---|
| 1006 | MEMC_WAYS, |
---|
| 1007 | MEMC_SETS, |
---|
| 1008 | L1_IWAYS, |
---|
| 1009 | L1_ISETS, |
---|
| 1010 | L1_DWAYS, |
---|
| 1011 | L1_DSETS, |
---|
| 1012 | XRAM_LATENCY, |
---|
| 1013 | |
---|
| 1014 | loader, |
---|
| 1015 | |
---|
| 1016 | frozen_cycles, |
---|
| 1017 | debug_from, |
---|
| 1018 | debug_ok and (cluster(x,y) == debug_memc_id), |
---|
| 1019 | debug_ok and (cluster(x,y) == debug_proc_id), |
---|
| 1020 | debug_ok and debug_iob |
---|
| 1021 | ); |
---|
| 1022 | |
---|
| 1023 | #if USE_OPENMP |
---|
| 1024 | } // end critical |
---|
| 1025 | #endif |
---|
| 1026 | } // end for |
---|
| 1027 | #if USE_OPENMP |
---|
| 1028 | } |
---|
| 1029 | #endif |
---|
| 1030 | |
---|
| 1031 | std::cout << std::endl; |
---|
| 1032 | |
---|
| 1033 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 1034 | // Net-list |
---|
| 1035 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 1036 | |
---|
| 1037 | // IOX network connexion |
---|
| 1038 | iox_network->p_clk (signal_clk); |
---|
| 1039 | iox_network->p_resetn (signal_resetn); |
---|
| 1040 | iox_network->p_to_ini[IOX_IOB0_INI_ID] (signal_vci_ini_iob0); |
---|
| 1041 | iox_network->p_to_ini[IOX_IOB1_INI_ID] (signal_vci_ini_iob1); |
---|
| 1042 | iox_network->p_to_ini[IOX_BDEV_INI_ID] (signal_vci_ini_bdev); |
---|
| 1043 | iox_network->p_to_ini[IOX_CDMA_INI_ID] (signal_vci_ini_cdma); |
---|
| 1044 | iox_network->p_to_tgt[IOX_IOB0_TGT_ID] (signal_vci_tgt_iob0); |
---|
| 1045 | iox_network->p_to_tgt[IOX_IOB1_TGT_ID] (signal_vci_tgt_iob1); |
---|
| 1046 | iox_network->p_to_tgt[IOX_MTTY_TGT_ID] (signal_vci_tgt_mtty); |
---|
| 1047 | iox_network->p_to_tgt[IOX_FBUF_TGT_ID] (signal_vci_tgt_fbuf); |
---|
| 1048 | iox_network->p_to_tgt[IOX_MNIC_TGT_ID] (signal_vci_tgt_mnic); |
---|
| 1049 | iox_network->p_to_tgt[IOX_BROM_TGT_ID] (signal_vci_tgt_brom); |
---|
| 1050 | iox_network->p_to_tgt[IOX_BDEV_TGT_ID] (signal_vci_tgt_bdev); |
---|
| 1051 | iox_network->p_to_tgt[IOX_CDMA_TGT_ID] (signal_vci_tgt_cdma); |
---|
| 1052 | |
---|
| 1053 | // BDEV connexion |
---|
| 1054 | iox_bdev->p_clk (signal_clk); |
---|
| 1055 | iox_bdev->p_resetn (signal_resetn); |
---|
| 1056 | iox_bdev->p_irq (signal_irq_bdev); |
---|
| 1057 | iox_bdev->p_vci_target (signal_vci_tgt_bdev); |
---|
| 1058 | iox_bdev->p_vci_initiator (signal_vci_ini_bdev); |
---|
| 1059 | |
---|
| 1060 | std::cout << " - BDEV connected" << std::endl; |
---|
| 1061 | |
---|
| 1062 | // FBUF connexion |
---|
| 1063 | iox_fbuf->p_clk (signal_clk); |
---|
| 1064 | iox_fbuf->p_resetn (signal_resetn); |
---|
| 1065 | iox_fbuf->p_vci (signal_vci_tgt_fbuf); |
---|
| 1066 | |
---|
| 1067 | std::cout << " - FBUF connected" << std::endl; |
---|
| 1068 | |
---|
| 1069 | // MNIC connexion |
---|
| 1070 | iox_mnic->p_clk (signal_clk); |
---|
| 1071 | iox_mnic->p_resetn (signal_resetn); |
---|
| 1072 | iox_mnic->p_vci (signal_vci_tgt_mnic); |
---|
| 1073 | for ( size_t i=0 ; i<NB_NIC_CHANNELS ; i++ ) |
---|
| 1074 | { |
---|
| 1075 | iox_mnic->p_rx_irq[i] (signal_irq_mnic_rx[i]); |
---|
| 1076 | iox_mnic->p_tx_irq[i] (signal_irq_mnic_tx[i]); |
---|
| 1077 | } |
---|
| 1078 | |
---|
| 1079 | std::cout << " - MNIC connected" << std::endl; |
---|
| 1080 | |
---|
| 1081 | // BROM connexion |
---|
| 1082 | iox_brom->p_clk (signal_clk); |
---|
| 1083 | iox_brom->p_resetn (signal_resetn); |
---|
| 1084 | iox_brom->p_vci (signal_vci_tgt_brom); |
---|
| 1085 | |
---|
| 1086 | std::cout << " - BROM connected" << std::endl; |
---|
| 1087 | |
---|
| 1088 | // MTTY connexion |
---|
| 1089 | iox_mtty->p_clk (signal_clk); |
---|
| 1090 | iox_mtty->p_resetn (signal_resetn); |
---|
| 1091 | iox_mtty->p_vci (signal_vci_tgt_mtty); |
---|
| 1092 | for ( size_t i=0 ; i<NB_TTY_CHANNELS ; i++ ) |
---|
| 1093 | { |
---|
| 1094 | iox_mtty->p_irq[i] (signal_irq_mtty[i]); |
---|
| 1095 | } |
---|
| 1096 | |
---|
| 1097 | std::cout << " - MTTY connected" << std::endl; |
---|
| 1098 | |
---|
| 1099 | // CDMA connexion |
---|
| 1100 | iox_cdma->p_clk (signal_clk); |
---|
| 1101 | iox_cdma->p_resetn (signal_resetn); |
---|
| 1102 | iox_cdma->p_vci_target (signal_vci_tgt_cdma); |
---|
| 1103 | iox_cdma->p_vci_initiator (signal_vci_ini_cdma); |
---|
| 1104 | for ( size_t i=0 ; i<(NB_NIC_CHANNELS*2) ; i++) |
---|
| 1105 | { |
---|
| 1106 | iox_cdma->p_irq[i] (signal_irq_cdma[i]); |
---|
| 1107 | } |
---|
| 1108 | |
---|
| 1109 | std::cout << " - CDMA connected" << std::endl; |
---|
| 1110 | |
---|
| 1111 | // IRQ connexions (for cluster_iob0 only) |
---|
[498] | 1112 | // IRQ_MNIC_RX -> IRQ[08] to IRQ[09] |
---|
| 1113 | // IRQ_MNIC_TX -> IRQ[10] to IRQ[11] |
---|
| 1114 | // IRQ_CDMA -> IRQ[12] to IRQ[15] |
---|
| 1115 | // IRQ_MTTY -> IRQ[16] to IRQ[30] |
---|
| 1116 | // IRQ_BDEV -> IRQ[31] |
---|
| 1117 | |
---|
[472] | 1118 | size_t mx = 16 + NB_TTY_CHANNELS; |
---|
[450] | 1119 | for ( size_t n=0 ; n<32 ; n++ ) |
---|
| 1120 | { |
---|
[472] | 1121 | if ( n < 8 ) clusters[0][0]->p_irq[n]->bind (signal_unused_irq[n]); |
---|
| 1122 | else if ( n < 10 ) clusters[0][0]->p_irq[n]->bind (signal_irq_mnic_rx[n-8]); |
---|
| 1123 | else if ( n < 12 ) clusters[0][0]->p_irq[n]->bind (signal_irq_mnic_tx[n-10]); |
---|
| 1124 | else if ( n < 16 ) clusters[0][0]->p_irq[n]->bind (signal_irq_cdma[n-12]); |
---|
| 1125 | else if ( n < mx ) clusters[0][0]->p_irq[n]->bind (signal_irq_mtty[n-16]); |
---|
[450] | 1126 | else if ( n < 31 ) clusters[0][0]->p_irq[n]->bind (signal_unused_irq[n]); |
---|
| 1127 | else clusters[0][0]->p_irq[n]->bind (signal_irq_bdev); |
---|
| 1128 | } |
---|
| 1129 | |
---|
| 1130 | // IOB0 cluster connexion to IOX network |
---|
| 1131 | clusters[0][0]->p_vci_iox_ini->bind (signal_vci_ini_iob0); |
---|
| 1132 | clusters[0][0]->p_vci_iox_tgt->bind (signal_vci_tgt_iob0); |
---|
| 1133 | |
---|
| 1134 | // IOB1 cluster connexion to IOX network |
---|
| 1135 | clusters[XMAX-1][YMAX-1]->p_vci_iox_ini->bind (signal_vci_ini_iob1); |
---|
| 1136 | clusters[XMAX-1][YMAX-1]->p_vci_iox_tgt->bind (signal_vci_tgt_iob1); |
---|
| 1137 | |
---|
| 1138 | // All clusters Clock & RESET connexions |
---|
| 1139 | for ( size_t x = 0; x < (XMAX); x++ ) |
---|
| 1140 | { |
---|
| 1141 | for (size_t y = 0; y < YMAX; y++) |
---|
| 1142 | { |
---|
| 1143 | clusters[x][y]->p_clk (signal_clk); |
---|
| 1144 | clusters[x][y]->p_resetn (signal_resetn); |
---|
| 1145 | } |
---|
| 1146 | } |
---|
| 1147 | |
---|
| 1148 | // Inter Clusters horizontal connections |
---|
| 1149 | if (XMAX > 1) |
---|
| 1150 | { |
---|
| 1151 | for (size_t x = 0; x < (XMAX-1); x++) |
---|
| 1152 | { |
---|
| 1153 | for (size_t y = 0; y < YMAX; y++) |
---|
| 1154 | { |
---|
[468] | 1155 | for (size_t k = 0; k < 3; k++) |
---|
| 1156 | { |
---|
| 1157 | clusters[x][y]->p_dspin_int_cmd_out[EAST][k] (signal_dspin_int_cmd_h_inc[x][y][k]); |
---|
| 1158 | clusters[x+1][y]->p_dspin_int_cmd_in[WEST][k] (signal_dspin_int_cmd_h_inc[x][y][k]); |
---|
| 1159 | clusters[x][y]->p_dspin_int_cmd_in[EAST][k] (signal_dspin_int_cmd_h_dec[x][y][k]); |
---|
| 1160 | clusters[x+1][y]->p_dspin_int_cmd_out[WEST][k] (signal_dspin_int_cmd_h_dec[x][y][k]); |
---|
| 1161 | } |
---|
| 1162 | |
---|
[450] | 1163 | for (size_t k = 0; k < 2; k++) |
---|
| 1164 | { |
---|
[468] | 1165 | clusters[x][y]->p_dspin_int_rsp_out[EAST][k] (signal_dspin_int_rsp_h_inc[x][y][k]); |
---|
| 1166 | clusters[x+1][y]->p_dspin_int_rsp_in[WEST][k] (signal_dspin_int_rsp_h_inc[x][y][k]); |
---|
| 1167 | clusters[x][y]->p_dspin_int_rsp_in[EAST][k] (signal_dspin_int_rsp_h_dec[x][y][k]); |
---|
| 1168 | clusters[x+1][y]->p_dspin_int_rsp_out[WEST][k] (signal_dspin_int_rsp_h_dec[x][y][k]); |
---|
[450] | 1169 | } |
---|
| 1170 | |
---|
| 1171 | clusters[x][y]->p_dspin_ram_cmd_out[EAST] (signal_dspin_ram_cmd_h_inc[x][y]); |
---|
| 1172 | clusters[x+1][y]->p_dspin_ram_cmd_in[WEST] (signal_dspin_ram_cmd_h_inc[x][y]); |
---|
| 1173 | clusters[x][y]->p_dspin_ram_cmd_in[EAST] (signal_dspin_ram_cmd_h_dec[x][y]); |
---|
| 1174 | clusters[x+1][y]->p_dspin_ram_cmd_out[WEST] (signal_dspin_ram_cmd_h_dec[x][y]); |
---|
| 1175 | clusters[x][y]->p_dspin_ram_rsp_out[EAST] (signal_dspin_ram_rsp_h_inc[x][y]); |
---|
| 1176 | clusters[x+1][y]->p_dspin_ram_rsp_in[WEST] (signal_dspin_ram_rsp_h_inc[x][y]); |
---|
| 1177 | clusters[x][y]->p_dspin_ram_rsp_in[EAST] (signal_dspin_ram_rsp_h_dec[x][y]); |
---|
| 1178 | clusters[x+1][y]->p_dspin_ram_rsp_out[WEST] (signal_dspin_ram_rsp_h_dec[x][y]); |
---|
| 1179 | } |
---|
| 1180 | } |
---|
| 1181 | } |
---|
| 1182 | |
---|
| 1183 | std::cout << std::endl << "Horizontal connections established" << std::endl; |
---|
| 1184 | |
---|
| 1185 | // Inter Clusters vertical connections |
---|
| 1186 | if (YMAX > 1) |
---|
| 1187 | { |
---|
| 1188 | for (size_t y = 0; y < (YMAX-1); y++) |
---|
| 1189 | { |
---|
| 1190 | for (size_t x = 0; x < XMAX; x++) |
---|
| 1191 | { |
---|
[468] | 1192 | for (size_t k = 0; k < 3; k++) |
---|
| 1193 | { |
---|
| 1194 | clusters[x][y]->p_dspin_int_cmd_out[NORTH][k] (signal_dspin_int_cmd_v_inc[x][y][k]); |
---|
| 1195 | clusters[x][y+1]->p_dspin_int_cmd_in[SOUTH][k] (signal_dspin_int_cmd_v_inc[x][y][k]); |
---|
| 1196 | clusters[x][y]->p_dspin_int_cmd_in[NORTH][k] (signal_dspin_int_cmd_v_dec[x][y][k]); |
---|
| 1197 | clusters[x][y+1]->p_dspin_int_cmd_out[SOUTH][k] (signal_dspin_int_cmd_v_dec[x][y][k]); |
---|
| 1198 | } |
---|
| 1199 | |
---|
[450] | 1200 | for (size_t k = 0; k < 2; k++) |
---|
| 1201 | { |
---|
[468] | 1202 | clusters[x][y]->p_dspin_int_rsp_out[NORTH][k] (signal_dspin_int_rsp_v_inc[x][y][k]); |
---|
| 1203 | clusters[x][y+1]->p_dspin_int_rsp_in[SOUTH][k] (signal_dspin_int_rsp_v_inc[x][y][k]); |
---|
| 1204 | clusters[x][y]->p_dspin_int_rsp_in[NORTH][k] (signal_dspin_int_rsp_v_dec[x][y][k]); |
---|
| 1205 | clusters[x][y+1]->p_dspin_int_rsp_out[SOUTH][k] (signal_dspin_int_rsp_v_dec[x][y][k]); |
---|
[450] | 1206 | } |
---|
| 1207 | |
---|
| 1208 | clusters[x][y]->p_dspin_ram_cmd_out[NORTH] (signal_dspin_ram_cmd_v_inc[x][y]); |
---|
| 1209 | clusters[x][y+1]->p_dspin_ram_cmd_in[SOUTH] (signal_dspin_ram_cmd_v_inc[x][y]); |
---|
| 1210 | clusters[x][y]->p_dspin_ram_cmd_in[NORTH] (signal_dspin_ram_cmd_v_dec[x][y]); |
---|
| 1211 | clusters[x][y+1]->p_dspin_ram_cmd_out[SOUTH] (signal_dspin_ram_cmd_v_dec[x][y]); |
---|
| 1212 | clusters[x][y]->p_dspin_ram_rsp_out[NORTH] (signal_dspin_ram_rsp_v_inc[x][y]); |
---|
| 1213 | clusters[x][y+1]->p_dspin_ram_rsp_in[SOUTH] (signal_dspin_ram_rsp_v_inc[x][y]); |
---|
| 1214 | clusters[x][y]->p_dspin_ram_rsp_in[NORTH] (signal_dspin_ram_rsp_v_dec[x][y]); |
---|
| 1215 | clusters[x][y+1]->p_dspin_ram_rsp_out[SOUTH] (signal_dspin_ram_rsp_v_dec[x][y]); |
---|
| 1216 | } |
---|
| 1217 | } |
---|
| 1218 | } |
---|
| 1219 | |
---|
| 1220 | std::cout << "Vertical connections established" << std::endl; |
---|
| 1221 | |
---|
| 1222 | // East & West boundary cluster connections |
---|
| 1223 | for (size_t y = 0; y < YMAX; y++) |
---|
| 1224 | { |
---|
[468] | 1225 | for (size_t k = 0; k < 3; k++) |
---|
| 1226 | { |
---|
| 1227 | clusters[0][y]->p_dspin_int_cmd_in[WEST][k] (signal_dspin_false_int_cmd_in[0][y][WEST][k]); |
---|
| 1228 | clusters[0][y]->p_dspin_int_cmd_out[WEST][k] (signal_dspin_false_int_cmd_out[0][y][WEST][k]); |
---|
| 1229 | clusters[XMAX-1][y]->p_dspin_int_cmd_in[EAST][k] (signal_dspin_false_int_cmd_in[XMAX-1][y][EAST][k]); |
---|
| 1230 | clusters[XMAX-1][y]->p_dspin_int_cmd_out[EAST][k] (signal_dspin_false_int_cmd_out[XMAX-1][y][EAST][k]); |
---|
| 1231 | } |
---|
| 1232 | |
---|
[450] | 1233 | for (size_t k = 0; k < 2; k++) |
---|
| 1234 | { |
---|
[468] | 1235 | clusters[0][y]->p_dspin_int_rsp_in[WEST][k] (signal_dspin_false_int_rsp_in[0][y][WEST][k]); |
---|
| 1236 | clusters[0][y]->p_dspin_int_rsp_out[WEST][k] (signal_dspin_false_int_rsp_out[0][y][WEST][k]); |
---|
| 1237 | clusters[XMAX-1][y]->p_dspin_int_rsp_in[EAST][k] (signal_dspin_false_int_rsp_in[XMAX-1][y][EAST][k]); |
---|
| 1238 | clusters[XMAX-1][y]->p_dspin_int_rsp_out[EAST][k] (signal_dspin_false_int_rsp_out[XMAX-1][y][EAST][k]); |
---|
[450] | 1239 | } |
---|
| 1240 | |
---|
| 1241 | clusters[0][y]->p_dspin_ram_cmd_in[WEST] (signal_dspin_false_ram_cmd_in[0][y][WEST]); |
---|
| 1242 | clusters[0][y]->p_dspin_ram_cmd_out[WEST] (signal_dspin_false_ram_cmd_out[0][y][WEST]); |
---|
| 1243 | clusters[0][y]->p_dspin_ram_rsp_in[WEST] (signal_dspin_false_ram_rsp_in[0][y][WEST]); |
---|
| 1244 | clusters[0][y]->p_dspin_ram_rsp_out[WEST] (signal_dspin_false_ram_rsp_out[0][y][WEST]); |
---|
| 1245 | |
---|
| 1246 | clusters[XMAX-1][y]->p_dspin_ram_cmd_in[EAST] (signal_dspin_false_ram_cmd_in[XMAX-1][y][EAST]); |
---|
| 1247 | clusters[XMAX-1][y]->p_dspin_ram_cmd_out[EAST] (signal_dspin_false_ram_cmd_out[XMAX-1][y][EAST]); |
---|
| 1248 | clusters[XMAX-1][y]->p_dspin_ram_rsp_in[EAST] (signal_dspin_false_ram_rsp_in[XMAX-1][y][EAST]); |
---|
| 1249 | clusters[XMAX-1][y]->p_dspin_ram_rsp_out[EAST] (signal_dspin_false_ram_rsp_out[XMAX-1][y][EAST]); |
---|
| 1250 | } |
---|
| 1251 | |
---|
| 1252 | std::cout << "East & West boundaries established" << std::endl; |
---|
| 1253 | |
---|
| 1254 | // North & South boundary clusters connections |
---|
| 1255 | for (size_t x = 0; x < XMAX; x++) |
---|
| 1256 | { |
---|
[468] | 1257 | for (size_t k = 0; k < 3; k++) |
---|
| 1258 | { |
---|
| 1259 | clusters[x][0]->p_dspin_int_cmd_in[SOUTH][k] (signal_dspin_false_int_cmd_in[x][0][SOUTH][k]); |
---|
| 1260 | clusters[x][0]->p_dspin_int_cmd_out[SOUTH][k] (signal_dspin_false_int_cmd_out[x][0][SOUTH][k]); |
---|
| 1261 | clusters[x][YMAX-1]->p_dspin_int_cmd_in[NORTH][k] (signal_dspin_false_int_cmd_in[x][YMAX-1][NORTH][k]); |
---|
| 1262 | clusters[x][YMAX-1]->p_dspin_int_cmd_out[NORTH][k] (signal_dspin_false_int_cmd_out[x][YMAX-1][NORTH][k]); |
---|
| 1263 | } |
---|
| 1264 | |
---|
[450] | 1265 | for (size_t k = 0; k < 2; k++) |
---|
| 1266 | { |
---|
[468] | 1267 | clusters[x][0]->p_dspin_int_rsp_in[SOUTH][k] (signal_dspin_false_int_rsp_in[x][0][SOUTH][k]); |
---|
| 1268 | clusters[x][0]->p_dspin_int_rsp_out[SOUTH][k] (signal_dspin_false_int_rsp_out[x][0][SOUTH][k]); |
---|
| 1269 | clusters[x][YMAX-1]->p_dspin_int_rsp_in[NORTH][k] (signal_dspin_false_int_rsp_in[x][YMAX-1][NORTH][k]); |
---|
| 1270 | clusters[x][YMAX-1]->p_dspin_int_rsp_out[NORTH][k] (signal_dspin_false_int_rsp_out[x][YMAX-1][NORTH][k]); |
---|
[450] | 1271 | } |
---|
| 1272 | |
---|
| 1273 | clusters[x][0]->p_dspin_ram_cmd_in[SOUTH] (signal_dspin_false_ram_cmd_in[x][0][SOUTH]); |
---|
| 1274 | clusters[x][0]->p_dspin_ram_cmd_out[SOUTH] (signal_dspin_false_ram_cmd_out[x][0][SOUTH]); |
---|
| 1275 | clusters[x][0]->p_dspin_ram_rsp_in[SOUTH] (signal_dspin_false_ram_rsp_in[x][0][SOUTH]); |
---|
| 1276 | clusters[x][0]->p_dspin_ram_rsp_out[SOUTH] (signal_dspin_false_ram_rsp_out[x][0][SOUTH]); |
---|
| 1277 | |
---|
| 1278 | clusters[x][YMAX-1]->p_dspin_ram_cmd_in[NORTH] (signal_dspin_false_ram_cmd_in[x][YMAX-1][NORTH]); |
---|
| 1279 | clusters[x][YMAX-1]->p_dspin_ram_cmd_out[NORTH] (signal_dspin_false_ram_cmd_out[x][YMAX-1][NORTH]); |
---|
| 1280 | clusters[x][YMAX-1]->p_dspin_ram_rsp_in[NORTH] (signal_dspin_false_ram_rsp_in[x][YMAX-1][NORTH]); |
---|
| 1281 | clusters[x][YMAX-1]->p_dspin_ram_rsp_out[NORTH] (signal_dspin_false_ram_rsp_out[x][YMAX-1][NORTH]); |
---|
| 1282 | } |
---|
| 1283 | |
---|
| 1284 | std::cout << "North & South boundaries established" << std::endl; |
---|
| 1285 | |
---|
| 1286 | //////////////////////////////////////////////////////// |
---|
| 1287 | // Simulation |
---|
| 1288 | /////////////////////////////////////////////////////// |
---|
| 1289 | |
---|
| 1290 | sc_start(sc_core::sc_time(0, SC_NS)); |
---|
| 1291 | signal_resetn = false; |
---|
| 1292 | |
---|
| 1293 | // network boundaries signals |
---|
| 1294 | for (size_t x = 0; x < XMAX ; x++) |
---|
| 1295 | { |
---|
| 1296 | for (size_t y = 0; y < YMAX ; y++) |
---|
| 1297 | { |
---|
| 1298 | for (size_t a = 0; a < 4; a++) |
---|
| 1299 | { |
---|
[468] | 1300 | for (size_t k = 0; k < 3; k++) |
---|
| 1301 | { |
---|
| 1302 | signal_dspin_false_int_cmd_in[x][y][a][k].write = false; |
---|
| 1303 | signal_dspin_false_int_cmd_in[x][y][a][k].read = true; |
---|
| 1304 | signal_dspin_false_int_cmd_out[x][y][a][k].write = false; |
---|
| 1305 | signal_dspin_false_int_cmd_out[x][y][a][k].read = true; |
---|
| 1306 | } |
---|
| 1307 | |
---|
[450] | 1308 | for (size_t k = 0; k < 2; k++) |
---|
| 1309 | { |
---|
[468] | 1310 | signal_dspin_false_int_rsp_in[x][y][a][k].write = false; |
---|
| 1311 | signal_dspin_false_int_rsp_in[x][y][a][k].read = true; |
---|
| 1312 | signal_dspin_false_int_rsp_out[x][y][a][k].write = false; |
---|
| 1313 | signal_dspin_false_int_rsp_out[x][y][a][k].read = true; |
---|
[450] | 1314 | } |
---|
| 1315 | |
---|
| 1316 | signal_dspin_false_ram_cmd_in[x][y][a].write = false; |
---|
| 1317 | signal_dspin_false_ram_cmd_in[x][y][a].read = true; |
---|
| 1318 | signal_dspin_false_ram_cmd_out[x][y][a].write = false; |
---|
| 1319 | signal_dspin_false_ram_cmd_out[x][y][a].read = true; |
---|
| 1320 | |
---|
| 1321 | signal_dspin_false_ram_rsp_in[x][y][a].write = false; |
---|
| 1322 | signal_dspin_false_ram_rsp_in[x][y][a].read = true; |
---|
| 1323 | signal_dspin_false_ram_rsp_out[x][y][a].write = false; |
---|
| 1324 | signal_dspin_false_ram_rsp_out[x][y][a].read = true; |
---|
| 1325 | } |
---|
| 1326 | } |
---|
| 1327 | } |
---|
| 1328 | |
---|
| 1329 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
| 1330 | signal_resetn = true; |
---|
| 1331 | |
---|
| 1332 | for (size_t n = 1; n < ncycles; n++) |
---|
| 1333 | { |
---|
| 1334 | // Monitor a specific address for L1 & L2 caches |
---|
[493] | 1335 | // clusters[1][1]->proc[0]->cache_monitor(0x8ba4ULL); |
---|
[498] | 1336 | // clusters[0][0]->memc->cache_monitor( 0x12180ULL); |
---|
[450] | 1337 | |
---|
| 1338 | if (debug_ok and (n > debug_from) and (n % debug_period == 0)) |
---|
| 1339 | { |
---|
| 1340 | std::cout << "****************** cycle " << std::dec << n ; |
---|
| 1341 | std::cout << " ************************************************" << std::endl; |
---|
| 1342 | |
---|
| 1343 | // trace proc[debug_proc_id] |
---|
[490] | 1344 | if ( debug_proc_id < XMAX*YMAX*NB_PROCS_MAX ) |
---|
[450] | 1345 | { |
---|
| 1346 | |
---|
| 1347 | size_t l = debug_proc_id % NB_PROCS_MAX ; |
---|
| 1348 | size_t y = (debug_proc_id / NB_PROCS_MAX) % YMAX ; |
---|
| 1349 | size_t x = debug_proc_id / (YMAX * NB_PROCS_MAX) ; |
---|
| 1350 | |
---|
[490] | 1351 | clusters[x][y]->proc[l]->print_trace(1); |
---|
[450] | 1352 | |
---|
| 1353 | std::ostringstream proc_signame; |
---|
| 1354 | proc_signame << "[SIG]PROC_" << x << "_" << y << "_" << l ; |
---|
| 1355 | clusters[x][y]->signal_int_vci_ini_proc[l].print_trace(proc_signame.str()); |
---|
| 1356 | |
---|
| 1357 | std::ostringstream p2m_signame; |
---|
| 1358 | p2m_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " P2M" ; |
---|
| 1359 | clusters[x][y]->signal_int_dspin_p2m_proc[l].print_trace(p2m_signame.str()); |
---|
| 1360 | |
---|
| 1361 | std::ostringstream m2p_signame; |
---|
| 1362 | m2p_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " M2P" ; |
---|
| 1363 | clusters[x][y]->signal_int_dspin_m2p_proc[l].print_trace(m2p_signame.str()); |
---|
| 1364 | |
---|
| 1365 | // std::ostringstream p_cmd_signame; |
---|
| 1366 | // p_cmd_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " CMD" ; |
---|
| 1367 | // clusters[x][y]->signal_int_dspin_cmd_proc_i[l].print_trace(p_cmd_signame.str()); |
---|
| 1368 | |
---|
| 1369 | // std::ostringstream p_rsp_signame; |
---|
| 1370 | // p_rsp_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " RSP" ; |
---|
| 1371 | // clusters[x][y]->signal_int_dspin_rsp_proc_i[l].print_trace(p_rsp_signame.str()); |
---|
| 1372 | |
---|
| 1373 | // trace INT routers and xbar in a given cluster |
---|
| 1374 | // clusters[x][y]->int_xbar_m2p_c->print_trace(); |
---|
| 1375 | // clusters[x][y]->int_router_cmd->print_trace(1); |
---|
| 1376 | // clusters[x][y]->int_xbar_rsp_d->print_trace(); |
---|
| 1377 | // clusters[x][y]->int_xbar_cmd_d->print_trace(); |
---|
| 1378 | // clusters[x][y]->signal_int_dspin_cmd_l2g_d.print_trace("[SIG]L2G CMD"); |
---|
| 1379 | // clusters[x][y]->signal_int_dspin_cmd_g2l_d.print_trace("[SIG]G2L CMD"); |
---|
| 1380 | // clusters[x][y]->signal_int_dspin_rsp_l2g_d.print_trace("[SIG]L2G RSP"); |
---|
| 1381 | // clusters[x][y]->signal_int_dspin_rsp_g2l_d.print_trace("[SIG]G2L RSP"); |
---|
| 1382 | } |
---|
| 1383 | |
---|
| 1384 | // trace memc[debug_memc_id] |
---|
| 1385 | if ( debug_memc_id < XMAX*YMAX ) |
---|
| 1386 | { |
---|
[498] | 1387 | |
---|
[450] | 1388 | size_t x = debug_memc_id / YMAX; |
---|
| 1389 | size_t y = debug_memc_id % YMAX; |
---|
| 1390 | |
---|
| 1391 | clusters[x][y]->memc->print_trace(); |
---|
| 1392 | |
---|
| 1393 | std::ostringstream smemc_tgt; |
---|
| 1394 | smemc_tgt << "[SIG]MEMC_TGT_" << x << "_" << y; |
---|
| 1395 | clusters[x][y]->signal_int_vci_tgt_memc.print_trace(smemc_tgt.str()); |
---|
| 1396 | |
---|
| 1397 | std::ostringstream smemc_ini; |
---|
| 1398 | smemc_ini << "[SIG]MEMC_INI_" << x << "_" << y; |
---|
| 1399 | clusters[x][y]->signal_ram_vci_ini_memc.print_trace(smemc_ini.str()); |
---|
| 1400 | |
---|
| 1401 | // clusters[x][y]->ram_router_cmd->print_trace(); |
---|
| 1402 | // clusters[x][y]->ram_xbar_cmd->print_trace(); |
---|
| 1403 | |
---|
| 1404 | // std::ostringstream sg2l; |
---|
| 1405 | // sg2l << "[SIG]G2L_" << x << "_" << y; |
---|
| 1406 | // clusters[x][y]->signal_ram_dspin_cmd_g2l.print_trace(sg2l.str()); |
---|
| 1407 | |
---|
| 1408 | clusters[x][y]->xram->print_trace(); |
---|
| 1409 | |
---|
| 1410 | std::ostringstream sxram_tgt; |
---|
| 1411 | sxram_tgt << "[SIG]XRAM_TGT_" << x << "_" << y; |
---|
| 1412 | clusters[x][y]->signal_ram_vci_tgt_xram.print_trace(sxram_tgt.str()); |
---|
| 1413 | |
---|
| 1414 | std::ostringstream sm2p; |
---|
| 1415 | sm2p << "[SIG]MEMC_" << x << "_" << y << " M2P" ; |
---|
| 1416 | clusters[x][y]->signal_int_dspin_m2p_memc.print_trace(sm2p.str()); |
---|
| 1417 | |
---|
| 1418 | std::ostringstream sp2m; |
---|
| 1419 | sp2m << "[SIG]MEMC_" << x << "_" << y << " P2M" ; |
---|
| 1420 | clusters[x][y]->signal_int_dspin_p2m_memc.print_trace(sp2m.str()); |
---|
| 1421 | |
---|
| 1422 | // std::ostringstream m_cmd_signame; |
---|
| 1423 | // m_cmd_signame << "[SIG]MEMC_" << x << "_" << y << " CMD" ; |
---|
| 1424 | // clusters[x][y]->signal_int_dspin_cmd_memc_t.print_trace(m_cmd_signame.str()); |
---|
| 1425 | |
---|
| 1426 | // std::ostringstream m_rsp_signame; |
---|
| 1427 | // m_rsp_signame << "[SIG]MEMC_" << x << "_" << y << " RSP" ; |
---|
| 1428 | // clusters[x][y]->signal_int_dspin_rsp_memc_t.print_trace(m_rsp_signame.str()); |
---|
| 1429 | |
---|
| 1430 | std::ostringstream siob_ini; |
---|
| 1431 | siob_ini << "[SIG]IOB_INI_" << x << "_" << y; |
---|
| 1432 | clusters[x][y]->signal_ram_vci_ini_iobx.print_trace(siob_ini.str()); |
---|
| 1433 | } |
---|
| 1434 | |
---|
| 1435 | // trace components iob |
---|
| 1436 | if ( debug_iob ) |
---|
| 1437 | { |
---|
| 1438 | clusters[0][0]->iob->print_trace(); |
---|
[498] | 1439 | clusters[0][0]->signal_int_vci_tgt_iobx.print_trace( "[SIG]IOB0 INT TGT" ); |
---|
| 1440 | // clusters[0][0]->signal_int_dspin_cmd_iobx_t.print_trace("[SIG]IOB0 INT CMD"); |
---|
| 1441 | // clusters[0][0]->signal_int_dspin_rsp_iobx_t.print_trace("[SIG]IOB0 INT RSP"); |
---|
[450] | 1442 | |
---|
| 1443 | clusters[XMAX-1][YMAX-1]->iob->print_trace(); |
---|
[498] | 1444 | clusters[XMAX-1][YMAX-1]->signal_int_vci_tgt_iobx.print_trace( "[SIG]IOB1 INT TGT" ); |
---|
| 1445 | // clusters[XMAX-1][YMAX-1]->signal_int_dspin_cmd_iobx_t.print_trace("[SIG]IOB1 INT CMD"); |
---|
| 1446 | // clusters[XMAX-1][YMAX-1]->signal_int_dspin_rsp_iobx_t.print_trace("[SIG]IOB1 INT RSP"); |
---|
[450] | 1447 | } |
---|
| 1448 | |
---|
| 1449 | // trace external peripherals |
---|
| 1450 | iox_network->print_trace(); |
---|
| 1451 | |
---|
[498] | 1452 | signal_vci_ini_iob0.print_trace("[SIG]IOB0 IOX INI"); |
---|
| 1453 | signal_vci_tgt_iob0.print_trace("[SIG]IOB0 IOX TGT"); |
---|
| 1454 | signal_vci_ini_iob1.print_trace("[SIG]IOB1 IOX INI"); |
---|
| 1455 | signal_vci_tgt_iob1.print_trace("[SIG]IOB1 IOX TGT"); |
---|
[450] | 1456 | |
---|
[498] | 1457 | iox_cdma->print_trace(); |
---|
| 1458 | signal_vci_tgt_cdma.print_trace("[SIG]CDMA_TGT"); |
---|
| 1459 | signal_vci_ini_cdma.print_trace("[SIG]CDMA_INI"); |
---|
[450] | 1460 | |
---|
[498] | 1461 | // iox_brom->print_trace(); |
---|
| 1462 | // signal_vci_tgt_brom.print_trace("[SIG]BROM"); |
---|
[450] | 1463 | |
---|
[498] | 1464 | iox_mtty->print_trace(); |
---|
| 1465 | signal_vci_tgt_mtty.print_trace("[SIG]MTTY"); |
---|
[450] | 1466 | |
---|
[498] | 1467 | iox_bdev->print_trace(); |
---|
| 1468 | signal_vci_tgt_bdev.print_trace("[SIG]BDEV_TGT"); |
---|
| 1469 | signal_vci_ini_bdev.print_trace("[SIG]BDEV_INI"); |
---|
| 1470 | |
---|
[450] | 1471 | // iox_fbuf->print_trace(); |
---|
| 1472 | // signal_vci_tgt_fbuf.print_trace("[SIG]FBUF"); |
---|
| 1473 | |
---|
| 1474 | } |
---|
| 1475 | |
---|
| 1476 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
| 1477 | } |
---|
| 1478 | return EXIT_SUCCESS; |
---|
| 1479 | } |
---|
| 1480 | |
---|
| 1481 | int sc_main (int argc, char *argv[]) |
---|
| 1482 | { |
---|
| 1483 | try { |
---|
| 1484 | return _main(argc, argv); |
---|
| 1485 | } catch (std::exception &e) { |
---|
| 1486 | std::cout << e.what() << std::endl; |
---|
| 1487 | } catch (...) { |
---|
| 1488 | std::cout << "Unknown exception occured" << std::endl; |
---|
| 1489 | throw; |
---|
| 1490 | } |
---|
| 1491 | return 1; |
---|
| 1492 | } |
---|
| 1493 | |
---|
| 1494 | |
---|
| 1495 | // Local Variables: |
---|
| 1496 | // tab-width: 3 |
---|
| 1497 | // c-basic-offset: 3 |
---|
| 1498 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 1499 | // indent-tabs-mode: nil |
---|
| 1500 | // End: |
---|
| 1501 | |
---|
| 1502 | // vim: filetype=cpp:expandtab:shiftwidth=3:tabstop=3:softtabstop=3 |
---|
| 1503 | |
---|
| 1504 | |
---|
| 1505 | |
---|