[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 |
---|
[550] | 242 | #define BDEV_SIZE 0x0000008000 // 4 Kbytes |
---|
[450] | 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 | |
---|
[550] | 293 | #define PROC_LOCAL_SRCID 0x0 // from 0 to 7 |
---|
| 294 | #define MDMA_LOCAL_SRCID 0x8 |
---|
| 295 | #define IOBX_LOCAL_SRCID 0x9 |
---|
| 296 | #define MEMC_LOCAL_SRCID 0xA |
---|
| 297 | #define CDMA_LOCAL_SRCID 0xE // hard-coded in dspin_tsar |
---|
| 298 | #define BDEV_LOCAL_SRCID 0xF // hard-coded in dspin_tsar |
---|
[450] | 299 | |
---|
[550] | 300 | /////////////////////////////////////////////////////////////////////// |
---|
[450] | 301 | // TGT_ID and INI_ID port indexing for INT local interconnect |
---|
[550] | 302 | /////////////////////////////////////////////////////////////////////// |
---|
[450] | 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 | |
---|
[550] | 313 | /////////////////////////////////////////////////////////////////////// |
---|
[450] | 314 | // TGT_ID and INI_ID port indexing for RAM local interconnect |
---|
[550] | 315 | /////////////////////////////////////////////////////////////////////// |
---|
[450] | 316 | |
---|
| 317 | #define RAM_XRAM_TGT_ID 0 |
---|
| 318 | |
---|
| 319 | #define RAM_MEMC_INI_ID 0 |
---|
| 320 | #define RAM_IOBX_INI_ID 1 |
---|
| 321 | |
---|
[550] | 322 | /////////////////////////////////////////////////////////////////////// |
---|
[450] | 323 | // TGT_ID and INI_ID port indexing for I0X local interconnect |
---|
[550] | 324 | /////////////////////////////////////////////////////////////////////// |
---|
[450] | 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 | |
---|
[550] | 340 | //////////////////////////////////////////////////////////////////////// |
---|
[450] | 341 | int _main(int argc, char *argv[]) |
---|
[550] | 342 | //////////////////////////////////////////////////////////////////////// |
---|
[450] | 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); |
---|
[550] | 535 | bool config = true; |
---|
| 536 | bool cacheable = true; |
---|
[450] | 537 | |
---|
| 538 | // the four following segments are defined in all clusters |
---|
| 539 | |
---|
| 540 | std::ostringstream smemc_conf; |
---|
| 541 | smemc_conf << "int_seg_memc_conf_" << x << "_" << y; |
---|
| 542 | maptab_int.add(Segment(smemc_conf.str(), MEMC_BASE+offset, MEMC_SIZE, |
---|
[569] | 543 | IntTab(cluster(x,y),INT_MEMC_TGT_ID), not cacheable, config )); |
---|
[450] | 544 | |
---|
| 545 | std::ostringstream smemc_xram; |
---|
| 546 | smemc_xram << "int_seg_memc_xram_" << x << "_" << y; |
---|
| 547 | maptab_int.add(Segment(smemc_xram.str(), XRAM_BASE+offset, XRAM_SIZE, |
---|
[550] | 548 | IntTab(cluster(x,y),INT_MEMC_TGT_ID), cacheable)); |
---|
[450] | 549 | |
---|
| 550 | std::ostringstream sxicu; |
---|
| 551 | sxicu << "int_seg_xicu_" << x << "_" << y; |
---|
| 552 | maptab_int.add(Segment(sxicu.str(), XICU_BASE+offset, XICU_SIZE, |
---|
[550] | 553 | IntTab(cluster(x,y),INT_XICU_TGT_ID), not cacheable)); |
---|
[450] | 554 | |
---|
| 555 | std::ostringstream smdma; |
---|
| 556 | smdma << "int_seg_mdma_" << x << "_" << y; |
---|
| 557 | maptab_int.add(Segment(smdma.str(), MDMA_BASE+offset, MDMA_SIZE, |
---|
[550] | 558 | IntTab(cluster(x,y),INT_MDMA_TGT_ID), not cacheable)); |
---|
[450] | 559 | |
---|
| 560 | // the following segments are only defined in cluster_iob0 or in cluster_iob1 |
---|
| 561 | |
---|
| 562 | if ( (cluster(x,y) == cluster_iob0) or (cluster(x,y) == cluster_iob1) ) |
---|
| 563 | { |
---|
| 564 | std::ostringstream siobx; |
---|
| 565 | siobx << "int_seg_iobx_" << x << "_" << y; |
---|
| 566 | maptab_int.add(Segment(siobx.str(), IOBX_BASE+offset, IOBX_SIZE, |
---|
[550] | 567 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable, config )); |
---|
[450] | 568 | |
---|
| 569 | std::ostringstream stty; |
---|
| 570 | stty << "int_seg_mtty_" << x << "_" << y; |
---|
| 571 | maptab_int.add(Segment(stty.str(), MTTY_BASE+offset, MTTY_SIZE, |
---|
[550] | 572 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
[450] | 573 | |
---|
| 574 | std::ostringstream sfbf; |
---|
| 575 | sfbf << "int_seg_fbuf_" << x << "_" << y; |
---|
| 576 | maptab_int.add(Segment(sfbf.str(), FBUF_BASE+offset, FBUF_SIZE, |
---|
[550] | 577 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
[450] | 578 | |
---|
| 579 | std::ostringstream sbdv; |
---|
| 580 | sbdv << "int_seg_bdev_" << x << "_" << y; |
---|
| 581 | maptab_int.add(Segment(sbdv.str(), BDEV_BASE+offset, BDEV_SIZE, |
---|
[550] | 582 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
[450] | 583 | |
---|
| 584 | std::ostringstream snic; |
---|
| 585 | snic << "int_seg_mnic_" << x << "_" << y; |
---|
| 586 | maptab_int.add(Segment(snic.str(), MNIC_BASE+offset, MNIC_SIZE, |
---|
[550] | 587 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
[450] | 588 | |
---|
| 589 | std::ostringstream srom; |
---|
| 590 | srom << "int_seg_brom_" << x << "_" << y; |
---|
| 591 | maptab_int.add(Segment(srom.str(), BROM_BASE+offset, BROM_SIZE, |
---|
[550] | 592 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), cacheable )); |
---|
[450] | 593 | |
---|
| 594 | std::ostringstream sdma; |
---|
| 595 | sdma << "int_seg_cdma_" << x << "_" << y; |
---|
| 596 | maptab_int.add(Segment(sdma.str(), CDMA_BASE+offset, CDMA_SIZE, |
---|
[550] | 597 | IntTab(cluster(x,y), INT_IOBX_TGT_ID), not cacheable)); |
---|
[450] | 598 | } |
---|
| 599 | |
---|
| 600 | // This define the mapping between the SRCIDs |
---|
| 601 | // and the port index on the local interconnect. |
---|
| 602 | |
---|
[550] | 603 | maptab_int.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ), |
---|
| 604 | IntTab( cluster(x,y), INT_MDMA_INI_ID ) ); |
---|
[450] | 605 | |
---|
[550] | 606 | maptab_int.srcid_map( IntTab( cluster(x,y), IOBX_LOCAL_SRCID ), |
---|
| 607 | IntTab( cluster(x,y), INT_IOBX_INI_ID ) ); |
---|
[450] | 608 | |
---|
| 609 | for ( size_t p = 0 ; p < NB_PROCS_MAX ; p++ ) |
---|
[550] | 610 | maptab_int.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID+p ), |
---|
| 611 | IntTab( cluster(x,y), INT_PROC_INI_ID+p ) ); |
---|
[450] | 612 | } |
---|
| 613 | } |
---|
| 614 | std::cout << "INT network " << maptab_int << std::endl; |
---|
| 615 | |
---|
| 616 | ///////////////////////////////////////////////////////////////////////// |
---|
| 617 | // RAM network mapping table |
---|
| 618 | // - two levels address decoding for commands |
---|
| 619 | // - two levels srcid decoding for responses |
---|
| 620 | // - 2 local initiators (MEMC, IOBX) per cluster |
---|
| 621 | // (IOBX component only in cluster_iob0 and cluster_iob1) |
---|
| 622 | // - 1 local target (XRAM) per cluster |
---|
| 623 | //////////////////////////////////////////////////////////////////////// |
---|
| 624 | MappingTable maptab_ram( vci_address_width, |
---|
| 625 | IntTab(x_width+y_width, 16 - x_width - y_width), |
---|
| 626 | IntTab(x_width+y_width, vci_srcid_width - x_width - y_width), |
---|
| 627 | 0x00FF000000); |
---|
| 628 | |
---|
| 629 | for (size_t x = 0; x < XMAX; x++) |
---|
| 630 | { |
---|
| 631 | for (size_t y = 0; y < YMAX ; y++) |
---|
| 632 | { |
---|
| 633 | uint64_t offset = ((uint64_t)cluster(x,y)) |
---|
| 634 | << (vci_address_width-x_width-y_width); |
---|
| 635 | |
---|
| 636 | std::ostringstream sxram; |
---|
| 637 | sxram << "ext_seg_xram_" << x << "_" << y; |
---|
| 638 | maptab_ram.add(Segment(sxram.str(), XRAM_BASE+offset, |
---|
| 639 | XRAM_SIZE, IntTab(cluster(x,y), 0), false)); |
---|
| 640 | } |
---|
| 641 | } |
---|
| 642 | |
---|
[550] | 643 | // This define the mapping between the initiators SRCID |
---|
| 644 | // and the port index on the RAM local interconnect. |
---|
[450] | 645 | // External initiator have two alias SRCID (iob0 / iob1) |
---|
| 646 | |
---|
[550] | 647 | maptab_ram.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ), |
---|
| 648 | IntTab( cluster_iob0, RAM_IOBX_INI_ID ) ); |
---|
[450] | 649 | |
---|
[550] | 650 | maptab_ram.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ), |
---|
| 651 | IntTab( cluster_iob1, RAM_IOBX_INI_ID ) ); |
---|
[450] | 652 | |
---|
[550] | 653 | maptab_ram.srcid_map( IntTab( cluster_iob0, BDEV_LOCAL_SRCID ), |
---|
| 654 | IntTab( cluster_iob0, RAM_IOBX_INI_ID ) ); |
---|
[450] | 655 | |
---|
[550] | 656 | maptab_ram.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ), |
---|
| 657 | IntTab( cluster_iob1, RAM_IOBX_INI_ID ) ); |
---|
| 658 | |
---|
| 659 | maptab_ram.srcid_map( IntTab( cluster_iob1, MEMC_LOCAL_SRCID ), |
---|
| 660 | IntTab( cluster_iob1, RAM_MEMC_INI_ID ) ); |
---|
| 661 | |
---|
[450] | 662 | std::cout << "RAM network " << maptab_ram << std::endl; |
---|
| 663 | |
---|
| 664 | /////////////////////////////////////////////////////////////////////// |
---|
| 665 | // IOX network mapping table |
---|
| 666 | // - two levels address decoding for commands |
---|
| 667 | // - two levels srcid decoding for responses |
---|
| 668 | // - 4 initiators (IOB0, IOB1, BDEV, CDMA) |
---|
| 669 | // - 8 targets (IOB0, IOB1, BDEV, CDMA, MTTY, FBUF, BROM, MNIC) |
---|
| 670 | /////////////////////////////////////////////////////////////////////// |
---|
| 671 | MappingTable maptab_iox( vci_address_width, |
---|
| 672 | IntTab(x_width+y_width, 16 - x_width - y_width), |
---|
| 673 | IntTab(x_width+y_width, vci_srcid_width - x_width - y_width), |
---|
| 674 | 0x00FF000000); |
---|
| 675 | |
---|
| 676 | // compute base addresses for cluster_iob0 and cluster_iob1 |
---|
| 677 | uint64_t iob0_base = ((uint64_t)cluster_iob0) << (vci_address_width - x_width - y_width); |
---|
| 678 | uint64_t iob1_base = ((uint64_t)cluster_iob1) << (vci_address_width - x_width - y_width); |
---|
| 679 | |
---|
| 680 | // Each peripheral can be accessed through two segments, |
---|
| 681 | // depending on the used IOB (IOB0 or IOB1). |
---|
| 682 | maptab_iox.add(Segment("iox_seg_mtty_0", MTTY_BASE + iob0_base, MTTY_SIZE, |
---|
| 683 | IntTab(cluster_iob0,IOX_MTTY_TGT_ID), false)); |
---|
| 684 | maptab_iox.add(Segment("iox_seg_mtty_1", MTTY_BASE + iob1_base, MTTY_SIZE, |
---|
| 685 | IntTab(cluster_iob1,IOX_MTTY_TGT_ID), false)); |
---|
| 686 | |
---|
| 687 | maptab_iox.add(Segment("iox_seg_fbuf_0", FBUF_BASE + iob0_base, FBUF_SIZE, |
---|
| 688 | IntTab(cluster_iob0,IOX_FBUF_TGT_ID), false)); |
---|
| 689 | maptab_iox.add(Segment("iox_seg_fbuf_1", FBUF_BASE + iob1_base, FBUF_SIZE, |
---|
| 690 | IntTab(cluster_iob1,IOX_FBUF_TGT_ID), false)); |
---|
| 691 | |
---|
| 692 | maptab_iox.add(Segment("iox_seg_bdev_0", BDEV_BASE + iob0_base, BDEV_SIZE, |
---|
| 693 | IntTab(cluster_iob0,IOX_BDEV_TGT_ID), false)); |
---|
| 694 | maptab_iox.add(Segment("iox_seg_bdev_1", BDEV_BASE + iob1_base, BDEV_SIZE, |
---|
| 695 | IntTab(cluster_iob1,IOX_BDEV_TGT_ID), false)); |
---|
| 696 | |
---|
| 697 | maptab_iox.add(Segment("iox_seg_mnic_0", MNIC_BASE + iob0_base, MNIC_SIZE, |
---|
| 698 | IntTab(cluster_iob0,IOX_MNIC_TGT_ID), false)); |
---|
| 699 | maptab_iox.add(Segment("iox_seg_mnic_1", MNIC_BASE + iob1_base, MNIC_SIZE, |
---|
| 700 | IntTab(cluster_iob1,IOX_MNIC_TGT_ID), false)); |
---|
| 701 | |
---|
| 702 | maptab_iox.add(Segment("iox_seg_cdma_0", CDMA_BASE + iob0_base, CDMA_SIZE, |
---|
| 703 | IntTab(cluster_iob0,IOX_CDMA_TGT_ID), false)); |
---|
| 704 | maptab_iox.add(Segment("iox_seg_cdma_1", CDMA_BASE + iob1_base, CDMA_SIZE, |
---|
| 705 | IntTab(cluster_iob1,IOX_CDMA_TGT_ID), false)); |
---|
| 706 | |
---|
| 707 | maptab_iox.add(Segment("iox_seg_brom_0", BROM_BASE + iob0_base, BROM_SIZE, |
---|
| 708 | IntTab(cluster_iob0,IOX_BROM_TGT_ID), false)); |
---|
| 709 | maptab_iox.add(Segment("iox_seg_brom_1", BROM_BASE + iob1_base, BROM_SIZE, |
---|
| 710 | IntTab(cluster_iob1,IOX_BROM_TGT_ID), false)); |
---|
| 711 | |
---|
| 712 | // Each physical RAM can be accessed through IOB0, or through IOB1. |
---|
| 713 | // if IOMMU is not activated, addresses are 40 bits (physical addresses), |
---|
| 714 | // and the choice depends on on address bit A[39]. |
---|
| 715 | // if IOMMU is activated the addresses use only 32 bits (virtual addresses), |
---|
| 716 | // and the choice depends on address bit A[31]. |
---|
| 717 | for (size_t x = 0; x < XMAX; x++) |
---|
| 718 | { |
---|
| 719 | for (size_t y = 0; y < YMAX ; y++) |
---|
| 720 | { |
---|
| 721 | uint64_t offset = ((uint64_t)cluster(x,y)) |
---|
| 722 | << (vci_address_width-x_width-y_width); |
---|
| 723 | |
---|
| 724 | if ( x < (XMAX/2) ) // send command to XRAM through IOB0 |
---|
| 725 | { |
---|
| 726 | std::ostringstream siob0; |
---|
| 727 | siob0 << "iox_seg_xram_" << x << "_" << y; |
---|
| 728 | maptab_iox.add(Segment(siob0.str(), offset, 0x80000000, |
---|
| 729 | IntTab(cluster_iob0,IOX_IOB0_TGT_ID), false)); |
---|
| 730 | } |
---|
| 731 | else // send command to XRAM through IOB1 |
---|
| 732 | { |
---|
| 733 | std::ostringstream siob1; |
---|
| 734 | siob1 << "iox_seg_xram_" << x << "_" << y; |
---|
| 735 | maptab_iox.add(Segment(siob1.str(), offset, 0x80000000, |
---|
| 736 | IntTab(cluster_iob1,IOX_IOB1_TGT_ID), false)); |
---|
| 737 | } |
---|
| 738 | } |
---|
| 739 | } |
---|
| 740 | // useful when IOMMU activated |
---|
| 741 | maptab_iox.add(Segment("iox_seg_xram ", 0xc0000000, 0x40000000, |
---|
| 742 | IntTab(cluster_iob1,IOX_IOB1_TGT_ID), false)); |
---|
| 743 | |
---|
| 744 | // This define the mapping between the initiators (identified by the SRCID) |
---|
| 745 | // and the port index on the IOX local interconnect. |
---|
| 746 | // External initiator have two alias SRCID (iob0 / iob1 access) |
---|
| 747 | |
---|
[550] | 748 | maptab_iox.srcid_map( IntTab( cluster_iob0, CDMA_LOCAL_SRCID ), |
---|
| 749 | IntTab( cluster_iob0, IOX_CDMA_INI_ID ) ); |
---|
[450] | 750 | |
---|
[550] | 751 | maptab_iox.srcid_map( IntTab( cluster_iob1, CDMA_LOCAL_SRCID ), |
---|
| 752 | IntTab( cluster_iob1, IOX_CDMA_INI_ID ) ); |
---|
[450] | 753 | |
---|
[550] | 754 | maptab_iox.srcid_map( IntTab( cluster_iob0, BDEV_LOCAL_SRCID ), |
---|
| 755 | IntTab( cluster_iob0, IOX_BDEV_INI_ID ) ); |
---|
| 756 | |
---|
| 757 | maptab_iox.srcid_map( IntTab( cluster_iob1, BDEV_LOCAL_SRCID ), |
---|
| 758 | IntTab( cluster_iob0, IOX_BDEV_INI_ID ) ); |
---|
| 759 | |
---|
[450] | 760 | for (size_t x = 0; x < XMAX; x++) |
---|
| 761 | { |
---|
| 762 | for (size_t y = 0; y < YMAX ; y++) |
---|
| 763 | { |
---|
[550] | 764 | size_t iob = ( x < (XMAX/2) ) ? IOX_IOB0_INI_ID : IOX_IOB1_INI_ID; |
---|
| 765 | |
---|
| 766 | for (size_t p = 0 ; p < NB_PROCS_MAX ; p++) |
---|
| 767 | maptab_iox.srcid_map( IntTab( cluster(x,y), PROC_LOCAL_SRCID + p ), |
---|
| 768 | IntTab( cluster(x,y), iob ) ); |
---|
| 769 | |
---|
| 770 | maptab_iox.srcid_map( IntTab( cluster(x,y), MDMA_LOCAL_SRCID ), |
---|
| 771 | IntTab( cluster(x,y), IOX_IOB0_INI_ID ) ); |
---|
[450] | 772 | } |
---|
| 773 | } |
---|
| 774 | |
---|
| 775 | std::cout << "IOX network " << maptab_iox << std::endl; |
---|
| 776 | |
---|
| 777 | //////////////////// |
---|
| 778 | // Signals |
---|
| 779 | /////////////////// |
---|
| 780 | |
---|
[550] | 781 | sc_clock signal_clk("clk"); |
---|
| 782 | sc_signal<bool> signal_resetn("resetn"); |
---|
[450] | 783 | |
---|
[550] | 784 | sc_signal<bool> signal_unused_irq[32]; |
---|
| 785 | sc_signal<bool> signal_irq_bdev; |
---|
| 786 | sc_signal<bool> signal_irq_mnic_rx[NB_NIC_CHANNELS]; |
---|
| 787 | sc_signal<bool> signal_irq_mnic_tx[NB_NIC_CHANNELS]; |
---|
| 788 | sc_signal<bool> signal_irq_mtty[NB_TTY_CHANNELS]; |
---|
| 789 | sc_signal<bool> signal_irq_cdma[NB_NIC_CHANNELS*2]; |
---|
[450] | 790 | |
---|
[550] | 791 | // DSPIN signals for loopback in cluster_iob0 & cluster_iob1 |
---|
| 792 | DspinSignals<dspin_ram_cmd_width> signal_dspin_cmd_iob0_loopback; |
---|
| 793 | DspinSignals<dspin_ram_rsp_width> signal_dspin_rsp_iob0_loopback; |
---|
| 794 | DspinSignals<dspin_ram_cmd_width> signal_dspin_cmd_iob1_loopback; |
---|
| 795 | DspinSignals<dspin_ram_rsp_width> signal_dspin_rsp_iob1_loopback; |
---|
| 796 | |
---|
[450] | 797 | // VCI signals for IOX network |
---|
[550] | 798 | VciSignals<vci_param_ext> signal_vci_ini_iob0("signal_vci_ini_iob0"); |
---|
| 799 | VciSignals<vci_param_ext> signal_vci_ini_iob1("signal_vci_ini_iob1"); |
---|
| 800 | VciSignals<vci_param_ext> signal_vci_ini_bdev("signal_vci_ini_bdev"); |
---|
| 801 | VciSignals<vci_param_ext> signal_vci_ini_cdma("signal_vci_ini_cdma"); |
---|
[450] | 802 | |
---|
[550] | 803 | VciSignals<vci_param_ext> signal_vci_tgt_iob0("signal_vci_tgt_iob0"); |
---|
| 804 | VciSignals<vci_param_ext> signal_vci_tgt_iob1("signal_vci_tgt_iob1"); |
---|
| 805 | VciSignals<vci_param_ext> signal_vci_tgt_mtty("signal_vci_tgt_mtty"); |
---|
| 806 | VciSignals<vci_param_ext> signal_vci_tgt_fbuf("signal_vci_tgt_fbuf"); |
---|
| 807 | VciSignals<vci_param_ext> signal_vci_tgt_mnic("signal_vci_tgt_mnic"); |
---|
| 808 | VciSignals<vci_param_ext> signal_vci_tgt_brom("signal_vci_tgt_brom"); |
---|
| 809 | VciSignals<vci_param_ext> signal_vci_tgt_bdev("signal_vci_tgt_bdev"); |
---|
| 810 | VciSignals<vci_param_ext> signal_vci_tgt_cdma("signal_vci_tgt_cdma"); |
---|
[450] | 811 | |
---|
| 812 | // Horizontal inter-clusters INT network DSPIN |
---|
| 813 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_h_inc = |
---|
[468] | 814 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_h_inc", XMAX-1, YMAX, 3); |
---|
[450] | 815 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_h_dec = |
---|
[468] | 816 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_h_dec", XMAX-1, YMAX, 3); |
---|
[450] | 817 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_h_inc = |
---|
| 818 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_h_inc", XMAX-1, YMAX, 2); |
---|
| 819 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_h_dec = |
---|
| 820 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_h_dec", XMAX-1, YMAX, 2); |
---|
| 821 | |
---|
| 822 | // Vertical inter-clusters INT network DSPIN |
---|
| 823 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_v_inc = |
---|
[468] | 824 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_v_inc", XMAX, YMAX-1, 3); |
---|
[450] | 825 | DspinSignals<dspin_int_cmd_width>*** signal_dspin_int_cmd_v_dec = |
---|
[468] | 826 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_int_cmd_v_dec", XMAX, YMAX-1, 3); |
---|
[450] | 827 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_v_inc = |
---|
| 828 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_v_inc", XMAX, YMAX-1, 2); |
---|
| 829 | DspinSignals<dspin_int_rsp_width>*** signal_dspin_int_rsp_v_dec = |
---|
| 830 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_int_rsp_v_dec", XMAX, YMAX-1, 2); |
---|
| 831 | |
---|
| 832 | // Mesh boundaries INT network DSPIN |
---|
| 833 | DspinSignals<dspin_int_cmd_width>**** signal_dspin_false_int_cmd_in = |
---|
[468] | 834 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_false_int_cmd_in", XMAX, YMAX, 4, 3); |
---|
[450] | 835 | DspinSignals<dspin_int_cmd_width>**** signal_dspin_false_int_cmd_out = |
---|
[468] | 836 | alloc_elems<DspinSignals<dspin_int_cmd_width> >("signal_dspin_false_int_cmd_out", XMAX, YMAX, 4, 3); |
---|
[450] | 837 | DspinSignals<dspin_int_rsp_width>**** signal_dspin_false_int_rsp_in = |
---|
[468] | 838 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_false_int_rsp_in", XMAX, YMAX, 4, 2); |
---|
[450] | 839 | DspinSignals<dspin_int_rsp_width>**** signal_dspin_false_int_rsp_out = |
---|
[468] | 840 | alloc_elems<DspinSignals<dspin_int_rsp_width> >("signal_dspin_false_int_rsp_out", XMAX, YMAX, 4, 2); |
---|
[450] | 841 | |
---|
| 842 | |
---|
| 843 | // Horizontal inter-clusters RAM network DSPIN |
---|
| 844 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_h_inc = |
---|
| 845 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_h_inc", XMAX-1, YMAX); |
---|
| 846 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_h_dec = |
---|
| 847 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_h_dec", XMAX-1, YMAX); |
---|
| 848 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_h_inc = |
---|
| 849 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_h_inc", XMAX-1, YMAX); |
---|
| 850 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_h_dec = |
---|
| 851 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_h_dec", XMAX-1, YMAX); |
---|
| 852 | |
---|
| 853 | // Vertical inter-clusters RAM network DSPIN |
---|
| 854 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_v_inc = |
---|
| 855 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_v_inc", XMAX, YMAX-1); |
---|
| 856 | DspinSignals<dspin_ram_cmd_width>** signal_dspin_ram_cmd_v_dec = |
---|
| 857 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_ram_cmd_v_dec", XMAX, YMAX-1); |
---|
| 858 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_v_inc = |
---|
| 859 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_v_inc", XMAX, YMAX-1); |
---|
| 860 | DspinSignals<dspin_ram_rsp_width>** signal_dspin_ram_rsp_v_dec = |
---|
| 861 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_ram_rsp_v_dec", XMAX, YMAX-1); |
---|
| 862 | |
---|
| 863 | // Mesh boundaries RAM network DSPIN |
---|
| 864 | DspinSignals<dspin_ram_cmd_width>*** signal_dspin_false_ram_cmd_in = |
---|
| 865 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_false_ram_cmd_in", XMAX, YMAX, 4); |
---|
| 866 | DspinSignals<dspin_ram_cmd_width>*** signal_dspin_false_ram_cmd_out = |
---|
| 867 | alloc_elems<DspinSignals<dspin_ram_cmd_width> >("signal_dspin_false_ram_cmd_out", XMAX, YMAX, 4); |
---|
| 868 | DspinSignals<dspin_ram_rsp_width>*** signal_dspin_false_ram_rsp_in = |
---|
| 869 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_false_ram_rsp_in", XMAX, YMAX, 4); |
---|
| 870 | DspinSignals<dspin_ram_rsp_width>*** signal_dspin_false_ram_rsp_out = |
---|
| 871 | alloc_elems<DspinSignals<dspin_ram_rsp_width> >("signal_dspin_false_ram_rsp_out", XMAX, YMAX, 4); |
---|
| 872 | |
---|
| 873 | //////////////////////////// |
---|
| 874 | // Loader |
---|
| 875 | //////////////////////////// |
---|
| 876 | |
---|
| 877 | #if USE_ALMOS |
---|
| 878 | soclib::common::Loader loader(almos_bootloader_pathname, |
---|
| 879 | almos_archinfo_pathname, |
---|
| 880 | almos_kernel_pathname); |
---|
| 881 | #else |
---|
| 882 | soclib::common::Loader loader(soft_name); |
---|
| 883 | #endif |
---|
| 884 | |
---|
| 885 | typedef soclib::common::GdbServer<soclib::common::Mips32ElIss> proc_iss; |
---|
| 886 | proc_iss::set_loader(loader); |
---|
| 887 | |
---|
| 888 | //////////////////////////////////////// |
---|
| 889 | // Instanciated Hardware Components |
---|
| 890 | //////////////////////////////////////// |
---|
| 891 | |
---|
| 892 | std::cout << std::endl << "External Bus and Peripherals" << std::endl << std::endl; |
---|
| 893 | |
---|
| 894 | // IOX network |
---|
| 895 | VciIoxNetwork<vci_param_ext>* iox_network; |
---|
| 896 | iox_network = new VciIoxNetwork<vci_param_ext>( "iox_network", |
---|
| 897 | maptab_iox, |
---|
| 898 | 8, // number of targets |
---|
| 899 | 4 ); // number of initiators |
---|
| 900 | // boot ROM |
---|
[550] | 901 | VciSimpleRom<vci_param_ext>* brom; |
---|
| 902 | brom = new VciSimpleRom<vci_param_ext>( "brom", |
---|
| 903 | IntTab(0, IOX_BROM_TGT_ID), |
---|
| 904 | maptab_iox, |
---|
| 905 | loader ); |
---|
[450] | 906 | // Network Controller |
---|
[550] | 907 | VciMultiNic<vci_param_ext>* mnic; |
---|
| 908 | mnic = new VciMultiNic<vci_param_ext>( "mnic", |
---|
| 909 | IntTab(0, IOX_MNIC_TGT_ID), |
---|
| 910 | maptab_iox, |
---|
| 911 | NB_NIC_CHANNELS, |
---|
| 912 | nic_rx_name, |
---|
| 913 | nic_tx_name, |
---|
| 914 | 0, // mac_4 address |
---|
| 915 | 0 ); // mac_2 address |
---|
[450] | 916 | |
---|
| 917 | // Frame Buffer |
---|
[550] | 918 | VciFrameBuffer<vci_param_ext>* fbuf; |
---|
| 919 | fbuf = new VciFrameBuffer<vci_param_ext>( "fbuf", |
---|
| 920 | IntTab(0, IOX_FBUF_TGT_ID), |
---|
| 921 | maptab_iox, |
---|
| 922 | FBUF_X_SIZE, FBUF_Y_SIZE ); |
---|
[450] | 923 | |
---|
| 924 | // Block Device |
---|
[550] | 925 | // for AHCI |
---|
| 926 | // std::vector<std::string> filenames; |
---|
| 927 | // filenames.push_back(disk_name); // one single disk |
---|
| 928 | VciBlockDeviceTsar<vci_param_ext>* bdev; |
---|
| 929 | bdev = new VciBlockDeviceTsar<vci_param_ext>( "bdev", |
---|
| 930 | maptab_iox, |
---|
| 931 | IntTab(0, BDEV_LOCAL_SRCID), |
---|
| 932 | IntTab(0, IOX_BDEV_TGT_ID), |
---|
| 933 | disk_name, |
---|
| 934 | block_size, |
---|
| 935 | 64, // burst size (bytes) |
---|
| 936 | 0 ); // disk latency |
---|
[450] | 937 | |
---|
| 938 | // Chained Buffer DMA controller |
---|
[550] | 939 | VciChbufDma<vci_param_ext>* cdma; |
---|
| 940 | cdma = new VciChbufDma<vci_param_ext>( "cdma", |
---|
| 941 | maptab_iox, |
---|
| 942 | IntTab(0, CDMA_LOCAL_SRCID), |
---|
| 943 | IntTab(0, IOX_CDMA_TGT_ID), |
---|
| 944 | 64, // burst size (bytes) |
---|
| 945 | 2*NB_NIC_CHANNELS ); |
---|
[450] | 946 | // Multi-TTY controller |
---|
| 947 | std::vector<std::string> vect_names; |
---|
| 948 | for( size_t tid = 0 ; tid < NB_TTY_CHANNELS ; tid++ ) |
---|
| 949 | { |
---|
| 950 | std::ostringstream term_name; |
---|
| 951 | term_name << "term" << tid; |
---|
| 952 | vect_names.push_back(term_name.str().c_str()); |
---|
| 953 | } |
---|
[550] | 954 | VciMultiTty<vci_param_ext>* mtty; |
---|
| 955 | mtty = new VciMultiTty<vci_param_ext>( "mtty", |
---|
| 956 | IntTab(0, IOX_MTTY_TGT_ID), |
---|
| 957 | maptab_iox, |
---|
| 958 | vect_names); |
---|
[450] | 959 | // Clusters |
---|
| 960 | TsarIobCluster<vci_param_int, |
---|
| 961 | vci_param_ext, |
---|
| 962 | dspin_int_cmd_width, |
---|
| 963 | dspin_int_rsp_width, |
---|
| 964 | dspin_ram_cmd_width, |
---|
| 965 | dspin_ram_rsp_width>* clusters[XMAX][YMAX]; |
---|
| 966 | |
---|
| 967 | #if USE_OPENMP |
---|
| 968 | #pragma omp parallel |
---|
| 969 | { |
---|
| 970 | #pragma omp for |
---|
| 971 | #endif |
---|
| 972 | for(size_t i = 0; i < (XMAX * YMAX); i++) |
---|
| 973 | { |
---|
| 974 | size_t x = i / YMAX; |
---|
| 975 | size_t y = i % YMAX; |
---|
| 976 | |
---|
| 977 | #if USE_OPENMP |
---|
| 978 | #pragma omp critical |
---|
| 979 | { |
---|
| 980 | #endif |
---|
| 981 | std::cout << std::endl; |
---|
| 982 | std::cout << "Cluster_" << std::dec << x << "_" << y << std::endl; |
---|
| 983 | std::cout << std::endl; |
---|
| 984 | |
---|
| 985 | std::ostringstream sc; |
---|
| 986 | sc << "cluster_" << x << "_" << y; |
---|
| 987 | clusters[x][y] = new TsarIobCluster<vci_param_int, |
---|
| 988 | vci_param_ext, |
---|
| 989 | dspin_int_cmd_width, |
---|
| 990 | dspin_int_rsp_width, |
---|
| 991 | dspin_ram_cmd_width, |
---|
| 992 | dspin_ram_rsp_width> |
---|
| 993 | ( |
---|
| 994 | sc.str().c_str(), |
---|
| 995 | NB_PROCS_MAX, |
---|
| 996 | NB_DMA_CHANNELS, |
---|
| 997 | x, |
---|
| 998 | y, |
---|
| 999 | XMAX, |
---|
| 1000 | YMAX, |
---|
| 1001 | |
---|
| 1002 | maptab_int, |
---|
| 1003 | maptab_ram, |
---|
| 1004 | maptab_iox, |
---|
| 1005 | |
---|
| 1006 | x_width, |
---|
| 1007 | y_width, |
---|
| 1008 | vci_srcid_width - x_width - y_width, // l_id width, |
---|
| 1009 | |
---|
| 1010 | INT_MEMC_TGT_ID, |
---|
| 1011 | INT_XICU_TGT_ID, |
---|
| 1012 | INT_MDMA_TGT_ID, |
---|
| 1013 | INT_IOBX_TGT_ID, |
---|
| 1014 | |
---|
| 1015 | INT_PROC_INI_ID, |
---|
| 1016 | INT_MDMA_INI_ID, |
---|
| 1017 | INT_IOBX_INI_ID, |
---|
| 1018 | |
---|
| 1019 | RAM_XRAM_TGT_ID, |
---|
| 1020 | |
---|
| 1021 | RAM_MEMC_INI_ID, |
---|
[550] | 1022 | RAM_IOBX_INI_ID, |
---|
[450] | 1023 | |
---|
| 1024 | MEMC_WAYS, |
---|
| 1025 | MEMC_SETS, |
---|
| 1026 | L1_IWAYS, |
---|
| 1027 | L1_ISETS, |
---|
| 1028 | L1_DWAYS, |
---|
| 1029 | L1_DSETS, |
---|
| 1030 | XRAM_LATENCY, |
---|
| 1031 | |
---|
| 1032 | loader, |
---|
| 1033 | |
---|
| 1034 | frozen_cycles, |
---|
| 1035 | debug_from, |
---|
| 1036 | debug_ok and (cluster(x,y) == debug_memc_id), |
---|
| 1037 | debug_ok and (cluster(x,y) == debug_proc_id), |
---|
| 1038 | debug_ok and debug_iob |
---|
| 1039 | ); |
---|
| 1040 | |
---|
| 1041 | #if USE_OPENMP |
---|
| 1042 | } // end critical |
---|
| 1043 | #endif |
---|
| 1044 | } // end for |
---|
| 1045 | #if USE_OPENMP |
---|
| 1046 | } |
---|
| 1047 | #endif |
---|
| 1048 | |
---|
| 1049 | std::cout << std::endl; |
---|
| 1050 | |
---|
| 1051 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 1052 | // Net-list |
---|
| 1053 | /////////////////////////////////////////////////////////////////////////////// |
---|
| 1054 | |
---|
| 1055 | // IOX network connexion |
---|
| 1056 | iox_network->p_clk (signal_clk); |
---|
| 1057 | iox_network->p_resetn (signal_resetn); |
---|
| 1058 | iox_network->p_to_ini[IOX_IOB0_INI_ID] (signal_vci_ini_iob0); |
---|
| 1059 | iox_network->p_to_ini[IOX_IOB1_INI_ID] (signal_vci_ini_iob1); |
---|
| 1060 | iox_network->p_to_ini[IOX_BDEV_INI_ID] (signal_vci_ini_bdev); |
---|
| 1061 | iox_network->p_to_ini[IOX_CDMA_INI_ID] (signal_vci_ini_cdma); |
---|
| 1062 | iox_network->p_to_tgt[IOX_IOB0_TGT_ID] (signal_vci_tgt_iob0); |
---|
| 1063 | iox_network->p_to_tgt[IOX_IOB1_TGT_ID] (signal_vci_tgt_iob1); |
---|
| 1064 | iox_network->p_to_tgt[IOX_MTTY_TGT_ID] (signal_vci_tgt_mtty); |
---|
| 1065 | iox_network->p_to_tgt[IOX_FBUF_TGT_ID] (signal_vci_tgt_fbuf); |
---|
| 1066 | iox_network->p_to_tgt[IOX_MNIC_TGT_ID] (signal_vci_tgt_mnic); |
---|
| 1067 | iox_network->p_to_tgt[IOX_BROM_TGT_ID] (signal_vci_tgt_brom); |
---|
| 1068 | iox_network->p_to_tgt[IOX_BDEV_TGT_ID] (signal_vci_tgt_bdev); |
---|
| 1069 | iox_network->p_to_tgt[IOX_CDMA_TGT_ID] (signal_vci_tgt_cdma); |
---|
| 1070 | |
---|
| 1071 | // BDEV connexion |
---|
[550] | 1072 | bdev->p_clk (signal_clk); |
---|
| 1073 | bdev->p_resetn (signal_resetn); |
---|
| 1074 | bdev->p_irq (signal_irq_bdev); |
---|
| 1075 | // For AHCI |
---|
| 1076 | // bdev->p_channel_irq[0] (signal_irq_bdev); |
---|
| 1077 | bdev->p_vci_target (signal_vci_tgt_bdev); |
---|
| 1078 | bdev->p_vci_initiator (signal_vci_ini_bdev); |
---|
[450] | 1079 | |
---|
| 1080 | std::cout << " - BDEV connected" << std::endl; |
---|
| 1081 | |
---|
| 1082 | // FBUF connexion |
---|
[550] | 1083 | fbuf->p_clk (signal_clk); |
---|
| 1084 | fbuf->p_resetn (signal_resetn); |
---|
| 1085 | fbuf->p_vci (signal_vci_tgt_fbuf); |
---|
[450] | 1086 | |
---|
| 1087 | std::cout << " - FBUF connected" << std::endl; |
---|
| 1088 | |
---|
| 1089 | // MNIC connexion |
---|
[550] | 1090 | mnic->p_clk (signal_clk); |
---|
| 1091 | mnic->p_resetn (signal_resetn); |
---|
| 1092 | mnic->p_vci (signal_vci_tgt_mnic); |
---|
[450] | 1093 | for ( size_t i=0 ; i<NB_NIC_CHANNELS ; i++ ) |
---|
| 1094 | { |
---|
[550] | 1095 | mnic->p_rx_irq[i] (signal_irq_mnic_rx[i]); |
---|
| 1096 | mnic->p_tx_irq[i] (signal_irq_mnic_tx[i]); |
---|
[450] | 1097 | } |
---|
| 1098 | |
---|
| 1099 | std::cout << " - MNIC connected" << std::endl; |
---|
| 1100 | |
---|
| 1101 | // BROM connexion |
---|
[550] | 1102 | brom->p_clk (signal_clk); |
---|
| 1103 | brom->p_resetn (signal_resetn); |
---|
| 1104 | brom->p_vci (signal_vci_tgt_brom); |
---|
[450] | 1105 | |
---|
| 1106 | std::cout << " - BROM connected" << std::endl; |
---|
| 1107 | |
---|
| 1108 | // MTTY connexion |
---|
[550] | 1109 | mtty->p_clk (signal_clk); |
---|
| 1110 | mtty->p_resetn (signal_resetn); |
---|
| 1111 | mtty->p_vci (signal_vci_tgt_mtty); |
---|
[450] | 1112 | for ( size_t i=0 ; i<NB_TTY_CHANNELS ; i++ ) |
---|
| 1113 | { |
---|
[550] | 1114 | mtty->p_irq[i] (signal_irq_mtty[i]); |
---|
[450] | 1115 | } |
---|
| 1116 | |
---|
| 1117 | std::cout << " - MTTY connected" << std::endl; |
---|
| 1118 | |
---|
| 1119 | // CDMA connexion |
---|
[550] | 1120 | cdma->p_clk (signal_clk); |
---|
| 1121 | cdma->p_resetn (signal_resetn); |
---|
| 1122 | cdma->p_vci_target (signal_vci_tgt_cdma); |
---|
| 1123 | cdma->p_vci_initiator (signal_vci_ini_cdma); |
---|
[450] | 1124 | for ( size_t i=0 ; i<(NB_NIC_CHANNELS*2) ; i++) |
---|
| 1125 | { |
---|
[550] | 1126 | cdma->p_irq[i] (signal_irq_cdma[i]); |
---|
[450] | 1127 | } |
---|
| 1128 | |
---|
| 1129 | std::cout << " - CDMA connected" << std::endl; |
---|
| 1130 | |
---|
| 1131 | // IRQ connexions (for cluster_iob0 only) |
---|
[498] | 1132 | // IRQ_MNIC_RX -> IRQ[08] to IRQ[09] |
---|
| 1133 | // IRQ_MNIC_TX -> IRQ[10] to IRQ[11] |
---|
| 1134 | // IRQ_CDMA -> IRQ[12] to IRQ[15] |
---|
| 1135 | // IRQ_MTTY -> IRQ[16] to IRQ[30] |
---|
| 1136 | // IRQ_BDEV -> IRQ[31] |
---|
| 1137 | |
---|
[472] | 1138 | size_t mx = 16 + NB_TTY_CHANNELS; |
---|
[450] | 1139 | for ( size_t n=0 ; n<32 ; n++ ) |
---|
| 1140 | { |
---|
[533] | 1141 | if ( n < 8 ) (*clusters[0][0]->p_irq[n]) (signal_unused_irq[n]); |
---|
| 1142 | else if ( n < 10 ) (*clusters[0][0]->p_irq[n]) (signal_irq_mnic_rx[n-8]); |
---|
| 1143 | else if ( n < 12 ) (*clusters[0][0]->p_irq[n]) (signal_irq_mnic_tx[n-10]); |
---|
| 1144 | else if ( n < 16 ) (*clusters[0][0]->p_irq[n]) (signal_irq_cdma[n-12]); |
---|
| 1145 | else if ( n < mx ) (*clusters[0][0]->p_irq[n]) (signal_irq_mtty[n-16]); |
---|
| 1146 | else if ( n < 31 ) (*clusters[0][0]->p_irq[n]) (signal_unused_irq[n]); |
---|
| 1147 | else (*clusters[0][0]->p_irq[n]) (signal_irq_bdev); |
---|
[450] | 1148 | } |
---|
| 1149 | |
---|
| 1150 | // IOB0 cluster connexion to IOX network |
---|
[550] | 1151 | (*clusters[0][0]->p_vci_iob_iox_ini) (signal_vci_ini_iob0); |
---|
| 1152 | (*clusters[0][0]->p_vci_iob_iox_tgt) (signal_vci_tgt_iob0); |
---|
[450] | 1153 | |
---|
| 1154 | // IOB1 cluster connexion to IOX network |
---|
[550] | 1155 | (*clusters[XMAX-1][YMAX-1]->p_vci_iob_iox_ini) (signal_vci_ini_iob1); |
---|
| 1156 | (*clusters[XMAX-1][YMAX-1]->p_vci_iob_iox_tgt) (signal_vci_tgt_iob1); |
---|
[450] | 1157 | |
---|
| 1158 | // All clusters Clock & RESET connexions |
---|
| 1159 | for ( size_t x = 0; x < (XMAX); x++ ) |
---|
| 1160 | { |
---|
| 1161 | for (size_t y = 0; y < YMAX; y++) |
---|
| 1162 | { |
---|
| 1163 | clusters[x][y]->p_clk (signal_clk); |
---|
| 1164 | clusters[x][y]->p_resetn (signal_resetn); |
---|
| 1165 | } |
---|
| 1166 | } |
---|
| 1167 | |
---|
| 1168 | // Inter Clusters horizontal connections |
---|
| 1169 | if (XMAX > 1) |
---|
| 1170 | { |
---|
| 1171 | for (size_t x = 0; x < (XMAX-1); x++) |
---|
| 1172 | { |
---|
| 1173 | for (size_t y = 0; y < YMAX; y++) |
---|
| 1174 | { |
---|
[468] | 1175 | for (size_t k = 0; k < 3; k++) |
---|
| 1176 | { |
---|
| 1177 | clusters[x][y]->p_dspin_int_cmd_out[EAST][k] (signal_dspin_int_cmd_h_inc[x][y][k]); |
---|
| 1178 | clusters[x+1][y]->p_dspin_int_cmd_in[WEST][k] (signal_dspin_int_cmd_h_inc[x][y][k]); |
---|
| 1179 | clusters[x][y]->p_dspin_int_cmd_in[EAST][k] (signal_dspin_int_cmd_h_dec[x][y][k]); |
---|
| 1180 | clusters[x+1][y]->p_dspin_int_cmd_out[WEST][k] (signal_dspin_int_cmd_h_dec[x][y][k]); |
---|
| 1181 | } |
---|
| 1182 | |
---|
[450] | 1183 | for (size_t k = 0; k < 2; k++) |
---|
| 1184 | { |
---|
[468] | 1185 | clusters[x][y]->p_dspin_int_rsp_out[EAST][k] (signal_dspin_int_rsp_h_inc[x][y][k]); |
---|
| 1186 | clusters[x+1][y]->p_dspin_int_rsp_in[WEST][k] (signal_dspin_int_rsp_h_inc[x][y][k]); |
---|
| 1187 | clusters[x][y]->p_dspin_int_rsp_in[EAST][k] (signal_dspin_int_rsp_h_dec[x][y][k]); |
---|
| 1188 | clusters[x+1][y]->p_dspin_int_rsp_out[WEST][k] (signal_dspin_int_rsp_h_dec[x][y][k]); |
---|
[450] | 1189 | } |
---|
| 1190 | |
---|
| 1191 | clusters[x][y]->p_dspin_ram_cmd_out[EAST] (signal_dspin_ram_cmd_h_inc[x][y]); |
---|
| 1192 | clusters[x+1][y]->p_dspin_ram_cmd_in[WEST] (signal_dspin_ram_cmd_h_inc[x][y]); |
---|
| 1193 | clusters[x][y]->p_dspin_ram_cmd_in[EAST] (signal_dspin_ram_cmd_h_dec[x][y]); |
---|
| 1194 | clusters[x+1][y]->p_dspin_ram_cmd_out[WEST] (signal_dspin_ram_cmd_h_dec[x][y]); |
---|
| 1195 | clusters[x][y]->p_dspin_ram_rsp_out[EAST] (signal_dspin_ram_rsp_h_inc[x][y]); |
---|
| 1196 | clusters[x+1][y]->p_dspin_ram_rsp_in[WEST] (signal_dspin_ram_rsp_h_inc[x][y]); |
---|
| 1197 | clusters[x][y]->p_dspin_ram_rsp_in[EAST] (signal_dspin_ram_rsp_h_dec[x][y]); |
---|
| 1198 | clusters[x+1][y]->p_dspin_ram_rsp_out[WEST] (signal_dspin_ram_rsp_h_dec[x][y]); |
---|
| 1199 | } |
---|
| 1200 | } |
---|
| 1201 | } |
---|
| 1202 | |
---|
| 1203 | std::cout << std::endl << "Horizontal connections established" << std::endl; |
---|
| 1204 | |
---|
| 1205 | // Inter Clusters vertical connections |
---|
| 1206 | if (YMAX > 1) |
---|
| 1207 | { |
---|
| 1208 | for (size_t y = 0; y < (YMAX-1); y++) |
---|
| 1209 | { |
---|
| 1210 | for (size_t x = 0; x < XMAX; x++) |
---|
| 1211 | { |
---|
[468] | 1212 | for (size_t k = 0; k < 3; k++) |
---|
| 1213 | { |
---|
| 1214 | clusters[x][y]->p_dspin_int_cmd_out[NORTH][k] (signal_dspin_int_cmd_v_inc[x][y][k]); |
---|
| 1215 | clusters[x][y+1]->p_dspin_int_cmd_in[SOUTH][k] (signal_dspin_int_cmd_v_inc[x][y][k]); |
---|
| 1216 | clusters[x][y]->p_dspin_int_cmd_in[NORTH][k] (signal_dspin_int_cmd_v_dec[x][y][k]); |
---|
| 1217 | clusters[x][y+1]->p_dspin_int_cmd_out[SOUTH][k] (signal_dspin_int_cmd_v_dec[x][y][k]); |
---|
| 1218 | } |
---|
| 1219 | |
---|
[450] | 1220 | for (size_t k = 0; k < 2; k++) |
---|
| 1221 | { |
---|
[468] | 1222 | clusters[x][y]->p_dspin_int_rsp_out[NORTH][k] (signal_dspin_int_rsp_v_inc[x][y][k]); |
---|
| 1223 | clusters[x][y+1]->p_dspin_int_rsp_in[SOUTH][k] (signal_dspin_int_rsp_v_inc[x][y][k]); |
---|
| 1224 | clusters[x][y]->p_dspin_int_rsp_in[NORTH][k] (signal_dspin_int_rsp_v_dec[x][y][k]); |
---|
| 1225 | clusters[x][y+1]->p_dspin_int_rsp_out[SOUTH][k] (signal_dspin_int_rsp_v_dec[x][y][k]); |
---|
[450] | 1226 | } |
---|
| 1227 | |
---|
| 1228 | clusters[x][y]->p_dspin_ram_cmd_out[NORTH] (signal_dspin_ram_cmd_v_inc[x][y]); |
---|
| 1229 | clusters[x][y+1]->p_dspin_ram_cmd_in[SOUTH] (signal_dspin_ram_cmd_v_inc[x][y]); |
---|
| 1230 | clusters[x][y]->p_dspin_ram_cmd_in[NORTH] (signal_dspin_ram_cmd_v_dec[x][y]); |
---|
| 1231 | clusters[x][y+1]->p_dspin_ram_cmd_out[SOUTH] (signal_dspin_ram_cmd_v_dec[x][y]); |
---|
| 1232 | clusters[x][y]->p_dspin_ram_rsp_out[NORTH] (signal_dspin_ram_rsp_v_inc[x][y]); |
---|
| 1233 | clusters[x][y+1]->p_dspin_ram_rsp_in[SOUTH] (signal_dspin_ram_rsp_v_inc[x][y]); |
---|
| 1234 | clusters[x][y]->p_dspin_ram_rsp_in[NORTH] (signal_dspin_ram_rsp_v_dec[x][y]); |
---|
| 1235 | clusters[x][y+1]->p_dspin_ram_rsp_out[SOUTH] (signal_dspin_ram_rsp_v_dec[x][y]); |
---|
| 1236 | } |
---|
| 1237 | } |
---|
| 1238 | } |
---|
| 1239 | |
---|
| 1240 | std::cout << "Vertical connections established" << std::endl; |
---|
| 1241 | |
---|
| 1242 | // East & West boundary cluster connections |
---|
| 1243 | for (size_t y = 0; y < YMAX; y++) |
---|
| 1244 | { |
---|
[468] | 1245 | for (size_t k = 0; k < 3; k++) |
---|
| 1246 | { |
---|
| 1247 | clusters[0][y]->p_dspin_int_cmd_in[WEST][k] (signal_dspin_false_int_cmd_in[0][y][WEST][k]); |
---|
| 1248 | clusters[0][y]->p_dspin_int_cmd_out[WEST][k] (signal_dspin_false_int_cmd_out[0][y][WEST][k]); |
---|
| 1249 | clusters[XMAX-1][y]->p_dspin_int_cmd_in[EAST][k] (signal_dspin_false_int_cmd_in[XMAX-1][y][EAST][k]); |
---|
| 1250 | clusters[XMAX-1][y]->p_dspin_int_cmd_out[EAST][k] (signal_dspin_false_int_cmd_out[XMAX-1][y][EAST][k]); |
---|
| 1251 | } |
---|
| 1252 | |
---|
[450] | 1253 | for (size_t k = 0; k < 2; k++) |
---|
| 1254 | { |
---|
[468] | 1255 | clusters[0][y]->p_dspin_int_rsp_in[WEST][k] (signal_dspin_false_int_rsp_in[0][y][WEST][k]); |
---|
| 1256 | clusters[0][y]->p_dspin_int_rsp_out[WEST][k] (signal_dspin_false_int_rsp_out[0][y][WEST][k]); |
---|
| 1257 | clusters[XMAX-1][y]->p_dspin_int_rsp_in[EAST][k] (signal_dspin_false_int_rsp_in[XMAX-1][y][EAST][k]); |
---|
| 1258 | clusters[XMAX-1][y]->p_dspin_int_rsp_out[EAST][k] (signal_dspin_false_int_rsp_out[XMAX-1][y][EAST][k]); |
---|
[450] | 1259 | } |
---|
| 1260 | |
---|
[550] | 1261 | if( y == 0 ) // handling IOB to RAM network connection in cluster_iob0 |
---|
| 1262 | { |
---|
| 1263 | (*clusters[0][0]->p_dspin_iob_cmd_out) (signal_dspin_cmd_iob0_loopback); |
---|
| 1264 | clusters[0][0]->p_dspin_ram_cmd_in[WEST] (signal_dspin_cmd_iob0_loopback); |
---|
[450] | 1265 | |
---|
[550] | 1266 | clusters[0][0]->p_dspin_ram_cmd_out[WEST] (signal_dspin_false_ram_cmd_out[0][0][WEST]); |
---|
| 1267 | clusters[0][0]->p_dspin_ram_rsp_in[WEST] (signal_dspin_false_ram_rsp_in[0][0][WEST]); |
---|
| 1268 | |
---|
| 1269 | clusters[0][0]->p_dspin_ram_rsp_out[WEST] (signal_dspin_rsp_iob0_loopback); |
---|
| 1270 | (*clusters[0][0]->p_dspin_iob_rsp_in) (signal_dspin_rsp_iob0_loopback); |
---|
| 1271 | |
---|
| 1272 | } |
---|
| 1273 | else |
---|
| 1274 | { |
---|
| 1275 | clusters[0][y]->p_dspin_ram_cmd_in[WEST] (signal_dspin_false_ram_cmd_in[0][y][WEST]); |
---|
| 1276 | clusters[0][y]->p_dspin_ram_cmd_out[WEST] (signal_dspin_false_ram_cmd_out[0][y][WEST]); |
---|
| 1277 | clusters[0][y]->p_dspin_ram_rsp_in[WEST] (signal_dspin_false_ram_rsp_in[0][y][WEST]); |
---|
| 1278 | clusters[0][y]->p_dspin_ram_rsp_out[WEST] (signal_dspin_false_ram_rsp_out[0][y][WEST]); |
---|
| 1279 | } |
---|
| 1280 | |
---|
| 1281 | if( y == YMAX-1 ) // handling IOB to RAM network connection in cluster_iob1 |
---|
| 1282 | { |
---|
| 1283 | (*clusters[XMAX-1][YMAX-1]->p_dspin_iob_cmd_out) (signal_dspin_cmd_iob1_loopback); |
---|
| 1284 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_cmd_in[EAST] (signal_dspin_cmd_iob1_loopback); |
---|
| 1285 | |
---|
| 1286 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_cmd_out[EAST] (signal_dspin_false_ram_cmd_out[XMAX-1][YMAX-1][EAST]); |
---|
| 1287 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_rsp_in[EAST] (signal_dspin_false_ram_rsp_in[XMAX-1][YMAX-1][EAST]); |
---|
| 1288 | |
---|
| 1289 | clusters[XMAX-1][YMAX-1]->p_dspin_ram_rsp_out[EAST] (signal_dspin_rsp_iob1_loopback); |
---|
| 1290 | (*clusters[XMAX-1][YMAX-1]->p_dspin_iob_rsp_in) (signal_dspin_rsp_iob1_loopback); |
---|
| 1291 | } |
---|
| 1292 | else |
---|
| 1293 | { |
---|
| 1294 | clusters[XMAX-1][y]->p_dspin_ram_cmd_in[EAST] (signal_dspin_false_ram_cmd_in[XMAX-1][y][EAST]); |
---|
| 1295 | clusters[XMAX-1][y]->p_dspin_ram_cmd_out[EAST] (signal_dspin_false_ram_cmd_out[XMAX-1][y][EAST]); |
---|
| 1296 | clusters[XMAX-1][y]->p_dspin_ram_rsp_in[EAST] (signal_dspin_false_ram_rsp_in[XMAX-1][y][EAST]); |
---|
| 1297 | clusters[XMAX-1][y]->p_dspin_ram_rsp_out[EAST] (signal_dspin_false_ram_rsp_out[XMAX-1][y][EAST]); |
---|
| 1298 | } |
---|
[450] | 1299 | } |
---|
| 1300 | |
---|
| 1301 | std::cout << "East & West boundaries established" << std::endl; |
---|
| 1302 | |
---|
| 1303 | // North & South boundary clusters connections |
---|
| 1304 | for (size_t x = 0; x < XMAX; x++) |
---|
| 1305 | { |
---|
[468] | 1306 | for (size_t k = 0; k < 3; k++) |
---|
| 1307 | { |
---|
| 1308 | clusters[x][0]->p_dspin_int_cmd_in[SOUTH][k] (signal_dspin_false_int_cmd_in[x][0][SOUTH][k]); |
---|
| 1309 | clusters[x][0]->p_dspin_int_cmd_out[SOUTH][k] (signal_dspin_false_int_cmd_out[x][0][SOUTH][k]); |
---|
| 1310 | clusters[x][YMAX-1]->p_dspin_int_cmd_in[NORTH][k] (signal_dspin_false_int_cmd_in[x][YMAX-1][NORTH][k]); |
---|
| 1311 | clusters[x][YMAX-1]->p_dspin_int_cmd_out[NORTH][k] (signal_dspin_false_int_cmd_out[x][YMAX-1][NORTH][k]); |
---|
| 1312 | } |
---|
| 1313 | |
---|
[450] | 1314 | for (size_t k = 0; k < 2; k++) |
---|
| 1315 | { |
---|
[468] | 1316 | clusters[x][0]->p_dspin_int_rsp_in[SOUTH][k] (signal_dspin_false_int_rsp_in[x][0][SOUTH][k]); |
---|
| 1317 | clusters[x][0]->p_dspin_int_rsp_out[SOUTH][k] (signal_dspin_false_int_rsp_out[x][0][SOUTH][k]); |
---|
| 1318 | clusters[x][YMAX-1]->p_dspin_int_rsp_in[NORTH][k] (signal_dspin_false_int_rsp_in[x][YMAX-1][NORTH][k]); |
---|
| 1319 | clusters[x][YMAX-1]->p_dspin_int_rsp_out[NORTH][k] (signal_dspin_false_int_rsp_out[x][YMAX-1][NORTH][k]); |
---|
[450] | 1320 | } |
---|
| 1321 | |
---|
| 1322 | clusters[x][0]->p_dspin_ram_cmd_in[SOUTH] (signal_dspin_false_ram_cmd_in[x][0][SOUTH]); |
---|
| 1323 | clusters[x][0]->p_dspin_ram_cmd_out[SOUTH] (signal_dspin_false_ram_cmd_out[x][0][SOUTH]); |
---|
| 1324 | clusters[x][0]->p_dspin_ram_rsp_in[SOUTH] (signal_dspin_false_ram_rsp_in[x][0][SOUTH]); |
---|
| 1325 | clusters[x][0]->p_dspin_ram_rsp_out[SOUTH] (signal_dspin_false_ram_rsp_out[x][0][SOUTH]); |
---|
| 1326 | |
---|
| 1327 | clusters[x][YMAX-1]->p_dspin_ram_cmd_in[NORTH] (signal_dspin_false_ram_cmd_in[x][YMAX-1][NORTH]); |
---|
| 1328 | clusters[x][YMAX-1]->p_dspin_ram_cmd_out[NORTH] (signal_dspin_false_ram_cmd_out[x][YMAX-1][NORTH]); |
---|
| 1329 | clusters[x][YMAX-1]->p_dspin_ram_rsp_in[NORTH] (signal_dspin_false_ram_rsp_in[x][YMAX-1][NORTH]); |
---|
| 1330 | clusters[x][YMAX-1]->p_dspin_ram_rsp_out[NORTH] (signal_dspin_false_ram_rsp_out[x][YMAX-1][NORTH]); |
---|
| 1331 | } |
---|
| 1332 | |
---|
[550] | 1333 | std::cout << "North & South boundaries established" << std::endl << std::endl; |
---|
[450] | 1334 | |
---|
| 1335 | //////////////////////////////////////////////////////// |
---|
| 1336 | // Simulation |
---|
| 1337 | /////////////////////////////////////////////////////// |
---|
| 1338 | |
---|
| 1339 | sc_start(sc_core::sc_time(0, SC_NS)); |
---|
| 1340 | signal_resetn = false; |
---|
| 1341 | |
---|
| 1342 | // network boundaries signals |
---|
| 1343 | for (size_t x = 0; x < XMAX ; x++) |
---|
| 1344 | { |
---|
| 1345 | for (size_t y = 0; y < YMAX ; y++) |
---|
| 1346 | { |
---|
| 1347 | for (size_t a = 0; a < 4; a++) |
---|
| 1348 | { |
---|
[468] | 1349 | for (size_t k = 0; k < 3; k++) |
---|
| 1350 | { |
---|
| 1351 | signal_dspin_false_int_cmd_in[x][y][a][k].write = false; |
---|
| 1352 | signal_dspin_false_int_cmd_in[x][y][a][k].read = true; |
---|
| 1353 | signal_dspin_false_int_cmd_out[x][y][a][k].write = false; |
---|
| 1354 | signal_dspin_false_int_cmd_out[x][y][a][k].read = true; |
---|
| 1355 | } |
---|
| 1356 | |
---|
[450] | 1357 | for (size_t k = 0; k < 2; k++) |
---|
| 1358 | { |
---|
[468] | 1359 | signal_dspin_false_int_rsp_in[x][y][a][k].write = false; |
---|
| 1360 | signal_dspin_false_int_rsp_in[x][y][a][k].read = true; |
---|
| 1361 | signal_dspin_false_int_rsp_out[x][y][a][k].write = false; |
---|
| 1362 | signal_dspin_false_int_rsp_out[x][y][a][k].read = true; |
---|
[450] | 1363 | } |
---|
| 1364 | |
---|
| 1365 | signal_dspin_false_ram_cmd_in[x][y][a].write = false; |
---|
| 1366 | signal_dspin_false_ram_cmd_in[x][y][a].read = true; |
---|
| 1367 | signal_dspin_false_ram_cmd_out[x][y][a].write = false; |
---|
| 1368 | signal_dspin_false_ram_cmd_out[x][y][a].read = true; |
---|
| 1369 | |
---|
| 1370 | signal_dspin_false_ram_rsp_in[x][y][a].write = false; |
---|
| 1371 | signal_dspin_false_ram_rsp_in[x][y][a].read = true; |
---|
| 1372 | signal_dspin_false_ram_rsp_out[x][y][a].write = false; |
---|
| 1373 | signal_dspin_false_ram_rsp_out[x][y][a].read = true; |
---|
| 1374 | } |
---|
| 1375 | } |
---|
| 1376 | } |
---|
| 1377 | |
---|
[550] | 1378 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
| 1379 | signal_resetn = true; |
---|
[450] | 1380 | |
---|
[550] | 1381 | for (size_t n = 1; n < ncycles; n++) |
---|
| 1382 | { |
---|
| 1383 | // Monitor a specific address for L1 & L2 caches |
---|
| 1384 | // clusters[1][1]->proc[0]->cache_monitor(0x8ba4ULL); |
---|
| 1385 | // clusters[0][0]->memc->cache_monitor( 0x12180ULL); |
---|
[450] | 1386 | |
---|
[550] | 1387 | if (debug_ok and (n > debug_from) and (n % debug_period == 0)) |
---|
[450] | 1388 | { |
---|
[550] | 1389 | std::cout << "****************** cycle " << std::dec << n ; |
---|
| 1390 | std::cout << " ************************************************" << std::endl; |
---|
[450] | 1391 | |
---|
[550] | 1392 | // trace proc[debug_proc_id] |
---|
| 1393 | if ( debug_proc_id < XMAX*YMAX*NB_PROCS_MAX ) |
---|
| 1394 | { |
---|
[450] | 1395 | |
---|
[550] | 1396 | size_t l = debug_proc_id % NB_PROCS_MAX ; |
---|
| 1397 | size_t y = (debug_proc_id / NB_PROCS_MAX) % YMAX ; |
---|
| 1398 | size_t x = debug_proc_id / (YMAX * NB_PROCS_MAX) ; |
---|
[450] | 1399 | |
---|
[550] | 1400 | clusters[x][y]->proc[l]->print_trace(0); |
---|
[450] | 1401 | |
---|
[550] | 1402 | std::ostringstream proc_signame; |
---|
| 1403 | proc_signame << "[SIG]PROC_" << x << "_" << y << "_" << l ; |
---|
| 1404 | clusters[x][y]->signal_int_vci_ini_proc[l].print_trace(proc_signame.str()); |
---|
[450] | 1405 | |
---|
[550] | 1406 | // std::ostringstream p2m_signame; |
---|
| 1407 | // p2m_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " P2M" ; |
---|
| 1408 | // clusters[x][y]->signal_int_dspin_p2m_proc[l].print_trace(p2m_signame.str()); |
---|
[450] | 1409 | |
---|
[550] | 1410 | // std::ostringstream m2p_signame; |
---|
| 1411 | // m2p_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " M2P" ; |
---|
| 1412 | // clusters[x][y]->signal_int_dspin_m2p_proc[l].print_trace(m2p_signame.str()); |
---|
[450] | 1413 | |
---|
[550] | 1414 | // std::ostringstream p_cmd_signame; |
---|
| 1415 | // p_cmd_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " CMD" ; |
---|
| 1416 | // clusters[x][y]->signal_int_dspin_cmd_proc_i[l].print_trace(p_cmd_signame.str()); |
---|
[450] | 1417 | |
---|
[550] | 1418 | // std::ostringstream p_rsp_signame; |
---|
| 1419 | // p_rsp_signame << "[SIG]PROC_" << x << "_" << y << "_" << l << " RSP" ; |
---|
| 1420 | // clusters[x][y]->signal_int_dspin_rsp_proc_i[l].print_trace(p_rsp_signame.str()); |
---|
| 1421 | } |
---|
[450] | 1422 | |
---|
[550] | 1423 | // trace INT_CMD_D xbar and router in 1_0 |
---|
| 1424 | // clusters[1][0]->int_xbar_cmd_d->print_trace(); |
---|
| 1425 | // clusters[1][0]->int_xbar_rsp_d->print_trace(); |
---|
[498] | 1426 | |
---|
[550] | 1427 | // clusters[1][0]->signal_int_dspin_cmd_l2g_d.print_trace("[SIG] INT_CMD_L2G_D_1_0"); |
---|
| 1428 | // clusters[1][0]->signal_int_dspin_rsp_g2l_d.print_trace("[SIG] INT_RSP_G2L_D_1_0"); |
---|
[450] | 1429 | |
---|
[550] | 1430 | // clusters[1][0]->int_router_cmd->print_trace(0); |
---|
| 1431 | // clusters[1][0]->int_router_rsp->print_trace(0); |
---|
[450] | 1432 | |
---|
[550] | 1433 | // trace INT_CMD_D xbar and router in 0_0 |
---|
| 1434 | // clusters[0][0]->int_xbar_cmd_d->print_trace(); |
---|
| 1435 | // clusters[0][0]->int_xbar_rsp_d->print_trace(); |
---|
[450] | 1436 | |
---|
[550] | 1437 | // clusters[0][0]->signal_int_dspin_cmd_g2l_d.print_trace("[SIG] INT_CMD_G2L_D_0_0"); |
---|
| 1438 | // clusters[0][0]->signal_int_dspin_rsp_l2g_d.print_trace("[SIG] INT_RSP_L2G_D_0_0"); |
---|
| 1439 | |
---|
| 1440 | // clusters[0][0]->int_router_cmd->print_trace(0); |
---|
| 1441 | // clusters[0][0]->int_router_rsp->print_trace(0); |
---|
[450] | 1442 | |
---|
[550] | 1443 | // trace memc[debug_memc_id] and xram[debug_memc_id] |
---|
| 1444 | if ( debug_memc_id < XMAX*YMAX ) |
---|
| 1445 | { |
---|
| 1446 | size_t x = debug_memc_id / YMAX; |
---|
| 1447 | size_t y = debug_memc_id % YMAX; |
---|
| 1448 | clusters[x][y]->memc->print_trace(0); |
---|
| 1449 | std::ostringstream smemc_tgt; |
---|
| 1450 | smemc_tgt << "[SIG]MEMC_TGT_" << x << "_" << y; |
---|
| 1451 | clusters[x][y]->signal_int_vci_tgt_memc.print_trace(smemc_tgt.str()); |
---|
| 1452 | std::ostringstream smemc_ini; |
---|
| 1453 | smemc_ini << "[SIG]MEMC_INI_" << x << "_" << y; |
---|
| 1454 | clusters[x][y]->signal_ram_vci_ini_memc.print_trace(smemc_ini.str()); |
---|
| 1455 | clusters[x][y]->xram->print_trace(); |
---|
| 1456 | std::ostringstream sxram_tgt; |
---|
| 1457 | sxram_tgt << "[SIG]XRAM_TGT_" << x << "_" << y; |
---|
| 1458 | clusters[x][y]->signal_ram_vci_tgt_xram.print_trace(sxram_tgt.str()); |
---|
| 1459 | } |
---|
[450] | 1460 | |
---|
[550] | 1461 | // trace RAM network |
---|
| 1462 | for( size_t cluster = 0 ; cluster < XMAX*YMAX ; cluster++ ) |
---|
| 1463 | { |
---|
| 1464 | size_t x = cluster / YMAX; |
---|
| 1465 | size_t y = cluster % YMAX; |
---|
| 1466 | clusters[x][y]->ram_router_cmd->print_trace(); |
---|
| 1467 | clusters[x][y]->ram_router_rsp->print_trace(); |
---|
| 1468 | } |
---|
[450] | 1469 | |
---|
[550] | 1470 | // trace iob, iox and external peripherals |
---|
| 1471 | if ( debug_iob ) |
---|
| 1472 | { |
---|
| 1473 | clusters[0][0]->iob->print_trace(); |
---|
| 1474 | clusters[0][0]->signal_int_vci_tgt_iobx.print_trace( "[SIG]IOB0_INT_TGT"); |
---|
| 1475 | clusters[0][0]->signal_int_vci_ini_iobx.print_trace( "[SIG]IOB0_INT_INI"); |
---|
| 1476 | clusters[0][0]->signal_ram_vci_ini_iobx.print_trace( "[SIG]IOB0_RAM_INI"); |
---|
[450] | 1477 | |
---|
[550] | 1478 | signal_vci_ini_iob0.print_trace("[SIG]IOB0_IOX_INI"); |
---|
| 1479 | signal_vci_tgt_iob0.print_trace("[SIG]IOB0_IOX_TGT"); |
---|
[450] | 1480 | |
---|
[550] | 1481 | signal_dspin_cmd_iob0_loopback.print_trace("[SIG]IOB0_CMD_LOOPBACK"); |
---|
| 1482 | signal_dspin_rsp_iob0_loopback.print_trace("[SIG]IOB0_RSP_LOOPBACK"); |
---|
[450] | 1483 | |
---|
[550] | 1484 | // cdma->print_trace(); |
---|
| 1485 | // signal_vci_tgt_cdma.print_trace("[SIG]IOX_CDMA_TGT"); |
---|
| 1486 | // signal_vci_ini_cdma.print_trace("[SIG]IOX_CDMA_INI"); |
---|
[450] | 1487 | |
---|
[550] | 1488 | // brom->print_trace(); |
---|
| 1489 | // signal_vci_tgt_brom.print_trace("[SIG]IOX_BROM_TGT"); |
---|
[450] | 1490 | |
---|
[550] | 1491 | // mtty->print_trace(); |
---|
| 1492 | // signal_vci_tgt_mtty.print_trace("[SIG]IOX_MTTY_TGT"); |
---|
[450] | 1493 | |
---|
[550] | 1494 | bdev->print_trace(); |
---|
| 1495 | signal_vci_tgt_bdev.print_trace("[SIG]IOX_BDEV_TGT"); |
---|
| 1496 | signal_vci_ini_bdev.print_trace("[SIG]IOX_BDEV_INI"); |
---|
[450] | 1497 | |
---|
[550] | 1498 | // fbuf->print_trace(); |
---|
| 1499 | // signal_vci_tgt_fbuf.print_trace("[SIG]FBUF"); |
---|
[498] | 1500 | |
---|
[550] | 1501 | iox_network->print_trace(); |
---|
[450] | 1502 | |
---|
[550] | 1503 | // interrupts |
---|
| 1504 | if (signal_irq_bdev) std::cout << "### IRQ_BDEV ACTIVATED" << std::endl; |
---|
| 1505 | } |
---|
| 1506 | } |
---|
[450] | 1507 | |
---|
[550] | 1508 | sc_start(sc_core::sc_time(1, SC_NS)); |
---|
| 1509 | } |
---|
| 1510 | return EXIT_SUCCESS; |
---|
[450] | 1511 | } |
---|
| 1512 | |
---|
| 1513 | int sc_main (int argc, char *argv[]) |
---|
| 1514 | { |
---|
| 1515 | try { |
---|
| 1516 | return _main(argc, argv); |
---|
| 1517 | } catch (std::exception &e) { |
---|
| 1518 | std::cout << e.what() << std::endl; |
---|
| 1519 | } catch (...) { |
---|
| 1520 | std::cout << "Unknown exception occured" << std::endl; |
---|
| 1521 | throw; |
---|
| 1522 | } |
---|
| 1523 | return 1; |
---|
| 1524 | } |
---|
| 1525 | |
---|
| 1526 | |
---|
| 1527 | // Local Variables: |
---|
| 1528 | // tab-width: 3 |
---|
| 1529 | // c-basic-offset: 3 |
---|
| 1530 | // c-file-offsets:((innamespace . 0)(inline-open . 0)) |
---|
| 1531 | // indent-tabs-mode: nil |
---|
| 1532 | // End: |
---|
| 1533 | |
---|
| 1534 | // vim: filetype=cpp:expandtab:shiftwidth=3:tabstop=3:softtabstop=3 |
---|
| 1535 | |
---|
| 1536 | |
---|
| 1537 | |
---|