back.rtlil: add support for real (float) parameters on Instances.
authorDarrell Harmon <dlharmon@users.noreply.github.com>
Thu, 22 Aug 2019 04:13:05 +0000 (22:13 -0600)
committerwhitequark <cz@m-labs.hk>
Thu, 22 Aug 2019 04:13:05 +0000 (04:13 +0000)
Required for Xilinx MMCME2_BASE, etc.

nmigen/back/rtlil.py

index 875212d195182e7e6aebf14898ba8bff5dc97dd0..3409d4cca8b04cfe6eb8932228f5cff8426dc5dc 100644 (file)
@@ -123,6 +123,9 @@ class _ModuleBuilder(_Namer, _BufferedBuilder, _AttrBuilder):
             elif isinstance(value, int):
                 self._append("    parameter \\{} {:d}\n",
                              param, value)
+            elif isinstance(value, float):
+                self._append("    parameter real \\{} \"{:f}\"\n",
+                             param, value)
             elif isinstance(value, ast.Const):
                 self._append("    parameter \\{} {}'{:b}\n",
                              param, len(value), value.value)