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