Deleted Added
sdiff udiff text old ( 12204:2ba80db6075c ) new ( 12222:6db0fc7407a5 )
full compact
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 dep = self.open('inc.d', bare=True)
1577
1578 # decoder header - everything depends on this
1579 file = 'decoder.hh'
1580 with self.open(file) as f:
1581 inc = []
1582
1583 fn = 'decoder-g.hh.inc'
1584 assert(fn in self.files)
1585 f.write('#include "%s"\n' % fn)
1586 inc.append(fn)
1587
1588 fn = 'decoder-ns.hh.inc'
1589 assert(fn in self.files)
1590 f.write('namespace %s {\n#include "%s"\n}\n'
1591 % (self.namespace, fn))
1592 inc.append(fn)
1593
1594 print >>dep, file+':', ' '.join(inc)
1595
1596 # decoder method - cannot be split
1597 file = 'decoder.cc'
1598 with self.open(file) as f:
1599 inc = []
1600
1601 fn = 'decoder-g.cc.inc'
1602 assert(fn in self.files)
1603 f.write('#include "%s"\n' % fn)
1604 inc.append(fn)
1605
1606 fn = 'decoder.hh'
1607 f.write('#include "%s"\n' % fn)
1608 inc.append(fn)
1609
1610 fn = 'decode-method.cc.inc'
1611 # is guaranteed to have been written for parse to complete
1612 f.write('#include "%s"\n' % fn)
1613 inc.append(fn)
1614
1615 print >>dep, file+':', ' '.join(inc)
1616
1617 extn = re.compile('(\.[^\.]+)$')
1618
1619 # instruction constructors
1620 splits = self.splits[self.get_file('decoder')]
1621 file_ = 'inst-constrs.cc'
1622 for i in range(1, splits+1):
1623 if splits > 1:
1624 file = extn.sub(r'-%d\1' % i, file_)
1625 else:
1626 file = file_
1627 with self.open(file) as f:
1628 inc = []
1629
1630 fn = 'decoder-g.cc.inc'
1631 assert(fn in self.files)
1632 f.write('#include "%s"\n' % fn)
1633 inc.append(fn)
1634
1635 fn = 'decoder.hh'
1636 f.write('#include "%s"\n' % fn)
1637 inc.append(fn)
1638
1639 fn = 'decoder-ns.cc.inc'
1640 assert(fn in self.files)
1641 print >>f, 'namespace %s {' % self.namespace
1642 if splits > 1:
1643 print >>f, '#define __SPLIT %u' % i
1644 print >>f, '#include "%s"' % fn
1645 print >>f, '}'
1646 inc.append(fn)
1647
1648 print >>dep, file+':', ' '.join(inc)
1649
1650 # instruction execution per-CPU model
1651 splits = self.splits[self.get_file('exec')]
1652 for cpu in self.cpuModels:
1653 for i in range(1, splits+1):
1654 if splits > 1:
1655 file = extn.sub(r'_%d\1' % i, cpu.filename)
1656 else:
1657 file = cpu.filename
1658 with self.open(file) as f:
1659 inc = []
1660
1661 fn = 'exec-g.cc.inc'
1662 assert(fn in self.files)
1663 f.write('#include "%s"\n' % fn)
1664 inc.append(fn)
1665
1666 f.write(cpu.includes+"\n")
1667
1668 fn = 'decoder.hh'
1669 f.write('#include "%s"\n' % fn)
1670 inc.append(fn)
1671
1672 fn = 'exec-ns.cc.inc'
1673 assert(fn in self.files)
1674 print >>f, 'namespace %s {' % self.namespace
1675 print >>f, '#define CPU_EXEC_CONTEXT %s' \
1676 % cpu.strings['CPU_exec_context']
1677 if splits > 1:
1678 print >>f, '#define __SPLIT %u' % i
1679 print >>f, '#include "%s"' % fn
1680 print >>f, '}'
1681 inc.append(fn)
1682
1683 inc.append("decoder.hh")
1684 print >>dep, file+':', ' '.join(inc)
1685
1686 # max_inst_regs.hh
1687 self.update('max_inst_regs.hh',
1688 '''namespace %(namespace)s {
1689 const int MaxInstSrcRegs = %(maxInstSrcRegs)d;
1690 const int MaxInstDestRegs = %(maxInstDestRegs)d;
1691 const int MaxMiscDestRegs = %(maxMiscDestRegs)d;\n}\n''' % self)
1692 print >>dep, 'max_inst_regs.hh:'
1693
1694 dep.close()
1695
1696
1697 scaremonger_template ='''// DO NOT EDIT
1698// This file was automatically generated from an ISA description:
1699// %(filename)s
1700
1701''';
1702
1703 #####################################################################
1704 #

--- 1012 unchanged lines hidden ---