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