summaryrefslogtreecommitdiff
path: root/src/arch
diff options
context:
space:
mode:
Diffstat (limited to 'src/arch')
-rwxr-xr-xsrc/arch/hsail/gen.py4
-rwxr-xr-xsrc/arch/isa_parser.py30
-rw-r--r--src/arch/micro_asm.py10
-rwxr-xr-xsrc/arch/micro_asm_test.py4
4 files changed, 27 insertions, 21 deletions
diff --git a/src/arch/hsail/gen.py b/src/arch/hsail/gen.py
index 515d7ed77..bb6012112 100755
--- a/src/arch/hsail/gen.py
+++ b/src/arch/hsail/gen.py
@@ -35,12 +35,14 @@
# Author: Steve Reinhardt
#
+from __future__ import print_function
+
import sys, re
from m5.util import code_formatter
if len(sys.argv) != 4:
- print "Error: need 3 args (file names)"
+ print("Error: need 3 args (file names)")
sys.exit(0)
header_code = code_formatter()
diff --git a/src/arch/isa_parser.py b/src/arch/isa_parser.py
index fe95d06bf..681734985 100755
--- a/src/arch/isa_parser.py
+++ b/src/arch/isa_parser.py
@@ -39,7 +39,7 @@
#
# Authors: Steve Reinhardt
-from __future__ import with_statement
+from __future__ import with_statement, print_function
import os
import sys
import re
@@ -1537,11 +1537,11 @@ class ISAParser(Grammar):
# select the different chunks. If no 'split' directives are used,
# the cpp emissions have no effect.
if re.search('-ns.cc.inc$', filename):
- print >>f, '#if !defined(__SPLIT) || (__SPLIT == 1)'
+ print('#if !defined(__SPLIT) || (__SPLIT == 1)', file=f)
self.splits[f] = 1
# ensure requisite #include's
elif filename == 'decoder-g.hh.inc':
- print >>f, '#include "base/bitfield.hh"'
+ print('#include "base/bitfield.hh"', file=f)
return f
@@ -1596,11 +1596,11 @@ class ISAParser(Grammar):
fn = 'decoder-ns.cc.inc'
assert(fn in self.files)
- print >>f, 'namespace %s {' % self.namespace
+ print('namespace %s {' % self.namespace, file=f)
if splits > 1:
- print >>f, '#define __SPLIT %u' % i
- print >>f, '#include "%s"' % fn
- print >>f, '}'
+ print('#define __SPLIT %u' % i, file=f)
+ print('#include "%s"' % fn, file=f)
+ print('}', file=f)
# instruction execution
splits = self.splits[self.get_file('exec')]
@@ -1617,11 +1617,11 @@ class ISAParser(Grammar):
fn = 'exec-ns.cc.inc'
assert(fn in self.files)
- print >>f, 'namespace %s {' % self.namespace
+ print('namespace %s {' % self.namespace, file=f)
if splits > 1:
- print >>f, '#define __SPLIT %u' % i
- print >>f, '#include "%s"' % fn
- print >>f, '}'
+ print('#define __SPLIT %u' % i, file=f)
+ print('#include "%s"' % fn, file=f)
+ print('}', file=f)
# max_inst_regs.hh
self.update('max_inst_regs.hh',
@@ -2019,7 +2019,7 @@ del wrap
def p_def_template(self, t):
'def_template : DEF TEMPLATE ID CODELIT SEMI'
if t[3] in self.templateMap:
- print "warning: template %s already defined" % t[3]
+ print("warning: template %s already defined" % t[3])
self.templateMap[t[3]] = Template(self, t[4])
# An instruction format definition looks like
@@ -2604,9 +2604,9 @@ StaticInstPtr
try:
self._parse_isa_desc(*args, **kwargs)
except ISAParserError, e:
- print backtrace(self.fileNameStack)
- print "At %s:" % e.lineno
- print e
+ print(backtrace(self.fileNameStack))
+ print("At %s:" % e.lineno)
+ print(e)
sys.exit(1)
# Called as script: get args from command line.
diff --git a/src/arch/micro_asm.py b/src/arch/micro_asm.py
index 4e5400cef..263e73afd 100644
--- a/src/arch/micro_asm.py
+++ b/src/arch/micro_asm.py
@@ -26,6 +26,8 @@
#
# Authors: Gabe Black
+from __future__ import print_function
+
import os
import sys
import re
@@ -117,9 +119,9 @@ class Directive(Statement):
##########################################################################
def print_error(message):
- print
- print "*** %s" % message
- print
+ print()
+ print("*** %s" % message)
+ print()
def handle_statement(parser, container, statement):
if statement.is_microop:
@@ -153,7 +155,7 @@ def handle_statement(parser, container, statement):
statement.params, {}, parser.symbols)
except:
print_error("Error executing directive.")
- print container.directives
+ print(container.directives)
raise
else:
raise Exception, "Didn't recognize the type of statement", statement
diff --git a/src/arch/micro_asm_test.py b/src/arch/micro_asm_test.py
index b074ecb58..e5755f717 100755
--- a/src/arch/micro_asm_test.py
+++ b/src/arch/micro_asm_test.py
@@ -26,6 +26,8 @@
#
# Authors: Gabe Black
+from __future__ import print_function
+
from micro_asm import MicroAssembler, Combinational_Macroop, Rom_Macroop, Rom
class Bah(object):
@@ -58,7 +60,7 @@ class TestMacroop(Combinational_Macroop):
def untweak(self):
microops["bah"] = Bah
def print_debug(self, message):
- print message
+ print(message)
def __init__(self, name):
super(TestMacroop, self).__init__(name)