aboutsummaryrefslogtreecommitdiffstats
path: root/src/amd/common/sid_tables.py
diff options
context:
space:
mode:
authorMathieu Bridon <[email protected]>2018-07-05 15:17:32 +0200
committerDylan Baker <[email protected]>2018-07-06 10:04:22 -0700
commit0f7b18fa0d353aab0a44082b1aca8d8c00df71a7 (patch)
treee511fe8f70b48ad5203e3a0e52d0dc1b086bfd91 /src/amd/common/sid_tables.py
parentb3a42fa0667caeeebabd9e6aeb46a9534810c2f3 (diff)
python: Use the print function
In Python 2, `print` was a statement, but it became a function in Python 3. Using print functions everywhere makes the script compatible with Python versions >= 2.6, including Python 3. Signed-off-by: Mathieu Bridon <[email protected]> Acked-by: Eric Engestrom <[email protected]> Acked-by: Dylan Baker <[email protected]>
Diffstat (limited to 'src/amd/common/sid_tables.py')
-rw-r--r--src/amd/common/sid_tables.py39
1 files changed, 20 insertions, 19 deletions
diff --git a/src/amd/common/sid_tables.py b/src/amd/common/sid_tables.py
index ca90f82535d..421c2a13352 100644
--- a/src/amd/common/sid_tables.py
+++ b/src/amd/common/sid_tables.py
@@ -1,3 +1,4 @@
+from __future__ import print_function
CopyRight = '''
/*
@@ -333,10 +334,10 @@ def write_tables(asics, packets):
strings_offsets = IntTable("int")
fields = FieldTable()
- print '/* This file is autogenerated by sid_tables.py from sid.h. Do not edit directly. */'
- print
- print CopyRight.strip()
- print '''
+ print('/* This file is autogenerated by sid_tables.py from sid.h. Do not edit directly. */')
+ print()
+ print(CopyRight.strip())
+ print('''
#ifndef SID_TABLES_H
#define SID_TABLES_H
@@ -358,17 +359,17 @@ struct si_packet3 {
unsigned name_offset;
unsigned op;
};
-'''
+''')
- print 'static const struct si_packet3 packet3_table[] = {'
+ print('static const struct si_packet3 packet3_table[] = {')
for pkt in packets:
- print '\t{%s, %s},' % (strings.add(pkt[5:]), pkt)
- print '};'
- print
+ print('\t{%s, %s},' % (strings.add(pkt[5:]), pkt))
+ print('};')
+ print()
regs = {}
for asic in asics:
- print 'static const struct si_reg %s_reg_table[] = {' % (asic.name)
+ print('static const struct si_reg %s_reg_table[] = {' % (asic.name))
for reg in asic.registers:
# Only output a register that was changed or added relative to
# the previous generation
@@ -377,27 +378,27 @@ struct si_packet3 {
continue
if len(reg.fields):
- print '\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name,
- len(reg.fields), fields.add(reg.fields))
+ print('\t{%s, %s, %s, %s},' % (strings.add(reg.name), reg.r_name,
+ len(reg.fields), fields.add(reg.fields)))
else:
- print '\t{%s, %s},' % (strings.add(reg.name), reg.r_name)
+ print('\t{%s, %s},' % (strings.add(reg.name), reg.r_name))
regs[reg.r_name] = reg
- print '};'
- print
+ print('};')
+ print()
fields.emit(sys.stdout, strings, strings_offsets)
- print
+ print()
strings.emit(sys.stdout, "sid_strings")
- print
+ print()
strings_offsets.emit(sys.stdout, "sid_strings_offsets")
- print
- print '#endif'
+ print()
+ print('#endif')
def main():