vendor.xilinx_{7series,ultrascale}: don't use `write_verilog -decimal`.
authorwhitequark <whitequark@whitequark.org>
Thu, 21 May 2020 08:57:30 +0000 (08:57 +0000)
committerwhitequark <whitequark@whitequark.org>
Thu, 21 May 2020 08:57:43 +0000 (08:57 +0000)
In commit 892cff05, `-decimal` was used when writing Verilog for
Vivado targets because it treats (* keep=32'd1 *) and (* keep=1 *)
differently in violation of Verilog LRM. However, it is possible
to avoid that workaround by using (* keep="TRUE" *). Do that,
and remove `-decimal` to avoid special-casing 32-bit constants.

Refs #373.

nmigen/vendor/xilinx_7series.py
nmigen/vendor/xilinx_ultrascale.py

index dec32a26596dda608175e1cb6e22565ab07647a3..c9b44f140fbec7014a30fb86f3cdd1d1084f27c0 100644 (file)
@@ -66,15 +66,13 @@ class Xilinx7SeriesPlatform(TemplatedPlatform):
             [ -n "${{platform._toolchain_env_var}}" ] && . "${{platform._toolchain_env_var}}"
             {{emit_commands("sh")}}
         """,
-        # Vivado doesn't like constructs like (* keep = 32'd1 *), even though they mean the same
-        # thing as (* keep = 1 *); use -decimal to work around that.
         "{{name}}.v": r"""
             /* {{autogenerated}} */
-            {{emit_verilog(["-decimal"])}}
+            {{emit_verilog()}}
         """,
         "{{name}}.debug.v": r"""
             /* {{autogenerated}} */
-            {{emit_debug_verilog(["-decimal"])}}
+            {{emit_debug_verilog()}}
         """,
         "{{name}}.tcl": r"""
             # {{autogenerated}}
@@ -181,7 +179,7 @@ class Xilinx7SeriesPlatform(TemplatedPlatform):
 
     def add_clock_constraint(self, clock, frequency):
         super().add_clock_constraint(clock, frequency)
-        clock.attrs["keep"] = 1
+        clock.attrs["keep"] = "TRUE"
 
     def _get_xdr_buffer(self, m, pin, *, i_invert=False, o_invert=False):
         def get_dff(clk, d, q):
index 7445f4bfb6b5eee1c9eb93be69268cdbf8860263..c1442296b7146a52cba06d6bb2cbeb90b16b1b36 100644 (file)
@@ -66,15 +66,13 @@ class XilinxUltraScalePlatform(TemplatedPlatform):
             [ -n "${{platform._toolchain_env_var}}" ] && . "${{platform._toolchain_env_var}}"
             {{emit_commands("sh")}}
         """,
-        # Vivado doesn't like constructs like (* keep = 32'd1 *), even though they mean the same
-        # thing as (* keep = 1 *); use -decimal to work around that.
         "{{name}}.v": r"""
             /* {{autogenerated}} */
-            {{emit_verilog(["-decimal"])}}
+            {{emit_verilog()}}
         """,
         "{{name}}.debug.v": r"""
             /* {{autogenerated}} */
-            {{emit_debug_verilog(["-decimal"])}}
+            {{emit_debug_verilog()}}
         """,
         "{{name}}.tcl": r"""
             # {{autogenerated}}
@@ -181,7 +179,7 @@ class XilinxUltraScalePlatform(TemplatedPlatform):
 
     def add_clock_constraint(self, clock, frequency):
         super().add_clock_constraint(clock, frequency)
-        clock.attrs["keep"] = 1
+        clock.attrs["keep"] = "TRUE"
 
     def _get_xdr_buffer(self, m, pin, *, i_invert=False, o_invert=False):
         def get_dff(clk, d, q):