Changeset 967 for trunk/platforms/tsar_generic_leti/top.cpp
- Timestamp:
- Apr 6, 2015, 12:39:32 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/platforms/tsar_generic_leti/top.cpp
r951 r967 1 1 ///////////////////////////////////////////////////////////////////////// 2 // File: top.cpp (for tsar_generic_leti )2 // File: top.cpp (for tsar_generic_leti platform) 3 3 // Author: Alain Greiner 4 4 // Copyright: UPMC/LIP6 … … 11 11 // 12 12 // The processor is a MIPS32 processor wrapped in a GDB server 13 // (this is defined in the tsar_ xbar_cluster).13 // (this is defined in the tsar_leti_cluster). 14 14 // 15 15 // The main hardware parameters are the mesh size (X_SIZE & Y_SIZE), 16 16 // and the number of processors per cluster (NB_PROCS_MAX). 17 17 // The NB_PROCS_MAX parameter cannot be larger than 4. 18 // Others parameters are the frame buffer size, the disk controller type 19 // (BDV or HBA), the number of TTY channels, the number of NIC channels, 20 // and the number of CMA channels. 18 21 // 19 22 // All external peripherals are located in cluster[X_SIZE-1][Y_SIZE-1], 20 23 // and are connected to an IO bus (implemented as a vci_local_crossbar): 21 // - one disk controller 22 // - one multi-channel ethernet controller 23 // - one multi-channel chained buffer dma controller 24 // - one multi-channel tty controller 25 // - one frame buffer controller 26 // - one iopic controller 24 // - DISK : block device controller (BDV / HBA) 25 // - MNIC : multi-channel ethernet controller 26 // - CDMA : multi-channel chained buffer dma controller 27 // - MTTY : multi-channel tty controller 28 // - FBUF : frame buffer controller 29 // - IOPI : HWI to SWI translator 30 // 27 31 // This IO bus is directly connected to the north ports of the CMD/RSP 28 32 // routers in cluster[X_SIZE-1][y_SIZE-2] through VCI/DSPIN wrappers. … … 47 51 // 48 52 // Each processor receives 4 consecutive IRQ lines from the local XICU. 53 // The number of PTI and WTI IRQs is bounded to 16. 49 54 // 50 55 // In all clusters, the MEMC IRQ line (signaling a late write error) 51 56 // is connected to XICU HWI[8] 52 57 // 53 // This IOBUS is connected to the north port of the DIR_CMD54 // and DIR_RSP routers, in cluster(X_SIZE-1, Y_SIZE-1).55 58 // For all external peripherals, the hardware interrupts (HWI) are 56 59 // translated to write interrupts (WTI) by the iopic component: … … 58 61 // - IOPIC HWI[3:2] connected to IRQ_NIC_TX[1:0] 59 62 // - IOPIC HWI[7:4] connected to IRQ_CMA_TX[3:0]] 60 // - IOPIC HWI[8] connected to IRQ_ BDEV63 // - IOPIC HWI[8] connected to IRQ_DISK 61 64 // - IOPIC HWI[15:9] unused (grounded) 62 65 // - IOPIC HWI[23:16] connected to IRQ_TTY_RX[7:0]] … … 69 72 // - X_WIDTH : number of bits for x coordinate (must be 4) 70 73 // - Y_WIDTH : number of bits for y coordinate (must be 4) 74 // - P_WIDTH : number of bits for local processor coordinate 71 75 // - X_SIZE : number of clusters in a row (1,2,4,8,16) 72 76 // - Y_SIZE : number of clusters in a column (1,2,4,8) … … 77 81 // - FBUF_X_SIZE : number of pixels per line for frame buffer 78 82 // - FBUF_Y_SIZE : number of lines for frame buffer 83 // - XCU_NB_HWI : number of XCU HWIs (must be 16) 84 // - XCU_NB_PTI : number of XCU PTIs (must be 16) 85 // - XCU_NB_WTI : number of XCU WTIs (must be 16) 86 // - XCU_NB_OUT : number of XCU output (must be 16) 87 // - USE_IOC_XYZ : IOC type (XYZ in HBA / BDV / SDC / RDK) 79 88 // 80 89 // Some other hardware parameters are not used when compiling the OS, … … 85 94 // - L1_DWAYS : L1 cache data number of ways 86 95 // - L1_DSETS : L1 cache data number of sets 87 // - BDEV_IMAGE_NAME : pathname for block device disk image96 // - DISK_IMAGE_NAME : pathname for block device disk image 88 97 ///////////////////////////////////////////////////////////////////////// 89 98 // General policy for 40 bits physical address decoding: … … 111 120 #include "gdbserver.h" 112 121 #include "mapping_table.h" 122 113 123 #include "tsar_leti_cluster.h" 114 124 #include "vci_local_crossbar.h" … … 119 129 #include "vci_chbuf_dma.h" 120 130 #include "vci_block_device_tsar.h" 131 #include "vci_multi_ahci.h" 121 132 #include "vci_framebuffer.h" 122 133 #include "vci_iopic.h" 134 123 135 #include "alloc_elems.h" 124 136 137 /////////////////////////////////////////////////// 138 // Main hardware parameters values 139 /////////////////////////////////////////////////// 140 125 141 #include "hard_config.h" 142 143 /////////////////////////////////////////////////////////////////////////////////////// 144 // Secondary Hardware Parameters 145 /////////////////////////////////////////////////////////////////////////////////////// 146 147 #define XMAX X_SIZE // actual number of columns in 2D mesh 148 #define YMAX (Y_SIZE - 1) // actual number of rows in 2D mesh 149 150 #define XRAM_LATENCY 0 151 152 #define MEMC_WAYS 16 153 #define MEMC_SETS 256 154 155 #define L1_IWAYS 4 156 #define L1_ISETS 64 157 158 #define L1_DWAYS 4 159 #define L1_DSETS 64 160 161 #define DISK_IMAGE_NAME "../../../giet_vm/hdd/virt_hdd.dmg" 162 163 #define ROM_SOFT_NAME "../../softs/tsar_boot/preloader.elf" 164 165 #define NORTH 0 166 #define SOUTH 1 167 #define EAST 2 168 #define WEST 3 126 169 127 170 /////////////////////////////////////////////////// 128 171 // Parallelisation 129 172 /////////////////////////////////////////////////// 173 130 174 #define USE_OPENMP _OPENMP 131 175 … … 164 208 165 209 166 ///////////////////////////////////////////////////////////////////////////////////////167 // Secondary Hardware Parameters168 ///////////////////////////////////////////////////////////////////////////////////////169 170 #define XMAX X_SIZE // actual number of columns in 2D mesh171 #define YMAX (Y_SIZE - 1) // actual number of rows in 2D mesh172 173 #define XRAM_LATENCY 0174 175 #define MEMC_WAYS 16176 #define MEMC_SETS 256177 178 #define L1_IWAYS 4179 #define L1_ISETS 64180 181 #define L1_DWAYS 4182 #define L1_DSETS 64183 184 #define BDEV_IMAGE_NAME "../../../giet_vm/hdd/virt_hdd.dmg"185 186 #define ROM_SOFT_NAME "../../softs/tsar_boot/preloader.elf"187 188 #define NORTH 0189 #define SOUTH 1190 #define EAST 2191 #define WEST 3192 210 193 211 /////////////////////////////////////////////////////////////////////////////////////// … … 205 223 #define XICU_TGTID 1 206 224 #define MTTY_TGTID 2 207 #define BDEV_TGTID 3225 #define DISK_TGTID 3 208 226 #define FBUF_TGTID 4 209 227 #define MNIC_TGTID 5 … … 211 229 #define IOPI_TGTID 7 212 230 213 #define BDEV_SRCID NB_PROCS_MAX231 #define DISK_SRCID NB_PROCS_MAX 214 232 #define CDMA_SRCID NB_PROCS_MAX + 1 215 233 #define IOPI_SRCID NB_PROCS_MAX + 2 … … 233 251 size_t trace_proc_id = 0; // index of proc to be traced 234 252 char soft_name[256] = ROM_SOFT_NAME; // pathname for ROM binary code 235 char disk_name[256] = BDEV_IMAGE_NAME; // pathname for DISK image253 char disk_name[256] = DISK_IMAGE_NAME; // pathname for DISK image 236 254 uint32_t frozen_cycles = MAX_FROZEN_CYCLES; // for debug 237 255 struct timeval t1,t2; … … 260 278 261 279 assert( (x < XMAX) and (y < (YMAX)) and 262 "MEMCID parameter refers a not valid memory cache");280 "MEMCID parameter doesxn't fit valid XMAX/YMAX"); 263 281 } 264 282 else if ((strcmp(argv[n], "-PROCID") == 0) && (n + 1 < argc)) … … 273 291 assert( (x < XMAX) and (y < YMAX) and (l < NB_PROCS_MAX) and 274 292 "PROCID parameter refers a not valid processor"); 275 }276 else if ((strcmp(argv[n], "-ROM") == 0) && ((n + 1) < argc))277 {278 strcpy(soft_name, argv[n + 1]);279 }280 else if ((strcmp(argv[n], "-DISK") == 0) && ((n + 1) < argc))281 {282 strcpy(disk_name, argv[n + 1]);283 293 } 284 294 else if ((strcmp(argv[n], "-THREADS") == 0) && ((n + 1) < argc)) … … 298 308 std::cout << " - NCYCLES number_of_simulated_cycles" << std::endl; 299 309 std::cout << " - DEBUG debug_start_cycle" << std::endl; 300 std::cout << " - ROM path to ROM image" << std::endl;301 std::cout << " - DISK path to disk image" << std::endl;302 310 std::cout << " - THREADS simulator's threads number" << std::endl; 303 311 std::cout << " - FROZEN max_number_of_lines" << std::endl; 304 std::cout << " - PERIOD number_of_cycles between trace" << std::endl;305 312 std::cout << " - MEMCID index_memc_to_be_traced" << std::endl; 306 313 std::cout << " - PROCID index_proc_to_be_traced" << std::endl; … … 323 330 "Illegal NB_PROCS_MAX parameter" ); 324 331 332 assert( (XCU_NB_HWI == 16) and 333 "XCU_NB_HWI must be 16" ); 334 335 assert( (XCU_NB_PTI == 16) and 336 "XCU_NB_PTI must be 16" ); 337 338 assert( (XCU_NB_WTI == 16) and 339 "XCU_NB_WTI must be 16" ); 340 341 assert( (XCU_NB_OUT == 16) and 342 "XCU_NB_OUT must be 16" ); 343 325 344 assert( (NB_CMA_CHANNELS <= 4) and 326 345 "The NB_CMA_CHANNELS parameter cannot be larger than 4" ); 327 346 328 347 assert( (NB_TTY_CHANNELS <= 8) and 329 "The NB_TTY_CHANNELS parameter cannot be larger than 16" );348 "The NB_TTY_CHANNELS parameter cannot be larger than 8" ); 330 349 331 350 assert( (NB_NIC_CHANNELS <= 2) and … … 340 359 std::cout << std::endl; 341 360 342 std::cout << " - XMAX = " << XMAX << std::endl; 343 std::cout << " - YMAX = " << YMAX << std::endl; 344 std::cout << " - NB_PROCS_MAX = " << NB_PROCS_MAX << std::endl; 345 std::cout << " - NB_TTY_CHANNELS = " << NB_TTY_CHANNELS << std::endl; 346 std::cout << " - NB_NIC_CHANNELS = " << NB_NIC_CHANNELS << std::endl; 347 std::cout << " - NB_CMA_CHANNELS = " << NB_CMA_CHANNELS << std::endl; 348 std::cout << " - MEMC_WAYS = " << MEMC_WAYS << std::endl; 349 std::cout << " - MEMC_SETS = " << MEMC_SETS << std::endl; 350 std::cout << " - RAM_LATENCY = " << XRAM_LATENCY << std::endl; 351 std::cout << " - MAX_FROZEN = " << frozen_cycles << std::endl; 352 std::cout << " - MAX_CYCLES = " << ncycles << std::endl; 353 std::cout << " - RESET_ADDRESS = " << RESET_ADDRESS << std::endl; 354 std::cout << " - SOFT_FILENAME = " << soft_name << std::endl; 355 std::cout << " - DISK_IMAGENAME = " << disk_name << std::endl; 356 std::cout << " - OPENMP THREADS = " << threads << std::endl; 361 std::cout << " - XMAX = " << XMAX << std::endl 362 << " - YMAX = " << YMAX << std::endl 363 << " - NB_PROCS_MAX = " << NB_PROCS_MAX << std::endl 364 << " - NB_TTY_CHANNELS = " << NB_TTY_CHANNELS << std::endl 365 << " - NB_NIC_CHANNELS = " << NB_NIC_CHANNELS << std::endl 366 << " - NB_CMA_CHANNELS = " << NB_CMA_CHANNELS << std::endl 367 << " - MEMC_WAYS = " << MEMC_WAYS << std::endl 368 << " - MEMC_SETS = " << MEMC_SETS << std::endl 369 << " - RAM_LATENCY = " << XRAM_LATENCY << std::endl 370 << " - MAX_FROZEN = " << frozen_cycles << std::endl 371 << " - MAX_CYCLES = " << ncycles << std::endl 372 << " - RESET_ADDRESS = " << RESET_ADDRESS << std::endl 373 << " - SOFT_FILENAME = " << soft_name << std::endl 374 << " - DISK_IMAGENAME = " << disk_name << std::endl 375 << " - OPENMP THREADS = " << threads << std::endl 376 << " - DEBUG_PROCID = " << trace_proc_id << std::endl 377 << " - DEBUG_MEMCID = " << trace_memc_id << std::endl; 357 378 358 379 std::cout << std::endl; … … 427 448 428 449 maptabd.add(Segment("seg_ioc0", SEG_IOC_BASE, SEG_IOC_SIZE, 429 IntTab(cluster(0,0), BDEV_TGTID), false));450 IntTab(cluster(0,0),DISK_TGTID), false)); 430 451 431 452 // segments for peripherals in cluster_io (XMAX-1,YMAX) … … 439 460 IntTab(cluster(XMAX-1, YMAX),FBUF_TGTID), false)); 440 461 441 maptabd.add(Segment("seg_ bdev", SEG_IOC_BASE + offset, SEG_IOC_SIZE,442 IntTab(cluster(XMAX-1, YMAX), BDEV_TGTID), false));462 maptabd.add(Segment("seg_disk", SEG_IOC_BASE + offset, SEG_IOC_SIZE, 463 IntTab(cluster(XMAX-1, YMAX),DISK_TGTID), false)); 443 464 444 465 maptabd.add(Segment("seg_mnic", SEG_NIC_BASE + offset, SEG_NIC_SIZE, … … 487 508 488 509 // IRQs from external peripherals 489 sc_signal<bool> signal_irq_ bdev;510 sc_signal<bool> signal_irq_disk; 490 511 sc_signal<bool> signal_irq_mnic_rx[NB_NIC_CHANNELS]; 491 512 sc_signal<bool> signal_irq_mnic_tx[NB_NIC_CHANNELS]; … … 573 594 574 595 // VCI signals for iobus and peripherals 575 VciSignals<vci_param_int> signal_vci_ini_ bdev("signal_vci_ini_bdev");596 VciSignals<vci_param_int> signal_vci_ini_disk("signal_vci_ini_disk"); 576 597 VciSignals<vci_param_int> signal_vci_ini_cdma("signal_vci_ini_cdma"); 577 598 VciSignals<vci_param_int> signal_vci_ini_iopi("signal_vci_ini_iopi"); … … 582 603 VciSignals<vci_param_int> signal_vci_tgt_memc("signal_vci_tgt_memc"); 583 604 VciSignals<vci_param_int> signal_vci_tgt_xicu("signal_vci_tgt_xicu"); 584 VciSignals<vci_param_int> signal_vci_tgt_ bdev("signal_vci_tgt_bdev");605 VciSignals<vci_param_int> signal_vci_tgt_disk("signal_vci_tgt_disk"); 585 606 VciSignals<vci_param_int> signal_vci_tgt_mtty("signal_vci_tgt_mtty"); 586 607 VciSignals<vci_param_int> signal_vci_tgt_fbuf("signal_vci_tgt_fbuf"); … … 660 681 XICU_TGTID, 661 682 MTTY_TGTID, 662 BDEV_TGTID,683 DISK_TGTID, 663 684 disk_name, 664 685 MEMC_WAYS, … … 713 734 NB_PROCS_MAX + 3, // number of local initiators 714 735 8, // number of local targets 715 BDEV_TGTID ); // default target index736 DISK_TGTID ); // default target index 716 737 717 738 //////////// vci_framebuffer … … 723 744 FBUF_X_SIZE, FBUF_Y_SIZE ); 724 745 746 #if ( USE_IOC_HBA ) 747 748 //////////// vci_multi_ahci 749 std::vector<std::string> filenames; 750 filenames.push_back(disk_name); // one single disk 751 VciMultiAhci<vci_param_int>* 752 disk = new VciMultiAhci<vci_param_int>( 753 "disk", 754 maptabd, 755 IntTab(cluster_io, DISK_SRCID), 756 IntTab(cluster_io, DISK_TGTID), 757 filenames, 758 512, // block size 759 64, // burst size (bytes) 760 0 ); // disk latency 761 762 #elif ( USE_IOC_BDV or USE_IOC_SDC ) 763 725 764 //////////// vci_block_device 726 765 VciBlockDeviceTsar<vci_param_int>* 727 bdev= new VciBlockDeviceTsar<vci_param_int>(728 " bdev",766 disk = new VciBlockDeviceTsar<vci_param_int>( 767 "disk", 729 768 maptabd, 730 IntTab(cluster_io, BDEV_SRCID),731 IntTab(cluster_io, BDEV_TGTID),769 IntTab(cluster_io, DISK_SRCID), 770 IntTab(cluster_io, DISK_TGTID), 732 771 disk_name, 733 772 512, // block size 734 64 ); // burst size 773 64, // burst size (bytes) 774 0 ); // disk latency 775 #endif 735 776 736 777 //////////// vci_multi_nic … … 807 848 iobus->p_to_target[FBUF_TGTID] (signal_vci_tgt_fbuf); 808 849 iobus->p_to_target[MNIC_TGTID] (signal_vci_tgt_mnic); 809 iobus->p_to_target[ BDEV_TGTID] (signal_vci_tgt_bdev);850 iobus->p_to_target[DISK_TGTID] (signal_vci_tgt_disk); 810 851 iobus->p_to_target[CDMA_TGTID] (signal_vci_tgt_cdma); 811 852 iobus->p_to_target[IOPI_TGTID] (signal_vci_tgt_iopi); … … 815 856 iobus->p_to_initiator[p] (signal_vci_ini_proc[p]); 816 857 } 817 iobus->p_to_initiator[ BDEV_SRCID] (signal_vci_ini_bdev);858 iobus->p_to_initiator[DISK_SRCID] (signal_vci_ini_disk); 818 859 iobus->p_to_initiator[CDMA_SRCID] (signal_vci_ini_cdma); 819 860 iobus->p_to_initiator[IOPI_SRCID] (signal_vci_ini_iopi); … … 821 862 std::cout << " - IOBUS connected" << std::endl; 822 863 823 // block_device 824 bdev->p_clk (signal_clk); 825 bdev->p_resetn (signal_resetn); 826 bdev->p_vci_target (signal_vci_tgt_bdev); 827 bdev->p_vci_initiator (signal_vci_ini_bdev); 828 bdev->p_irq (signal_irq_bdev); 829 830 std::cout << " - BDEV connected" << std::endl; 864 // disk 865 disk->p_clk (signal_clk); 866 disk->p_resetn (signal_resetn); 867 disk->p_vci_target (signal_vci_tgt_disk); 868 disk->p_vci_initiator (signal_vci_ini_disk); 869 #if USE_IOC_HBA 870 disk->p_channel_irq[0] (signal_irq_disk); 871 #else 872 disk->p_irq (signal_irq_disk); 873 #endif 874 875 std::cout << " - DISK connected" << std::endl; 831 876 832 877 // frame_buffer … … 888 933 else if(i < 4+NB_CMA_CHANNELS) iopic->p_hwi[i] (signal_irq_cdma[i-4]); 889 934 else if(i < 8) iopic->p_hwi[i] (signal_irq_false); 890 else if(i == 8) iopic->p_hwi[i] (signal_irq_ bdev);935 else if(i == 8) iopic->p_hwi[i] (signal_irq_disk); 891 936 else if(i < 16) iopic->p_hwi[i] (signal_irq_false); 892 937 else if(i < 16+NB_TTY_CHANNELS) iopic->p_hwi[i] (signal_irq_mtty_rx[i-16]); … … 1236 1281 #if USE_PIC 1237 1282 // trace external ioc 1238 bdev->print_trace();1239 signal_vci_tgt_ bdev.print_trace("[SIG]BDEV_TGT");1240 signal_vci_ini_ bdev.print_trace("[SIG]BDEV_INI");1283 disk->print_trace(); 1284 signal_vci_tgt_disk.print_trace("[SIG]DISK_TGT"); 1285 signal_vci_ini_disk.print_trace("[SIG]DISK_INI"); 1241 1286 1242 1287 // trace external iopic … … 1246 1291 1247 1292 // trace external interrupts 1248 if (signal_irq_ bdev) std::cout << "### IRQ_BDEV" << std::endl;1293 if (signal_irq_disk) std::cout << "### IRQ_DISK" << std::endl; 1249 1294 #else 1250 clusters[0][0]-> bdev->print_trace();1251 clusters[0][0]->signal_vci_tgt_ bdev.print_trace("[SIG]BDEV_0_0");1252 clusters[0][0]->signal_vci_ini_ bdev.print_trace("[SIG]BDEV_0_0");1295 clusters[0][0]->disk->print_trace(); 1296 clusters[0][0]->signal_vci_tgt_disk.print_trace("[SIG]DISK_0_0"); 1297 clusters[0][0]->signal_vci_ini_disk.print_trace("[SIG]DISK_0_0"); 1253 1298 #endif 1254 1299
Note: See TracChangeset
for help on using the changeset viewer.