- Timestamp:
- Jun 23, 2014, 4:02:53 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/fault_tolerance/platform/tsar_generic_iob/top.cpp
r695 r717 38 38 // (VCI ADDDRESS = 40 bits / VCI DATA width = 64 bits) 39 39 // 40 // The external peripherals IRQs are connected to the XICU component 41 // in cluster(0,0): therefore, the number of channels for the external 42 // peripherals (MTTY, MNIC, CDMA) is limited by the number of IRQ ports... 43 // 44 // In cluster(0,0), the XICU HWI input ports are connected as follow: 45 // - IRQ_IN[0] to IRQ_IN[7] grounded (reserved for PTI or SWI) 46 // - IRQ_IN[8] to IRQ_IN[9] are connected to 2 NIC_RX channels. 47 // - IRQ_IN[10] to IRQ_IN[11] are connected to 2 NIC_TX channels. 48 // - IRQ_IN[12] to IRQ_IN[15] are connected to 4 CDMA channels 49 // - IRQ_IN[16] to IRQ_IN[30] are connected to 15 TTY channels 50 // - IRQ_IN[31] is connected to BDEV 51 // In other clusters, the XICU HWI input ports are grounded. 40 // The external peripherals IRQs are connected to the XPIC component 41 // in IOX interconnect. 52 42 // 53 43 // All clusters are identical, but cluster(0,0) and cluster(XMAX-1,YMAX-1) … … 59 49 // - It uses two dspin_local_crossbar per cluster to implement the 60 50 // local interconnect correponding to the INT network. 61 // - It uses t wodspin_local_crossbar per cluster to implement the51 // - It uses three dspin_local_crossbar per cluster to implement the 62 52 // local interconnect correponding to the coherence INT network. 63 53 // - It uses two virtual_dspin_router per cluster to implement … … 68 58 // - It contains one vci_xicu and one vci_multi_dma per cluster. 69 59 // - It contains one vci_simple ram per cluster to model the L3 cache. 70 // 71 // The TsarIobCluster component is defined in files 72 // tsar_iob_cluster.* (with * = cpp, h, sd) 73 // 74 // The main hardware parameters must be defined in the hard_config.h file : 75 // - XMAX : number of clusters in a row (power of 2) 76 // - YMAX : number of clusters in a column (power of 2) 77 // - CLUSTER_SIZE : size of the segment allocated to a cluster 78 // - NB_PROCS_MAX : number of processors per cluster (power of 2) 79 // - NB_DMA_CHANNELS : number of DMA channels per cluster (< 9) 80 // - NB_TTY_CHANNELS : number of TTY channels in I/O network (< 16) 81 // - NB_NIC_CHANNELS : number of NIC channels in I/O network (< 9) 82 // 83 // Some secondary hardware parameters must be defined in this top.cpp file: 84 // - XRAM_LATENCY : external ram latency 85 // - MEMC_WAYS : L2 cache number of ways 86 // - MEMC_SETS : L2 cache number of sets 87 // - L1_IWAYS 88 // - L1_ISETS 89 // - L1_DWAYS 90 // - L1_DSETS 91 // - FBUF_X_SIZE : width of frame buffer (pixels) 92 // - FBUF_Y_SIZE : heigth of frame buffer (lines) 93 // - BDEV_SECTOR_SIZE : block size for block drvice 94 // - BDEV_IMAGE_NAME : file pathname for block device 95 // - NIC_RX_NAME : file pathname for NIC received packets 96 // - NIC_TX_NAME : file pathname for NIC transmited packets 97 // - NIC_TIMEOUT : max number of cycles before closing a container 60 // - It contains one vci_simple_rom per cluster which can be used for a 61 // distributed boot. 62 // - It contains one vci_multi_tty per cluster for debug purposes (number 63 // of channels can be 0). This TTY is mostly useful when using distributed 64 // boot. 98 65 // 99 66 // General policy for 40 bits physical address decoding: 100 67 // All physical segments base addresses are multiple of 1 Mbytes 101 68 // (=> the 24 LSB bits = 0, and the 16 MSB bits define the target) 102 // The (x_width + y_width) MSB bits (left aligned) define103 // the cluster index, and theLADR bits define the local index:69 // The (x_width + y_width) MSB bits define the cluster index, and the 70 // LADR bits define the local index: 104 71 // | X_ID | Y_ID |---| LADR | OFFSET | 105 72 // |x_width|y_width|---| 8 | 24 | … … 129 96 #include "vci_block_device_tsar.h" 130 97 #include "vci_framebuffer.h" 98 #include "vci_iopic.h" 131 99 #include "vci_iox_network.h" 132 100 … … 215 183 // All initiators are in the same indexing space (14 bits). 216 184 // The SRCID is structured in two fields: 217 // - The 10 MSB bits define the cluster index (left aligned)185 // - The 10 MSB bits define the cluster index 218 186 // - The 4 LSB bits define the local index. 219 187 // Two different initiators cannot have the same SRCID, but a given … … 234 202 #define MDMA_LOCAL_SRCID 0x8 235 203 #define IOBX_LOCAL_SRCID 0x9 236 #define MEMC_LOCAL_SRCID 0xA237 #define CDMA_LOCAL_SRCID 0xE // hard-coded in dspin_tsar238 #define BDEV_LOCAL_SRCID 0xF // hard-coded in dspin_tsar204 #define CDMA_LOCAL_SRCID 0xA 205 #define BDEV_LOCAL_SRCID 0xB 206 #define XPIC_LOCAL_SRCID 0xC 239 207 240 208 /////////////////////////////////////////////////////////////////////// 241 // TGT_ID and INI_ID port indexing for I 0X local interconnect209 // TGT_ID and INI_ID port indexing for IOX local interconnect 242 210 /////////////////////////////////////////////////////////////////////// 243 211 244 #define IOX_IOB0_TGT_ID 0 // don't change this value 245 #define IOX_IOB1_TGT_ID 1 // don't change this value 246 #define IOX_FBUF_TGT_ID 2 247 #define IOX_BDEV_TGT_ID 3 248 #define IOX_MNIC_TGT_ID 4 249 #define IOX_CDMA_TGT_ID 5 250 #define IOX_MTTY_TGT_ID 6 251 252 #define IOX_IOB0_INI_ID 0 // Don't change this value 253 #define IOX_IOB1_INI_ID 1 // Don't change this value 254 #define IOX_BDEV_INI_ID 2 255 #define IOX_CDMA_INI_ID 3 212 #define IOX_FBUF_TGT_ID 0 213 #define IOX_BDEV_TGT_ID 1 214 #define IOX_MNIC_TGT_ID 2 215 #define IOX_CDMA_TGT_ID 3 216 #define IOX_MTTY_TGT_ID 4 217 #define IOX_XPIC_TGT_ID 5 218 #define IOX_IOB0_TGT_ID 6 219 #define IOX_IOB1_TGT_ID 7 220 221 #define IOX_BDEV_INI_ID 0 222 #define IOX_CDMA_INI_ID 1 223 #define IOX_XPIC_INI_ID 2 224 #define IOX_IOB0_INI_ID 3 225 #define IOX_IOB1_INI_ID 4 256 226 257 227 //////////////////////////////////////////////////////////////////////// … … 267 237 char nic_tx_name[256] = NIC_TX_NAME; // path: tx packets file 268 238 ssize_t threads_nr = 1; // simulator's threads 269 bool debug_ok = false; // trace activated239 bool debug_ok = false; 270 240 size_t debug_period = 1; // trace period 271 241 size_t debug_memc_id = 0xFFFFFFFF; // idx of traced memc … … 274 244 uint32_t debug_from = 0; // trace start cycle 275 245 uint32_t frozen_cycles = MAX_FROZEN_CYCLES; // monitoring frozen procs 246 bool distboot = false; // distributed boot 276 247 const size_t block_size = BDEV_SECTOR_SIZE; // disk block size 277 248 const size_t x_size = X_SIZE; … … 296 267 } 297 268 if ((strcmp(argv[n],"-DEBUG") == 0) && ((n+1) < argc) ) { 298 debug_ok 269 debug_ok = true; 299 270 debug_from = strtol(argv[n+1], NULL, 0); 300 271 continue; … … 334 305 continue; 335 306 } 336 337 std::cout << " Arguments are (key,value) couples.\n" 338 << " The order is not important.\n" 339 << " Accepted arguments are :\n\n" 340 << " -NCYCLES number of simulated_cycles\n" 341 << " -SOFT pathname for embedded soft\n" 342 << " -DISK pathname for disk image\n" 343 << " -DEBUG debug start cycle\n" 344 << " -MEMCID index of memc to trace\n" 345 << " -IOB debug IOBs if non_zero_value\n\n" 346 << " -PROCID index of proc to trace\n" 347 << " -THREADS simulator's threads number\n" 348 << " -FROZEN max number of frozen cycles\n" 349 << " -PERIOD number of cycles between trace\n\n"; 307 if ((strcmp(argv[n], "-DISTBOOT") == 0)) { 308 distboot = true; 309 continue; 310 } 311 312 std::cout 313 << "\nArguments are (key,value) couples." 314 << "\nThe order is not important." 315 << "\nAccepted arguments are :\n" 316 << "\n -NCYCLES number of simulated_cycles" 317 << "\n -SOFT pathname for embedded soft" 318 << "\n -DISK pathname for disk image" 319 << "\n -DEBUG debug start cycle" 320 << "\n -MEMCID index of memc to trace" 321 << "\n -IOB debug IOBs if non_zero_value" 322 << "\n -PROCID index of proc to trace" 323 << "\n -THREADS simulator's threads number" 324 << "\n -FROZEN max number of frozen cycles" 325 << "\n -PERIOD number of cycles between trace" 326 << "\n -DISTBOOT use distributed boot ROM" 327 << "\n (processors physical address extention is" 328 << "\n initialized with local cluster id)" 329 << std::endl; 330 350 331 exit(0); 351 332 } … … 358 339 "The NB_NIC_CHANNELS parameter must be 1" ); 359 340 360 std::cout << std::endl; 361 std::cout << " - X_SIZE = " << x_size << std::endl; 362 std::cout << " - Y_SIZE = " << y_size << std::endl; 363 std::cout << " - NB_PROCS = " << NB_PROCS << std::endl; 364 std::cout << " - NB_DMA_CHANNELS = " << NB_DMA_CHANNELS << std::endl; 365 std::cout << " - NB_TTY_CHANNELS = " << NB_TTY_CHANNELS << std::endl; 366 std::cout << " - NB_NIC_CHANNELS = " << NB_NIC_CHANNELS << std::endl; 367 std::cout << " - MEMC_WAYS = " << MEMC_WAYS << std::endl; 368 std::cout << " - MEMC_SETS = " << MEMC_SETS << std::endl; 369 std::cout << " - RAM_LATENCY = " << XRAM_LATENCY << std::endl; 370 std::cout << " - MAX_FROZEN = " << frozen_cycles << std::endl; 341 assert( (x_size > 0) and (y_size > 0) and 342 "Number of clusters on X and Y must be at least 1" ); 343 344 std::cout << "\n- X_SIZE = " << x_size 345 << "\n- Y_SIZE = " << y_size 346 << "\n- NB_PROCS = " << NB_PROCS 347 << "\n- NB_DMA_CHANNELS = " << NB_DMA_CHANNELS 348 << "\n- NB_TTY_CHANNELS = " << NB_TTY_CHANNELS 349 << "\n- NB_NIC_CHANNELS = " << NB_NIC_CHANNELS 350 << "\n- MEMC_WAYS = " << MEMC_WAYS 351 << "\n- MEMC_SETS = " << MEMC_SETS 352 << "\n- RAM_LATENCY = " << XRAM_LATENCY 353 << "\n- MAX_FROZEN = " << frozen_cycles 354 << "\n- DISTBOOT = " << distboot 355 << std::endl; 371 356 372 357 std::cout << std::endl; … … 409 394 size_t cluster_iob0 = cluster(0, 0); 410 395 size_t cluster_iob1 = cluster(x_size - 1, y_size - 1); 396 397 // using mono cluster configuration (only one IO bridge) ? 398 bool is_mono_cluster = ((x_size == 1) && (y_size == 1)); 411 399 412 400 ///////////////////////////////////////////////////////////////////// … … 507 495 IntTab(cluster(x,y), INT_IOBX_TGT_ID), 508 496 not cacheable)); 497 498 std::ostringstream spic; 499 sdma << "int_seg_xpic_" << x << "_" << y; 500 maptab_int.add(Segment(spic.str(), XPIC_BASE+offset, XPIC_SIZE, 501 IntTab(cluster(x,y), INT_IOBX_TGT_ID), 502 not cacheable)); 509 503 } 510 504 … … 515 509 IntTab(cluster(x,y), INT_MDMA_INI_ID)); 516 510 maptab_int.srcid_map(IntTab(cluster(x,y), IOBX_LOCAL_SRCID), 511 IntTab(cluster(x,y), INT_IOBX_INI_ID)); 512 maptab_int.srcid_map(IntTab(cluster(x,y), XPIC_LOCAL_SRCID), 517 513 IntTab(cluster(x,y), INT_IOBX_INI_ID)); 518 514 … … 535 531 MappingTable maptab_ram( 536 532 vci_address_width, 537 IntTab(X_WIDTH + Y_WIDTH, 16 - X_WIDTH - Y_WIDTH),533 IntTab(X_WIDTH + Y_WIDTH, 0), 538 534 IntTab(X_WIDTH + Y_WIDTH, vci_param_int::S - X_WIDTH - Y_WIDTH), 539 535 0x00FF000000); … … 547 543 sxram << "ext_seg_xram_" << x << "_" << y; 548 544 maptab_ram.add(Segment(sxram.str(), XRAM_BASE+offset, XRAM_SIZE, 549 IntTab(cluster(x,y), 0), false));545 IntTab(cluster(x,y), RAM_XRAM_TGT_ID), false)); 550 546 } 551 547 } … … 557 553 maptab_ram.srcid_map(IntTab(cluster_iob0, CDMA_LOCAL_SRCID), 558 554 IntTab(cluster_iob0, RAM_IOBX_INI_ID)); 559 maptab_ram.srcid_map(IntTab(cluster_iob1, CDMA_LOCAL_SRCID),560 IntTab(cluster_iob1, RAM_IOBX_INI_ID));561 555 maptab_ram.srcid_map(IntTab(cluster_iob0, BDEV_LOCAL_SRCID), 562 556 IntTab(cluster_iob0, RAM_IOBX_INI_ID)); 563 maptab_ram.srcid_map(IntTab(cluster_iob1, BDEV_LOCAL_SRCID), 564 IntTab(cluster_iob1, RAM_IOBX_INI_ID)); 565 maptab_ram.srcid_map(IntTab(cluster_iob1, MEMC_LOCAL_SRCID), 566 IntTab(cluster_iob1, RAM_MEMC_INI_ID)); 557 maptab_ram.srcid_map(IntTab(cluster_iob0, XPIC_LOCAL_SRCID), 558 IntTab(cluster_iob0, RAM_IOBX_INI_ID)); 559 maptab_ram.srcid_map(IntTab(cluster_iob0, RAM_MEMC_INI_ID), 560 IntTab(cluster_iob0, RAM_MEMC_INI_ID)); 561 562 if (not is_mono_cluster) { 563 maptab_ram.srcid_map(IntTab(cluster_iob1, CDMA_LOCAL_SRCID), 564 IntTab(cluster_iob1, RAM_IOBX_INI_ID)); 565 maptab_ram.srcid_map(IntTab(cluster_iob1, BDEV_LOCAL_SRCID), 566 IntTab(cluster_iob1, RAM_IOBX_INI_ID)); 567 maptab_ram.srcid_map(IntTab(cluster_iob1, XPIC_LOCAL_SRCID), 568 IntTab(cluster_iob1, RAM_IOBX_INI_ID)); 569 maptab_ram.srcid_map(IntTab(cluster_iob1, RAM_MEMC_INI_ID), 570 IntTab(cluster_iob1, RAM_MEMC_INI_ID)); 571 } 567 572 568 573 std::cout << "RAM network " << maptab_ram << std::endl; … … 575 580 // - 8 targets (IOB0, IOB1, BDEV, CDMA, MTTY, FBUF, BROM, MNIC) 576 581 /////////////////////////////////////////////////////////////////////// 582 583 const size_t iox_addr_drop_bits = X_WIDTH + Y_WIDTH - 1; 584 const size_t iox_addr_decd_bits = 16 - X_WIDTH - Y_WIDTH + 1; 577 585 MappingTable maptab_iox( 578 586 vci_address_width, 579 IntTab( X_WIDTH + Y_WIDTH, 16 - X_WIDTH - Y_WIDTH),580 IntTab(X_WIDTH + Y_WIDTH , vci_srcid_width- X_WIDTH - Y_WIDTH),587 IntTab(iox_addr_drop_bits, iox_addr_decd_bits), 588 IntTab(X_WIDTH + Y_WIDTH , vci_param_ext::S - X_WIDTH - Y_WIDTH), 581 589 0x00FF000000); 582 590 583 // compute base addresses for cluster_iob0 and cluster_iob1 591 592 // Each peripheral can be accessed through two segments, 593 // depending on the used IOB (IOB0 or IOB1). 594 584 595 uint64_t iob0_base = ((uint64_t)cluster_iob0) 585 596 << (vci_address_width - X_WIDTH - Y_WIDTH); 586 uint64_t iob1_base = ((uint64_t)cluster_iob1) 587 << (vci_address_width - X_WIDTH - Y_WIDTH); 588 589 // Each peripheral can be accessed through two segments, 590 // depending on the used IOB (IOB0 or IOB1). 597 591 598 maptab_iox.add(Segment("iox_seg_mtty_0", XTTY_BASE + iob0_base, XTTY_SIZE, 592 IntTab(cluster_iob0, IOX_MTTY_TGT_ID), false)); 593 maptab_iox.add(Segment("iox_seg_mtty_1", XTTY_BASE + iob1_base, XTTY_SIZE, 594 IntTab(cluster_iob1, IOX_MTTY_TGT_ID), false)); 599 IntTab(0, IOX_MTTY_TGT_ID), false)); 595 600 maptab_iox.add(Segment("iox_seg_fbuf_0", FBUF_BASE + iob0_base, FBUF_SIZE, 596 IntTab(cluster_iob0, IOX_FBUF_TGT_ID), false)); 597 maptab_iox.add(Segment("iox_seg_fbuf_1", FBUF_BASE + iob1_base, FBUF_SIZE, 598 IntTab(cluster_iob1, IOX_FBUF_TGT_ID), false)); 601 IntTab(0, IOX_FBUF_TGT_ID), false)); 599 602 maptab_iox.add(Segment("iox_seg_bdev_0", BDEV_BASE + iob0_base, BDEV_SIZE, 600 IntTab(cluster_iob0, IOX_BDEV_TGT_ID), false)); 601 maptab_iox.add(Segment("iox_seg_bdev_1", BDEV_BASE + iob1_base, BDEV_SIZE, 602 IntTab(cluster_iob1, IOX_BDEV_TGT_ID), false)); 603 IntTab(0, IOX_BDEV_TGT_ID), false)); 603 604 maptab_iox.add(Segment("iox_seg_mnic_0", MNIC_BASE + iob0_base, MNIC_SIZE, 604 IntTab(cluster_iob0, IOX_MNIC_TGT_ID), false)); 605 maptab_iox.add(Segment("iox_seg_mnic_1", MNIC_BASE + iob1_base, MNIC_SIZE, 606 IntTab(cluster_iob1, IOX_MNIC_TGT_ID), false)); 605 IntTab(0, IOX_MNIC_TGT_ID), false)); 607 606 maptab_iox.add(Segment("iox_seg_cdma_0", CDMA_BASE + iob0_base, CDMA_SIZE, 608 IntTab(cluster_iob0, IOX_CDMA_TGT_ID), false)); 609 maptab_iox.add(Segment("iox_seg_cdma_1", CDMA_BASE + iob1_base, CDMA_SIZE, 610 IntTab(cluster_iob1, IOX_CDMA_TGT_ID), false)); 611 612 // Each physical RAM can be accessed through IOB0, or through IOB1. 613 // if IOMMU is not activated, addresses are 40 bits (physical addresses), 614 // and the choice depends on on address bit A[39]. 615 // if IOMMU is activated the addresses use only 32 bits (virtual 616 // addresses), and the choice depends on address bit A[31]. 607 IntTab(0, IOX_CDMA_TGT_ID), false)); 608 maptab_iox.add(Segment("iox_seg_xpic_0", XPIC_BASE + iob0_base, XPIC_SIZE, 609 IntTab(0, IOX_XPIC_TGT_ID), false)); 610 611 if (not is_mono_cluster) { 612 uint64_t iob1_base = ((uint64_t)cluster_iob1) 613 << (vci_address_width - X_WIDTH - Y_WIDTH); 614 615 maptab_iox.add(Segment("iox_seg_mtty_1", XTTY_BASE + iob1_base, 616 XTTY_SIZE, IntTab(0, IOX_MTTY_TGT_ID), false)); 617 maptab_iox.add(Segment("iox_seg_fbuf_1", FBUF_BASE + iob1_base, 618 FBUF_SIZE, IntTab(0, IOX_FBUF_TGT_ID), false)); 619 maptab_iox.add(Segment("iox_seg_bdev_1", BDEV_BASE + iob1_base, 620 BDEV_SIZE, IntTab(0, IOX_BDEV_TGT_ID), false)); 621 maptab_iox.add(Segment("iox_seg_mnic_1", MNIC_BASE + iob1_base, 622 MNIC_SIZE, IntTab(0, IOX_MNIC_TGT_ID), false)); 623 maptab_iox.add(Segment("iox_seg_cdma_1", CDMA_BASE + iob1_base, 624 CDMA_SIZE, IntTab(0, IOX_CDMA_TGT_ID), false)); 625 maptab_iox.add(Segment("iox_seg_xpic_1", XPIC_BASE + iob1_base, 626 XPIC_SIZE, IntTab(0, IOX_XPIC_TGT_ID), false)); 627 } 628 629 /////////////////////////////////////////////////////////////////////////// 630 // - For external DMA peripherals, each physical RAM and replicated 631 // XICU can be accessed through IOB0, or through IOB1 depending on address 632 // bit A[32] (0 => IOB0, 1 => IOB1). 633 // 634 // NOTE: the special attribute in the XICU segments is used by the IOB to 635 // route commands through the INT network. The commands on not special 636 // segments (RAM) are routed by the IOB through the RAM network 637 // 638 // NOTE: The IOX interconnect is implemented as a local interconnect because 639 // the global bits need to be dropped, but no locality check is 640 // performed 641 /////////////////////////////////////////////////////////////////////////// 642 617 643 for (size_t x = 0; x < x_size; x++) { 618 644 for (size_t y = 0; y < y_size ; y++) { 619 uint64_t offset = static_cast<uint64_t>(cluster(x,y)) 645 const bool special = true; 646 const bool cacheable = true; 647 648 const uint64_t offset = static_cast<uint64_t>(cluster(x,y)) 620 649 << (vci_address_width - X_WIDTH - Y_WIDTH); 621 650 622 // send command to XRAM through IOB0 623 if ( x < (x_size/2) ) { 624 std::ostringstream siob0; 625 siob0 << "iox_seg_xram_" << x << "_" << y; 626 maptab_iox.add(Segment(siob0.str(), 627 XRAM_BASE + offset, XRAM_SIZE, 628 IntTab(cluster_iob0,IOX_IOB0_TGT_ID), 629 false)); 630 } 631 // send command to XRAM through IOB1 632 else { 633 std::ostringstream siob1; 634 siob1 << "iox_seg_xram_" << x << "_" << y; 635 maptab_iox.add(Segment(siob1.str(), 636 XRAM_BASE + offset, XRAM_SIZE, 637 IntTab(cluster_iob1,IOX_IOB1_TGT_ID), 638 false)); 651 const uint64_t xicu_base = XICU_BASE + offset; 652 if ( (y & 0x1) == 0 ) { 653 // segments mapped to IOB0 654 std::ostringstream sxcu0; 655 sxcu0 << "iox_seg_xcu0_" << x << "_" << y; 656 maptab_iox.add(Segment(sxcu0.str(), xicu_base, XICU_SIZE, 657 IntTab(0, IOX_IOB0_TGT_ID), not cacheable, special)); 658 659 std::ostringstream sram0; 660 sram0 << "iox_seg_ram0_" << x << "_" << y; 661 maptab_iox.add(Segment(sram0.str(), offset, XICU_BASE, 662 IntTab(0, IOX_IOB0_TGT_ID), not cacheable, not special)); 663 } else { 664 // segments mapped to IOB1 665 std::ostringstream sxcu1; 666 sxcu1 << "iox_seg_xcu1_" << x << "_" << y; 667 maptab_iox.add(Segment(sxcu1.str(), xicu_base | (1ULL<<32), XICU_SIZE, 668 IntTab(0, IOX_IOB1_TGT_ID), not cacheable, special)); 669 670 std::ostringstream sram1; 671 sram1 << "iox_seg_ram1_" << x << "_" << y; 672 maptab_iox.add(Segment(sram1.str(), offset | (1ULL<<32), XICU_BASE, 673 IntTab(0, IOX_IOB1_TGT_ID), not cacheable, not special)); 639 674 } 640 675 } 641 676 } 642 // useful when IOMMU activated643 //maptab_iox.add(Segment("iox_seg_xram", 0xc0000000, 0x40000000,644 // IntTab(cluster_iob1,IOX_IOB1_TGT_ID), false));645 677 646 678 // This define the mapping between the initiators (identified by the SRCID) 647 679 // and the port index on the IOX local interconnect. 648 // External initiator have two alias SRCID (iob0 / iob1 access) 649 650 maptab_iox.srcid_map(IntTab(cluster_iob0, CDMA_LOCAL_SRCID), 651 IntTab(cluster_iob0, IOX_CDMA_INI_ID)); 652 maptab_iox.srcid_map(IntTab(cluster_iob1, CDMA_LOCAL_SRCID), 653 IntTab(cluster_iob1, IOX_CDMA_INI_ID)); 654 maptab_iox.srcid_map(IntTab(cluster_iob0, BDEV_LOCAL_SRCID), 655 IntTab(cluster_iob0, IOX_BDEV_INI_ID)); 656 maptab_iox.srcid_map(IntTab(cluster_iob1, BDEV_LOCAL_SRCID), 657 IntTab(cluster_iob0, IOX_BDEV_INI_ID)); 658 659 for (size_t x = 0; x < x_size; x++) { 660 for (size_t y = 0; y < y_size ; y++) { 661 size_t iob = (x < (x_size / 2)) ? IOX_IOB0_INI_ID : IOX_IOB1_INI_ID; 662 663 for (size_t p = 0 ; p < NB_PROCS ; p++) { 664 maptab_iox.srcid_map(IntTab(cluster(x,y), PROC_LOCAL_SRCID + p), 665 IntTab(cluster(x,y), iob)); 666 } 667 maptab_iox.srcid_map(IntTab( cluster(x,y), MDMA_LOCAL_SRCID), 668 IntTab( cluster(x,y), IOX_IOB0_INI_ID)); 669 } 680 681 maptab_iox.srcid_map(IntTab(0, CDMA_LOCAL_SRCID), 682 IntTab(0, IOX_CDMA_INI_ID)); 683 maptab_iox.srcid_map(IntTab(0, BDEV_LOCAL_SRCID), 684 IntTab(0, IOX_BDEV_INI_ID)); 685 maptab_iox.srcid_map(IntTab(0, XPIC_LOCAL_SRCID), 686 IntTab(0, IOX_XPIC_INI_ID)); 687 maptab_iox.srcid_map(IntTab(0, IOX_IOB0_INI_ID), 688 IntTab(0, IOX_IOB0_INI_ID)); 689 690 if (not is_mono_cluster) { 691 maptab_iox.srcid_map(IntTab(0, IOX_IOB1_INI_ID), 692 IntTab(0, IOX_IOB1_INI_ID)); 670 693 } 671 694 … … 697 720 VciSignals<vci_param_ext> signal_vci_ini_bdev("signal_vci_ini_bdev"); 698 721 VciSignals<vci_param_ext> signal_vci_ini_cdma("signal_vci_ini_cdma"); 722 VciSignals<vci_param_ext> signal_vci_ini_xpic("signal_vci_ini_xpic"); 699 723 700 724 VciSignals<vci_param_ext> signal_vci_tgt_iob0("signal_vci_tgt_iob0"); … … 705 729 VciSignals<vci_param_ext> signal_vci_tgt_bdev("signal_vci_tgt_bdev"); 706 730 VciSignals<vci_param_ext> signal_vci_tgt_cdma("signal_vci_tgt_cdma"); 731 VciSignals<vci_param_ext> signal_vci_tgt_xpic("signal_vci_tgt_xpic"); 707 732 708 733 // Horizontal inter-clusters INT network DSPIN … … 807 832 << std::endl; 808 833 834 const size_t nb_iox_initiators = (not is_mono_cluster) ? 5 : 4; 835 const size_t nb_iox_targets = (not is_mono_cluster) ? 8 : 7; 836 809 837 // IOX network 810 838 VciIoxNetwork<vci_param_ext>* iox_network; 811 839 iox_network = new VciIoxNetwork<vci_param_ext>("iox_network", 812 840 maptab_iox, 813 7,// number of targets814 4); // number of initiators841 nb_iox_targets, // number of targets 842 nb_iox_initiators ); // number of initiators 815 843 816 844 // Network Controller … … 853 881 IntTab(0, IOX_CDMA_TGT_ID), 854 882 64, // burst size (bytes) 855 2 * NB_NIC_CHANNELS); 883 NB_CMA_CHANNELS); 884 856 885 // Multi-TTY controller 857 886 std::vector<std::string> vect_names; … … 868 897 vect_names); 869 898 899 // IOPIC 900 VciIopic<vci_param_ext>* xpic; 901 xpic = new VciIopic<vci_param_ext>( "xpic", 902 maptab_iox, 903 IntTab(0, XPIC_LOCAL_SRCID), 904 IntTab(0, IOX_XPIC_TGT_ID), 905 32 ); // number of input HWI 906 907 870 908 TsarIobClusterType* clusters[x_size][y_size]; 871 909 … … 891 929 sc << "cluster_" << x << "_" << y; 892 930 893 bool memc_debug = 894 debug_ok && (cluster(x,y) == debug_memc_id); 895 bool proc_debug = 896 debug_ok && (cluster(x,y) == (debug_proc_id / NB_PROCS)); 931 bool memc_debug = (cluster(x,y) == debug_memc_id); 932 bool proc_debug = (cluster(x,y) == (debug_proc_id / NB_PROCS)); 933 934 bool is_io0 = (cluster(x,y) == cluster_iob0); 935 bool is_io1 = (cluster(x,y) == cluster_iob1); 936 bool is_io = is_io0 || is_io1; 937 938 IntTab iox_iob_tgtid = 939 IntTab(0, is_io0 ? IOX_IOB0_TGT_ID : IOX_IOB1_TGT_ID); 940 IntTab iox_iob_srcid = 941 IntTab(0, is_io0 ? IOX_IOB0_INI_ID : IOX_IOB1_INI_ID); 897 942 898 943 TsarIobClusterType::ClusterParams params = { … … 905 950 .mt_ext = maptab_ram, 906 951 .mt_iox = maptab_iox, 952 953 .is_io = is_io, 954 .iox_iob_tgtid = iox_iob_tgtid, 955 .iox_iob_srcid = iox_iob_srcid, 907 956 908 957 .memc_ways = MEMC_WAYS, … … 916 965 .loader = loader, 917 966 967 .distboot = distboot, 968 918 969 .frozen_cycles = frozen_cycles, 919 970 .debug_start_cycle = debug_from, 920 .memc_debug_ok = memc_debug, 921 .proc_debug_ok = proc_debug, 922 .iob_debug_ok = debug_ ok and debug_iob971 .memc_debug_ok = memc_debug, 972 .proc_debug_ok = proc_debug, 973 .iob_debug_ok = debug_iob 923 974 }; 924 975 … … 942 993 iox_network->p_clk (signal_clk); 943 994 iox_network->p_resetn (signal_resetn); 944 iox_network->p_to_ini[IOX_IOB0_INI_ID] (signal_vci_ini_iob0);945 iox_network->p_to_ini[IOX_IOB1_INI_ID] (signal_vci_ini_iob1);946 995 iox_network->p_to_ini[IOX_BDEV_INI_ID] (signal_vci_ini_bdev); 947 996 iox_network->p_to_ini[IOX_CDMA_INI_ID] (signal_vci_ini_cdma); 948 iox_network->p_to_ tgt[IOX_IOB0_TGT_ID] (signal_vci_tgt_iob0);949 iox_network->p_to_ tgt[IOX_IOB1_TGT_ID] (signal_vci_tgt_iob1);997 iox_network->p_to_ini[IOX_XPIC_INI_ID] (signal_vci_ini_xpic); 998 iox_network->p_to_ini[IOX_IOB0_INI_ID] (signal_vci_ini_iob0); 950 999 iox_network->p_to_tgt[IOX_MTTY_TGT_ID] (signal_vci_tgt_mtty); 951 1000 iox_network->p_to_tgt[IOX_FBUF_TGT_ID] (signal_vci_tgt_fbuf); … … 953 1002 iox_network->p_to_tgt[IOX_BDEV_TGT_ID] (signal_vci_tgt_bdev); 954 1003 iox_network->p_to_tgt[IOX_CDMA_TGT_ID] (signal_vci_tgt_cdma); 1004 iox_network->p_to_tgt[IOX_XPIC_TGT_ID] (signal_vci_tgt_xpic); 1005 iox_network->p_to_tgt[IOX_IOB0_TGT_ID] (signal_vci_tgt_iob0); 1006 1007 if (not is_mono_cluster) { 1008 iox_network->p_to_ini[IOX_IOB1_INI_ID] (signal_vci_ini_iob1); 1009 iox_network->p_to_tgt[IOX_IOB1_TGT_ID] (signal_vci_tgt_iob1); 1010 } 955 1011 956 1012 // BDEV connexion 957 bdev->p_clk (signal_clk); 958 bdev->p_resetn (signal_resetn); 959 bdev->p_irq (signal_irq_bdev); 960 961 // For AHCI 962 // bdev->p_channel_irq[0] (signal_irq_bdev); 963 1013 bdev->p_clk (signal_clk); 1014 bdev->p_resetn (signal_resetn); 1015 bdev->p_irq (signal_irq_bdev); 964 1016 bdev->p_vci_target (signal_vci_tgt_bdev); 965 1017 bdev->p_vci_initiator (signal_vci_ini_bdev); … … 1001 1053 cdma->p_vci_target (signal_vci_tgt_cdma); 1002 1054 cdma->p_vci_initiator (signal_vci_ini_cdma); 1003 for ( size_t i=0 ; i< (NB_NIC_CHANNELS*2); i++) {1055 for ( size_t i=0 ; i<NB_CMA_CHANNELS ; i++) { 1004 1056 cdma->p_irq[i] (signal_irq_cdma[i]); 1005 1057 } … … 1007 1059 std::cout << " - CDMA connected" << std::endl; 1008 1060 1009 // IRQ connexions from external peripherals (cluster_iob0 only) 1010 // IRQ_MNIC_RX -> IRQ[08] to IRQ[09] 1011 // IRQ_MNIC_TX -> IRQ[10] to IRQ[11] 1012 // IRQ_CDMA -> IRQ[12] to IRQ[15] 1013 // IRQ_MTTY -> IRQ[16] to IRQ[30] 1014 // IRQ_BDEV -> IRQ[31] 1015 1016 size_t mx = 16 + NB_TTY_CHANNELS; 1017 for ( size_t n=0 ; n<32 ; n++ ) { 1018 if ( n < 8 ) (*clusters[0][0]->p_irq[n]) (signal_irq_false); 1019 else if ( n < 10 ) (*clusters[0][0]->p_irq[n]) (signal_irq_false); 1020 else if ( n < 12 ) (*clusters[0][0]->p_irq[n]) (signal_irq_false); 1021 else if ( n < 16 ) (*clusters[0][0]->p_irq[n]) (signal_irq_false); 1022 else if ( n < mx ) (*clusters[0][0]->p_irq[n]) (signal_irq_mtty[n-16]); 1023 else if ( n < 31 ) (*clusters[0][0]->p_irq[n]) (signal_irq_false); 1024 else (*clusters[0][0]->p_irq[n]) (signal_irq_bdev); 1025 } 1061 // XPIC connexion 1062 xpic->p_clk (signal_clk); 1063 xpic->p_resetn (signal_resetn); 1064 xpic->p_vci_target (signal_vci_tgt_xpic); 1065 xpic->p_vci_initiator (signal_vci_ini_xpic); 1066 for ( size_t i=0 ; i<32 ; i++) 1067 { 1068 if (i < NB_NIC_CHANNELS) xpic->p_hwi[i] (signal_irq_mnic_rx[i]); 1069 else if (i < 2) xpic->p_hwi[i] (signal_irq_false); 1070 else if (i < 2+NB_NIC_CHANNELS) xpic->p_hwi[i] (signal_irq_mnic_tx[i-2]); 1071 else if (i < 4) xpic->p_hwi[i] (signal_irq_false); 1072 else if (i < 4+NB_CMA_CHANNELS) xpic->p_hwi[i] (signal_irq_cdma[i-4]); 1073 else if (i < 8) xpic->p_hwi[i] (signal_irq_false); 1074 else if (i < 9) xpic->p_hwi[i] (signal_irq_bdev); 1075 else if (i < 9+NB_TTY_CHANNELS) xpic->p_hwi[i] (signal_irq_mtty[i-9]); 1076 else xpic->p_hwi[i] (signal_irq_false); 1077 } 1078 1079 std::cout << " - XPIC connected" << std::endl; 1026 1080 1027 1081 // IOB0 cluster connexion to IOX network … … 1030 1084 1031 1085 // IOB1 cluster connexion to IOX network 1032 (*clusters[x_size-1][y_size-1]->p_vci_iob_iox_ini) (signal_vci_ini_iob1); 1033 (*clusters[x_size-1][y_size-1]->p_vci_iob_iox_tgt) (signal_vci_tgt_iob1); 1086 if (not is_mono_cluster) { 1087 (*clusters[x_size-1][y_size-1]->p_vci_iob_iox_ini) (signal_vci_ini_iob1); 1088 (*clusters[x_size-1][y_size-1]->p_vci_iob_iox_tgt) (signal_vci_tgt_iob1); 1089 } 1034 1090 1035 1091 // All clusters Clock & RESET connexions … … 1145 1201 // East & West boundary cluster connections 1146 1202 for (size_t y = 0; y < y_size; y++) { 1203 // L1-L2 cmd network boundary connections 1147 1204 for (size_t k = 0; k < 3; k++) { 1148 1205 clusters[0][y]->p_dspin_int_cmd_in[WEST][k]( … … 1156 1213 } 1157 1214 1215 // L1-L2 rsp network boundary connections 1158 1216 for (size_t k = 0; k < 2; k++) { 1159 1217 clusters[0][y]->p_dspin_int_rsp_in[WEST][k]( … … 1167 1225 } 1168 1226 1169 // handling IOB to RAM network connection in cluster_iob0 1170 if( y == 0 ) { 1171 (*clusters[0][0]->p_dspin_iob_cmd_out)( 1172 signal_dspin_cmd_iob0_loopback); 1173 clusters[0][0]->p_dspin_ram_cmd_in[WEST]( 1174 signal_dspin_cmd_iob0_loopback); 1175 clusters[0][0]->p_dspin_ram_cmd_out[WEST]( 1176 signal_dspin_false_ram_cmd_out[0][0][WEST]); 1177 clusters[0][0]->p_dspin_ram_rsp_in[WEST]( 1178 signal_dspin_false_ram_rsp_in[0][0][WEST]); 1179 clusters[0][0]->p_dspin_ram_rsp_out[WEST]( 1180 signal_dspin_rsp_iob0_loopback); 1181 (*clusters[0][0]->p_dspin_iob_rsp_in)( 1182 signal_dspin_rsp_iob0_loopback); 1183 } 1184 else { 1185 clusters[0][y]->p_dspin_ram_cmd_in[WEST]( 1186 signal_dspin_false_ram_cmd_in[0][y][WEST]); 1187 clusters[0][y]->p_dspin_ram_cmd_out[WEST]( 1188 signal_dspin_false_ram_cmd_out[0][y][WEST]); 1189 clusters[0][y]->p_dspin_ram_rsp_in[WEST]( 1190 signal_dspin_false_ram_rsp_in[0][y][WEST]); 1191 clusters[0][y]->p_dspin_ram_rsp_out[WEST]( 1192 signal_dspin_false_ram_rsp_out[0][y][WEST]); 1193 } 1194 1195 // handling IOB to RAM network connection in cluster_iob1 1196 if( y == y_size-1 ) { 1197 (*clusters[x_size-1][y_size-1]->p_dspin_iob_cmd_out)( 1198 signal_dspin_cmd_iob1_loopback); 1199 clusters[x_size-1][y_size-1]->p_dspin_ram_cmd_in[EAST]( 1200 signal_dspin_cmd_iob1_loopback); 1201 1202 clusters[x_size-1][y_size-1]->p_dspin_ram_cmd_out[EAST]( 1203 signal_dspin_false_ram_cmd_out[x_size-1][y_size-1][EAST]); 1204 clusters[x_size-1][y_size-1]->p_dspin_ram_rsp_in[EAST]( 1205 signal_dspin_false_ram_rsp_in[x_size-1][y_size-1][EAST]); 1206 1207 clusters[x_size-1][y_size-1]->p_dspin_ram_rsp_out[EAST]( 1208 signal_dspin_rsp_iob1_loopback); 1209 (*clusters[x_size-1][y_size-1]->p_dspin_iob_rsp_in)( 1210 signal_dspin_rsp_iob1_loopback); 1211 } 1212 else { 1213 clusters[x_size-1][y]->p_dspin_ram_cmd_in[EAST]( 1214 signal_dspin_false_ram_cmd_in[x_size-1][y][EAST]); 1215 clusters[x_size-1][y]->p_dspin_ram_cmd_out[EAST]( 1216 signal_dspin_false_ram_cmd_out[x_size-1][y][EAST]); 1217 clusters[x_size-1][y]->p_dspin_ram_rsp_in[EAST]( 1218 signal_dspin_false_ram_rsp_in[x_size-1][y][EAST]); 1219 clusters[x_size-1][y]->p_dspin_ram_rsp_out[EAST]( 1220 signal_dspin_false_ram_rsp_out[x_size-1][y][EAST]); 1221 } 1227 // L2-XRAM cmd network boundary connections 1228 clusters[0][y]->p_dspin_ram_cmd_in[WEST]( 1229 signal_dspin_false_ram_cmd_in[0][y][WEST]); 1230 clusters[0][y]->p_dspin_ram_cmd_out[WEST]( 1231 signal_dspin_false_ram_cmd_out[0][y][WEST]); 1232 clusters[x_size-1][y]->p_dspin_ram_cmd_in[EAST]( 1233 signal_dspin_false_ram_cmd_in[x_size-1][y][EAST]); 1234 clusters[x_size-1][y]->p_dspin_ram_cmd_out[EAST]( 1235 signal_dspin_false_ram_cmd_out[x_size-1][y][EAST]); 1236 1237 // L2-XRAM rsp network boundary connections 1238 clusters[0][y]->p_dspin_ram_rsp_in[WEST]( 1239 signal_dspin_false_ram_rsp_in[0][y][WEST]); 1240 clusters[0][y]->p_dspin_ram_rsp_out[WEST]( 1241 signal_dspin_false_ram_rsp_out[0][y][WEST]); 1242 clusters[x_size-1][y]->p_dspin_ram_rsp_in[EAST]( 1243 signal_dspin_false_ram_rsp_in[x_size-1][y][EAST]); 1244 clusters[x_size-1][y]->p_dspin_ram_rsp_out[EAST]( 1245 signal_dspin_false_ram_rsp_out[x_size-1][y][EAST]); 1222 1246 } 1223 1247 … … 1277 1301 1278 1302 signal_resetn = false; 1279 1280 1303 signal_irq_false = false; 1281 1304 … … 1368 1391 } 1369 1392 1393 // trace RAM xbar (between MEMC and IOB) 1394 // clusters[0][0]->ram_xbar_cmd->print_trace(); 1395 // clusters[0][0]->ram_xbar_rsp->print_trace(); 1396 // clusters[x_size-1][y_size-1]->ram_xbar_cmd->print_trace(); 1397 // clusters[x_size-1][y_size-1]->ram_xbar_rsp->print_trace(); 1398 1370 1399 // trace INT network 1371 // 1372 1373 // 1374 // 1375 // 1376 // 1377 1378 // 1379 // 1400 // clusters[0][0]->int_xbar_d->print_trace(); 1401 1402 // clusters[0][0]->signal_int_dspin_cmd_l2g_d.print_trace( 1403 // "[SIG] INT_CMD_L2G_D_0_0"); 1404 // clusters[0][0]->signal_int_dspin_rsp_g2l_d.print_trace( 1405 // "[SIG] INT_RSP_G2L_D_0_0"); 1406 1407 // clusters[0][0]->int_router_cmd->print_trace(0); 1408 // clusters[0][0]->int_router_rsp->print_trace(0); 1380 1409 1381 1410 // trace INT_CMD_D xbar and router in cluster 0_1 1382 // 1383 // 1384 1385 // 1386 // 1387 // 1388 // 1389 1390 // 1411 // clusters[0][1]->int_router_cmd->print_trace(0); 1412 // clusters[0][1]->int_router_rsp->print_trace(0); 1413 1414 // clusters[0][1]->signal_int_dspin_cmd_g2l_d.print_trace( 1415 // "[SIG] INT_CMD_G2L_D_0_0"); 1416 // clusters[0][1]->signal_int_dspin_rsp_l2g_d.print_trace( 1417 // "[SIG] INT_RSP_L2G_D_0_0"); 1418 1419 // clusters[0][1]->int_xbar_cmd_d->print_trace(); 1391 1420 1392 1421 // trace memc[debug_memc_id] … … 1412 1441 1413 1442 // trace iob, iox and external peripherals 1414 if ( debug_iob ) {1415 clusters[0][0]->iob->print_trace();1416 clusters[0][0]->signal_int_vci_tgt_iobx.print_trace(1417 "[SIG]IOB0_INT_TGT");1418 clusters[0][0]->signal_int_vci_ini_iobx.print_trace(1419 "[SIG]IOB0_INT_INI");1420 clusters[0][0]->signal_ram_vci_ini_iobx.print_trace(1421 "[SIG]IOB0_RAM_INI");1422 1423 signal_vci_ini_iob0.print_trace("[SIG]IOB0_IOX_INI");1424 signal_vci_tgt_iob0.print_trace("[SIG]IOB0_IOX_TGT");1425 1426 cdma->print_trace();1427 signal_vci_tgt_cdma.print_trace("[SIG]IOX_CDMA_TGT");1428 signal_vci_ini_cdma.print_trace("[SIG]IOX_CDMA_INI");1429 1430 iox_network->print_trace();1431 1432 // interrupts1433 if (signal_irq_bdev) std::cout << "### IRQ_BDEV ACTIVATED"1434 << std::endl;1435 }1443 //if ( debug_iob ) { 1444 // clusters[0][0]->iob->print_trace(); 1445 // clusters[0][0]->signal_int_vci_tgt_iobx.print_trace( 1446 // "[SIG]IOB0_INT_TGT"); 1447 // clusters[0][0]->signal_int_vci_ini_iobx.print_trace( 1448 // "[SIG]IOB0_INT_INI"); 1449 // clusters[0][0]->signal_ram_vci_ini_iobx.print_trace( 1450 // "[SIG]IOB0_RAM_INI"); 1451 1452 // signal_vci_ini_iob0.print_trace("[SIG]IOB0_IOX_INI"); 1453 // signal_vci_tgt_iob0.print_trace("[SIG]IOB0_IOX_TGT"); 1454 1455 // cdma->print_trace(); 1456 // signal_vci_tgt_cdma.print_trace("[SIG]IOX_CDMA_TGT"); 1457 // signal_vci_ini_cdma.print_trace("[SIG]IOX_CDMA_INI"); 1458 1459 // iox_network->print_trace(); 1460 1461 // // interrupts 1462 // if (signal_irq_bdev) std::cout << "### IRQ_BDEV ACTIVATED" 1463 // << std::endl; 1464 //} 1436 1465 } 1437 1466 sc_start(sc_core::sc_time(1, SC_NS)); … … 1444 1473 delete cdma; 1445 1474 delete mtty; 1475 delete xpic; 1446 1476 1447 1477 for(size_t x = 0; x < x_size; x++) {
Note: See TracChangeset
for help on using the changeset viewer.