systemc,tests,python: Updated testall.py to python3

Change-Id: I95fce9d71bf0af9cd76e8bf0dd353281cff8ed74
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47022
Maintainer: Bobby R. Bruce <bbruce@ucdavis.edu>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
(cherry picked from commit f9a941524febbea0143dd736ee8924f385ecf6f3)
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/47919
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
diff --git a/src/systemc/tests/tlm/endian_conv/testall.py b/src/systemc/tests/tlm/endian_conv/testall.py
index a534fa7..f3a9d0b 100644
--- a/src/systemc/tests/tlm/endian_conv/testall.py
+++ b/src/systemc/tests/tlm/endian_conv/testall.py
@@ -106,7 +106,7 @@
       if random.random() < 0.25:  break
     length = random.choice(lengths)
     addr_base = random.choice(list(range(0,1024,bus_width)))
-    addr_offset = random.choice(list(range(bus_width))+[0]*(bus_width/2))
+    addr_offset = random.choice(list(range(bus_width))+[0]*int(bus_width//2))
     txn = transaction(
       bus_width = bus_width,
       data_width = data_width,
@@ -137,15 +137,15 @@
 # test code for transaction generator
 if False:
   for t in txn_generator(20):
-    print t
+    print(t)
   raise Exception
 # end test code
 
 
 class memory_state_cl:
   buffer_size = 2048
-  repeats = 10 * buffer_size / 36
-  population = (string.lowercase + string.digits) * repeats
+  repeats = 10 * buffer_size // 36
+  population = (string.ascii_lowercase + string.digits) * int(repeats)
   def __init__(self):
     self.initiator = "".join(
       random.sample(memory_state_cl.population, memory_state_cl.buffer_size))
@@ -293,10 +293,10 @@
 # test code for fragmenters
 if False:
   for t in txn_generator(1):
-    print t
-    print
+    print(t)
+    print()
     for u in fragmenters[4](t):
-      print u
+      print(u)
   raise Exception
 # end test code
 
@@ -401,16 +401,16 @@
 
 from sys import argv
 
-print "Testing Endianness Conversion Functions"
-print "March 2008"
-print "OSCI TLM-2"
+print("Testing Endianness Conversion Functions")
+print("March 2008")
+print("OSCI TLM-2")
 
 try:  nr_txns_to_test = int(argv[1])
 except:
-  print "No command line input for number of tests, using default"
+  print("No command line input for number of tests, using default")
   nr_txns_to_test = 1000
 
-print "Number to test:", nr_txns_to_test
+print("Number to test:", nr_txns_to_test)
 
 # generate and test a number of transactions
 for txn in txn_generator(nr_txns_to_test):
@@ -445,12 +445,12 @@
 actual memory:
 %s""" % (fragmenter, txn, initial_memory, golden_memory_state, memory_state))
 
-  print ".",
-print
+  print("."),
+print()
 
 
-print "Conversion functions usage frequency:"
+print("Conversion functions usage frequency:")
 for c in all_converters:
-  print c.nr, c.__name__, c.usage
+  print(c.nr, c.__name__, c.usage)