Add integer attributes
authorArnaud Durand <arnaud.durand@unifr.ch>
Thu, 19 Dec 2019 08:03:12 +0000 (09:03 +0100)
committerArnaud Durand <arnaud.durand@unifr.ch>
Thu, 19 Dec 2019 08:03:12 +0000 (09:03 +0100)
litex/gen/fhdl/verilog.py

index 0e34af26fcd79dfda1bc0bf5a78c81dc4b26ab76..e1bd8da4e6d9ebf2318cbd6dca405d15937f9804 100644 (file)
@@ -210,7 +210,8 @@ def _printattr(attr, attr_translate):
         if not firsta:
             r += ", "
         firsta = False
-        r += attr_name + " = \"" + attr_value + "\""
+        const_expr = "\"" + attr_value + "\"" if not isinstance(attr_value, int) else str(attr_value)
+        r += attr_name + " = " + const_expr
     if r:
         r = "(* " + r + " *)"
     return r