python: Manually convert float to int when using %x
authorGiacomo Travaglini <giacomo.travaglini@arm.com>
Tue, 5 May 2020 09:38:10 +0000 (10:38 +0100)
committerGiacomo Travaglini <giacomo.travaglini@arm.com>
Wed, 6 May 2020 08:15:15 +0000 (08:15 +0000)
This is required by python3.5 which is not allowing a
floating point value to be printed in hex and will trigger
a TypeError assertion:

TypeError: %X format: an integer is required, not float

Change-Id: I2033366751924579cc87e7fccda8fdb33a31412d
Signed-off-by: Giacomo Travaglini <giacomo.travaglini@arm.com>
Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/28607
Reviewed-by: Bobby R. Bruce <bbruce@ucdavis.edu>
Reviewed-by: Jason Lowe-Power <power.jg@gmail.com>
Maintainer: Jason Lowe-Power <power.jg@gmail.com>
Tested-by: kokoro <noreply+kokoro@google.com>
src/python/m5/util/dot_writer.py

index e6de3f321934903daed4593de8ec626513dad237..c66108d21b14e56b34b9b6fcf2295b08281b390a 100644 (file)
@@ -267,7 +267,7 @@ def dot_gen_colour(simNode, isPort = False):
     return dot_rgb_to_html(r, g, b)
 
 def dot_rgb_to_html(r, g, b):
-    return "#%.2x%.2x%.2x" % (r, g, b)
+    return "#%.2x%.2x%.2x" % (int(r), int(g), int(b))
 
 # We need to create all of the clock domains. We abuse the alpha channel to get
 # the correct domain colouring.