back.verilog: make Yosys version check compatible with Verific.
authorTeguh Hofstee <5227572+hofstee@users.noreply.github.com>
Wed, 22 Apr 2020 12:23:14 +0000 (05:23 -0700)
committerLuke Kenneth Casson Leighton <lkcl@lkcl.net>
Fri, 31 Dec 2021 13:28:25 +0000 (13:28 +0000)
nmigen/back/verilog.py

index eb98a34cf1dd42fa88d70ad832d81646526430a2..6e2185abcdbe8a0df63b12f23d60ed497ab22502 100644 (file)
@@ -16,7 +16,8 @@ class YosysError(Exception):
 def _yosys_version():
     yosys_path = require_tool("yosys")
     version = subprocess.check_output([yosys_path, "-V"], encoding="utf-8")
-    m = re.match(r"^Yosys ([\d.]+)(?:\+(\d+))?", version)
+    # If Yosys is built with Verific, then Verific license information is printed first.
+    m = re.search(r"^Yosys ([\d.]+)(?:\+(\d+))?", version, flags=re.M)
     tag, offset = m[1], m[2] or 0
     return tuple(map(int, tag.split("."))), offset