Changeset 6 for trunk/tools/arch_info/arch_classes.py
- Timestamp:
- Apr 26, 2017, 2:14:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/arch_info/arch_classes.py
r1 r6 13 13 # It handle 4 types of objects: clusters, cores, devices and irqs. 14 14 # - The number of cluster is variable (can be one). 15 # - The cluster topology can be a 2D mesh or a simpl aarray.15 # - The cluster topology can be a 2D mesh or a simple 1D array. 16 16 # - The number of cores per cluster is variable (can be zero). 17 17 # - The number of addressable devices per cluster is variable. … … 41 41 ######################################################################################### 42 42 # These arrays define the supported types of peripherals. 43 # They must be kept consistent with values defined in file arch_info.h.43 # They must be kept consistent with values defined in files arch_info.h & device.h. 44 44 ######################################################################################### 45 45 46 46 DEVICE_TYPES_STR = [ 47 'RAM', # 0 48 'DMA', # 1 49 'FBF', # 1 50 'IOB', # 3 51 'IOC_BDV', # 4 52 'IOC_HBA', # 5 53 'IOC_SDC', # 6 54 'IOC_SPI', # 7 55 'IOC_RDK', # 8 56 'MMC', # 9 57 'MWR_CPY', # 10 58 'MWR_GCD', # 11 59 'MWR_DCT', # 12 60 'NIC', # 13 61 'ROM', # 14 62 'SIM', # 15 63 'TIM', # 16 64 'TTY', # 17 65 'XCU', # 18 66 'PIC', # 19 67 'CMA', # 20 47 'RAM_SCL', # 0.0 48 'ROM_SCL', # 1.0 49 'FBF_SCL', # 2.0 50 'IOB_TSR', # 3.0 51 'IOC_BDV', # 4.0 52 'IOC_HBA', # 4.1 53 'IOC_SDC', # 4.2 54 'IOC_SPI', # 4.3 55 'IOC_RDK', # 4.4 56 'MMC_TSR', # 5.0 57 'DMA_SCL', # 6.0 58 'NIC_CBF', # 7.0 59 'TIM_SCL', # 8.0 60 'TXT_TTY', # 9.0 61 'ICU_XCU', # A.0 62 'PIC_TSR', # B.0 68 63 ] 69 64 70 65 DEVICE_TYPES_INT = [ 71 0x00000000, # 0 72 0x00010000, # 1 73 0x00020000, # 1 74 0x00030000, # 3 75 0x00040000, # 4 76 0x00040001, # 5 77 0x00040002, # 6 78 0x00040003, # 7 79 0x00040004, # 8 80 0x00050000, # 9 81 0x00060000, # 10 82 0x00060001, # 11 83 0x00060002, # 12 84 0x00070000, # 13 85 0x00080000, # 14 86 0x00090000, # 15 87 0x000A0000, # 16 88 0x000B0000, # 17 89 0x000C0000, # 18 90 0x000D0000, # 19 91 0x000E0000, # 20 66 0x00000000, # 0.0 67 0x00010000, # 1.0 68 0x00020000, # 1.0 69 0x00030000, # 3.0 70 0x00040000, # 4.0 71 0x00040001, # 4.1 72 0x00040002, # 4.2 73 0x00040003, # 4.3 74 0x00040004, # 4.4 75 0x00050000, # 5.0 76 0x00060000, # 6.0 77 0x00070000, # 7.0 78 0x00080000, # 8.0 79 0x00090000, # 9.0 80 0x000A0000, # A.0 81 0x000B0000, # B.0 92 82 ] 93 83 … … 104 94 x_width, # number of bits for x coordinate 105 95 y_width, # number of bits for y coordinate 106 irqs_per_core, # number or IRQs from XCU to one core96 irqs_per_core, # number or IRQs from ICU to one core 107 97 io_cxy, # IO cluster identifier 108 98 boot_cxy, # boot cluster identifier … … 186 176 ################################ add an input IRQ in a device 187 177 def addIrq( self, 188 dstdev, # destination device (PIC or XCU)178 dstdev, # destination device (PIC or ICU) 189 179 port, # input IRQ port index 190 180 srcdev, # source device … … 192 182 is_rx = False ): # I/O operation direction 193 183 194 assert (dstdev.ptype == ' XCU') or (dstdev.ptype == 'PIC')184 assert (dstdev.ptype == 'ICU_XCU') or (dstdev.ptype == 'PIC_TSR') 195 185 assert (port < dstdev.arg0) 196 186 … … 382 372 ram_size = 0 383 373 384 nb_cma = 0 385 cma_channels = 0 386 cma_base = 0xFFFFFFFFFFFFFFFF 387 cma_size = 0 388 389 nb_dma = 0 390 dma_channels = 0 391 dma_base = 0xFFFFFFFFFFFFFFFF 392 dma_size = 0 374 nb_rom = 0 375 rom_channels = 0 376 rom_base = 0xFFFFFFFFFFFFFFFF 377 rom_size = 0 393 378 394 379 nb_fbf = 0 … … 419 404 mmc_size = 0 420 405 421 nb_mwr = 0 422 mwr_channels = 0 423 mwr_base = 0xFFFFFFFFFFFFFFFF 424 mwr_size = 0 425 mwr_arg0 = 0 426 mwr_arg1 = 0 427 mwr_arg2 = 0 428 mwr_arg3 = 0 429 use_mwr_gcd = False 430 use_mwr_dct = False 431 use_mwr_cpy = False 406 nb_dma = 0 407 dma_channels = 0 408 dma_base = 0xFFFFFFFFFFFFFFFF 409 dma_size = 0 432 410 433 411 nb_nic = 0 … … 436 414 nic_size = 0 437 415 416 nb_sim = 0 417 sim_channels = 0 418 sim_base = 0xFFFFFFFFFFFFFFFF 419 sim_size = 0 420 421 nb_tim = 0 422 tim_channels = 0 423 tim_base = 0xFFFFFFFFFFFFFFFF 424 tim_size = 0 425 426 nb_txt = 0 427 txt_channels = 0 428 txt_base = 0xFFFFFFFFFFFFFFFF 429 txt_size = 0 430 431 nb_icu = 0 432 icu_channels = 0 433 icu_base = 0xFFFFFFFFFFFFFFFF 434 icu_size = 0 435 icu_arg0 = 0 436 438 437 nb_pic = 0 439 438 pic_channels = 0 … … 441 440 pic_size = 0 442 441 443 nb_rom = 0 444 rom_channels = 0 445 rom_base = 0xFFFFFFFFFFFFFFFF 446 rom_size = 0 447 448 nb_sim = 0 449 sim_channels = 0 450 sim_base = 0xFFFFFFFFFFFFFFFF 451 sim_size = 0 452 453 nb_tim = 0 454 tim_channels = 0 455 tim_base = 0xFFFFFFFFFFFFFFFF 456 tim_size = 0 457 458 nb_tty = 0 459 tty_channels = 0 460 tty_base = 0xFFFFFFFFFFFFFFFF 461 tty_size = 0 462 463 nb_xcu = 0 464 xcu_channels = 0 465 xcu_base = 0xFFFFFFFFFFFFFFFF 466 xcu_size = 0 467 xcu_arg0 = 0 468 469 nb_drom = 0 470 drom_channels = 0 471 drom_base = 0xFFFFFFFFFFFFFFFF 472 drom_size = 0 442 nb_rom = 0 443 rom_channels = 0 444 rom_base = 0xFFFFFFFFFFFFFFFF 445 rom_size = 0 473 446 474 447 # get devices attributes … … 476 449 for device in cluster.devices: 477 450 478 if ( device.ptype == 'RAM ' ):451 if ( device.ptype == 'RAM_SCL' ): 479 452 ram_base = device.base 480 453 ram_size = device.size … … 482 455 nb_ram +=1 483 456 484 elif ( device.ptype == 'CMA' ): 485 cma_base = device.base 486 cma_size = device.size 487 cma_channels = device.channels 488 nb_cma +=1 489 490 elif ( device.ptype == 'DMA' ): 491 dma_base = device.base 492 dma_size = device.size 493 dma_channels = device.channels 494 nb_dma +=1 495 496 elif ( device.ptype == 'FBF' ): 457 elif ( device.ptype == 'ROM_SCL' ): 458 rom_base = device.base 459 rom_size = device.size 460 rom_channels = device.channels 461 nb_rom +=1 462 463 elif ( device.ptype == 'FBF_SCL' ): 497 464 fbf_base = device.base 498 465 fbf_size = device.size … … 502 469 nb_fbf +=1 503 470 504 elif ( device.ptype == 'IOB ' ):471 elif ( device.ptype == 'IOB_TSR' ): 505 472 iob_base = device.base 506 473 iob_size = device.size … … 532 499 use_ioc_spi = True 533 500 nb_ioc += 1 534 535 501 elif ( device.ptype == 'IOC_RDK' ): 536 502 ioc_base = device.base … … 540 506 nb_ioc += 1 541 507 542 elif ( device.ptype == 'MMC ' ):508 elif ( device.ptype == 'MMC_TSR' ): 543 509 mmc_base = device.base 544 510 mmc_size = device.size … … 546 512 nb_mmc +=1 547 513 548 elif ( device.ptype == 'MWR_GCD' ): 549 mwr_base = device.base 550 mwr_size = device.size 551 mwr_channels = device.channels 552 mwr_arg0 = device.arg0 553 mwr_arg1 = device.arg1 554 mwr_arg2 = device.arg2 555 mwr_arg3 = device.arg3 556 use_mwr_gcd = True 557 nb_mwr +=1 558 elif ( device.ptype == 'MWR_DCT' ): 559 mwr_base = device.base 560 mwr_size = device.size 561 mwr_channels = device.channels 562 mwr_arg0 = device.arg0 563 mwr_arg1 = device.arg1 564 mwr_arg2 = device.arg2 565 mwr_arg3 = device.arg3 566 use_mwr_dct = True 567 nb_mwr +=1 568 elif ( device.ptype == 'MWR_CPY' ): 569 mwr_base = device.base 570 mwr_size = device.size 571 mwr_channels = device.channels 572 mwr_arg0 = device.arg0 573 mwr_arg1 = device.arg1 574 mwr_arg2 = device.arg2 575 mwr_arg3 = device.arg3 576 use_mwr_cpy = True 577 nb_mwr +=1 578 579 elif ( device.ptype == 'ROM' ): 580 rom_base = device.base 581 rom_size = device.size 582 rom_channels = device.channels 583 nb_rom +=1 584 585 elif ( device.ptype == 'DROM' ): 586 drom_base = device.base 587 drom_size = device.size 588 drom_channels = device.channels 589 nb_drom +=1 590 591 elif ( device.ptype == 'SIM' ): 592 sim_base = device.base 593 sim_size = device.size 594 sim_channels = device.channels 595 nb_sim +=1 596 597 elif ( device.ptype == 'NIC' ): 514 elif ( device.ptype == 'DMA_SCL' ): 515 dma_base = device.base 516 dma_size = device.size 517 dma_channels = device.channels 518 nb_dma +=1 519 520 elif ( device.ptype == 'NIC_CBF' ): 598 521 nic_base = device.base 599 522 nic_size = device.size … … 601 524 nb_nic +=1 602 525 603 elif ( device.ptype == 'PIC' ): 526 elif ( device.ptype == 'TIM_SCL' ): 527 tim_base = device.pseg.base 528 tim_size = device.pseg.size 529 tim_channels = device.channels 530 nb_tim +=1 531 532 elif ( device.ptype == 'TXT_TTY' ): 533 txt_base = device.base 534 txt_size = device.size 535 txt_channels = device.channels 536 nb_txt +=1 537 538 elif ( device.ptype == 'ICU_XCU' ): 539 icu_base = device.base 540 icu_size = device.size 541 icu_channels = device.channels 542 icu_arg0 = device.arg0 543 icu_arg1 = device.arg1 544 icu_arg2 = device.arg2 545 icu_arg3 = device.arg3 546 nb_icu +=1 547 548 elif ( device.ptype == 'PIC_TSR' ): 604 549 pic_base = device.base 605 550 pic_size = device.size 606 551 pic_channels = device.channels 607 552 nb_pic +=1 608 609 elif ( device.ptype == 'TIM' ):610 tim_base = device.pseg.base611 tim_size = device.pseg.size612 tim_channels = device.channels613 nb_tim +=1614 615 elif ( device.ptype == 'TTY' ):616 tty_base = device.base617 tty_size = device.size618 tty_channels = device.channels619 nb_tty +=1620 621 elif ( device.ptype == 'XCU' ):622 xcu_base = device.base623 xcu_size = device.size624 xcu_channels = device.channels625 xcu_arg0 = device.arg0626 xcu_arg1 = device.arg1627 xcu_arg2 = device.arg2628 nb_xcu +=1629 630 # no more than two access to external devices631 assert ( nb_fbf <= 2 )632 assert ( nb_cma <= 2 )633 assert ( nb_ioc <= 2 )634 assert ( nb_nic <= 2 )635 assert ( nb_tim <= 2 )636 assert ( nb_tty <= 2 )637 assert ( nb_pic <= 2 )638 553 639 554 # one and only one IOC controller … … 647 562 rdk_base = 0 648 563 rdk_size = 0 649 650 # only one type of MWR controller651 nb_mwr_types = 0652 if use_mwr_gcd: nb_mwr_types += 1653 if use_mwr_dct: nb_mwr_types += 1654 if use_mwr_cpy: nb_mwr_types += 1655 if ( nb_mwr > 0 ) : assert ( nb_mwr_types == 1 )656 564 657 565 # Compute total number of cores, devices and irqs … … 697 605 s += '/* Peripherals */\n' 698 606 s += '\n' 699 s += '#define NB_T TY_CHANNELS %d\n' % tty_channels607 s += '#define NB_TXT_CHANNELS %d\n' % txt_channels 700 608 s += '#define NB_IOC_CHANNELS %d\n' % ioc_channels 701 609 s += '#define NB_NIC_CHANNELS %d\n' % nic_channels 702 s += '#define NB_CMA_CHANNELS %d\n' % cma_channels703 610 s += '#define NB_TIM_CHANNELS %d\n' % tim_channels 704 s += '#define NB_DMA_CHANNELS %d\n' % dma_channels 705 s += '\n' 706 s += '#define USE_XCU %d\n' % ( nb_xcu != 0 ) 707 s += '#define USE_DMA %d\n' % ( nb_dma != 0 ) 708 s += '\n' 611 s += '\n' 612 s += '#define USE_ICU %d\n' % ( nb_icu != 0 ) 709 613 s += '#define USE_IOB %d\n' % ( nb_iob != 0 ) 710 614 s += '#define USE_PIC %d\n' % ( nb_pic != 0 ) 711 615 s += '#define USE_FBF %d\n' % ( nb_fbf != 0 ) 712 616 s += '#define USE_NIC %d\n' % ( nb_nic != 0 ) 617 s += '#define USE_DMA %d\n' % ( nb_dma != 0 ) 713 618 s += '\n' 714 619 s += '#define USE_IOC_BDV %d\n' % use_ioc_bdv … … 718 623 s += '#define USE_IOC_RDK %d\n' % use_ioc_rdk 719 624 s += '\n' 720 s += '#define USE_MWR_GCD %d\n' % use_mwr_gcd721 s += '#define USE_MWR_DCT %d\n' % use_mwr_dct722 s += '#define USE_MWR_CPY %d\n' % use_mwr_cpy723 s += '\n'724 625 s += '#define FBUF_X_SIZE %d\n' % fbf_arg0 725 626 s += '#define FBUF_Y_SIZE %d\n' % fbf_arg1 726 627 s += '\n' 727 s += '#define XCU_NB_HWI %d\n' % xcu_arg0 728 s += '#define XCU_NB_PTI %d\n' % xcu_arg1 729 s += '#define XCU_NB_WTI %d\n' % xcu_arg2 730 s += '#define XCU_NB_OUT %d\n' % xcu_channels 731 s += '\n' 732 s += '#define MWR_TO_COPROC %d\n' % mwr_arg0 733 s += '#define MWR_FROM_COPROC %d\n' % mwr_arg1 734 s += '#define MWR_CONFIG %d\n' % mwr_arg2 735 s += '#define MWR_STATUS %d\n' % mwr_arg3 628 s += '#define ICU_NB_HWI %d\n' % icu_arg0 629 s += '#define ICU_NB_PTI %d\n' % icu_arg1 630 s += '#define ICU_NB_WTI %d\n' % icu_arg2 631 s += '#define ICU_NB_OUT %d\n' % icu_arg3 736 632 s += '\n' 737 633 … … 741 637 s += '#define SEG_RAM_SIZE 0x%x\n' % ram_size 742 638 s += '\n' 743 s += '#define SEG_CMA_BASE 0x%x\n' % (cma_base & local_physical_mask) 744 s += '#define SEG_CMA_SIZE 0x%x\n' % cma_size 639 s += '#define SEG_FBF_BASE 0x%x\n' % (fbf_base & local_physical_mask) 640 s += '#define SEG_FBF_SIZE 0x%x\n' % fbf_size 641 s += '\n' 642 s += '#define SEG_IOB_BASE 0x%x\n' % (iob_base & local_physical_mask) 643 s += '#define SEG_IOB_SIZE 0x%x\n' % iob_size 644 s += '\n' 645 s += '#define SEG_IOC_BASE 0x%x\n' % (ioc_base & local_physical_mask) 646 s += '#define SEG_IOC_SIZE 0x%x\n' % ioc_size 647 s += '\n' 648 s += '#define SEG_MMC_BASE 0x%x\n' % (mmc_base & local_physical_mask) 649 s += '#define SEG_MMC_SIZE 0x%x\n' % mmc_size 745 650 s += '\n' 746 651 s += '#define SEG_DMA_BASE 0x%x\n' % (dma_base & local_physical_mask) 747 652 s += '#define SEG_DMA_SIZE 0x%x\n' % dma_size 748 653 s += '\n' 749 s += '#define SEG_FBF_BASE 0x%x\n' % (fbf_base & local_physical_mask)750 s += '#define SEG_FBF_SIZE 0x%x\n' % fbf_size751 s += '\n'752 s += '#define SEG_IOB_BASE 0x%x\n' % (iob_base & local_physical_mask)753 s += '#define SEG_IOB_SIZE 0x%x\n' % iob_size754 s += '\n'755 s += '#define SEG_IOC_BASE 0x%x\n' % (ioc_base & local_physical_mask)756 s += '#define SEG_IOC_SIZE 0x%x\n' % ioc_size757 s += '\n'758 s += '#define SEG_MMC_BASE 0x%x\n' % (mmc_base & local_physical_mask)759 s += '#define SEG_MMC_SIZE 0x%x\n' % mmc_size760 s += '\n'761 s += '#define SEG_MWR_BASE 0x%x\n' % (mwr_base & local_physical_mask)762 s += '#define SEG_MWR_SIZE 0x%x\n' % mwr_size763 s += '\n'764 654 s += '#define SEG_ROM_BASE 0x%x\n' % (rom_base & local_physical_mask) 765 655 s += '#define SEG_ROM_SIZE 0x%x\n' % rom_size … … 777 667 s += '#define SEG_TIM_SIZE 0x%x\n' % tim_size 778 668 s += '\n' 779 s += '#define SEG_T TY_BASE 0x%x\n' % (tty_base & local_physical_mask)780 s += '#define SEG_T TY_SIZE 0x%x\n' % tty_size781 s += '\n' 782 s += '#define SEG_ XCU_BASE 0x%x\n' % (xcu_base & local_physical_mask)783 s += '#define SEG_ XCU_SIZE 0x%x\n' % xcu_size669 s += '#define SEG_TXT_BASE 0x%x\n' % (txt_base & local_physical_mask) 670 s += '#define SEG_TXT_SIZE 0x%x\n' % txt_size 671 s += '\n' 672 s += '#define SEG_ICU_BASE 0x%x\n' % (icu_base & local_physical_mask) 673 s += '#define SEG_ICU_SIZE 0x%x\n' % icu_size 784 674 s += '\n' 785 675 s += '#define SEG_RDK_BASE 0x%x\n' % (rdk_base & local_physical_mask) 786 676 s += '#define SEG_RDK_SIZE 0x%x\n' % rdk_size 787 s += '\n'788 s += '#define SEG_DROM_BASE 0x%x\n' % (drom_base & local_physical_mask)789 s += '#define SEG_DROM_SIZE 0x%x\n' % drom_size790 677 s += '\n' 791 678 s += '#endif\n' … … 931 818 self.arg2 = arg2 # optional (semantic depends on ptype) 932 819 self.arg3 = arg3 # optional (semantic depends on ptype) 933 self.irqs = [] # set of input IRQs (for PIC and XCU only)820 self.irqs = [] # set of input IRQs (for PIC and ICU only) 934 821 self.irq_ctrl = None # interrupt controller for this device 935 822 return … … 946 833 s += ' arg2="%d"' % self.arg2 947 834 s += ' arg3="%d"' % self.arg3 948 if ( (self.ptype == 'PIC ') or (self.ptype == 'XCU') ):835 if ( (self.ptype == 'PIC_TSR') or (self.ptype == 'ICU_XCU') ): 949 836 s += ' >\n' 950 837 for irq in self.irqs: s += irq.xml() … … 958 845 959 846 if ( verbose ): 960 print '*** cbin for device[%d] / type %s' \961 % (self.index , self.ptype )847 print '*** cbin for device[%d] / type = %s / base = %x' \ 848 % (self.index , self.ptype , self.base) 962 849 963 850 # check index … … 985 872 986 873 byte_stream = bytearray() 987 byte_stream += mapping.int2bytes(4,ptype_id) # device type988 874 byte_stream += mapping.int2bytes(8,self.base) # segment base address 989 875 byte_stream += mapping.int2bytes(8,self.size) # segment size 876 byte_stream += mapping.int2bytes(4,ptype_id) # device type 990 877 byte_stream += mapping.int2bytes(4,self.channels) # number of channels 991 878 byte_stream += mapping.int2bytes(4,self.arg0) # optionnal arg0 … … 997 884 998 885 if ( verbose ): 999 print 'ptype = %d' % ptype_id1000 886 print 'base = %x' % self.base 1001 887 print 'size = %x' % self.size … … 1034 920 1035 921 if ( verbose ): 1036 print '*** cbin for irq[%d] / type= %s' \1037 % (self. index , self.isrtype)922 print '*** cbin for irq[%d] / src_dev = %s' \ 923 % (self.port , self.dev.ptype) 1038 924 1039 925 # check index … … 1041 927 print '[genarch error] in Irq.cbin()' 1042 928 print ' irq global index = %d / expected = %d' \ 1043 % (self.index ,expected)929 % (self.index , expected) 1044 930 sys.exit(1) 1045 931
Note: See TracChangeset
for help on using the changeset viewer.