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
8d5b4529
Commit
8d5b4529
authored
May 24, 2017
by
Javier D. Garcia-Lasheras
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor how the fileset is built and managed
parent
a67c8fde
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
64 additions
and
41 deletions
+64
-41
action.py
hdlmake/action/action.py
+33
-10
core.py
hdlmake/action/core.py
+12
-3
make_sim.py
hdlmake/tools/make_sim.py
+3
-11
make_syn.py
hdlmake/tools/make_syn.py
+4
-17
makefile.py
hdlmake/tools/makefile.py
+12
-0
No files found.
hdlmake/action/action.py
View file @
8d5b4529
...
@@ -33,6 +33,7 @@ from hdlmake import shell
...
@@ -33,6 +33,7 @@ from hdlmake import shell
from
hdlmake.util.termcolor
import
colored
from
hdlmake.util.termcolor
import
colored
from
hdlmake
import
new_dep_solver
as
dep_solver
from
hdlmake
import
new_dep_solver
as
dep_solver
from
hdlmake
import
fetch
as
fetch_mod
from
hdlmake
import
fetch
as
fetch_mod
from
hdlmake.srcfile
import
SourceFileSet
def
set_logging_level
(
options
):
def
set_logging_level
(
options
):
...
@@ -65,6 +66,8 @@ class Action(list):
...
@@ -65,6 +66,8 @@ class Action(list):
def
__init__
(
self
,
options
):
def
__init__
(
self
,
options
):
super
(
Action
,
self
)
.
__init__
()
super
(
Action
,
self
)
.
__init__
()
self
.
top_module
=
None
self
.
top_module
=
None
self
.
parseable_fileset
=
SourceFileSet
()
self
.
privative_fileset
=
SourceFileSet
()
self
.
_deps_solved
=
False
self
.
_deps_solved
=
False
self
.
options
=
options
self
.
options
=
options
set_logging_level
(
options
)
set_logging_level
(
options
)
...
@@ -76,10 +79,13 @@ class Action(list):
...
@@ -76,10 +79,13 @@ class Action(list):
action
=
self
.
config
.
get
(
"action"
)
action
=
self
.
config
.
get
(
"action"
)
if
action
==
None
:
if
action
==
None
:
self
.
tool
=
None
self
.
tool
=
None
self
.
top_entity
=
None
elif
action
==
"simulation"
:
elif
action
==
"simulation"
:
self
.
tool
=
load_sim_tool
(
self
.
config
.
get
(
"sim_tool"
))
self
.
tool
=
load_sim_tool
(
self
.
config
.
get
(
"sim_tool"
))
self
.
top_entity
=
self
.
config
.
get
(
"sim_top"
)
elif
action
==
"synthesis"
:
elif
action
==
"synthesis"
:
self
.
tool
=
load_syn_tool
(
self
.
config
.
get
(
"syn_tool"
))
self
.
tool
=
load_syn_tool
(
self
.
config
.
get
(
"syn_tool"
))
self
.
top_entity
=
self
.
config
.
get
(
"syn_top"
)
else
:
else
:
logging
.
error
(
"Unknown requested action:
%
s"
,
action
)
logging
.
error
(
"Unknown requested action:
%
s"
,
action
)
quit
()
quit
()
...
@@ -132,25 +138,42 @@ class Action(list):
...
@@ -132,25 +138,42 @@ class Action(list):
def
build_complete_file_set
(
self
):
def
build_complete_file_set
(
self
):
"""Build file set with all the files listed in the complete pool"""
"""Build file set with all the files listed in the complete pool"""
logging
.
debug
(
"Begin build complete file set"
)
logging
.
debug
(
"Begin build complete file set"
)
from
hdlmake.srcfile
import
SourceFileSet
all_manifested_files
=
SourceFileSet
()
all_manifested_files
=
SourceFileSet
()
for
module
in
self
:
for
module
in
self
:
all_manifested_files
.
add
(
module
.
files
)
all_manifested_files
.
add
(
module
.
files
)
logging
.
debug
(
"End build complete file set"
)
logging
.
debug
(
"End build complete file set"
)
return
all_manifested_files
return
all_manifested_files
def
build_file_set
(
self
,
top_entity
=
None
,
standard_libs
=
None
):
def
solve_file_set
(
self
):
"""Build file set with only those files required by the top entity"""
"""Build file set with only those files required by the top entity"""
logging
.
debug
(
"Begin build file set for
%
s"
,
top_entity
)
all_files
=
self
.
build_complete_file_set
()
if
not
self
.
_deps_solved
:
if
not
self
.
_deps_solved
:
dep_solver
.
solve
(
all_files
,
standard_libs
=
standard_libs
)
dep_solver
.
solve
(
self
.
parseable_fileset
,
self
.
tool
.
get_standard_libs
())
self
.
_deps_solved
=
True
self
.
_deps_solved
=
True
from
hdlmake.srcfile
import
SourceFileSet
solved_files
=
SourceFileSet
()
source_files
=
SourceFileSet
()
solved_files
.
add
(
dep_solver
.
make_dependency_set
(
source_files
.
add
(
dep_solver
.
make_dependency_set
(
all_files
,
top_entity
))
self
.
parseable_fileset
,
self
.
top_entity
))
logging
.
debug
(
"End build file set"
)
self
.
parseable_fileset
=
solved_files
return
source_files
def
build_file_set
(
self
):
"""Initialize the parseable and privative fileset contents"""
total_files
=
self
.
build_complete_file_set
()
for
file_aux
in
total_files
:
if
any
(
isinstance
(
file_aux
,
file_type
)
for
file_type
in
self
.
tool
.
get_privative_files
()):
self
.
privative_fileset
.
add
(
file_aux
)
elif
any
(
isinstance
(
file_aux
,
file_type
)
for
file_type
in
self
.
tool
.
get_parseable_files
()):
self
.
parseable_fileset
.
add
(
file_aux
)
else
:
logging
.
error
(
"File not supported by the tool:
%
s"
,
file_aux
.
path
)
if
len
(
self
.
privative_fileset
)
>
0
:
logging
.
info
(
"Detected
%
d supported files that are not parseable"
,
len
(
self
.
privative_fileset
))
if
len
(
self
.
parseable_fileset
)
>
0
:
logging
.
info
(
"Detected
%
d supported files that can be parsed"
,
len
(
self
.
parseable_fileset
))
def
get_top_module
(
self
):
def
get_top_module
(
self
):
"""Get the Top module from the pool"""
"""Get the Top module from the pool"""
...
...
hdlmake/action/core.py
View file @
8d5b4529
...
@@ -61,7 +61,13 @@ class ActionCore(Action):
...
@@ -61,7 +61,13 @@ class ActionCore(Action):
def
makefile
(
self
):
def
makefile
(
self
):
"""Write the Makefile for the current design"""
"""Write the Makefile for the current design"""
self
.
_check_all_fetched_or_quit
()
self
.
_check_all_fetched_or_quit
()
self
.
tool
.
write_makefile
(
self
)
self
.
build_file_set
()
self
.
solve_file_set
()
combined_fileset
=
self
.
parseable_fileset
combined_fileset
.
add
(
self
.
privative_fileset
)
self
.
tool
.
write_makefile
(
self
.
config
,
combined_fileset
,
filename
=
self
.
options
.
filename
)
def
_fetch_all
(
self
):
def
_fetch_all
(
self
):
"""Fetch all the modules declared in the design"""
"""Fetch all the modules declared in the design"""
...
@@ -141,8 +147,11 @@ class ActionCore(Action):
...
@@ -141,8 +147,11 @@ class ActionCore(Action):
for
mod_aux
in
unfetched_modules
:
for
mod_aux
in
unfetched_modules
:
logging
.
warning
(
logging
.
warning
(
"List incomplete, module
%
s has not been fetched!"
,
mod_aux
)
"List incomplete, module
%
s has not been fetched!"
,
mod_aux
)
file_set
=
self
.
build_file_set
(
top_entity
=
self
.
options
.
top
)
self
.
top_entity
=
self
.
options
.
top
file_list
=
dep_solver
.
make_dependency_sorted_list
(
file_set
)
self
.
build_file_set
()
self
.
solve_file_set
()
file_list
=
dep_solver
.
make_dependency_sorted_list
(
self
.
parseable_fileset
)
files_str
=
[
file_aux
.
path
for
file_aux
in
file_list
]
files_str
=
[
file_aux
.
path
for
file_aux
in
file_list
]
if
self
.
options
.
reverse
is
True
:
if
self
.
options
.
reverse
is
True
:
files_str
.
reverse
()
files_str
.
reverse
()
...
...
hdlmake/tools/make_sim.py
View file @
8d5b4529
...
@@ -9,7 +9,6 @@ import logging
...
@@ -9,7 +9,6 @@ import logging
from
.makefile
import
ToolMakefile
from
.makefile
import
ToolMakefile
from
hdlmake
import
shell
from
hdlmake
import
shell
from
hdlmake.srcfile
import
VerilogFile
,
VHDLFile
,
SVFile
from
hdlmake.srcfile
import
VerilogFile
,
VHDLFile
,
SVFile
from
hdlmake.dep_file
import
DepFile
def
_check_simulation_manifest
(
manifest_dict
):
def
_check_simulation_manifest
(
manifest_dict
):
...
@@ -30,17 +29,10 @@ class ToolSim(ToolMakefile):
...
@@ -30,17 +29,10 @@ class ToolSim(ToolMakefile):
super
(
ToolSim
,
self
)
.
__init__
()
super
(
ToolSim
,
self
)
.
__init__
()
self
.
_simulator_controls
=
{}
self
.
_simulator_controls
=
{}
def
write_makefile
(
self
,
pool
):
def
write_makefile
(
self
,
config
,
fileset
,
filename
=
None
):
"""Execute the simulation action"""
"""Execute the simulation action"""
_check_simulation_manifest
(
pool
.
config
)
_check_simulation_manifest
(
config
)
fset
=
pool
.
build_file_set
(
self
.
makefile_setup
(
config
,
fileset
,
filename
=
filename
)
pool
.
config
.
get
(
"sim_top"
),
standard_libs
=
self
.
_standard_libs
)
# Filter the not parseable files!
dep_files
=
fset
.
filter
(
DepFile
)
# dep_solver.solve(dep_files)
self
.
makefile_setup
(
pool
.
config
,
dep_files
,
filename
=
pool
.
options
.
filename
)
self
.
makefile_check_tool
(
'sim_path'
)
self
.
makefile_check_tool
(
'sim_path'
)
self
.
makefile_sim_top
()
self
.
makefile_sim_top
()
self
.
makefile_sim_options
()
self
.
makefile_sim_options
()
...
...
hdlmake/tools/make_syn.py
View file @
8d5b4529
...
@@ -39,24 +39,11 @@ class ToolSyn(ToolMakefile):
...
@@ -39,24 +39,11 @@ class ToolSyn(ToolMakefile):
def
__init__
(
self
):
def
__init__
(
self
):
super
(
ToolSyn
,
self
)
.
__init__
()
super
(
ToolSyn
,
self
)
.
__init__
()
def
write_makefile
(
self
,
pool
):
def
write_makefile
(
self
,
config
,
fileset
,
filename
=
None
):
"""Generate a Makefile for the specific synthesis tool"""
"""Generate a Makefile for the specific synthesis tool"""
_check_synthesis_manifest
(
pool
.
config
)
_check_synthesis_manifest
(
config
)
fileset
=
pool
.
build_file_set
(
self
.
makefile_setup
(
config
,
fileset
,
pool
.
config
[
"syn_top"
],
filename
=
filename
)
standard_libs
=
self
.
_standard_libs
)
sup_files
=
pool
.
build_complete_file_set
()
privative_files
=
[]
for
file_aux
in
sup_files
:
if
any
(
isinstance
(
file_aux
,
file_type
)
for
file_type
in
self
.
_supported_files
):
privative_files
.
append
(
file_aux
)
if
len
(
privative_files
)
>
0
:
logging
.
info
(
"Detected
%
d supported files that are not parseable"
,
len
(
privative_files
))
fileset
.
add
(
privative_files
)
self
.
makefile_setup
(
pool
.
config
,
fileset
,
filename
=
pool
.
options
.
filename
)
self
.
makefile_check_tool
(
'syn_path'
)
self
.
makefile_check_tool
(
'syn_path'
)
self
.
makefile_includes
()
self
.
makefile_includes
()
self
.
makefile_syn_top
()
self
.
makefile_syn_top
()
...
...
hdlmake/tools/makefile.py
View file @
8d5b4529
...
@@ -53,6 +53,18 @@ class ToolMakefile(object):
...
@@ -53,6 +53,18 @@ class ToolMakefile(object):
if
self
.
_file
:
if
self
.
_file
:
self
.
_file
.
close
()
self
.
_file
.
close
()
def
get_standard_libs
(
self
):
"""Get the standard libs supported by the tool"""
return
self
.
_standard_libs
def
get_parseable_files
(
self
):
"""Get the parseable HDL file types supported by the tool"""
return
self
.
_hdl_files
def
get_privative_files
(
self
):
"""Get the privative format file types supported by the tool"""
return
self
.
_supported_files
def
makefile_setup
(
self
,
manifest_project_dict
,
fileset
,
filename
=
None
):
def
makefile_setup
(
self
,
manifest_project_dict
,
fileset
,
filename
=
None
):
"""Set the Makefile configuration"""
"""Set the Makefile configuration"""
self
.
manifest_dict
=
manifest_project_dict
self
.
manifest_dict
=
manifest_project_dict
...
...
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