Skip to content

Commit

Permalink
vivado: add get_version function
Browse files Browse the repository at this point in the history
Signed-off-by: Karol Gugala <kgugala@antmicro.com>
  • Loading branch information
kgugala authored and olofk committed Oct 14, 2019
1 parent 820a108 commit 05cf5ca
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion edalize/vivado.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import logging
import os.path
import platform
import re
import subprocess

from edalize.edatool import Edatool

Expand Down Expand Up @@ -34,8 +36,27 @@ def get_doc(cls, api_ver):
'desc' : 'P&R tool. Allowed values are vivado (default) and none (to just run synthesis)'},
]}

""" Configuration is the first phase of the build
""" Get tool version
This gets the Vivado version by running vivado -version and
parsing the output. If this command fails, "unknown" is returned
"""
def get_version(self):

version = "unknown"
try:
vivado_text = subprocess.Popen(["vivado", "-version"], stdout=subprocess.PIPE, env=os.environ).communicate()[0]
version_exp = r'Vivado.*(?P<version>v.*) \(.*'

match = re.search(version_exp, str(vivado_text))
if match is not None:
version = match.group('version')
except Exception as ex:
logger.warning("Unable to recognize Vivado version")

return version

""" Configuration is the first phase of the build
This writes the project TCL files and Makefile. It first collects all
sources, IPs and contraints and then writes them to the TCL file along
with the build steps.
Expand Down

0 comments on commit 05cf5ca

Please sign in to comment.