Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
H
Hdlmake
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
15
Issues
15
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
Hdlmake
Commits
6387bf69
Commit
6387bf69
authored
Jul 31, 2013
by
Pawel Szostek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better ISE version checking
parent
54608e84
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
35 deletions
+36
-35
__main__.py
src/__main__.py
+9
-6
env.py
src/env.py
+27
-29
No files found.
src/__main__.py
View file @
6387bf69
...
...
@@ -80,16 +80,19 @@ def main():
global_mod
.
global_target
=
global_mod
.
top_module
.
target
global_mod
.
mod_pool
=
modules_pool
env
=
Env
(
options
,
global_mod
.
top_module
)
env
=
Env
(
options
)
global_mod
.
env
=
env
global_mod
.
env
.
check
()
if
options
.
command
==
"check-env"
:
env
.
check_env
(
verbose
=
True
)
quit
()
modules_pool
.
process_top_module_manifest
()
if
options
.
command
==
"check-env"
:
env
.
check
(
verbose
=
True
)
quit
()
elif
options
.
command
==
"manifest-help"
:
env
.
top_module
=
modules_pool
.
get_top_module
()
env
.
check_env
(
verbose
=
False
)
env
.
check_env_wrt_manifest
(
verbose
=
False
)
if
options
.
command
==
"manifest-help"
:
ManifestParser
()
.
print_help
()
quit
()
elif
options
.
command
==
"make-sim"
:
...
...
src/env.py
View file @
6387bf69
...
...
@@ -76,13 +76,13 @@ class _IsePath(object):
try
:
minor_dct
=
dct
[
major
]
try
:
path
=
minor_dct
[
minor
]
return
path
ise_
path
=
minor_dct
[
minor
]
return
ise_
path
except
KeyError
:
#get latest for the chosen major version
minor_keys
=
sorted
(
minor_dct
.
keys
())
max_minor_key
=
minor_keys
[
-
1
]
path
=
minor_dct
[
max_minor_key
]
ise_
path
=
minor_dct
[
max_minor_key
]
except
KeyError
:
#get path for the latest version from the dict
...
...
@@ -91,17 +91,28 @@ class _IsePath(object):
minor_dct
=
dct
[
max_major_key
]
minor_keys
=
sorted
(
minor_dct
.
keys
())
max_minor_key
=
minor_keys
[
-
1
]
path
=
minor_dct
[
max_minor_key
]
return
path
ise_
path
=
minor_dct
[
max_minor_key
]
return
ise_
path
class
Env
(
dict
):
def
__init__
(
self
,
options
,
top_module
):
def
__init__
(
self
,
options
,
top_module
=
None
):
dict
.
__init__
(
self
)
self
.
options
=
options
self
.
top_module
=
top_module
def
check
(
self
,
verbose
=
False
):
def
check_env_wrt_manifest
(
self
,
verbose
=
False
):
# determine ISE version
if
self
.
top_module
:
if
self
.
top_module
.
syn_ise_version
is
not
None
:
ise_version
=
tuple
(
self
.
top_module
.
syn_ise_version
)
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
]))
def
check_env
(
self
,
verbose
=
False
):
print
.
set_verbose
(
verbose
)
platform
=
sys
.
platform
print
(
"Platform:
%
s"
%
platform
)
...
...
@@ -134,6 +145,7 @@ class Env(dict):
print
(
"Environmental variable
%
s is set:
%
s."
%
(
"XILINX"
,
xilinx
))
self
[
"xilinx"
]
=
xilinx
else
:
self
[
"xilinx"
]
=
None
print
(
"Environmental variable XILINX is not set."
)
self
.
_report_and_set_hdlmake_var
(
"ise_path"
)
...
...
@@ -144,35 +156,21 @@ class Env(dict):
else
:
pass
self
[
"ise_path"
]
=
os
.
path
.
join
(
self
[
"xilinx"
],
"ISE/bin/lin"
)
self
[
"ise_version"
]
=
None
if
self
[
"ise_path"
]
is
not
None
:
if
self
.
_check_in_path
(
"ise"
,
self
[
"ise_path"
]):
print
(
"ISE found in HDLMAKE_ISE_PATH:
%
s."
%
self
[
"ise_path"
])
self
[
"ise_version"
]
=
self
.
_guess_ise_version
(
self
[
"ise_path"
])
else
:
print
(
"ISE not found in HDLMAKE_ISE_PATH:
%
s."
%
self
[
"ise_path"
])
else
:
if
self
.
_check_in_path
(
"ise"
):
print
(
"ISE found in PATH:
%
s."
%
self
.
_get_path
(
"ise"
))
self
[
"ise_version"
]
=
self
.
_guess_ise_version
(
self
.
_get_path
(
"ise"
))
else
:
print
(
"ISE not found in PATH."
)
# determine ISE version
if
self
.
top_module
:
if
self
.
top_module
.
syn_ise_version
is
not
None
:
ise_version
=
tuple
(
self
.
top_module
.
syn_ise_version
)
print
(
"ise_version set in the manifest:
%
s.
%
s"
%
(
ise_version
[
0
],
ise_version
[
1
]))
self
[
"ise_version"
]
=
ise_version
else
:
ise_version
=
None
if
"ise_version"
not
in
self
:
ise_version
=
self
.
_guess_ise_version
(
xilinx
,
''
)
if
ise_version
:
print
(
"syn_ise_version not set in the manifest,"
" guessed ISE version:
%
s.
%
s."
%
(
ise_version
[
0
],
ise_version
[
1
]))
self
[
"ise_version"
]
=
ise_version
#######
# determine modelsim path
print
(
"
\n
### Modelsim simulation ###"
)
self
.
_report_and_set_hdlmake_var
(
"modelsim_path"
)
...
...
@@ -191,7 +189,7 @@ class Env(dict):
# determine iverilog path
print
(
"
\n
### Iverilog simulation ###"
)
self
.
_report_and_set_hdlmake_var
(
"iverilog_path"
)
if
self
[
"iverilog_path"
]
is
not
None
:
if
self
[
"iverilog_path"
]
is
not
None
:
if
self
.
_check_in_path
(
"iverilog"
,
self
[
"iverilog_path"
]):
print
(
"iverilog found under HDLMAKE_IVERILOG_PATH:
%
s"
%
self
[
"iverilog_path"
])
else
:
...
...
@@ -259,7 +257,7 @@ class Env(dict):
else
:
print
(
"Environmental variable HDLMAKE_RSYNTH_USE_SCREEN is unset. Set it to '1' to use screen in remote synthesis"
)
def
_guess_ise_version
(
self
,
xilinx
,
ise_path
):
def
_guess_ise_version
(
self
,
ise_path
):
xst
=
Popen
(
'which xst'
,
shell
=
True
,
stdin
=
PIPE
,
stdout
=
PIPE
,
close_fds
=
True
)
lines
=
xst
.
stdout
.
readlines
()
...
...
@@ -297,14 +295,14 @@ class Env(dict):
return
os
.
environ
.
get
(
"HDLMAKE_
%
s"
%
name
)
def
_get_path
(
self
,
name
):
return
os
.
popen
(
"which
%
s"
%
name
)
.
read
()
.
strip
()
location
=
os
.
popen
(
"which
%
s"
%
name
)
.
read
()
.
strip
()
return
os
.
path
.
dirname
(
location
)
def
_check_in_path
(
self
,
name
,
path
=
None
):
if
path
is
not
None
:
return
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
name
))
else
:
assert
isinstance
(
name
,
basestring
)
path
=
self
.
_get_path
(
name
)
return
len
(
path
)
>
0
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment