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
b65b0cf5
Commit
b65b0cf5
authored
Aug 19, 2016
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move 'check_tool' method from Env to Tools package
parent
ca7cdc4b
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
69 additions
and
70 deletions
+69
-70
env.py
hdlmake/env.py
+0
-52
manifest_parser.py
hdlmake/manifest_parser/manifest_parser.py
+8
-0
make_sim.py
hdlmake/tools/make_sim.py
+1
-3
make_syn.py
hdlmake/tools/make_syn.py
+5
-13
makefile.py
hdlmake/tools/makefile.py
+53
-0
modelsim.py
hdlmake/tools/modelsim.py
+2
-2
No files found.
hdlmake/env.py
View file @
b65b0cf5
...
...
@@ -28,8 +28,6 @@ from __future__ import absolute_import
import
os
import
os.path
import
logging
from
.util
import
path
as
path_mod
import
six
...
...
@@ -42,56 +40,6 @@ class Env(dict):
dict
.
__init__
(
self
)
self
.
options
=
options
def
check_tool
(
self
,
info_class
):
"""Check if the binary is available in the O.S. environment"""
def
_get_path
(
name
):
"""Get the directory in which the tool binary is at Host"""
location
=
os
.
popen
(
path_mod
.
which_cmd
()
+
"
%
s"
%
name
)
.
read
()
.
split
(
'
\n
'
,
1
)[
0
]
.
strip
()
logging
.
debug
(
"location for
%
s:
%
s"
,
name
,
location
)
return
os
.
path
.
dirname
(
location
)
def
_is_in_path
(
name
,
path
=
None
):
"""Check if the directory is in the system path"""
if
path
is
not
None
:
return
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
name
))
else
:
assert
isinstance
(
name
,
six
.
string_types
)
path
=
_get_path
(
name
)
return
len
(
path
)
>
0
def
_check_in_system_path
(
name
):
"""Check if if in the system path exists a file named (name)"""
path
=
_get_path
(
name
)
if
path
:
return
True
else
:
return
False
tool_info
=
info_class
.
_tool_info
if
path_mod
.
check_windows
():
bin_name
=
tool_info
[
'windows_bin'
]
else
:
bin_name
=
tool_info
[
'linux_bin'
]
path_key
=
tool_info
[
'id'
]
+
'_path'
name
=
tool_info
[
'name'
]
logging
.
debug
(
"Checking if "
+
name
+
" tool is available on PATH"
)
self
.
_report_and_set_hdlmake_var
(
path_key
)
if
self
[
path_key
]
is
not
None
:
if
_is_in_path
(
bin_name
,
self
[
path_key
]):
logging
.
info
(
"
%
s found under HDLMAKE_
%
s:
%
s"
,
name
,
path_key
.
upper
(),
self
[
path_key
])
else
:
logging
.
warning
(
"
%
s NOT found under HDLMAKE_
%
s:
%
s"
,
name
,
path_key
.
upper
(),
self
[
path_key
])
else
:
if
_check_in_system_path
(
bin_name
):
self
[
path_key
]
=
_get_path
(
bin_name
)
logging
.
info
(
"
%
s found in system PATH:
%
s"
,
name
,
self
[
path_key
])
else
:
logging
.
warning
(
"
%
s cannnot be found in system PATH"
,
name
)
def
_report_and_set_hdlmake_var
(
self
,
name
):
"""Create a new entry in the Env dictionary and initialize the value
to the obtained from the O.S. environmental variable if defined"""
...
...
hdlmake/manifest_parser/manifest_parser.py
View file @
b65b0cf5
...
...
@@ -96,6 +96,10 @@ class ManifestParser(ConfigParser):
'default'
:
None
,
'help'
:
"Tool to be used in the synthesis"
,
'type'
:
''
},
{
'name'
:
'syn_path'
,
'default'
:
None
,
'help'
:
"Execution path for the Tool to be used in synthesis"
,
'type'
:
''
},
{
'name'
:
'syn_device'
,
'default'
:
None
,
'help'
:
"Target FPGA device"
,
...
...
@@ -194,6 +198,10 @@ class ManifestParser(ConfigParser):
'default'
:
None
,
'help'
:
"Simulation tool to be used (e.g. isim, vsim, iverilog)"
,
'type'
:
''
},
{
'name'
:
'sim_path'
,
'default'
:
None
,
'help'
:
"Execution path for the Tool to be used in simulation"
,
'type'
:
''
},
{
'name'
:
'sim_pre_cmd'
,
'default'
:
None
,
'help'
:
"Command to be executed before simulation"
,
...
...
hdlmake/tools/make_sim.py
View file @
b65b0cf5
...
...
@@ -34,9 +34,6 @@ class ToolSim(ToolMakefile):
"""Execute the simulation action"""
_check_simulation_manifest
(
pool
.
top_module
.
manifest_dict
)
pool
.
check_all_fetched_or_quit
()
pool
.
env
.
check_tool
(
self
)
logging
.
info
(
"Generating "
+
self
.
_tool_info
[
'name'
]
+
" makefile for simulation."
)
top_module
=
pool
.
get_top_module
()
fset
=
pool
.
build_file_set
(
top_module
.
manifest_dict
[
"sim_top"
],
...
...
@@ -45,6 +42,7 @@ class ToolSim(ToolMakefile):
dep_files
=
fset
.
filter
(
DepFile
)
# dep_solver.solve(dep_files)
self
.
makefile_setup
(
top_module
,
dep_files
)
self
.
makefile_check_tool
(
'sim_path'
)
self
.
makefile_sim_top
()
self
.
makefile_sim_options
()
self
.
makefile_sim_local
()
...
...
hdlmake/tools/make_syn.py
View file @
b65b0cf5
...
...
@@ -43,16 +43,7 @@ class ToolSyn(ToolMakefile):
"""Generate a project for the specific synthesis tool"""
_check_synthesis_manifest
(
pool
.
top_module
.
manifest_dict
)
pool
.
check_all_fetched_or_quit
()
tool_info
=
self
.
_tool_info
path_key
=
tool_info
[
'id'
]
+
'_path'
name
=
tool_info
[
'name'
]
env
=
pool
.
env
env
.
check_tool
(
self
)
top_module
=
pool
.
get_top_module
()
if
env
[
path_key
]:
tool_path
=
env
[
path_key
]
else
:
tool_path
=
""
fileset
=
pool
.
build_file_set
(
top_module
.
manifest_dict
[
"syn_top"
],
standard_libs
=
self
.
_standard_libs
)
...
...
@@ -67,8 +58,9 @@ class ToolSyn(ToolMakefile):
len
(
privative_files
))
fileset
.
add
(
privative_files
)
self
.
makefile_setup
(
top_module
,
fileset
)
self
.
makefile_check_tool
(
'syn_path'
)
self
.
makefile_includes
()
self
.
makefile_syn_top
(
tool_path
)
self
.
makefile_syn_top
()
self
.
makefile_syn_tcl
()
self
.
makefile_syn_files
()
self
.
makefile_syn_local
()
...
...
@@ -76,9 +68,9 @@ class ToolSyn(ToolMakefile):
self
.
makefile_syn_build
()
self
.
makefile_syn_clean
()
self
.
makefile_syn_phony
()
logging
.
info
(
name
+
" project file generated."
)
logging
.
info
(
self
.
_tool_info
[
'name'
]
+
" project file generated."
)
def
makefile_syn_top
(
self
,
tool_path
):
def
makefile_syn_top
(
self
):
"""Create the top part of the synthesis Makefile"""
if
path_mod
.
check_windows
():
tcl_interpreter
=
self
.
_tool_info
[
"windows_bin"
]
...
...
@@ -100,7 +92,7 @@ endif
tcl_interpreter
=
tcl_interpreter
,
project_name
=
self
.
top_module
.
manifest_dict
[
"syn_project"
],
project_ext
=
self
.
_tool_info
[
"project_ext"
],
tool_path
=
tool_path
,
tool_path
=
self
.
top_module
.
manifest_dict
[
"syn_path"
]
,
top_module
=
self
.
top_module
.
manifest_dict
[
"syn_top"
]))
def
makefile_syn_tcl
(
self
):
...
...
hdlmake/tools/makefile.py
View file @
b65b0cf5
...
...
@@ -25,6 +25,8 @@
from
__future__
import
absolute_import
import
os
import
logging
import
six
from
hdlmake.util
import
path
as
path_mod
...
...
@@ -59,6 +61,57 @@ class ToolMakefile(object):
self
.
top_module
=
top_module
self
.
fileset
=
fileset
def
makefile_check_tool
(
self
,
path_key
):
"""Check if the binary is available in the O.S. environment"""
def
_get_path
(
name
):
"""Get the directory in which the tool binary is at Host"""
location
=
os
.
popen
(
path_mod
.
which_cmd
()
+
"
%
s"
%
name
)
.
read
()
.
split
(
'
\n
'
,
1
)[
0
]
.
strip
()
logging
.
debug
(
"location for
%
s:
%
s"
,
name
,
location
)
return
os
.
path
.
dirname
(
location
)
def
_is_in_path
(
name
,
path
=
None
):
"""Check if the directory is in the system path"""
if
path
is
not
None
:
return
os
.
path
.
exists
(
os
.
path
.
join
(
path
,
name
))
else
:
assert
isinstance
(
name
,
six
.
string_types
)
path
=
_get_path
(
name
)
return
len
(
path
)
>
0
def
_check_in_system_path
(
name
):
"""Check if if in the system path exists a file named (name)"""
path
=
_get_path
(
name
)
if
path
:
return
True
else
:
return
False
tool_info
=
self
.
_tool_info
if
path_mod
.
check_windows
():
bin_name
=
tool_info
[
'windows_bin'
]
else
:
bin_name
=
tool_info
[
'linux_bin'
]
name
=
tool_info
[
'name'
]
logging
.
debug
(
"Checking if "
+
name
+
" tool is available on PATH"
)
if
self
.
top_module
.
manifest_dict
[
path_key
]
is
not
None
:
if
_is_in_path
(
bin_name
,
self
.
top_module
.
manifest_dict
[
path_key
]):
logging
.
info
(
"
%
s found under HDLMAKE_
%
s:
%
s"
,
name
,
path_key
.
upper
(),
self
.
top_module
.
manifest_dict
[
path_key
])
else
:
logging
.
warning
(
"
%
s NOT found under HDLMAKE_
%
s:
%
s"
,
name
,
path_key
.
upper
(),
self
.
top_module
.
manifest_dict
[
path_key
])
else
:
if
_check_in_system_path
(
bin_name
):
self
.
top_module
.
manifest_dict
[
path_key
]
=
_get_path
(
bin_name
)
logging
.
info
(
"
%
s found in system PATH:
%
s"
,
name
,
self
.
top_module
.
manifest_dict
[
path_key
])
else
:
logging
.
warning
(
"
%
s cannnot be found in system PATH"
,
name
)
def
makefile_includes
(
self
):
"""Add the included makefiles that need to be previously loaded"""
for
file_aux
in
self
.
top_module
.
incl_makefiles
:
...
...
hdlmake/tools/modelsim.py
View file @
b65b0cf5
...
...
@@ -59,9 +59,9 @@ class ToolModelsim(VsimMakefileWriter):
def
makefile_sim_options
(
self
):
"""Print the Modelsim options to the Makefile"""
top_module
=
self
.
top_module
if
top_module
.
pool
.
env
[
"model
sim_path"
]:
if
top_module
.
manifest_dict
[
"
sim_path"
]:
modelsim_ini_path
=
os
.
path
.
join
(
top_module
.
pool
.
env
[
"model
sim_path"
],
top_module
.
manifest_dict
[
"
sim_path"
],
".."
)
else
:
modelsim_ini_path
=
os
.
path
.
join
(
"$(HDLMAKE_MODELSIM_PATH)"
,
".."
)
...
...
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