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