Commit 190d9fb9 authored by Paweł Szostek's avatar Paweł Szostek

add stubs for tool version detection

parent aa1f1e49
......@@ -29,6 +29,7 @@ import logging
import os.path
from util import path
from util.termcolor import colored
from tools.ise import detect_ise_version
_plain_print = print
......@@ -118,8 +119,9 @@ class Env(dict):
print("ise_version set in the manifest: %s.%s" % (ise_version[0], ise_version[1]))
self["ise_version"] = ise_version
elif self["ise_version"] is not None:
print("syn_ise_version not set in the manifest,"
" guessed ISE version: %s.%s." % (ise_version[0], ise_version[1]))
iv = self["ise_version"]
print("syn_ise_version not set in the manifest,"
" guessed ISE version: %s.%s." % (iv[0], iv[1]))
def check_env(self, verbose=False):
print.set_verbose(verbose)
......@@ -173,15 +175,17 @@ class Env(dict):
if self["ise_path"] is not None:
if self._is_in_path("ise", self["ise_path"]):
print(("ISE " + _green("found") + " in HDLMAKE_ISE_PATH: %s.") % self["ise_path"])
self["ise_version"] = self._guess_ise_version(self["ise_path"])
self["ise_version"] = detect_ise_version(self["ise_path"])
else:
print(("ISE " + _red("not found") + " in HDLMAKE_ISE_PATH: %s.") % self["ise_path"])
else:
if self._is_in_path("ise"):
print(("ISE " + _green("found") + " in PATH: %s.") % self._get_path("ise"))
self["ise_version"] = self._guess_ise_version(self._get_path("ise"))
self["ise_version"] = detect_ise_version(self._get_path("ise"))
else:
print("ISE " + _red("not found"))
if self["ise_version"] is not None:
print("Detected ISE version %s.%s." % (self["ise_version"][0], self["ise_version"][1]))
# determine modelsim path
print("\n### Modelsim simulation ###")
......@@ -266,35 +270,7 @@ class Env(dict):
else:
print("To use screen, set it to '1'.")
def _guess_ise_version(self, ise_path):
xst = Popen('which xst', shell=True, stdin=PIPE,
stdout=PIPE, close_fds=True)
lines = xst.stdout.readlines()
if not lines:
return None
xst = str(lines[0].strip())
version_pattern = re.compile('.*?(?P<major>\d|\d\d)[^\d](?P<minor>\d|\d\d).*')
# First check if we have version in path
match = re.match(version_pattern, xst)
if match:
ise_version = (match.group('major'), match.group('minor'))
else: # If it is not the case call the "xst -h" to get version
xst_output = Popen('xst -h', shell=True, stdin=PIPE,
stdout=PIPE, close_fds=True)
xst_output = xst_output.stdout.readlines()[0]
xst_output = xst_output.strip()
version_pattern = re.compile('Release\s(?P<major>\d|\d\d)[^\d](?P<minor>\d|\d\d)\s.*')
match = re.match(version_pattern, xst_output)
if match:
ise_version = (match.group('major'), match.group('minor'))
else:
logging.error("xst output is not in expected format: %s\n" % xst_output +
"Can't determine ISE version")
return None
return ise_version
def _get(self, name):
assert not name.startswith("HDLMAKE_")
......
......@@ -64,6 +64,9 @@ class ManifestParser(ConfigParser):
self.add_option('top_module', default=None, help="Top level entity for synthesis and simulation", type='')
self.add_delimiter()
self.add_option('force_tool', default=None, help="Force certain version of a tool, e.g. 'ise-13.2'")
self.add_delimiter()
self.add_option('include_dirs', default=None, help="Include dirs for Verilog sources", type=[])
self.add_type('include_dirs', type="")
......
......@@ -29,6 +29,8 @@ import logging
import re
import global_mod
import os
from subprocess import Popen, PIPE
XmlImpl = xml.dom.minidom.getDOMImplementation()
......@@ -45,6 +47,36 @@ FAMILY_NAMES = {
"XC7A": "Artix7"}
def detect_ise_version(path):
xst = Popen('which xst', shell=True, stdin=PIPE,
stdout=PIPE, close_fds=True)
lines = xst.stdout.readlines()
if not lines:
return None
xst = str(lines[0].strip())
version_pattern = re.compile('.*?(?P<major>\d|\d\d)[^\d](?P<minor>\d|\d\d).*')
# First check if we have version in path
match = re.match(version_pattern, xst)
if match:
ise_version = (match.group('major'), match.group('minor'))
else: # If it is not the case call the "xst -h" to get version
xst_output = Popen('xst -h', shell=True, stdin=PIPE,
stdout=PIPE, close_fds=True)
xst_output = xst_output.stdout.readlines()[0]
xst_output = xst_output.strip()
version_pattern = re.compile('Release\s(?P<major>\d|\d\d)[^\d](?P<minor>\d|\d\d)\s.*')
match = re.match(version_pattern, xst_output)
if match:
ise_version = (match.group('major'), match.group('minor'))
else:
logging.error("xst output is not in expected format: %s\n" % xst_output +
"Can't determine ISE version")
return None
return ise_version
class ISEProjectProperty:
def __init__(self, name, value, is_default=False):
self.name = name
......
......@@ -3,3 +3,7 @@ ISIM_STARDAND_LIBS = ['std', 'ieee', 'ieee_proposed', 'vl', 'synopsys',
'pls', 'xilinxcorelib', 'aim_ver', 'cpld_ver',
'simprims_ver', 'unisims_ver', 'uni9000_ver',
'unimacro_ver', 'xilinxcorelib_ver', 'secureip']
def detect_isim_version(path):
pass
#!/usr/bin/env python
from subprocess import Popen, PIPE
def detect_iverilog_version(path):
iverilog = Popen("iverilog -v 2>/dev/null| awk '{if(NR==1) print $4}'",
shell=True,
stdin=PIPE,
stdout=PIPE,
close_fds=True)
version = iverilog.stdout.readlines()[0].stripe()
return version
......@@ -33,6 +33,11 @@ XmlImpl = xml.dom.minidom.getDOMImplementation()
MODELSIM_STANDARD_LIBS = ['ieee', 'std']
def detect_modelsim_version(path):
pass
class ModelsiminiReader(object):
def __init__(self, path=None):
if path is None:
......
......@@ -24,6 +24,10 @@
QUARTUS_STANDARD_LIBS = ['altera', 'altera_mf', 'lpm', 'ieee', 'std']
def detect_quartus_version(path):
pass
class _QuartusProjectProperty:
SET_GLOBAL_INSTANCE, SET_INSTANCE_ASSIGNMENT, SET_LOCATION_ASSIGNMENT, SET_GLOBAL_ASSIGNMENT = range(4)
t = {"set_global_instance": SET_GLOBAL_INSTANCE,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment