1# Copyright (c) 2014, 2016 ARM Limited 2# All rights reserved 3# 4# The license below extends only to copyright in the software and shall 5# not be construed as granting a license to any other intellectual 6# property including but not limited to intellectual property relating 7# to a hardware implementation of the functionality of the software 8# licensed hereunder. You may use the software subject to the license --- 1559 unchanged lines hidden (view full) --- 1568 1569 return f 1570 1571 # Weave together the parts of the different output sections by 1572 # #include'ing them into some very short top-level .cc/.hh files. 1573 # These small files make it much clearer how this tool works, since 1574 # you directly see the chunks emitted as files that are #include'd. 1575 def write_top_level_files(self): |
1576 # decoder header - everything depends on this 1577 file = 'decoder.hh' 1578 with self.open(file) as f: |
1579 fn = 'decoder-g.hh.inc' 1580 assert(fn in self.files) 1581 f.write('#include "%s"\n' % fn) |
1582 1583 fn = 'decoder-ns.hh.inc' 1584 assert(fn in self.files) 1585 f.write('namespace %s {\n#include "%s"\n}\n' 1586 % (self.namespace, fn)) |
1587 |
1588 # decoder method - cannot be split 1589 file = 'decoder.cc' 1590 with self.open(file) as f: |
1591 fn = 'decoder-g.cc.inc' 1592 assert(fn in self.files) 1593 f.write('#include "%s"\n' % fn) |
1594 1595 fn = 'decoder.hh' 1596 f.write('#include "%s"\n' % fn) |
1597 1598 fn = 'decode-method.cc.inc' 1599 # is guaranteed to have been written for parse to complete 1600 f.write('#include "%s"\n' % fn) |
1601 |
1602 extn = re.compile('(\.[^\.]+)$') 1603 1604 # instruction constructors 1605 splits = self.splits[self.get_file('decoder')] 1606 file_ = 'inst-constrs.cc' 1607 for i in range(1, splits+1): 1608 if splits > 1: 1609 file = extn.sub(r'-%d\1' % i, file_) 1610 else: 1611 file = file_ 1612 with self.open(file) as f: |
1613 fn = 'decoder-g.cc.inc' 1614 assert(fn in self.files) 1615 f.write('#include "%s"\n' % fn) |
1616 1617 fn = 'decoder.hh' 1618 f.write('#include "%s"\n' % fn) |
1619 1620 fn = 'decoder-ns.cc.inc' 1621 assert(fn in self.files) 1622 print >>f, 'namespace %s {' % self.namespace 1623 if splits > 1: 1624 print >>f, '#define __SPLIT %u' % i 1625 print >>f, '#include "%s"' % fn 1626 print >>f, '}' |
1627 |
1628 # instruction execution per-CPU model 1629 splits = self.splits[self.get_file('exec')] 1630 for cpu in self.cpuModels: 1631 for i in range(1, splits+1): 1632 if splits > 1: 1633 file = extn.sub(r'_%d\1' % i, cpu.filename) 1634 else: 1635 file = cpu.filename 1636 with self.open(file) as f: |
1637 fn = 'exec-g.cc.inc' 1638 assert(fn in self.files) 1639 f.write('#include "%s"\n' % fn) |
1640 1641 f.write(cpu.includes+"\n") 1642 1643 fn = 'decoder.hh' 1644 f.write('#include "%s"\n' % fn) |
1645 1646 fn = 'exec-ns.cc.inc' 1647 assert(fn in self.files) 1648 print >>f, 'namespace %s {' % self.namespace 1649 print >>f, '#define CPU_EXEC_CONTEXT %s' \ 1650 % cpu.strings['CPU_exec_context'] 1651 if splits > 1: 1652 print >>f, '#define __SPLIT %u' % i 1653 print >>f, '#include "%s"' % fn 1654 print >>f, '}' |
1655 |
1656 # max_inst_regs.hh 1657 self.update('max_inst_regs.hh', 1658 '''namespace %(namespace)s { 1659 const int MaxInstSrcRegs = %(maxInstSrcRegs)d; 1660 const int MaxInstDestRegs = %(maxInstDestRegs)d; 1661 const int MaxMiscDestRegs = %(maxMiscDestRegs)d;\n}\n''' % self) |
1662 |
1663 scaremonger_template ='''// DO NOT EDIT 1664// This file was automatically generated from an ISA description: 1665// %(filename)s 1666 1667'''; 1668 1669 ##################################################################### 1670 # --- 1012 unchanged lines hidden --- |