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
190d9fb9
Commit
190d9fb9
authored
Aug 01, 2013
by
Paweł Szostek
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add stubs for tool version detection
parent
aa1f1e49
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
69 additions
and
32 deletions
+69
-32
env.py
hdlmake/env.py
+8
-32
manifest_parser.py
hdlmake/manifest_parser.py
+3
-0
ise.py
hdlmake/tools/ise.py
+32
-0
isim.py
hdlmake/tools/isim.py
+4
-0
iverilog.py
hdlmake/tools/iverilog.py
+13
-0
modelsim.py
hdlmake/tools/modelsim.py
+5
-0
quartus.py
hdlmake/tools/quartus.py
+4
-0
No files found.
hdlmake/env.py
View file @
190d9fb9
...
...
@@ -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_"
)
...
...
hdlmake/manifest_parser.py
View file @
190d9fb9
...
...
@@ -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
=
""
)
...
...
hdlmake/tools/ise.py
View file @
190d9fb9
...
...
@@ -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
...
...
hdlmake/tools/isim.py
View file @
190d9fb9
...
...
@@ -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
hdlmake/tools/iverilog.py
0 → 100644
View file @
190d9fb9
#!/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
hdlmake/tools/modelsim.py
View file @
190d9fb9
...
...
@@ -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
:
...
...
hdlmake/tools/quartus.py
View file @
190d9fb9
...
...
@@ -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
,
...
...
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