Changeset 348
- Timestamp:
- Jun 29, 2014, 12:31:06 PM (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
soft/giet_vm/giet_python/mapping.py
r341 r348 335 335 ############################ add one (or several) global vseg into mapping 336 336 def addGlobal( self, 337 name, # vseg name 338 vbase, # virtual base address 339 size, # vobj length (bytes) 340 mode, # CXWU flags 341 vtype, # vobj type 342 x, # destination x coordinate 343 y, # destination y coordinate 344 pseg, # destination pseg name 345 identity = False, # identity mapping required if true 346 binpath = '' ): # pathname for binary code 337 name, # vseg name 338 vbase, # virtual base address 339 size, # vobj length (bytes) 340 mode, # CXWU flags 341 vtype, # vobj type 342 x, # destination x coordinate 343 y, # destination y coordinate 344 pseg, # destination pseg name 345 identity = False, # identity mapping required if true 346 binpath = '', # pathname for binary code 347 local = False ): # non shared vseg when true 347 348 348 349 assert mode in VSEGMODES … … 355 356 356 357 # add one vseg into mapping 357 vseg = Vseg( name, vbase, mode, x, y, pseg, identity ) 358 vseg = Vseg( name, vbase, mode, x, y, pseg, 359 identity = identity, local = local ) 360 358 361 self.globs.append( vseg ) 359 362 self.total_globals += 1 … … 393 396 y, # destination y coordinate 394 397 pseg, # destination pseg name 395 binpath = '', # pathname for binary code 396 align = 0, # alignment required 397 init = 0 ): # initial value 398 binpath = '', # pathname for binary code 399 align = 0, # alignment required 400 init = 0, # initial value 401 local = False ): # non shared when true 398 402 399 403 assert mode in VSEGMODES … … 404 408 405 409 # add one vseg into mapping 406 vseg = Vseg( name, vbase, mode, x, y, pseg )410 vseg = Vseg( name, vbase, mode, x, y, pseg, local = local ) 407 411 vspace.vsegs.append( vseg ) 408 412 vseg.index = self.total_vsegs … … 478 482 byte_stream.append( '\0' ) 479 483 else: 480 print ' error in str2bytes()string %s too long' % s484 print '[genmap error] in str2bytes() : string %s too long' % s 481 485 sys.exit(1) 482 486 … … 700 704 kernel_init_found = False 701 705 for vseg in self.globs: 706 702 707 if ( vseg.name == 'seg_boot_code' ): 703 708 boot_code_vbase = vseg.vbase … … 732 737 # check if all required vsegs have been found 733 738 if ( boot_code_found == False ): 734 print ' errorin giet_vsegs() : seg_boot_code vseg missing'739 print '[genmap error] in giet_vsegs() : seg_boot_code vseg missing' 735 740 sys.exit() 736 741 737 742 if ( boot_data_found == False ): 738 print ' errorin giet_vsegs() : seg_boot_data vseg missing'743 print '[genmap error] in giet_vsegs() : seg_boot_data vseg missing' 739 744 sys.exit() 740 745 741 746 if ( kernel_data_found == False ): 742 print ' errorin giet_vsegs() : seg_kernel_data vseg missing'747 print '[genmap error] in giet_vsegs() : seg_kernel_data vseg missing' 743 748 sys.exit() 744 749 745 750 if ( kernel_uncdata_found == False ): 746 print ' errorin giet_vsegs() : seg_kernel_uncdata vseg missing'751 print '[genmap error] in giet_vsegs() : seg_kernel_uncdata vseg missing' 747 752 sys.exit() 748 753 749 754 if ( kernel_code_found == False ): 750 print ' error in giet_vsegs() : seg_kernel_datavseg missing'755 print '[genmap error] in giet_vsegs() : seg_kernel_code vseg missing' 751 756 sys.exit() 752 757 753 758 if ( kernel_init_found == False ): 754 print ' errorin giet_vsegs() : seg_kernel_init vseg missing'759 print '[genmap error] in giet_vsegs() : seg_kernel_init vseg missing' 755 760 sys.exit() 756 761 … … 1002 1007 boot_mapping_base = vseg.vbase 1003 1008 boot_mapping_size = vseg.vobjs[0].length 1004 boot_mapping_ident = vseg.ident1009 boot_mapping_identity = vseg.identity 1005 1010 boot_mapping_found = True 1006 1011 … … 1008 1013 boot_code_base = vseg.vbase 1009 1014 boot_code_size = vseg.vobjs[0].length 1010 boot_code_ident = vseg.ident1015 boot_code_identity = vseg.identity 1011 1016 boot_code_found = True 1012 1017 … … 1014 1019 boot_data_base = vseg.vbase 1015 1020 boot_data_size = vseg.vobjs[0].length 1016 boot_data_ident = vseg.ident1021 boot_data_identity = vseg.identity 1017 1022 boot_data_found = True 1018 1023 … … 1020 1025 boot_buffer_base = vseg.vbase 1021 1026 boot_buffer_size = vseg.vobjs[0].length 1022 boot_buffer_ident = vseg.ident1027 boot_buffer_identity = vseg.identity 1023 1028 boot_buffer_found = True 1024 1029 … … 1026 1031 boot_stack_base = vseg.vbase 1027 1032 boot_stack_size = vseg.vobjs[0].length 1028 boot_stack_ident = vseg.ident1033 boot_stack_identity = vseg.identity 1029 1034 boot_stack_found = True 1030 1035 1031 1036 # check that BOOT vsegs are found and identity mapping 1032 if ( (boot_mapping_found == False) or (boot_mapping_ident == False) ):1033 print ' errorin hard_config() : seg_boot_mapping missing or not ident'1037 if ( (boot_mapping_found == False) or (boot_mapping_identity == False) ): 1038 print '[genmap error] in hard_config() : seg_boot_mapping missing or not ident' 1034 1039 sys.exit() 1035 1040 1036 if ( (boot_code_found == False) or (boot_code_ident == False) ):1037 print ' errorin hard_config() : seg_boot_code missing or not ident'1041 if ( (boot_code_found == False) or (boot_code_identity == False) ): 1042 print '[genmap error] in hard_config() : seg_boot_code missing or not ident' 1038 1043 sys.exit() 1039 1044 1040 if ( (boot_data_found == False) or (boot_data_ident == False) ):1041 print ' errorin hard_config() : seg_boot_data missing or not ident'1045 if ( (boot_data_found == False) or (boot_data_identity == False) ): 1046 print '[genmap error] in hard_config() : seg_boot_data missing or not ident' 1042 1047 sys.exit() 1043 1048 1044 if ( (boot_buffer_found == False) or (boot_buffer_ident == False) ):1045 print ' errorin hard_config() : seg_boot_buffer missing or not ident'1049 if ( (boot_buffer_found == False) or (boot_buffer_identity == False) ): 1050 print '[genmap error] in hard_config() : seg_boot_buffer missing or not ident' 1046 1051 sys.exit() 1047 1052 1048 if ( (boot_stack_found == False) or (boot_stack_ident == False) ):1049 print ' errorin giet_vsegs() : seg_boot_stack missing or not ident'1053 if ( (boot_stack_found == False) or (boot_stack_identity == False) ): 1054 print '[genmap error] in giet_vsegs() : seg_boot_stack missing or not ident' 1050 1055 sys.exit() 1051 1056 … … 1285 1290 1286 1291 if ( (found_xcu == False) and (found_pic == False) and (len(cluster.periphs) > 0) ): 1287 print ' errorin netbsd_dts() : No XCU/PIC in cluster(%d,%d)' % (cluster.x, cluster.y)1292 print '[genmap error] in netbsd_dts() : No XCU/PIC in cluster(%d,%d)' % (cluster.x, cluster.y) 1288 1293 sys.exit(1) 1289 1294 … … 1312 1317 hwi_id = irq.srcid 1313 1318 if ( hwi_id == 0xFFFFFFFF ): 1314 print ' errorin netbsd.dts() ISR_DMA channel %d not found' % channel1319 print '[genmap error] in netbsd.dts() ISR_DMA channel %d not found' % channel 1315 1320 sys.exit(1) 1316 1321 … … 1333 1338 if ( irq.isrtype == 'ISR_MMC' ): irq_in = irq.srcid 1334 1339 if ( irq_in == 0xFFFFFFFF ): 1335 print ' errorin netbsd.dts() ISR_MMC not found'1340 print '[genmap error] in netbsd.dts() ISR_MMC not found' 1336 1341 sys.exit(1) 1337 1342 … … 1363 1368 if ( irq.isrtype == 'ISR_BDV' ): irq_in = irq.srcid 1364 1369 if ( irq_in == 0xFFFFFFFF ): 1365 print ' errorin netbsd.dts() ISR_BDV not found'1370 print '[genmap error] in netbsd.dts() ISR_BDV not found' 1366 1371 sys.exit(1) 1367 1372 … … 1373 1378 1374 1379 elif ( periph.subtype == 'HBA' ): 1375 print ' errorin netbsd_dts() : HBA peripheral not supported by NetBSD'1380 print '[genmap error] in netbsd_dts() : HBA peripheral not supported by NetBSD' 1376 1381 sys.exit(1) 1377 1382 … … 1383 1388 if ( irq.isrtype == 'ISR_SPI' ): irq_in = irq.srcid 1384 1389 if ( irq_in == 0xFFFFFFFF ): 1385 print ' errorin netbsd.dts() ISR_SPI not found'1390 print '[genmap error] in netbsd.dts() ISR_SPI not found' 1386 1391 sys.exit(1) 1387 1392 … … 1424 1429 hwi_id = irq.srcid 1425 1430 if ( hwi_id == 0xFFFFFFFF ): 1426 print ' errorin netbsd.dts() ISR_TTY_RX channel %d not found' % channel1431 print '[genmap error] in netbsd.dts() ISR_TTY_RX channel %d not found' % channel 1427 1432 sys.exit(1) 1428 1433 … … 1461 1466 hwi_id = irq.srcid 1462 1467 if ( hwi_id == 0xFFFFFFFF ): 1463 print ' errorin netbsd.dts() ISR_NIC_RX channel %d not found' % channel1468 print '[genmap error] in netbsd.dts() ISR_NIC_RX channel %d not found' % channel 1464 1469 sys.exit(1) 1465 1470 … … 1477 1482 hwi_id = irq.srcid 1478 1483 if ( hwi_id == 0xFFFFFFFF ): 1479 print ' errorin netbsd.dts() ISR_NIC_TX channel %d not found' % channel1484 print '[genmap error] in netbsd.dts() ISR_NIC_TX channel %d not found' % channel 1480 1485 sys.exit(1) 1481 1486 … … 1505 1510 hwi_id = irq.srcid 1506 1511 if ( hwi_id == 0xFFFFFFFF ): 1507 print ' errorin netbsd.dts() ISR_CMA channel %d not found' % channel1512 print '[genmap error] in netbsd.dts() ISR_CMA channel %d not found' % channel 1508 1513 sys.exit(1) 1509 1514 … … 1521 1526 elif ( periph.ptype == 'TIM' ): 1522 1527 1523 print ' errorin netbsd_dts() : TIM peripheral not supported by NetBSD'1528 print '[genmap error] in netbsd_dts() : TIM peripheral not supported by NetBSD' 1524 1529 sys.exit(1) 1525 1530 … … 1527 1532 elif ( periph.ptype == 'MWR' ): 1528 1533 1529 print ' errorin netbsd_dts() : MWR peripheral not supported by NetBSD'1534 print '[genmap error] in netbsd_dts() : MWR peripheral not supported by NetBSD' 1530 1535 sys.exit(1) 1531 1536 1532 1537 # research ICU component 1533 1538 elif ( periph.ptype == 'ICU' ): 1534 print ' errorin netbsd_dts() : ICU peripheral not supported by NetBSD'1539 print '[genmap error] in netbsd_dts() : ICU peripheral not supported by NetBSD' 1535 1540 sys.exit(1) 1536 1541 … … 1714 1719 # check index 1715 1720 if (self.index != expected): 1716 print ' errorin Cluster.cbin() : cluster global index = %d / expected = %d' \1721 print '[genmap error] in Cluster.cbin() : cluster global index = %d / expected = %d' \ 1717 1722 % (self.index, expected ) 1718 1723 sys.exit(1) … … 1799 1804 # check index 1800 1805 if (self.index != expected): 1801 print ' errorin Vspace.cbin() : vspace global index = %d / expected = %d' \1806 print '[genmap error] in Vspace.cbin() : vspace global index = %d / expected = %d' \ 1802 1807 % (self.index, expected ) 1803 1808 sys.exit(1) … … 1809 1814 vobj_start_id = vseg.vobjs[0].index 1810 1815 if ( vobj_start_id == 0xFFFFFFFF ): 1811 print ' errorin Vspace.cbin() : startname %s not found for vspace %s' \1816 print '[genmap error] in Vspace.cbin() : startname %s not found for vspace %s' \ 1812 1817 % ( self.startname, self.name ) 1813 1818 sys.exit(1) … … 1908 1913 # check index 1909 1914 if (self.index != expected): 1910 print ' errorin Task.cbin() : task global index = %d / expected = %d' \1915 print '[genmap error] in Task.cbin() : task global index = %d / expected = %d' \ 1911 1916 % (self.index, expected ) 1912 1917 sys.exit(1) … … 1921 1926 vobj_stack_id = vseg.vobjs[0].index 1922 1927 if ( vobj_stack_id == 0xFFFFFFFF ): 1923 print ' errorin Task.cbin() : stackname %s not found for task %s in vspace %s' \1928 print '[genmap error] in Task.cbin() : stackname %s not found for task %s in vspace %s' \ 1924 1929 % ( self.stackname, self.name, vspace.name ) 1925 1930 sys.exit(1) … … 1931 1936 vobj_heap_id = vseg.vobjs[0].index 1932 1937 if ( vobj_heap_id == 0xFFFFFFFF ): 1933 print ' errorin Task.cbin() : heapname %s not found for task %s in vspace %s' \1938 print '[genmap error] in Task.cbin() : heapname %s not found for task %s in vspace %s' \ 1934 1939 % ( self.heapname, self.name, vspace.name ) 1935 1940 sys.exit(1) … … 1969 1974 y, 1970 1975 psegname, 1971 ident = False ): 1976 identity = False, 1977 local = False ): 1972 1978 1973 1979 assert mode in VSEGMODES 1974 1980 1975 self.index = 0 # global index ( set by addVseg() ) 1976 self.name = name # vseg name 1977 self.vbase = vbase & 0xFFFFFFFF # virtual base address in vspace 1978 self.mode = mode # CXWU access rights 1979 self.x = x # x coordinate of destination cluster 1980 self.y = y # y coordinate of destination cluster 1981 self.psegname = psegname # name of pseg in destination cluster 1982 self.ident = ident # identity mapping required 1983 self.vobjs = [] 1981 self.index = 0 # global index ( set by addVseg() ) 1982 self.name = name # vseg name 1983 self.vbase = vbase & 0xFFFFFFFF # virtual base address in vspace 1984 self.mode = mode # CXWU access rights 1985 self.x = x # x coordinate of destination cluster 1986 self.y = y # y coordinate of destination cluster 1987 self.psegname = psegname # name of pseg in destination cluster 1988 self.identity = identity # identity mapping required 1989 self.local = local # one copy per cluster 1990 self.vobjs = [] 1984 1991 return 1985 1992 … … 1989 1996 s = ' <vseg name="%s" vbase="0x%x" mode="%s" x="%d" y="%d" psegname="%s"' \ 1990 1997 % ( self.name, self.vbase, self.mode, self.x, self.y, self.psegname ) 1991 if ( self.ident ): s += ' ident="1" >\n' 1992 else: s += ' >\n' 1993 for vobj in self.vobjs: s += vobj.xml() 1998 if ( self.identity ): s += ' ident="1"' 1999 if ( self.local ): s += ' local="1"' 2000 s += ' >\n' 2001 for vobj in self.vobjs: s += vobj.xml() 1994 2002 s += ' </vseg>\n' 1995 2003 … … 2004 2012 # check index 2005 2013 if (self.index != expected): 2006 print ' errorin Vseg.cbin() : vseg global index = %d / expected = %d' \2014 print '[genmap error] in Vseg.cbin() : vseg global index = %d / expected = %d' \ 2007 2015 % (self.index, expected ) 2008 2016 sys.exit(1) … … 2016 2024 pseg_id = pseg.index 2017 2025 if (pseg_id == 0xFFFFFFFF): 2018 print ' errorin Vseg.cbin() : psegname %s not found for vseg %s in cluster %d' \2026 print '[genmap error] in Vseg.cbin() : psegname %s not found for vseg %s in cluster %d' \ 2019 2027 % ( self.psegname, self.name, cluster_id ) 2020 2028 sys.exit(1) … … 2026 2034 mode_id = x 2027 2035 if ( mode_id == 0xFFFFFFFF ): 2028 print ' errorin Vseg.cbin() : undefined vseg mode %s' % self.mode2036 print '[genmap error] in Vseg.cbin() : undefined vseg mode %s' % self.mode 2029 2037 sys.exit(1) 2030 2038 … … 2043 2051 byte_stream += mapping.int2bytes( 4, 0 ) # linked list of vsegs on same pseg 2044 2052 byte_stream += mapping.int2bytes( 1, 0 ) # mapped when non zero 2045 byte_stream += mapping.int2bytes( 1, self.ident ) # identity mapping when non zero 2046 byte_stream += mapping.int2bytes( 2, 0 ) # reserved (padding) 2053 byte_stream += mapping.int2bytes( 1, self.identity ) # identity mapping when non zero 2054 byte_stream += mapping.int2bytes( 1, self.local ) # non shared if non zero 2055 byte_stream += mapping.int2bytes( 1, 0 ) # reserved (padding) 2047 2056 2048 2057 if ( verbose ): … … 2098 2107 # check index 2099 2108 if (self.index != expected): 2100 print ' errorin Vobj.cbin() : vobj global index = %d / expected = %d' \2109 print '[genmap error] in Vobj.cbin() : vobj global index = %d / expected = %d' \ 2101 2110 % (self.index, expected ) 2102 2111 sys.exit(1) … … 2110 2119 vtype_int = x 2111 2120 if ( vtype_int == 0xFFFFFFFF ): 2112 print ' errorin Vobj.cbin() : undefined vobj type %s' % self.vtype2121 print '[genmap error] in Vobj.cbin() : undefined vobj type %s' % self.vtype 2113 2122 sys.exit(1) 2114 2123 … … 2157 2166 # check index 2158 2167 if (self.index != expected): 2159 print ' errorin Proc.cbin() : proc global index = %d / expected = %d' \2168 print '[genmap error] in Proc.cbin() : proc global index = %d / expected = %d' \ 2160 2169 % (self.index, expected ) 2161 2170 sys.exit(1) … … 2204 2213 # check index 2205 2214 if (self.index != expected): 2206 print ' errorin Pseg.cbin() : pseg global index = %d / expected = %d' \2215 print '[genmap error] in Pseg.cbin() : pseg global index = %d / expected = %d' \ 2207 2216 % (self.index, expected ) 2208 2217 sys.exit(1) … … 2214 2223 segtype_int = x 2215 2224 if ( segtype_int == 0xFFFFFFFF ): 2216 print ' errorin Pseg.cbin() : undefined segment type %s' % self.segtype2225 print '[genmap error] in Pseg.cbin() : undefined segment type %s' % self.segtype 2217 2226 sys.exit(1) 2218 2227 … … 2278 2287 # check index 2279 2288 if (self.index != expected): 2280 print ' errorin Periph.cbin() : periph global index = %d / expected = %d' \2289 print '[genmap error] in Periph.cbin() : periph global index = %d / expected = %d' \ 2281 2290 % (self.index, expected ) 2282 2291 sys.exit(1) … … 2296 2305 if ( self.ptype == PERIPHTYPES[x] ): ptype_id = x 2297 2306 if ( ptype_id == 0xFFFFFFFF ): 2298 print ' errorin Periph.cbin() : undefined peripheral type %s' % self.ptype2307 print '[genmap error] in Periph.cbin() : undefined peripheral type %s' % self.ptype 2299 2308 sys.exit(1) 2300 2309 … … 2355 2364 # check index 2356 2365 if (self.index != expected): 2357 print ' errorin Irq.cbin() : irq global index = %d / expected = %d' \2366 print '[genmap error] in Irq.cbin() : irq global index = %d / expected = %d' \ 2358 2367 % (self.index, expected ) 2359 2368 sys.exit(1) … … 2365 2374 irqtype_id = x 2366 2375 if ( irqtype_id == 0xFFFFFFFF ): 2367 print ' errorin Irq.cbin() : undefined irqtype %s' % self.irqtype2376 print '[genmap error] in Irq.cbin() : undefined irqtype %s' % self.irqtype 2368 2377 sys.exit(1) 2369 2378 … … 2374 2383 isrtype_id = x 2375 2384 if ( isrtype_id == 0xFFFFFFFF ): 2376 print ' errorin Irq.cbin() : undefined isrtype %s' % self.isrtype2385 print '[genmap error] in Irq.cbin() : undefined isrtype %s' % self.isrtype 2377 2386 sys.exit(1) 2378 2387 … … 2408 2417 def xml( self ): # xml for Coproc 2409 2418 2410 print ' errorin Coproc.xml() : not defined yet'2419 print '[genmap error] in Coproc.xml() : not defined yet' 2411 2420 sys.exit(1) 2412 2421 … … 2421 2430 # check index 2422 2431 if (self.index != expected): 2423 print ' errorin Coproc.cbin() : coproc global index = %d / expected = %d' \2432 print '[genmap error] in Coproc.cbin() : coproc global index = %d / expected = %d' \ 2424 2433 % (self.index, expected ) 2425 2434 sys.exit(1) … … 2463 2472 def xml( self ): # xml for Cpport 2464 2473 2465 print ' errorin Cpport.xml() : not defined yet'2474 print '[genmap error] in Cpport.xml() : not defined yet' 2466 2475 sys.exit(1) 2467 2476 … … 2476 2485 # check index 2477 2486 if ( self.index != expected ): 2478 print ' errorin Cpport.cbin() : port global index = %d / expected = %d' \2487 print '[genmap error] in Cpport.cbin() : port global index = %d / expected = %d' \ 2479 2488 % ( self.index, expected ) 2480 2489 sys.exit(1) … … 2492 2501 vspace_id = vspace.index 2493 2502 if (vspace_id == 0xFFFFFFFF): 2494 print ' errorin Cpport.cbin() : vspace name %s not found' \2503 print '[genmap error] in Cpport.cbin() : vspace name %s not found' \ 2495 2504 % ( self.vspacename ) 2496 2505 sys.exit(1) … … 2503 2512 mwmr_id = vobj.index 2504 2513 if (mwmr_id == 0xFFFFFFFF): 2505 print ' errorin Cpport.cbin() : mwmr vobj name %s not found in vspace %s' \2514 print '[genmap error] in Cpport.cbin() : mwmr vobj name %s not found in vspace %s' \ 2506 2515 % ( self.mwmrname, self.vspacename ) 2507 2516 sys.exit(1)
Note: See TracChangeset
for help on using the changeset viewer.